summaryrefslogtreecommitdiff
path: root/tools/gfx-unit-test
diff options
context:
space:
mode:
authorEllie Hermaszewska <ellieh@nvidia.com>2024-11-06 01:47:26 +0800
committerGitHub <noreply@github.com>2024-11-05 09:47:26 -0800
commitb118451e301d734e3e783b3acdf871f3f6ea851c (patch)
tree277f160d31e2c442f724bc6a2d3c09fabff403ca /tools/gfx-unit-test
parent53dd5928c35d5a5cb1f7d2a563348fd1fa87d672 (diff)
Move switch statement bodies to their own lines (#5493)
* Move switch statement bodies to their own lines * format --------- Co-authored-by: Yong He <yonghe@outlook.com>
Diffstat (limited to 'tools/gfx-unit-test')
-rw-r--r--tools/gfx-unit-test/buffer-barrier-test.cpp11
-rw-r--r--tools/gfx-unit-test/existing-device-handle-test.cpp15
-rw-r--r--tools/gfx-unit-test/format-unit-tests.cpp39
-rw-r--r--tools/gfx-unit-test/get-buffer-resource-handle-test.cpp15
-rw-r--r--tools/gfx-unit-test/get-cmd-buffer-handle-test.cpp15
-rw-r--r--tools/gfx-unit-test/get-cmd-queue-handle-test.cpp15
-rw-r--r--tools/gfx-unit-test/get-supported-resource-states-test.cpp39
-rw-r--r--tools/gfx-unit-test/get-texture-resource-handle-test.cpp15
-rw-r--r--tools/gfx-unit-test/gfx-test-texture-util.cpp236
-rw-r--r--tools/gfx-unit-test/gfx-test-texture-util.h8
-rw-r--r--tools/gfx-unit-test/gfx-test-util.cpp23
-rw-r--r--tools/gfx-unit-test/precompiled-module-2.cpp11
-rw-r--r--tools/gfx-unit-test/texture-types-tests.cpp59
13 files changed, 340 insertions, 161 deletions
diff --git a/tools/gfx-unit-test/buffer-barrier-test.cpp b/tools/gfx-unit-test/buffer-barrier-test.cpp
index 80723d2e4..2ee78fdb1 100644
--- a/tools/gfx-unit-test/buffer-barrier-test.cpp
+++ b/tools/gfx-unit-test/buffer-barrier-test.cpp
@@ -154,9 +154,14 @@ void barrierTestAPI(UnitTestContext* context, Slang::RenderApiFlag::Enum api)
IDevice::Desc deviceDesc = {};
switch (api)
{
- case Slang::RenderApiFlag::D3D12: deviceDesc.deviceType = gfx::DeviceType::DirectX12; break;
- case Slang::RenderApiFlag::Vulkan: deviceDesc.deviceType = gfx::DeviceType::Vulkan; break;
- default: SLANG_IGNORE_TEST
+ case Slang::RenderApiFlag::D3D12:
+ deviceDesc.deviceType = gfx::DeviceType::DirectX12;
+ break;
+ case Slang::RenderApiFlag::Vulkan:
+ deviceDesc.deviceType = gfx::DeviceType::Vulkan;
+ break;
+ default:
+ SLANG_IGNORE_TEST
}
deviceDesc.slang.slangGlobalSession = context->slangGlobalSession;
const char* searchPaths[] = {"", "../../tools/gfx-unit-test", "tools/gfx-unit-test"};
diff --git a/tools/gfx-unit-test/existing-device-handle-test.cpp b/tools/gfx-unit-test/existing-device-handle-test.cpp
index 03f924b5c..e971100b9 100644
--- a/tools/gfx-unit-test/existing-device-handle-test.cpp
+++ b/tools/gfx-unit-test/existing-device-handle-test.cpp
@@ -91,10 +91,17 @@ void existingDeviceHandleTestAPI(UnitTestContext* context, Slang::RenderApiFlag:
IDevice::Desc deviceDesc = {};
switch (api)
{
- case Slang::RenderApiFlag::D3D12: deviceDesc.deviceType = gfx::DeviceType::DirectX12; break;
- case Slang::RenderApiFlag::Vulkan: deviceDesc.deviceType = gfx::DeviceType::Vulkan; break;
- case Slang::RenderApiFlag::CUDA: deviceDesc.deviceType = gfx::DeviceType::CUDA; break;
- default: SLANG_IGNORE_TEST;
+ case Slang::RenderApiFlag::D3D12:
+ deviceDesc.deviceType = gfx::DeviceType::DirectX12;
+ break;
+ case Slang::RenderApiFlag::Vulkan:
+ deviceDesc.deviceType = gfx::DeviceType::Vulkan;
+ break;
+ case Slang::RenderApiFlag::CUDA:
+ deviceDesc.deviceType = gfx::DeviceType::CUDA;
+ break;
+ default:
+ SLANG_IGNORE_TEST;
}
deviceDesc.slang.slangGlobalSession = context->slangGlobalSession;
const char* searchPaths[] = {"", "../../tools/gfx-unit-test", "tools/gfx-unit-test"};
diff --git a/tools/gfx-unit-test/format-unit-tests.cpp b/tools/gfx-unit-test/format-unit-tests.cpp
index 6ce38a26a..3b7695ccc 100644
--- a/tools/gfx-unit-test/format-unit-tests.cpp
+++ b/tools/gfx-unit-test/format-unit-tests.cpp
@@ -12,19 +12,32 @@ gfx::Format convertTypelessFormat(gfx::Format format)
{
switch (format)
{
- case gfx::Format::R32G32B32A32_TYPELESS: return gfx::Format::R32G32B32A32_FLOAT;
- case gfx::Format::R32G32B32_TYPELESS: return gfx::Format::R32G32B32_FLOAT;
- case gfx::Format::R32G32_TYPELESS: return gfx::Format::R32G32_FLOAT;
- case gfx::Format::R32_TYPELESS: return gfx::Format::R32_FLOAT;
- case gfx::Format::R16G16B16A16_TYPELESS: return gfx::Format::R16G16B16A16_FLOAT;
- case gfx::Format::R16G16_TYPELESS: return gfx::Format::R16G16_FLOAT;
- case gfx::Format::R16_TYPELESS: return gfx::Format::R16_FLOAT;
- case gfx::Format::R8G8B8A8_TYPELESS: return gfx::Format::R8G8B8A8_UNORM;
- case gfx::Format::R8G8_TYPELESS: return gfx::Format::R8G8_UNORM;
- case gfx::Format::R8_TYPELESS: return gfx::Format::R8_UNORM;
- case gfx::Format::B8G8R8A8_TYPELESS: return gfx::Format::B8G8R8A8_UNORM;
- case gfx::Format::R10G10B10A2_TYPELESS: return gfx::Format::R10G10B10A2_UINT;
- default: return gfx::Format::Unknown;
+ case gfx::Format::R32G32B32A32_TYPELESS:
+ return gfx::Format::R32G32B32A32_FLOAT;
+ case gfx::Format::R32G32B32_TYPELESS:
+ return gfx::Format::R32G32B32_FLOAT;
+ case gfx::Format::R32G32_TYPELESS:
+ return gfx::Format::R32G32_FLOAT;
+ case gfx::Format::R32_TYPELESS:
+ return gfx::Format::R32_FLOAT;
+ case gfx::Format::R16G16B16A16_TYPELESS:
+ return gfx::Format::R16G16B16A16_FLOAT;
+ case gfx::Format::R16G16_TYPELESS:
+ return gfx::Format::R16G16_FLOAT;
+ case gfx::Format::R16_TYPELESS:
+ return gfx::Format::R16_FLOAT;
+ case gfx::Format::R8G8B8A8_TYPELESS:
+ return gfx::Format::R8G8B8A8_UNORM;
+ case gfx::Format::R8G8_TYPELESS:
+ return gfx::Format::R8G8_UNORM;
+ case gfx::Format::R8_TYPELESS:
+ return gfx::Format::R8_UNORM;
+ case gfx::Format::B8G8R8A8_TYPELESS:
+ return gfx::Format::B8G8R8A8_UNORM;
+ case gfx::Format::R10G10B10A2_TYPELESS:
+ return gfx::Format::R10G10B10A2_UINT;
+ default:
+ return gfx::Format::Unknown;
}
}
diff --git a/tools/gfx-unit-test/get-buffer-resource-handle-test.cpp b/tools/gfx-unit-test/get-buffer-resource-handle-test.cpp
index a143ac135..83c3f400d 100644
--- a/tools/gfx-unit-test/get-buffer-resource-handle-test.cpp
+++ b/tools/gfx-unit-test/get-buffer-resource-handle-test.cpp
@@ -61,10 +61,17 @@ void getBufferResourceHandleTestAPI(UnitTestContext* context, Slang::RenderApiFl
IDevice::Desc deviceDesc = {};
switch (api)
{
- case Slang::RenderApiFlag::D3D11: deviceDesc.deviceType = gfx::DeviceType::DirectX11; break;
- case Slang::RenderApiFlag::D3D12: deviceDesc.deviceType = gfx::DeviceType::DirectX12; break;
- case Slang::RenderApiFlag::Vulkan: deviceDesc.deviceType = gfx::DeviceType::Vulkan; break;
- default: SLANG_IGNORE_TEST;
+ case Slang::RenderApiFlag::D3D11:
+ deviceDesc.deviceType = gfx::DeviceType::DirectX11;
+ break;
+ case Slang::RenderApiFlag::D3D12:
+ deviceDesc.deviceType = gfx::DeviceType::DirectX12;
+ break;
+ case Slang::RenderApiFlag::Vulkan:
+ deviceDesc.deviceType = gfx::DeviceType::Vulkan;
+ break;
+ default:
+ SLANG_IGNORE_TEST;
}
deviceDesc.slang.slangGlobalSession = context->slangGlobalSession;
const char* searchPaths[] = {"", "../../tools/gfx-unit-test", "tools/gfx-unit-test"};
diff --git a/tools/gfx-unit-test/get-cmd-buffer-handle-test.cpp b/tools/gfx-unit-test/get-cmd-buffer-handle-test.cpp
index cd9a401f7..c916c0d6d 100644
--- a/tools/gfx-unit-test/get-cmd-buffer-handle-test.cpp
+++ b/tools/gfx-unit-test/get-cmd-buffer-handle-test.cpp
@@ -57,10 +57,17 @@ void getBufferHandleTestAPI(UnitTestContext* context, Slang::RenderApiFlag::Enum
IDevice::Desc deviceDesc = {};
switch (api)
{
- case Slang::RenderApiFlag::D3D11: deviceDesc.deviceType = gfx::DeviceType::DirectX11; break;
- case Slang::RenderApiFlag::D3D12: deviceDesc.deviceType = gfx::DeviceType::DirectX12; break;
- case Slang::RenderApiFlag::Vulkan: deviceDesc.deviceType = gfx::DeviceType::Vulkan; break;
- default: SLANG_IGNORE_TEST;
+ case Slang::RenderApiFlag::D3D11:
+ deviceDesc.deviceType = gfx::DeviceType::DirectX11;
+ break;
+ case Slang::RenderApiFlag::D3D12:
+ deviceDesc.deviceType = gfx::DeviceType::DirectX12;
+ break;
+ case Slang::RenderApiFlag::Vulkan:
+ deviceDesc.deviceType = gfx::DeviceType::Vulkan;
+ break;
+ default:
+ SLANG_IGNORE_TEST;
}
deviceDesc.slang.slangGlobalSession = context->slangGlobalSession;
const char* searchPaths[] = {"", "../../tools/gfx-unit-test", "tools/gfx-unit-test"};
diff --git a/tools/gfx-unit-test/get-cmd-queue-handle-test.cpp b/tools/gfx-unit-test/get-cmd-queue-handle-test.cpp
index 8e589a899..f8b3850a1 100644
--- a/tools/gfx-unit-test/get-cmd-queue-handle-test.cpp
+++ b/tools/gfx-unit-test/get-cmd-queue-handle-test.cpp
@@ -46,10 +46,17 @@ void getQueueHandleTestAPI(UnitTestContext* context, Slang::RenderApiFlag::Enum
IDevice::Desc deviceDesc = {};
switch (api)
{
- case Slang::RenderApiFlag::D3D11: deviceDesc.deviceType = gfx::DeviceType::DirectX11; break;
- case Slang::RenderApiFlag::D3D12: deviceDesc.deviceType = gfx::DeviceType::DirectX12; break;
- case Slang::RenderApiFlag::Vulkan: deviceDesc.deviceType = gfx::DeviceType::Vulkan; break;
- default: SLANG_IGNORE_TEST;
+ case Slang::RenderApiFlag::D3D11:
+ deviceDesc.deviceType = gfx::DeviceType::DirectX11;
+ break;
+ case Slang::RenderApiFlag::D3D12:
+ deviceDesc.deviceType = gfx::DeviceType::DirectX12;
+ break;
+ case Slang::RenderApiFlag::Vulkan:
+ deviceDesc.deviceType = gfx::DeviceType::Vulkan;
+ break;
+ default:
+ SLANG_IGNORE_TEST;
}
deviceDesc.slang.slangGlobalSession = context->slangGlobalSession;
const char* searchPaths[] = {"", "../../tools/gfx-unit-test", "tools/gfx-unit-test"};
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 a3f331384..9870dfa1f 100644
--- a/tools/gfx-unit-test/get-supported-resource-states-test.cpp
+++ b/tools/gfx-unit-test/get-supported-resource-states-test.cpp
@@ -37,19 +37,32 @@ struct GetSupportedResourceStatesBase
{
switch (format)
{
- case Format::R32G32B32A32_TYPELESS: return Format::R32G32B32A32_FLOAT;
- case Format::R32G32B32_TYPELESS: return Format::R32G32B32_FLOAT;
- case Format::R32G32_TYPELESS: return Format::R32G32_FLOAT;
- case Format::R32_TYPELESS: return Format::R32_FLOAT;
- case Format::R16G16B16A16_TYPELESS: return Format::R16G16B16A16_FLOAT;
- case Format::R16G16_TYPELESS: return Format::R16G16_FLOAT;
- case Format::R16_TYPELESS: return Format::R16_FLOAT;
- case Format::R8G8B8A8_TYPELESS: return Format::R8G8B8A8_UNORM;
- case Format::R8G8_TYPELESS: return Format::R8G8_UNORM;
- case Format::R8_TYPELESS: return Format::R8_UNORM;
- case Format::B8G8R8A8_TYPELESS: return Format::B8G8R8A8_UNORM;
- case Format::R10G10B10A2_TYPELESS: return Format::R10G10B10A2_UINT;
- default: return Format::Unknown;
+ case Format::R32G32B32A32_TYPELESS:
+ return Format::R32G32B32A32_FLOAT;
+ case Format::R32G32B32_TYPELESS:
+ return Format::R32G32B32_FLOAT;
+ case Format::R32G32_TYPELESS:
+ return Format::R32G32_FLOAT;
+ case Format::R32_TYPELESS:
+ return Format::R32_FLOAT;
+ case Format::R16G16B16A16_TYPELESS:
+ return Format::R16G16B16A16_FLOAT;
+ case Format::R16G16_TYPELESS:
+ return Format::R16G16_FLOAT;
+ case Format::R16_TYPELESS:
+ return Format::R16_FLOAT;
+ case Format::R8G8B8A8_TYPELESS:
+ return Format::R8G8B8A8_UNORM;
+ case Format::R8G8_TYPELESS:
+ return Format::R8G8_UNORM;
+ case Format::R8_TYPELESS:
+ return Format::R8_UNORM;
+ case Format::B8G8R8A8_TYPELESS:
+ return Format::B8G8R8A8_UNORM;
+ case Format::R10G10B10A2_TYPELESS:
+ return Format::R10G10B10A2_UINT;
+ default:
+ return Format::Unknown;
}
}
diff --git a/tools/gfx-unit-test/get-texture-resource-handle-test.cpp b/tools/gfx-unit-test/get-texture-resource-handle-test.cpp
index 238d5a4fe..2cd2ba658 100644
--- a/tools/gfx-unit-test/get-texture-resource-handle-test.cpp
+++ b/tools/gfx-unit-test/get-texture-resource-handle-test.cpp
@@ -58,10 +58,17 @@ void getTextureResourceHandleTestAPI(UnitTestContext* context, Slang::RenderApiF
IDevice::Desc deviceDesc = {};
switch (api)
{
- case Slang::RenderApiFlag::D3D11: deviceDesc.deviceType = gfx::DeviceType::DirectX11; break;
- case Slang::RenderApiFlag::D3D12: deviceDesc.deviceType = gfx::DeviceType::DirectX12; break;
- case Slang::RenderApiFlag::Vulkan: deviceDesc.deviceType = gfx::DeviceType::Vulkan; break;
- default: SLANG_IGNORE_TEST;
+ case Slang::RenderApiFlag::D3D11:
+ deviceDesc.deviceType = gfx::DeviceType::DirectX11;
+ break;
+ case Slang::RenderApiFlag::D3D12:
+ deviceDesc.deviceType = gfx::DeviceType::DirectX12;
+ break;
+ case Slang::RenderApiFlag::Vulkan:
+ deviceDesc.deviceType = gfx::DeviceType::Vulkan;
+ break;
+ default:
+ SLANG_IGNORE_TEST;
}
deviceDesc.slang.slangGlobalSession = context->slangGlobalSession;
const char* searchPaths[] = {"", "../../tools/gfx-unit-test", "tools/gfx-unit-test"};
diff --git a/tools/gfx-unit-test/gfx-test-texture-util.cpp b/tools/gfx-unit-test/gfx-test-texture-util.cpp
index a4f86d1d8..bb2c9c5eb 100644
--- a/tools/gfx-unit-test/gfx-test-texture-util.cpp
+++ b/tools/gfx-unit-test/gfx-test-texture-util.cpp
@@ -35,8 +35,10 @@ TextureAspect getTextureAspect(Format format)
switch (format)
{
case Format::D16_UNORM:
- case Format::D32_FLOAT: return TextureAspect::Depth;
- default: return TextureAspect::Color;
+ case Format::D32_FLOAT:
+ return TextureAspect::Depth;
+ default:
+ return TextureAspect::Color;
}
}
@@ -56,88 +58,151 @@ RefPtr<ValidationTextureFormatBase> getValidationTextureFormat(Format format)
{
switch (format)
{
- case Format::R32G32B32A32_TYPELESS: return new ValidationTextureFormat<uint32_t>(4);
- case Format::R32G32B32_TYPELESS: return new ValidationTextureFormat<uint32_t>(3);
- case Format::R32G32_TYPELESS: return new ValidationTextureFormat<uint32_t>(2);
- case Format::R32_TYPELESS: return new ValidationTextureFormat<uint32_t>(1);
-
- case Format::R16G16B16A16_TYPELESS: return new ValidationTextureFormat<uint16_t>(4);
- case Format::R16G16_TYPELESS: return new ValidationTextureFormat<uint16_t>(2);
- case Format::R16_TYPELESS: return new ValidationTextureFormat<uint16_t>(1);
-
- case Format::R8G8B8A8_TYPELESS: return new ValidationTextureFormat<uint8_t>(4);
- case Format::R8G8_TYPELESS: return new ValidationTextureFormat<uint8_t>(2);
- case Format::R8_TYPELESS: return new ValidationTextureFormat<uint8_t>(1);
- case Format::B8G8R8A8_TYPELESS: return new ValidationTextureFormat<uint8_t>(4);
-
- case Format::R32G32B32A32_FLOAT: return new ValidationTextureFormat<float>(4);
- case Format::R32G32B32_FLOAT: return new ValidationTextureFormat<float>(3);
- case Format::R32G32_FLOAT: return new ValidationTextureFormat<float>(2);
- case Format::R32_FLOAT: return new ValidationTextureFormat<float>(1);
-
- case Format::R16G16B16A16_FLOAT: return new ValidationTextureFormat<uint16_t>(4);
- case Format::R16G16_FLOAT: return new ValidationTextureFormat<uint16_t>(2);
- case Format::R16_FLOAT: return new ValidationTextureFormat<uint16_t>(1);
-
- case Format::R64_UINT: return new ValidationTextureFormat<uint64_t>(1);
-
- case Format::R32G32B32A32_UINT: return new ValidationTextureFormat<uint32_t>(4);
- case Format::R32G32B32_UINT: return new ValidationTextureFormat<uint32_t>(3);
- case Format::R32G32_UINT: return new ValidationTextureFormat<uint32_t>(2);
- case Format::R32_UINT: return new ValidationTextureFormat<uint32_t>(1);
-
- case Format::R16G16B16A16_UINT: return new ValidationTextureFormat<uint16_t>(4);
- case Format::R16G16_UINT: return new ValidationTextureFormat<uint16_t>(2);
- case Format::R16_UINT: return new ValidationTextureFormat<uint16_t>(1);
-
- case Format::R8G8B8A8_UINT: return new ValidationTextureFormat<uint8_t>(4);
- case Format::R8G8_UINT: return new ValidationTextureFormat<uint8_t>(2);
- case Format::R8_UINT: return new ValidationTextureFormat<uint8_t>(1);
-
- case Format::R64_SINT: return new ValidationTextureFormat<int64_t>(1);
-
- case Format::R32G32B32A32_SINT: return new ValidationTextureFormat<int32_t>(4);
- case Format::R32G32B32_SINT: return new ValidationTextureFormat<int32_t>(3);
- case Format::R32G32_SINT: return new ValidationTextureFormat<int32_t>(2);
- case Format::R32_SINT: return new ValidationTextureFormat<int32_t>(1);
-
- case Format::R16G16B16A16_SINT: return new ValidationTextureFormat<int16_t>(4);
- case Format::R16G16_SINT: return new ValidationTextureFormat<int16_t>(2);
- case Format::R16_SINT: return new ValidationTextureFormat<int16_t>(1);
-
- case Format::R8G8B8A8_SINT: return new ValidationTextureFormat<int8_t>(4);
- case Format::R8G8_SINT: return new ValidationTextureFormat<int8_t>(2);
- case Format::R8_SINT: return new ValidationTextureFormat<int8_t>(1);
-
- case Format::R16G16B16A16_UNORM: return new ValidationTextureFormat<uint16_t>(4);
- case Format::R16G16_UNORM: return new ValidationTextureFormat<uint16_t>(2);
- case Format::R16_UNORM: return new ValidationTextureFormat<uint16_t>(1);
-
- case Format::R8G8B8A8_UNORM: return new ValidationTextureFormat<uint8_t>(4);
- case Format::R8G8B8A8_UNORM_SRGB: return new ValidationTextureFormat<uint8_t>(4);
- case Format::R8G8_UNORM: return new ValidationTextureFormat<uint8_t>(2);
- case Format::R8_UNORM: return new ValidationTextureFormat<uint8_t>(1);
- case Format::B8G8R8A8_UNORM: return new ValidationTextureFormat<uint8_t>(4);
- case Format::B8G8R8A8_UNORM_SRGB: return new ValidationTextureFormat<uint8_t>(4);
- case Format::B8G8R8X8_UNORM: return new ValidationTextureFormat<uint8_t>(3);
- case Format::B8G8R8X8_UNORM_SRGB: return new ValidationTextureFormat<uint8_t>(3);
-
- case Format::R16G16B16A16_SNORM: return new ValidationTextureFormat<int16_t>(4);
- case Format::R16G16_SNORM: return new ValidationTextureFormat<int16_t>(2);
- case Format::R16_SNORM: return new ValidationTextureFormat<int16_t>(1);
-
- case Format::R8G8B8A8_SNORM: return new ValidationTextureFormat<int8_t>(4);
- case Format::R8G8_SNORM: return new ValidationTextureFormat<int8_t>(2);
- case Format::R8_SNORM: return new ValidationTextureFormat<int8_t>(1);
-
- case Format::D32_FLOAT: return new ValidationTextureFormat<float>(1);
- case Format::D16_UNORM: return new ValidationTextureFormat<uint16_t>(1);
-
- case Format::B4G4R4A4_UNORM: return new PackedValidationTextureFormat<uint16_t>(4, 4, 4, 4);
- case Format::B5G6R5_UNORM: return new PackedValidationTextureFormat<uint16_t>(5, 6, 5, 0);
- case Format::B5G5R5A1_UNORM: return new PackedValidationTextureFormat<uint16_t>(5, 5, 5, 1);
-
- case Format::R9G9B9E5_SHAREDEXP: return new ValidationTextureFormat<uint32_t>(1);
+ case Format::R32G32B32A32_TYPELESS:
+ return new ValidationTextureFormat<uint32_t>(4);
+ case Format::R32G32B32_TYPELESS:
+ return new ValidationTextureFormat<uint32_t>(3);
+ case Format::R32G32_TYPELESS:
+ return new ValidationTextureFormat<uint32_t>(2);
+ case Format::R32_TYPELESS:
+ return new ValidationTextureFormat<uint32_t>(1);
+
+ case Format::R16G16B16A16_TYPELESS:
+ return new ValidationTextureFormat<uint16_t>(4);
+ case Format::R16G16_TYPELESS:
+ return new ValidationTextureFormat<uint16_t>(2);
+ case Format::R16_TYPELESS:
+ return new ValidationTextureFormat<uint16_t>(1);
+
+ case Format::R8G8B8A8_TYPELESS:
+ return new ValidationTextureFormat<uint8_t>(4);
+ case Format::R8G8_TYPELESS:
+ return new ValidationTextureFormat<uint8_t>(2);
+ case Format::R8_TYPELESS:
+ return new ValidationTextureFormat<uint8_t>(1);
+ case Format::B8G8R8A8_TYPELESS:
+ return new ValidationTextureFormat<uint8_t>(4);
+
+ case Format::R32G32B32A32_FLOAT:
+ return new ValidationTextureFormat<float>(4);
+ case Format::R32G32B32_FLOAT:
+ return new ValidationTextureFormat<float>(3);
+ case Format::R32G32_FLOAT:
+ return new ValidationTextureFormat<float>(2);
+ case Format::R32_FLOAT:
+ return new ValidationTextureFormat<float>(1);
+
+ case Format::R16G16B16A16_FLOAT:
+ return new ValidationTextureFormat<uint16_t>(4);
+ case Format::R16G16_FLOAT:
+ return new ValidationTextureFormat<uint16_t>(2);
+ case Format::R16_FLOAT:
+ return new ValidationTextureFormat<uint16_t>(1);
+
+ case Format::R64_UINT:
+ return new ValidationTextureFormat<uint64_t>(1);
+
+ case Format::R32G32B32A32_UINT:
+ return new ValidationTextureFormat<uint32_t>(4);
+ case Format::R32G32B32_UINT:
+ return new ValidationTextureFormat<uint32_t>(3);
+ case Format::R32G32_UINT:
+ return new ValidationTextureFormat<uint32_t>(2);
+ case Format::R32_UINT:
+ return new ValidationTextureFormat<uint32_t>(1);
+
+ case Format::R16G16B16A16_UINT:
+ return new ValidationTextureFormat<uint16_t>(4);
+ case Format::R16G16_UINT:
+ return new ValidationTextureFormat<uint16_t>(2);
+ case Format::R16_UINT:
+ return new ValidationTextureFormat<uint16_t>(1);
+
+ case Format::R8G8B8A8_UINT:
+ return new ValidationTextureFormat<uint8_t>(4);
+ case Format::R8G8_UINT:
+ return new ValidationTextureFormat<uint8_t>(2);
+ case Format::R8_UINT:
+ return new ValidationTextureFormat<uint8_t>(1);
+
+ case Format::R64_SINT:
+ return new ValidationTextureFormat<int64_t>(1);
+
+ case Format::R32G32B32A32_SINT:
+ return new ValidationTextureFormat<int32_t>(4);
+ case Format::R32G32B32_SINT:
+ return new ValidationTextureFormat<int32_t>(3);
+ case Format::R32G32_SINT:
+ return new ValidationTextureFormat<int32_t>(2);
+ case Format::R32_SINT:
+ return new ValidationTextureFormat<int32_t>(1);
+
+ case Format::R16G16B16A16_SINT:
+ return new ValidationTextureFormat<int16_t>(4);
+ case Format::R16G16_SINT:
+ return new ValidationTextureFormat<int16_t>(2);
+ case Format::R16_SINT:
+ return new ValidationTextureFormat<int16_t>(1);
+
+ case Format::R8G8B8A8_SINT:
+ return new ValidationTextureFormat<int8_t>(4);
+ case Format::R8G8_SINT:
+ return new ValidationTextureFormat<int8_t>(2);
+ case Format::R8_SINT:
+ return new ValidationTextureFormat<int8_t>(1);
+
+ case Format::R16G16B16A16_UNORM:
+ return new ValidationTextureFormat<uint16_t>(4);
+ case Format::R16G16_UNORM:
+ return new ValidationTextureFormat<uint16_t>(2);
+ case Format::R16_UNORM:
+ return new ValidationTextureFormat<uint16_t>(1);
+
+ case Format::R8G8B8A8_UNORM:
+ return new ValidationTextureFormat<uint8_t>(4);
+ case Format::R8G8B8A8_UNORM_SRGB:
+ return new ValidationTextureFormat<uint8_t>(4);
+ case Format::R8G8_UNORM:
+ return new ValidationTextureFormat<uint8_t>(2);
+ case Format::R8_UNORM:
+ return new ValidationTextureFormat<uint8_t>(1);
+ case Format::B8G8R8A8_UNORM:
+ return new ValidationTextureFormat<uint8_t>(4);
+ case Format::B8G8R8A8_UNORM_SRGB:
+ return new ValidationTextureFormat<uint8_t>(4);
+ case Format::B8G8R8X8_UNORM:
+ return new ValidationTextureFormat<uint8_t>(3);
+ case Format::B8G8R8X8_UNORM_SRGB:
+ return new ValidationTextureFormat<uint8_t>(3);
+
+ case Format::R16G16B16A16_SNORM:
+ return new ValidationTextureFormat<int16_t>(4);
+ case Format::R16G16_SNORM:
+ return new ValidationTextureFormat<int16_t>(2);
+ case Format::R16_SNORM:
+ return new ValidationTextureFormat<int16_t>(1);
+
+ case Format::R8G8B8A8_SNORM:
+ return new ValidationTextureFormat<int8_t>(4);
+ case Format::R8G8_SNORM:
+ return new ValidationTextureFormat<int8_t>(2);
+ case Format::R8_SNORM:
+ return new ValidationTextureFormat<int8_t>(1);
+
+ case Format::D32_FLOAT:
+ return new ValidationTextureFormat<float>(1);
+ case Format::D16_UNORM:
+ return new ValidationTextureFormat<uint16_t>(1);
+
+ case Format::B4G4R4A4_UNORM:
+ return new PackedValidationTextureFormat<uint16_t>(4, 4, 4, 4);
+ case Format::B5G6R5_UNORM:
+ return new PackedValidationTextureFormat<uint16_t>(5, 6, 5, 0);
+ case Format::B5G5R5A1_UNORM:
+ return new PackedValidationTextureFormat<uint16_t>(5, 5, 5, 1);
+
+ case Format::R9G9B9E5_SHAREDEXP:
+ return new ValidationTextureFormat<uint32_t>(1);
case Format::R10G10B10A2_TYPELESS:
return new PackedValidationTextureFormat<uint32_t>(10, 10, 10, 2);
case Format::R10G10B10A2_UNORM:
@@ -162,7 +227,8 @@ RefPtr<ValidationTextureFormatBase> getValidationTextureFormat(Format format)
// BC6H_SF16,
// BC7_UNORM,
// BC7_UNORM_SRGB,
- default: return nullptr;
+ default:
+ return nullptr;
}
}
diff --git a/tools/gfx-unit-test/gfx-test-texture-util.h b/tools/gfx-unit-test/gfx-test-texture-util.h
index 7c6b9443f..2751a2a20 100644
--- a/tools/gfx-unit-test/gfx-test-texture-util.h
+++ b/tools/gfx-unit-test/gfx-test-texture-util.h
@@ -61,7 +61,9 @@ struct ValidationTextureFormat : ValidationTextureFormatBase
switch (componentCount)
{
- case 1: temp[0] = T(x + y + z + mipLevel + arrayLayer); break;
+ case 1:
+ temp[0] = T(x + y + z + mipLevel + arrayLayer);
+ break;
case 2:
temp[0] = T(x + z + arrayLayer);
temp[1] = T(y + mipLevel);
@@ -77,7 +79,9 @@ struct ValidationTextureFormat : ValidationTextureFormatBase
temp[2] = (T)z;
temp[3] = (T)mipLevel;
break;
- default: assert(!"component count should be no greater than 4"); SLANG_CHECK_ABORT(false);
+ default:
+ assert(!"component count should be no greater than 4");
+ SLANG_CHECK_ABORT(false);
}
}
};
diff --git a/tools/gfx-unit-test/gfx-test-util.cpp b/tools/gfx-unit-test/gfx-test-util.cpp
index 18aaabdaf..79343680f 100644
--- a/tools/gfx-unit-test/gfx-test-util.cpp
+++ b/tools/gfx-unit-test/gfx-test-util.cpp
@@ -267,12 +267,23 @@ Slang::ComPtr<gfx::IDevice> createTestingDevice(
gfx::IDevice::Desc deviceDesc = {};
switch (api)
{
- case Slang::RenderApiFlag::D3D11: deviceDesc.deviceType = gfx::DeviceType::DirectX11; break;
- case Slang::RenderApiFlag::D3D12: deviceDesc.deviceType = gfx::DeviceType::DirectX12; break;
- case Slang::RenderApiFlag::Vulkan: deviceDesc.deviceType = gfx::DeviceType::Vulkan; break;
- case Slang::RenderApiFlag::CPU: deviceDesc.deviceType = gfx::DeviceType::CPU; break;
- case Slang::RenderApiFlag::CUDA: deviceDesc.deviceType = gfx::DeviceType::CUDA; break;
- default: SLANG_IGNORE_TEST
+ case Slang::RenderApiFlag::D3D11:
+ deviceDesc.deviceType = gfx::DeviceType::DirectX11;
+ break;
+ case Slang::RenderApiFlag::D3D12:
+ deviceDesc.deviceType = gfx::DeviceType::DirectX12;
+ break;
+ case Slang::RenderApiFlag::Vulkan:
+ deviceDesc.deviceType = gfx::DeviceType::Vulkan;
+ break;
+ case Slang::RenderApiFlag::CPU:
+ deviceDesc.deviceType = gfx::DeviceType::CPU;
+ break;
+ case Slang::RenderApiFlag::CUDA:
+ deviceDesc.deviceType = gfx::DeviceType::CUDA;
+ break;
+ default:
+ SLANG_IGNORE_TEST
}
deviceDesc.slang.slangGlobalSession = context->slangGlobalSession;
Slang::List<const char*> searchPaths = getSlangSearchPaths();
diff --git a/tools/gfx-unit-test/precompiled-module-2.cpp b/tools/gfx-unit-test/precompiled-module-2.cpp
index 0a5ea3ac0..f5c478b4d 100644
--- a/tools/gfx-unit-test/precompiled-module-2.cpp
+++ b/tools/gfx-unit-test/precompiled-module-2.cpp
@@ -42,9 +42,14 @@ static Slang::Result precompileProgram(
SlangCompileTarget target;
switch (device->getDeviceInfo().deviceType)
{
- case gfx::DeviceType::DirectX12: target = SLANG_DXIL; break;
- case gfx::DeviceType::Vulkan: target = SLANG_SPIRV; break;
- default: return SLANG_FAIL;
+ case gfx::DeviceType::DirectX12:
+ target = SLANG_DXIL;
+ break;
+ case gfx::DeviceType::Vulkan:
+ target = SLANG_SPIRV;
+ break;
+ default:
+ return SLANG_FAIL;
}
ComPtr<slang::IModulePrecompileService_Experimental> precompileService;
diff --git a/tools/gfx-unit-test/texture-types-tests.cpp b/tools/gfx-unit-test/texture-types-tests.cpp
index 0aa082a1e..89342f9cf 100644
--- a/tools/gfx-unit-test/texture-types-tests.cpp
+++ b/tools/gfx-unit-test/texture-types-tests.cpp
@@ -56,13 +56,18 @@ struct BaseTextureViewTest
{
switch (type)
{
- case IResourceView::Type::RenderTarget: return ResourceState::RenderTarget;
- case IResourceView::Type::DepthStencil: return ResourceState::DepthWrite;
- case IResourceView::Type::ShaderResource: return ResourceState::ShaderResource;
- case IResourceView::Type::UnorderedAccess: return ResourceState::UnorderedAccess;
+ case IResourceView::Type::RenderTarget:
+ return ResourceState::RenderTarget;
+ case IResourceView::Type::DepthStencil:
+ return ResourceState::DepthWrite;
+ case IResourceView::Type::ShaderResource:
+ return ResourceState::ShaderResource;
+ case IResourceView::Type::UnorderedAccess:
+ return ResourceState::UnorderedAccess;
case IResourceView::Type::AccelerationStructure:
return ResourceState::AccelerationStructure;
- default: return ResourceState::Undefined;
+ default:
+ return ResourceState::Undefined;
}
}
@@ -74,21 +79,43 @@ struct BaseTextureViewTest
switch (textureInfo->textureType)
{
- case IResource::Type::Texture1D: shape = "1D"; break;
- case IResource::Type::Texture2D: shape = "2D"; break;
- case IResource::Type::Texture3D: shape = "3D"; break;
- case IResource::Type::TextureCube: shape = "Cube"; break;
- default: assert(!"Invalid texture shape"); SLANG_CHECK_ABORT(false);
+ case IResource::Type::Texture1D:
+ shape = "1D";
+ break;
+ case IResource::Type::Texture2D:
+ shape = "2D";
+ break;
+ case IResource::Type::Texture3D:
+ shape = "3D";
+ break;
+ case IResource::Type::TextureCube:
+ shape = "Cube";
+ break;
+ default:
+ assert(!"Invalid texture shape");
+ SLANG_CHECK_ABORT(false);
}
switch (viewType)
{
- case IResourceView::Type::RenderTarget: view = "Render"; break;
- case IResourceView::Type::DepthStencil: view = "Depth"; break;
- case IResourceView::Type::ShaderResource: view = "Shader"; break;
- case IResourceView::Type::UnorderedAccess: view = "Unordered"; break;
- case IResourceView::Type::AccelerationStructure: view = "Accel"; break;
- default: assert(!"Invalid resource view"); SLANG_CHECK_ABORT(false);
+ case IResourceView::Type::RenderTarget:
+ view = "Render";
+ break;
+ case IResourceView::Type::DepthStencil:
+ view = "Depth";
+ break;
+ case IResourceView::Type::ShaderResource:
+ view = "Shader";
+ break;
+ case IResourceView::Type::UnorderedAccess:
+ view = "Unordered";
+ break;
+ case IResourceView::Type::AccelerationStructure:
+ view = "Accel";
+ break;
+ default:
+ assert(!"Invalid resource view");
+ SLANG_CHECK_ABORT(false);
}
return base + shape + view;