From 56286834b88f0dbcc4f95dc0edfb7618d30365cc Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Thu, 7 Aug 2014 20:58:53 +0200 Subject: [PATCH] st/mesa: fix DrawPixels(GL_STENCIL_INDEX) MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This is a bug which was probably uncovered recently by Jason's commits and broke this. The problem is _mesa_base_tex_format(GL_STENCIL_INDEX) returns -1. Tested-by: Michel Dänzer --- src/mesa/state_tracker/st_cb_drawpixels.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c index 6119cc275f4..d13a17f5002 100644 --- a/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/src/mesa/state_tracker/st_cb_drawpixels.c @@ -494,22 +494,19 @@ make_texture(struct st_context *st, pipeFormat = st_choose_matching_format(pipe->screen, PIPE_BIND_SAMPLER_VIEW, format, type, unpack->SwapBytes); - if (pipeFormat != PIPE_FORMAT_NONE) { - mformat = st_pipe_format_to_mesa_format(pipeFormat); - baseInternalFormat = _mesa_get_format_base_format(mformat); - } - else { + if (pipeFormat == PIPE_FORMAT_NONE) { /* Use the generic approach. */ GLenum intFormat = internal_format(ctx, format, type); - baseInternalFormat = _mesa_base_tex_format(ctx, intFormat); pipeFormat = st_choose_format(st, intFormat, format, type, PIPE_TEXTURE_2D, 0, PIPE_BIND_SAMPLER_VIEW, FALSE); assert(pipeFormat != PIPE_FORMAT_NONE); - mformat = st_pipe_format_to_mesa_format(pipeFormat); } + mformat = st_pipe_format_to_mesa_format(pipeFormat); + baseInternalFormat = _mesa_get_format_base_format(mformat); + pixels = _mesa_map_pbo_source(ctx, unpack, pixels); if (!pixels) return NULL; -- 2.30.2