From dcc2b854a64b3e4e890215ff21cf4b219724f524 Mon Sep 17 00:00:00 2001 From: lucy96chen <47800040+lucy96chen@users.noreply.github.com> Date: Tue, 26 Oct 2021 16:30:59 -0700 Subject: Expanded gfx::Format to include additional formats (#1982) * Format list updated with additional formats supported by both D3D and Vulkan; D3DUtil::getMapFormat() and VkUtil::getVkFormat() updated to include additional formats; GFX_FORMAT() updated with all additional formats (BC compression unfinished) * Finished updating GFX_FORMAT with newly added formats and sizes; Pixel size is now tracked using the FormatPixelSize struct containing the values for bytes per block and pixels per block to accomodate BC formats; Updated gfxGetFormatSize and associated sub-calls to return FormatPixelSize instead of uint8_t; Most calls to gfxGetFormatSize() updated to reflect changes, a couple calls still unupdated * Changes to accommodate new formats finished, debugging slang-literal unit test * First format unit test working * One test added for BC1Unorm and RGBA8Unorm_SRGB, both passing * Refactored format testing code to merge BC1Unorm and RGBA8Unorm SRGB into a single file * All unit tests added for BC and Srgb formats * Most tests added and working; Added five additional formats (still need tests) and made the appropriate changes to support these; createTextureView() modified for D3D11, D3D12, and Vulkan to take into account the format specified in the texture view desc when the texture's format is typeless * Format enums renamed to more closely match their D3D counterparts; Added a universal float and uint buffer and buffer view for use across all Format tests * Remaining tests added; D3D12 tests pass, but Vulkan crashes in BC1_UNORM and D3D11 spits out a bunch of D3D11 Errors (but supposedly passes) * re-run premake * Added Sint versions of test shaders; Vulkan and D3D11 tests also pass * Size struct for format unit tests no longer use initializer lists * Fixed a Size struct missed in the previous pass * Fixed minor bugs causing tests to fail * Added documentation detailing all currently unsupported formats * Skip tests causing unsupported format warnings due to swiftshader * updated several test using old Format enum names * Revert change to compareComputeResult() that was added for debugging purposes * DEBUGGING: Added prints to identify which formats are failing on CI * Reverted attempted debugging changes; Fixed texture2d-gather.hlsl to use updated Format enums * Fixed incorrect array sizes in d3d11 _initSrvDesc() * Commented out further tests that produce unexpected results when tested for Vulkan with swiftshader * Revert "Merge branch 'expanded-format-support' of https://github.com/lucy96chen/slang into expanded-format-support" This reverts commit 20008f0d3ecc3b1405ecac8c138edaa3cd37ed6b, reversing changes made to 6081e95827315fee50e18409394d5abd62fac787. * Added a fuzzy comparison function for use with floats * submodule update * Revert messed up changes caused by previous revert after automatically merging on github --- tests/bugs/texture2d-gather.hlsl | 2 +- tests/compute/half-rw-texture-convert.slang | 6 +++--- tests/compute/half-rw-texture-convert2.slang | 6 +++--- tests/compute/half-rw-texture-simple.slang | 6 +++--- tests/compute/rw-texture-simple.slang | 6 +++--- 5 files changed, 13 insertions(+), 13 deletions(-) (limited to 'tests') diff --git a/tests/bugs/texture2d-gather.hlsl b/tests/bugs/texture2d-gather.hlsl index 6eb8b1af7..d84c122b5 100644 --- a/tests/bugs/texture2d-gather.hlsl +++ b/tests/bugs/texture2d-gather.hlsl @@ -1,5 +1,5 @@ //TEST(smoke):COMPARE_HLSL_RENDER: -//TEST_INPUT: Texture2D(size=16, content=chessboard, format=R_Float32):name g_texture +//TEST_INPUT: Texture2D(size=16, content=chessboard, format=R32_FLOAT):name g_texture //TEST_INPUT: Sampler :name g_sampler Texture2D g_texture : register(t0); diff --git a/tests/compute/half-rw-texture-convert.slang b/tests/compute/half-rw-texture-convert.slang index 063f2329e..f3d8eedb5 100644 --- a/tests/compute/half-rw-texture-convert.slang +++ b/tests/compute/half-rw-texture-convert.slang @@ -11,15 +11,15 @@ // Note that this test is a little silly. The output does not confirm that the write actually worked. // half-rw-texture-convert2.slang tests this -//TEST_INPUT: RWTexture2D(format=R_Float16, size=4, content = one, mipMaps = 1):name rwt2D +//TEST_INPUT: RWTexture2D(format=R16_FLOAT, size=4, content = one, mipMaps = 1):name rwt2D [format("r16f")] RWTexture2D rwt2D; -//TEST_INPUT: RWTexture2D(format=RG_Float16, size=4, content = one, mipMaps = 1):name rwt2D_2 +//TEST_INPUT: RWTexture2D(format=R16G16_FLOAT, size=4, content = one, mipMaps = 1):name rwt2D_2 [format("rg16f")] RWTexture2D rwt2D_2; -//TEST_INPUT: RWTexture2D(format=RGBA_Float16, size=4, content = one, mipMaps = 1):name rwt2D_4 +//TEST_INPUT: RWTexture2D(format=R16G16B16A16_FLOAT, size=4, content = one, mipMaps = 1):name rwt2D_4 [format("rgba16f")] RWTexture2D rwt2D_4; diff --git a/tests/compute/half-rw-texture-convert2.slang b/tests/compute/half-rw-texture-convert2.slang index c190cf37b..1937b4c8e 100644 --- a/tests/compute/half-rw-texture-convert2.slang +++ b/tests/compute/half-rw-texture-convert2.slang @@ -8,15 +8,15 @@ //TEST(compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute -output-using-type -shaderobj //TEST(compute):COMPARE_COMPUTE_EX:-cuda -compute -output-using-type -shaderobj -render-features half -//TEST_INPUT: RWTexture2D(format=R_Float16, size=4, content = one, mipMaps = 1):name rwt2D +//TEST_INPUT: RWTexture2D(format=R16_FLOAT, size=4, content = one, mipMaps = 1):name rwt2D [format("r16f")] RWTexture2D rwt2D; -//TEST_INPUT: RWTexture2D(format=RG_Float16, size=4, content = one, mipMaps = 1):name rwt2D_2 +//TEST_INPUT: RWTexture2D(format=R16G16_FLOAT, size=4, content = one, mipMaps = 1):name rwt2D_2 [format("rg16f")] RWTexture2D rwt2D_2; -//TEST_INPUT: RWTexture2D(format=RGBA_Float16, size=4, content = one, mipMaps = 1):name rwt2D_4 +//TEST_INPUT: RWTexture2D(format=R16G16B16A16_FLOAT, size=4, content = one, mipMaps = 1):name rwt2D_4 [format("rgba16f")] RWTexture2D rwt2D_4; diff --git a/tests/compute/half-rw-texture-simple.slang b/tests/compute/half-rw-texture-simple.slang index f9b393529..8077b36a6 100644 --- a/tests/compute/half-rw-texture-simple.slang +++ b/tests/compute/half-rw-texture-simple.slang @@ -10,13 +10,13 @@ //DISABLE_TEST(compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute -output-using-type -shaderobj //TEST(compute):COMPARE_COMPUTE_EX:-cuda -compute -output-using-type -shaderobj -render-features half -//TEST_INPUT: RWTexture1D(format=R_Float16, size=4, content = one, mipMaps = 1):name rwt1D +//TEST_INPUT: RWTexture1D(format=R16_FLOAT, size=4, content = one, mipMaps = 1):name rwt1D RWTexture1D rwt1D; -//TEST_INPUT: RWTexture2D(format=R_Float16, size=4, content = one, mipMaps = 1):name rwt2D +//TEST_INPUT: RWTexture2D(format=R16_FLOAT, size=4, content = one, mipMaps = 1):name rwt2D RWTexture2D rwt2D; -//TEST_INPUT: RWTexture2D(format=RGBA_Float16, size=4, content = one, mipMaps = 1):name rwt2D_4 +//TEST_INPUT: RWTexture2D(format=R16G16B16A16_FLOAT, size=4, content = one, mipMaps = 1):name rwt2D_4 RWTexture2D rwt2D_4; //TEST_INPUT: ubuffer(data=[0 0 0 0], stride=4):out,name outputBuffer diff --git a/tests/compute/rw-texture-simple.slang b/tests/compute/rw-texture-simple.slang index aba12eee7..268337956 100644 --- a/tests/compute/rw-texture-simple.slang +++ b/tests/compute/rw-texture-simple.slang @@ -8,11 +8,11 @@ //TEST(compute):COMPARE_COMPUTE_EX:-cuda -compute -output-using-type -shaderobj -//TEST_INPUT: RWTexture1D(format=R_Float32, size=4, content = one, mipMaps = 1):name rwt1D +//TEST_INPUT: RWTexture1D(format=R32_FLOAT, size=4, content = one, mipMaps = 1):name rwt1D RWTexture1D rwt1D; -//TEST_INPUT: RWTexture2D(format=R_Float32, size=4, content = one, mipMaps = 1):name rwt2D +//TEST_INPUT: RWTexture2D(format=R32_FLOAT, size=4, content = one, mipMaps = 1):name rwt2D RWTexture2D rwt2D; -//TEST_INPUT: RWTexture3D(format=R_Float32, size=4, content = one, mipMaps = 1):name rwt3D +//TEST_INPUT: RWTexture3D(format=R32_FLOAT, size=4, content = one, mipMaps = 1):name rwt3D RWTexture3D rwt3D; //TEST_INPUT: ubuffer(data=[0 0 0 0], stride=4):out,name outputBuffer -- cgit v1.2.3