diff options
Diffstat (limited to 'src/mesa/state_tracker/st_texture.h')
-rw-r--r-- | src/mesa/state_tracker/st_texture.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/mesa/state_tracker/st_texture.h b/src/mesa/state_tracker/st_texture.h index b2ddc14ddfc..d2c4f3f880c 100644 --- a/src/mesa/state_tracker/st_texture.h +++ b/src/mesa/state_tracker/st_texture.h @@ -170,6 +170,27 @@ st_create_texture_sampler_view(struct pipe_context *pipe, texture->format); } +static inline struct st_texture_object * +st_get_texture_object(struct gl_context *ctx, + const struct gl_program *prog, + unsigned unit) +{ + const GLuint texUnit = prog->SamplerUnits[unit]; + struct gl_texture_object *texObj = ctx->Texture.Unit[texUnit]._Current; + + if (!texObj) + return NULL; + + return st_texture_object(texObj); +} + +static inline enum pipe_format +st_get_view_format(struct st_texture_object *stObj) +{ + if (!stObj) + return PIPE_FORMAT_NONE; + return stObj->surface_based ? stObj->surface_format : stObj->pt->format; +} extern struct pipe_resource * |