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/gfx-test-texture-util.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'tools/gfx-unit-test/gfx-test-texture-util.cpp') diff --git a/tools/gfx-unit-test/gfx-test-texture-util.cpp b/tools/gfx-unit-test/gfx-test-texture-util.cpp index 24cd1c4a9..c7c85db58 100644 --- a/tools/gfx-unit-test/gfx-test-texture-util.cpp +++ b/tools/gfx-unit-test/gfx-test-texture-util.cpp @@ -1,4 +1,5 @@ #include "gfx-test-texture-util.h" +#include "gfx-test-util.h" #include "tools/unit-test/slang-unit-test.h" #include @@ -28,6 +29,13 @@ namespace gfx_test } } + uint32_t getTexelSize(Format format) + { + FormatInfo info; + GFX_CHECK_CALL_ABORT(gfxGetFormatInfo(format, &info)); + return info.blockSizeInBytes / info.pixelsPerBlock; + } + uint32_t getSubresourceIndex(uint32_t mipLevel, uint32_t mipLevelCount, uint32_t baseArrayLayer) { return baseArrayLayer * mipLevelCount + mipLevel; @@ -145,7 +153,7 @@ namespace gfx_test auto extents = texture->extents; auto arrayLayers = texture->arrayLayerCount; auto mipLevels = texture->mipLevelCount; - auto texelSize = texture->texelSize; + auto texelSize = getTexelSize(texture->format); for (uint32_t layer = 0; layer < arrayLayers; ++layer) { -- cgit v1.2.3