summaryrefslogtreecommitdiffstats
path: root/src/mesa/state_tracker/st_texture.h
diff options
context:
space:
mode:
authorRob Clark <[email protected]>2016-08-31 17:44:01 -0400
committerRob Clark <[email protected]>2016-09-26 15:29:17 -0400
commitecd6fce2611e88ff8468a354cff8eda39f260a31 (patch)
treef4c281475a9dfb836cf9c9ff1853de0edc850bc6 /src/mesa/state_tracker/st_texture.h
parente0ec1c31345aa8f47b5dea16d26be4420bd908ad (diff)
mesa/st: support lowering multi-planar YUV
Support multi-planar YUV for external EGLImage's (currently just in the dma-buf import path) by lowering to multiple texture fetch's for each plane and CSC in shader. There was some discussion of alternative approaches for tracking the additional UV or U/V planes: https://lists.freedesktop.org/archives/mesa-dev/2016-September/127832.html They all seemed worse than pipe_resource::next Signed-off-by: Rob Clark <[email protected]>
Diffstat (limited to 'src/mesa/state_tracker/st_texture.h')
-rw-r--r--src/mesa/state_tracker/st_texture.h21
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 *