Skip to content

Commit ad454c4

Browse files
committed
Added new test
1 parent 6c9da55 commit ad454c4

File tree

2 files changed

+28
-5
lines changed

2 files changed

+28
-5
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#pragma wave shader_stage(compute)
2+
#include "common.hlsl"
3+
4+
[[vk::binding(0,0)]] RWByteAddressBuffer output[];
5+
[[vk::binding(1,0)]] RWStructuredBuffer<SomeType> asdf;
6+
7+
[numthreads(WorkgroupSize, 1, 1)]
8+
void main(uint32_t3 ID : SV_DispatchThreadID)
9+
{
10+
const uint32_t index = ID.x;
11+
const uint32_t byteOffset = sizeof(uint32_t)*index;
12+
13+
output[index].Store<uint32_t>(byteOffset, asdf[index].a);
14+
}

03_DeviceSelectionAndSharedSources/main.cpp

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,13 @@ class DeviceSelectionAndSharedSourcesApp final : public application_templates::M
5454
#endif
5555
// testing creation of compute pipeline layouts compatible for multiple shaders
5656
{
57-
constexpr uint32_t MERGE_TEST_SHADERS_CNT = 3u;
58-
59-
60-
std::array mergeTestShadersPaths = {
57+
constexpr std::array mergeTestShadersPaths = {
6158
"app_resources/pplnLayoutMergeTest/shader_1.comp.hlsl",
6259
"app_resources/pplnLayoutMergeTest/shader_2.comp.hlsl",
63-
"app_resources/pplnLayoutMergeTest/shader_3.comp.hlsl"
60+
"app_resources/pplnLayoutMergeTest/shader_3.comp.hlsl",
61+
"app_resources/pplnLayoutMergeTest/shader_4.comp.hlsl"
6462
};
63+
constexpr uint32_t MERGE_TEST_SHADERS_CNT = mergeTestShadersPaths.size();
6564

6665
auto confirmExpectedOutput = [this](bool value, bool expectedValue)
6766
{
@@ -89,9 +88,19 @@ class DeviceSelectionAndSharedSourcesApp final : public application_templates::M
8988

9089
core::smart_refctd_ptr<CSPIRVIntrospector::CPipelineIntrospectionData> pplnIntroData;
9190
pplnIntroData = core::make_smart_refctd_ptr<CSPIRVIntrospector::CPipelineIntrospectionData>();
91+
92+
// should merge successfully since shader is not messed up and it is the first merge
9293
confirmExpectedOutput(pplnIntroData->merge(introspections[0].get()), true);
94+
// should merge successfully since pipeline layout of "shader_2.comp.hlsl" is compatible with "shader_1.comp.hlsl"
9395
confirmExpectedOutput(pplnIntroData->merge(introspections[1].get()), true);
96+
// should not merge since pipeline layout of "shader_3.comp.hlsl" is not compatible with "shader_1.comp.hlsl"
9497
confirmExpectedOutput(pplnIntroData->merge(introspections[2].get()), false);
98+
99+
core::smart_refctd_ptr<CSPIRVIntrospector::CPipelineIntrospectionData> pplnIntroData2;
100+
pplnIntroData2 = core::make_smart_refctd_ptr<CSPIRVIntrospector::CPipelineIntrospectionData>();
101+
102+
// should not merge since run-time sized destriptor of "shader_4.comp.hlsl" is not last
103+
confirmExpectedOutput(pplnIntroData2->merge(introspections[3].get()), false);
95104
}
96105

97106
m_logger->log("------- shader.comp.hlsl INTROSPECTION -------", ILogger::E_LOG_LEVEL::ELL_WARNING);

0 commit comments

Comments
 (0)