mirror of
https://github.com/love2d/love.git
synced 2026-08-12 08:30:56 +02:00
metal: fix shader compilation when using void effect() with MRTs.
This commit is contained in:
@@ -26,6 +26,7 @@
|
||||
|
||||
// glslang
|
||||
#include "libraries/glslang/glslang/Public/ShaderLang.h"
|
||||
#include "libraries/glslang/glslang/Public/ResourceLimits.h"
|
||||
|
||||
// Needed for reflection information.
|
||||
#include "libraries/glslang/glslang/Include/Types.h"
|
||||
@@ -1445,7 +1446,18 @@ void Shader::handleUnknownUniformName(const char */*name*/)
|
||||
|
||||
bool Shader::initialize()
|
||||
{
|
||||
return glslang::InitializeProcess();
|
||||
bool success = glslang::InitializeProcess();
|
||||
if (!success)
|
||||
return false;
|
||||
|
||||
TBuiltInResource *resources = GetResources();
|
||||
*resources = *GetDefaultResources();
|
||||
|
||||
// This is 32 in the default resource struct, which is too high for Metal.
|
||||
// TODO: Set this based on what the system actually supports?
|
||||
resources->maxDrawBuffers = 8;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void Shader::deinitialize()
|
||||
|
||||
@@ -62,7 +62,7 @@ ShaderStage::ShaderStage(Graphics *gfx, ShaderStageType stage, const std::string
|
||||
|
||||
bool forwardcompat = supportsGLSL3 && !forcedefault;
|
||||
|
||||
if (!glslangShader->parse(GetDefaultResources(), defaultversion, defaultprofile, forcedefault, forwardcompat, EShMsgSuppressWarnings))
|
||||
if (!glslangShader->parse(GetResources(), defaultversion, defaultprofile, forcedefault, forwardcompat, EShMsgSuppressWarnings))
|
||||
{
|
||||
const char *stagename = "unknown";
|
||||
getConstant(stage, stagename);
|
||||
|
||||
@@ -208,7 +208,7 @@ Shader::Shader(id<MTLDevice> device, StrongRef<love::graphics::ShaderStage> stag
|
||||
forcedefault = true;
|
||||
#endif
|
||||
|
||||
if (!tshader->parse(GetDefaultResources(), defaultversion, defaultprofile, forcedefault, forwardcompat, EShMsgSuppressWarnings))
|
||||
if (!tshader->parse(GetResources(), defaultversion, defaultprofile, forcedefault, forwardcompat, EShMsgSuppressWarnings))
|
||||
{
|
||||
const char *stagename = "unknown";
|
||||
ShaderStage::getConstant(stage, stagename);
|
||||
|
||||
@@ -554,7 +554,7 @@ void Shader::compileShaders()
|
||||
bool forceDefault = false;
|
||||
bool forwardCompat = true;
|
||||
|
||||
if (!tshader->parse(GetDefaultResources(), defaultVersion, defaultProfile, forceDefault, forwardCompat, EShMsgSuppressWarnings))
|
||||
if (!tshader->parse(GetResources(), defaultVersion, defaultProfile, forceDefault, forwardCompat, EShMsgSuppressWarnings))
|
||||
{
|
||||
const char *stageName = "unknown";
|
||||
ShaderStage::getConstant(stage, stageName);
|
||||
|
||||
Reference in New Issue
Block a user