Module: Mesa Branch: nvfx-next-6 Commit: 8b0b77f73b7a4cca9731354df5ac58281e72d6eb URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=8b0b77f73b7a4cca9731354df5ac58281e72d6eb
Author: Luca Barbieri <[email protected]> Date: Thu Apr 15 09:04:20 2010 +0200 st/mesa: set PIPE_RESOURCE_FLAG_UNNORMALIZED_COORDS_HINT for GL_TEXTURE_RECTANGLE Allow to pass flags to st_texture_create and take advantage of that in the obvious way. --- src/mesa/state_tracker/st_atom_pixeltransfer.c | 2 +- src/mesa/state_tracker/st_cb_bitmap.c | 4 ++-- src/mesa/state_tracker/st_cb_drawpixels.c | 2 +- src/mesa/state_tracker/st_cb_texture.c | 16 ++++++++++++++-- src/mesa/state_tracker/st_gen_mipmap.c | 8 ++++++-- src/mesa/state_tracker/st_texture.c | 5 +++-- src/mesa/state_tracker/st_texture.h | 3 ++- 7 files changed, 29 insertions(+), 11 deletions(-) diff --git a/src/mesa/state_tracker/st_atom_pixeltransfer.c b/src/mesa/state_tracker/st_atom_pixeltransfer.c index 4aac5bd..62a1cef 100644 --- a/src/mesa/state_tracker/st_atom_pixeltransfer.c +++ b/src/mesa/state_tracker/st_atom_pixeltransfer.c @@ -126,7 +126,7 @@ create_color_map_texture(GLcontext *ctx) /* create texture for color map/table */ pt = st_texture_create(ctx->st, PIPE_TEXTURE_2D, format, 0, - texSize, texSize, 1, PIPE_BIND_SAMPLER_VIEW); + texSize, texSize, 1, PIPE_BIND_SAMPLER_VIEW, 0); return pt; } diff --git a/src/mesa/state_tracker/st_cb_bitmap.c b/src/mesa/state_tracker/st_cb_bitmap.c index 074fc27..4d5d58e 100644 --- a/src/mesa/state_tracker/st_cb_bitmap.c +++ b/src/mesa/state_tracker/st_cb_bitmap.c @@ -274,7 +274,7 @@ make_bitmap_texture(GLcontext *ctx, GLsizei width, GLsizei height, */ pt = st_texture_create(ctx->st, PIPE_TEXTURE_2D, ctx->st->bitmap.tex_format, 0, width, height, 1, - PIPE_BIND_SAMPLER_VIEW); + PIPE_BIND_SAMPLER_VIEW, 0); if (!pt) { _mesa_unmap_pbo_source(ctx, unpack); return NULL; @@ -541,7 +541,7 @@ reset_cache(struct st_context *st) st->bitmap.tex_format, 0, BITMAP_CACHE_WIDTH, BITMAP_CACHE_HEIGHT, 1, - PIPE_BIND_SAMPLER_VIEW); + PIPE_BIND_SAMPLER_VIEW, 0); } diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c index 955e371..c5267dc 100644 --- a/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/src/mesa/state_tracker/st_cb_drawpixels.c @@ -330,7 +330,7 @@ alloc_texture(struct st_context *st, GLsizei width, GLsizei height, } pt = st_texture_create(st, PIPE_TEXTURE_2D, texFormat, 0, - ptw, pth, 1, PIPE_BIND_SAMPLER_VIEW); + ptw, pth, 1, PIPE_BIND_SAMPLER_VIEW, 0); return pt; } diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index 9479819..91aae75 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -247,6 +247,7 @@ guess_and_alloc_texture(struct st_context *st, GLuint height = stImage->base.Height2; GLuint depth = stImage->base.Depth2; GLuint i, usage; + GLuint flags; enum pipe_format fmt; DBG("%s\n", __FUNCTION__); @@ -313,6 +314,11 @@ guess_and_alloc_texture(struct st_context *st, usage = default_usage(fmt); + flags = 0; + + if(stObj->base.Target == GL_TEXTURE_RECTANGLE) + flags |= PIPE_RESOURCE_FLAG_UNNORMALIZED_COORDS_HINT; + stObj->pt = st_texture_create(st, gl_target_to_pipe(stObj->base.Target), fmt, @@ -320,7 +326,8 @@ guess_and_alloc_texture(struct st_context *st, width, height, depth, - usage); + usage, + flags); stObj->pipe = st->pipe; @@ -1852,6 +1859,10 @@ st_finalize_texture(GLcontext *ctx, const enum pipe_format fmt = st_mesa_format_to_pipe_format(firstImage->base.TexFormat); GLuint usage = default_usage(fmt); + GLuint flags = 0; + + if(stObj->base.Target == GL_TEXTURE_RECTANGLE) + flags |= PIPE_RESOURCE_FLAG_UNNORMALIZED_COORDS_HINT; stObj->pt = st_texture_create(ctx->st, gl_target_to_pipe(stObj->base.Target), @@ -1860,7 +1871,8 @@ st_finalize_texture(GLcontext *ctx, firstImage->base.Width2, firstImage->base.Height2, firstImage->base.Depth2, - usage); + usage, + flags); if (!stObj->pt) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage"); diff --git a/src/mesa/state_tracker/st_gen_mipmap.c b/src/mesa/state_tracker/st_gen_mipmap.c index f0fe319..b171940 100644 --- a/src/mesa/state_tracker/st_gen_mipmap.c +++ b/src/mesa/state_tracker/st_gen_mipmap.c @@ -234,7 +234,10 @@ st_generate_mipmap(GLcontext *ctx, GLenum target, struct pipe_resource *oldTex = stObj->pt; GLboolean needFlush; - /* create new texture with space for more levels */ + /* create new texture with space for more levels + * we never set UNNORMALIZED_COORDS_HINT here since, in OpenGL, + * mipmaps always mean normalized coords as well + */ stObj->pt = st_texture_create(st, oldTex->target, oldTex->format, @@ -242,7 +245,8 @@ st_generate_mipmap(GLcontext *ctx, GLenum target, oldTex->width0, oldTex->height0, oldTex->depth0, - oldTex->bind); + oldTex->bind, + 0); /* The texture isn't in a "complete" state yet so set the expected * lastLevel here, since it won't get done in st_finalize_texture(). diff --git a/src/mesa/state_tracker/st_texture.c b/src/mesa/state_tracker/st_texture.c index 2dcd9a8..1f57424 100644 --- a/src/mesa/state_tracker/st_texture.c +++ b/src/mesa/state_tracker/st_texture.c @@ -78,7 +78,8 @@ st_texture_create(struct st_context *st, GLuint width0, GLuint height0, GLuint depth0, - GLuint bind ) + GLuint bind, + GLuint flags) { struct pipe_resource pt, *newtex; struct pipe_screen *screen = st->pipe->screen; @@ -102,7 +103,7 @@ st_texture_create(struct st_context *st, pt.depth0 = depth0; pt._usage = PIPE_USAGE_DEFAULT; pt.bind = bind; - pt.flags = 0; + pt.flags = flags; newtex = screen->resource_create(screen, &pt); diff --git a/src/mesa/state_tracker/st_texture.h b/src/mesa/state_tracker/st_texture.h index 76ea7e6..34ce3f4 100644 --- a/src/mesa/state_tracker/st_texture.h +++ b/src/mesa/state_tracker/st_texture.h @@ -152,7 +152,8 @@ st_texture_create(struct st_context *st, GLuint width0, GLuint height0, GLuint depth0, - GLuint tex_usage ); + GLuint tex_usage, + GLuint flags); /* Check if an image fits into an existing texture object. _______________________________________________ mesa-commit mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/mesa-commit
