Skip to content

Commit b9f3f13

Browse files
author
kevyuu
committed
Fix example to use reworked shader spec itnerface
1 parent 3698fb4 commit b9f3f13

File tree

16 files changed

+36
-46
lines changed

16 files changed

+36
-46
lines changed

02_HelloCompute/main.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,6 @@ class HelloComputeApp final : public nbl::application_templates::MonoSystemMonoL
169169
// Theoretically a blob of SPIR-V can contain multiple named entry points and one has to be chosen, in practice most compilers only support outputting one (and glslang used to require it be called "main")
170170
params.shader.entryPoint = "main";
171171
params.shader.shader = shader.get();
172-
params.shader.stage = hlsl::ESS_COMPUTE;
173172
// we'll cover the specialization constant API in another example
174173
if (!device->createComputePipelines(nullptr,{&params,1},&pipeline))
175174
return logFail("Failed to create pipelines (compile & link shaders)!\n");

03_DeviceSelectionAndSharedSources/Testers.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -254,10 +254,9 @@ class PredefinedLayoutTester final : public IntrospectionTesterBase
254254
bool pplnCreationSuccess[MERGE_TEST_SHADERS_CNT];
255255
for (uint32_t i = 0u; i < MERGE_TEST_SHADERS_CNT; ++i)
256256
{
257-
IPipelineBase::SShaderSpecInfo specInfo;
257+
ICPUPipelineBase::SShaderSpecInfo specInfo;
258258
specInfo.entryPoint = "main";
259-
specInfo.shader = sources[i].get();
260-
specInfo.stage = hlsl::ShaderStage::ESS_COMPUTE;
259+
specInfo.shader = sources[i];
261260
pplnCreationSuccess[i] = static_cast<bool>(introspector[i].createApproximateComputePipelineFromIntrospection(specInfo, core::smart_refctd_ptr<ICPUPipelineLayout>(predefinedPplnLayout)));
262261
}
263262

03_DeviceSelectionAndSharedSources/main.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,9 @@ class DeviceSelectionAndSharedSourcesApp final : public application_templates::M
6161
//shaderIntrospection->debugPrint(m_logger.get());
6262

6363
// We've now skipped the manual creation of a descriptor set layout, pipeline layout
64-
IPipelineBase::SShaderSpecInfo specInfo;
64+
ICPUPipelineBase::SShaderSpecInfo specInfo;
6565
specInfo.entryPoint = "main";
66-
specInfo.shader = source.get();
67-
specInfo.stage = hlsl::ShaderStage::ESS_COMPUTE;
66+
specInfo.shader = source;
6867

6968
smart_refctd_ptr<nbl::asset::ICPUComputePipeline> cpuPipeline = introspector.createApproximateComputePipelineFromIntrospection(specInfo);
7069

05_StreamingAndBufferDeviceAddressApp/main.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,6 @@ class StreamingAndBufferDeviceAddressApp final : public application_templates::M
135135
params.layout = layout.get();
136136
params.shader.shader = shader.get();
137137
params.shader.entryPoint = "main";
138-
params.shader.stage = hlsl::ShaderStage::ESS_COMPUTE;
139138
if (!m_device->createComputePipelines(nullptr,{&params,1},&m_pipeline))
140139
return logFail("Failed to create compute pipeline!\n");
141140
}

07_StagingAndMultipleQueues/main.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,6 @@ class StagingAndMultipleQueuesApp final : public application_templates::BasicMul
311311
// Theoretically a blob of SPIR-V can contain multiple named entry points and one has to be chosen, in practice most compilers only support outputting one (and glslang used to require it be called "main")
312312
params.shader.entryPoint = "main";
313313
params.shader.shader = shader.get();
314-
params.shader.stage = hlsl::ShaderStage::ESS_COMPUTE;
315314
// we'll cover the specialization constant API in another example
316315
if (!m_device->createComputePipelines(nullptr,{&params,1},&pipeline))
317316
logFailAndTerminate("Failed to create pipelines (compile & link shaders)!\n");

10_CountingSort/main.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,9 @@ class CountingSortApp final : public application_templates::MonoDeviceApplicatio
9292
params.layout = layout.get();
9393
params.shader.shader = prefixSumShader.get();
9494
params.shader.entryPoint = "main";
95-
params.shader.stage = hlsl::ShaderStage::ESS_COMPUTE;
9695
params.shader.entries = nullptr;
97-
params.shader.requireFullSubgroups = true;
98-
params.shader.requiredSubgroupSize = static_cast<IPipelineBase::SShaderSpecInfo::SUBGROUP_SIZE>(5);
96+
params.shader.requiredSubgroupSize = static_cast<IPipelineBase::SUBGROUP_SIZE>(5);
97+
params.cached.requireFullSubgroups = true;
9998
if (!m_device->createComputePipelines(nullptr, { &params,1 }, &prefixSumPipeline))
10099
return logFail("Failed to create compute pipeline!\n");
101100
params.shader.shader = scatterShader.get();

11_FFT/main.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,8 @@ class FFT_Test final : public application_templates::MonoDeviceApplication, publ
133133
params.layout = layout.get();
134134
params.shader.shader = shader.get();
135135
params.shader.entryPoint = "main";
136-
params.shader.stage = hlsl::ESS_COMPUTE;
137-
params.shader.requiredSubgroupSize = static_cast<IPipelineBase::SShaderSpecInfo::SUBGROUP_SIZE>(hlsl::findMSB(m_physicalDevice->getLimits().maxSubgroupSize));
138-
params.shader.requireFullSubgroups = true;
136+
params.shader.requiredSubgroupSize = static_cast<IPipelineBase::SUBGROUP_SIZE>(hlsl::findMSB(m_physicalDevice->getLimits().maxSubgroupSize));
137+
params.cached.requireFullSubgroups = true;
139138
if (!m_device->createComputePipelines(nullptr, { &params,1 }, &m_pipeline))
140139
return logFail("Failed to create compute pipeline!\n");
141140
}

22_CppCompat/ITester.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@ class ITester
113113
params.layout = m_pplnLayout.get();
114114
params.shader.entryPoint = "main";
115115
params.shader.shader = shader.get();
116-
params.shader.stage = shaderStage;
117116
if (!m_device->createComputePipelines(nullptr, { &params,1 }, &m_pipeline))
118117
logFail("Failed to create pipelines (compile & link shaders)!\n");
119118
}

22_CppCompat/main.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,6 @@ class CompatibilityTest final : public MonoDeviceApplication, public MonoAssetMa
128128
params.layout = layout.get();
129129
params.shader.shader = shader.get();
130130
params.shader.entryPoint = "main";
131-
params.shader.stage = hlsl::ShaderStage::ESS_COMPUTE;
132131
if (!m_device->createComputePipelines(nullptr, { &params,1 }, &m_pipeline))
133132
return logFail("Failed to create compute pipeline!\n");
134133
}

23_ArithmeticUnitTest/main.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -284,11 +284,10 @@ class ArithmeticUnitTestApp final : public application_templates::BasicMultiQueu
284284
params.shader = {
285285
.shader = shader.get(),
286286
.entryPoint = "main",
287-
.stage = hlsl::ESS_COMPUTE,
288-
.requiredSubgroupSize = static_cast<IPipelineBase::SShaderSpecInfo::SUBGROUP_SIZE>(subgroupSizeLog2),
289-
.requireFullSubgroups = true,
287+
.requiredSubgroupSize = static_cast<IPipelineBase::SUBGROUP_SIZE>(subgroupSizeLog2),
290288
.entries = nullptr,
291289
};
290+
params.cached.requireFullSubgroups = true;
292291
core::smart_refctd_ptr<IGPUComputePipeline> pipeline;
293292
if (!m_device->createComputePipelines(m_spirv_isa_cache.get(),{&params,1},&pipeline))
294293
return nullptr;

0 commit comments

Comments
 (0)