summaryrefslogtreecommitdiffstats
path: root/examples/triangle
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 /examples/triangle
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 'examples/triangle')
-rw-r--r--examples/triangle/main.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/examples/triangle/main.cpp b/examples/triangle/main.cpp
index 51d355e50..a81a105ab 100644
--- a/examples/triangle/main.cpp
+++ b/examples/triangle/main.cpp
@@ -227,6 +227,7 @@ Slang::Result initialize()
{ "COLOR", 0, Format::R32G32B32_FLOAT, offsetof(Vertex, color) },
};
auto inputLayout = gDevice->createInputLayout(
+ sizeof(Vertex),
&inputElements[0],
2);
if(!inputLayout) return SLANG_FAIL;
@@ -373,7 +374,7 @@ virtual void renderFrame(int frameBufferIndex) override
// We also need to set up a few pieces of fixed-function pipeline
// state that are not bound by the pipeline state above.
//
- renderEncoder->setVertexBuffer(0, gVertexBuffer, sizeof(Vertex));
+ renderEncoder->setVertexBuffer(0, gVertexBuffer);
renderEncoder->setPrimitiveTopology(PrimitiveTopology::TriangleList);
// Finally, we are ready to issue a draw call for a single triangle.