etnaviv: nir: fix gl_FrontFacing
Only invert front facing when glFrontFace is GL_CW. Fixes following deqp test: dEQP-GLES2.functional.shaders.builtin_variable.frontfacing Signed-off-by: Jonathan Marek <jonathan@marek.ca> Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
This commit is contained in:
parent
931fc2a7b3
commit
7da15bdd2d
|
@ -98,6 +98,9 @@ etna_lower_io(nir_shader *shader, struct etna_shader_variant *v)
|
||||||
|
|
||||||
switch (intr->intrinsic) {
|
switch (intr->intrinsic) {
|
||||||
case nir_intrinsic_load_front_face: {
|
case nir_intrinsic_load_front_face: {
|
||||||
|
if (!v->key.front_ccw)
|
||||||
|
break;
|
||||||
|
|
||||||
/* front face inverted (run after int_to_float, so invert as float) */
|
/* front face inverted (run after int_to_float, so invert as float) */
|
||||||
b.cursor = nir_after_instr(instr);
|
b.cursor = nir_after_instr(instr);
|
||||||
|
|
||||||
|
|
|
@ -214,7 +214,10 @@ etna_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info)
|
||||||
}
|
}
|
||||||
ctx->dirty |= ETNA_DIRTY_INDEX_BUFFER;
|
ctx->dirty |= ETNA_DIRTY_INDEX_BUFFER;
|
||||||
|
|
||||||
struct etna_shader_key key = {};
|
struct etna_shader_key key = {
|
||||||
|
.front_ccw = ctx->rasterizer->front_ccw,
|
||||||
|
};
|
||||||
|
|
||||||
if (pfb->cbufs[0])
|
if (pfb->cbufs[0])
|
||||||
key.frag_rb_swap = !!translate_rs_format_rb_swap(pfb->cbufs[0]->format);
|
key.frag_rb_swap = !!translate_rs_format_rb_swap(pfb->cbufs[0]->format);
|
||||||
|
|
||||||
|
|
|
@ -43,6 +43,8 @@ struct etna_shader_key
|
||||||
|
|
||||||
/* do we need to swap rb in frag color? */
|
/* do we need to swap rb in frag color? */
|
||||||
unsigned frag_rb_swap : 1;
|
unsigned frag_rb_swap : 1;
|
||||||
|
/* do we need to invert front facing value? */
|
||||||
|
unsigned front_ccw : 1;
|
||||||
};
|
};
|
||||||
uint32_t global;
|
uint32_t global;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue