Check if gl_Frag[Data/Color] are not already patched (#2661)
This commit is contained in:
parent
5b321e6669
commit
08cd17e3b8
@ -6509,7 +6509,9 @@ namespace bgfx { namespace gl
|
||||
|
||||
uint32_t fragData = 0;
|
||||
|
||||
if (!bx::findIdentifierMatch(code, "gl_FragData").isEmpty() )
|
||||
bool patchedFragData = s_renderGL->m_gles3 && !bx::findIdentifierMatch(code, "bgfx_FragData").isEmpty();
|
||||
|
||||
if (!patchedFragData && !bx::findIdentifierMatch(code, "gl_FragData").isEmpty() )
|
||||
{
|
||||
for (uint32_t ii = 0, num = g_caps.limits.maxFBAttachments; ii < num; ++ii)
|
||||
{
|
||||
@ -6540,16 +6542,22 @@ namespace bgfx { namespace gl
|
||||
|
||||
if (0 != fragData)
|
||||
{
|
||||
bx::write(&writer, &err, "out vec4 bgfx_FragData[%d];\n", fragData);
|
||||
bx::write(&writer, "#define gl_FragData bgfx_FragData\n", &err);
|
||||
if (!patchedFragData)
|
||||
{
|
||||
bx::write(&writer, &err, "out vec4 bgfx_FragData[%d];\n", fragData);
|
||||
bx::write(&writer, "#define gl_FragData bgfx_FragData\n", &err);
|
||||
}
|
||||
}
|
||||
else
|
||||
else if (!patchedFragData)
|
||||
{
|
||||
bx::write(&writer
|
||||
, "out vec4 bgfx_FragColor;\n"
|
||||
"#define gl_FragColor bgfx_FragColor\n"
|
||||
, &err
|
||||
);
|
||||
if (bx::findIdentifierMatch(code, "bgfx_FragColor").isEmpty() )
|
||||
{
|
||||
bx::write(&writer
|
||||
, "out vec4 bgfx_FragColor;\n"
|
||||
"#define gl_FragColor bgfx_FragColor\n"
|
||||
, &err
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -1728,8 +1728,8 @@ namespace bgfx
|
||||
}
|
||||
if (hasFragColor)
|
||||
{
|
||||
preprocessor.writef("#define gl_FragColor bgfx_FragData0\n");
|
||||
preprocessor.writef("out mediump vec4 bgfx_FragData0;\n");
|
||||
preprocessor.writef("#define gl_FragColor bgfx_FragColor\n");
|
||||
preprocessor.writef("out mediump vec4 bgfx_FragColor;\n");
|
||||
}
|
||||
else if (numFragData)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user