r300: clear not_flushed OQ list after flush
[mesa.git] / src / mesa / drivers / dri / r300 / r300_context.c
index 3c16e80d2bb68057f025e207bef001109da6f132..d37a37ca4647d57b9fd8fc830add568b120b3281 100644 (file)
@@ -66,6 +66,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "r300_emit.h"
 #include "r300_swtcl.h"
 #include "radeon_bocs_wrapper.h"
+#include "radeon_buffer_objects.h"
 
 
 #include "vblank.h"
@@ -73,6 +74,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "xmlpool.h"           /* for symbolic values of enum-type options */
 
 #define need_GL_VERSION_2_0
+#define need_GL_ARB_occlusion_query
 #define need_GL_ARB_point_parameters
 #define need_GL_ARB_vertex_program
 #define need_GL_EXT_blend_equation_separate
@@ -123,6 +125,8 @@ const struct dri_extension card_extensions[] = {
   {"GL_EXT_texture_lod_bias",          NULL},
   {"GL_EXT_texture_mirror_clamp",      NULL},
   {"GL_EXT_texture_rectangle",         NULL},
+  {"GL_EXT_texture_sRGB",              NULL},
+  {"GL_EXT_vertex_array_bgra",         NULL},
   {"GL_ATI_separate_stencil",          GL_ATI_separate_stencil_functions},
   {"GL_ATI_texture_env_combine3",      NULL},
   {"GL_ATI_texture_mirror_once",       NULL},
@@ -150,16 +154,7 @@ const struct dri_extension gl_20_extension[] = {
   {"GL_VERSION_2_0",                   GL_VERSION_2_0_functions },
 };
 
-
-extern struct tnl_pipeline_stage _r300_render_stage;
-extern const struct tnl_pipeline_stage _r300_tcl_stage;
-
 static const struct tnl_pipeline_stage *r300_pipeline[] = {
-
-       /* Try and go straight to t&l
-        */
-       &_r300_tcl_stage,
-
        /* Catch any t&l fallbacks
         */
        &_tnl_vertex_transform_stage,
@@ -170,21 +165,7 @@ static const struct tnl_pipeline_stage *r300_pipeline[] = {
        &_tnl_texture_transform_stage,
        &_tnl_point_attenuation_stage,
        &_tnl_vertex_program_stage,
-
-       /* Try again to go to tcl?
-        *     - no good for asymmetric-twoside (do with multipass)
-        *     - no good for asymmetric-unfilled (do with multipass)
-        *     - good for material
-        *     - good for texgen
-        *     - need to manipulate a bit of state
-        *
-        * - worth it/not worth it?
-        */
-
-       /* Else do them here.
-        */
-       &_r300_render_stage,
-       &_tnl_render_stage,     /* FALLBACK  */
+       &_tnl_render_stage,
        0,
 };
 
@@ -271,13 +252,20 @@ static void r300InitConstValues(GLcontext *ctx, radeonScreenPtr screen)
            driQueryOptioni(&r300->radeon.optionCache, "texture_coord_units");
        ctx->Const.MaxTextureUnits = MIN2(ctx->Const.MaxTextureImageUnits,
                 ctx->Const.MaxTextureCoordUnits);
+
        ctx->Const.MaxTextureMaxAnisotropy = 16.0;
        ctx->Const.MaxTextureLodBias = 16.0;
 
-       if (screen->chip_family >= CHIP_FAMILY_RV515)
+       if (screen->chip_family >= CHIP_FAMILY_RV515) {
                ctx->Const.MaxTextureLevels = 13;
-       else
+               ctx->Const.MaxCubeTextureLevels = 13;
+               ctx->Const.MaxTextureRectSize = 4096;
+       }
+       else {
                ctx->Const.MaxTextureLevels = 12;
+               ctx->Const.MaxCubeTextureLevels = 12;
+               ctx->Const.MaxTextureRectSize = 2048;
+       }
 
        ctx->Const.MinPointSize = 1.0;
        ctx->Const.MinPointSizeAA = 1.0;
@@ -323,6 +311,11 @@ static void r300InitConstValues(GLcontext *ctx, radeonScreenPtr screen)
                ctx->Const.FragmentProgram.MaxNativeTexIndirections = R300_PFS_MAX_TEX_INDIRECT;
                ctx->Const.FragmentProgram.MaxNativeAddressRegs = 0;
        }
+
+       if (r300->radeon.radeonScreen->chip_family == CHIP_FAMILY_RV530)
+               r300->num_z_pipes = 2;
+       else
+               r300->num_z_pipes = r300->radeon.radeonScreen->num_gb_pipes;
 }
 
 static void r300ParseOptions(r300ContextPtr r300, radeonScreenPtr screen)
@@ -332,7 +325,6 @@ static void r300ParseOptions(r300ContextPtr r300, radeonScreenPtr screen)
        driParseConfigFiles(&r300->radeon.optionCache, &screen->optionCache,
                            screen->driScreen->myNum, "r300");
 
-       r300->disable_lowimpact_fallback = driQueryOptionb(&r300->radeon.optionCache, "disable_lowimpact_fallback");
        r300->radeon.initialMaxAnisotropy = driQueryOptionf(&r300->radeon.optionCache, "def_max_anisotropy");
 
        options.stencil_two_side_disabled = driQueryOptionb(&r300->radeon.optionCache, "disable_stencil_two_side");
@@ -344,6 +336,8 @@ static void r300ParseOptions(r300ContextPtr r300, radeonScreenPtr screen)
        else
                options.hw_tcl_enabled = 1;
 
+       options.conformance_mode = !driQueryOptionb(&r300->radeon.optionCache, "disable_lowimpact_fallback");
+
        r300->options = options;
 }
 
@@ -395,6 +389,7 @@ GLboolean r300CreateContext(const __GLcontextModes * glVisual,
        r300InitStateFuncs(&functions);
        r300InitTextureFuncs(&functions);
        r300InitShaderFuncs(&functions);
+       radeonInitBufferObjectFuncs(&functions);
 
        if (!radeonInitContext(&r300->radeon, &functions,
                               glVisual, driContextPriv,
@@ -405,6 +400,7 @@ GLboolean r300CreateContext(const __GLcontextModes * glVisual,
 
        ctx = r300->radeon.glCtx;
 
+       r300->fallback = 0;
        if (r300->options.hw_tcl_enabled)
                ctx->VertexProgram._MaintainTnlProgram = GL_TRUE;
 
@@ -412,6 +408,8 @@ GLboolean r300CreateContext(const __GLcontextModes * glVisual,
 
        r300InitConstValues(ctx, screen);
 
+       _mesa_set_mvp_with_dp4( ctx, GL_TRUE );
+
        /* Initialize the software rasterizer and helper modules.
         */
        _swrast_CreateContext(ctx);
@@ -433,8 +431,11 @@ GLboolean r300CreateContext(const __GLcontextModes * glVisual,
        _tnl_allow_pixel_fog(ctx, GL_FALSE);
        _tnl_allow_vertex_fog(ctx, GL_TRUE);
 
-       if (!r300->options.hw_tcl_enabled)
+       if (r300->options.hw_tcl_enabled) {
+               r300InitDraw(ctx);
+       } else {
                r300InitSwtcl(ctx);
+       }
 
        radeon_fbo_init(&r300->radeon);
        radeonInitSpanFuncs( ctx );
@@ -442,13 +443,10 @@ GLboolean r300CreateContext(const __GLcontextModes * glVisual,
        r300InitState(r300);
        r300InitShaderFunctions(r300);
 
-       if (screen->chip_family == CHIP_FAMILY_RS600 || screen->chip_family == CHIP_FAMILY_RS690 ||
-               screen->chip_family == CHIP_FAMILY_RS740) {
-               r300->radeon.texture_row_align = 64;
-       }
-
        r300InitGLExtensions(ctx);
 
+       make_empty_list(&r300->query.not_flushed_head);
+
        return GL_TRUE;
 }