mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-09 06:48:06 +02:00
st/mesa: redefine mapping from VARYING_SLOT_TEXi/PNTC/VARi to TGSI GENERIC[i]
Generic varyings in TGSI were based on the value of VARYING_SLOT_TEX0, so VAR0 was always GENERIC[22] (with tessellation patches). Some drivers might not be able to cope with that. This commit defines a proper mapping, so that PNTC is GENERIC[8] and VAR0 is GENERIC[9]. Reviewed-by: Brian Paul <brianp@vmware.com>
This commit is contained in:
parent
77038cd35a
commit
6cfedf8797
3 changed files with 52 additions and 22 deletions
|
|
@ -33,6 +33,7 @@
|
||||||
#include "main/macros.h"
|
#include "main/macros.h"
|
||||||
#include "st_context.h"
|
#include "st_context.h"
|
||||||
#include "st_atom.h"
|
#include "st_atom.h"
|
||||||
|
#include "st_program.h"
|
||||||
#include "pipe/p_context.h"
|
#include "pipe/p_context.h"
|
||||||
#include "pipe/p_defines.h"
|
#include "pipe/p_defines.h"
|
||||||
#include "cso_cache/cso_context.h"
|
#include "cso_cache/cso_context.h"
|
||||||
|
|
@ -174,7 +175,7 @@ static void update_raster_state( struct st_context *st )
|
||||||
if (!st->needs_texcoord_semantic &&
|
if (!st->needs_texcoord_semantic &&
|
||||||
fragProg->Base.InputsRead & VARYING_BIT_PNTC) {
|
fragProg->Base.InputsRead & VARYING_BIT_PNTC) {
|
||||||
raster->sprite_coord_enable |=
|
raster->sprite_coord_enable |=
|
||||||
1 << (VARYING_SLOT_PNTC - VARYING_SLOT_TEX0);
|
1 << st_get_generic_varying_index(st, VARYING_SLOT_PNTC);
|
||||||
}
|
}
|
||||||
|
|
||||||
raster->point_quad_rasterization = 1;
|
raster->point_quad_rasterization = 1;
|
||||||
|
|
|
||||||
|
|
@ -275,17 +275,18 @@ st_prepare_vertex_program(struct gl_context *ctx,
|
||||||
case VARYING_SLOT_TEX5:
|
case VARYING_SLOT_TEX5:
|
||||||
case VARYING_SLOT_TEX6:
|
case VARYING_SLOT_TEX6:
|
||||||
case VARYING_SLOT_TEX7:
|
case VARYING_SLOT_TEX7:
|
||||||
stvp->output_semantic_name[slot] = st->needs_texcoord_semantic ?
|
if (st->needs_texcoord_semantic) {
|
||||||
TGSI_SEMANTIC_TEXCOORD : TGSI_SEMANTIC_GENERIC;
|
stvp->output_semantic_name[slot] = TGSI_SEMANTIC_TEXCOORD;
|
||||||
stvp->output_semantic_index[slot] = attr - VARYING_SLOT_TEX0;
|
stvp->output_semantic_index[slot] = attr - VARYING_SLOT_TEX0;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
/* fall through */
|
||||||
case VARYING_SLOT_VAR0:
|
case VARYING_SLOT_VAR0:
|
||||||
default:
|
default:
|
||||||
assert(attr < VARYING_SLOT_MAX);
|
assert(attr < VARYING_SLOT_MAX);
|
||||||
stvp->output_semantic_name[slot] = TGSI_SEMANTIC_GENERIC;
|
stvp->output_semantic_name[slot] = TGSI_SEMANTIC_GENERIC;
|
||||||
stvp->output_semantic_index[slot] = st->needs_texcoord_semantic ?
|
stvp->output_semantic_index[slot] =
|
||||||
(attr - VARYING_SLOT_VAR0) : (attr - VARYING_SLOT_TEX0);
|
st_get_generic_varying_index(st, attr);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -655,9 +656,8 @@ st_translate_fragment_program(struct st_context *st,
|
||||||
* the user varyings on VAR0. Otherwise, we use TEX0 as base index.
|
* the user varyings on VAR0. Otherwise, we use TEX0 as base index.
|
||||||
*/
|
*/
|
||||||
assert(attr >= VARYING_SLOT_TEX0);
|
assert(attr >= VARYING_SLOT_TEX0);
|
||||||
input_semantic_index[slot] = st->needs_texcoord_semantic ?
|
|
||||||
(attr - VARYING_SLOT_VAR0) : (attr - VARYING_SLOT_TEX0);
|
|
||||||
input_semantic_name[slot] = TGSI_SEMANTIC_GENERIC;
|
input_semantic_name[slot] = TGSI_SEMANTIC_GENERIC;
|
||||||
|
input_semantic_index[slot] = st_get_generic_varying_index(st, attr);
|
||||||
if (attr == VARYING_SLOT_PNTC)
|
if (attr == VARYING_SLOT_PNTC)
|
||||||
interpMode[slot] = TGSI_INTERPOLATE_LINEAR;
|
interpMode[slot] = TGSI_INTERPOLATE_LINEAR;
|
||||||
else
|
else
|
||||||
|
|
@ -974,16 +974,18 @@ st_translate_geometry_program(struct st_context *st,
|
||||||
case VARYING_SLOT_TEX5:
|
case VARYING_SLOT_TEX5:
|
||||||
case VARYING_SLOT_TEX6:
|
case VARYING_SLOT_TEX6:
|
||||||
case VARYING_SLOT_TEX7:
|
case VARYING_SLOT_TEX7:
|
||||||
stgp->input_semantic_name[slot] = st->needs_texcoord_semantic ?
|
if (st->needs_texcoord_semantic) {
|
||||||
TGSI_SEMANTIC_TEXCOORD : TGSI_SEMANTIC_GENERIC;
|
stgp->input_semantic_name[slot] = TGSI_SEMANTIC_TEXCOORD;
|
||||||
stgp->input_semantic_index[slot] = (attr - VARYING_SLOT_TEX0);
|
stgp->input_semantic_index[slot] = attr - VARYING_SLOT_TEX0;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
/* fall through */
|
||||||
case VARYING_SLOT_VAR0:
|
case VARYING_SLOT_VAR0:
|
||||||
default:
|
default:
|
||||||
assert(attr >= VARYING_SLOT_VAR0 && attr < VARYING_SLOT_MAX);
|
assert(attr >= VARYING_SLOT_VAR0 && attr < VARYING_SLOT_MAX);
|
||||||
stgp->input_semantic_name[slot] = TGSI_SEMANTIC_GENERIC;
|
stgp->input_semantic_name[slot] = TGSI_SEMANTIC_GENERIC;
|
||||||
stgp->input_semantic_index[slot] = st->needs_texcoord_semantic ?
|
stgp->input_semantic_index[slot] =
|
||||||
(attr - VARYING_SLOT_VAR0) : (attr - VARYING_SLOT_TEX0);
|
st_get_generic_varying_index(st, attr);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1069,17 +1071,19 @@ st_translate_geometry_program(struct st_context *st,
|
||||||
case VARYING_SLOT_TEX5:
|
case VARYING_SLOT_TEX5:
|
||||||
case VARYING_SLOT_TEX6:
|
case VARYING_SLOT_TEX6:
|
||||||
case VARYING_SLOT_TEX7:
|
case VARYING_SLOT_TEX7:
|
||||||
gs_output_semantic_name[slot] = st->needs_texcoord_semantic ?
|
if (st->needs_texcoord_semantic) {
|
||||||
TGSI_SEMANTIC_TEXCOORD : TGSI_SEMANTIC_GENERIC;
|
gs_output_semantic_name[slot] = TGSI_SEMANTIC_TEXCOORD;
|
||||||
gs_output_semantic_index[slot] = (attr - VARYING_SLOT_TEX0);
|
gs_output_semantic_index[slot] = attr - VARYING_SLOT_TEX0;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
/* fall through */
|
||||||
case VARYING_SLOT_VAR0:
|
case VARYING_SLOT_VAR0:
|
||||||
default:
|
default:
|
||||||
assert(slot < Elements(gs_output_semantic_name));
|
assert(slot < Elements(gs_output_semantic_name));
|
||||||
assert(attr >= VARYING_SLOT_VAR0);
|
assert(attr >= VARYING_SLOT_VAR0);
|
||||||
gs_output_semantic_name[slot] = TGSI_SEMANTIC_GENERIC;
|
gs_output_semantic_name[slot] = TGSI_SEMANTIC_GENERIC;
|
||||||
gs_output_semantic_index[slot] = st->needs_texcoord_semantic ?
|
gs_output_semantic_index[slot] =
|
||||||
(attr - VARYING_SLOT_VAR0) : (attr - VARYING_SLOT_TEX0);
|
st_get_generic_varying_index(st, attr);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -270,6 +270,31 @@ st_reference_fragprog(struct st_context *st,
|
||||||
(struct gl_program *) prog);
|
(struct gl_program *) prog);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This defines mapping from Mesa VARYING_SLOTs to TGSI GENERIC slots.
|
||||||
|
*/
|
||||||
|
static INLINE unsigned
|
||||||
|
st_get_generic_varying_index(struct st_context *st, GLuint attr)
|
||||||
|
{
|
||||||
|
if (attr >= VARYING_SLOT_VAR0) {
|
||||||
|
if (st->needs_texcoord_semantic)
|
||||||
|
return attr - VARYING_SLOT_VAR0;
|
||||||
|
else
|
||||||
|
return 9 + (attr - VARYING_SLOT_VAR0);
|
||||||
|
}
|
||||||
|
if (attr == VARYING_SLOT_PNTC) {
|
||||||
|
assert(!st->needs_texcoord_semantic);
|
||||||
|
return 8;
|
||||||
|
}
|
||||||
|
if (attr >= VARYING_SLOT_TEX0 && attr <= VARYING_SLOT_TEX7) {
|
||||||
|
assert(!st->needs_texcoord_semantic);
|
||||||
|
return attr - VARYING_SLOT_TEX0;
|
||||||
|
}
|
||||||
|
|
||||||
|
assert(0);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
extern struct st_vp_variant *
|
extern struct st_vp_variant *
|
||||||
st_get_vp_variant(struct st_context *st,
|
st_get_vp_variant(struct st_context *st,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue