diff --git a/src/services/impl/gui_renderer.cpp b/src/services/impl/gui_renderer.cpp index f0a2557..37dd73c 100644 --- a/src/services/impl/gui_renderer.cpp +++ b/src/services/impl/gui_renderer.cpp @@ -228,10 +228,6 @@ std::vector ClipPolygonToRect(const std::vector& polygon, return output; } -bool IsSpirvPath(const std::filesystem::path& path) { - return path.extension() == ".spv"; -} - shaderc_shader_kind ShadercKindFromStage(VkShaderStageFlagBits stage) { switch (stage) { case VK_SHADER_STAGE_VERTEX_BIT: @@ -277,7 +273,7 @@ std::vector ReadShaderFile(const std::filesystem::path& path, } std::filesystem::path shaderPath = path; - if (!std::filesystem::exists(shaderPath) && IsSpirvPath(shaderPath)) { + if (!std::filesystem::exists(shaderPath) && shaderPath.extension() == ".spv") { std::filesystem::path sourcePath = shaderPath; sourcePath.replace_extension(); if (std::filesystem::exists(sourcePath)) { @@ -298,7 +294,7 @@ std::vector ReadShaderFile(const std::filesystem::path& path, throw std::runtime_error("Path is not a regular file: " + shaderPath.string()); } - if (IsSpirvPath(shaderPath)) { + if (shaderPath.extension() == ".spv") { auto buffer = ReadBinaryFile(shaderPath); if (logger) { logger->Trace("GuiRenderer", "ReadShaderFile", diff --git a/src/services/impl/pipeline_service.cpp b/src/services/impl/pipeline_service.cpp index 83e5c89..2dbc120 100644 --- a/src/services/impl/pipeline_service.cpp +++ b/src/services/impl/pipeline_service.cpp @@ -10,10 +10,6 @@ #include namespace { -bool IsSpirvPath(const std::filesystem::path& path) { - return path.extension() == ".spv"; -} - shaderc_shader_kind ShadercKindFromStage(VkShaderStageFlagBits stage) { switch (stage) { case VK_SHADER_STAGE_VERTEX_BIT: @@ -400,7 +396,7 @@ bool PipelineService::HasShaderSource(const std::string& path) const { if (std::filesystem::exists(shaderPath)) { return true; } - if (IsSpirvPath(shaderPath)) { + if (shaderPath.extension() == ".spv") { std::filesystem::path sourcePath = shaderPath; sourcePath.replace_extension(); return std::filesystem::exists(sourcePath); @@ -417,7 +413,7 @@ const std::vector& PipelineService::ReadShaderFile(const std::string& path } std::filesystem::path shaderPath(path); - if (!std::filesystem::exists(shaderPath) && IsSpirvPath(shaderPath)) { + if (!std::filesystem::exists(shaderPath) && shaderPath.extension() == ".spv") { std::filesystem::path sourcePath = shaderPath; sourcePath.replace_extension(); if (std::filesystem::exists(sourcePath)) { @@ -446,7 +442,7 @@ const std::vector& PipelineService::ReadShaderFile(const std::string& path } std::vector buffer; - if (IsSpirvPath(shaderPath)) { + if (shaderPath.extension() == ".spv") { std::ifstream file(shaderPath, std::ios::ate | std::ios::binary); if (!file) { throw std::runtime_error("Failed to open shader file: " + shaderPath.string() +