summaryrefslogtreecommitdiff
path: root/tools/gfx/immediate-renderer-base.h
diff options
context:
space:
mode:
authorlucy96chen <47800040+lucy96chen@users.noreply.github.com>2022-01-10 11:00:50 -0800
committerGitHub <noreply@github.com>2022-01-10 11:00:50 -0800
commitaee4aa3528072e4b5e95ccc4e571868716b47d50 (patch)
tree3621d7e5cd67e09581d7fe001e359df12167889b /tools/gfx/immediate-renderer-base.h
parent8919c19440dea9a62578905d365fe80bcd58e316 (diff)
Draw call tests for Vulkan (#2073)
* Added instancing support to Vulkan, drawInstanced() test image is upside-down * Fixed inverted drawInstanced() test output by changing Vulkan viewport convention * Replaced vkCmdDraw with vkCmdDrawIndexed in all non-indirect indexed draws, drawIndexedIndirect test now working for Vulkan * Moved index and vertex buffer binding into setIndexBuffer and setVertexBuffers; Defaulted countBuffer to nullptr and countOffset to 0 and added a check for non-null countBuffer to drawIndirect and drawIndexedIndirect in Vulkan; All Vulkan draw tests working (but D3D12 tests broken) * Added support for drawInstanced and drawIndexedInstanced to D3D11 and added tests for both, however D3D11 tests are currently disabled due to readTextureResource assuming a fixed pixel size (among other possible problems); Fixed issues causing D3D12 tests to fail after major back-end fixes to get Vulkan up and running * Removed testing function for dumping images and some other commented out code * Removed some commented out code * Fix initializer list causing builds to fail (attempt 1) * Removed initializer list for VertexStreamDesc in createInputLayout() and fill in struct fields normally (build fix attempt 2) * Removed default values from VertexStreamDesc and changed all initializer lists to reflect this change * Moved applyBinding before setVertexBuffer in RenderTestApp::renderFrame() to ensure the pipeline has already been bound before vertex buffers are * Changed D3D11's readTextureResource to calculate pixel size using format-specific size information; Removed wrapper around D3D11 instanced and indexed instanced draw tests
Diffstat (limited to 'tools/gfx/immediate-renderer-base.h')
-rw-r--r--tools/gfx/immediate-renderer-base.h45
1 files changed, 38 insertions, 7 deletions
diff --git a/tools/gfx/immediate-renderer-base.h b/tools/gfx/immediate-renderer-base.h
index 19186d0f2..f7530d985 100644
--- a/tools/gfx/immediate-renderer-base.h
+++ b/tools/gfx/immediate-renderer-base.h
@@ -63,13 +63,23 @@ public:
uint32_t startSlot,
uint32_t slotCount,
IBufferResource* const* buffers,
- const uint32_t* strides,
const uint32_t* offsets) = 0;
virtual void setIndexBuffer(
IBufferResource* buffer, Format indexFormat, uint32_t offset = 0) = 0;
virtual void draw(uint32_t vertexCount, uint32_t startVertex = 0) = 0;
virtual void drawIndexed(
uint32_t indexCount, uint32_t startIndex = 0, uint32_t baseVertex = 0) = 0;
+ virtual void drawInstanced(
+ uint32_t vertexCount,
+ uint32_t instanceCount,
+ uint32_t startVertex,
+ uint32_t startInstanceLocation) = 0;
+ virtual void drawIndexedInstanced(
+ uint32_t indexCount,
+ uint32_t instanceCount,
+ uint32_t startIndexLocation,
+ int32_t baseVertexLocation,
+ uint32_t startInstanceLocation) = 0;
virtual void setStencilReference(uint32_t referenceValue) = 0;
virtual void dispatchCompute(int x, int y, int z) = 0;
virtual void copyBuffer(
@@ -142,13 +152,11 @@ public:
uint32_t startSlot,
uint32_t slotCount,
IBufferResource* const* buffers,
- const uint32_t* strides,
const uint32_t* offsets) override
{
SLANG_UNUSED(startSlot);
SLANG_UNUSED(slotCount);
SLANG_UNUSED(buffers);
- SLANG_UNUSED(strides);
SLANG_UNUSED(offsets);
}
virtual void setIndexBuffer(
@@ -171,6 +179,31 @@ public:
SLANG_UNUSED(startIndex);
SLANG_UNUSED(baseVertex);
}
+ virtual void drawInstanced(
+ uint32_t vertexCount,
+ uint32_t instanceCount,
+ uint32_t startVertex,
+ uint32_t startInstanceLocation) override
+ {
+ SLANG_UNUSED(vertexCount);
+ SLANG_UNUSED(instanceCount);
+ SLANG_UNUSED(startVertex);
+ SLANG_UNUSED(startInstanceLocation);
+ }
+
+ virtual void drawIndexedInstanced(
+ uint32_t indexCount,
+ uint32_t instanceCount,
+ uint32_t startIndexLocation,
+ int32_t baseVertexLocation,
+ uint32_t startInstanceLocation) override
+ {
+ SLANG_UNUSED(indexCount);
+ SLANG_UNUSED(instanceCount);
+ SLANG_UNUSED(startIndexLocation);
+ SLANG_UNUSED(baseVertexLocation);
+ SLANG_UNUSED(startInstanceLocation);
+ }
virtual void setStencilReference(uint32_t referenceValue) override
{
SLANG_UNUSED(referenceValue);
@@ -211,12 +244,10 @@ public:
}
virtual SLANG_NO_THROW Result SLANG_MCALL createInputLayout(
- const InputElementDesc* inputElements,
- UInt inputElementCount,
+ IInputLayout::Desc const& desc,
IInputLayout** outLayout) override
{
- SLANG_UNUSED(inputElements);
- SLANG_UNUSED(inputElementCount);
+ SLANG_UNUSED(desc);
SLANG_UNUSED(outLayout);
return SLANG_E_NOT_AVAILABLE;
}