[Mesa-dev] [PATCH] i915: fallback to swrast when gl_PointSize met

Liu Aleaxander aleaxander at gmail.com
Tue Feb 21 07:21:07 PST 2012


This patch(the way to fix this issue) is a little weird, as we already
fallbacked to swrast when handling gl_PointSize(in vertex shader).
Sounds that we didn't fallback enough;) This patch servers as fixing the
gl_PointSize issue on Pineview platform.

Since the patch is a little weird, I thought a while for another fix:
get the point size at intelRenderStart() (or somewhere else before
vtbl.emit_state()) by reading the vertex program output. This is so
tricky that I droped this fix.

Any better thoughts(or even fixes) are welcome and appreciate.

This patch would fix piglit glsl-vs-point-size on Pineview(when the GL
version 2.0 requirement is removed).

Signed-off-by: Yuanhan Liu <yuanhan.liu at linux.intel.com>
---
 src/mesa/drivers/dri/i915/i915_context.h  |    1 +
 src/mesa/drivers/dri/i915/i915_fragprog.c |    9 +++++++++
 src/mesa/drivers/dri/i915/intel_tris.c    |    1 +
 3 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/dri/i915/i915_context.h
b/src/mesa/drivers/dri/i915/i915_context.h
index 8167137..400e3a4 100644
--- a/src/mesa/drivers/dri/i915/i915_context.h
+++ b/src/mesa/drivers/dri/i915/i915_context.h
@@ -40,6 +40,7 @@
 #define I915_FALLBACK_POINT_SMOOTH	 0x80000
 #define I915_FALLBACK_POINT_SPRITE_COORD_ORIGIN	 0x100000
 #define I915_FALLBACK_DRAW_OFFSET	 0x200000
+#define I915_FALLBACK_VERTEX_PROGRAM_POINT_SIZE	 0x400000

 #define I915_UPLOAD_CTX              0x1
 #define I915_UPLOAD_BUFFERS          0x2
diff --git a/src/mesa/drivers/dri/i915/i915_fragprog.c
b/src/mesa/drivers/dri/i915/i915_fragprog.c
index 4f016a3..0e3cda1 100644
--- a/src/mesa/drivers/dri/i915/i915_fragprog.c
+++ b/src/mesa/drivers/dri/i915/i915_fragprog.c
@@ -1324,6 +1324,15 @@ i915_update_program(struct gl_context *ctx)
       translate_program(fp);

    FALLBACK(&i915->intel, I915_FALLBACK_PROGRAM, fp->error);
+
+   /*
+    * fallback to swrast for handling gl_PointSize builtin variable.
+    *
+    * FIXME: it's a little weird that put the handling of vertex program
+    * relative stuff here.
+    */
+   FALLBACK(intel, I915_FALLBACK_VERTEX_PROGRAM_POINT_SIZE,
+            ctx->VertexProgram.PointSizeEnabled);
 }

 void
diff --git a/src/mesa/drivers/dri/i915/intel_tris.c
b/src/mesa/drivers/dri/i915/intel_tris.c
index a36011a..922f6ce 100644
--- a/src/mesa/drivers/dri/i915/intel_tris.c
+++ b/src/mesa/drivers/dri/i915/intel_tris.c
@@ -1198,6 +1198,7 @@ static char *fallbackStrings[] = {
    [19] = "Smooth point",
    [20] = "point sprite coord origin",
    [21] = "depth/color drawing offset",
+   [22] = "gl_PointSize",
 };


-- 
1.7.3.1


More information about the mesa-dev mailing list