Merge remote-tracking branch 'origin/master' into pipe-video
[mesa.git] / src / mesa / drivers / dri / r300 / r300_context.c
index 4dce454c3a757aab7b511ec2d0a4904a2004b662..213d3c060a689bfe980ed1e8a16534ec7e235e6a 100644 (file)
@@ -43,6 +43,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "main/extensions.h"
 #include "main/bufferobj.h"
 #include "main/texobj.h"
+#include "main/mfeatures.h"
 
 #include "swrast/swrast.h"
 #include "swrast_setup/swrast_setup.h"
@@ -86,6 +87,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #define need_GL_EXT_stencil_two_side
 #define need_GL_ATI_separate_stencil
 #define need_GL_NV_vertex_program
+#define need_GL_OES_EGL_image
 
 #include "main/remap_helper.h"
 
@@ -131,10 +133,11 @@ static const struct dri_extension card_extensions[] = {
   {"GL_ATI_texture_mirror_once",       NULL},
   {"GL_MESA_pack_invert",              NULL},
   {"GL_MESA_ycbcr_texture",            NULL},
-  {"GL_MESAX_texture_float",           NULL},
   {"GL_NV_blend_square",               NULL},
   {"GL_NV_vertex_program",             GL_NV_vertex_program_functions},
-  {"GL_SGIS_generate_mipmap",          NULL},
+#if FEATURE_OES_EGL_image
+  {"GL_OES_EGL_image",                  GL_OES_EGL_image_functions },
+#endif
   {NULL,                               NULL}
   /* *INDENT-ON* */
 };
@@ -220,7 +223,7 @@ static void r300_vtbl_pre_emit_atoms(radeonContextPtr radeon)
        end_3d(radeon);
 }
 
-static void r300_fallback(GLcontext *ctx, GLuint bit, GLboolean mode)
+static void r300_fallback(struct gl_context *ctx, GLuint bit, GLboolean mode)
 {
        r300ContextPtr r300 = R300_CONTEXT(ctx);
        if (mode)
@@ -332,7 +335,7 @@ static void r300_init_vtbl(radeonContextPtr radeon)
        }
 }
 
-static void r300InitConstValues(GLcontext *ctx, radeonScreenPtr screen)
+static void r300InitConstValues(struct gl_context *ctx, radeonScreenPtr screen)
 {
        r300ContextPtr r300 = R300_CONTEXT(ctx);
 
@@ -376,13 +379,12 @@ static void r300InitConstValues(GLcontext *ctx, radeonScreenPtr screen)
        ctx->Const.MaxDrawBuffers = 1;
        ctx->Const.MaxColorAttachments = 1;
 
-       /* currently bogus data */
        if (r300->options.hw_tcl_enabled) {
-               ctx->Const.VertexProgram.MaxNativeInstructions = VSF_MAX_FRAGMENT_LENGTH / 4;
-               ctx->Const.VertexProgram.MaxNativeAluInstructions = VSF_MAX_FRAGMENT_LENGTH / 4;
-               ctx->Const.VertexProgram.MaxNativeAttribs = 16; /* r420 */
+               ctx->Const.VertexProgram.MaxNativeInstructions = 255;
+               ctx->Const.VertexProgram.MaxNativeAluInstructions = 255;
+               ctx->Const.VertexProgram.MaxNativeAttribs = 16;
                ctx->Const.VertexProgram.MaxNativeTemps = 32;
-               ctx->Const.VertexProgram.MaxNativeParameters = 256;     /* r420 */
+               ctx->Const.VertexProgram.MaxNativeParameters = 256;
                ctx->Const.VertexProgram.MaxNativeAddressRegs = 1;
        }
 
@@ -441,7 +443,7 @@ static void r300ParseOptions(r300ContextPtr r300, radeonScreenPtr screen)
        r300->options = options;
 }
 
-static void r300InitGLExtensions(GLcontext *ctx)
+static void r300InitGLExtensions(struct gl_context *ctx)
 {
        r300ContextPtr r300 = R300_CONTEXT(ctx);
 
@@ -462,7 +464,7 @@ static void r300InitGLExtensions(GLcontext *ctx)
        if (!r300->radeon.radeonScreen->drmSupportsOcclusionQueries) {
                _mesa_disable_extension(ctx, "GL_ARB_occlusion_query");
        }
-       if (r300->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV350)
+        if (r300->radeon.radeonScreen->chip_family >= CHIP_FAMILY_R420)
                _mesa_enable_extension(ctx, "GL_ARB_half_float_vertex");
 
        if (r300->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV515)
@@ -478,7 +480,8 @@ static void r300InitIoctlFuncs(struct dd_function_table *functions)
 
 /* Create the device specific rendering context.
  */
-GLboolean r300CreateContext(const __GLcontextModes * glVisual,
+GLboolean r300CreateContext(gl_api api,
+                           const struct gl_config * glVisual,
                            __DRIcontext * driContextPriv,
                            void *sharedContextPrivate)
 {
@@ -486,7 +489,7 @@ GLboolean r300CreateContext(const __GLcontextModes * glVisual,
        radeonScreenPtr screen = (radeonScreenPtr) (sPriv->private);
        struct dd_function_table functions;
        r300ContextPtr r300;
-       GLcontext *ctx;
+       struct gl_context *ctx;
 
        assert(glVisual);
        assert(driContextPriv);