From 6ac0b4ed9d9600e4433553b78575762735f044e7 Mon Sep 17 00:00:00 2001 From: Nana <469449812@qq.com> Date: Mon, 24 Feb 2025 00:29:43 +0800 Subject: [PATCH] =?UTF-8?q?=E7=9D=80=E8=89=B2=E5=99=A8Profile=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- example/src/main.cpp | 2 +- scripts/compile_shaders.py | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/example/src/main.cpp b/example/src/main.cpp index c923326..49ce53e 100644 --- a/example/src/main.cpp +++ b/example/src/main.cpp @@ -6,6 +6,6 @@ int main(int argc, char* argv[]) { init.size = {800, 600}; init.resizable = true; init.centered = true; - init.api = mirage::renderer_api::opengl; + // init.api = mirage::renderer_api::opengl; return run(init); } diff --git a/scripts/compile_shaders.py b/scripts/compile_shaders.py index c8d3f38..d989c5e 100644 --- a/scripts/compile_shaders.py +++ b/scripts/compile_shaders.py @@ -257,6 +257,25 @@ def generate_pipeline_header_preamble() -> List[str]: " desc.type = type;", " desc.sourceType = is_string_source ? LLGL::ShaderSourceType::CodeString : LLGL::ShaderSourceType::BinaryBuffer;", "", + " if (rendererID == LLGL::RendererID::Direct3D11) {", + " if (type == LLGL::ShaderType::Vertex) {", + " desc.profile = \"vs_5_0\";", + " } else if (type == LLGL::ShaderType::Fragment) {", + " desc.profile = \"ps_5_0\";", + " } else if (type == LLGL::ShaderType::Compute) {", + " desc.profile = \"cs_5_0\";", + " };", + " } else if (rendererID == LLGL::RendererID::Direct3D12) {", + " if (type == LLGL::ShaderType::Vertex) {", + " desc.profile = \"vs_6_6\";", + " } else if (type == LLGL::ShaderType::Fragment) {", + " desc.profile = \"ps_6_6\";", + " } else if (type == LLGL::ShaderType::Compute) {", + " desc.profile = \"cs_6_6\";", + " };", + " } else if (rendererID == LLGL::RendererID::Metal) {", + " desc.profile = \"2.1\";", + " }", " auto shader = renderer->CreateShader(desc);", " if (auto report = shader->GetReport()) {", " spdlog::error(\"Shader compilation report: {}\", report->GetText());",