From 0ee4d4b54732239b946bae7fde32bb21aa5a3ec3 Mon Sep 17 00:00:00 2001 From: "YONGH\\yongh" Date: Fri, 20 Oct 2017 18:24:30 -0400 Subject: in-progress work: allow render-test to generate and bind various resource inputs for running test shaders with arbitrary parameter definitions. This commit contains the parser of the resource input definition. --- tools/render-test/shader-input-layout.h | 52 +++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 tools/render-test/shader-input-layout.h (limited to 'tools/render-test/shader-input-layout.h') diff --git a/tools/render-test/shader-input-layout.h b/tools/render-test/shader-input-layout.h new file mode 100644 index 000000000..788a72224 --- /dev/null +++ b/tools/render-test/shader-input-layout.h @@ -0,0 +1,52 @@ +#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 + }; + struct InputTextureDesc + { + int dimension = 2; + int arrayLength = 0; + bool isCube = false; + bool isDepthTexture = false; + }; + 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 bufferData; + InputTextureDesc textureDesc; + InputBufferDesc bufferDesc; + InputSamplerDesc samplerDesc; + int hlslRegister = -1; + int glslBinding = -1; + int glslLocation = -1; + }; + class ShaderInputLayout + { + public: + Slang::List entries; + void Parse(const char * source); + }; +} + +#endif \ No newline at end of file -- cgit v1.2.3