diff --git a/.pick_status.json b/.pick_status.json index f2e64559918..0527cecec23 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -1254,7 +1254,7 @@ "description": "mesa: force rendertarget usage on required-renderable formats", "nominated": true, "nomination_type": 0, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null, "notes": null diff --git a/src/mesa/state_tracker/st_format.c b/src/mesa/state_tracker/st_format.c index e2af7724608..4a92723d303 100644 --- a/src/mesa/state_tracker/st_format.c +++ b/src/mesa/state_tracker/st_format.c @@ -1333,6 +1333,21 @@ st_ChooseTextureFormat(struct gl_context *ctx, GLenum target, is_renderbuffer = true; } else { pTarget = gl_target_to_pipe(target); + if (internalFormat == format) { + if (internalFormat == GL_RGBA) { + /* with GL_RGBA, these are effectively aliases to required formats */ + switch (type) { + case GL_UNSIGNED_SHORT_5_5_5_1: + case GL_UNSIGNED_SHORT_4_4_4_4: + case GL_UNSIGNED_INT_8_8_8_8: + is_renderbuffer = true; + break; + default: break; + } + } else if (internalFormat == GL_RGB && type == GL_UNSIGNED_SHORT_5_6_5) { + is_renderbuffer = true; + } + } } if (target == GL_TEXTURE_1D || target == GL_TEXTURE_1D_ARRAY) { @@ -1351,7 +1366,9 @@ st_ChooseTextureFormat(struct gl_context *ctx, GLenum target, bindings = PIPE_BIND_SAMPLER_VIEW; if (_mesa_is_depth_or_stencil_format(internalFormat)) bindings |= PIPE_BIND_DEPTH_STENCIL; - else if (is_renderbuffer || internalFormat == 3 || internalFormat == 4 || + else if (is_renderbuffer) + bindings |= PIPE_BIND_RENDER_TARGET; + else if (internalFormat == 3 || internalFormat == 4 || internalFormat == GL_RGB || internalFormat == GL_RGBA || internalFormat == GL_RGBA2 || internalFormat == GL_RGB4 || internalFormat == GL_RGBA4 ||