summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngineD3DBase
diff options
context:
space:
mode:
authorazhirnov <zh1dron@gmail.com>2021-03-10 18:42:03 +0000
committerassiduous <assiduous@diligentgraphics.com>2021-03-19 00:38:21 +0000
commit8f85ab43928dfbbfea5630d5419049e6015c2d29 (patch)
treea7c6a64dee52c7cc84487f24e0b3f6e6c037b8b5 /Graphics/GraphicsEngineD3DBase
parentDirect3D11: added resource signature (diff)
downloadDiligentCore-8f85ab43928dfbbfea5630d5419049e6015c2d29.tar.gz
DiligentCore-8f85ab43928dfbbfea5630d5419049e6015c2d29.zip
Direct3D11: added BindPointsD3D11 instead of TBindPoints and TBindPointsAndActiveBits,
GetShaderResourceTypeAndFlags moved to D3DBase, added DvpVerifySRBResources() and DvpValidateCommittedResource()
Diffstat (limited to 'Graphics/GraphicsEngineD3DBase')
-rw-r--r--Graphics/GraphicsEngineD3DBase/include/D3DCommonTypeConversions.hpp3
-rw-r--r--Graphics/GraphicsEngineD3DBase/src/D3DCommonTypeConversions.cpp60
2 files changed, 62 insertions, 1 deletions
diff --git a/Graphics/GraphicsEngineD3DBase/include/D3DCommonTypeConversions.hpp b/Graphics/GraphicsEngineD3DBase/include/D3DCommonTypeConversions.hpp
index 1432dffc..f9db0fc3 100644
--- a/Graphics/GraphicsEngineD3DBase/include/D3DCommonTypeConversions.hpp
+++ b/Graphics/GraphicsEngineD3DBase/include/D3DCommonTypeConversions.hpp
@@ -31,10 +31,13 @@
/// Common D3D type conversions
#include "GraphicsTypes.h"
+#include "PipelineResourceSignature.h"
namespace Diligent
{
RESOURCE_DIMENSION D3DSrvDimensionToResourceDimension(D3D_SRV_DIMENSION SrvDim);
+void GetShaderResourceTypeAndFlags(const struct D3DShaderResourceAttribs& Attribs, SHADER_RESOURCE_TYPE& OutType, PIPELINE_RESOURCE_FLAGS& OutFlags);
+
} // namespace Diligent
diff --git a/Graphics/GraphicsEngineD3DBase/src/D3DCommonTypeConversions.cpp b/Graphics/GraphicsEngineD3DBase/src/D3DCommonTypeConversions.cpp
index fb5fa24f..5f8bf910 100644
--- a/Graphics/GraphicsEngineD3DBase/src/D3DCommonTypeConversions.cpp
+++ b/Graphics/GraphicsEngineD3DBase/src/D3DCommonTypeConversions.cpp
@@ -25,8 +25,9 @@
* of the possibility of such damages.
*/
-#include <d3dcommon.h>
+#include "ShaderResources.hpp"
#include "D3DCommonTypeConversions.hpp"
+#include <d3dcommon.h>
namespace Diligent
{
@@ -52,4 +53,61 @@ RESOURCE_DIMENSION D3DSrvDimensionToResourceDimension(D3D_SRV_DIMENSION SrvDim)
}
}
+void GetShaderResourceTypeAndFlags(const D3DShaderResourceAttribs& Attribs,
+ SHADER_RESOURCE_TYPE& OutType,
+ PIPELINE_RESOURCE_FLAGS& OutFlags)
+{
+ OutFlags = PIPELINE_RESOURCE_FLAG_UNKNOWN;
+
+ switch (int{Attribs.GetInputType()})
+ {
+ case D3D_SIT_CBUFFER:
+ OutType = SHADER_RESOURCE_TYPE_CONSTANT_BUFFER;
+ break;
+ case D3D_SIT_TBUFFER:
+ UNSUPPORTED("TBuffers are not supported");
+ OutType = SHADER_RESOURCE_TYPE_TEXTURE_SRV;
+ break;
+ case D3D_SIT_TEXTURE:
+ if (Attribs.GetSRVDimension() == D3D_SRV_DIMENSION_BUFFER)
+ {
+ OutType = SHADER_RESOURCE_TYPE_BUFFER_SRV;
+ OutFlags = PIPELINE_RESOURCE_FLAG_FORMATTED_BUFFER;
+ }
+ else
+ OutType = SHADER_RESOURCE_TYPE_TEXTURE_SRV;
+ break;
+ case D3D_SIT_SAMPLER:
+ OutType = SHADER_RESOURCE_TYPE_SAMPLER;
+ break;
+ case D3D_SIT_UAV_RWTYPED:
+ if (Attribs.GetSRVDimension() == D3D_SRV_DIMENSION_BUFFER)
+ {
+ OutType = SHADER_RESOURCE_TYPE_BUFFER_UAV;
+ OutFlags = PIPELINE_RESOURCE_FLAG_FORMATTED_BUFFER;
+ }
+ else
+ OutType = SHADER_RESOURCE_TYPE_TEXTURE_UAV;
+ break;
+ case D3D_SIT_STRUCTURED:
+ case D3D_SIT_BYTEADDRESS:
+ OutType = SHADER_RESOURCE_TYPE_BUFFER_SRV;
+ break;
+ case D3D_SIT_UAV_RWSTRUCTURED:
+ case D3D_SIT_UAV_RWBYTEADDRESS:
+ case D3D_SIT_UAV_APPEND_STRUCTURED:
+ case D3D_SIT_UAV_CONSUME_STRUCTURED:
+ case D3D_SIT_UAV_RWSTRUCTURED_WITH_COUNTER:
+ OutType = SHADER_RESOURCE_TYPE_BUFFER_UAV;
+ break;
+ case D3D_SIT_RTACCELERATIONSTRUCTURE:
+ OutType = SHADER_RESOURCE_TYPE_ACCEL_STRUCT;
+ break;
+ default:
+ UNEXPECTED("Unknown HLSL resource type");
+ OutType = SHADER_RESOURCE_TYPE_UNKNOWN;
+ break;
+ }
+}
+
} // namespace Diligent