diff options
| author | Tim Foley <tfoleyNV@users.noreply.github.com> | 2017-06-12 12:28:12 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-06-12 12:28:12 -0700 |
| commit | d1f11a29f8a48eecd47ac64c8635ed062cba982d (patch) | |
| tree | b929d3d7f77da2ba538846f598e7eeb0a302b0cc /tools/render-test/render-d3d11.cpp | |
| parent | 4d63b6fe73018ae253bbef0075478f5989ad279a (diff) | |
| parent | 5fe2cf3279c279750d4821a9fa97bdbbe876e568 (diff) | |
Merge pull request #2 from tfoleyNV/glsl-render-test
GLSL: get GLSL limping in `render-test`
Diffstat (limited to 'tools/render-test/render-d3d11.cpp')
| -rw-r--r-- | tools/render-test/render-d3d11.cpp | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/tools/render-test/render-d3d11.cpp b/tools/render-test/render-d3d11.cpp index ab981bd45..4f1071905 100644 --- a/tools/render-test/render-d3d11.cpp +++ b/tools/render-test/render-d3d11.cpp @@ -362,6 +362,13 @@ ID3DBlob* compileHLSLShader( flags |= D3DCOMPILE_DEBUG; flags |= D3DCOMPILE_OPTIMIZATION_LEVEL0 | D3DCOMPILE_SKIP_OPTIMIZATION; + // We will always define `__HLSL__` when compiling here, so that + // input code can react differently to being compiled as pure HLSL. + D3D_SHADER_MACRO defines[] = { + { "__HLSL__", "1" }, + { nullptr, nullptr }, + }; + // The `D3DCompile` entry point takes a bunch of parameters, but we // don't really need most of them for Slang-generated code. ID3DBlob* dxShaderBlob = nullptr; @@ -370,7 +377,7 @@ ID3DBlob* compileHLSLShader( source, strlen(source), sourcePath, - nullptr, + &defines[0], nullptr, entryPointName, dxProfileName, @@ -383,8 +390,14 @@ ID3DBlob* compileHLSLShader( // then we will print them out (whether or not the compilation failed). if( dxErrorBlob ) { + fputs( + (char const*)dxErrorBlob->GetBufferPointer(), + stderr); + fflush(stderr); + OutputDebugStringA( (char const*)dxErrorBlob->GetBufferPointer()); + dxErrorBlob->Release(); } @@ -523,7 +536,13 @@ public: DXGI_SWAP_CHAIN_DESC dxSwapChainDesc = { 0 }; dxSwapChainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; - dxSwapChainDesc.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM_SRGB; + + // Note(tfoley): Disabling sRGB for DX back buffer for now, so that we + // can get consistent output with OpenGL, where setting up sRGB will + // probably be more involved. +// dxSwapChainDesc.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM_SRGB; + dxSwapChainDesc.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; + dxSwapChainDesc.SampleDesc.Count = 1; dxSwapChainDesc.SampleDesc.Quality = 0; dxSwapChainDesc.BufferCount = 2; @@ -601,12 +620,17 @@ public: dxImmediateContext->RSSetViewports(1, &dxViewport); } + float clearColor[4] = { 0, 0, 0, 0 }; + virtual void setClearColor(float const* color) override + { + memcpy(clearColor, color, sizeof(clearColor)); + } + virtual void clearFrame() override { - static const float kClearColor[] = { 0.25, 0.25, 0.25, 1.0 }; dxImmediateContext->ClearRenderTargetView( dxBackBufferRTV, - kClearColor); + clearColor); } virtual void presentFrame() override |
