diff options
author | Brian Paul <[email protected]> | 2010-09-21 09:57:25 -0600 |
---|---|---|
committer | Brian Paul <[email protected]> | 2010-09-21 09:57:25 -0600 |
commit | d49f153ab36fec16f687f35f3a9aaf19fb7254be (patch) | |
tree | 227a3561c276b5d9a6b20fd2bd5b4b7775b03086 /src/mesa | |
parent | 441344ba7ed2a1d162ee33ac4bac4bf645188ceb (diff) | |
parent | 77af10955462819d973a395270777c5b8217f6ae (diff) |
Merge branch 'sprite-coord'
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/state_tracker/st_atom_rasterizer.c | 14 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_program.c | 17 |
2 files changed, 19 insertions, 12 deletions
diff --git a/src/mesa/state_tracker/st_atom_rasterizer.c b/src/mesa/state_tracker/st_atom_rasterizer.c index 2599bd5ca03..0fe333ae8aa 100644 --- a/src/mesa/state_tracker/st_atom_rasterizer.c +++ b/src/mesa/state_tracker/st_atom_rasterizer.c @@ -60,6 +60,7 @@ static void update_raster_state( struct st_context *st ) GLcontext *ctx = st->ctx; struct pipe_rasterizer_state *raster = &st->state.rasterizer; const struct gl_vertex_program *vertProg = ctx->VertexProgram._Current; + const struct gl_fragment_program *fragProg = ctx->FragmentProgram._Current; uint i; memset(raster, 0, sizeof(*raster)); @@ -175,17 +176,30 @@ static void update_raster_state( struct st_context *st ) if (!ctx->Point.PointSprite && ctx->Point.SmoothFlag) raster->point_smooth = 1; + /* _NEW_POINT | _NEW_PROGRAM + */ if (ctx->Point.PointSprite) { + /* origin */ if ((ctx->Point.SpriteOrigin == GL_UPPER_LEFT) ^ (st_fb_orientation(ctx->DrawBuffer) == Y_0_BOTTOM)) raster->sprite_coord_mode = PIPE_SPRITE_COORD_UPPER_LEFT; else raster->sprite_coord_mode = PIPE_SPRITE_COORD_LOWER_LEFT; + + /* Coord replacement flags. If bit 'k' is set that means + * that we need to replace GENERIC[k] attrib with an automatically + * computed texture coord. + */ for (i = 0; i < MAX_TEXTURE_COORD_UNITS; i++) { if (ctx->Point.CoordReplace[i]) { raster->sprite_coord_enable |= 1 << i; } } + if (fragProg->Base.InputsRead & FRAG_BIT_PNTC) { + raster->sprite_coord_enable |= + 1 << (FRAG_ATTRIB_PNTC - FRAG_ATTRIB_TEX0); + } + raster->point_quad_rasterization = 1; } diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c index 8c2d8b6154b..18a7bbe0f90 100644 --- a/src/mesa/state_tracker/st_program.c +++ b/src/mesa/state_tracker/st_program.c @@ -338,17 +338,6 @@ st_translate_fragment_program(struct st_context *st, input_semantic_index[slot] = 0; interpMode[slot] = TGSI_INTERPOLATE_CONSTANT; break; - case FRAG_ATTRIB_PNTC: - /* This is a hack. We really need a new semantic label for - * point coord. The draw module needs to know which fragment - * shader input is the point coord attribute so that it can set - * up the right vertex attribute values. - */ - input_semantic_name[slot] = TGSI_SEMANTIC_GENERIC; - input_semantic_index[slot] = 0; - interpMode[slot] = TGSI_INTERPOLATE_PERSPECTIVE; - break; - /* In most cases, there is nothing special about these * inputs, so adopt a convention to use the generic * semantic name and the mesa FRAG_ATTRIB_ number as the @@ -364,6 +353,7 @@ st_translate_fragment_program(struct st_context *st, * zero or be restricted to a particular range -- nobody * should be building tables based on semantic index. */ + case FRAG_ATTRIB_PNTC: case FRAG_ATTRIB_TEX0: case FRAG_ATTRIB_TEX1: case FRAG_ATTRIB_TEX2: @@ -380,7 +370,10 @@ st_translate_fragment_program(struct st_context *st, assert(attr >= FRAG_ATTRIB_TEX0); input_semantic_index[slot] = (attr - FRAG_ATTRIB_TEX0); input_semantic_name[slot] = TGSI_SEMANTIC_GENERIC; - interpMode[slot] = TGSI_INTERPOLATE_PERSPECTIVE; + if (attr == FRAG_ATTRIB_PNTC) + interpMode[slot] = TGSI_INTERPOLATE_LINEAR; + else + interpMode[slot] = TGSI_INTERPOLATE_PERSPECTIVE; break; } } |