Skip to content

Commit

Permalink
Enable some rendering tests (#5623)
Browse files Browse the repository at this point in the history
* render-test: Add copy-source usage for render targets

I found that Slang-RHI/WGPU was not able to copy from render targets to staging buffers.

This helps to address issue #4943.

* Add entries to render API util infos

Entries for glsl-cross and glsl-rewrite are added.

Without glsl-cross, slang-test fails to select a back-end, and winds up crashing when
tests/render/cross-compile-entry-point.slang is enabled

tests/render/cross-compile0.hlsl fails similarly without glsl-rewrite.

* Enable some rendering tests

* Add expected test outputs
  • Loading branch information
aleino-nv authored Nov 21, 2024
1 parent dbc28b4 commit dcc7c6f
Show file tree
Hide file tree
Showing 36 changed files with 86 additions and 11 deletions.
2 changes: 1 addition & 1 deletion source/core/slang-render-api-util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace Slang
/* static */ const RenderApiUtil::Info RenderApiUtil::s_infos[] = {
{RenderApiType::Vulkan, "vk,vulkan", ""},
{RenderApiType::D3D12, "dx12,d3d12", ""},
{RenderApiType::D3D11, "dx11,d3d11", "hlsl,hlsl-rewrite,slang"},
{RenderApiType::D3D11, "dx11,d3d11", "hlsl,hlsl-rewrite,glsl-rewrite,glsl-cross,slang"},
{RenderApiType::Metal, "mtl,metal", ""},
{RenderApiType::CPU, "cpu", ""},
{RenderApiType::CUDA, "cuda", "cuda,ptx"},
Expand Down
3 changes: 3 additions & 0 deletions tests/expected-failure-github.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ tests/language-feature/saturated-cooperation/fuse3.slang (vk)
tests/language-feature/saturated-cooperation/fuse-product.slang (vk)
tests/language-feature/saturated-cooperation/fuse.slang (vk)
tests/bugs/byte-address-buffer-interlocked-add-f32.slang (vk)
tests/render/render0.hlsl (mtl)
tests/render/nointerpolation.hlsl (mtl)
tests/serialization/obfuscated-serialized-module-test.slang.2 syn (mtl)
tests/autodiff/custom-intrinsic.slang.2 syn (wgpu)
tests/bugs/buffer-swizzle-store.slang.3 syn (wgpu)
Expand All @@ -17,3 +19,4 @@ tests/language-feature/generics/variadic-0.slang.4 syn (wgpu)
tests/language-feature/shader-params/interface-shader-param-ordinary.slang.4 syn (wgpu)
tests/language-feature/swizzles/matrix-swizzle-write-array.slang.3 syn (wgpu)
tests/language-feature/swizzles/matrix-swizzle-write-swizzle.slang.3 syn (wgpu)
tests/render/nointerpolation.hlsl (wgpu)
3 changes: 1 addition & 2 deletions tests/render/cross-compile-entry-point.slang
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// //TEST(render):COMPARE_HLSL_CROSS_COMPILE_RENDER:
// //TEST(render):COMPARE_HLSL_CROSS_COMPILE_RENDER: -dx12
//TEST(render):COMPARE_HLSL_CROSS_COMPILE_RENDER:


// This is a test to ensure that we can cross-compile a complete entry point.
Expand Down
5 changes: 5 additions & 0 deletions tests/render/cross-compile-entry-point.slang.1.expected
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
result code = 0
standard error = {
}
standard output = {
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions tests/render/cross-compile-entry-point.slang.2.expected
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
result code = 0
standard error = {
}
standard output = {
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions tests/render/cross-compile-entry-point.slang.expected
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
result code = 0
standard error = {
}
standard output = {
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 1 addition & 2 deletions tests/render/cross-compile0.hlsl
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
//DISABLED_TEST(smoke,render):COMPARE_HLSL_GLSL_RENDER:
//DISABLED_TEST(smoke,render):COMPARE_HLSL_GLSL_RENDER: -dx12
//TEST(smoke,render):COMPARE_HLSL_GLSL_RENDER:

// This is a basic test case for cross-compilation behavior.
//
Expand Down
5 changes: 5 additions & 0 deletions tests/render/cross-compile0.hlsl.1.expected
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
result code = 0
standard error = {
}
standard output = {
}
Binary file added tests/render/cross-compile0.hlsl.1.expected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions tests/render/cross-compile0.hlsl.2.expected
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
result code = 0
standard error = {
}
standard output = {
}
Binary file added tests/render/cross-compile0.hlsl.2.expected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions tests/render/cross-compile0.hlsl.expected
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
result code = 0
standard error = {
}
standard output = {
}
Binary file added tests/render/cross-compile0.hlsl.expected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 1 addition & 2 deletions tests/render/imported-parameters.hlsl
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
//DISABLED_TEST(smoke,render):COMPARE_HLSL_GLSL_RENDER:
//DISABLED_TEST(smoke,render):COMPARE_HLSL_GLSL_RENDER: -dx12
//TEST(smoke,render):COMPARE_HLSL_GLSL_RENDER:

// This test is trying to ensure that we can
// correctly handle cases where top-level shader
Expand Down
5 changes: 5 additions & 0 deletions tests/render/imported-parameters.hlsl.1.expected
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
result code = 0
standard error = {
}
standard output = {
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions tests/render/imported-parameters.hlsl.2.expected
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
result code = 0
standard error = {
}
standard output = {
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions tests/render/imported-parameters.hlsl.expected
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
result code = 0
standard error = {
}
standard output = {
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 5 additions & 2 deletions tests/render/nointerpolation.hlsl
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
//DISABLED_TEST(smoke):COMPARE_HLSL_RENDER:
//DISABLED_TEST(smoke):COMPARE_HLSL_RENDER: -dx12
//TEST(smoke):COMPARE_HLSL_RENDER:
// WGSL: nointerpolate doesn't work #5625
//DISABLE_TEST(smoke):COMPARE_HLSL_RENDER: -wgpu
// TODO: Investigate Metal failure
//DISABLE_TEST(smoke):COMPARE_HLSL_RENDER: -mtl

// Confirm that the `nointerpolation` modifier
// makes it through Slang codegen with the
Expand Down
5 changes: 5 additions & 0 deletions tests/render/nointerpolation.hlsl.2.expected
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
result code = 0
standard error = {
}
standard output = {
}
Binary file added tests/render/nointerpolation.hlsl.2.expected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions tests/render/nointerpolation.hlsl.expected
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
result code = 0
standard error = {
}
standard output = {
}
Binary file added tests/render/nointerpolation.hlsl.expected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion tests/render/render0.hlsl
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
//DISABLED_TEST(smoke):COMPARE_HLSL_RENDER:
// Starting with a basic test for the ability to render stuff...

//TEST(smoke,render):COMPARE_HLSL_RENDER:
//DISABLE_TEST(smoke,render):COMPARE_HLSL_RENDER: -mtl

cbuffer Uniforms
{
float4x4 modelViewProjection;
Expand Down
5 changes: 5 additions & 0 deletions tests/render/render0.hlsl.2.expected
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
result code = 0
standard error = {
}
standard output = {
}
Binary file added tests/render/render0.hlsl.2.expected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions tests/render/render0.hlsl.3.expected
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
result code = 0
standard error = {
}
standard output = {
}
Binary file added tests/render/render0.hlsl.3.expected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions tests/render/render0.hlsl.expected
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
result code = 0
standard error = {
}
standard output = {
}
Binary file added tests/render/render0.hlsl.expected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion tools/render-test/render-test-main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,7 @@ void RenderTestApp::_initializeRenderPass()
colorBufferDesc.size.depth = 1;
colorBufferDesc.mipLevelCount = 1;
colorBufferDesc.format = Format::R8G8B8A8_UNORM;
colorBufferDesc.usage = TextureUsage::RenderTarget;
colorBufferDesc.usage = TextureUsage::RenderTarget | TextureUsage::CopySource;
colorBufferDesc.defaultState = ResourceState::RenderTarget;
m_colorBuffer = m_device->createTexture(colorBufferDesc, nullptr);
SLANG_ASSERT(m_colorBuffer);
Expand Down

0 comments on commit dcc7c6f

Please sign in to comment.