gpu: fix intel miscompiles of fragui shader

Having all 3 sampling branches feed into one colorblind() call was
breaking some versions of Intel's drivers whenever the xbr sampling code
was merely present. Changing each branch to individually call
colorblind() seems to fix it.
This commit is contained in:
Adam
2020-11-13 12:38:36 -05:00
parent cb31e1ddd4
commit ad4d1787a1
2 changed files with 13 additions and 11 deletions

View File

@@ -53,7 +53,6 @@ vec3 colorblind(int mode, vec3 color)
lms = LMS * lms2lmst; // blue deficiency
}
else {
// Should be impossible to get here
return color;
}

View File

@@ -24,7 +24,6 @@
*/
#version 330
#define SAMPLING_DEFAULT 0
#define SAMPLING_MITCHELL 1
#define SAMPLING_CATROM 2
#define SAMPLING_XBR 3
@@ -48,15 +47,19 @@ out vec4 FragColor;
void main() {
vec4 c;
if (samplingMode == SAMPLING_DEFAULT)
c = texture(tex, TexCoord);
else if (samplingMode == SAMPLING_CATROM || samplingMode == SAMPLING_MITCHELL)
c = textureCubic(tex, TexCoord, samplingMode);
else if (samplingMode == SAMPLING_XBR)
c = textureXBR(tex, TexCoord, xbrTable, ceil(1.0 * targetDimensions.x / sourceDimensions.x));
if (colorBlindMode > 0) {
c.rgb = colorblind(colorBlindMode, c.rgb);
switch (samplingMode) {
case SAMPLING_CATROM:
case SAMPLING_MITCHELL:
c = textureCubic(tex, TexCoord, samplingMode);
c.rgb = colorblind(colorBlindMode, c.rgb);
break;
case SAMPLING_XBR:
c = textureXBR(tex, TexCoord, xbrTable, ceil(1.0 * targetDimensions.x / sourceDimensions.x));
c.rgb = colorblind(colorBlindMode, c.rgb);
break;
default: // NEAREST or LINEAR, which uses GL_TEXTURE_MIN_FILTER/GL_TEXTURE_MAG_FILTER to affect sampling
c = texture(tex, TexCoord);
c.rgb = colorblind(colorBlindMode, c.rgb);
}
FragColor = c;