Skip to content

Commit 42ed25a

Browse files
committed
fixes to get it to compile after merge from master + old bugs in median
1 parent 7680a95 commit 42ed25a

4 files changed

Lines changed: 25 additions & 7 deletions

File tree

26_Autoexposure/CMakeLists.txt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,15 @@ if(NOT RES)
44
message(FATAL_ERROR "common.cmake not found. Should be in {repo_root}/cmake directory")
55
endif()
66

7-
nbl_create_executable_project("" "" "" "" "${NBL_EXECUTABLE_PROJECT_CREATION_PCH_TARGET}")
7+
set(NBL_INCLUDE_SERACH_DIRECTORIES
8+
"${CMAKE_CURRENT_SOURCE_DIR}/include"
9+
)
10+
11+
list(APPEND NBL_LIBRARIES
12+
Nabla::ext::FullScreenTriangle
13+
)
14+
15+
nbl_create_executable_project("" "" "${NBL_INCLUDE_SERACH_DIRECTORIES}" "${NBL_LIBRARIES}" "${NBL_EXECUTABLE_PROJECT_CREATION_PCH_TARGET}")
816

917
if(NBL_EMBED_BUILTIN_RESOURCES)
1018
set(_BR_TARGET_ ${EXECUTABLE_NAME}_builtinResourceData)

26_Autoexposure/app_resources/median_luma_meter.comp.hlsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ void main(uint32_t3 ID : SV_GroupThreadID, uint32_t3 GroupID : SV_GroupID)
6767
TexAccessor tex;
6868

6969
using LumaMeter = luma_meter::median_meter< WorkgroupSize, 8000, PtrAccessor, SharedAccessor, TexAccessor>;
70-
LumaMeter meter = LumaMeter::create(pushData.lumaMinMax, pushData.sampleCount);
70+
LumaMeter meter = LumaMeter::create(pushData.lumaMinMax);
7171

7272
meter.sampleLuma(pushData.window, histo_accessor, tex, sdata, (float32_t2)(glsl::gl_WorkGroupID() * glsl::gl_WorkGroupSize()), pushData.viewportSize);
7373
}

26_Autoexposure/app_resources/median_luma_tonemap.comp.hlsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ void main(uint32_t3 ID : SV_GroupThreadID, uint32_t3 GroupID : SV_GroupID)
7373
TexAccessor tex;
7474

7575
using LumaMeter = luma_meter::median_meter< WorkgroupSize, 8000, PtrAccessor, SharedAccessor, TexAccessor>;
76-
LumaMeter meter = LumaMeter::create(pushData.lumaMinMax, pushData.sampleCount);
76+
LumaMeter meter = LumaMeter::create(pushData.lumaMinMax);
7777

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

26_Autoexposure/main.cpp

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class AutoexposureApp final : public SimpleWindowedApplication, public BuiltinRe
4242
"app_resources/present.frag.hlsl"
4343
};
4444
constexpr static inline MeteringMode MeterMode = MeteringMode::AVERAGE;
45-
constexpr static inline uint32_t BinCount = 8000;
45+
constexpr static inline uint32_t BinCount = 8000; // TODO: it's 8000 here why? gonna set it to workgroup size (1024) for now
4646
constexpr static inline uint32_t2 Dimensions = { 1280, 720 };
4747
constexpr static inline float32_t2 MeteringWindowScale = { 0.8f, 0.8f };
4848
constexpr static inline float32_t2 MeteringWindowOffset = { 0.1f, 0.1f };
@@ -314,16 +314,26 @@ class AutoexposureApp final : public SimpleWindowedApplication, public BuiltinRe
314314

315315
const uint32_t workgroupSize = m_physicalDevice->getLimits().maxComputeWorkGroupInvocations;
316316
const uint32_t subgroupSize = m_physicalDevice->getLimits().maxSubgroupSize;
317-
const IShaderCompiler::SMacroDefinition defines[2] = {
317+
318+
struct MacroDefines
319+
{
320+
std::string identifier;
321+
std::string definition;
322+
};
323+
const MacroDefines definesBuf[2] = {
318324
{ "WorkgroupSize", std::to_string(workgroupSize) },
319325
{ "DeviceSubgroupSize", std::to_string(subgroupSize) }
320326
};
321-
options.preprocessorOptions.extraDefines = { defines, defines + 2 };
327+
328+
std::vector<IShaderCompiler::SMacroDefinition> defines;
329+
for (uint32_t i = 0; i < 2; i++)
330+
defines.emplace_back(definesBuf[i].identifier, definesBuf[i].definition);
331+
options.preprocessorOptions.extraDefines = defines;
322332

323333
auto overriddenSource = compiler->compileToSPIRV((const char*)source->getContent()->getPointer(), options);
324334
if (!overriddenSource)
325335
{
326-
m_logger->log("Shader creationed failed: %s!", ILogger::ELL_ERROR, pathToShader);
336+
m_logger->log("Shader creationed failed: %s!", ILogger::ELL_ERROR, pathToShader.c_str());
327337
std::exit(-1);
328338
}
329339

0 commit comments

Comments
 (0)