summaryrefslogtreecommitdiff
path: root/tools/gfx-unit-test
diff options
context:
space:
mode:
authorlucy96chen <47800040+lucy96chen@users.noreply.github.com>2022-04-21 12:59:09 -0700
committerGitHub <noreply@github.com>2022-04-21 12:59:09 -0700
commitf493d24c70a6227754296439e97adf35ec412496 (patch)
tree25fffb03c067477bef68ccdc66865683159e3ab5 /tools/gfx-unit-test
parent1b6cea2219307f6271e131c43d6e8f48910bd435 (diff)
GFX renaming work part 2: slang-gfx.h renames (#2194)
* Fixed all build errors and type conversion warnings from renames in slang-gfx.h * Made necessary build fixes to the CUDA implementation * Renamed ITextureResource::Size to ITextureResource::Extents * More rename changes based on CI errors * More renames to fix CI build errors * Rerun tests
Diffstat (limited to 'tools/gfx-unit-test')
-rw-r--r--tools/gfx-unit-test/copy-texture-tests.cpp26
-rw-r--r--tools/gfx-unit-test/format-unit-tests.cpp8
-rw-r--r--tools/gfx-unit-test/get-supported-resource-states-test.cpp4
-rw-r--r--tools/gfx-unit-test/gfx-test-texture-util.cpp8
-rw-r--r--tools/gfx-unit-test/gfx-test-texture-util.h29
-rw-r--r--tools/gfx-unit-test/resolve-resource-tests.cpp6
-rw-r--r--tools/gfx-unit-test/shared-textures-tests.cpp6
-rw-r--r--tools/gfx-unit-test/texture-types-tests.cpp12
8 files changed, 53 insertions, 46 deletions
diff --git a/tools/gfx-unit-test/copy-texture-tests.cpp b/tools/gfx-unit-test/copy-texture-tests.cpp
index 3461a8cdf..6a9d39d22 100644
--- a/tools/gfx-unit-test/copy-texture-tests.cpp
+++ b/tools/gfx-unit-test/copy-texture-tests.cpp
@@ -19,7 +19,7 @@ namespace gfx_test
{
SubresourceRange srcSubresource;
SubresourceRange dstSubresource;
- ITextureResource::Size extent;
+ ITextureResource::Extents extent;
ITextureResource::Offset3D srcOffset;
ITextureResource::Offset3D dstOffset;
};
@@ -27,10 +27,10 @@ namespace gfx_test
struct TextureToBufferCopyInfo
{
SubresourceRange srcSubresource;
- ITextureResource::Size extent;
+ ITextureResource::Extents extent;
ITextureResource::Offset3D textureOffset;
- size_t bufferOffset;
- size_t bufferSize;
+ Offset bufferOffset;
+ Offset bufferSize;
};
struct BaseCopyTextureTest
@@ -38,7 +38,7 @@ namespace gfx_test
IDevice* device;
UnitTestContext* context;
- size_t alignedRowStride;
+ Size alignedRowStride;
RefPtr<TextureInfo> srcTextureInfo;
RefPtr<TextureInfo> dstTextureInfo;
@@ -185,7 +185,7 @@ namespace gfx_test
queue->waitOnHost();
}
- bool isWithinCopyBounds(Int x, Int y, Int z)
+ bool isWithinCopyBounds(GfxIndex x, GfxIndex y, GfxIndex z)
{
auto copyExtents = texCopyInfo.extent;
auto copyOffset = texCopyInfo.dstOffset;
@@ -213,11 +213,11 @@ namespace gfx_test
auto srcTexOffset = texCopyInfo.srcOffset;
auto dstTexOffset = texCopyInfo.dstOffset;
- for (Int x = 0; x < actualExtents.width; ++x)
+ for (GfxIndex x = 0; x < actualExtents.width; ++x)
{
- for (Int y = 0; y < actualExtents.height; ++y)
+ for (GfxIndex y = 0; y < actualExtents.height; ++y)
{
- for (Int z = 0; z < actualExtents.depth; ++z)
+ for (GfxIndex z = 0; z < actualExtents.depth; ++z)
{
auto actualBlock = actual.getBlockAt(x, y, z);
if (isWithinCopyBounds(x, y, z))
@@ -241,7 +241,7 @@ namespace gfx_test
}
}
- void checkTestResults(ITextureResource::Size srcMipExtent, const void* expectedCopiedData, const void* expectedOriginalData)
+ void checkTestResults(ITextureResource::Extents srcMipExtent, const void* expectedCopiedData, const void* expectedOriginalData)
{
ComPtr<ISlangBlob> resultBlob;
GFX_CHECK_CALL_ABORT(device->readBufferResource(resultsBuffer, 0, bufferCopyInfo.bufferSize, resultBlob.writeRef()));
@@ -251,7 +251,7 @@ namespace gfx_test
actual.extents = bufferCopyInfo.extent;
actual.textureData = results;
actual.strides.x = getTexelSize(dstTextureInfo->format);
- actual.strides.y = (uint32_t)alignedRowStride;
+ actual.strides.y = alignedRowStride;
actual.strides.z = actual.extents.height * actual.strides.y;
ValidationTextureData expectedCopied;
@@ -746,9 +746,9 @@ namespace gfx_test
{
// Skip Type::Unknown and Type::Buffer as well as Format::Unknown
// TODO: Add support for TextureCube
- for (uint32_t i = 2; i < (uint32_t)ITextureResource::Type::CountOf - 1; ++i)
+ for (uint32_t i = 2; i < (uint32_t)ITextureResource::Type::_Count - 1; ++i)
{
- for (uint32_t j = 1; j < (uint32_t)Format::CountOf; ++j)
+ for (uint32_t j = 1; j < (uint32_t)Format::_Count; ++j)
{
auto type = (ITextureResource::Type)i;
auto format = (Format)j;
diff --git a/tools/gfx-unit-test/format-unit-tests.cpp b/tools/gfx-unit-test/format-unit-tests.cpp
index 8d3d07221..5755e03cd 100644
--- a/tools/gfx-unit-test/format-unit-tests.cpp
+++ b/tools/gfx-unit-test/format-unit-tests.cpp
@@ -97,7 +97,7 @@ namespace gfx_test
ComPtr<IResourceView> createTexView(
IDevice* device,
- ITextureResource::Size size,
+ ITextureResource::Extents size,
gfx::Format format,
ITextureResource::SubresourceData* data,
int mips = 1)
@@ -175,12 +175,12 @@ namespace gfx_test
auto intResults = createBuffer<uint32_t>(device, 16, initIntData);
auto intBufferView = createBufferView(device, intResults);
- ITextureResource::Size size = {};
+ ITextureResource::Extents size = {};
size.width = 2;
size.height = 2;
size.depth = 1;
- ITextureResource::Size bcSize = {};
+ ITextureResource::Extents bcSize = {};
bcSize.width = 4;
bcSize.height = 4;
bcSize.depth = 1;
@@ -939,7 +939,7 @@ namespace gfx_test
ITextureResource::SubresourceData {(void*)texData, 16, 32},
ITextureResource::SubresourceData {(void*)(texData + 32), 8, 0}
};
- ITextureResource::Size size = {};
+ ITextureResource::Extents size = {};
size.width = 8;
size.height = 8;
size.depth = 1;
diff --git a/tools/gfx-unit-test/get-supported-resource-states-test.cpp b/tools/gfx-unit-test/get-supported-resource-states-test.cpp
index 209cf1ba5..fc7c57771 100644
--- a/tools/gfx-unit-test/get-supported-resource-states-test.cpp
+++ b/tools/gfx-unit-test/get-supported-resource-states-test.cpp
@@ -109,7 +109,7 @@ namespace
void run()
{
// Skip Format::Unknown
- for (uint32_t i = 1; i < (uint32_t)Format::CountOf; ++i)
+ for (uint32_t i = 1; i < (uint32_t)Format::_Count; ++i)
{
auto baseFormat = (Format)i;
FormatInfo info;
@@ -148,7 +148,7 @@ namespace
ResourceState::CopyDestination);
ResourceState currentState = ResourceState::CopySource;
- ITextureResource::Size extent;
+ ITextureResource::Extents extent;
extent.width = 4;
extent.height = 4;
extent.depth = 1;
diff --git a/tools/gfx-unit-test/gfx-test-texture-util.cpp b/tools/gfx-unit-test/gfx-test-texture-util.cpp
index c7c85db58..e9d884894 100644
--- a/tools/gfx-unit-test/gfx-test-texture-util.cpp
+++ b/tools/gfx-unit-test/gfx-test-texture-util.cpp
@@ -29,14 +29,14 @@ namespace gfx_test
}
}
- uint32_t getTexelSize(Format format)
+ Size 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)
+ GfxIndex getSubresourceIndex(GfxIndex mipLevel, GfxCount mipLevelCount, GfxIndex baseArrayLayer)
{
return baseArrayLayer * mipLevelCount + mipLevel;
}
@@ -155,9 +155,9 @@ namespace gfx_test
auto mipLevels = texture->mipLevelCount;
auto texelSize = getTexelSize(texture->format);
- for (uint32_t layer = 0; layer < arrayLayers; ++layer)
+ for (GfxIndex layer = 0; layer < arrayLayers; ++layer)
{
- for (uint32_t mip = 0; mip < mipLevels; ++mip)
+ for (GfxIndex mip = 0; mip < mipLevels; ++mip)
{
RefPtr<ValidationTextureData> subresource = new ValidationTextureData();
diff --git a/tools/gfx-unit-test/gfx-test-texture-util.h b/tools/gfx-unit-test/gfx-test-texture-util.h
index 7e59c60e1..6b51af699 100644
--- a/tools/gfx-unit-test/gfx-test-texture-util.h
+++ b/tools/gfx-unit-test/gfx-test-texture-util.h
@@ -10,11 +10,18 @@ using namespace gfx;
namespace gfx_test
{
+ struct Strides
+ {
+ Size x;
+ Size y;
+ Size z;
+ };
+
struct ValidationTextureFormatBase : RefObject
{
virtual void validateBlocksEqual(const void* actual, const void* expected) = 0;
- virtual void initializeTexel(void* texel, int x, int y, int z, int mipLevel, int arrayLayer) = 0;
+ virtual void initializeTexel(void* texel, GfxIndex x, GfxIndex y, GfxIndex z, GfxIndex mipLevel, GfxIndex arrayLayer) = 0;
};
template <typename T>
@@ -35,7 +42,7 @@ namespace gfx_test
}
}
- virtual void initializeTexel(void* texel, int x, int y, int z, int mipLevel, int arrayLayer) override
+ virtual void initializeTexel(void* texel, GfxIndex x, GfxIndex y, GfxIndex z, GfxIndex mipLevel, GfxIndex arrayLayer) override
{
auto temp = (T*)texel;
@@ -90,7 +97,7 @@ namespace gfx_test
}
}
- virtual void initializeTexel(void* texel, int x, int y, int z, int mipLevel, int arrayLayer) override
+ virtual void initializeTexel(void* texel, GfxIndex x, GfxIndex y, GfxIndex z, GfxIndex mipLevel, GfxIndex arrayLayer) override
{
T temp = 0;
@@ -137,10 +144,10 @@ namespace gfx_test
struct ValidationTextureData : RefObject
{
const void* textureData;
- ITextureResource::Size extents;
- ITextureResource::Offset3D strides;
+ ITextureResource::Extents extents;
+ Strides strides;
- void* getBlockAt(Int x, Int y, Int z)
+ void* getBlockAt(GfxIndex x, GfxIndex y, GfxIndex z)
{
assert(x >= 0 && x < extents.width);
assert(y >= 0 && y < extents.height);
@@ -159,17 +166,17 @@ namespace gfx_test
Format format;
ITextureResource::Type textureType;
- ITextureResource::Size extents;
- uint32_t mipLevelCount;
- uint32_t arrayLayerCount;
+ ITextureResource::Extents extents;
+ GfxCount mipLevelCount;
+ GfxCount arrayLayerCount;
List<RefPtr<ValidationTextureData>> subresourceObjects;
List<ITextureResource::SubresourceData> subresourceDatas;
};
TextureAspect getTextureAspect(Format format);
- uint32_t getTexelSize(Format format);
- uint32_t getSubresourceIndex(uint32_t mipLevel, uint32_t mipLevelCount, uint32_t baseArrayLayer);
+ Size getTexelSize(Format format);
+ GfxIndex getSubresourceIndex(GfxIndex mipLevel, GfxCount mipLevelCount, GfxIndex baseArrayLayer);
RefPtr<ValidationTextureFormatBase> getValidationTextureFormat(Format format);
void generateTextureData(RefPtr<TextureInfo> texture, ValidationTextureFormatBase* validationFormat);
}
diff --git a/tools/gfx-unit-test/resolve-resource-tests.cpp b/tools/gfx-unit-test/resolve-resource-tests.cpp
index 2876be880..cc5dffd00 100644
--- a/tools/gfx-unit-test/resolve-resource-tests.cpp
+++ b/tools/gfx-unit-test/resolve-resource-tests.cpp
@@ -101,7 +101,7 @@ namespace
struct TextureInfo
{
- ITextureResource::Size extent;
+ ITextureResource::Extents extent;
int numMipLevels;
int arraySize;
ITextureResource::SubresourceData const* initData;
@@ -222,7 +222,7 @@ namespace
GFX_CHECK_CALL_ABORT(device->createFramebuffer(framebufferDesc, framebuffer.writeRef()));
}
- void submitGPUWork(SubresourceRange msaaSubresource, SubresourceRange dstSubresource, ITextureResource::Size extent)
+ void submitGPUWork(SubresourceRange msaaSubresource, SubresourceRange dstSubresource, ITextureResource::Extents extent)
{
Slang::ComPtr<ITransientResourceHeap> transientHeap;
ITransientResourceHeap::Desc transientHeapDesc = {};
@@ -296,7 +296,7 @@ namespace
{
void run()
{
- ITextureResource::Size extent = {};
+ ITextureResource::Extents extent = {};
extent.width = kWidth;
extent.height = kHeight;
extent.depth = 1;
diff --git a/tools/gfx-unit-test/shared-textures-tests.cpp b/tools/gfx-unit-test/shared-textures-tests.cpp
index 831296c72..4afa23546 100644
--- a/tools/gfx-unit-test/shared-textures-tests.cpp
+++ b/tools/gfx-unit-test/shared-textures-tests.cpp
@@ -67,7 +67,7 @@ namespace gfx_test
}
}
- ComPtr<ITextureResource> createTexture(IDevice* device, ITextureResource::Size extents, gfx::Format format, ITextureResource::SubresourceData* initialData)
+ ComPtr<ITextureResource> createTexture(IDevice* device, ITextureResource::Extents extents, gfx::Format format, ITextureResource::SubresourceData* initialData)
{
ITextureResource::Desc texDesc = {};
texDesc.type = IResource::Type::Texture2D;
@@ -152,12 +152,12 @@ namespace gfx_test
auto intResults = createBuffer<uint32_t>(dstDevice, 16, initIntData);
auto intBufferView = createOutBufferView(dstDevice, intResults);
- ITextureResource::Size size = {};
+ ITextureResource::Extents size = {};
size.width = 2;
size.height = 2;
size.depth = 1;
- ITextureResource::Size bcSize = {};
+ ITextureResource::Extents bcSize = {};
bcSize.width = 4;
bcSize.height = 4;
bcSize.depth = 1;
diff --git a/tools/gfx-unit-test/texture-types-tests.cpp b/tools/gfx-unit-test/texture-types-tests.cpp
index 94f7a764f..4d8037ce8 100644
--- a/tools/gfx-unit-test/texture-types-tests.cpp
+++ b/tools/gfx-unit-test/texture-types-tests.cpp
@@ -234,11 +234,11 @@ namespace gfx_test
void validateTextureValues(ValidationTextureData actual, ValidationTextureData original)
{
// TODO: needs to be extended to cover mip levels and array layers
- for (Int x = 0; x < actual.extents.width; ++x)
+ for (GfxIndex x = 0; x < actual.extents.width; ++x)
{
- for (Int y = 0; y < actual.extents.height; ++y)
+ for (GfxIndex y = 0; y < actual.extents.height; ++y)
{
- for (Int z = 0; z < actual.extents.depth; ++z)
+ for (GfxIndex z = 0; z < actual.extents.depth; ++z)
{
auto actualBlock = (uint8_t*)actual.getBlockAt(x, y, z);
for (Int i = 0; i < 4; ++i)
@@ -536,11 +536,11 @@ namespace gfx_test
// TODO: Needs to handle either the correct slice or array layer (will not always check z)
void validateTextureValues(ValidationTextureData actual)
{
- for (Int x = 0; x < actual.extents.width; ++x)
+ for (GfxIndex x = 0; x < actual.extents.width; ++x)
{
- for (Int y = 0; y < actual.extents.height; ++y)
+ for (GfxIndex y = 0; y < actual.extents.height; ++y)
{
- for (Int z = 0; z < actual.extents.depth; ++z)
+ for (GfxIndex z = 0; z < actual.extents.depth; ++z)
{
auto actualBlock = (float*)actual.getBlockAt(x, y, z);
for (Int i = 0; i < 4; ++i)