Two little enhancements to NV_occlusion_query

My main purpose is to hide need of synchronisation when using the queries (in some of its applications), and in result making them easier to use (and, who knows, maybe even potentially more efficient…)

  1. Copy result of occlusion query to texture

Let’s introduce new function that works this way:
. waits for the occlusion query to complete
. reads the pixel count result
. applies scale and bias to it
. then writes the value to single texel of texture.

(based on glCopyTexSubImage)

  GLenum target,    // texture target
  GLint level,      // mipmap level
  GLint xoffset,    // location of updated texel (1D/2D/3D)
  GLint yoffset,    // location of updated texel (2D/3D)
  GLint zoffset,    // location of updated texel (3D)
  GLenum component, // updated component of the texel: GL_RED/GREEN/BLUE/ALPHA
  GLint query_id,
  GLfloat scale,
  GLfloat bias,
  GLenum operation, // update operation performed on the texel component: 
                    // GL_REPLACE/ADD/SUB/MUL/MAX/MIN
  1. Window space bounding box hint

glBoundingBox(x, y, width, height, near, far)
where x,y,width,height are similar to glScissor or glViewport parameters
and near,far are similar to glDepthRange parameters

Think of it as 3D version of glScissor, with change that it does no clipping, but only provides hint, allowing driver to assume that all subsequent fragments will be inside the box (or otherwise result is undefined)

This actually is not a change to NV_occlusion_query, but rather hiding it from user, as the driver could do the query internally and discard some drawing commands when their results are known to be occluded.

Additionally, the hint could be useful for depth-replacing fragment programs, letting them undergo some coarse (but better than none?) early Z test.

[This message has been edited by MZ (edited 09-28-2002).]