Merge branch 'gallium-0.1' into gallium-0.2
[mesa.git] / src / mesa / drivers / dri / r300 / r300_context.c
index 9ea14ab4c784e155c9b9cbd3baf6d6f0343b6d2c..fcf571d20603aa856628241680a5c203ef576585 100644 (file)
@@ -63,6 +63,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_swtcl.h"
 
 #ifdef USER_BUFFERS
 #include "r300_mem.h"
@@ -78,11 +79,13 @@ int hw_tcl_on = 1;
 
 #define need_GL_EXT_stencil_two_side
 #define need_GL_ARB_multisample
+#define need_GL_ARB_point_parameters
 #define need_GL_ARB_texture_compression
 #define need_GL_ARB_vertex_buffer_object
 #define need_GL_ARB_vertex_program
 #define need_GL_EXT_blend_minmax
 //#define need_GL_EXT_fog_coord
+#define need_GL_EXT_multi_draw_arrays
 #define need_GL_EXT_secondary_color
 #define need_GL_EXT_blend_equation_separate
 #define need_GL_EXT_blend_func_separate
@@ -92,8 +95,13 @@ int hw_tcl_on = 1;
 
 const struct dri_extension card_extensions[] = {
   /* *INDENT-OFF* */
+  {"GL_ARB_depth_texture",             NULL},
+  {"GL_ARB_fragment_program",          NULL},
   {"GL_ARB_multisample",               GL_ARB_multisample_functions},
   {"GL_ARB_multitexture",              NULL},
+  {"GL_ARB_point_parameters",          GL_ARB_point_parameters_functions},
+  {"GL_ARB_shadow",                    NULL},
+  {"GL_ARB_shadow_ambient",            NULL},
   {"GL_ARB_texture_border_clamp",      NULL},
   {"GL_ARB_texture_compression",       GL_ARB_texture_compression_functions},
   {"GL_ARB_texture_cube_map",          NULL},
@@ -104,14 +112,15 @@ const struct dri_extension card_extensions[] = {
   {"GL_ARB_texture_mirrored_repeat",   NULL},
   {"GL_ARB_vertex_buffer_object",      GL_ARB_vertex_buffer_object_functions},
   {"GL_ARB_vertex_program",            GL_ARB_vertex_program_functions},
-  {"GL_ARB_fragment_program",          NULL},
   {"GL_EXT_blend_equation_separate",   GL_EXT_blend_equation_separate_functions},
   {"GL_EXT_blend_func_separate",       GL_EXT_blend_func_separate_functions},
   {"GL_EXT_blend_minmax",              GL_EXT_blend_minmax_functions},
   {"GL_EXT_blend_subtract",            NULL},
 //  {"GL_EXT_fog_coord",                       GL_EXT_fog_coord_functions },
+  {"GL_EXT_multi_draw_arrays",         GL_EXT_multi_draw_arrays_functions},
   {"GL_EXT_gpu_program_parameters",     GL_EXT_gpu_program_parameters_functions},
   {"GL_EXT_secondary_color",           GL_EXT_secondary_color_functions},
+  {"GL_EXT_shadow_funcs",              NULL},
   {"GL_EXT_stencil_two_side",          GL_EXT_stencil_two_side_functions},
   {"GL_EXT_stencil_wrap",              NULL},
   {"GL_EXT_texture_edge_clamp",                NULL},
@@ -129,6 +138,7 @@ const struct dri_extension card_extensions[] = {
   {"GL_NV_blend_square",               NULL},
   {"GL_NV_vertex_program",             GL_NV_vertex_program_functions},
   {"GL_SGIS_generate_mipmap",          NULL},
+  {"GL_SGIX_depth_texture",            NULL},
   {NULL,                               NULL}
   /* *INDENT-ON* */
 };
@@ -272,6 +282,12 @@ GLboolean r300CreateContext(const __GLcontextModes * glVisual,
            MIN2(ctx->Const.MaxTextureImageUnits,
                 ctx->Const.MaxTextureCoordUnits);
        ctx->Const.MaxTextureMaxAnisotropy = 16.0;
+       ctx->Const.MaxTextureLodBias = 16.0;
+
+       if (screen->chip_family >= CHIP_FAMILY_RV515) {
+           ctx->Const.MaxTextureLevels = 13;
+           ctx->Const.MaxTextureRectSize = 4096;
+       }
 
        ctx->Const.MinPointSize = 1.0;
        ctx->Const.MinPointSizeAA = 1.0;
@@ -317,15 +333,17 @@ GLboolean r300CreateContext(const __GLcontextModes * glVisual,
        _tnl_allow_vertex_fog(ctx, GL_TRUE);
 
        /* currently bogus data */
-       ctx->Const.VertexProgram.MaxInstructions = VSF_MAX_FRAGMENT_LENGTH / 4;
-       ctx->Const.VertexProgram.MaxNativeInstructions =
-           VSF_MAX_FRAGMENT_LENGTH / 4;
-       ctx->Const.VertexProgram.MaxNativeAttribs = 16; /* r420 */
-       ctx->Const.VertexProgram.MaxTemps = 32;
-       ctx->Const.VertexProgram.MaxNativeTemps =
-           /*VSF_MAX_FRAGMENT_TEMPS */ 32;
-       ctx->Const.VertexProgram.MaxNativeParameters = 256;     /* r420 */
-       ctx->Const.VertexProgram.MaxNativeAddressRegs = 1;
+       if (screen->chip_flags & RADEON_CHIPSET_TCL) {
+               ctx->Const.VertexProgram.MaxInstructions = VSF_MAX_FRAGMENT_LENGTH / 4;
+               ctx->Const.VertexProgram.MaxNativeInstructions =
+                 VSF_MAX_FRAGMENT_LENGTH / 4;
+               ctx->Const.VertexProgram.MaxNativeAttribs = 16; /* r420 */
+               ctx->Const.VertexProgram.MaxTemps = 32;
+               ctx->Const.VertexProgram.MaxNativeTemps =
+                 /*VSF_MAX_FRAGMENT_TEMPS */ 32;
+               ctx->Const.VertexProgram.MaxNativeParameters = 256;     /* r420 */
+               ctx->Const.VertexProgram.MaxNativeAddressRegs = 1;
+       }
 
        ctx->Const.FragmentProgram.MaxNativeTemps = PFS_NUM_TEMP_REGS;
        ctx->Const.FragmentProgram.MaxNativeAttribs = 11;       /* copy i915... */
@@ -363,6 +381,8 @@ GLboolean r300CreateContext(const __GLcontextModes * glVisual,
        radeonInitSpanFuncs(ctx);
        r300InitCmdBuf(r300);
        r300InitState(r300);
+       if (!(screen->chip_flags & RADEON_CHIPSET_TCL))
+               r300InitSwtcl(ctx);
 
        TNL_CONTEXT(ctx)->Driver.RunPipeline = _tnl_run_pipeline;