mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-15 21:41:43 +00:00
Support Dual Source Blending in OGL plugin with GLSL.
This commit is contained in:
parent
62b9a779c1
commit
0ccba2b581
2 changed files with 18 additions and 13 deletions
|
@ -675,10 +675,18 @@ const char *GeneratePixelShaderCode(DSTALPHA_MODE dstAlphaMode, API_TYPE ApiType
|
|||
{
|
||||
// GLSL doesn't do main arguments
|
||||
// Once we switch to GLSL 1.3 we will bind a lot of these.
|
||||
|
||||
WRITE(p, " float4 ocol0;\n");
|
||||
|
||||
|
||||
if(dstAlphaMode == DSTALPHA_DUAL_SOURCE_BLEND)
|
||||
WRITE(p, " float4 ocol1;\n"); // Will be supported later
|
||||
{
|
||||
// This won't get hit unless we support GL 3.3
|
||||
WRITE(p, " layout(location = 0) out float4 ocol0;\n");
|
||||
WRITE(p, " layout(location = 0, index = 1) out float4 ocol1;\n"); // Will be supported later
|
||||
}
|
||||
else
|
||||
{
|
||||
WRITE(p, " float4 ocol0;\n");
|
||||
}
|
||||
if(DepthTextureEnable)
|
||||
WRITE(p, " float depth;\n"); // TODO: Passed to Vertex Shader right?
|
||||
WRITE(p, " float4 rawpos = gl_FragCoord;\n");
|
||||
|
@ -721,7 +729,7 @@ const char *GeneratePixelShaderCode(DSTALPHA_MODE dstAlphaMode, API_TYPE ApiType
|
|||
// alpha test will always fail, so restart the shader and just make it an empty function
|
||||
WRITE(p, "ocol0 = float4(0);\n");
|
||||
WRITE(p, "discard;\n");
|
||||
if(ApiType == API_GLSL)
|
||||
if(ApiType == API_GLSL && dstAlphaMode != DSTALPHA_DUAL_SOURCE_BLEND)
|
||||
WRITE(p, "gl_FragData[0] = ocol0;\n");
|
||||
if(ApiType != API_D3D11)
|
||||
WRITE(p, "return;\n");
|
||||
|
@ -833,7 +841,8 @@ const char *GeneratePixelShaderCode(DSTALPHA_MODE dstAlphaMode, API_TYPE ApiType
|
|||
if(ApiType == API_GLSL)
|
||||
{
|
||||
// Once we switch to GLSL 1.3 and bind variables, we won't need to do this
|
||||
WRITE(p, "gl_FragData[0] = ocol0;\n");
|
||||
if (dstAlphaMode != DSTALPHA_DUAL_SOURCE_BLEND)
|
||||
WRITE(p, "gl_FragData[0] = ocol0;\n");
|
||||
if(DepthTextureEnable)
|
||||
WRITE(p, "gl_FragDepth = depth;\n");
|
||||
if(dstAlphaMode == DSTALPHA_DUAL_SOURCE_BLEND)
|
||||
|
@ -892,8 +901,8 @@ const char *GeneratePixelShaderCode(DSTALPHA_MODE dstAlphaMode, API_TYPE ApiType
|
|||
{
|
||||
if(DepthTextureEnable)
|
||||
WRITE(p, "gl_FragDepth = depth;\n");
|
||||
|
||||
WRITE(p, "gl_FragData[0] = ocol0;\n");
|
||||
if (dstAlphaMode != DSTALPHA_DUAL_SOURCE_BLEND)
|
||||
WRITE(p, "gl_FragData[0] = ocol0;\n");
|
||||
}
|
||||
}
|
||||
WRITE(p, "}\n");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue