From be8a42b4fcad0e0c7803e63f9c4b488c2f618cef Mon Sep 17 00:00:00 2001 From: Alan Hourihane Date: Fri, 2 May 2008 15:25:37 +0000 Subject: snprintf -> util_snprintf --- src/mesa/state_tracker/st_cb_strings.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/mesa/state_tracker') diff --git a/src/mesa/state_tracker/st_cb_strings.c b/src/mesa/state_tracker/st_cb_strings.c index 247519ab3d..066124f8f3 100644 --- a/src/mesa/state_tracker/st_cb_strings.c +++ b/src/mesa/state_tracker/st_cb_strings.c @@ -53,21 +53,21 @@ st_get_string(GLcontext * ctx, GLenum name) const char *vendor = screen->get_vendor( screen ); const char *tungsten = "Tungsten Graphics, Inc."; - /* Tungsten developed the state_tracker module (and much of - * Mesa), but the driver itself may come from elsewhere. The - * additional string allows "and XyzCorp" to reflect this. + /* Tungsten Graphics, Inc. developed the state_tracker module + * (and much of Mesa), but the driver itself may come from elsewhere. + * The additional string allows "and XyzCorp" to reflect this. */ if (vendor && strcmp(vendor, tungsten) != 0) - snprintf(st->vendor, sizeof(st->vendor), + util_snprintf(st->vendor, sizeof(st->vendor), "%s and %s", tungsten, vendor); else - snprintf(st->vendor, sizeof(st->vendor), "%s", tungsten); + util_snprintf(st->vendor, sizeof(st->vendor), "%s", tungsten); return (GLubyte *) st->vendor; } case GL_RENDERER: - snprintf(st->renderer, sizeof(st->renderer), "Gallium %s, %s on %s", + util_snprintf(st->renderer, sizeof(st->renderer), "Gallium %s, %s on %s", ST_VERSION_STRING, screen->get_name( screen ), screen->winsys->get_name( screen->winsys )); -- cgit v1.2.3 From d4074c509b5d28be0a2ec51d40329e1aed7047ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Fri, 2 May 2008 16:22:20 +0100 Subject: gallium: Reallocate pipe_texture in st_TexImage if the texture object was used. Fixes problems with interleaved glTexImage and rendering calls. --- src/mesa/state_tracker/st_atom_texture.c | 2 ++ src/mesa/state_tracker/st_cb_texture.c | 12 +++++++----- src/mesa/state_tracker/st_texture.h | 4 +--- 3 files changed, 10 insertions(+), 8 deletions(-) (limited to 'src/mesa/state_tracker') diff --git a/src/mesa/state_tracker/st_atom_texture.c b/src/mesa/state_tracker/st_atom_texture.c index f42b2f8d66..767654f3d0 100644 --- a/src/mesa/state_tracker/st_atom_texture.c +++ b/src/mesa/state_tracker/st_atom_texture.c @@ -90,6 +90,8 @@ update_textures(struct st_context *st) } st->state.num_textures = su + 1; + + stObj->teximage_realloc = TRUE; } pt = st_get_stobj_texture(stObj); diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index 5fd192a8b8..80122546fc 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -556,15 +556,17 @@ st_TexImage(GLcontext * ctx, * waiting on any outstanding fences. */ if (stObj->pt && - /*stObj->pt->first_level == level &&*/ - stObj->pt->last_level == level && - stObj->pt->target != PIPE_TEXTURE_CUBE && - !st_texture_match_image(stObj->pt, &stImage->base, - stImage->face, stImage->level)) { + (stObj->teximage_realloc || + (/*stObj->pt->first_level == level &&*/ + stObj->pt->last_level == level && + stObj->pt->target != PIPE_TEXTURE_CUBE && + !st_texture_match_image(stObj->pt, &stImage->base, + stImage->face, stImage->level)))) { DBG("release it\n"); pipe_texture_release(&stObj->pt); assert(!stObj->pt); + stObj->teximage_realloc = FALSE; } if (!stObj->pt) { diff --git a/src/mesa/state_tracker/st_texture.h b/src/mesa/state_tracker/st_texture.h index 7abccb3a69..b05762113c 100644 --- a/src/mesa/state_tracker/st_texture.h +++ b/src/mesa/state_tracker/st_texture.h @@ -68,9 +68,7 @@ struct st_texture_object */ struct pipe_texture *pt; - GLboolean imageOverride; - GLint depthOverride; - GLuint pitchOverride; + GLboolean teximage_realloc; }; -- cgit v1.2.3 From 479d19f5a2bca79104f3b7f94147e94a52a27fea Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 2 May 2008 10:38:39 -0600 Subject: gallium: in st_finalize_texture() check texture dimensions Check dimensions in addition to target, format, etc. Fixes a bug where we failed to detect a change in texture image sizes and wound up using the old texture data. --- src/mesa/state_tracker/st_cb_texture.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/mesa/state_tracker') diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index 80122546fc..1eabef6d92 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -1483,13 +1483,16 @@ st_finalize_texture(GLcontext *ctx, } /* Check texture can hold all active levels. Check texture matches - * target, imageFormat, etc. + * target, imageFormat, dimensions, etc. */ if (stObj->pt && (stObj->pt->target != gl_target_to_pipe(stObj->base.Target) || stObj->pt->format != st_mesa_format_to_pipe_format(firstImage->base.TexFormat->MesaFormat) || stObj->pt->last_level < stObj->lastLevel || + stObj->pt->width[0] != firstImage->base.Width2 || + stObj->pt->height[0] != firstImage->base.Height2 || + stObj->pt->depth[0] != firstImage->base.Depth2 || stObj->pt->cpp != cpp || stObj->pt->compressed != firstImage->base.IsCompressed)) { pipe_texture_release(&stObj->pt); -- cgit v1.2.3 From ce509401738e7073de94a2b7fc41461c52a73da0 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 2 May 2008 10:43:29 -0600 Subject: gallium: minor code, comments clean-up --- src/mesa/state_tracker/st_cb_texture.c | 42 +++++++++++++--------------------- 1 file changed, 16 insertions(+), 26 deletions(-) (limited to 'src/mesa/state_tracker') diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index 1eabef6d92..02ef961e4d 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -1448,17 +1448,6 @@ st_finalize_texture(GLcontext *ctx, calculate_first_last_level(stObj); firstImage = st_texture_image(stObj->base.Image[0][stObj->base.BaseLevel]); -#if 0 - /* Fallback case: - */ - if (firstImage->base.Border) { - if (stObj->pt) { - pipe_texture_release(&stObj->pt); - } - return GL_FALSE; - } -#endif - /* If both firstImage and stObj point to a texture which can contain * all active images, favour firstImage. Note that because of the * completeness requirement, we know that the image dimensions @@ -1482,24 +1471,25 @@ st_finalize_texture(GLcontext *ctx, cpp = firstImage->base.TexFormat->TexelBytes; } - /* Check texture can hold all active levels. Check texture matches - * target, imageFormat, dimensions, etc. + /* If we already have a gallium texture, check that it matches the texture + * object's format, target, size, num_levels, etc. */ - if (stObj->pt && - (stObj->pt->target != gl_target_to_pipe(stObj->base.Target) || - stObj->pt->format != - st_mesa_format_to_pipe_format(firstImage->base.TexFormat->MesaFormat) || - stObj->pt->last_level < stObj->lastLevel || - stObj->pt->width[0] != firstImage->base.Width2 || - stObj->pt->height[0] != firstImage->base.Height2 || - stObj->pt->depth[0] != firstImage->base.Depth2 || - stObj->pt->cpp != cpp || - stObj->pt->compressed != firstImage->base.IsCompressed)) { - pipe_texture_release(&stObj->pt); + if (stObj->pt) { + const enum pipe_format fmt = + st_mesa_format_to_pipe_format(firstImage->base.TexFormat->MesaFormat); + if (stObj->pt->target != gl_target_to_pipe(stObj->base.Target) || + stObj->pt->format != fmt || + stObj->pt->last_level < stObj->lastLevel || + stObj->pt->width[0] != firstImage->base.Width2 || + stObj->pt->height[0] != firstImage->base.Height2 || + stObj->pt->depth[0] != firstImage->base.Depth2 || + stObj->pt->cpp != cpp || + stObj->pt->compressed != firstImage->base.IsCompressed) { + pipe_texture_release(&stObj->pt); + } } - - /* May need to create a new texture: + /* May need to create a new gallium texture: */ if (!stObj->pt) { stObj->pt = st_texture_create(ctx->st, -- cgit v1.2.3 From 3668d20a9f382a174e002dc9b226710bdd983992 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 3 May 2008 08:58:44 -0600 Subject: gallium: fix computation of sampler->min_lod The texture BaseLevel is accounted for in texture layout so it doesn't factor in here. May also need to adjust max_lod... --- src/mesa/state_tracker/st_atom_sampler.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/mesa/state_tracker') diff --git a/src/mesa/state_tracker/st_atom_sampler.c b/src/mesa/state_tracker/st_atom_sampler.c index 7515bb30cc..b020d43505 100644 --- a/src/mesa/state_tracker/st_atom_sampler.c +++ b/src/mesa/state_tracker/st_atom_sampler.c @@ -148,7 +148,7 @@ update_samplers(struct st_context *st) sampler->normalized_coords = 1; sampler->lod_bias = st->ctx->Texture.Unit[su].LodBias; - sampler->min_lod = MAX2(texobj->BaseLevel, texobj->MinLod); + sampler->min_lod = MAX2(0, texobj->MinLod); sampler->max_lod = MIN2(texobj->MaxLevel, texobj->MaxLod); sampler->border_color[0] = texobj->BorderColor[RCOMP]; -- cgit v1.2.3 From 3837d401cc665eccf079eba5822b1a3eec565b81 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 3 May 2008 09:07:11 -0600 Subject: gallium: fix sampler->max_lod computation --- src/mesa/state_tracker/st_atom_sampler.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/mesa/state_tracker') diff --git a/src/mesa/state_tracker/st_atom_sampler.c b/src/mesa/state_tracker/st_atom_sampler.c index b020d43505..379b41c654 100644 --- a/src/mesa/state_tracker/st_atom_sampler.c +++ b/src/mesa/state_tracker/st_atom_sampler.c @@ -148,8 +148,9 @@ update_samplers(struct st_context *st) sampler->normalized_coords = 1; sampler->lod_bias = st->ctx->Texture.Unit[su].LodBias; - sampler->min_lod = MAX2(0, texobj->MinLod); - sampler->max_lod = MIN2(texobj->MaxLevel, texobj->MaxLod); + sampler->min_lod = MAX2(0.0f, texobj->MinLod); + sampler->max_lod = MIN2(texobj->MaxLevel - texobj->BaseLevel, + texobj->MaxLod); sampler->border_color[0] = texobj->BorderColor[RCOMP]; sampler->border_color[1] = texobj->BorderColor[GCOMP]; -- cgit v1.2.3 From 736f535b4f1c5e6912b5b2fe9415a3b44a678844 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 3 May 2008 09:26:25 -0600 Subject: gallium: fix warnings --- src/mesa/state_tracker/st_atom_sampler.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/mesa/state_tracker') diff --git a/src/mesa/state_tracker/st_atom_sampler.c b/src/mesa/state_tracker/st_atom_sampler.c index 379b41c654..10283d31a1 100644 --- a/src/mesa/state_tracker/st_atom_sampler.c +++ b/src/mesa/state_tracker/st_atom_sampler.c @@ -32,12 +32,14 @@ */ +#include "main/macros.h" + #include "st_context.h" #include "st_atom.h" #include "st_program.h" #include "pipe/p_context.h" #include "pipe/p_defines.h" -#include "pipe/p_util.h" + #include "cso_cache/cso_context.h" -- cgit v1.2.3 From 736374c1052be647bd7c377344acf8db0af4ddfc Mon Sep 17 00:00:00 2001 From: Alan Hourihane Date: Mon, 5 May 2008 23:08:59 +0100 Subject: declare atoms as extern --- src/mesa/state_tracker/st_atom.h | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'src/mesa/state_tracker') diff --git a/src/mesa/state_tracker/st_atom.h b/src/mesa/state_tracker/st_atom.h index 3a63e2dec0..c6c6eba812 100644 --- a/src/mesa/state_tracker/st_atom.h +++ b/src/mesa/state_tracker/st_atom.h @@ -44,20 +44,20 @@ void st_destroy_atoms( struct st_context *st ); void st_validate_state( struct st_context *st ); -const struct st_tracked_state st_update_framebuffer; -const struct st_tracked_state st_update_clip; -const struct st_tracked_state st_update_depth_stencil_alpha; -const struct st_tracked_state st_update_shader; -const struct st_tracked_state st_update_rasterizer; -const struct st_tracked_state st_update_polygon_stipple; -const struct st_tracked_state st_update_viewport; -const struct st_tracked_state st_update_scissor; -const struct st_tracked_state st_update_blend; -const struct st_tracked_state st_update_sampler; -const struct st_tracked_state st_update_texture; -const struct st_tracked_state st_update_fs_constants; -const struct st_tracked_state st_update_vs_constants; -const struct st_tracked_state st_update_pixel_transfer; +extern const struct st_tracked_state st_update_framebuffer; +extern const struct st_tracked_state st_update_clip; +extern const struct st_tracked_state st_update_depth_stencil_alpha; +extern const struct st_tracked_state st_update_shader; +extern const struct st_tracked_state st_update_rasterizer; +extern const struct st_tracked_state st_update_polygon_stipple; +extern const struct st_tracked_state st_update_viewport; +extern const struct st_tracked_state st_update_scissor; +extern const struct st_tracked_state st_update_blend; +extern const struct st_tracked_state st_update_sampler; +extern const struct st_tracked_state st_update_texture; +extern const struct st_tracked_state st_update_fs_constants; +extern const struct st_tracked_state st_update_vs_constants; +extern const struct st_tracked_state st_update_pixel_transfer; uint st_compare_func_to_pipe(GLenum func); -- cgit v1.2.3