From 2aac3700741f47caa6e8d674872979e2cdc251ab Mon Sep 17 00:00:00 2001 From: lucy96chen <47800040+lucy96chen@users.noreply.github.com> Date: Thu, 7 Apr 2022 11:11:45 -0700 Subject: Texture views/shapes tests part 1 (#2179) * Framework for texture views testing working; Small tweaks to texture testing utils; Changed D3D12 readTextureResource to account for non-1 depth * Basic framework for texture views tests working; Test file needs a rename at some point * 1D, 2D, and 3D textures working for ShaderResource, UnorderedAccess, and RenderTarget tests; Fixed some small issues with handling the depth field of 3D textures in Vulkan causing incorrectly cleared textures --- tools/gfx-unit-test/copy-texture-tests.cpp | 42 ++++-------------------------- 1 file changed, 5 insertions(+), 37 deletions(-) (limited to 'tools/gfx-unit-test/copy-texture-tests.cpp') diff --git a/tools/gfx-unit-test/copy-texture-tests.cpp b/tools/gfx-unit-test/copy-texture-tests.cpp index 2999dc704..f332198b4 100644 --- a/tools/gfx-unit-test/copy-texture-tests.cpp +++ b/tools/gfx-unit-test/copy-texture-tests.cpp @@ -62,19 +62,13 @@ namespace gfx_test this->context = context; this->validationFormat = validationFormat; - FormatInfo formatInfo; - GFX_CHECK_CALL_ABORT(gfxGetFormatInfo(format, &formatInfo)); - auto texelSize = formatInfo.blockSizeInBytes / formatInfo.pixelsPerBlock; - this->srcTextureInfo = new TextureInfo(); this->srcTextureInfo->format = format; this->srcTextureInfo->textureType = type; - this->srcTextureInfo->texelSize = texelSize; this->dstTextureInfo = new TextureInfo(); this->dstTextureInfo->format = format; this->dstTextureInfo->textureType = type; - this->dstTextureInfo->texelSize = texelSize; } void createRequiredResources() @@ -123,9 +117,10 @@ namespace gfx_test dstTexture.writeRef())); auto bufferCopyExtents = bufferCopyInfo.extent; + auto texelSize = getTexelSize(dstTextureInfo->format); size_t alignment; device->getTextureRowAlignment(&alignment); - alignedRowStride = (bufferCopyExtents.width * dstTextureInfo->texelSize + alignment - 1) & ~(alignment - 1); + alignedRowStride = (bufferCopyExtents.width * texelSize + alignment - 1) & ~(alignment - 1); IBufferResource::Desc bufferDesc = {}; bufferDesc.sizeInBytes = bufferCopyExtents.height * bufferCopyExtents.depth * alignedRowStride; bufferDesc.format = Format::Unknown; @@ -255,14 +250,14 @@ namespace gfx_test ValidationTextureData actual; actual.extents = bufferCopyInfo.extent; actual.textureData = results; - actual.strides.x = dstTextureInfo->texelSize; + actual.strides.x = getTexelSize(dstTextureInfo->format); actual.strides.y = (uint32_t)alignedRowStride; actual.strides.z = actual.extents.height * actual.strides.y; ValidationTextureData expectedCopied; expectedCopied.extents = srcMipExtent; expectedCopied.textureData = expectedCopiedData; - expectedCopied.strides.x = srcTextureInfo->texelSize; + expectedCopied.strides.x = getTexelSize(srcTextureInfo->format); expectedCopied.strides.y = expectedCopied.extents.width * expectedCopied.strides.x; expectedCopied.strides.z = expectedCopied.extents.height * expectedCopied.strides.y; @@ -271,7 +266,7 @@ namespace gfx_test { expectedOriginal.extents = bufferCopyInfo.extent; expectedOriginal.textureData = expectedOriginalData; - expectedOriginal.strides.x = dstTextureInfo->texelSize; + expectedOriginal.strides.x = getTexelSize(dstTextureInfo->format); expectedOriginal.strides.y = expectedOriginal.extents.width * expectedOriginal.strides.x; expectedOriginal.strides.z = expectedOriginal.extents.height * expectedOriginal.strides.y; } @@ -768,33 +763,6 @@ namespace gfx_test } } - SLANG_UNIT_TEST(copyTextureTests) - { - runTestImpl(copyTextureTestImpl, unitTestContext, Slang::RenderApiFlag::D3D12); - runTestImpl(copyTextureTestImpl, unitTestContext, Slang::RenderApiFlag::Vulkan); - - runTestImpl(copyTextureTestImpl, unitTestContext, Slang::RenderApiFlag::D3D12); - runTestImpl(copyTextureTestImpl, unitTestContext, Slang::RenderApiFlag::Vulkan); - - runTestImpl(copyTextureTestImpl, unitTestContext, Slang::RenderApiFlag::D3D12); - runTestImpl(copyTextureTestImpl, unitTestContext, Slang::RenderApiFlag::Vulkan); - - runTestImpl(copyTextureTestImpl, unitTestContext, Slang::RenderApiFlag::D3D12); - runTestImpl(copyTextureTestImpl, unitTestContext, Slang::RenderApiFlag::Vulkan); - - runTestImpl(copyTextureTestImpl, unitTestContext, Slang::RenderApiFlag::D3D12); - runTestImpl(copyTextureTestImpl, unitTestContext, Slang::RenderApiFlag::Vulkan); - - runTestImpl(copyTextureTestImpl, unitTestContext, Slang::RenderApiFlag::D3D12); - runTestImpl(copyTextureTestImpl, unitTestContext, Slang::RenderApiFlag::Vulkan); - - runTestImpl(copyTextureTestImpl, unitTestContext, Slang::RenderApiFlag::D3D12); - runTestImpl(copyTextureTestImpl, unitTestContext, Slang::RenderApiFlag::Vulkan); - - runTestImpl(copyTextureTestImpl, unitTestContext, Slang::RenderApiFlag::D3D12); - runTestImpl(copyTextureTestImpl, unitTestContext, Slang::RenderApiFlag::Vulkan); - } - SLANG_UNIT_TEST(copyTextureSimple) { runTestImpl(copyTextureTestImpl, unitTestContext, Slang::RenderApiFlag::D3D12); -- cgit v1.2.3