summaryrefslogtreecommitdiffstats
path: root/tools/render-test/main.cpp
diff options
context:
space:
mode:
authorYONGH\yongh <yonghe@outlook.com>2017-10-20 18:24:30 -0400
committerYONGH\yongh <yonghe@outlook.com>2017-10-20 18:24:30 -0400
commit0ee4d4b54732239b946bae7fde32bb21aa5a3ec3 (patch)
tree0c5f4a7f6f43e60802d354aa98a3983994f4f4bd /tools/render-test/main.cpp
parent5a18dc704a2f5eecebcbdd77682a40ba8316d253 (diff)
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.
Diffstat (limited to 'tools/render-test/main.cpp')
-rw-r--r--tools/render-test/main.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/tools/render-test/main.cpp b/tools/render-test/main.cpp
index 6907ba40f..02b1963ff 100644
--- a/tools/render-test/main.cpp
+++ b/tools/render-test/main.cpp
@@ -5,7 +5,7 @@
#include "render-d3d11.h"
#include "render-gl.h"
#include "slang-support.h"
-
+#include "shader-input-layout.h"
#include <stdio.h>
#include <stdlib.h>
@@ -55,7 +55,9 @@ Buffer* gConstantBuffer;
InputLayout* gInputLayout;
Buffer* gVertexBuffer;
Buffer* gComputeResultBuffer;
-ShaderProgram* gShaderProgram;
+ShaderProgram* gShaderProgram;
+BindingState* gBindingState;
+ShaderInputLayout gShaderInputLayout;
// Entry point name to use for vertex/fragment shader
static char const* vertexEntryPointName = "vertexMain";
@@ -92,6 +94,8 @@ Error initializeShaders(
fclose(sourceFile);
sourceText[sourceSize] = 0;
+ gShaderInputLayout.Parse(sourceText);
+
ShaderCompileRequest::SourceInfo sourceInfo;
sourceInfo.path = sourcePath;
sourceInfo.text = sourceText;
@@ -144,6 +148,7 @@ Error initializeInner(
err = initializeShaders(shaderCompiler);
if(err != Error::None) return err;
+ gBindingState = renderer->createBindingState(gShaderInputLayout);
// Do other initialization that doesn't depend on the source language.
@@ -222,7 +227,7 @@ void renderFrameInner(
renderer->setShaderProgram(gShaderProgram);
renderer->setConstantBuffer(0, gConstantBuffer);
-
+ renderer->setBindingState(gBindingState);
//
renderer->draw(3);
@@ -232,6 +237,7 @@ void runCompute(Renderer * renderer)
{
renderer->setShaderProgram(gShaderProgram);
renderer->setStorageBuffer(0, gComputeResultBuffer);
+ renderer->setBindingState(gBindingState);
renderer->dispatchCompute(1, 1, 1);
}