summaryrefslogtreecommitdiffstats
path: root/tools/render-test/main.cpp
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2018-04-19 17:47:04 -0400
committerTim Foley <tfoleyNV@users.noreply.github.com>2018-04-19 14:47:04 -0700
commit4c751df1680c30fac0369171a9b8dd4bb5bb5b9f (patch)
treeafde05a4cefd2b203add6b6ea8b94722d9734e11 /tools/render-test/main.cpp
parentcbedf01cc53b848dfcc086f04098ef438121a7c7 (diff)
Separation of Binding/Resource construction on Renderer interface (#508)
* Dx12 rendering works in test framework. * Turn on dx12 render tests. * First pass at Resource and TextureResource/BufferResource types. * Fix bug in Dx11 impl for BufferResource. * Dx12 supports TextureResource and binds using TextureResource type, and all tests pass. * Added TextureBuffer::Size type to make handling mips a little simpler. * Small improvements to Dx12 constant buffer binding Removed k prefix on an enum * First pass impl of dx11 createTextureResource Added setDefaults to TextureResource::Desc and BufferResource::Desc to simplify setup accessFlags -> cpuAccessFlags desc -> srcDesc * Split out generateTextureResource - can produce the texture using createTextureResource on the Renderer. * Added support for read mapping to Dx11 accessFlags -> cpuAccessFlags First pass at using TextureResource/BufferResource on Dx11 Some tests fail with this checkin * TextureResource working on all tests on dx11. * Construct ResourceBuffers on Dx11 and Dx12 using utility function createInputBufferResource. * First pass at OpenGl TextureResource * Small fixes to dx12 and dx11 setup. Gl working working using BufferResource and TextureResource * Tidy up around the compareSampler - looks like the previous test was incorrect. * Small documentation /naming improvements. * Fix some more small documentation issues. * First pass testing out construction of binding resources external to Renderer implementation. * Moved some BindingState::Desc types to BindingState to make easier to use. * First pass of binding using BindingState::Desc for Dx11. * First pass at binding with dx12. * Fixed issues around separating dx12 binding from ShaderInputLayout * First pass at OpenGl state binding. * BindingState::Desc::Binding::Type -> BindingType * Use Buffer to manage life of vk resources. Construction of buffers handled by createBufferResource (BindingState doesn't have specialized logic) * Remove InputLayout types from binding so can create a binding independent of it. * Added upload buffer to BufferResource - could be used for write mapping. * m_samplers -> m_samplerDescs. First pass at Vk binding with BindingState::Desc. Small tidy/doc improvements. * First pass with binding all taking place through BindingState::Desc. All tests pass. * Removed support for creating BindingState from ShaderInputLayout * Remove serializeOutput from Renderer interface and all implementations. Implement map/unmap on vulkan Implement serializeBindingOutput which uses map/unmap and BindingState::Desc to write result. * Make implementation of BindingState use the BindingState::Desc for much of state - only hold api specific in BindingDetail per implementation. * Use Glsl binding on vulkan (was using hlsl). * BindingState::Desc::Binding -> BindingState::Binding. Made possible by impls using 'BindingDetail' for their specific needs. * Fix compile problems on win32. * Fix a typo in name createBindingSetDesc -> createBindingStateDesc
Diffstat (limited to 'tools/render-test/main.cpp')
-rw-r--r--tools/render-test/main.cpp20
1 files changed, 18 insertions, 2 deletions
diff --git a/tools/render-test/main.cpp b/tools/render-test/main.cpp
index acc7ffb78..887ba4005 100644
--- a/tools/render-test/main.cpp
+++ b/tools/render-test/main.cpp
@@ -64,6 +64,8 @@ class RenderTestApp
BindingState* getBindingState() const { return m_bindingState; }
+ Result writeBindingOutput(const char* fileName);
+
protected:
/// Called in initialize
Result initializeShaders(ShaderCompiler* shaderCompiler);
@@ -99,7 +101,12 @@ SlangResult RenderTestApp::initialize(Renderer* renderer, ShaderCompiler* shader
m_renderer = renderer;
- m_bindingState = renderer->createBindingState(m_shaderInputLayout);
+ {
+ BindingState::Desc bindingStateDesc;
+ SLANG_RETURN_ON_FAIL(createBindingStateDesc(m_shaderInputLayout, m_renderer, bindingStateDesc));
+
+ m_bindingState = m_renderer->createBindingState(bindingStateDesc);
+ }
// Do other initialization that doesn't depend on the source language.
@@ -237,6 +244,11 @@ void RenderTestApp::finalize()
{
}
+Result RenderTestApp::writeBindingOutput(const char* fileName)
+{
+ return serializeBindingOutput(m_shaderInputLayout, m_bindingState, m_renderer, fileName);
+}
+
//
// We use a bare-minimum window procedure to get things up and running.
@@ -421,9 +433,13 @@ SlangResult innerMain(int argc, char** argv)
renderer->waitForGpu();
if (gOptions.shaderType == ShaderProgramType::Compute || gOptions.shaderType == ShaderProgramType::GraphicsCompute)
- renderer->serializeOutput(app.getBindingState(), gOptions.outputPath);
+ {
+ SLANG_RETURN_ON_FAIL(app.writeBindingOutput(gOptions.outputPath));
+ }
else
+ {
SLANG_RETURN_ON_FAIL(renderer->captureScreenShot(gOptions.outputPath));
+ }
return SLANG_OK;
}