diff options
author | Eric Anholt <[email protected]> | 2014-09-30 16:08:23 -0700 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2014-10-01 17:03:35 -0700 |
commit | d7a0502a5440359d1cecd42e58bdb85c2d857824 (patch) | |
tree | c51845d91a4bae9a8d21e956e4deed4e203fa972 /src/gallium/drivers/vc4/vc4_program.c | |
parent | 1bf2d17a60d112c7ca8da7ab0b539991df96a93d (diff) |
vc4: Add support for the FACE semantic.
Fixes glsl-fs-frontfacing.
Diffstat (limited to 'src/gallium/drivers/vc4/vc4_program.c')
-rw-r--r-- | src/gallium/drivers/vc4/vc4_program.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/gallium/drivers/vc4/vc4_program.c b/src/gallium/drivers/vc4/vc4_program.c index 804a1dc2097..09a39a12101 100644 --- a/src/gallium/drivers/vc4/vc4_program.c +++ b/src/gallium/drivers/vc4/vc4_program.c @@ -954,6 +954,19 @@ emit_fragment_input(struct vc4_compile *c, int attr, } static void +emit_face_input(struct vc4_compile *c, int attr) +{ + c->inputs[attr * 4 + 0] = qir_FSUB(c, + qir_uniform_f(c, 1.0), + qir_FMUL(c, + qir_ITOF(c, qir_FRAG_REV_FLAG(c)), + qir_uniform_f(c, 2.0))); + c->inputs[attr * 4 + 1] = qir_uniform_f(c, 0.0); + c->inputs[attr * 4 + 2] = qir_uniform_f(c, 0.0); + c->inputs[attr * 4 + 3] = qir_uniform_f(c, 1.0); +} + +static void emit_tgsi_declaration(struct vc4_compile *c, struct tgsi_full_declaration *decl) { @@ -974,6 +987,8 @@ emit_tgsi_declaration(struct vc4_compile *c, if (decl->Semantic.Name == TGSI_SEMANTIC_POSITION) { emit_fragcoord_input(c, i); + } else if (decl->Semantic.Name == TGSI_SEMANTIC_FACE) { + emit_face_input(c, i); } else if (decl->Semantic.Name == TGSI_SEMANTIC_GENERIC && (c->fs_key->point_sprite_mask & (1 << decl->Semantic.Index))) { |