Skip to content

Commit 8d41254

Browse files
committed
Fixed run-time descriptors validation
1 parent facf68f commit 8d41254

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

03_DeviceSelectionAndSharedSources/app_resources/pplnLayoutMergeTest/shader_3.comp.hlsl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#pragma wave shader_stage(compute)
22
#include "common.hlsl"
33

4+
// breaking this shader for testing purpose, only last binding in descriptor set may be run-time sized
45
[[vk::binding(0,0)]] RWByteAddressBuffer output[];
56
[[vk::binding(1,0)]] RWStructuredBuffer<SomeType> asdf;
67

03_DeviceSelectionAndSharedSources/app_resources/shader.comp.hlsl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
struct SomeType
55
{
6-
uint16_t butt[6][9][45];
6+
uint16_t asdf[6][9][45];
77
};
88

99
[[vk::constant_id(3)]] const int TEST_INT_1 = 2;
@@ -24,7 +24,7 @@ PushConstants u_pushConstants;
2424
[numthreads(WorkgroupSize, 1, 1)]
2525
void main(uint32_t3 ID : SV_DispatchThreadID)
2626
{
27-
const uint32_t byteOffset = sizeof(uint32_t)*ID.x+TEST_INT_1+uint32_t(asdf[69].butt[4][5][0]);
27+
const uint32_t byteOffset = sizeof(uint32_t)*ID.x+TEST_INT_1+uint32_t(asdf[69].asdf[4][5][0]);
2828

2929
output.Store<uint32_t>(byteOffset,inputs[0].Load<uint32_t>(byteOffset)+inputs[1].Load<uint32_t>(byteOffset)
3030
+ uint32_t(u_pushConstants.a.x) + uint32_t(u_pushConstants.a.y) + uint32_t(u_pushConstants.b));

03_DeviceSelectionAndSharedSources/main.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ class DeviceSelectionAndSharedSourcesApp final : public application_templates::M
4040
if (!asset_base_t::onAppInitialized(std::move(system)))
4141
return false;
4242

43-
// TODO: run-time sized buffers are not supporten in hlsl.. do it when testing glsl
4443
// Just a check that out specialization info will match
4544
//if (!introspection->canSpecializationlesslyCreateDescSetFrom())
4645
//return logFail("Someone changed the shader and some descriptor binding depends on a specialization constant!");
@@ -59,11 +58,11 @@ class DeviceSelectionAndSharedSourcesApp final : public application_templates::M
5958
}
6059

6160
CSPIRVIntrospector introspector;
62-
auto mainShader = this->compileShaderAndTestIntrospection("app_resources/shader.comp.hlsl", introspector);
63-
auto source = mainShader.first;
64-
auto mainShaderIntrospection = mainShader.second;
61+
auto compiledShader = this->compileShaderAndTestIntrospection("app_resources/shader.comp.hlsl", introspector);
62+
auto source = compiledShader.first;
63+
auto shaderIntrospection = compiledShader.second;
6564

66-
//mainShaderIntrospection->debugPrint(m_logger.get());
65+
//shaderIntrospection->debugPrint(m_logger.get());
6766

6867
// We've now skipped the manual creation of a descriptor set layout, pipeline layout
6968
ICPUShader::SSpecInfo specInfo;
@@ -314,6 +313,8 @@ class DeviceSelectionAndSharedSourcesApp final : public application_templates::M
314313
const CSPIRVIntrospector::CStageIntrospectionData::SParams inspctParams = { .entryPoint = "main", .shader = spirvUnspecialized };
315314

316315
introspection = introspector.introspect(inspctParams);
316+
introspection->debugPrint(m_logger.get());
317+
317318
if (!introspection)
318319
{
319320
logFail("SPIR-V Introspection failed, probably the required SPIR-V compilation failed first!");

0 commit comments

Comments
 (0)