aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Blumenkrantz <[email protected]>2019-05-29 16:41:59 -0400
committerKenneth Graunke <[email protected]>2019-07-01 15:16:43 -0700
commit2cc85670a79194a4c89797f0942d9eef4455fb92 (patch)
treed8b72e5a42440d8b9dfdbbe378925dad93c8cee0
parent9b1b9714915c3e3d08582fd1d77f182cdf3e5090 (diff)
mesa/st: simplify format usage in st_bind_egl_image
the formats handled in the switch statement will always return an unknown mesa format, so process them directly and leave the default case for other/unknown formats no functional changes Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
-rw-r--r--src/mesa/state_tracker/st_cb_eglimage.c28
1 files changed, 13 insertions, 15 deletions
diff --git a/src/mesa/state_tracker/st_cb_eglimage.c b/src/mesa/state_tracker/st_cb_eglimage.c
index f79df5a38ca..08697c42dfa 100644
--- a/src/mesa/state_tracker/st_cb_eglimage.c
+++ b/src/mesa/state_tracker/st_cb_eglimage.c
@@ -196,25 +196,23 @@ st_bind_egl_image(struct gl_context *ctx,
stObj->surface_based = GL_TRUE;
}
- texFormat = st_pipe_format_to_mesa_format(stimg->format);
-
/* TODO RequiredTextureImageUnits should probably be reset back
* to 1 somewhere if different texture is bound??
*/
- if (texFormat == MESA_FORMAT_NONE) {
- switch (stimg->format) {
- case PIPE_FORMAT_NV12:
- texFormat = MESA_FORMAT_R_UNORM8;
- texObj->RequiredTextureImageUnits = 2;
- break;
- case PIPE_FORMAT_IYUV:
- texFormat = MESA_FORMAT_R_UNORM8;
- texObj->RequiredTextureImageUnits = 3;
- break;
- default:
- unreachable("bad YUV format!");
- }
+ switch (stimg->format) {
+ case PIPE_FORMAT_NV12:
+ texFormat = MESA_FORMAT_R_UNORM8;
+ texObj->RequiredTextureImageUnits = 2;
+ break;
+ case PIPE_FORMAT_IYUV:
+ texFormat = MESA_FORMAT_R_UNORM8;
+ texObj->RequiredTextureImageUnits = 3;
+ break;
+ default:
+ texFormat = st_pipe_format_to_mesa_format(stimg->format);
+ break;
}
+ assert(texFormat != MESA_FORMAT_NONE);
_mesa_init_teximage_fields(ctx, texImage,
stimg->texture->width0, stimg->texture->height0,