Fix crashes when the frag prog can't be handled in hardware (#11131)
authorRoland Scheidegger <sroland@tungstengraphics.com>
Sun, 29 Jul 2007 16:04:28 +0000 (18:04 +0200)
committerRoland Scheidegger <sroland@tungstengraphics.com>
Sun, 29 Jul 2007 16:07:42 +0000 (18:07 +0200)
Must not change to/from swrast after Render.Start or bad things will happen.
(Driver will still somewhat incorrectly report an implementation error,
and apps can't really figure out if a prog is natively supported as validation
is later - could try doing it earlier to give some hint at least, even though
native status may still change later due to fog etc.)

src/mesa/drivers/dri/i915tex/i830_vtbl.c
src/mesa/drivers/dri/i915tex/i915_vtbl.c
src/mesa/drivers/dri/i915tex/intel_context.h
src/mesa/drivers/dri/i915tex/intel_render.c

index 03d4788be1abf6281f222f9bf32d567b8b311957..20c6900025ebb7a4f49337d649228009faf28ede 100644 (file)
@@ -60,6 +60,11 @@ do {                                                                 \
 #define VRTX_TEX_SET_FMT(n, x)          ((x)<<((n)*2))
 #define TEXBIND_SET(n, x)              ((x)<<((n)*4))
 
+static void
+i830_render_prevalidate(struct intel_context *intel)
+{
+}
+
 static void
 i830_render_start(struct intel_context *intel)
 {
@@ -638,5 +643,6 @@ i830InitVtbl(struct i830_context *i830)
    i830->intel.vtbl.update_texture_state = i830UpdateTextureState;
    i830->intel.vtbl.flush_cmd = i830_flush_cmd;
    i830->intel.vtbl.render_start = i830_render_start;
+   i830->intel.vtbl.render_prevalidate = i830_render_prevalidate;
    i830->intel.vtbl.assert_not_dirty = i830_assert_not_dirty;
 }
index 51aff68840209a5691bf1820bbf0bfbc0e774d1f..13ca9aee6bd5b007d85d26575fd26fcf3f6c0759 100644 (file)
 #include "i915_context.h"
 
 static void
-i915_render_start(struct intel_context *intel)
+i915_render_prevalidate(struct intel_context *intel)
 {
    struct i915_context *i915 = i915_context(&intel->ctx);
 
    i915ValidateFragmentProgram(i915);
 }
 
+static void
+i915_render_start(struct intel_context *intel)
+{
+}
+
 
 static void
 i915_reduced_primitive_state(struct intel_context *intel, GLenum rprim)
@@ -547,6 +552,7 @@ i915InitVtbl(struct i915_context *i915)
    i915->intel.vtbl.lost_hardware = i915_lost_hardware;
    i915->intel.vtbl.reduced_primitive_state = i915_reduced_primitive_state;
    i915->intel.vtbl.render_start = i915_render_start;
+   i915->intel.vtbl.render_prevalidate = i915_render_prevalidate;
    i915->intel.vtbl.set_draw_region = i915_set_draw_region;
    i915->intel.vtbl.update_texture_state = i915UpdateTextureState;
    i915->intel.vtbl.flush_cmd = i915_flush_cmd;
index 535a93effacba146ca8ffa6dd4a0efdc031143e3..ee5be45533335e247985608c73304a9ef2d9631f 100644 (file)
@@ -131,6 +131,7 @@ struct intel_context
       void (*update_texture_state) (struct intel_context * intel);
 
       void (*render_start) (struct intel_context * intel);
+      void (*render_prevalidate) (struct intel_context * intel);
       void (*set_draw_region) (struct intel_context * intel,
                                struct intel_region * draw_region,
                                struct intel_region * depth_region);
index f9fa55051eaa6b01129934435f3dcf75e870967f..c8b6d308d9699f4093c31e288f571128901a7c27 100644 (file)
@@ -202,6 +202,8 @@ intel_run_render(GLcontext * ctx, struct tnl_pipeline_stage *stage)
    struct vertex_buffer *VB = &tnl->vb;
    GLuint i;
 
+   intel->vtbl.render_prevalidate( intel );
+
    /* Don't handle clipping or indexed vertices.
     */
    if (intel->RenderIndex != 0 ||