diff --git a/AnKi/Gr/BackendCommon/Common.h b/AnKi/Gr/BackendCommon/Common.h index abaafb477..c49aea933 100644 --- a/AnKi/Gr/BackendCommon/Common.h +++ b/AnKi/Gr/BackendCommon/Common.h @@ -9,9 +9,6 @@ namespace anki { -/// There is no need to ask for a fence or a semaphore to be waited for more than 10 seconds. The GPU will timeout anyway. -constexpr Second kMaxFenceOrSemaphoreWaitTime = 120.0; - constexpr U32 kMaxQueriesPerQueryChunk = 64; } // end namespace anki diff --git a/AnKi/Gr/Common.h b/AnKi/Gr/Common.h index eba1fb3f8..aac74a31b 100644 --- a/AnKi/Gr/Common.h +++ b/AnKi/Gr/Common.h @@ -45,6 +45,8 @@ inline BoolCVar g_rayTracingCVar("Gr", "RayTracing", false, "Try enabling ray tr inline BoolCVar g_vrsCVar("Gr", "Vrs", false, "Enable or not VRS"); inline BoolCVar g_workGraphcsCVar("Gr", "WorkGraphs", false, "Enable or not WorkGraphs"); inline NumericCVar g_maxBindlessSampledTextureCountCVar("Gr", "MaxBindlessSampledTextureCountCVar", 512, 16, kMaxU16); +inline NumericCVar g_gpuTimeoutCVar("Gr", "GpuTimeout", 120.0, 0.0, 24.0 * 60.0, + "Max time to wait for GPU fences or semaphores. More than that it must be a GPU timeout"); #if ANKI_GR_BACKEND_DIRECT3D inline NumericCVar g_maxRtvDescriptorsCVar("Gr", "MaxRvtDescriptors", 1024, 8, kMaxU16, "Max number of RTVs"); diff --git a/AnKi/Gr/D3D/D3DFence.cpp b/AnKi/Gr/D3D/D3DFence.cpp index 69aed809a..60dc24343 100644 --- a/AnKi/Gr/D3D/D3DFence.cpp +++ b/AnKi/Gr/D3D/D3DFence.cpp @@ -39,7 +39,7 @@ Bool MicroFence::clientWait(Second seconds) } else { - seconds = min(seconds, kMaxFenceOrSemaphoreWaitTime); + seconds = min(seconds, g_gpuTimeoutCVar); ANKI_D3D_CHECKF(m_fence->SetEventOnCompletion(m_value.load(), m_event)); @@ -134,7 +134,7 @@ void FenceFactory::trimSignaledFences(Bool wait) GrDynamicArray unsignaledFences; for(MicroFence* fence : m_fences) { - const Bool signaled = fence->clientWait((wait) ? kMaxFenceOrSemaphoreWaitTime : 0.0f); + const Bool signaled = fence->clientWait((wait) ? g_gpuTimeoutCVar : 0.0); if(signaled) { deleteInstance(GrMemoryPool::getSingleton(), fence); diff --git a/AnKi/Gr/Vulkan/VkFenceFactory.cpp b/AnKi/Gr/Vulkan/VkFenceFactory.cpp index 75b73060e..c69ea4e02 100644 --- a/AnKi/Gr/Vulkan/VkFenceFactory.cpp +++ b/AnKi/Gr/Vulkan/VkFenceFactory.cpp @@ -93,7 +93,7 @@ void FenceFactory::trimSignaledFences(Bool wait) GrDynamicArray unsignaledFences; for(MicroFence* fence : m_fences) { - const Bool signaled = fence->clientWait((wait) ? kMaxFenceOrSemaphoreWaitTime : 0.0f); + const Bool signaled = fence->clientWait((wait) ? g_gpuTimeoutCVar : 0.0); if(signaled) { deleteInstance(GrMemoryPool::getSingleton(), fence); diff --git a/AnKi/Gr/Vulkan/VkFenceFactory.h b/AnKi/Gr/Vulkan/VkFenceFactory.h index b1398c3e7..9ff4b416d 100644 --- a/AnKi/Gr/Vulkan/VkFenceFactory.h +++ b/AnKi/Gr/Vulkan/VkFenceFactory.h @@ -77,7 +77,7 @@ class MicroFence } else { - seconds = min(seconds, kMaxFenceOrSemaphoreWaitTime); + seconds = min(seconds, g_gpuTimeoutCVar); const F64 nsf = 1e+9 * seconds; const U64 ns = U64(nsf); VkResult res; diff --git a/AnKi/Gr/Vulkan/VkSemaphoreFactory.cpp b/AnKi/Gr/Vulkan/VkSemaphoreFactory.cpp index 5286c5873..06ec655de 100644 --- a/AnKi/Gr/Vulkan/VkSemaphoreFactory.cpp +++ b/AnKi/Gr/Vulkan/VkSemaphoreFactory.cpp @@ -39,7 +39,7 @@ Bool MicroSemaphore::clientWait(Second seconds) { ANKI_ASSERT(m_isTimeline); - seconds = min(seconds, kMaxFenceOrSemaphoreWaitTime); + seconds = min(seconds, g_gpuTimeoutCVar); VkSemaphoreWaitInfo waitInfo = {}; waitInfo.sType = VK_STRUCTURE_TYPE_SEMAPHORE_WAIT_INFO; diff --git a/AnKi/Renderer/Bloom.cpp b/AnKi/Renderer/Bloom.cpp index 91ca395df..cd9e29c32 100644 --- a/AnKi/Renderer/Bloom.cpp +++ b/AnKi/Renderer/Bloom.cpp @@ -17,8 +17,6 @@ Error Bloom::init() const UVec2 pyramidSize = getRenderer().getInternalResolution() / 2; const U32 pyramidMipCount = computeMaxMipmapCount2d(pyramidSize.x(), pyramidSize.y(), g_bloomPyramidLowLimit); - ANKI_R_LOGV("Initializing bloom downscale pyramid. Resolution %ux%u, mip count %u", pyramidSize.x(), pyramidSize.y(), pyramidMipCount); - const Bool preferCompute = g_preferComputeCVar; // Create the miped texture diff --git a/AnKi/Renderer/Dbg.cpp b/AnKi/Renderer/Dbg.cpp index 60759019b..fca0beed6 100644 --- a/AnKi/Renderer/Dbg.cpp +++ b/AnKi/Renderer/Dbg.cpp @@ -31,8 +31,6 @@ Dbg::~Dbg() Error Dbg::init() { - ANKI_R_LOGV("Initializing DBG"); - // RT descr m_rtDescr = getRenderer().create2DRenderTargetDescription(getRenderer().getInternalResolution().x(), getRenderer().getInternalResolution().y(), Format::kR8G8B8A8_Unorm, "Dbg"); diff --git a/AnKi/Renderer/DepthDownscale.cpp b/AnKi/Renderer/DepthDownscale.cpp index 760642069..ef5368244 100644 --- a/AnKi/Renderer/DepthDownscale.cpp +++ b/AnKi/Renderer/DepthDownscale.cpp @@ -41,8 +41,6 @@ Error DepthDownscale::initInternal() const UVec2 lastMipSize = UVec2(width, height) >> (m_mipCount - 1); - ANKI_R_LOGV("Initializing HiZ. Mip count %u, last mip size %ux%u", m_mipCount, lastMipSize.x(), lastMipSize.y()); - const Bool preferCompute = g_preferComputeCVar; // Create RT descr diff --git a/AnKi/Renderer/FinalComposite.cpp b/AnKi/Renderer/FinalComposite.cpp index fd5458f8f..db0845282 100644 --- a/AnKi/Renderer/FinalComposite.cpp +++ b/AnKi/Renderer/FinalComposite.cpp @@ -37,8 +37,6 @@ namespace anki { Error FinalComposite::initInternal() { - ANKI_R_LOGV("Initializing final composite"); - // Progs for(MutatorValue dbg = 0; dbg < 2; ++dbg) { diff --git a/AnKi/Renderer/GBuffer.cpp b/AnKi/Renderer/GBuffer.cpp index 3f923586b..b90878e35 100644 --- a/AnKi/Renderer/GBuffer.cpp +++ b/AnKi/Renderer/GBuffer.cpp @@ -24,20 +24,6 @@ GBuffer::~GBuffer() Error GBuffer::init() { - Error err = initInternal(); - - if(err) - { - ANKI_R_LOGE("Failed to initialize g-buffer pass"); - } - - return err; -} - -Error GBuffer::initInternal() -{ - ANKI_R_LOGV("Initializing GBuffer. Resolution %ux%u", getRenderer().getInternalResolution().x(), getRenderer().getInternalResolution().y()); - // RTs static constexpr Array depthRtNames = {{"GBuffer depth #0", "GBuffer depth #1"}}; for(U32 i = 0; i < 2; ++i) diff --git a/AnKi/Renderer/GBuffer.h b/AnKi/Renderer/GBuffer.h index 6165179f9..ff9ffd1af 100644 --- a/AnKi/Renderer/GBuffer.h +++ b/AnKi/Renderer/GBuffer.h @@ -93,8 +93,6 @@ class GBuffer : public RendererObject BufferView m_visibleAaabbIndicesBuffer; ///< Optional BufferHandle m_visibleAaabbIndicesBufferDepedency; } m_runCtx; - - Error initInternal(); }; /// @} diff --git a/AnKi/Renderer/GBufferPost.cpp b/AnKi/Renderer/GBufferPost.cpp index d4be60a45..312fdbad9 100644 --- a/AnKi/Renderer/GBufferPost.cpp +++ b/AnKi/Renderer/GBufferPost.cpp @@ -13,21 +13,7 @@ namespace anki { Error GBufferPost::init() { - const Error err = initInternal(); - if(err) - { - ANKI_R_LOGE("Failed to initialize GBufferPost pass"); - } - return err; -} - -Error GBufferPost::initInternal() -{ - ANKI_R_LOGV("Initializing GBufferPost pass"); - - // Load shaders ANKI_CHECK(loadShaderProgram("ShaderBinaries/GBufferPost.ankiprogbin", m_prog, m_grProg)); - return Error::kNone; } diff --git a/AnKi/Renderer/GBufferPost.h b/AnKi/Renderer/GBufferPost.h index f5ba56590..f98a6d2bf 100644 --- a/AnKi/Renderer/GBufferPost.h +++ b/AnKi/Renderer/GBufferPost.h @@ -24,8 +24,6 @@ class GBufferPost : public RendererObject private: ShaderProgramResourcePtr m_prog; ShaderProgramPtr m_grProg; - - Error initInternal(); }; /// @} diff --git a/AnKi/Renderer/LensFlare.cpp b/AnKi/Renderer/LensFlare.cpp index 6ccde9d4e..89bf8b96a 100644 --- a/AnKi/Renderer/LensFlare.cpp +++ b/AnKi/Renderer/LensFlare.cpp @@ -27,8 +27,6 @@ Error LensFlare::init() Error LensFlare::initInternal() { - ANKI_R_LOGV("Initializing lens flare"); - m_maxSpritesPerFlare = g_lensFlareMaxSpritesPerFlareCVar; ANKI_CHECK(loadShaderProgram("ShaderBinaries/LensFlareSprite.ankiprogbin", m_realProg, m_realGrProg)); diff --git a/AnKi/Renderer/LightShading.cpp b/AnKi/Renderer/LightShading.cpp index e3b7a9aa2..aaef3aa59 100644 --- a/AnKi/Renderer/LightShading.cpp +++ b/AnKi/Renderer/LightShading.cpp @@ -27,66 +27,37 @@ namespace anki { Error LightShading::init() { - ANKI_R_LOGV("Initializing light shading"); + { + // Load shaders and programs + ANKI_CHECK(loadShaderProgram("ShaderBinaries/LightShading.ankiprogbin", m_lightShading.m_prog, m_lightShading.m_grProg)); - Error err = initLightShading(); + // Create RT descr + const UVec2 internalResolution = getRenderer().getInternalResolution(); + m_lightShading.m_rtDescr = getRenderer().create2DRenderTargetDescription(internalResolution.x(), internalResolution.y(), + getRenderer().getHdrFormat(), "Light Shading"); + m_lightShading.m_rtDescr.bake(); - if(!err) - { - err = initSkybox(); + // Debug visualization + ANKI_CHECK(loadShaderProgram("ShaderBinaries/VisualizeHdrRenderTarget.ankiprogbin", m_visualizeRtProg, m_visualizeRtGrProg)); } - if(!err) { - err = initApplyFog(); - } + ANKI_CHECK(ResourceManager::getSingleton().loadResource("ShaderBinaries/LightShadingSkybox.ankiprogbin", m_skybox.m_prog)); - if(err) - { - ANKI_R_LOGE("Failed to init light stage"); + for(MutatorValue method = 0; method < 3; ++method) + { + ANKI_CHECK(loadShaderProgram("ShaderBinaries/LightShadingSkybox.ankiprogbin", {{"METHOD", method}}, m_skybox.m_prog, + m_skybox.m_grProgs[method])); + } } - return err; -} - -Error LightShading::initLightShading() -{ - // Load shaders and programs - ANKI_CHECK(loadShaderProgram("ShaderBinaries/LightShading.ankiprogbin", m_lightShading.m_prog, m_lightShading.m_grProg)); - - // Create RT descr - const UVec2 internalResolution = getRenderer().getInternalResolution(); - m_lightShading.m_rtDescr = - getRenderer().create2DRenderTargetDescription(internalResolution.x(), internalResolution.y(), getRenderer().getHdrFormat(), "Light Shading"); - m_lightShading.m_rtDescr.bake(); - - // Debug visualization - ANKI_CHECK(loadShaderProgram("ShaderBinaries/VisualizeHdrRenderTarget.ankiprogbin", m_visualizeRtProg, m_visualizeRtGrProg)); - - return Error::kNone; -} - -Error LightShading::initSkybox() -{ - ANKI_CHECK(ResourceManager::getSingleton().loadResource("ShaderBinaries/LightShadingSkybox.ankiprogbin", m_skybox.m_prog)); - - for(MutatorValue method = 0; method < 3; ++method) { - ANKI_CHECK( - loadShaderProgram("ShaderBinaries/LightShadingSkybox.ankiprogbin", {{"METHOD", method}}, m_skybox.m_prog, m_skybox.m_grProgs[method])); + ANKI_CHECK(loadShaderProgram("ShaderBinaries/LightShadingApplyFog.ankiprogbin", m_applyFog.m_prog, m_applyFog.m_grProg)); } return Error::kNone; } -Error LightShading::initApplyFog() -{ - // Load shaders and programs - ANKI_CHECK(loadShaderProgram("ShaderBinaries/LightShadingApplyFog.ankiprogbin", m_applyFog.m_prog, m_applyFog.m_grProg)); - - return Error::kNone; -} - void LightShading::run(const RenderingContext& ctx, RenderPassWorkContext& rgraphCtx) { ANKI_TRACE_SCOPED_EVENT(LightShading); diff --git a/AnKi/Renderer/LightShading.h b/AnKi/Renderer/LightShading.h index 83d579c6d..b8b7569ac 100644 --- a/AnKi/Renderer/LightShading.h +++ b/AnKi/Renderer/LightShading.h @@ -65,10 +65,6 @@ class LightShading : public RendererObject ShaderProgramResourcePtr m_visualizeRtProg; ShaderProgramPtr m_visualizeRtGrProg; - Error initLightShading(); - Error initSkybox(); - Error initApplyFog(); - void run(const RenderingContext& ctx, RenderPassWorkContext& rgraphCtx); void getDebugRenderTarget(CString rtName, Array& handles, diff --git a/AnKi/Renderer/MotionVectors.cpp b/AnKi/Renderer/MotionVectors.cpp index d1a86f6df..37c7dee74 100644 --- a/AnKi/Renderer/MotionVectors.cpp +++ b/AnKi/Renderer/MotionVectors.cpp @@ -14,22 +14,8 @@ namespace anki { Error MotionVectors::init() { - const Error err = initInternal(); - if(err) - { - ANKI_R_LOGE("Failed to initialize motion vectors"); - } - return err; -} - -Error MotionVectors::initInternal() -{ - ANKI_R_LOGV("Initializing motion vectors"); - - // Prog ANKI_CHECK(loadShaderProgram("ShaderBinaries/MotionVectors.ankiprogbin", m_prog, m_grProg)); - // RTs m_motionVectorsRtDescr = getRenderer().create2DRenderTargetDescription( getRenderer().getInternalResolution().x(), getRenderer().getInternalResolution().y(), Format::kR16G16_Sfloat, "MotionVectors"); m_motionVectorsRtDescr.bake(); diff --git a/AnKi/Renderer/MotionVectors.h b/AnKi/Renderer/MotionVectors.h index fdf6eaf19..4b8ed31ca 100644 --- a/AnKi/Renderer/MotionVectors.h +++ b/AnKi/Renderer/MotionVectors.h @@ -50,8 +50,6 @@ class MotionVectors : public RendererObject public: RenderTargetHandle m_motionVectorsRtHandle; } m_runCtx; - - Error initInternal(); }; /// @} diff --git a/AnKi/Renderer/Renderer.cpp b/AnKi/Renderer/Renderer.cpp index 648328100..8a66ccc53 100644 --- a/AnKi/Renderer/Renderer.cpp +++ b/AnKi/Renderer/Renderer.cpp @@ -183,7 +183,13 @@ Error Renderer::initInternal(const RendererInitInfo& inf) if(initCondition) \ { \ m_##name2 = newInstance(RendererMemoryPool::getSingleton()); \ - ANKI_CHECK(m_##name2->init()); \ + ANKI_R_LOGV("Initializing " ANKI_STRINGIZE(name)); \ + const Error err = m_##name2->init(); \ + if(err) \ + { \ + ANKI_R_LOGE("Initialization failed: " ANKI_STRINGIZE(name)); \ + return err; \ + } \ } #include diff --git a/AnKi/Renderer/RtShadows.cpp b/AnKi/Renderer/RtShadows.cpp index c5cd43b01..666c5f116 100644 --- a/AnKi/Renderer/RtShadows.cpp +++ b/AnKi/Renderer/RtShadows.cpp @@ -23,19 +23,6 @@ namespace anki { Error RtShadows::init() { - const Error err = initInternal(); - if(err) - { - ANKI_R_LOGE("Failed to initialize ray traced shadows"); - } - - return err; -} - -Error RtShadows::initInternal() -{ - ANKI_R_LOGV("Initializing RT shadows"); - m_useSvgf = g_rtShadowsSvgfCVar; m_atrousPassCount = g_rtShadowsSvgfAtrousPassCountCVar; diff --git a/AnKi/Renderer/RtShadows.h b/AnKi/Renderer/RtShadows.h index 10aa0f800..25af5e4a2 100644 --- a/AnKi/Renderer/RtShadows.h +++ b/AnKi/Renderer/RtShadows.h @@ -104,8 +104,6 @@ class RtShadows : public RendererObject Array m_varianceRts; } m_runCtx; - Error initInternal(); - void runDenoise(const RenderingContext& ctx, RenderPassWorkContext& rgraphCtx, Bool horizontal); U32 getPassCountWithoutUpscaling() const diff --git a/AnKi/Renderer/ShadowMapping.cpp b/AnKi/Renderer/ShadowMapping.cpp index 82d569481..d73910c9f 100644 --- a/AnKi/Renderer/ShadowMapping.cpp +++ b/AnKi/Renderer/ShadowMapping.cpp @@ -60,27 +60,12 @@ static LightHash decodeTileHash(U64 hash) } Error ShadowMapping::init() -{ - const Error err = initInternal(); - if(err) - { - ANKI_R_LOGE("Failed to initialize shadowmapping"); - } - - return err; -} - -Error ShadowMapping::initInternal() { // Init RT { m_tileResolution = g_shadowMappingTileResolutionCVar; m_tileCountBothAxis = g_shadowMappingTileCountPerRowOrColumnCVar; - ANKI_R_LOGV("Initializing shadowmapping. Atlas resolution %ux%u", m_tileResolution * m_tileCountBothAxis, - m_tileResolution * m_tileCountBothAxis); - - // RT const TextureUsageBit usage = TextureUsageBit::kSrvPixel | TextureUsageBit::kSrvCompute | TextureUsageBit::kAllRtvDsv; TextureInitInfo texinit = getRenderer().create2DRenderTargetInitInfo( m_tileResolution * m_tileCountBothAxis, m_tileResolution * m_tileCountBothAxis, Format::kD32_Sfloat, usage, "ShadowAtlas"); diff --git a/AnKi/Renderer/ShadowMapping.h b/AnKi/Renderer/ShadowMapping.h index 5e2e74920..48ab1ee4b 100644 --- a/AnKi/Renderer/ShadowMapping.h +++ b/AnKi/Renderer/ShadowMapping.h @@ -75,8 +75,6 @@ class ShadowMapping : public RendererObject RenderTargetHandle m_rt; } m_runCtx; - Error initInternal(); - void processLights(RenderingContext& ctx); TileAllocatorResult2 allocateAtlasTiles(U32 lightUuid, U32 componentIndex, U32 faceCount, const U32* hierarchies, UVec4* atlasTileViewports); diff --git a/AnKi/Renderer/ShadowmapsResolve.cpp b/AnKi/Renderer/ShadowmapsResolve.cpp index 9b6288949..c9f580a13 100644 --- a/AnKi/Renderer/ShadowmapsResolve.cpp +++ b/AnKi/Renderer/ShadowmapsResolve.cpp @@ -16,24 +16,11 @@ namespace anki { Error ShadowmapsResolve::init() -{ - const Error err = initInternal(); - if(err) - { - ANKI_R_LOGE("Failed to initialize shadow resolve pass"); - } - - return Error::kNone; -} - -Error ShadowmapsResolve::initInternal() { m_quarterRez = g_smResolveQuarterRezCVar; const U32 width = getRenderer().getInternalResolution().x() / (m_quarterRez + 1); const U32 height = getRenderer().getInternalResolution().y() / (m_quarterRez + 1); - ANKI_R_LOGV("Initializing shadowmaps resolve. Resolution %ux%u", width, height); - m_rtDescr = getRenderer().create2DRenderTargetDescription(width, height, Format::kR8G8B8A8_Unorm, "SM resolve"); m_rtDescr.bake(); diff --git a/AnKi/Renderer/ShadowmapsResolve.h b/AnKi/Renderer/ShadowmapsResolve.h index 1f3a6466e..1a0d0fe98 100644 --- a/AnKi/Renderer/ShadowmapsResolve.h +++ b/AnKi/Renderer/ShadowmapsResolve.h @@ -54,8 +54,6 @@ class ShadowmapsResolve : public RendererObject RenderTargetHandle m_rt; } m_runCtx; - Error initInternal(); - void run(RenderPassWorkContext& rgraphCtx, RenderingContext& ctx); }; /// @} diff --git a/AnKi/Renderer/Sky.cpp b/AnKi/Renderer/Sky.cpp index e7d5e45fc..95945ebad 100644 --- a/AnKi/Renderer/Sky.cpp +++ b/AnKi/Renderer/Sky.cpp @@ -13,19 +13,6 @@ namespace anki { Error Sky::init() { - const Error err = initInternal(); - if(err) - { - ANKI_R_LOGE("Failed to initialize sky passes"); - } - - return Error::kNone; -} - -Error Sky::initInternal() -{ - ANKI_R_LOGV("Initializing sky passes"); - ANKI_CHECK(loadShaderProgram("ShaderBinaries/Sky.ankiprogbin", {}, m_prog, m_transmittanceLutGrProg, "SkyTransmittanceLut")); ANKI_CHECK(loadShaderProgram("ShaderBinaries/Sky.ankiprogbin", {}, m_prog, m_multipleScatteringLutGrProg, "SkyMultipleScatteringLut")); ANKI_CHECK(loadShaderProgram("ShaderBinaries/Sky.ankiprogbin", {}, m_prog, m_skyLutGrProg, "SkyLut")); diff --git a/AnKi/Renderer/Sky.h b/AnKi/Renderer/Sky.h index dcc2da802..e399a954b 100644 --- a/AnKi/Renderer/Sky.h +++ b/AnKi/Renderer/Sky.h @@ -67,8 +67,6 @@ class Sky : public RendererObject public: RenderTargetHandle m_skyLutRt; } m_runCtx; - - Error initInternal(); }; /// @} diff --git a/AnKi/Renderer/Ssao.cpp b/AnKi/Renderer/Ssao.cpp index 6df644224..ff134fee1 100644 --- a/AnKi/Renderer/Ssao.cpp +++ b/AnKi/Renderer/Ssao.cpp @@ -13,21 +13,8 @@ namespace anki { Error Ssao::init() -{ - const Error err = initInternal(); - if(err) - { - ANKI_R_LOGE("Failed to initialize SSAO"); - } - return err; -} - -Error Ssao::initInternal() { const UVec2 rez = (g_ssaoQuarterRezCVar) ? getRenderer().getInternalResolution() / 2 : getRenderer().getInternalResolution(); - - ANKI_R_LOGV("Initializing SSAO. Resolution %ux%u", rez.x(), rez.y()); - const Bool preferCompute = g_preferComputeCVar; { diff --git a/AnKi/Renderer/Ssr.cpp b/AnKi/Renderer/Ssr.cpp index e618957cd..4602e6bec 100644 --- a/AnKi/Renderer/Ssr.cpp +++ b/AnKi/Renderer/Ssr.cpp @@ -30,21 +30,9 @@ namespace anki { Error Ssr::init() -{ - const Error err = initInternal(); - if(err) - { - ANKI_R_LOGE("Failed to initialize SSR"); - } - return err; -} - -Error Ssr::initInternal() { const UVec2 rez = (g_ssrQuarterResolutionCVar) ? getRenderer().getInternalResolution() / 2 : getRenderer().getInternalResolution(); - ANKI_R_LOGV("Initializing SSR. Resolution %ux%u", rez.x(), rez.y()); - TextureUsageBit mipTexUsage = TextureUsageBit::kAllSrv; if(g_preferComputeCVar) { diff --git a/AnKi/Renderer/Ssr.h b/AnKi/Renderer/Ssr.h index e4e6e89e0..bc21801e6 100644 --- a/AnKi/Renderer/Ssr.h +++ b/AnKi/Renderer/Ssr.h @@ -56,8 +56,6 @@ class Ssr : public RendererObject public: RenderTargetHandle m_ssrRt; } m_runCtx; - - Error initInternal(); }; /// @} diff --git a/AnKi/Renderer/TemporalAA.cpp b/AnKi/Renderer/TemporalAA.cpp index df753f72d..2ddfc657d 100644 --- a/AnKi/Renderer/TemporalAA.cpp +++ b/AnKi/Renderer/TemporalAA.cpp @@ -16,19 +16,6 @@ namespace anki { Error TemporalAA::init() { - const Error err = initInternal(); - if(err) - { - ANKI_R_LOGE("Failed to init TAA"); - } - - return Error::kNone; -} - -Error TemporalAA::initInternal() -{ - ANKI_R_LOGV("Initializing TAA"); - ANKI_CHECK(loadShaderProgram("ShaderBinaries/TemporalAA.ankiprogbin", {{"VARIANCE_CLIPPING", 1}, {"YCBCR", 0}}, m_prog, m_grProg)); for(U32 i = 0; i < 2; ++i) diff --git a/AnKi/Renderer/TemporalAA.h b/AnKi/Renderer/TemporalAA.h index f1efda665..a031d95db 100644 --- a/AnKi/Renderer/TemporalAA.h +++ b/AnKi/Renderer/TemporalAA.h @@ -38,8 +38,6 @@ class TemporalAA : public RendererObject RenderTargetHandle m_renderRt; RenderTargetHandle m_historyRt; } m_runCtx; - - Error initInternal(); }; /// @} diff --git a/AnKi/Renderer/Tonemapping.cpp b/AnKi/Renderer/Tonemapping.cpp index 5dfc40b34..4581f0815 100644 --- a/AnKi/Renderer/Tonemapping.cpp +++ b/AnKi/Renderer/Tonemapping.cpp @@ -14,25 +14,12 @@ namespace anki { Error Tonemapping::init() -{ - const Error err = initInternal(); - if(err) - { - ANKI_R_LOGE("Failed to initialize tonemapping"); - } - - return err; -} - -Error Tonemapping::initInternal() { { m_expAndAvgLum.m_inputTexMip = (getRenderer().getBloom().getPyramidTextureMipmapCount() > 2) ? getRenderer().getBloom().getPyramidTextureMipmapCount() - 2 : 0; const UVec2 size = getRenderer().getBloom().getPyramidTextureSize() >> m_expAndAvgLum.m_inputTexMip; - ANKI_R_LOGV("Initializing tonemapping. Resolution %ux%u", size.x(), size.y()); - // Create program ANKI_CHECK(loadShaderProgram("ShaderBinaries/TonemappingAverageLuminance.ankiprogbin", m_expAndAvgLum.m_prog, m_expAndAvgLum.m_grProg)); diff --git a/AnKi/Renderer/Tonemapping.h b/AnKi/Renderer/Tonemapping.h index a678650e1..4ec3c9e6f 100644 --- a/AnKi/Renderer/Tonemapping.h +++ b/AnKi/Renderer/Tonemapping.h @@ -63,8 +63,6 @@ class Tonemapping : public RendererObject RenderTargetHandle m_exposureLuminanceHandle; RenderTargetHandle m_rt; } m_runCtx; - - Error initInternal(); }; /// @} diff --git a/AnKi/Renderer/VolumetricFog.cpp b/AnKi/Renderer/VolumetricFog.cpp index 63aea91a5..001927f23 100644 --- a/AnKi/Renderer/VolumetricFog.cpp +++ b/AnKi/Renderer/VolumetricFog.cpp @@ -26,8 +26,6 @@ Error VolumetricFog::init() m_volumeSize[1] = U32(F32(getRenderer().getTileCounts().y()) * qualityXY); m_volumeSize[2] = U32(F32(m_finalZSplit + 1) * qualityZ); - ANKI_R_LOGV("Initializing volumetric fog. Resolution %ux%ux%u", m_volumeSize[0], m_volumeSize[1], m_volumeSize[2]); - // Shaders ANKI_CHECK(loadShaderProgram("ShaderBinaries/VolumetricFogAccumulation.ankiprogbin", m_prog, m_grProg)); diff --git a/AnKi/Renderer/VolumetricLightingAccumulation.cpp b/AnKi/Renderer/VolumetricLightingAccumulation.cpp index 42c370787..58dd06ad3 100644 --- a/AnKi/Renderer/VolumetricLightingAccumulation.cpp +++ b/AnKi/Renderer/VolumetricLightingAccumulation.cpp @@ -25,7 +25,6 @@ Error VolumetricLightingAccumulation::init() m_volumeSize[0] = U32(F32(getRenderer().getTileCounts().x()) * qualityXY); m_volumeSize[1] = U32(F32(getRenderer().getTileCounts().y()) * qualityXY); m_volumeSize[2] = U32(F32(finalZSplit + 1) * qualityZ); - ANKI_R_LOGV("Initializing volumetric lighting accumulation. Size %ux%ux%u", m_volumeSize[0], m_volumeSize[1], m_volumeSize[2]); if(!isAligned(getRenderer().getTileCounts().x(), m_volumeSize[0]) || !isAligned(getRenderer().getTileCounts().y(), m_volumeSize[1]) || m_volumeSize[0] == 0 || m_volumeSize[1] == 0 || m_volumeSize[2] == 0) diff --git a/AnKi/Renderer/VrsSriGeneration.cpp b/AnKi/Renderer/VrsSriGeneration.cpp index f19ed13db..2a988fa47 100644 --- a/AnKi/Renderer/VrsSriGeneration.cpp +++ b/AnKi/Renderer/VrsSriGeneration.cpp @@ -12,16 +12,6 @@ namespace anki { Error VrsSriGeneration::init() -{ - const Error err = initInternal(); - if(err) - { - ANKI_R_LOGE("Failed to initialize VRS SRI generation"); - } - return err; -} - -Error VrsSriGeneration::initInternal() { if(!GrManager::getSingleton().getDeviceCapabilities().m_vrs) { @@ -32,8 +22,6 @@ Error VrsSriGeneration::initInternal() ANKI_ASSERT(m_sriTexelDimension == 8 || m_sriTexelDimension == 16); const UVec2 rez = (getRenderer().getInternalResolution() + m_sriTexelDimension - 1) / m_sriTexelDimension; - ANKI_R_LOGV("Intializing VRS SRI generation. SRI resolution %ux%u", rez.x(), rez.y()); - // Create textures const TextureUsageBit texUsage = TextureUsageBit::kShadingRate | TextureUsageBit::kUavCompute | TextureUsageBit::kAllSrv; TextureInitInfo sriInitInfo = getRenderer().create2DRenderTargetInitInfo(rez.x(), rez.y(), Format::kR8_Uint, texUsage, "VrsSri"); diff --git a/AnKi/Renderer/VrsSriGeneration.h b/AnKi/Renderer/VrsSriGeneration.h index 2f9ae7dfb..468af6c19 100644 --- a/AnKi/Renderer/VrsSriGeneration.h +++ b/AnKi/Renderer/VrsSriGeneration.h @@ -69,8 +69,6 @@ class VrsSriGeneration : public RendererObject RenderTargetHandle m_downscaledRt; } m_runCtx; - Error initInternal(); - void getDebugRenderTarget(CString rtName, Array& handles, ShaderProgramPtr& optionalShaderProgram) const override; }; diff --git a/AnKi/Util/CVarSet.cpp b/AnKi/Util/CVarSet.cpp index f10f4bbcb..d3e5db796 100644 --- a/AnKi/Util/CVarSet.cpp +++ b/AnKi/Util/CVarSet.cpp @@ -103,6 +103,7 @@ Error CVarSet::setMultiple(ConstWeakArray arr) ANKI_CVAR_NUMERIC_SET(U32) ANKI_CVAR_NUMERIC_SET(PtrSize) ANKI_CVAR_NUMERIC_SET(F32) + ANKI_CVAR_NUMERIC_SET(F64) default: ANKI_ASSERT(0); } diff --git a/AnKi/Util/CVarSet.h b/AnKi/Util/CVarSet.h index 17af10bd7..65bcda35e 100644 --- a/AnKi/Util/CVarSet.h +++ b/AnKi/Util/CVarSet.h @@ -40,7 +40,8 @@ class CVar : public IntrusiveListEnabled kNumericU16, kNumericU32, kNumericPtrSize, - kNumericF32 + kNumericF32, + kNumericF64 }; Type m_type; @@ -111,6 +112,7 @@ ANKI_CVAR_NUMERIC_TYPE(U16) ANKI_CVAR_NUMERIC_TYPE(U32) ANKI_CVAR_NUMERIC_TYPE(PtrSize) ANKI_CVAR_NUMERIC_TYPE(F32) +ANKI_CVAR_NUMERIC_TYPE(F64) #undef ANKI_CVAR_NUMERIC_TYPE /// String config variable. diff --git a/AnKi/Util/Logger.cpp b/AnKi/Util/Logger.cpp index 132d76855..4f6f27200 100644 --- a/AnKi/Util/Logger.cpp +++ b/AnKi/Util/Logger.cpp @@ -65,15 +65,9 @@ void Logger::removeMessageHandler(void* data, LoggerMessageHandlerCallback callb } } -void Logger::write(const Char* file, int line, const Char* func, const Char* subsystem, LoggerMessageType type, const Char* threadName, - const Char* msg) +void Logger::writeInternal(const Char* file, int line, const Char* func, const Char* subsystem, LoggerMessageType type, const Char* threadName, + const Char* msg) { - // Note: m_verbosityEnabled is not accessed in a thread-safe way. It doesn't really matter though - if(type == LoggerMessageType::kVerbose && !m_verbosityEnabled) [[likely]] - { - return; - } - const Char* baseFile = strrchr(file, (ANKI_OS_WINDOWS) ? '\\' : '/'); baseFile = (baseFile) ? baseFile + 1 : file; @@ -107,6 +101,12 @@ void Logger::write(const Char* file, int line, const Char* func, const Char* sub void Logger::writeFormated(const Char* file, int line, const Char* func, const Char* subsystem, LoggerMessageType type, const Char* threadName, const Char* fmt, ...) { + // Note: m_verbosityEnabled is not accessed in a thread-safe way. It doesn't really matter though + if(type == LoggerMessageType::kVerbose && !m_verbosityEnabled) + { + return; + } + Array buffer; va_list args; @@ -119,7 +119,7 @@ void Logger::writeFormated(const Char* file, int line, const Char* func, const C } else if(len < I(sizeof(buffer))) { - write(file, line, func, subsystem, type, threadName, &buffer[0]); + writeInternal(file, line, func, subsystem, type, threadName, &buffer[0]); va_end(args); } else @@ -133,7 +133,7 @@ void Logger::writeFormated(const Char* file, int line, const Char* func, const C Char* newBuffer = static_cast(malloc(newSize)); len = vsnprintf(newBuffer, newSize, fmt, args); - write(file, line, func, subsystem, type, threadName, newBuffer); + writeInternal(file, line, func, subsystem, type, threadName, newBuffer); free(newBuffer); va_end(args); diff --git a/AnKi/Util/Logger.h b/AnKi/Util/Logger.h index af6d50383..e7a647eb1 100644 --- a/AnKi/Util/Logger.h +++ b/AnKi/Util/Logger.h @@ -47,8 +47,7 @@ class LoggerMessageInfo /// @memberof Logger using LoggerMessageHandlerCallback = void (*)(void*, const LoggerMessageInfo& info); -/// The logger singleton class. The logger cannot print errors or throw exceptions, it has to recover somehow. It's -/// thread safe. +/// The logger singleton class. The logger cannot print errors or throw exceptions, it has to recover somehow. It's thread safe. /// To add a new signal: /// @code logger.addMessageHandler((void*)obj, &function) @endcode class Logger : public MakeSingleton @@ -67,7 +66,16 @@ class Logger : public MakeSingleton void addFileMessageHandler(File* file); /// Send a message. - void write(const Char* file, int line, const Char* func, const Char* subsystem, LoggerMessageType type, const Char* threadName, const Char* msg); + void write(const Char* file, int line, const Char* func, const Char* subsystem, LoggerMessageType type, const Char* threadName, const Char* msg) + { + // Note: m_verbosityEnabled is not accessed in a thread-safe way. It doesn't really matter though + if(type == LoggerMessageType::kVerbose && !m_verbosityEnabled) + { + return; + } + + writeInternal(file, line, func, subsystem, type, threadName, msg); + } /// Send a formated message. ANKI_CHECK_FORMAT(7, 8) @@ -100,6 +108,9 @@ class Logger : public MakeSingleton static void defaultSystemMessageHandler(void*, const LoggerMessageInfo& info); static void fileMessageHandler(void* file, const LoggerMessageInfo& info); + + void writeInternal(const Char* file, int line, const Char* func, const Char* subsystem, LoggerMessageType type, const Char* threadName, + const Char* msg); }; #define ANKI_LOG(subsystem_, t, ...) \ diff --git a/Tests/Framework/Framework.cpp b/Tests/Framework/Framework.cpp index 276533903..a02a1c379 100644 --- a/Tests/Framework/Framework.cpp +++ b/Tests/Framework/Framework.cpp @@ -241,7 +241,7 @@ void initWindow() inf.m_width = g_windowWidthCVar; inf.m_height = g_windowHeightCVar; inf.m_title = "AnKi unit tests"; - NativeWindow* win = &NativeWindow::allocateSingleton(); + NativeWindow::allocateSingleton(); ANKI_TEST_EXPECT_NO_ERR(NativeWindow::getSingleton().init(inf)); } diff --git a/Tools/Shader/ShaderProgramBinaryDumpMain.cpp b/Tools/Shader/ShaderProgramBinaryDumpMain.cpp index 14437be7b..95f2022ee 100644 --- a/Tools/Shader/ShaderProgramBinaryDumpMain.cpp +++ b/Tools/Shader/ShaderProgramBinaryDumpMain.cpp @@ -178,7 +178,7 @@ Error dumpStats(const ShaderBinary& bin) DynamicArray newSpirv; newSpirv.resize(codeBlock.m_binary.getSize()); memcpy(newSpirv.getBegin(), codeBlock.m_binary.getBegin(), codeBlock.m_binary.getSizeInBytes()); - visitSpirv(WeakArray(reinterpret_cast(newSpirv.getBegin()), newSpirv.getSizeInBytes() / sizeof(U32)), + visitSpirv(WeakArray(reinterpret_cast(newSpirv.getBegin()), U32(newSpirv.getSizeInBytes() / sizeof(U32))), [&](U32 cmd, WeakArray instructions) { if(cmd == spv::OpDecorate && instructions[1] == spv::DecorationDescriptorSet && instructions[2] == kDxcVkBindlessRegisterSpace)