r300: enable ARB_occlusion_query
authorMaciej Cencora <m.cencora@gmail.com>
Thu, 11 Jun 2009 14:11:47 +0000 (16:11 +0200)
committerMaciej Cencora <m.cencora@gmail.com>
Sat, 15 Aug 2009 13:14:29 +0000 (15:14 +0200)
Supported only on HW with TCL block and with proper radeon drm.
Required minimum radeon drm version is 1.30 or KMS.

src/mesa/drivers/dri/r300/r300_context.c

index d37a37ca4647d57b9fd8fc830add568b120b3281..91fa77a169058deea8d7b6a9cf4ad6831ac382a2 100644 (file)
@@ -64,6 +64,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "r300_ioctl.h"
 #include "r300_tex.h"
 #include "r300_emit.h"
+#include "r300_queryobj.h"
 #include "r300_swtcl.h"
 #include "radeon_bocs_wrapper.h"
 #include "radeon_buffer_objects.h"
@@ -95,6 +96,7 @@ const struct dri_extension card_extensions[] = {
   /* *INDENT-OFF* */
   {"GL_ARB_depth_texture",             NULL},
   {"GL_ARB_fragment_program",          NULL},
+  {"GL_ARB_occlusion_query",           GL_ARB_occlusion_query_functions},
   {"GL_ARB_multitexture",              NULL},
   {"GL_ARB_point_parameters",          GL_ARB_point_parameters_functions},
   {"GL_ARB_shadow",                    NULL},
@@ -358,6 +360,11 @@ static void r300InitGLExtensions(GLcontext *ctx)
        } else if (r300->options.s3tc_force_disabled) {
                _mesa_disable_extension(ctx, "GL_EXT_texture_compression_s3tc");
        }
+
+       if (!r300->radeon.radeonScreen->drmSupportsOcclusionQueries ||
+               !r300->options.hw_tcl_enabled) {
+               _mesa_disable_extension(ctx, "GL_ARB_occlusion_query");
+       }
 }
 
 /* Create the device specific rendering context.
@@ -389,6 +396,7 @@ GLboolean r300CreateContext(const __GLcontextModes * glVisual,
        r300InitStateFuncs(&functions);
        r300InitTextureFuncs(&functions);
        r300InitShaderFuncs(&functions);
+       r300InitQueryObjFunctions(&functions);
        radeonInitBufferObjectFuncs(&functions);
 
        if (!radeonInitContext(&r300->radeon, &functions,