[Mesa-dev] [PATCH 2/6] mesa: split _NEW_TEXTURE into _NEW_TEXTURE_OBJECT & _NEW_TEXTURE_STATE
Marek Olšák
maraeo at gmail.com
Thu Mar 23 23:42:02 UTC 2017
From: Marek Olšák <marek.olsak at amd.com>
No performance testing has been done, because it makes sense to make this
change regardless of that. Also, _NEW_TEXTURE is still used in many places,
but the obvious occurences are replaced here.
It's now possible to split _NEW_TEXTURE_OBJECT further.
---
src/mesa/main/enable.c | 8 ++++----
src/mesa/main/ff_fragment_shader.cpp | 4 ++--
src/mesa/main/mipmap.c | 2 +-
src/mesa/main/mtypes.h | 8 +++++---
src/mesa/main/samplerobj.c | 10 +++++-----
src/mesa/main/shaderimage.h | 2 +-
src/mesa/main/texenv.c | 18 +++++++++---------
src/mesa/main/texgen.c | 6 +++---
src/mesa/main/teximage.c | 6 +++---
src/mesa/main/texobj.c | 14 +++++++-------
src/mesa/main/texparam.c | 10 +++++-----
src/mesa/main/texstate.c | 2 +-
src/mesa/main/uniform_query.cpp | 2 +-
src/mesa/program/prog_statevars.c | 4 ++--
src/mesa/state_tracker/st_context.c | 2 +-
15 files changed, 50 insertions(+), 48 deletions(-)
diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c
index f0c5bb7..d9d63a6 100644
--- a/src/mesa/main/enable.c
+++ b/src/mesa/main/enable.c
@@ -219,21 +219,21 @@ get_texcoord_unit(struct gl_context *ctx)
static GLboolean
enable_texture(struct gl_context *ctx, GLboolean state, GLbitfield texBit)
{
struct gl_texture_unit *texUnit = _mesa_get_current_tex_unit(ctx);
const GLbitfield newenabled = state
? (texUnit->Enabled | texBit) : (texUnit->Enabled & ~texBit);
if (texUnit->Enabled == newenabled)
return GL_FALSE;
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE_STATE);
texUnit->Enabled = newenabled;
return GL_TRUE;
}
/**
* Helper function to enable or disable GL_MULTISAMPLE, skipping the check for
* whether the API supports it (GLES doesn't).
*/
void
@@ -711,42 +711,42 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
if (ctx->API != API_OPENGL_COMPAT)
goto invalid_enum_error;
if (texUnit) {
GLbitfield coordBit = S_BIT << (cap - GL_TEXTURE_GEN_S);
GLbitfield newenabled = texUnit->TexGenEnabled & ~coordBit;
if (state)
newenabled |= coordBit;
if (texUnit->TexGenEnabled == newenabled)
return;
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE_STATE);
texUnit->TexGenEnabled = newenabled;
}
}
break;
case GL_TEXTURE_GEN_STR_OES:
/* disable S, T, and R at the same time */
{
struct gl_texture_unit *texUnit = get_texcoord_unit(ctx);
if (ctx->API != API_OPENGLES)
goto invalid_enum_error;
if (texUnit) {
GLuint newenabled =
texUnit->TexGenEnabled & ~STR_BITS;
if (state)
newenabled |= STR_BITS;
if (texUnit->TexGenEnabled == newenabled)
return;
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE_STATE);
texUnit->TexGenEnabled = newenabled;
}
}
break;
/* client-side state */
case GL_VERTEX_ARRAY:
case GL_NORMAL_ARRAY:
case GL_COLOR_ARRAY:
case GL_TEXTURE_COORD_ARRAY:
@@ -951,21 +951,21 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
return;
FLUSH_VERTICES(ctx, _NEW_PROGRAM);
ctx->ATIFragmentShader.Enabled = state;
break;
case GL_TEXTURE_CUBE_MAP_SEAMLESS:
if (!_mesa_is_desktop_gl(ctx))
goto invalid_enum_error;
CHECK_EXTENSION(ARB_seamless_cube_map, cap);
if (ctx->Texture.CubeMapSeamless != state) {
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE_OBJECT);
ctx->Texture.CubeMapSeamless = state;
}
break;
case GL_RASTERIZER_DISCARD:
if (!_mesa_is_desktop_gl(ctx) && !_mesa_is_gles3(ctx))
goto invalid_enum_error;
CHECK_EXTENSION(EXT_transform_feedback, cap);
if (ctx->RasterDiscard != state) {
FLUSH_VERTICES(ctx, 0);
diff --git a/src/mesa/main/ff_fragment_shader.cpp b/src/mesa/main/ff_fragment_shader.cpp
index be382fa..f007ac3 100644
--- a/src/mesa/main/ff_fragment_shader.cpp
+++ b/src/mesa/main/ff_fragment_shader.cpp
@@ -331,21 +331,21 @@ static GLbitfield get_fp_input_mask( struct gl_context *ctx )
* vertex program:
*/
/* _NEW_LIGHT */
if (ctx->Light.Enabled) {
fp_inputs |= VARYING_BIT_COL0;
if (texenv_doing_secondary_color(ctx))
fp_inputs |= VARYING_BIT_COL1;
}
- /* _NEW_TEXTURE */
+ /* _NEW_TEXTURE_STATE */
fp_inputs |= (ctx->Texture._TexGenEnabled |
ctx->Texture._TexMatEnabled) << VARYING_SLOT_TEX0;
/* Then look at what might be varying as a result of enabled
* arrays, etc:
*/
if (varying_inputs & VERT_BIT_COLOR0)
fp_inputs |= VARYING_BIT_COL0;
if (varying_inputs & VERT_BIT_COLOR1)
fp_inputs |= VARYING_BIT_COL1;
@@ -397,21 +397,21 @@ static GLbitfield get_fp_input_mask( struct gl_context *ctx )
static GLuint make_state_key( struct gl_context *ctx, struct state_key *key )
{
GLuint j;
GLbitfield inputs_referenced = VARYING_BIT_COL0;
const GLbitfield inputs_available = get_fp_input_mask( ctx );
GLbitfield mask;
GLuint keySize;
memset(key, 0, sizeof(*key));
- /* _NEW_TEXTURE */
+ /* _NEW_TEXTURE_OBJECT */
mask = ctx->Texture._EnabledCoordUnits;
while (mask) {
const int i = u_bit_scan(&mask);
const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[i];
const struct gl_texture_object *texObj = texUnit->_Current;
const struct gl_tex_env_combine_state *comb = texUnit->_CurrentCombine;
const struct gl_sampler_object *samp;
GLenum format;
if (!texObj)
diff --git a/src/mesa/main/mipmap.c b/src/mesa/main/mipmap.c
index 05c13fb..8745dd9 100644
--- a/src/mesa/main/mipmap.c
+++ b/src/mesa/main/mipmap.c
@@ -1860,21 +1860,21 @@ prepare_mipmap_level(struct gl_context *ctx,
_mesa_init_teximage_fields(ctx, dstImage,
width, height, depth,
border, intFormat, format);
ctx->Driver.AllocTextureImageBuffer(ctx, dstImage);
/* in case the mipmap level is part of an FBO: */
_mesa_update_fbo_texture(ctx, texObj, face, level);
- ctx->NewState |= _NEW_TEXTURE;
+ ctx->NewState |= _NEW_TEXTURE_OBJECT;
}
}
return GL_TRUE;
}
/**
* Prepare all mipmap levels beyond 'baseLevel' for mipmap generation.
* When finished, all the gl_texture_image structures for the smaller
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index be78b96..91e1948 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -4093,46 +4093,48 @@ struct gl_matrix_stack
#define _NEW_FOG (1u << 6) /**< gl_context::Fog */
#define _NEW_HINT (1u << 7) /**< gl_context::Hint */
#define _NEW_LIGHT (1u << 8) /**< gl_context::Light */
#define _NEW_LINE (1u << 9) /**< gl_context::Line */
#define _NEW_PIXEL (1u << 10) /**< gl_context::Pixel */
#define _NEW_POINT (1u << 11) /**< gl_context::Point */
#define _NEW_POLYGON (1u << 12) /**< gl_context::Polygon */
#define _NEW_POLYGONSTIPPLE (1u << 13) /**< gl_context::PolygonStipple */
#define _NEW_SCISSOR (1u << 14) /**< gl_context::Scissor */
#define _NEW_STENCIL (1u << 15) /**< gl_context::Stencil */
-#define _NEW_TEXTURE (1u << 16) /**< gl_context::Texture */
+#define _NEW_TEXTURE_OBJECT (1u << 16) /**< gl_context::Texture (bindings only) */
#define _NEW_TRANSFORM (1u << 17) /**< gl_context::Transform */
#define _NEW_VIEWPORT (1u << 18) /**< gl_context::Viewport */
-/* gap, re-use for core Mesa state only; use ctx->DriverFlags otherwise */
+#define _NEW_TEXTURE_STATE (1u << 19) /**< gl_context::Texture (states only) */
#define _NEW_ARRAY (1u << 20) /**< gl_context::Array */
#define _NEW_RENDERMODE (1u << 21) /**< gl_context::RenderMode, etc */
#define _NEW_BUFFERS (1u << 22) /**< gl_context::Visual, DrawBuffer, */
#define _NEW_CURRENT_ATTRIB (1u << 23) /**< gl_context::Current */
#define _NEW_MULTISAMPLE (1u << 24) /**< gl_context::Multisample */
#define _NEW_TRACK_MATRIX (1u << 25) /**< gl_context::VertexProgram */
#define _NEW_PROGRAM (1u << 26) /**< New program/shader state */
#define _NEW_PROGRAM_CONSTANTS (1u << 27)
#define _NEW_BUFFER_OBJECT (1u << 28)
#define _NEW_FRAG_CLAMP (1u << 29)
/* gap, re-use for core Mesa state only; use ctx->DriverFlags otherwise */
#define _NEW_VARYING_VP_INPUTS (1u << 31) /**< gl_context::varying_vp_inputs */
#define _NEW_ALL ~0
/*@}*/
/**
* Composite state flags
*/
/*@{*/
+#define _NEW_TEXTURE (_NEW_TEXTURE_OBJECT | _NEW_TEXTURE_STATE)
+
#define _MESA_NEW_NEED_EYE_COORDS (_NEW_LIGHT | \
- _NEW_TEXTURE | \
+ _NEW_TEXTURE_STATE | \
_NEW_POINT | \
_NEW_PROGRAM | \
_NEW_MODELVIEW)
#define _MESA_NEW_SEPARATE_SPECULAR (_NEW_LIGHT | \
_NEW_FOG | \
_NEW_PROGRAM)
/*@}*/
diff --git a/src/mesa/main/samplerobj.c b/src/mesa/main/samplerobj.c
index a36563a..183f1d2 100644
--- a/src/mesa/main/samplerobj.c
+++ b/src/mesa/main/samplerobj.c
@@ -219,21 +219,21 @@ _mesa_DeleteSamplers(GLsizei count, const GLuint *samplers)
for (i = 0; i < count; i++) {
if (samplers[i]) {
GLuint j;
struct gl_sampler_object *sampObj =
lookup_samplerobj_locked(ctx, samplers[i]);
if (sampObj) {
/* If the sampler is currently bound, unbind it. */
for (j = 0; j < ctx->Const.MaxCombinedTextureImageUnits; j++) {
if (ctx->Texture.Unit[j].Sampler == sampObj) {
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE_OBJECT);
_mesa_reference_sampler_object(ctx, &ctx->Texture.Unit[j].Sampler, NULL);
}
}
/* The ID is immediately freed for re-use */
_mesa_HashRemoveLocked(ctx->Shared->SamplerObjects, samplers[i]);
/* But the object exists until its reference count goes to zero */
_mesa_reference_sampler_object(ctx, &sampObj, NULL);
}
}
@@ -251,21 +251,21 @@ _mesa_IsSampler(GLuint sampler)
ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
return _mesa_lookup_samplerobj(ctx, sampler) != NULL;
}
void
_mesa_bind_sampler(struct gl_context *ctx, GLuint unit,
struct gl_sampler_object *sampObj)
{
if (ctx->Texture.Unit[unit].Sampler != sampObj) {
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE_OBJECT);
}
_mesa_reference_sampler_object(ctx, &ctx->Texture.Unit[unit].Sampler,
sampObj);
}
void GLAPIENTRY
_mesa_BindSampler(GLuint unit, GLuint sampler)
{
struct gl_sampler_object *sampObj;
@@ -367,35 +367,35 @@ _mesa_BindSamplers(GLuint first, GLsizei count, const GLuint *samplers)
}
} else {
sampObj = NULL;
}
/* Bind the new sampler */
if (sampObj != currentSampler) {
_mesa_reference_sampler_object(ctx,
&ctx->Texture.Unit[unit].Sampler,
sampObj);
- ctx->NewState |= _NEW_TEXTURE;
+ ctx->NewState |= _NEW_TEXTURE_OBJECT;
}
}
_mesa_HashUnlockMutex(ctx->Shared->SamplerObjects);
} else {
/* Unbind all samplers in the range <first> through <first>+<count>-1 */
for (i = 0; i < count; i++) {
const GLuint unit = first + i;
if (ctx->Texture.Unit[unit].Sampler) {
_mesa_reference_sampler_object(ctx,
&ctx->Texture.Unit[unit].Sampler,
NULL);
- ctx->NewState |= _NEW_TEXTURE;
+ ctx->NewState |= _NEW_TEXTURE_OBJECT;
}
}
}
}
/**
* Check if a coordinate wrap mode is legal.
* \return GL_TRUE if legal, GL_FALSE otherwise
*/
@@ -423,21 +423,21 @@ validate_texture_wrap_mode(struct gl_context *ctx, GLenum wrap)
}
}
/**
* This is called just prior to changing any sampler object state.
*/
static inline void
flush(struct gl_context *ctx)
{
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE_OBJECT);
}
void
_mesa_set_sampler_wrap(struct gl_context *ctx, struct gl_sampler_object *samp,
GLenum s, GLenum t, GLenum r)
{
assert(validate_texture_wrap_mode(ctx, s));
assert(validate_texture_wrap_mode(ctx, t));
assert(validate_texture_wrap_mode(ctx, r));
diff --git a/src/mesa/main/shaderimage.h b/src/mesa/main/shaderimage.h
index 2cf0b0a..99dddb7 100644
--- a/src/mesa/main/shaderimage.h
+++ b/src/mesa/main/shaderimage.h
@@ -67,21 +67,21 @@ _mesa_default_image_unit(struct gl_context *ctx);
*/
void
_mesa_init_image_units(struct gl_context *ctx);
/**
* Return GL_TRUE if the state of the image unit passed as argument is valid
* and access from the shader is allowed. Otherwise loads from this unit
* should return zero and stores should have no effect.
*
* The result depends on context state other than the passed image unit, part
- * of the _NEW_TEXTURE set.
+ * of the _NEW_TEXTURE_OBJECT set.
*/
GLboolean
_mesa_is_image_unit_valid(struct gl_context *ctx, struct gl_image_unit *u);
void GLAPIENTRY
_mesa_BindImageTexture(GLuint unit, GLuint texture, GLint level,
GLboolean layered, GLint layer, GLenum access,
GLenum format);
void GLAPIENTRY
diff --git a/src/mesa/main/texenv.c b/src/mesa/main/texenv.c
index de49566..ee5171c 100644
--- a/src/mesa/main/texenv.c
+++ b/src/mesa/main/texenv.c
@@ -70,37 +70,37 @@ set_env_mode(struct gl_context *ctx,
legal = GL_TRUE;
break;
case GL_COMBINE4_NV:
legal = ctx->Extensions.NV_texture_env_combine4;
break;
default:
legal = GL_FALSE;
}
if (legal) {
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE_STATE);
texUnit->EnvMode = mode;
}
else {
TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode);
}
}
static void
set_env_color(struct gl_context *ctx,
struct gl_texture_unit *texUnit,
const GLfloat *color)
{
if (TEST_EQ_4V(color, texUnit->EnvColorUnclamped))
return;
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE_STATE);
COPY_4FV(texUnit->EnvColorUnclamped, color);
texUnit->EnvColor[0] = CLAMP(color[0], 0.0F, 1.0F);
texUnit->EnvColor[1] = CLAMP(color[1], 0.0F, 1.0F);
texUnit->EnvColor[2] = CLAMP(color[2], 0.0F, 1.0F);
texUnit->EnvColor[3] = CLAMP(color[3], 0.0F, 1.0F);
}
/** Set an RGB or A combiner mode/function */
static void
@@ -144,28 +144,28 @@ set_combiner_mode(struct gl_context *ctx,
if (!legal) {
TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", mode);
return;
}
switch (pname) {
case GL_COMBINE_RGB:
if (texUnit->Combine.ModeRGB == mode)
return;
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE_STATE);
texUnit->Combine.ModeRGB = mode;
break;
case GL_COMBINE_ALPHA:
if (texUnit->Combine.ModeA == mode)
return;
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE_STATE);
texUnit->Combine.ModeA = mode;
break;
default:
TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname);
}
}
/** Set an RGB or A combiner source term */
@@ -242,21 +242,21 @@ set_combiner_source(struct gl_context *ctx,
break;
default:
legal = GL_FALSE;
}
if (!legal) {
TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", param);
return;
}
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE_STATE);
if (alpha)
texUnit->Combine.SourceA[term] = param;
else
texUnit->Combine.SourceRGB[term] = param;
}
/** Set an RGB or A combiner operand term */
static void
@@ -324,21 +324,21 @@ set_combiner_operand(struct gl_context *ctx,
break;
default:
legal = GL_FALSE;
}
if (!legal) {
TE_ERROR(GL_INVALID_ENUM, "glTexEnv(param=%s)", param);
return;
}
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE_STATE);
if (alpha)
texUnit->Combine.OperandA[term] = param;
else
texUnit->Combine.OperandRGB[term] = param;
}
static void
set_combiner_scale(struct gl_context *ctx,
@@ -359,27 +359,27 @@ set_combiner_scale(struct gl_context *ctx,
else {
_mesa_error( ctx, GL_INVALID_VALUE,
"glTexEnv(GL_RGB_SCALE not 1, 2 or 4)" );
return;
}
switch (pname) {
case GL_RGB_SCALE:
if (texUnit->Combine.ScaleShiftRGB == shift)
return;
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE_STATE);
texUnit->Combine.ScaleShiftRGB = shift;
break;
case GL_ALPHA_SCALE:
if (texUnit->Combine.ScaleShiftA == shift)
return;
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE_STATE);
texUnit->Combine.ScaleShiftA = shift;
break;
default:
TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname);
}
}
void GLAPIENTRY
@@ -437,21 +437,21 @@ _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param )
break;
default:
_mesa_error( ctx, GL_INVALID_ENUM, "glTexEnv(pname)" );
return;
}
}
else if (target == GL_TEXTURE_FILTER_CONTROL_EXT) {
if (pname == GL_TEXTURE_LOD_BIAS_EXT) {
if (texUnit->LodBias == param[0])
return;
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE_STATE);
texUnit->LodBias = param[0];
}
else {
TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname);
return;
}
}
else if (target == GL_POINT_SPRITE_NV) {
/* GL_ARB_point_sprite / GL_NV_point_sprite */
if (!ctx->Extensions.NV_point_sprite
diff --git a/src/mesa/main/texgen.c b/src/mesa/main/texgen.c
index 24ba295..1b8d187 100644
--- a/src/mesa/main/texgen.c
+++ b/src/mesa/main/texgen.c
@@ -126,35 +126,35 @@ _mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params )
if (!bit) {
_mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(param)" );
return;
}
if (ctx->API != API_OPENGL_COMPAT
&& (bit & (TEXGEN_REFLECTION_MAP_NV | TEXGEN_NORMAL_MAP_NV)) == 0) {
_mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(param)" );
return;
}
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE_STATE);
texgen->Mode = mode;
texgen->_ModeBit = bit;
}
break;
case GL_OBJECT_PLANE:
{
if (ctx->API != API_OPENGL_COMPAT) {
_mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(param)" );
return;
}
if (TEST_EQ_4V(texgen->ObjectPlane, params))
return;
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE_STATE);
COPY_4FV(texgen->ObjectPlane, params);
}
break;
case GL_EYE_PLANE:
{
GLfloat tmp[4];
if (ctx->API != API_OPENGL_COMPAT) {
_mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(param)" );
@@ -162,21 +162,21 @@ _mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params )
}
/* Transform plane equation by the inverse modelview matrix */
if (_math_matrix_is_dirty(ctx->ModelviewMatrixStack.Top)) {
_math_matrix_analyse(ctx->ModelviewMatrixStack.Top);
}
_mesa_transform_vector(tmp, params,
ctx->ModelviewMatrixStack.Top->inv);
if (TEST_EQ_4V(texgen->EyePlane, tmp))
return;
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE_STATE);
COPY_4FV(texgen->EyePlane, tmp);
}
break;
default:
_mesa_error( ctx, GL_INVALID_ENUM, "glTexGenfv(pname)" );
return;
}
if (ctx->Driver.TexGen)
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index efbf30b..1a00d25 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -3218,21 +3218,21 @@ _mesa_texture_sub_image(struct gl_context *ctx, GLuint dims,
xoffset += texImage->Border;
}
ctx->Driver.TexSubImage(ctx, dims, texImage,
xoffset, yoffset, zoffset,
width, height, depth,
format, type, pixels, &ctx->Unpack);
check_gen_mipmap(ctx, target, texObj, level);
- /* NOTE: Don't signal _NEW_TEXTURE since we've only changed
+ /* NOTE: Don't signal _NEW_TEXTURE_OBJECT since we've only changed
* the texel data, not the texture format, size, etc.
*/
}
}
_mesa_unlock_texture(ctx, texObj);
}
/**
* Implement all the glTexSubImage1/2/3D() functions.
* Must split this out this way because of GL_TEXTURE_CUBE_MAP.
@@ -3810,21 +3810,21 @@ _mesa_copy_texture_sub_image(struct gl_context *ctx, GLuint dims,
&width, &height)) {
struct gl_renderbuffer *srcRb =
get_copy_tex_image_source(ctx, texImage->TexFormat);
copytexsubimage_by_slice(ctx, texImage, dims,
xoffset, yoffset, zoffset,
srcRb, x, y, width, height);
check_gen_mipmap(ctx, target, texObj, level);
- /* NOTE: Don't signal _NEW_TEXTURE since we've only changed
+ /* NOTE: Don't signal _NEW_TEXTURE_OBJECT since we've only changed
* the texel data, not the texture format, size, etc.
*/
}
}
_mesa_unlock_texture(ctx, texObj);
}
void GLAPIENTRY
_mesa_CopyTexSubImage1D( GLenum target, GLint level,
GLint xoffset, GLint x, GLint y, GLsizei width )
@@ -4516,21 +4516,21 @@ _mesa_compressed_texture_sub_image(struct gl_context *ctx, GLuint dims,
_mesa_lock_texture(ctx, texObj);
{
if (width > 0 && height > 0 && depth > 0) {
ctx->Driver.CompressedTexSubImage(ctx, dims, texImage,
xoffset, yoffset, zoffset,
width, height, depth,
format, imageSize, data);
check_gen_mipmap(ctx, target, texObj, level);
- /* NOTE: Don't signal _NEW_TEXTURE since we've only changed
+ /* NOTE: Don't signal _NEW_TEXTURE_OBJECT since we've only changed
* the texel data, not the texture format, size, etc.
*/
}
}
_mesa_unlock_texture(ctx, texObj);
}
void GLAPIENTRY
_mesa_CompressedTexSubImage1D(GLenum target, GLint level, GLint xoffset,
diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c
index 25b959d..a5e64c3 100644
--- a/src/mesa/main/texobj.c
+++ b/src/mesa/main/texobj.c
@@ -925,21 +925,21 @@ _mesa_cube_complete(const struct gl_texture_object *texObj)
* and forces the context to re-validate its state.
*
* \param ctx GL context.
* \param texObj texture object.
*/
void
_mesa_dirty_texobj(struct gl_context *ctx, struct gl_texture_object *texObj)
{
texObj->_BaseComplete = GL_FALSE;
texObj->_MipmapComplete = GL_FALSE;
- ctx->NewState |= _NEW_TEXTURE;
+ ctx->NewState |= _NEW_TEXTURE_OBJECT;
}
/**
* Return pointer to a default/fallback texture of the given type/target.
* The texture is an RGBA texture with all texels = (0,0,0,1).
* That's the value a GLSL sampler should get when sampling from an
* incomplete texture.
*/
struct gl_texture_object *
@@ -1405,21 +1405,21 @@ unbind_textures_from_unit(struct gl_context *ctx, GLuint unit)
const GLuint index = ffs(texUnit->_BoundTextures) - 1;
struct gl_texture_object *texObj = ctx->Shared->DefaultTex[index];
_mesa_reference_texobj(&texUnit->CurrentTex[index], texObj);
/* Pass BindTexture call to device driver */
if (ctx->Driver.BindTexture)
ctx->Driver.BindTexture(ctx, unit, 0, texObj);
texUnit->_BoundTextures &= ~(1 << index);
- ctx->NewState |= _NEW_TEXTURE;
+ ctx->NewState |= _NEW_TEXTURE_OBJECT;
}
}
/**
* Delete named textures.
*
* \param n number of textures to be deleted.
* \param textures array of texture IDs to be deleted.
*
@@ -1475,21 +1475,21 @@ _mesa_DeleteTextures( GLsizei n, const GLuint *textures)
unbind_texobj_from_texunits(ctx, delObj);
/* Check if this texture is currently bound to any shader
* image unit. If so, unbind it.
* See section 3.9.X of GL_ARB_shader_image_load_store.
*/
unbind_texobj_from_image_units(ctx, delObj);
_mesa_unlock_texture(ctx, delObj);
- ctx->NewState |= _NEW_TEXTURE;
+ ctx->NewState |= _NEW_TEXTURE_OBJECT;
/* The texture _name_ is now free for re-use.
* Remove it from the hash table now.
*/
_mesa_HashRemove(ctx->Shared->TexObjects, delObj->Name);
/* Unreference the texobj. If refcount hits zero, the texture
* will be deleted.
*/
_mesa_reference_texobj(&delObj, NULL);
@@ -1524,21 +1524,21 @@ _mesa_delete_nameless_texture(struct gl_context *ctx,
unbind_texobj_from_texunits(ctx, texObj);
/* Check if this texture is currently bound to any shader
* image unit. If so, unbind it.
* See section 3.9.X of GL_ARB_shader_image_load_store.
*/
unbind_texobj_from_image_units(ctx, texObj);
}
_mesa_unlock_texture(ctx, texObj);
- ctx->NewState |= _NEW_TEXTURE;
+ ctx->NewState |= _NEW_TEXTURE_OBJECT;
/* Unreference the texobj. If refcount hits zero, the texture
* will be deleted.
*/
_mesa_reference_texobj(&texObj, NULL);
}
/**
* Convert a GL texture target enum such as GL_TEXTURE_2D or GL_TEXTURE_3D
@@ -1627,21 +1627,21 @@ bind_texture(struct gl_context *ctx,
mtx_lock(&ctx->Shared->Mutex);
early_out = ((ctx->Shared->RefCount == 1)
&& (texObj == texUnit->CurrentTex[targetIndex]));
mtx_unlock(&ctx->Shared->Mutex);
if (early_out) {
return;
}
}
/* flush before changing binding */
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE_OBJECT);
/* If the refcount on the previously bound texture is decremented to
* zero, it'll be deleted here.
*/
_mesa_reference_texobj(&texUnit->CurrentTex[targetIndex], texObj);
ctx->Texture.NumCurrentTexUsed = MAX2(ctx->Texture.NumCurrentTexUsed,
unit + 1);
if (texObj->Name != 0)
@@ -1908,21 +1908,21 @@ _mesa_PrioritizeTextures( GLsizei n, const GLuint *texName,
for (i = 0; i < n; i++) {
if (texName[i] > 0) {
struct gl_texture_object *t = _mesa_lookup_texture(ctx, texName[i]);
if (t) {
t->Priority = CLAMP( priorities[i], 0.0F, 1.0F );
}
}
}
- ctx->NewState |= _NEW_TEXTURE;
+ ctx->NewState |= _NEW_TEXTURE_OBJECT;
}
/**
* See if textures are loaded in texture memory.
*
* \param n number of textures to query.
* \param texName array with the texture names.
* \param residences array which will hold the residence status.
@@ -2012,21 +2012,21 @@ _mesa_IsTexture( GLuint texture )
* the texture.
*
* See also _mesa_lock/unlock_texture() in teximage.h
*/
void
_mesa_lock_context_textures( struct gl_context *ctx )
{
mtx_lock(&ctx->Shared->TexMutex);
if (ctx->Shared->TextureStateStamp != ctx->TextureStateTimestamp) {
- ctx->NewState |= _NEW_TEXTURE;
+ ctx->NewState |= _NEW_TEXTURE_OBJECT;
ctx->TextureStateTimestamp = ctx->Shared->TextureStateStamp;
}
}
void
_mesa_unlock_context_textures( struct gl_context *ctx )
{
assert(ctx->Shared->TextureStateStamp == ctx->TextureStateTimestamp);
mtx_unlock(&ctx->Shared->TexMutex);
diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c
index 4db406f..25165e4 100644
--- a/src/mesa/main/texparam.c
+++ b/src/mesa/main/texparam.c
@@ -226,35 +226,35 @@ set_swizzle_component(GLuint *swizzle, GLuint comp, GLuint swz)
}
/**
* This is called just prior to changing any texture object state which
* will not affect texture completeness.
*/
static inline void
flush(struct gl_context *ctx)
{
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE_OBJECT);
}
/**
* This is called just prior to changing any texture object state which
* could affect texture completeness (texture base level, max level).
- * Any pending rendering will be flushed out, we'll set the _NEW_TEXTURE
+ * Any pending rendering will be flushed out, we'll set the _NEW_TEXTURE_OBJECT
* state flag and then mark the texture object as 'incomplete' so that any
* per-texture derived state gets recomputed.
*/
static inline void
incomplete(struct gl_context *ctx, struct gl_texture_object *texObj)
{
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE_OBJECT);
_mesa_dirty_texobj(ctx, texObj);
}
GLboolean
_mesa_target_allows_setting_sampler_parameters(GLenum target)
{
switch (target) {
case GL_TEXTURE_2D_MULTISAMPLE:
case GL_TEXTURE_2D_MULTISAMPLE_ARRAY:
@@ -975,21 +975,21 @@ void
_mesa_texture_parameterIiv(struct gl_context *ctx,
struct gl_texture_object *texObj,
GLenum pname, const GLint *params, bool dsa)
{
switch (pname) {
case GL_TEXTURE_BORDER_COLOR:
if (!_mesa_target_allows_setting_sampler_parameters(texObj->Target)) {
_mesa_error(ctx, GL_INVALID_ENUM, "glTextureParameterIiv(texture)");
return;
}
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE_OBJECT);
/* set the integer-valued border color */
COPY_4V(texObj->Sampler.BorderColor.i, params);
break;
default:
_mesa_texture_parameteriv(ctx, texObj, pname, params, dsa);
break;
}
/* XXX no driver hook for TexParameterIiv() yet */
}
@@ -997,21 +997,21 @@ void
_mesa_texture_parameterIuiv(struct gl_context *ctx,
struct gl_texture_object *texObj,
GLenum pname, const GLuint *params, bool dsa)
{
switch (pname) {
case GL_TEXTURE_BORDER_COLOR:
if (!_mesa_target_allows_setting_sampler_parameters(texObj->Target)) {
_mesa_error(ctx, GL_INVALID_ENUM, "glTextureParameterIuiv(texture)");
return;
}
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE_OBJECT);
/* set the unsigned integer-valued border color */
COPY_4V(texObj->Sampler.BorderColor.ui, params);
break;
default:
_mesa_texture_parameteriv(ctx, texObj, pname, (const GLint *) params,
dsa);
break;
}
/* XXX no driver hook for TexParameterIuiv() yet */
}
diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c
index 70e014c..87c4d4a 100644
--- a/src/mesa/main/texstate.c
+++ b/src/mesa/main/texstate.c
@@ -299,21 +299,21 @@ _mesa_ActiveTexture(GLenum texture)
k = _mesa_max_tex_unit(ctx);
assert(k <= ARRAY_SIZE(ctx->Texture.Unit));
if (texUnit >= k) {
_mesa_error(ctx, GL_INVALID_ENUM, "glActiveTexture(texture=%s)",
_mesa_enum_to_string(texture));
return;
}
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE_STATE);
ctx->Texture.CurrentUnit = texUnit;
if (ctx->Transform.MatrixMode == GL_TEXTURE) {
/* update current stack pointer */
ctx->CurrentStack = &ctx->TextureMatrixStack[texUnit];
}
}
/* GL_ARB_multitexture */
diff --git a/src/mesa/main/uniform_query.cpp b/src/mesa/main/uniform_query.cpp
index 4d06313..e613898 100644
--- a/src/mesa/main/uniform_query.cpp
+++ b/src/mesa/main/uniform_query.cpp
@@ -956,21 +956,21 @@ _mesa_uniform(GLint location, GLsizei count, const GLvoid *values,
for (int j = 0; j < count; j++) {
unsigned unit = uni->opaque[i].index + offset + j;
if (sh->Program->SamplerUnits[unit] != ((unsigned *) values)[j]) {
sh->Program->SamplerUnits[unit] = ((unsigned *) values)[j];
changed = true;
}
}
if (changed) {
if (!flushed) {
- FLUSH_VERTICES(ctx, _NEW_TEXTURE | _NEW_PROGRAM);
+ FLUSH_VERTICES(ctx, _NEW_TEXTURE_OBJECT | _NEW_PROGRAM);
flushed = true;
}
struct gl_program *const prog = sh->Program;
_mesa_update_shader_textures_used(shProg, prog);
if (ctx->Driver.SamplerUniformChange)
ctx->Driver.SamplerUniformChange(ctx, prog->Target, prog);
}
}
}
diff --git a/src/mesa/program/prog_statevars.c b/src/mesa/program/prog_statevars.c
index 803d0af..91178e3 100644
--- a/src/mesa/program/prog_statevars.c
+++ b/src/mesa/program/prog_statevars.c
@@ -634,23 +634,23 @@ _mesa_program_state_flags(const gl_state_index state[STATE_LENGTH])
case STATE_LIGHTPROD:
case STATE_LIGHTMODEL_SCENECOLOR:
/* these can be effected by glColor when colormaterial mode is used */
return _NEW_LIGHT | _NEW_CURRENT_ATTRIB;
case STATE_LIGHT:
case STATE_LIGHTMODEL_AMBIENT:
return _NEW_LIGHT;
case STATE_TEXGEN:
- return _NEW_TEXTURE;
+ return _NEW_TEXTURE_STATE;
case STATE_TEXENV_COLOR:
- return _NEW_TEXTURE | _NEW_BUFFERS | _NEW_FRAG_CLAMP;
+ return _NEW_TEXTURE_STATE | _NEW_BUFFERS | _NEW_FRAG_CLAMP;
case STATE_FOG_COLOR:
return _NEW_FOG | _NEW_BUFFERS | _NEW_FRAG_CLAMP;
case STATE_FOG_PARAMS:
return _NEW_FOG;
case STATE_CLIPPLANE:
return _NEW_TRANSFORM;
case STATE_POINT_SIZE:
diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c
index c7d25ec..fb98a34 100644
--- a/src/mesa/state_tracker/st_context.c
+++ b/src/mesa/state_tracker/st_context.c
@@ -251,21 +251,21 @@ void st_invalidate_state(struct gl_context * ctx, GLbitfield new_state)
st->dirty |= ST_NEW_VS_STATE;
/* Which shaders are dirty will be determined manually. */
if (new_state & _NEW_PROGRAM) {
st->gfx_shaders_may_be_dirty = true;
st->compute_shader_may_be_dirty = true;
/* This will mask out unused shader resources. */
st->active_states = st_get_active_states(ctx);
}
- if (new_state & _NEW_TEXTURE) {
+ if (new_state & _NEW_TEXTURE_OBJECT) {
st->dirty |= st->active_states &
(ST_NEW_SAMPLER_VIEWS |
ST_NEW_SAMPLERS |
ST_NEW_IMAGE_UNITS);
if (ctx->FragmentProgram._Current &&
ctx->FragmentProgram._Current->ExternalSamplersUsed) {
st->dirty |= ST_NEW_FS_STATE;
}
}
--
2.7.4
More information about the mesa-dev
mailing list