Skip to content

Commit 173a3c9

Browse files
author
kevyuu
committed
Fix compile error for example 23 and 29
1 parent 18bb325 commit 173a3c9

File tree

2 files changed

+17
-17
lines changed

2 files changed

+17
-17
lines changed

23_Arithmetic2UnitTest/main.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ class Workgroup2ScanTestApp final : public application_templates::BasicMultiQueu
157157
exit(-1);
158158
}
159159
auto firstAssetInBundle = bundle.getContents()[0];
160-
return smart_refctd_ptr_static_cast<ICPUShader>(firstAssetInBundle);
160+
return smart_refctd_ptr_static_cast<IShader>(firstAssetInBundle);
161161
};
162162

163163
auto subgroupTestSource = getShaderSource("app_resources/testSubgroup.comp.hlsl");
@@ -263,26 +263,26 @@ class Workgroup2ScanTestApp final : public application_templates::BasicMultiQueu
263263
}
264264

265265
// create pipeline (specialized every test) [TODO: turn into a future/async]
266-
smart_refctd_ptr<IGPUComputePipeline> createPipeline(const ICPUShader* overridenUnspecialized, const uint8_t subgroupSizeLog2)
266+
smart_refctd_ptr<IGPUComputePipeline> createPipeline(const IShader* overridenUnspecialized, const uint8_t subgroupSizeLog2)
267267
{
268-
auto shader = m_device->createShader(overridenUnspecialized);
268+
auto shader = m_device->compileShader({ overridenUnspecialized });
269269
IGPUComputePipeline::SCreationParams params = {};
270270
params.layout = pipelineLayout.get();
271271
params.shader = {
272-
.entryPoint = "main",
273272
.shader = shader.get(),
273+
.entryPoint = "main",
274+
.requiredSubgroupSize = static_cast<IPipelineBase::SUBGROUP_SIZE>(subgroupSizeLog2),
274275
.entries = nullptr,
275-
.requiredSubgroupSize = static_cast<IGPUShader::SSpecInfo::SUBGROUP_SIZE>(subgroupSizeLog2),
276-
.requireFullSubgroups = true
277276
};
277+
params.cached.requireFullSubgroups = true;
278278
core::smart_refctd_ptr<IGPUComputePipeline> pipeline;
279279
if (!m_device->createComputePipelines(m_spirv_isa_cache.get(),{&params,1},&pipeline))
280280
return nullptr;
281281
return pipeline;
282282
}
283283

284284
template<template<class> class Arithmetic, bool WorkgroupTest>
285-
bool runTest(const smart_refctd_ptr<const ICPUShader>& source, const uint32_t elementCount, const uint8_t subgroupSizeLog2, const uint32_t workgroupSize, bool useNative, uint32_t itemsPerWG, uint32_t itemsPerInvoc = 1u)
285+
bool runTest(const smart_refctd_ptr<const IShader>& source, const uint32_t elementCount, const uint8_t subgroupSizeLog2, const uint32_t workgroupSize, bool useNative, uint32_t itemsPerWG, uint32_t itemsPerInvoc = 1u)
286286
{
287287
std::string arith_name = Arithmetic<arithmetic::bit_xor<float>>::name;
288288
const uint32_t workgroupSizeLog2 = hlsl::findMSB(workgroupSize);
@@ -305,7 +305,7 @@ class Workgroup2ScanTestApp final : public application_templates::BasicMultiQueu
305305
auto* includeFinder = compiler->getDefaultIncludeFinder();
306306
options.preprocessorOptions.includeFinder = includeFinder;
307307

308-
smart_refctd_ptr<ICPUShader> overriddenUnspecialized;
308+
smart_refctd_ptr<IShader> overriddenUnspecialized;
309309
if constexpr (WorkgroupTest)
310310
{
311311
hlsl::workgroup2::SArithmeticConfiguration wgConfig;

29_Arithmetic2Bench/main.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -346,12 +346,12 @@ class ArithmeticBenchApp final : public examples::SimpleWindowedApplication, pub
346346
exit(-1);
347347
}
348348
auto firstAssetInBundle = bundle.getContents()[0];
349-
return smart_refctd_ptr_static_cast<ICPUShader>(firstAssetInBundle);
349+
return smart_refctd_ptr_static_cast<IShader>(firstAssetInBundle);
350350
};
351351

352352
// for each workgroup size (manually adjust items per invoc, operation else uses up a lot of ram)
353353
const auto MaxSubgroupSize = m_physicalDevice->getLimits().maxSubgroupSize;
354-
smart_refctd_ptr<ICPUShader> shaderSource;
354+
smart_refctd_ptr<IShader> shaderSource;
355355
if constexpr (DoWorkgroupBenchmarks)
356356
shaderSource = getShaderSource("app_resources/benchmarkWorkgroup.comp.hlsl");
357357
else
@@ -496,18 +496,18 @@ class ArithmeticBenchApp final : public examples::SimpleWindowedApplication, pub
496496

497497
private:
498498
// create pipeline (specialized every test) [TODO: turn into a future/async]
499-
smart_refctd_ptr<IGPUComputePipeline> createPipeline(const ICPUShader* overridenUnspecialized, const IGPUPipelineLayout* layout, const uint8_t subgroupSizeLog2)
499+
smart_refctd_ptr<IGPUComputePipeline> createPipeline(const IShader* overridenUnspecialized, const IGPUPipelineLayout* layout, const uint8_t subgroupSizeLog2)
500500
{
501-
auto shader = m_device->createShader(overridenUnspecialized);
501+
auto shader = m_device->compileShader({ overridenUnspecialized });
502502
IGPUComputePipeline::SCreationParams params = {};
503503
params.layout = layout;
504504
params.shader = {
505-
.entryPoint = "main",
506505
.shader = shader.get(),
506+
.entryPoint = "main",
507+
.requiredSubgroupSize = static_cast<IPipelineBase::SUBGROUP_SIZE>(subgroupSizeLog2),
507508
.entries = nullptr,
508-
.requiredSubgroupSize = static_cast<IGPUShader::SSpecInfo::SUBGROUP_SIZE>(subgroupSizeLog2),
509-
.requireFullSubgroups = true
510509
};
510+
params.cached.requireFullSubgroups = true;
511511
core::smart_refctd_ptr<IGPUComputePipeline> pipeline;
512512
if (!m_device->createComputePipelines(nullptr,{&params,1},&pipeline))
513513
return nullptr;
@@ -522,7 +522,7 @@ class ArithmeticBenchApp final : public examples::SimpleWindowedApplication, pub
522522
};
523523

524524
template<bool WorkgroupBench>
525-
BenchmarkSet createBenchmarkPipelines(const smart_refctd_ptr<const ICPUShader>&source, const IGPUPipelineLayout* layout, const uint32_t elementCount, const std::string& arith_name, const uint8_t subgroupSizeLog2, const uint32_t workgroupSize, uint32_t itemsPerInvoc = 1u, uint32_t numLoops = 8u)
525+
BenchmarkSet createBenchmarkPipelines(const smart_refctd_ptr<const IShader>&source, const IGPUPipelineLayout* layout, const uint32_t elementCount, const std::string& arith_name, const uint8_t subgroupSizeLog2, const uint32_t workgroupSize, uint32_t itemsPerInvoc = 1u, uint32_t numLoops = 8u)
526526
{
527527
auto compiler = make_smart_refctd_ptr<asset::CHLSLCompiler>(smart_refctd_ptr(m_system));
528528
CHLSLCompiler::SOptions options = {};
@@ -547,7 +547,7 @@ class ArithmeticBenchApp final : public examples::SimpleWindowedApplication, pub
547547
hlsl::workgroup2::SArithmeticConfiguration wgConfig;
548548
wgConfig.init(workgroupSizeLog2, subgroupSizeLog2, itemsPerInvoc);
549549
const uint32_t itemsPerWG = wgConfig.VirtualWorkgroupSize * wgConfig.ItemsPerInvocation_0;
550-
smart_refctd_ptr<ICPUShader> overriddenUnspecialized;
550+
smart_refctd_ptr<IShader> overriddenUnspecialized;
551551
if constexpr (WorkgroupBench)
552552
{
553553
const std::string definitions[4] = {

0 commit comments

Comments
 (0)