diff options
| author | Yong He <yonghe@outlook.com> | 2017-10-25 23:16:53 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-10-25 23:16:53 -0400 |
| commit | 56bc82656c2b2cd581a430713bc25b409bb4da4f (patch) | |
| tree | f5e667617ae8dd1853d4977ec13c153e9fafca0e /tools/render-test/main.cpp | |
| parent | 3043171dae37d18015d6cd26287d492c576f4f1a (diff) | |
| parent | 3a7dcf6d4d7a9c98ae769ad85f131c16802d1f72 (diff) | |
Merge pull request #230 from csyonghe/master
Finish up implementation of render-test
Diffstat (limited to 'tools/render-test/main.cpp')
| -rw-r--r-- | tools/render-test/main.cpp | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/tools/render-test/main.cpp b/tools/render-test/main.cpp index d3247e55f..cb0eb927d 100644 --- a/tools/render-test/main.cpp +++ b/tools/render-test/main.cpp @@ -37,13 +37,14 @@ struct Vertex { float position[3]; float color[3]; + float uv[2]; }; static const int kVertexCount = 3; static const Vertex kVertexData[kVertexCount] = { - { { 0, 0, 0.5 }, {1, 0, 0} }, - { { 0, 1, 0.5 }, {0, 0, 1} }, - { { 1, 0, 0.5 }, {0, 1, 0} }, + { { 0, 0, 0.5 }, {1, 0, 0} , {0, 0} }, + { { 0, 1, 0.5 }, {0, 0, 1} , {1, 0} }, + { { 1, 0, 0.5 }, {0, 1, 0} , {1, 1} }, }; @@ -65,9 +66,9 @@ static char const* computeEntryPointName = "computeMain"; // "Profile" to use when compiling for HLSL targets // TODO: does this belong here? -static char const* vertexProfileName = "vs_4_0"; -static char const* fragmentProfileName = "ps_4_0"; -static char const* computeProfileName = "cs_4_0"; +static char const* vertexProfileName = "vs_5_0"; +static char const* fragmentProfileName = "ps_5_0"; +static char const* computeProfileName = "cs_5_0"; Error initializeShaders( ShaderCompiler* shaderCompiler) @@ -101,7 +102,7 @@ Error initializeShaders( ShaderCompileRequest compileRequest; compileRequest.source = sourceInfo; - if (gOptions.shaderType == ShaderProgramType::Graphics) + if (gOptions.shaderType == ShaderProgramType::Graphics || gOptions.shaderType == ShaderProgramType::GraphicsCompute) { compileRequest.vertexShader.source = sourceInfo; compileRequest.vertexShader.name = vertexEntryPointName; @@ -157,9 +158,10 @@ Error initializeInner( InputElementDesc inputElements[] = { { "A", 0, Format::RGB_Float32, offsetof(Vertex, position) }, { "A", 1, Format::RGB_Float32, offsetof(Vertex, color) }, + { "A", 2, Format::RG_Float32, offsetof(Vertex, uv) }, }; - gInputLayout = renderer->createInputLayout(&inputElements[0], 2); + gInputLayout = renderer->createInputLayout(&inputElements[0], sizeof(inputElements)/sizeof(inputElements[0])); if(!gInputLayout) return Error::Unexpected; @@ -409,7 +411,7 @@ int main( // If we are in a mode where output is requested, we need to snapshot the back buffer here if (gOptions.outputPath) { - if (gOptions.shaderType == ShaderProgramType::Compute) + if (gOptions.shaderType == ShaderProgramType::Compute || gOptions.shaderType == ShaderProgramType::GraphicsCompute) renderer->serializeOutput(gBindingState, gOptions.outputPath); else renderer->captureScreenShot(gOptions.outputPath); |
