summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorEllie Hermaszewska <ellieh@nvidia.com>2023-01-07 03:02:47 +0800
committerGitHub <noreply@github.com>2023-01-06 11:02:47 -0800
commite70cbe76ce74769069b7384f5f05c62da1ca45ed (patch)
tree83f2df1187ac229a19a3d56297621898472dfa1f /tools
parent7f64b2a9e3eb7aea13de550bd24c1aea7787c94b (diff)
Fix validation errors (and hang) in swapchain resize test (#2578)
* Use same format as swapchain for framebuffer in swapchain resize test * Use correct resource state for vertex buffer in swapchain resize test * Call acquireNextImage before drawing to fix validation error in swapchain resize test
Diffstat (limited to 'tools')
-rw-r--r--tools/gfx-unit-test/swap-chain-resize-test.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/tools/gfx-unit-test/swap-chain-resize-test.cpp b/tools/gfx-unit-test/swap-chain-resize-test.cpp
index 3940ebd6d..2be690077 100644
--- a/tools/gfx-unit-test/swap-chain-resize-test.cpp
+++ b/tools/gfx-unit-test/swap-chain-resize-test.cpp
@@ -45,7 +45,7 @@ namespace gfx_test
GfxCount width = 500;
GfxCount height = 500;
static const int kSwapchainImageCount = 2;
- const Format format = Format::R8G8B8A8_UNORM;
+ const Format desiredFormat = Format::R8G8B8A8_UNORM;
void init(IDevice* device, UnitTestContext* context)
{
@@ -96,7 +96,7 @@ namespace gfx_test
queue = device->createCommandQueue(queueDesc);
ISwapchain::Desc swapchainDesc = {};
- swapchainDesc.format = Format::R8G8B8A8_UNORM;
+ swapchainDesc.format = desiredFormat;
swapchainDesc.width = width;
swapchainDesc.height = height;
swapchainDesc.imageCount = kSwapchainImageCount;
@@ -127,7 +127,7 @@ namespace gfx_test
IBufferResource::Desc vertexBufferDesc;
vertexBufferDesc.type = IResource::Type::Buffer;
vertexBufferDesc.sizeInBytes = kVertexCount * sizeof(Vertex);
- vertexBufferDesc.defaultState = ResourceState::ShaderResource;
+ vertexBufferDesc.defaultState = ResourceState::VertexBuffer;
vertexBuffer = device->createBufferResource(vertexBufferDesc, &kVertexData[0]);
SLANG_CHECK_ABORT(vertexBuffer != nullptr);
@@ -141,7 +141,7 @@ namespace gfx_test
GFX_CHECK_CALL_ABORT(loadGraphicsProgram(device, shaderProgram, "swapchain-shader", "vertexMain", "fragmentMain", slangReflection));
IFramebufferLayout::TargetLayout targetLayout;
- targetLayout.format = format;
+ targetLayout.format = swapchain->getDesc().format;
targetLayout.sampleCount = 1;
IFramebufferLayout::Desc framebufferLayoutDesc;
@@ -189,6 +189,7 @@ namespace gfx_test
encoder->setVertexBuffer(0, vertexBuffer);
encoder->setPrimitiveTopology(PrimitiveTopology::TriangleList);
+ swapchain->acquireNextImage();
encoder->draw(kVertexCount);
encoder->endEncoding();
commandBuffer->close();