summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri
diff options
context:
space:
mode:
authorMarek Olšák <marek.olsak@amd.com>2017-11-15 22:02:51 +0100
committerMarek Olšák <marek.olsak@amd.com>2018-02-13 01:00:45 +0100
commit07c10cc59c164ddd0109e061dac8edf47437d8ca (patch)
treead38e5e0408a4fe07fb41a77b0bacef2e19a7100 /src/mesa/drivers/dri
parent79aca14f5f37de32140fb710970133c72886a0f2 (diff)
mesa: separate legacy stuff from gl_texture_unit into gl_fixedfunc_texture_unit
Reviewed-by: Brian Paul <brianp@vmware.com>
Diffstat (limited to 'src/mesa/drivers/dri')
-rw-r--r--src/mesa/drivers/dri/i915/i830_texblend.c3
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_util.h2
-rw-r--r--src/mesa/drivers/dri/nouveau/nv04_context.c14
-rw-r--r--src/mesa/drivers/dri/nouveau/nv04_state_frag.c6
-rw-r--r--src/mesa/drivers/dri/nouveau/nv10_state_frag.c4
-rw-r--r--src/mesa/drivers/dri/nouveau/nv10_state_tex.c5
-rw-r--r--src/mesa/drivers/dri/nouveau/nv20_state_tex.c3
-rw-r--r--src/mesa/drivers/dri/r200/r200_tex.c3
-rw-r--r--src/mesa/drivers/dri/r200/r200_texstate.c31
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_maos_verts.c2
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_state.c2
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_tex.c3
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_texstate.c13
13 files changed, 53 insertions, 38 deletions
diff --git a/src/mesa/drivers/dri/i915/i830_texblend.c b/src/mesa/drivers/dri/i915/i830_texblend.c
index 15d6d54a795..390a54f917f 100644
--- a/src/mesa/drivers/dri/i915/i830_texblend.c
+++ b/src/mesa/drivers/dri/i915/i830_texblend.c
@@ -388,7 +388,8 @@ static void
emit_texblend(struct i830_context *i830, GLuint unit, GLuint blendUnit,
bool last_stage)
{
- struct gl_texture_unit *texUnit = &i830->intel.ctx.Texture.Unit[unit];
+ struct gl_fixedfunc_texture_unit *texUnit =
+ &i830->intel.ctx.Texture.FixedFuncUnit[unit];
GLuint tmp[I830_TEXBLEND_SIZE], tmp_sz;
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_util.h b/src/mesa/drivers/dri/nouveau/nouveau_util.h
index 8087445b65a..088a2563766 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_util.h
+++ b/src/mesa/drivers/dri/nouveau/nouveau_util.h
@@ -193,7 +193,7 @@ is_texture_source(int s)
}
static inline struct gl_texgen *
-get_texgen_coord(struct gl_texture_unit *u, int i)
+get_texgen_coord(struct gl_fixedfunc_texture_unit *u, int i)
{
return ((struct gl_texgen *[])
{ &u->GenS, &u->GenT, &u->GenR, &u->GenQ }) [i];
diff --git a/src/mesa/drivers/dri/nouveau/nv04_context.c b/src/mesa/drivers/dri/nouveau/nv04_context.c
index 4dbb950e9ab..324595e2403 100644
--- a/src/mesa/drivers/dri/nouveau/nv04_context.c
+++ b/src/mesa/drivers/dri/nouveau/nv04_context.c
@@ -32,17 +32,18 @@
#include "nv04_driver.h"
static GLboolean
-texunit_needs_combiners(struct gl_texture_unit *u)
+texunit_needs_combiners(struct gl_texture_unit *u,
+ struct gl_fixedfunc_texture_unit *f)
{
struct gl_texture_object *t = u->_Current;
struct gl_texture_image *ti = t->Image[0][t->BaseLevel];
return ti->TexFormat == MESA_FORMAT_A_UNORM8 ||
ti->TexFormat == MESA_FORMAT_L_UNORM8 ||
- u->EnvMode == GL_COMBINE ||
- u->EnvMode == GL_COMBINE4_NV ||
- u->EnvMode == GL_BLEND ||
- u->EnvMode == GL_ADD;
+ f->EnvMode == GL_COMBINE ||
+ f->EnvMode == GL_COMBINE4_NV ||
+ f->EnvMode == GL_BLEND ||
+ f->EnvMode == GL_ADD;
}
struct nouveau_object *
@@ -54,7 +55,8 @@ nv04_context_engine(struct gl_context *ctx)
struct nouveau_object *fahrenheit;
if ((ctx->Texture.Unit[0]._Current &&
- texunit_needs_combiners(&ctx->Texture.Unit[0])) ||
+ texunit_needs_combiners(&ctx->Texture.Unit[0],
+ &ctx->Texture.FixedFuncUnit[0])) ||
ctx->Texture.Unit[1]._Current ||
ctx->Stencil.Enabled ||
GET_COLORMASK(ctx->Color.ColorMask, 0) != 0xf)
diff --git a/src/mesa/drivers/dri/nouveau/nv04_state_frag.c b/src/mesa/drivers/dri/nouveau/nv04_state_frag.c
index bfe8eaea123..26e2e91a6e0 100644
--- a/src/mesa/drivers/dri/nouveau/nv04_state_frag.c
+++ b/src/mesa/drivers/dri/nouveau/nv04_state_frag.c
@@ -64,7 +64,7 @@ struct combiner_state {
* context. */
#define INIT_COMBINER(chan, ctx, rc, i) do { \
struct gl_tex_env_combine_state *c = \
- ctx->Texture.Unit[i]._CurrentCombine; \
+ ctx->Texture.FixedFuncUnit[i]._CurrentCombine; \
(rc)->ctx = ctx; \
(rc)->unit = i; \
(rc)->alpha = __INIT_COMBINER_ALPHA_##chan; \
@@ -287,7 +287,7 @@ nv04_emit_tex_env(struct gl_context *ctx, int emit)
/* calculate non-multitex state */
nv04->blend &= ~NV04_TEXTURED_TRIANGLE_BLEND_TEXTURE_MAP__MASK;
if (ctx->Texture._MaxEnabledTexImageUnit != -1)
- nv04->blend |= get_texenv_mode(ctx->Texture.Unit[0].EnvMode);
+ nv04->blend |= get_texenv_mode(ctx->Texture.FixedFuncUnit[0].EnvMode);
else
nv04->blend |= get_texenv_mode(GL_MODULATE);
@@ -295,5 +295,5 @@ nv04_emit_tex_env(struct gl_context *ctx, int emit)
nv04->alpha[i] = rc_a.hw;
nv04->color[i] = rc_c.hw;
nv04->factor = pack_rgba_f(MESA_FORMAT_B8G8R8A8_UNORM,
- ctx->Texture.Unit[0].EnvColor);
+ ctx->Texture.FixedFuncUnit[0].EnvColor);
}
diff --git a/src/mesa/drivers/dri/nouveau/nv10_state_frag.c b/src/mesa/drivers/dri/nouveau/nv10_state_frag.c
index 42dff085ca5..27400d3ebdc 100644
--- a/src/mesa/drivers/dri/nouveau/nv10_state_frag.c
+++ b/src/mesa/drivers/dri/nouveau/nv10_state_frag.c
@@ -80,7 +80,7 @@ struct combiner_state {
* context. */
#define INIT_COMBINER(chan, ctx, rc, i) do { \
struct gl_tex_env_combine_state *c = \
- ctx->Texture.Unit[i]._CurrentCombine; \
+ ctx->Texture.FixedFuncUnit[i]._CurrentCombine; \
(rc)->ctx = ctx; \
(rc)->unit = i; \
(rc)->premodulate = c->_NumArgs##chan == 4; \
@@ -332,7 +332,7 @@ nv10_get_general_combiner(struct gl_context *ctx, int i,
}
*k = pack_rgba_f(MESA_FORMAT_B8G8R8A8_UNORM,
- ctx->Texture.Unit[i].EnvColor);
+ ctx->Texture.FixedFuncUnit[i].EnvColor);
*a_in = rc_a.in;
*a_out = rc_a.out;
*c_in = rc_c.in;
diff --git a/src/mesa/drivers/dri/nouveau/nv10_state_tex.c b/src/mesa/drivers/dri/nouveau/nv10_state_tex.c
index d85adfa9cf7..d741d416673 100644
--- a/src/mesa/drivers/dri/nouveau/nv10_state_tex.c
+++ b/src/mesa/drivers/dri/nouveau/nv10_state_tex.c
@@ -39,7 +39,8 @@ nv10_emit_tex_gen(struct gl_context *ctx, int emit)
const int i = emit - NOUVEAU_STATE_TEX_GEN0;
struct nouveau_context *nctx = to_nouveau_context(ctx);
struct nouveau_pushbuf *push = context_push(ctx);
- struct gl_texture_unit *unit = &ctx->Texture.Unit[i];
+ struct gl_fixedfunc_texture_unit *unit =
+ &ctx->Texture.FixedFuncUnit[i];
int j;
for (j = 0; j < 4; j++) {
@@ -73,7 +74,7 @@ nv10_emit_tex_mat(struct gl_context *ctx, int emit)
if (nctx->fallback == HWTNL &&
((ctx->Texture._TexMatEnabled & 1 << i) ||
- ctx->Texture.Unit[i]._GenFlags)) {
+ ctx->Texture.FixedFuncUnit[i]._GenFlags)) {
BEGIN_NV04(push, NV10_3D(TEX_MATRIX_ENABLE(i)), 1);
PUSH_DATA (push, 1);
diff --git a/src/mesa/drivers/dri/nouveau/nv20_state_tex.c b/src/mesa/drivers/dri/nouveau/nv20_state_tex.c
index 72df81476c5..9960ae0d449 100644
--- a/src/mesa/drivers/dri/nouveau/nv20_state_tex.c
+++ b/src/mesa/drivers/dri/nouveau/nv20_state_tex.c
@@ -39,7 +39,8 @@ nv20_emit_tex_gen(struct gl_context *ctx, int emit)
const int i = emit - NOUVEAU_STATE_TEX_GEN0;
struct nouveau_context *nctx = to_nouveau_context(ctx);
struct nouveau_pushbuf *push = context_push(ctx);
- struct gl_texture_unit *unit = &ctx->Texture.Unit[i];
+ struct gl_fixedfunc_texture_unit *unit =
+ &ctx->Texture.FixedFuncUnit[i];
int j;
for (j = 0; j < 4; j++) {
diff --git a/src/mesa/drivers/dri/r200/r200_tex.c b/src/mesa/drivers/dri/r200/r200_tex.c
index 0696c0dc683..1b217b9ed2b 100644
--- a/src/mesa/drivers/dri/r200/r200_tex.c
+++ b/src/mesa/drivers/dri/r200/r200_tex.c
@@ -297,7 +297,8 @@ static void r200TexEnv( struct gl_context *ctx, GLenum target,
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
GLuint unit = ctx->Texture.CurrentUnit;
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
+ struct gl_fixedfunc_texture_unit *texUnit =
+ &ctx->Texture.FixedFuncUnit[unit];
radeon_print(RADEON_TEXTURE | RADEON_STATE, RADEON_VERBOSE, "%s( %s )\n",
__func__, _mesa_enum_to_string( pname ) );
diff --git a/src/mesa/drivers/dri/r200/r200_texstate.c b/src/mesa/drivers/dri/r200/r200_texstate.c
index dcf211f521e..60a20071d97 100644
--- a/src/mesa/drivers/dri/r200/r200_texstate.c
+++ b/src/mesa/drivers/dri/r200/r200_texstate.c
@@ -217,7 +217,9 @@ do { \
static GLboolean r200UpdateTextureEnv( struct gl_context *ctx, int unit, int slot, GLuint replaceargs )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
- const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
+ const struct gl_texture_unit *rtexUnit = &ctx->Texture.Unit[unit];
+ const struct gl_fixedfunc_texture_unit *texUnit =
+ &ctx->Texture.FixedFuncUnit[unit];
GLuint color_combine, alpha_combine;
GLuint color_scale = rmesa->hw.pix[slot].cmd[PIX_PP_TXCBLEND2] &
~(R200_TXC_SCALE_MASK | R200_TXC_OUTPUT_REG_MASK | R200_TXC_TFACTOR_SEL_MASK |
@@ -244,7 +246,7 @@ static GLboolean r200UpdateTextureEnv( struct gl_context *ctx, int unit, int slo
(unit << R200_TXA_TFACTOR_SEL_SHIFT) |
(replaceargs << R200_TXA_TFACTOR1_SEL_SHIFT);
- if ( !texUnit->_Current ) {
+ if ( !rtexUnit->_Current ) {
assert( unit == 0);
color_combine = R200_TXC_ARG_A_ZERO | R200_TXC_ARG_B_ZERO
| R200_TXC_ARG_C_DIFFUSE_COLOR | R200_TXC_OP_MADD;
@@ -261,9 +263,9 @@ static GLboolean r200UpdateTextureEnv( struct gl_context *ctx, int unit, int slo
const GLint replaceoprgb =
- ctx->Texture.Unit[replaceargs]._CurrentCombine->OperandRGB[0] - GL_SRC_COLOR;
+ ctx->Texture.FixedFuncUnit[replaceargs]._CurrentCombine->OperandRGB[0] - GL_SRC_COLOR;
const GLint replaceopa =
- ctx->Texture.Unit[replaceargs]._CurrentCombine->OperandA[0] - GL_SRC_ALPHA;
+ ctx->Texture.FixedFuncUnit[replaceargs]._CurrentCombine->OperandA[0] - GL_SRC_ALPHA;
/* Step 1:
* Extract the color and alpha combine function arguments.
@@ -286,7 +288,7 @@ static GLboolean r200UpdateTextureEnv( struct gl_context *ctx, int unit, int slo
case GL_PREVIOUS:
if (replaceargs != unit) {
const GLint srcRGBreplace =
- ctx->Texture.Unit[replaceargs]._CurrentCombine->SourceRGB[0];
+ ctx->Texture.FixedFuncUnit[replaceargs]._CurrentCombine->SourceRGB[0];
if (op >= 2) {
op = op ^ replaceopa;
}
@@ -373,7 +375,7 @@ static GLboolean r200UpdateTextureEnv( struct gl_context *ctx, int unit, int slo
case GL_PREVIOUS:
if (replaceargs != unit) {
const GLint srcAreplace =
- ctx->Texture.Unit[replaceargs]._CurrentCombine->SourceA[0];
+ ctx->Texture.FixedFuncUnit[replaceargs]._CurrentCombine->SourceA[0];
op = op ^ replaceopa;
switch (srcAreplace) {
case GL_TEXTURE:
@@ -771,7 +773,9 @@ static GLboolean r200UpdateAllTexEnv( struct gl_context *ctx )
stageref[maxunitused + 1] = REF_COLOR | REF_ALPHA;
for ( j = maxunitused; j >= 0; j-- ) {
- const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[j];
+ const struct gl_texture_unit *rtexUnit = &ctx->Texture.Unit[j];
+ const struct gl_fixedfunc_texture_unit *texUnit =
+ &ctx->Texture.FixedFuncUnit[j];
rmesa->state.texture.unit[j].outputreg = -1;
@@ -793,7 +797,7 @@ static GLboolean r200UpdateAllTexEnv( struct gl_context *ctx )
nextunit[j] = currentnext;
- if (!texUnit->_Current) {
+ if (!rtexUnit->_Current) {
/* the not enabled stages are referenced "indirectly",
must not cut off the lower stages */
stageref[j] = REF_COLOR | REF_ALPHA;
@@ -880,10 +884,10 @@ static GLboolean r200UpdateAllTexEnv( struct gl_context *ctx )
if (ctx->Texture.Unit[i]._Current && stageref[i+1]) {
GLuint replaceunit = i;
/* try to optimize GL_REPLACE away (only one level deep though) */
- if ( (ctx->Texture.Unit[i]._CurrentCombine->ModeRGB == GL_REPLACE) &&
- (ctx->Texture.Unit[i]._CurrentCombine->ModeA == GL_REPLACE) &&
- (ctx->Texture.Unit[i]._CurrentCombine->ScaleShiftRGB == 0) &&
- (ctx->Texture.Unit[i]._CurrentCombine->ScaleShiftA == 0) &&
+ if ( (ctx->Texture.FixedFuncUnit[i]._CurrentCombine->ModeRGB == GL_REPLACE) &&
+ (ctx->Texture.FixedFuncUnit[i]._CurrentCombine->ModeA == GL_REPLACE) &&
+ (ctx->Texture.FixedFuncUnit[i]._CurrentCombine->ScaleShiftRGB == 0) &&
+ (ctx->Texture.FixedFuncUnit[i]._CurrentCombine->ScaleShiftA == 0) &&
(nextunit[i] > 0) ) {
/* yippie! can optimize it away! */
replaceunit = i;
@@ -1086,7 +1090,8 @@ static GLuint r200_need_dis_texgen(const GLbitfield texGenEnabled,
static GLboolean r200_validate_texgen( struct gl_context *ctx, GLuint unit )
{
r200ContextPtr rmesa = R200_CONTEXT(ctx);
- const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
+ const struct gl_fixedfunc_texture_unit *texUnit =
+ &ctx->Texture.FixedFuncUnit[unit];
GLuint inputshift = R200_TEXGEN_0_INPUT_SHIFT + unit*4;
GLuint tgi, tgcm;
GLuint mode = 0;
diff --git a/src/mesa/drivers/dri/radeon/radeon_maos_verts.c b/src/mesa/drivers/dri/radeon/radeon_maos_verts.c
index 9a778506205..c9c91f8640c 100644
--- a/src/mesa/drivers/dri/radeon/radeon_maos_verts.c
+++ b/src/mesa/drivers/dri/radeon/radeon_maos_verts.c
@@ -352,7 +352,7 @@ void radeonEmitArrays( struct gl_context *ctx, GLuint inputs )
req |= RADEON_Q_BIT(unit);
vtx |= RADEON_Q_BIT(unit);
}
- if ( (ctx->Texture.Unit[unit].TexGenEnabled & (R_BIT | Q_BIT)) )
+ if ( (ctx->Texture.FixedFuncUnit[unit].TexGenEnabled & (R_BIT | Q_BIT)) )
vtx |= RADEON_Q_BIT(unit);
else if ((VB->AttribPtr[_TNL_ATTRIB_TEX0 + unit]->size >= 3) &&
(!ctx->Texture.Unit[unit]._Current ||
diff --git a/src/mesa/drivers/dri/radeon/radeon_state.c b/src/mesa/drivers/dri/radeon/radeon_state.c
index e413df3542e..58d8fc54b79 100644
--- a/src/mesa/drivers/dri/radeon/radeon_state.c
+++ b/src/mesa/drivers/dri/radeon/radeon_state.c
@@ -1890,7 +1890,7 @@ static void update_texturematrix( struct gl_context *ctx )
if (needMatrix) {
rmesa->NeedTexMatrix |= 1 << unit;
radeonUploadTexMatrix( rmesa, unit,
- !ctx->Texture.Unit[unit].TexGenEnabled );
+ !ctx->Texture.FixedFuncUnit[unit].TexGenEnabled );
}
}
}
diff --git a/src/mesa/drivers/dri/radeon/radeon_tex.c b/src/mesa/drivers/dri/radeon/radeon_tex.c
index b4964f13cdf..da5d469e04c 100644
--- a/src/mesa/drivers/dri/radeon/radeon_tex.c
+++ b/src/mesa/drivers/dri/radeon/radeon_tex.c
@@ -257,7 +257,8 @@ static void radeonTexEnv( struct gl_context *ctx, GLenum target,
{
r100ContextPtr rmesa = R100_CONTEXT(ctx);
GLuint unit = ctx->Texture.CurrentUnit;
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
+ struct gl_fixedfunc_texture_unit *texUnit =
+ &ctx->Texture.FixedFuncUnit[unit];
if ( RADEON_DEBUG & RADEON_STATE ) {
fprintf( stderr, "%s( %s )\n",
diff --git a/src/mesa/drivers/dri/radeon/radeon_texstate.c b/src/mesa/drivers/dri/radeon/radeon_texstate.c
index 5cabba1227f..47eac855c66 100644
--- a/src/mesa/drivers/dri/radeon/radeon_texstate.c
+++ b/src/mesa/drivers/dri/radeon/radeon_texstate.c
@@ -208,7 +208,9 @@ texture_base_format(const struct gl_texture_object *t)
static GLboolean radeonUpdateTextureEnv( struct gl_context *ctx, int unit )
{
r100ContextPtr rmesa = R100_CONTEXT(ctx);
- const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
+ const struct gl_texture_unit *rtexUnit = &ctx->Texture.Unit[unit];
+ const struct gl_fixedfunc_texture_unit *texUnit =
+ &ctx->Texture.FixedFuncUnit[unit];
GLuint color_combine, alpha_combine;
const GLuint color_combine0 = RADEON_COLOR_ARG_A_ZERO | RADEON_COLOR_ARG_B_ZERO
| RADEON_COLOR_ARG_C_CURRENT_COLOR | RADEON_BLEND_CTL_ADD
@@ -234,7 +236,7 @@ static GLboolean radeonUpdateTextureEnv( struct gl_context *ctx, int unit )
rmesa->state.texture.unit[unit].format = 0;
rmesa->state.texture.unit[unit].envMode = 0;
- if ( !texUnit->_Current ) {
+ if ( !rtexUnit->_Current ) {
color_combine = color_combine0;
alpha_combine = alpha_combine0;
}
@@ -257,7 +259,7 @@ static GLboolean radeonUpdateTextureEnv( struct gl_context *ctx, int unit )
assert(op <= 3);
switch ( srcRGBi ) {
case GL_TEXTURE:
- if (texture_base_format(texUnit->_Current) == GL_ALPHA)
+ if (texture_base_format(rtexUnit->_Current) == GL_ALPHA)
color_arg[i] = radeon_zero_color[op];
else
color_arg[i] = radeon_texture_color[op][unit];
@@ -302,7 +304,7 @@ static GLboolean radeonUpdateTextureEnv( struct gl_context *ctx, int unit )
assert(op <= 1);
switch ( srcAi ) {
case GL_TEXTURE:
- if (texture_base_format(texUnit->_Current) == GL_LUMINANCE)
+ if (texture_base_format(rtexUnit->_Current) == GL_LUMINANCE)
alpha_arg[i] = radeon_zero_alpha[op+1];
else
alpha_arg[i] = radeon_texture_alpha[op][unit];
@@ -798,7 +800,8 @@ static void set_texgen_matrix( r100ContextPtr rmesa,
static GLboolean radeon_validate_texgen( struct gl_context *ctx, GLuint unit )
{
r100ContextPtr rmesa = R100_CONTEXT(ctx);
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
+ struct gl_fixedfunc_texture_unit *texUnit =
+ &ctx->Texture.FixedFuncUnit[unit];
GLuint inputshift = RADEON_TEXGEN_0_INPUT_SHIFT + unit*4;
GLuint tmp = rmesa->TexGenEnabled;
static const GLfloat reflect[16] = {