Enable early Z in the XCAA multicolor direct interior pass
This commit is contained in:
parent
2975038891
commit
bc99fdf02b
|
@ -449,15 +449,10 @@ export abstract class Renderer {
|
|||
}
|
||||
|
||||
// Set up direct curve state.
|
||||
if (renderingMode === 'color-depth') {
|
||||
gl.depthMask(true);
|
||||
gl.disable(gl.BLEND);
|
||||
} else {
|
||||
gl.depthMask(false);
|
||||
gl.enable(gl.BLEND);
|
||||
gl.blendEquation(gl.FUNC_ADD);
|
||||
gl.blendFuncSeparate(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE);
|
||||
}
|
||||
gl.depthMask(renderingMode === 'color-depth');
|
||||
gl.enable(gl.BLEND);
|
||||
gl.blendEquation(gl.FUNC_ADD);
|
||||
gl.blendFuncSeparate(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE);
|
||||
|
||||
// Set up the direct curve VAO.
|
||||
//
|
||||
|
|
|
@ -1084,6 +1084,9 @@ export class MCAAMulticolorStrategy extends MCAAStrategy {
|
|||
gl.activeTexture(gl.TEXTURE0 + textureUnit);
|
||||
gl.bindTexture(gl.TEXTURE_2D, this.aaDepthTexture);
|
||||
gl.uniform1i(uniforms.uEdgeDepth, textureUnit);
|
||||
gl.activeTexture(gl.TEXTURE0 + textureUnit + 1);
|
||||
gl.bindTexture(gl.TEXTURE_2D, this.aaAlphaTexture);
|
||||
gl.uniform1i(uniforms.uEdgeAlpha, textureUnit);
|
||||
}
|
||||
|
||||
protected getResolveProgram(renderContext: RenderContext): PathfinderShaderProgram {
|
||||
|
@ -1153,7 +1156,7 @@ export class MCAAMulticolorStrategy extends MCAAStrategy {
|
|||
const gl = renderContext.gl;
|
||||
|
||||
gl.depthMask(true);
|
||||
gl.depthFunc(gl.GEQUAL);
|
||||
gl.depthFunc(gl.GREATER);
|
||||
gl.enable(gl.DEPTH_TEST);
|
||||
|
||||
gl.blendEquation(gl.FUNC_ADD);
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
precision highp float;
|
||||
|
||||
uniform ivec2 uFramebufferSize;
|
||||
uniform sampler2D uEdgeAlpha;
|
||||
uniform sampler2D uEdgeDepth;
|
||||
|
||||
varying vec4 vColor;
|
||||
|
@ -20,9 +21,9 @@ void main() {
|
|||
float depth = gl_FragCoord.z;
|
||||
vec2 texCoord = floor(center) / vec2(uFramebufferSize);
|
||||
|
||||
// TODO(pcwalton): Get back early Z somehow?
|
||||
vec4 color = vColor;
|
||||
if (depth == texture2D(uEdgeDepth, texCoord).r)
|
||||
discard;
|
||||
color.a = texture2D(uEdgeAlpha, texCoord).r;
|
||||
|
||||
gl_FragColor = vColor;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue