mesa/st: move st_TexParameter into mesa
Some places this just passes an always true pname, so just call sampler view invalidate directly Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14632>
This commit is contained in:
parent
96b57faf35
commit
31d3e3ebeb
|
@ -63,6 +63,7 @@
|
|||
#include "state_tracker/st_cb_texture.h"
|
||||
#include "state_tracker/st_cb_viewport.h"
|
||||
#include "state_tracker/st_context.h"
|
||||
#include "state_tracker/st_sampler_view.h"
|
||||
|
||||
static inline bool
|
||||
copy_texture_attribs(struct gl_texture_object *dst,
|
||||
|
@ -595,8 +596,7 @@ pop_texture_group(struct gl_context *ctx, struct gl_texture_attrib_node *texstat
|
|||
if (!copy_texture_attribs(texObj, savedObj, tgt))
|
||||
continue;
|
||||
|
||||
/* GL_ALL_ATTRIB_BITS means all pnames. (internal) */
|
||||
st_TexParameter(ctx, texObj, GL_ALL_ATTRIB_BITS);
|
||||
st_texture_release_all_sampler_views(st_context(ctx), texObj);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -65,6 +65,7 @@
|
|||
#include "state_tracker/st_format.h"
|
||||
#include "state_tracker/st_gen_mipmap.h"
|
||||
#include "state_tracker/st_cb_eglimage.h"
|
||||
#include "state_tracker/st_sampler_view.h"
|
||||
|
||||
/**
|
||||
* Returns a corresponding internal floating point format for a given base
|
||||
|
@ -6353,13 +6354,13 @@ texture_buffer_range(struct gl_context *ctx,
|
|||
_mesa_unlock_texture(ctx, texObj);
|
||||
|
||||
if (old_format != format) {
|
||||
st_TexParameter(ctx, texObj, GL_ALL_ATTRIB_BITS);
|
||||
st_texture_release_all_sampler_views(st_context(ctx), texObj);
|
||||
} else {
|
||||
if (offset != oldOffset) {
|
||||
st_TexParameter(ctx, texObj, GL_TEXTURE_BUFFER_OFFSET);
|
||||
st_texture_release_all_sampler_views(st_context(ctx), texObj);
|
||||
}
|
||||
if (size != oldSize) {
|
||||
st_TexParameter(ctx, texObj, GL_TEXTURE_BUFFER_SIZE);
|
||||
st_texture_release_all_sampler_views(st_context(ctx), texObj);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -49,6 +49,7 @@
|
|||
#include "api_exec_decl.h"
|
||||
|
||||
#include "state_tracker/st_cb_texture.h"
|
||||
#include "state_tracker/st_sampler_view.h"
|
||||
|
||||
/**
|
||||
* Use macro to resolve undefined clamping behaviour when using lroundf
|
||||
|
@ -894,6 +895,41 @@ invalid_enum:
|
|||
return GL_FALSE;
|
||||
}
|
||||
|
||||
static bool
|
||||
texparam_invalidates_sampler_views(GLenum pname)
|
||||
{
|
||||
switch (pname) {
|
||||
/*
|
||||
* Changing any of these texture parameters means we must create
|
||||
* new sampler views.
|
||||
*/
|
||||
case GL_ALL_ATTRIB_BITS: /* meaning is all pnames, internal */
|
||||
case GL_TEXTURE_BASE_LEVEL:
|
||||
case GL_TEXTURE_MAX_LEVEL:
|
||||
case GL_DEPTH_TEXTURE_MODE:
|
||||
case GL_DEPTH_STENCIL_TEXTURE_MODE:
|
||||
case GL_TEXTURE_SRGB_DECODE_EXT:
|
||||
case GL_TEXTURE_SWIZZLE_R:
|
||||
case GL_TEXTURE_SWIZZLE_G:
|
||||
case GL_TEXTURE_SWIZZLE_B:
|
||||
case GL_TEXTURE_SWIZZLE_A:
|
||||
case GL_TEXTURE_SWIZZLE_RGBA:
|
||||
case GL_TEXTURE_BUFFER_SIZE:
|
||||
case GL_TEXTURE_BUFFER_OFFSET:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_mesa_texture_parameter_invalidate(struct gl_context *ctx,
|
||||
struct gl_texture_object *texObj,
|
||||
GLenum pname)
|
||||
{
|
||||
if (texparam_invalidates_sampler_views(pname))
|
||||
st_texture_release_all_sampler_views(st_context(ctx), texObj);
|
||||
}
|
||||
|
||||
void
|
||||
_mesa_texture_parameterf(struct gl_context *ctx,
|
||||
|
@ -950,7 +986,7 @@ _mesa_texture_parameterf(struct gl_context *ctx,
|
|||
}
|
||||
|
||||
if (need_update) {
|
||||
st_TexParameter(ctx, texObj, pname);
|
||||
_mesa_texture_parameter_invalidate(ctx, texObj, pname);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1020,7 +1056,7 @@ _mesa_texture_parameterfv(struct gl_context *ctx,
|
|||
}
|
||||
|
||||
if (need_update) {
|
||||
st_TexParameter(ctx, texObj, pname);
|
||||
_mesa_texture_parameter_invalidate(ctx, texObj, pname);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1064,7 +1100,7 @@ _mesa_texture_parameteri(struct gl_context *ctx,
|
|||
}
|
||||
|
||||
if (need_update) {
|
||||
st_TexParameter(ctx, texObj, pname);
|
||||
_mesa_texture_parameter_invalidate(ctx, texObj, pname);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1107,7 +1143,7 @@ _mesa_texture_parameteriv(struct gl_context *ctx,
|
|||
}
|
||||
|
||||
if (need_update) {
|
||||
st_TexParameter(ctx, texObj, pname);
|
||||
_mesa_texture_parameter_invalidate(ctx, texObj, pname);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3516,40 +3516,6 @@ st_ClearTexSubImage(struct gl_context *ctx,
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Called via the glTexParam*() function, but only when some texture object
|
||||
* state has actually changed.
|
||||
*/
|
||||
void
|
||||
st_TexParameter(struct gl_context *ctx,
|
||||
struct gl_texture_object *texObj, GLenum pname)
|
||||
{
|
||||
struct st_context *st = st_context(ctx);
|
||||
|
||||
switch (pname) {
|
||||
case GL_ALL_ATTRIB_BITS: /* meaning is all pnames, internal */
|
||||
case GL_TEXTURE_BASE_LEVEL:
|
||||
case GL_TEXTURE_MAX_LEVEL:
|
||||
case GL_DEPTH_TEXTURE_MODE:
|
||||
case GL_DEPTH_STENCIL_TEXTURE_MODE:
|
||||
case GL_TEXTURE_SRGB_DECODE_EXT:
|
||||
case GL_TEXTURE_SWIZZLE_R:
|
||||
case GL_TEXTURE_SWIZZLE_G:
|
||||
case GL_TEXTURE_SWIZZLE_B:
|
||||
case GL_TEXTURE_SWIZZLE_A:
|
||||
case GL_TEXTURE_SWIZZLE_RGBA:
|
||||
case GL_TEXTURE_BUFFER_SIZE:
|
||||
case GL_TEXTURE_BUFFER_OFFSET:
|
||||
/* changing any of these texture parameters means we must create
|
||||
* new sampler views.
|
||||
*/
|
||||
st_texture_release_all_sampler_views(st, texObj);
|
||||
break;
|
||||
default:
|
||||
; /* nothing */
|
||||
}
|
||||
}
|
||||
|
||||
GLboolean
|
||||
st_SetTextureStorageForMemoryObject(struct gl_context *ctx,
|
||||
struct gl_texture_object *texObj,
|
||||
|
|
|
@ -113,8 +113,6 @@ void st_ClearTexSubImage(struct gl_context *ctx,
|
|||
GLint xoffset, GLint yoffset, GLint zoffset,
|
||||
GLsizei width, GLsizei height, GLsizei depth,
|
||||
const void *clearValue);
|
||||
void st_TexParameter(struct gl_context *ctx,
|
||||
struct gl_texture_object *texObj, GLenum pname);
|
||||
GLboolean st_SetTextureStorageForMemoryObject(struct gl_context *ctx,
|
||||
struct gl_texture_object *texObj,
|
||||
struct gl_memory_object *memObj,
|
||||
|
|
Loading…
Reference in New Issue