Skip to content

Commit 233db45

Browse files
committed
rename defines to all caps, refactor luma meter template names
1 parent 9c330d3 commit 233db45

6 files changed

Lines changed: 20 additions & 20 deletions

File tree

26_Autoexposure/app_resources/avg_luma_meter.comp.hlsl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ using PtrAccessor = BdaAccessor < uint32_t >;
1616

1717
[[vk::push_constant]] AutoexposurePushData pushData;
1818

19-
groupshared float32_t sdata[WorkgroupSize];
19+
groupshared float32_t sdata[WORKGROUP_SIZE];
2020
struct SharedAccessor
2121
{
2222
using type = float32_t;
@@ -49,10 +49,10 @@ struct TexAccessor
4949

5050
uint32_t3 glsl::gl_WorkGroupSize()
5151
{
52-
return uint32_t3(DeviceSubgroupSize, DeviceSubgroupSize, 1);
52+
return uint32_t3(SUBGROUP_SIZE, SUBGROUP_SIZE, 1);
5353
}
5454

55-
[numthreads(DeviceSubgroupSize, DeviceSubgroupSize, 1)]
55+
[numthreads(SUBGROUP_SIZE, SUBGROUP_SIZE, 1)]
5656
[shader("compute")]
5757
void main(uint32_t3 ID : SV_GroupThreadID, uint32_t3 GroupID : SV_GroupID)
5858
{
@@ -62,7 +62,7 @@ void main(uint32_t3 ID : SV_GroupThreadID, uint32_t3 GroupID : SV_GroupID)
6262
SharedAccessor sdata;
6363
TexAccessor tex;
6464

65-
using LumaMeter = luma_meter::geom_meter< WorkgroupSize, PtrAccessor, SharedAccessor, TexAccessor>;
65+
using LumaMeter = luma_meter::geom_meter< WORKGROUP_SIZE, SUBGROUP_SIZE, PtrAccessor, SharedAccessor, TexAccessor>;
6666
LumaMeter meter = LumaMeter::create(pushData.lumaMin, pushData.lumaMax, pushData.sampleCount, pushData.rcpFirstPassWGCount);
6767

6868
uint32_t texWidth, texHeight;

26_Autoexposure/app_resources/avg_luma_tonemap.comp.hlsl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ using PtrAccessor = BdaAccessor < uint32_t >;
2121

2222
[[vk::push_constant]] AutoexposurePushData pushData;
2323

24-
groupshared float32_t sdata[WorkgroupSize];
24+
groupshared float32_t sdata[WORKGROUP_SIZE];
2525
struct SharedAccessor
2626
{
2727
using type = float32_t;
@@ -54,10 +54,10 @@ struct TexAccessor
5454

5555
uint32_t3 glsl::gl_WorkGroupSize()
5656
{
57-
return uint32_t3(DeviceSubgroupSize, DeviceSubgroupSize, 1);
57+
return uint32_t3(SUBGROUP_SIZE, SUBGROUP_SIZE, 1);
5858
}
5959

60-
[numthreads(DeviceSubgroupSize, DeviceSubgroupSize, 1)]
60+
[numthreads(SUBGROUP_SIZE, SUBGROUP_SIZE, 1)]
6161
[shader("compute")]
6262
void main(uint32_t3 ID : SV_GroupThreadID, uint32_t3 GroupID : SV_GroupID)
6363
{
@@ -67,7 +67,7 @@ void main(uint32_t3 ID : SV_GroupThreadID, uint32_t3 GroupID : SV_GroupID)
6767
SharedAccessor sdata;
6868
TexAccessor tex;
6969

70-
using LumaMeter = luma_meter::geom_meter< WorkgroupSize, PtrAccessor, SharedAccessor, TexAccessor>;
70+
using LumaMeter = luma_meter::geom_meter< WORKGROUP_SIZE, SUBGROUP_SIZE, PtrAccessor, SharedAccessor, TexAccessor>;
7171
LumaMeter meter = LumaMeter::create(pushData.lumaMin, pushData.lumaMax, pushData.sampleCount, pushData.rcpFirstPassWGCount);
7272

7373
float32_t EV = meter.gatherLuma(val_accessor);

26_Autoexposure/app_resources/common.hlsl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@ struct AutoexposurePushData
3232

3333
#ifdef __HLSL_VERSION
3434

35-
#ifndef WorkgroupSize
36-
#error "Define WorkgroupSize!"
35+
#ifndef WORKGROUP_SIZE
36+
#error "Define WORKGROUP_SIZE!"
3737
#endif
3838

39-
#ifndef DeviceSubgroupSize
40-
#error "Define DeviceSubgroupSize!"
39+
#ifndef SUBGROUP_SIZE
40+
#error "Define SUBGROUP_SIZE!"
4141
#endif
4242

4343
#endif

26_Autoexposure/app_resources/median_luma_meter.comp.hlsl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,10 @@ struct TexAccessor
5555

5656
uint32_t3 glsl::gl_WorkGroupSize()
5757
{
58-
return uint32_t3(DeviceSubgroupSize, DeviceSubgroupSize, 1);
58+
return uint32_t3(SUBGROUP_SIZE, SUBGROUP_SIZE, 1);
5959
}
6060

61-
[numthreads(DeviceSubgroupSize, DeviceSubgroupSize, 1)]
61+
[numthreads(SUBGROUP_SIZE, SUBGROUP_SIZE, 1)]
6262
[shader("compute")]
6363
void main(uint32_t3 ID : SV_GroupThreadID, uint32_t3 GroupID : SV_GroupID)
6464
{
@@ -68,7 +68,7 @@ void main(uint32_t3 ID : SV_GroupThreadID, uint32_t3 GroupID : SV_GroupID)
6868
SharedAccessor sdata;
6969
TexAccessor tex;
7070

71-
using LumaMeter = luma_meter::median_meter< WorkgroupSize, BIN_COUNT, PtrAccessor, SharedAccessor, TexAccessor>;
71+
using LumaMeter = luma_meter::median_meter< WORKGROUP_SIZE, BIN_COUNT, PtrAccessor, SharedAccessor, TexAccessor>;
7272
LumaMeter meter = LumaMeter::create(pushData.lumaMin, pushData.lumaMax, pushData.lowerBoundPercentile, pushData.upperBoundPercentile);
7373

7474
uint32_t texWidth, texHeight;

26_Autoexposure/app_resources/median_luma_tonemap.comp.hlsl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,10 @@ struct TexAccessor
6161

6262
uint32_t3 glsl::gl_WorkGroupSize()
6363
{
64-
return uint32_t3(DeviceSubgroupSize, DeviceSubgroupSize, 1);
64+
return uint32_t3(SUBGROUP_SIZE, SUBGROUP_SIZE, 1);
6565
}
6666

67-
[numthreads(DeviceSubgroupSize, DeviceSubgroupSize, 1)]
67+
[numthreads(SUBGROUP_SIZE, SUBGROUP_SIZE, 1)]
6868
[shader("compute")]
6969
void main(uint32_t3 ID : SV_GroupThreadID, uint32_t3 GroupID : SV_GroupID)
7070
{
@@ -74,7 +74,7 @@ void main(uint32_t3 ID : SV_GroupThreadID, uint32_t3 GroupID : SV_GroupID)
7474
SharedAccessor sdata;
7575
TexAccessor tex;
7676

77-
using LumaMeter = luma_meter::median_meter< WorkgroupSize, BIN_COUNT, PtrAccessor, SharedAccessor, TexAccessor>;
77+
using LumaMeter = luma_meter::median_meter< WORKGROUP_SIZE, BIN_COUNT, PtrAccessor, SharedAccessor, TexAccessor>;
7878
LumaMeter meter = LumaMeter::create(pushData.lumaMin, pushData.lumaMax, pushData.lowerBoundPercentile, pushData.upperBoundPercentile);
7979

8080
float32_t EV = meter.gatherLuma(histo_accessor, sdata);

26_Autoexposure/main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -322,8 +322,8 @@ class AutoexposureApp final : public SimpleWindowedApplication, public BuiltinRe
322322
std::string definition;
323323
};
324324
const MacroDefines definesBuf[2] = {
325-
{ "WorkgroupSize", std::to_string(workgroupSize) },
326-
{ "DeviceSubgroupSize", std::to_string(subgroupSize) }
325+
{ "WORKGROUP_SIZE", std::to_string(workgroupSize) },
326+
{ "SUBGROUP_SIZE", std::to_string(subgroupSize) }
327327
};
328328

329329
std::vector<IShaderCompiler::SMacroDefinition> defines;

0 commit comments

Comments
 (0)