diff options
Diffstat (limited to 'src/mesa/state_tracker')
-rw-r--r-- | src/mesa/state_tracker/st_atom_texture.c | 2 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_cb_drawpixels.c | 2 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_cb_fbo.c | 2 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_cb_readpixels.c | 2 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_cb_texture.c | 19 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_format.c | 22 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_format.h | 4 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_texture.c | 5 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_texture.h | 3 |
9 files changed, 32 insertions, 29 deletions
diff --git a/src/mesa/state_tracker/st_atom_texture.c b/src/mesa/state_tracker/st_atom_texture.c index 2e10bc3e241..03d05932a24 100644 --- a/src/mesa/state_tracker/st_atom_texture.c +++ b/src/mesa/state_tracker/st_atom_texture.c @@ -338,7 +338,7 @@ update_single_texture(struct st_context *st, /* Determine the format of the texture sampler view */ if (texObj->Target == GL_TEXTURE_BUFFER) { view_format = - st_mesa_format_to_pipe_format(stObj->base._BufferObjectFormat); + st_mesa_format_to_pipe_format(st, stObj->base._BufferObjectFormat); } else { view_format = diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c index d13a17f5002..5ae092b94fb 100644 --- a/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/src/mesa/state_tracker/st_cb_drawpixels.c @@ -491,7 +491,7 @@ make_texture(struct st_context *st, /* Choose a pixel format for the temp texture which will hold the * image to draw. */ - pipeFormat = st_choose_matching_format(pipe->screen, PIPE_BIND_SAMPLER_VIEW, + pipeFormat = st_choose_matching_format(st, PIPE_BIND_SAMPLER_VIEW, format, type, unpack->SwapBytes); if (pipeFormat == PIPE_FORMAT_NONE) { diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c index ce8d91514d8..7cfd3dadefa 100644 --- a/src/mesa/state_tracker/st_cb_fbo.c +++ b/src/mesa/state_tracker/st_cb_fbo.c @@ -588,7 +588,7 @@ st_validate_attachment(struct gl_context *ctx, if (!ctx->Extensions.EXT_framebuffer_sRGB && _mesa_get_format_color_encoding(texFormat) == GL_SRGB) { const mesa_format linearFormat = _mesa_get_srgb_format_linear(texFormat); - format = st_mesa_format_to_pipe_format(linearFormat); + format = st_mesa_format_to_pipe_format(st_context(ctx), linearFormat); } valid = screen->is_format_supported(screen, format, diff --git a/src/mesa/state_tracker/st_cb_readpixels.c b/src/mesa/state_tracker/st_cb_readpixels.c index 3f7bbd9738c..d95a608d32e 100644 --- a/src/mesa/state_tracker/st_cb_readpixels.c +++ b/src/mesa/state_tracker/st_cb_readpixels.c @@ -143,7 +143,7 @@ st_readpixels(struct gl_context *ctx, GLint x, GLint y, /* Choose the destination format by finding the best match * for the format+type combo. */ - dst_format = st_choose_matching_format(screen, bind, format, type, + dst_format = st_choose_matching_format(st, bind, format, type, pack->SwapBytes); if (dst_format == PIPE_FORMAT_NONE) { goto fallback; diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index 62075c67463..1b065e4f04b 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -442,7 +442,7 @@ guess_and_alloc_texture(struct st_context *st, stObj->height0 = height; stObj->depth0 = depth; - fmt = st_mesa_format_to_pipe_format(stImage->base.TexFormat); + fmt = st_mesa_format_to_pipe_format(st, stImage->base.TexFormat); bindings = default_bindings(st, fmt); @@ -493,7 +493,7 @@ st_AllocTextureImageBuffer(struct gl_context *ctx, /* Look if the parent texture object has space for this image */ if (stObj->pt && level <= stObj->pt->last_level && - st_texture_match_image(stObj->pt, texImage)) { + st_texture_match_image(st, stObj->pt, texImage)) { /* this image will fit in the existing texture object's memory */ pipe_resource_reference(&stImage->pt, stObj->pt); return GL_TRUE; @@ -516,7 +516,7 @@ st_AllocTextureImageBuffer(struct gl_context *ctx, } if (stObj->pt && - st_texture_match_image(stObj->pt, texImage)) { + st_texture_match_image(st, stObj->pt, texImage)) { /* The image will live in the object's mipmap memory */ pipe_resource_reference(&stImage->pt, stObj->pt); assert(stImage->pt); @@ -530,7 +530,7 @@ st_AllocTextureImageBuffer(struct gl_context *ctx, * level. */ enum pipe_format format = - st_mesa_format_to_pipe_format(texImage->TexFormat); + st_mesa_format_to_pipe_format(st, texImage->TexFormat); GLuint bindings = default_bindings(st, format); GLuint ptWidth, ptHeight, ptDepth, ptLayers; @@ -706,7 +706,7 @@ st_TexSubImage(struct gl_context *ctx, GLuint dims, } /* Choose the source format. */ - src_format = st_choose_matching_format(screen, PIPE_BIND_SAMPLER_VIEW, + src_format = st_choose_matching_format(st, PIPE_BIND_SAMPLER_VIEW, format, type, unpack->SwapBytes); if (!src_format) { goto fallback; @@ -982,7 +982,7 @@ st_GetTexImage(struct gl_context * ctx, /* Choose the destination format by finding the best match * for the format+type combo. */ - dst_format = st_choose_matching_format(screen, bind, format, type, + dst_format = st_choose_matching_format(st, bind, format, type, ctx->Pack.SwapBytes); if (dst_format == PIPE_FORMAT_NONE) { @@ -1581,7 +1581,8 @@ st_finalize_texture(struct gl_context *ctx, } /* Find gallium format for the Mesa texture */ - firstImageFormat = st_mesa_format_to_pipe_format(firstImage->base.TexFormat); + firstImageFormat = + st_mesa_format_to_pipe_format(st, firstImage->base.TexFormat); /* Find size of level=0 Gallium mipmap image, plus number of texture layers */ { @@ -1699,7 +1700,7 @@ st_AllocTextureStorage(struct gl_context *ctx, stObj->depth0 = depth; stObj->lastLevel = levels - 1; - fmt = st_mesa_format_to_pipe_format(texImage->TexFormat); + fmt = st_mesa_format_to_pipe_format(st, texImage->TexFormat); bindings = default_bindings(st, fmt); @@ -1778,7 +1779,7 @@ st_TestProxyTexImage(struct gl_context *ctx, GLenum target, memset(&pt, 0, sizeof(pt)); pt.target = gl_target_to_pipe(target); - pt.format = st_mesa_format_to_pipe_format(format); + pt.format = st_mesa_format_to_pipe_format(st, format); st_gl_texture_dims_to_pipe_dims(target, width, height, depth, diff --git a/src/mesa/state_tracker/st_format.c b/src/mesa/state_tracker/st_format.c index ff3f494f39f..3d822a5a4e4 100644 --- a/src/mesa/state_tracker/st_format.c +++ b/src/mesa/state_tracker/st_format.c @@ -54,7 +54,7 @@ * Translate Mesa format to Gallium format. */ enum pipe_format -st_mesa_format_to_pipe_format(mesa_format mesaFormat) +st_mesa_format_to_pipe_format(struct st_context *st, mesa_format mesaFormat) { switch (mesaFormat) { case MESA_FORMAT_A8B8G8R8_UNORM: @@ -795,7 +795,7 @@ st_pipe_format_to_mesa_format(enum pipe_format format) * Mesa formats to Gallium formats and back again. */ static void -test_format_conversion(void) +test_format_conversion(struct st_context *st) { GLuint i; @@ -805,7 +805,7 @@ test_format_conversion(void) if (_mesa_is_format_etc2(i)) continue; - enum pipe_format pf = st_mesa_format_to_pipe_format(i); + enum pipe_format pf = st_mesa_format_to_pipe_format(st, i); if (pf != PIPE_FORMAT_NONE) { mesa_format mf = st_pipe_format_to_mesa_format(pf); assert(mf == i); @@ -816,7 +816,7 @@ test_format_conversion(void) for (i = 1; i < PIPE_FORMAT_COUNT; i++) { mesa_format mf = st_pipe_format_to_mesa_format(i); if (mf != MESA_FORMAT_NONE) { - enum pipe_format pf = st_mesa_format_to_pipe_format(mf); + enum pipe_format pf = st_mesa_format_to_pipe_format(st, mf); assert(pf == i); } } @@ -1704,7 +1704,7 @@ st_choose_format(struct st_context *st, GLenum internalFormat, { static boolean firstCall = TRUE; if (firstCall) { - test_format_conversion(); + test_format_conversion(st); firstCall = FALSE; } } @@ -1770,9 +1770,10 @@ st_choose_renderbuffer_format(struct st_context *st, * If no format is supported, return PIPE_FORMAT_NONE. */ enum pipe_format -st_choose_matching_format(struct pipe_screen *screen, unsigned bind, +st_choose_matching_format(struct st_context *st, unsigned bind, GLenum format, GLenum type, GLboolean swapBytes) { + struct pipe_screen *screen = st->pipe->screen; mesa_format mesa_format; for (mesa_format = 1; mesa_format < MESA_FORMAT_COUNT; mesa_format++) { @@ -1788,7 +1789,8 @@ st_choose_matching_format(struct pipe_screen *screen, unsigned bind, if (_mesa_format_matches_format_and_type(mesa_format, format, type, swapBytes)) { - enum pipe_format format = st_mesa_format_to_pipe_format(mesa_format); + enum pipe_format format = + st_mesa_format_to_pipe_format(st, mesa_format); if (format && screen->is_format_supported(screen, format, PIPE_TEXTURE_2D, 0, @@ -1858,16 +1860,14 @@ st_ChooseTextureFormat(struct gl_context *ctx, GLenum target, * with the "format". */ if (iformat == baseFormat && iformat == basePackFormat) { - pFormat = st_choose_matching_format(st->pipe->screen, bindings, - format, type, + pFormat = st_choose_matching_format(st, bindings, format, type, ctx->Unpack.SwapBytes); if (pFormat != PIPE_FORMAT_NONE) return st_pipe_format_to_mesa_format(pFormat); /* try choosing format again, this time without render target bindings */ - pFormat = st_choose_matching_format(st->pipe->screen, - PIPE_BIND_SAMPLER_VIEW, + pFormat = st_choose_matching_format(st, PIPE_BIND_SAMPLER_VIEW, format, type, ctx->Unpack.SwapBytes); if (pFormat != PIPE_FORMAT_NONE) diff --git a/src/mesa/state_tracker/st_format.h b/src/mesa/state_tracker/st_format.h index ce1e2306dd2..90e00e8ebf6 100644 --- a/src/mesa/state_tracker/st_format.h +++ b/src/mesa/state_tracker/st_format.h @@ -41,7 +41,7 @@ struct pipe_screen; extern enum pipe_format -st_mesa_format_to_pipe_format(mesa_format mesaFormat); +st_mesa_format_to_pipe_format(struct st_context *st, mesa_format mesaFormat); extern mesa_format st_pipe_format_to_mesa_format(enum pipe_format pipeFormat); @@ -58,7 +58,7 @@ st_choose_renderbuffer_format(struct st_context *st, GLenum internalFormat, unsigned sample_count); extern enum pipe_format -st_choose_matching_format(struct pipe_screen *screen, unsigned bind, +st_choose_matching_format(struct st_context *st, unsigned bind, GLenum format, GLenum type, GLboolean swapBytes); extern mesa_format diff --git a/src/mesa/state_tracker/st_texture.c b/src/mesa/state_tracker/st_texture.c index 9f57cfb3d96..af9b7675f10 100644 --- a/src/mesa/state_tracker/st_texture.c +++ b/src/mesa/state_tracker/st_texture.c @@ -197,7 +197,8 @@ st_gl_texture_dims_to_pipe_dims(GLenum texture, * Check if a texture image can be pulled into a unified mipmap texture. */ GLboolean -st_texture_match_image(const struct pipe_resource *pt, +st_texture_match_image(struct st_context *st, + const struct pipe_resource *pt, const struct gl_texture_image *image) { GLuint ptWidth, ptHeight, ptDepth, ptLayers; @@ -209,7 +210,7 @@ st_texture_match_image(const struct pipe_resource *pt, /* Check if this image's format matches the established texture's format. */ - if (st_mesa_format_to_pipe_format(image->TexFormat) != pt->format) + if (st_mesa_format_to_pipe_format(st, image->TexFormat) != pt->format) return GL_FALSE; st_gl_texture_dims_to_pipe_dims(image->TexObject->Target, diff --git a/src/mesa/state_tracker/st_texture.h b/src/mesa/state_tracker/st_texture.h index 04b886ee39f..ce1cf8b0a94 100644 --- a/src/mesa/state_tracker/st_texture.h +++ b/src/mesa/state_tracker/st_texture.h @@ -199,7 +199,8 @@ st_gl_texture_dims_to_pipe_dims(GLenum texture, /* Check if an image fits into an existing texture object. */ extern GLboolean -st_texture_match_image(const struct pipe_resource *pt, +st_texture_match_image(struct st_context *st, + const struct pipe_resource *pt, const struct gl_texture_image *image); /* Return a pointer to an image within a texture. Return image stride as |