[Mesa-dev] [PATCH 24/24] st/mesa: unify fail paths for update_single_texture
Marek Olšák
maraeo at gmail.com
Mon Jun 12 18:18:55 UTC 2017
From: Marek Olšák <marek.olsak at amd.com>
---
src/mesa/state_tracker/st_atom_texture.c | 5 ++---
src/mesa/state_tracker/st_sampler_view.c | 4 ----
2 files changed, 2 insertions(+), 7 deletions(-)
diff --git a/src/mesa/state_tracker/st_atom_texture.c b/src/mesa/state_tracker/st_atom_texture.c
index 9d2564f..e38bd51 100644
--- a/src/mesa/state_tracker/st_atom_texture.c
+++ b/src/mesa/state_tracker/st_atom_texture.c
@@ -54,36 +54,35 @@
static void
update_single_texture(struct st_context *st,
struct pipe_sampler_view **sampler_view,
GLuint texUnit, bool glsl130_or_later)
{
struct gl_context *ctx = st->ctx;
const struct gl_sampler_object *samp;
struct gl_texture_object *texObj;
struct st_texture_object *stObj;
- GLboolean retval;
samp = _mesa_get_samplerobj(ctx, texUnit);
texObj = ctx->Texture.Unit[texUnit]._Current;
assert(texObj);
stObj = st_texture_object(texObj);
if (unlikely(texObj->Target == GL_TEXTURE_BUFFER)) {
*sampler_view = st_get_buffer_sampler_view_from_stobj(st, stObj);
return;
}
- retval = st_finalize_texture(ctx, st->pipe, texObj, 0);
- if (!retval) {
+ if (!st_finalize_texture(ctx, st->pipe, texObj, 0) ||
+ !stObj->pt) {
/* out of mem */
*sampler_view = NULL;
return;
}
/* Check a few pieces of state outside the texture object to see if we
* need to force revalidation.
*/
if (stObj->prev_glsl130_or_later != glsl130_or_later ||
stObj->prev_sRGBDecode != samp->sRGBDecode) {
diff --git a/src/mesa/state_tracker/st_sampler_view.c b/src/mesa/state_tracker/st_sampler_view.c
index 7a8d05d..fbf0aae 100644
--- a/src/mesa/state_tracker/st_sampler_view.c
+++ b/src/mesa/state_tracker/st_sampler_view.c
@@ -401,24 +401,20 @@ st_create_texture_sampler_view_from_stobj(struct st_context *st,
struct pipe_sampler_view *
st_get_texture_sampler_view_from_stobj(struct st_context *st,
struct st_texture_object *stObj,
const struct gl_sampler_object *samp,
bool glsl130_or_later)
{
struct pipe_sampler_view **sv;
- if (!stObj || !stObj->pt) {
- return NULL;
- }
-
sv = st_texture_get_sampler_view(st, stObj);
if (*sv) {
/* Debug check: make sure that the sampler view's parameters are
* what they're supposed to be.
*/
MAYBE_UNUSED struct pipe_sampler_view *view = *sv;
assert(stObj->pt == view->texture);
assert(!check_sampler_swizzle(st, stObj, view, glsl130_or_later));
assert(get_sampler_view_format(st, stObj, samp) == view->format);
--
2.7.4
More information about the mesa-dev
mailing list