summaryrefslogtreecommitdiffstats
path: root/tools/render-test/main.cpp
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2018-04-17 16:59:03 -0400
committerGitHub <noreply@github.com>2018-04-17 16:59:03 -0400
commit00389a127af8db18a3ec8fe7ad2dd114a65ac024 (patch)
tree7fa57f2f30a399f03a7967a8534eb212744de5cc /tools/render-test/main.cpp
parent15bff9162530113b426664eb0c1deb7ea9e3a90d (diff)
Feature/renderer binding (#489)
* 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.
Diffstat (limited to 'tools/render-test/main.cpp')
-rw-r--r--tools/render-test/main.cpp26
1 files changed, 12 insertions, 14 deletions
diff --git a/tools/render-test/main.cpp b/tools/render-test/main.cpp
index 12160ae78..acc7ffb78 100644
--- a/tools/render-test/main.cpp
+++ b/tools/render-test/main.cpp
@@ -73,11 +73,11 @@ class RenderTestApp
RefPtr<Renderer> m_renderer;
- RefPtr<Buffer> m_constantBuffer;
- RefPtr<InputLayout> m_inputLayout;
- RefPtr<Buffer> m_vertexBuffer;
- RefPtr<ShaderProgram> m_shaderProgram;
- RefPtr<BindingState> m_bindingState;
+ RefPtr<BufferResource> m_constantBuffer;
+ RefPtr<InputLayout> m_inputLayout;
+ RefPtr<BufferResource> m_vertexBuffer;
+ RefPtr<ShaderProgram> m_shaderProgram;
+ RefPtr<BindingState> m_bindingState;
ShaderInputLayout m_shaderInputLayout;
};
@@ -106,11 +106,11 @@ SlangResult RenderTestApp::initialize(Renderer* renderer, ShaderCompiler* shader
// TODO(tfoley): use each API's reflection interface to query the constant-buffer size needed
m_constantBufferSize = 16 * sizeof(float);
- BufferDesc constantBufferDesc;
- constantBufferDesc.size = m_constantBufferSize;
- constantBufferDesc.flavor = BufferFlavor::Constant;
+ BufferResource::Desc constantBufferDesc;
+ constantBufferDesc.init(m_constantBufferSize);
+ constantBufferDesc.cpuAccessFlags = Resource::AccessFlag::Write;
- m_constantBuffer = renderer->createBuffer(constantBufferDesc);
+ m_constantBuffer = renderer->createBufferResource(Resource::Usage::ConstantBuffer, constantBufferDesc);
if(!m_constantBuffer)
return SLANG_FAIL;
@@ -126,12 +126,10 @@ SlangResult RenderTestApp::initialize(Renderer* renderer, ShaderCompiler* shader
if(!m_inputLayout)
return SLANG_FAIL;
- BufferDesc vertexBufferDesc;
- vertexBufferDesc.size = kVertexCount * sizeof(Vertex);
- vertexBufferDesc.flavor = BufferFlavor::Vertex;
- vertexBufferDesc.initData = &kVertexData[0];
+ BufferResource::Desc vertexBufferDesc;
+ vertexBufferDesc.init(kVertexCount * sizeof(Vertex));
- m_vertexBuffer = renderer->createBuffer(vertexBufferDesc);
+ m_vertexBuffer = renderer->createBufferResource(Resource::Usage::VertexBuffer, vertexBufferDesc, kVertexData);
if(!m_vertexBuffer)
return SLANG_FAIL;