r600g: Added support for TGSI_SEMANTIC_FACE.
authorTilman Sauerbeck <tilman@code-monkey.de>
Sat, 18 Sep 2010 14:42:22 +0000 (16:42 +0200)
committerTilman Sauerbeck <tilman@code-monkey.de>
Sun, 19 Sep 2010 07:21:41 +0000 (09:21 +0200)
This makes the 'glsl1-gl_FrontFacing var (1)' piglit test pass.

Signed-off-by: Tilman Sauerbeck <tilman@code-monkey.de>
src/gallium/drivers/r600/eg_hw_states.c
src/gallium/drivers/r600/r600_hw_states.c

index d6f417e1e379878db96103a2196476fcdceba80d..ad8aa4ca9a6ac32c882f053f3dcb5e7560ebf121 100644 (file)
@@ -930,7 +930,7 @@ static int eg_ps_shader(struct r600_context *rctx, struct r600_context_state *rp
        const struct pipe_rasterizer_state *rasterizer;
        struct r600_shader *rshader = &rpshader->shader;
        unsigned i, tmp, exports_ps, num_cout;
-       boolean have_pos = FALSE;
+       boolean have_pos = FALSE, have_face = FALSE;
 
        rasterizer = &rctx->rasterizer->state.rasterizer;
 
@@ -945,6 +945,10 @@ static int eg_ps_shader(struct r600_context *rctx, struct r600_context_state *rp
                    rshader->input[i].name == TGSI_SEMANTIC_POSITION) {
                        tmp |= S_028644_FLAT_SHADE(rshader->flat_shade);
                }
+
+               if (rshader->input[i].name == TGSI_SEMANTIC_FACE)
+                       have_face = TRUE;
+
                if (rasterizer->sprite_coord_enable & (1 << i)) {
                        tmp |= S_028644_PT_SPRITE_TEX(1);
                }
@@ -971,7 +975,10 @@ static int eg_ps_shader(struct r600_context *rctx, struct r600_context_state *rp
                state->states[EG_PS_SHADER__SPI_PS_IN_CONTROL_0] |=  S_0286CC_POSITION_ENA(1);
                state->states[EG_PS_SHADER__SPI_INPUT_Z] |= 1;
        }
+
        state->states[EG_PS_SHADER__SPI_PS_IN_CONTROL_1] = 0x00000000;
+       state->states[EG_PS_SHADER__SPI_PS_IN_CONTROL_1] |= S_0286D0_FRONT_FACE_ENA(have_face);
+
        state->states[EG_PS_SHADER__SQ_PGM_RESOURCES_PS] = S_028844_NUM_GPRS(rshader->bc.ngpr) | S_028844_PRIME_CACHE_ON_DRAW(1) |
                S_028844_STACK_SIZE(rshader->bc.nstack);
        state->states[EG_PS_SHADER__SQ_PGM_EXPORTS_PS] = exports_ps;
index bca78ee8deb78263755a9b8f306498e0cd24d92f..25344c6f82a5306c9ed5b4966bd077206fa55423 100644 (file)
@@ -943,7 +943,7 @@ static int r600_ps_shader(struct r600_context *rctx, struct r600_context_state *
        const struct pipe_rasterizer_state *rasterizer;
        struct r600_shader *rshader = &rpshader->shader;
        unsigned i, tmp, exports_ps, num_cout;
-       boolean have_pos = FALSE;
+       boolean have_pos = FALSE, have_face = FALSE;
 
        rasterizer = &rctx->rasterizer->state.rasterizer;
 
@@ -958,6 +958,10 @@ static int r600_ps_shader(struct r600_context *rctx, struct r600_context_state *
                    rshader->input[i].name == TGSI_SEMANTIC_POSITION) {
                        tmp |= S_028644_FLAT_SHADE(rshader->flat_shade);
                }
+
+               if (rshader->input[i].name == TGSI_SEMANTIC_FACE)
+                       have_face = TRUE;
+
                if (rasterizer->sprite_coord_enable & (1 << i)) {
                        tmp |= S_028644_PT_SPRITE_TEX(1);
                }
@@ -985,7 +989,10 @@ static int r600_ps_shader(struct r600_context *rctx, struct r600_context_state *
                                                                       S_0286CC_BARYC_SAMPLE_CNTL(1);
                state->states[R600_PS_SHADER__SPI_INPUT_Z] |= 1;
        }
+
        state->states[R600_PS_SHADER__SPI_PS_IN_CONTROL_1] = 0x00000000;
+       state->states[R600_PS_SHADER__SPI_PS_IN_CONTROL_1] |= S_0286D0_FRONT_FACE_ENA(have_face);
+
        state->states[R600_PS_SHADER__SQ_PGM_RESOURCES_PS] = S_028868_NUM_GPRS(rshader->bc.ngpr) |
                S_028868_STACK_SIZE(rshader->bc.nstack);
        state->states[R600_PS_SHADER__SQ_PGM_EXPORTS_PS] = exports_ps;