From 8c223e8eb6359d5df918e23ae5c036fa134cc40d Mon Sep 17 00:00:00 2001 From: Alan Hourihane Date: Thu, 6 Aug 2009 15:54:49 +0100 Subject: Ensure GL_EXT_blend_equation_separate is enabled when 2.0 is enabled. --- src/mesa/main/extensions.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c index 5c4bea9cf6..ebbe28acf4 100644 --- a/src/mesa/main/extensions.c +++ b/src/mesa/main/extensions.c @@ -404,6 +404,7 @@ _mesa_enable_2_0_extensions(GLcontext *ctx) ctx->Extensions.ARB_fragment_shader = GL_TRUE; #endif ctx->Extensions.ARB_point_sprite = GL_TRUE; + ctx->Extensions.EXT_blend_equation_separate = GL_TRUE; ctx->Extensions.ARB_texture_non_power_of_two = GL_TRUE; #if FEATURE_ARB_shader_objects ctx->Extensions.ARB_shader_objects = GL_TRUE; -- cgit v1.2.3 From ffb1f9bded52aa9f53ed179f91186c9e8c59b8c8 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 6 Aug 2009 09:02:05 -0600 Subject: util: added util_same_surface() helper function --- src/gallium/auxiliary/util/u_surface.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/gallium/auxiliary/util/u_surface.h b/src/gallium/auxiliary/util/u_surface.h index a5b73cfc20..ce84ed7ad0 100644 --- a/src/gallium/auxiliary/util/u_surface.h +++ b/src/gallium/auxiliary/util/u_surface.h @@ -37,6 +37,23 @@ struct pipe_texture; struct pipe_surface; +/** + * Are s1 and s2 the same surface? + * Surfaces are basically views into textures so check if the two surfaces + * name the same part of the same texture. + */ +static INLINE boolean +util_same_surface(const struct pipe_surface *s1, const struct pipe_surface *s2) +{ + return (s1->texture == s2->texture && + s1->face == s2->face && + s1->level == s2->level && + s1->zslice == s2->zslice); +} + + + + extern boolean util_create_rgba_surface(struct pipe_screen *screen, uint width, uint height, -- cgit v1.2.3 From 24fdf8aadb6cd1f98d0ce54a1e4f28cb964b99e0 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 6 Aug 2009 09:02:36 -0600 Subject: util: use util_same_surface() to compare surface pointers --- src/gallium/auxiliary/util/u_blit.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gallium/auxiliary/util/u_blit.c b/src/gallium/auxiliary/util/u_blit.c index f7cc7dd375..739aa51564 100644 --- a/src/gallium/auxiliary/util/u_blit.c +++ b/src/gallium/auxiliary/util/u_blit.c @@ -328,8 +328,9 @@ util_blit_pixels(struct blit_state *ctx, PIPE_TEXTURE_USAGE_SAMPLER, 0)); /* do the regions overlap? */ - overlap = (src == dst) && regions_overlap(srcX0, srcY0, srcX1, srcY1, - dstX0, dstY0, dstX1, dstY1); + overlap = util_same_surface(src, dst) && + regions_overlap(srcX0, srcY0, srcX1, srcY1, + dstX0, dstY0, dstX1, dstY1); /* * Check for simple case: no format conversion, no flipping, no stretching, @@ -343,7 +344,6 @@ util_blit_pixels(struct blit_state *ctx, (dstX1 - dstX0) == (srcX1 - srcX0) && (dstY1 - dstY0) == (srcY1 - srcY0) && !overlap) { - /* FIXME: this will most surely fail for overlapping rectangles */ pipe->surface_copy(pipe, dst, dstX0, dstY0, /* dest */ src, srcX0, srcY0, /* src */ -- cgit v1.2.3 From 98f00e8eb90b2b46fe72ffb0aea6cd516cf47497 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 6 Aug 2009 14:54:25 -0600 Subject: util: include u_surface.h, added comment --- src/gallium/auxiliary/util/u_blit.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gallium/auxiliary/util/u_blit.c b/src/gallium/auxiliary/util/u_blit.c index 739aa51564..ebf3f144b5 100644 --- a/src/gallium/auxiliary/util/u_blit.c +++ b/src/gallium/auxiliary/util/u_blit.c @@ -45,6 +45,7 @@ #include "util/u_math.h" #include "util/u_memory.h" #include "util/u_simple_shaders.h" +#include "util/u_surface.h" #include "cso_cache/cso_context.h" @@ -335,6 +336,7 @@ util_blit_pixels(struct blit_state *ctx, /* * Check for simple case: no format conversion, no flipping, no stretching, * no overlapping. + * Filter mode should not matter since there's no stretching. */ if (dst->format == src->format && srcX0 < srcX1 && -- cgit v1.2.3 From 9676ed27fe1f59956779ca4a612929e0cf61e3a3 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 6 Aug 2009 14:58:01 -0600 Subject: util: fix incorrect assertion Check that the dest surface/format is renderable. --- src/gallium/auxiliary/util/u_blit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/auxiliary/util/u_blit.c b/src/gallium/auxiliary/util/u_blit.c index ebf3f144b5..cda6dbd46d 100644 --- a/src/gallium/auxiliary/util/u_blit.c +++ b/src/gallium/auxiliary/util/u_blit.c @@ -326,7 +326,7 @@ util_blit_pixels(struct blit_state *ctx, assert(screen->is_format_supported(screen, src->format, PIPE_TEXTURE_2D, PIPE_TEXTURE_USAGE_SAMPLER, 0)); assert(screen->is_format_supported(screen, dst->format, PIPE_TEXTURE_2D, - PIPE_TEXTURE_USAGE_SAMPLER, 0)); + PIPE_TEXTURE_USAGE_RENDER_TARGET, 0)); /* do the regions overlap? */ overlap = util_same_surface(src, dst) && -- cgit v1.2.3 From d80b36f64f0a8224f2c73f3bab9b33d95c392158 Mon Sep 17 00:00:00 2001 From: Pauli Nieminen Date: Fri, 7 Aug 2009 10:02:22 -0700 Subject: dri: Fix problems with unitialized values in dri screen object. This fixes crash in r200 KMS driver when pSAREA was set to 1 randomly because of memory wasn't cleared. Signed-off-by: Pauli Nieminen --- src/mesa/drivers/dri/common/dri_util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c index 576494940f..ecccc01000 100644 --- a/src/mesa/drivers/dri/common/dri_util.c +++ b/src/mesa/drivers/dri/common/dri_util.c @@ -763,7 +763,7 @@ dri2CreateNewScreen(int scrn, int fd, if (driDriverAPI.InitScreen2 == NULL) return NULL; - psp = _mesa_malloc(sizeof(*psp)); + psp = _mesa_calloc(sizeof(*psp)); if (!psp) return NULL; -- cgit v1.2.3 From 1ce3f5a806f6efb29c231157987e3495c7b41022 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Thu, 13 Aug 2009 15:54:10 +0100 Subject: draw: cope with more primitives in draw_pipeline_run This previously was used only for decomposed (POINT/LINE/TRI) primitives, but for some time a full range of primitives could end up in here. Fixes trivial/lineloop-clip on softpipe, among others. (cherry picked from commit 87cd8a3b8a2407b30916be418ff2f95dfea5d2ad) --- src/gallium/auxiliary/draw/draw_pipe.c | 77 ++++++++++++++++++++++++---------- 1 file changed, 55 insertions(+), 22 deletions(-) diff --git a/src/gallium/auxiliary/draw/draw_pipe.c b/src/gallium/auxiliary/draw/draw_pipe.c index 3cde9d36d3..be2f0f27f2 100644 --- a/src/gallium/auxiliary/draw/draw_pipe.c +++ b/src/gallium/auxiliary/draw/draw_pipe.c @@ -158,6 +158,60 @@ static void do_triangle( struct draw_context *draw, +#define QUAD(i0,i1,i2,i3) \ + do_triangle( draw, \ + ( DRAW_PIPE_RESET_STIPPLE | \ + DRAW_PIPE_EDGE_FLAG_0 | \ + DRAW_PIPE_EDGE_FLAG_2 ), \ + verts + stride * elts[i0], \ + verts + stride * elts[i1], \ + verts + stride * elts[i3]); \ + do_triangle( draw, \ + ( DRAW_PIPE_EDGE_FLAG_0 | \ + DRAW_PIPE_EDGE_FLAG_1 ), \ + verts + stride * elts[i1], \ + verts + stride * elts[i2], \ + verts + stride * elts[i3]) + +#define TRIANGLE(flags,i0,i1,i2) \ + do_triangle( draw, \ + elts[i0], /* flags */ \ + verts + stride * (elts[i0] & ~DRAW_PIPE_FLAG_MASK), \ + verts + stride * elts[i1], \ + verts + stride * elts[i2]) + +#define LINE(flags,i0,i1) \ + do_line( draw, \ + elts[i0], \ + verts + stride * (elts[i0] & ~DRAW_PIPE_FLAG_MASK), \ + verts + stride * elts[i1]) + +#define POINT(i0) \ + do_point( draw, \ + verts + stride * elts[i0] ) + +#define FUNC pipe_run +#define ARGS \ + struct draw_context *draw, \ + unsigned prim, \ + struct vertex_header *vertices, \ + unsigned stride, \ + const ushort *elts + +#define LOCAL_VARS \ + char *verts = (char *)vertices; \ + boolean flatfirst = (draw->rasterizer->flatshade && \ + draw->rasterizer->flatshade_first); \ + unsigned i; \ + ushort flags + +#define FLUSH + +#include "draw_pt_decompose.h" +#undef ARGS +#undef LOCAL_VARS + + /* Code to run the pipeline on a fairly arbitary collection of vertices. * @@ -184,28 +238,7 @@ void draw_pipeline_run( struct draw_context *draw, draw->pipeline.vertex_stride = stride; draw->pipeline.vertex_count = vertex_count; - switch (prim) { - case PIPE_PRIM_POINTS: - for (i = 0; i < count; i++) - do_point( draw, - verts + stride * elts[i] ); - break; - case PIPE_PRIM_LINES: - for (i = 0; i+1 < count; i += 2) - do_line( draw, - elts[i+0], /* flags */ - verts + stride * (elts[i+0] & ~DRAW_PIPE_FLAG_MASK), - verts + stride * elts[i+1]); - break; - case PIPE_PRIM_TRIANGLES: - for (i = 0; i+2 < count; i += 3) - do_triangle( draw, - elts[i+0], /* flags */ - verts + stride * (elts[i+0] & ~DRAW_PIPE_FLAG_MASK), - verts + stride * elts[i+1], - verts + stride * elts[i+2]); - break; - } + pipe_run(draw, prim, vertices, stride, elts, count); draw->pipeline.verts = NULL; draw->pipeline.vertex_count = 0; -- cgit v1.2.3