mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-24 04:51:19 +00:00
dca0b75038
- clamp scissors fully to avoid NVidia's awful drivers locking up the entire system if they end up out of bounds - perform buffer clears as part of the render pass. this puts some restrictions on how FRenderState.Clear can be used - add an offset uniform to the present shaders so the vulkan target can flip the image during presentation
31 lines
926 B
GLSL
31 lines
926 B
GLSL
|
|
layout(location=0) in vec2 TexCoord;
|
|
layout(location=0) out vec4 FragColor;
|
|
|
|
layout(binding=0) uniform sampler2D LeftEyeTexture;
|
|
layout(binding=1) uniform sampler2D RightEyeTexture;
|
|
|
|
vec4 ApplyGamma(vec4 c)
|
|
{
|
|
vec3 val = c.rgb * Contrast - (Contrast - 1.0) * 0.5;
|
|
val += Brightness * 0.5;
|
|
val = pow(max(val, vec3(0.0)), vec3(InvGamma));
|
|
return vec4(val, c.a);
|
|
}
|
|
|
|
void main()
|
|
{
|
|
int thisHorizontalPixel = int(gl_FragCoord.x); // zero-based column index from left
|
|
bool isLeftEye = (thisHorizontalPixel // because we want to alternate eye view on each column
|
|
+ WindowPositionParity // because the window might not be aligned to the screen
|
|
) % 2 == 0;
|
|
vec4 inputColor;
|
|
if (isLeftEye) {
|
|
inputColor = texture(LeftEyeTexture, UVOffset + TexCoord * UVScale);
|
|
}
|
|
else {
|
|
// inputColor = vec4(0, 1, 0, 1);
|
|
inputColor = texture(RightEyeTexture, UVOffset + TexCoord * UVScale);
|
|
}
|
|
FragColor = ApplyGamma(inputColor);
|
|
}
|