diff --git a/src/modules/graphics/Shader.cpp b/src/modules/graphics/Shader.cpp index 8f70a1bbf..a6092c4d5 100644 --- a/src/modules/graphics/Shader.cpp +++ b/src/modules/graphics/Shader.cpp @@ -88,13 +88,7 @@ static const char global_uniforms[] = R"( // According to the GLSL ES 1.0 spec, uniform precision must match between stages, // but we can't guarantee that highp is always supported in fragment shaders... // We *really* don't want to use mediump for these in vertex shaders though. -#if __VERSION__ >= 300 && defined(LOVE_USE_UNIFORM_BUFFERS) -layout (std140) uniform love_UniformsPerDrawBuffer { - highp vec4 love_UniformsPerDraw[13]; -}; -#else uniform LOVE_HIGHP_OR_MEDIUMP vec4 love_UniformsPerDraw[13]; -#endif // These are initialized in love_initializeBuiltinUniforms below. GLSL ES can't // do it as an initializer. @@ -536,8 +530,6 @@ std::string Shader::createShaderStageCode(Graphics *gfx, ShaderStage::StageType ss << "#define LOVE_GAMMA_CORRECT 1\n"; if (info.usesMRT) ss << "#define LOVE_MULTI_RENDER_TARGETS 1\n"; - if (gfx->getRenderer() == Graphics::RENDERER_METAL) - ss << "#define LOVE_USE_UNIFORM_BUFFERS 1\n"; // FIXME: this is temporary ss << glsl::global_syntax; ss << stageinfo.header; ss << glsl::global_uniforms; diff --git a/src/modules/graphics/metal/Shader.mm b/src/modules/graphics/metal/Shader.mm index f4bd6eecc..c3549513b 100644 --- a/src/modules/graphics/metal/Shader.mm +++ b/src/modules/graphics/metal/Shader.mm @@ -250,7 +250,7 @@ Shader::Shader(id device, love::graphics::ShaderStage *vertex, love:: continue; } - if (resource.name == "love_UniformsPerDrawBuffer") + if (resource.name == "gl_DefaultUniformBlock") { msl.set_decoration(resource.id, spv::DecorationBinding, 0); const SPIRType &type = msl.get_type(resource.base_type_id); diff --git a/src/modules/graphics/metal/ShaderStage.mm b/src/modules/graphics/metal/ShaderStage.mm index 3f7a7ea5c..19b3123c2 100644 --- a/src/modules/graphics/metal/ShaderStage.mm +++ b/src/modules/graphics/metal/ShaderStage.mm @@ -154,11 +154,12 @@ ShaderStage::ShaderStage(love::graphics::Graphics *gfx, StageType stage, const s // We can't reuse the validation glslang shader object in the base class, // because we need these options set (and the language set to >= 300). - glslangShader->setEnvInput(EShSourceGlsl, glslangStage, EShClientNone, 0); - glslangShader->setEnvClient(EShClientOpenGL, EShTargetOpenGL_450); - glslangShader->setEnvTarget(EShTargetSpv, EShTargetSpv_1_0); + glslangShader->setEnvInput(EShSourceGlsl, glslangStage, EShClientVulkan, 450); + glslangShader->setEnvClient(EShClientVulkan, EShTargetVulkan_1_2); + glslangShader->setEnvTarget(EShTargetSpv, EShTargetSpv_1_5); glslangShader->setAutoMapLocations(true); glslangShader->setAutoMapBindings(true); + glslangShader->setEnvInputVulkanRulesRelaxed(); const char *csrc = source.c_str(); int srclen = (int) source.length();