summaryrefslogtreecommitdiff
path: root/tools/render-test/shader-input-layout.h
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2017-10-24 19:14:14 -0400
committerGitHub <noreply@github.com>2017-10-24 19:14:14 -0400
commit3043171dae37d18015d6cd26287d492c576f4f1a (patch)
tree1037732c1e90afd36b588851ce5755d64188bcdb /tools/render-test/shader-input-layout.h
parentab64cf2ec05980d72cb2bad45e629d10ebbefdc1 (diff)
parent434d3428932ccaa0f6834d03c37adcab37d17a01 (diff)
Merge pull request #227 from csyonghe/master
Extending render-test to support various resource inputs
Diffstat (limited to 'tools/render-test/shader-input-layout.h')
-rw-r--r--tools/render-test/shader-input-layout.h61
1 files changed, 61 insertions, 0 deletions
diff --git a/tools/render-test/shader-input-layout.h b/tools/render-test/shader-input-layout.h
new file mode 100644
index 000000000..f2258b7b9
--- /dev/null
+++ b/tools/render-test/shader-input-layout.h
@@ -0,0 +1,61 @@
+#ifndef SLANG_TEST_SHADER_INPUT_LAYOUT_H
+#define SLANG_TEST_SHADER_INPUT_LAYOUT_H
+
+#include "core/basic.h"
+
+namespace renderer_test
+{
+ enum class ShaderInputType
+ {
+ Buffer, Texture, Sampler, CombinedTextureSampler
+ };
+ enum class InputTextureContent
+ {
+ Zero, One, ChessBoard, Gradient
+ };
+ struct InputTextureDesc
+ {
+ int dimension = 2;
+ int arrayLength = 0;
+ bool isCube = false;
+ bool isDepthTexture = false;
+ bool isRWTexture = false;
+ int size = 4;
+ InputTextureContent content = InputTextureContent::One;
+ };
+ enum class InputBufferType
+ {
+ ConstantBuffer, StorageBuffer
+ };
+ struct InputBufferDesc
+ {
+ InputBufferType type = InputBufferType::ConstantBuffer;
+ int stride = 0; // stride == 0 indicates an unstructured buffer.
+ };
+ struct InputSamplerDesc
+ {
+ bool isCompareSampler = false;
+ };
+ class ShaderInputLayoutEntry
+ {
+ public:
+ ShaderInputType type;
+ Slang::List<unsigned int> bufferData;
+ InputTextureDesc textureDesc;
+ InputBufferDesc bufferDesc;
+ InputSamplerDesc samplerDesc;
+ bool isOutput = false;
+ int hlslBinding = -1;
+ int glslBinding = -1;
+ int glslLocation = -1;
+ };
+ class ShaderInputLayout
+ {
+ public:
+ Slang::List<ShaderInputLayoutEntry> entries;
+ int numRenderTargets = 1;
+ void Parse(const char * source);
+ };
+}
+
+#endif \ No newline at end of file