diff options
| author | lucy96chen <47800040+lucy96chen@users.noreply.github.com> | 2022-04-07 11:11:45 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-04-07 11:11:45 -0700 |
| commit | 2aac3700741f47caa6e8d674872979e2cdc251ab (patch) | |
| tree | 02e750f77fa40f4f397e4698f06e05e15e38be16 /tools/gfx-unit-test/gfx-test-texture-util.cpp | |
| parent | 86221ff4757ee504307f3537b34acb05117ce272 (diff) | |
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
Diffstat (limited to 'tools/gfx-unit-test/gfx-test-texture-util.cpp')
| -rw-r--r-- | tools/gfx-unit-test/gfx-test-texture-util.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
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 <slang-com-ptr.h> @@ -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) { |
