[Mesa-dev] [PATCH 5/5] i965: Add support for NV_conditional_render.

Brian Paul brianp at vmware.com
Wed Apr 20 16:01:11 PDT 2011


On 04/20/2011 12:08 PM, Eric Anholt wrote:
> Since we lack hardware support for it, this is a simple matter of
> checking _mesa_check_conditional_render at the entrypoints, and
> suppressing it for the metaops where it doesn't apply.
> ---
>   docs/GL3.txt                                    |    2 +-
>   docs/relnotes-7.11.html                         |    1 +
>   src/mesa/drivers/dri/i965/brw_draw.c            |    4 ++++
>   src/mesa/drivers/dri/intel/intel_clear.c        |    4 ++++
>   src/mesa/drivers/dri/intel/intel_extensions.c   |    1 +
>   src/mesa/drivers/dri/intel/intel_pixel.c        |   12 +++++++++++-
>   src/mesa/drivers/dri/intel/intel_pixel_bitmap.c |    4 ++++
>   src/mesa/drivers/dri/intel/intel_pixel_copy.c   |    4 ++++
>   8 files changed, 30 insertions(+), 2 deletions(-)
>
> diff --git a/docs/GL3.txt b/docs/GL3.txt
> index 6eeb9e4..c4e6059 100644
> --- a/docs/GL3.txt
> +++ b/docs/GL3.txt
> @@ -13,7 +13,7 @@ Feature                                               Status
>   GL 3.0:
>
>   GLSL 1.30 (GL_EXT_gpu_shader4, etc.)                  started
> -Conditional rendering (GL_NV_conditional_render)      DONE (swrast&  softpipe)
> +Conditional rendering (GL_NV_conditional_render)      DONE (swrast, softpipe, i965)
>   Map buffer subranges (GL_ARB_map_buffer_range)        DONE
>   Clamping controls (GL_ARB_color_buffer_float)         DONE
>   Float textures, renderbuffers (GL_ARB_texture_float)  DONE (gallium r300)
> diff --git a/docs/relnotes-7.11.html b/docs/relnotes-7.11.html
> index d223a0a..b57fe9b 100644
> --- a/docs/relnotes-7.11.html
> +++ b/docs/relnotes-7.11.html
> @@ -51,6 +51,7 @@ tbd
>   <li>GL_ATI_draw_buffers (all drivers)
>   <li>GL_ATI_texture_compression_3dc (gallium drivers, swrast)
>   <li>GL_ATI_texture_float (gallium, i965)
> +<li>GL_NV_conditional_render (i965)
>   <li>GL_NV_texture_barrier (gallium drivers)
>   </ul>
>
> diff --git a/src/mesa/drivers/dri/i965/brw_draw.c b/src/mesa/drivers/dri/i965/brw_draw.c
> index 2db70c5..4dd0c82 100644
> --- a/src/mesa/drivers/dri/i965/brw_draw.c
> +++ b/src/mesa/drivers/dri/i965/brw_draw.c
> @@ -28,6 +28,7 @@
>
>   #include "main/glheader.h"
>   #include "main/context.h"
> +#include "main/condrender.h"
>   #include "main/state.h"
>   #include "main/enums.h"
>   #include "tnl/tnl.h"
> @@ -438,6 +439,9 @@ void brw_draw_prims( struct gl_context *ctx,
>   {
>      GLboolean retval;
>
> +   if (!_mesa_check_conditional_render(ctx))
> +      return;
> +
>      if (!vbo_all_varyings_in_vbos(arrays)) {
>         if (!index_bounds_valid)
>   	 vbo_get_minmax_index(ctx, prim, ib,&min_index,&max_index);
> diff --git a/src/mesa/drivers/dri/intel/intel_clear.c b/src/mesa/drivers/dri/intel/intel_clear.c
> index 82d29e7..5a96232 100644
> --- a/src/mesa/drivers/dri/intel/intel_clear.c
> +++ b/src/mesa/drivers/dri/intel/intel_clear.c
> @@ -28,6 +28,7 @@
>
>   #include "main/glheader.h"
>   #include "main/mtypes.h"
> +#include "main/condrender.h"
>   #include "swrast/swrast.h"
>   #include "drivers/common/meta.h"
>
> @@ -88,6 +89,9 @@ intelClear(struct gl_context *ctx, GLbitfield mask)
>      struct intel_renderbuffer *irb;
>      int i;
>
> +   if (!_mesa_check_conditional_render(ctx))
> +      return;
> +
>      if (mask&  (BUFFER_BIT_FRONT_LEFT | BUFFER_BIT_FRONT_RIGHT)) {
>         intel->front_buffer_dirty = GL_TRUE;
>      }
> diff --git a/src/mesa/drivers/dri/intel/intel_extensions.c b/src/mesa/drivers/dri/intel/intel_extensions.c
> index 6a81857..c24bc99 100644
> --- a/src/mesa/drivers/dri/intel/intel_extensions.c
> +++ b/src/mesa/drivers/dri/intel/intel_extensions.c
> @@ -190,6 +190,7 @@ static const struct dri_extension brw_extensions[] = {
>      { "GL_ATI_envmap_bumpmap",             GL_ATI_envmap_bumpmap_functions },
>      { "GL_ATI_separate_stencil",           GL_ATI_separate_stencil_functions },
>      { "GL_ATI_texture_env_combine3",       NULL },
> +   { "GL_NV_conditional_render",          NULL },
>      { "GL_NV_texture_env_combine4",        NULL },
>      { NULL,                                NULL }
>   };
> diff --git a/src/mesa/drivers/dri/intel/intel_pixel.c b/src/mesa/drivers/dri/intel/intel_pixel.c
> index f97256e..8143e64 100644
> --- a/src/mesa/drivers/dri/intel/intel_pixel.c
> +++ b/src/mesa/drivers/dri/intel/intel_pixel.c
> @@ -28,6 +28,7 @@
>   #include "main/enums.h"
>   #include "main/state.h"
>   #include "main/bufferobj.h"
> +#include "main/condrender.h"
>   #include "main/context.h"
>   #include "swrast/swrast.h"
>
> @@ -154,10 +155,19 @@ intel_check_blit_format(struct intel_region * region,
>      return GL_FALSE;
>   }
>
> +static void
> +intel_accum(struct gl_context *ctx, GLenum op, GLfloat value)
> +{
> +   if (!_mesa_check_conditional_render(ctx))
> +      return;
> +
> +   _swrast_Accum(ctx, op, value);
> +}
> +

In this case I think we should do the _mesa_check_conditional_render() 
call in _swrast_Accum() itself.  That would match what we're doing for 
_swrast_DrawPixels(), _swrast_CopyPixels() and _swrast_Bitmap().  I 
think I just missed the glAccum case when I implemented these.

Otherwise, for the series:
Reviewed-by: Brian Paul <brianp at vmware.com>

-Brian


More information about the mesa-dev mailing list