Merge branch 'lp-offset-twoside'
[mesa.git] / src / mesa / drivers / dri / r600 / r600_context.c
index b0a79c7b5987ceb6c248b2ab931b4382803468dc..b6443bf0c535153b5335154f729448157e74074d 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/points.h"
 
 #include "swrast/swrast.h"
 #include "swrast_setup/swrast_setup.h"
@@ -93,6 +94,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"
 
@@ -145,9 +147,11 @@ static const struct dri_extension card_extensions[] = {
   {"GL_MESAX_texture_float",           NULL},
   {"GL_NV_blend_square",               NULL},
   {"GL_NV_vertex_program",             GL_NV_vertex_program_functions},
-  {"GL_SGIS_generate_mipmap",          NULL},
   {"GL_ARB_pixel_buffer_object",        NULL},
   {"GL_ARB_draw_elements_base_vertex", GL_ARB_draw_elements_base_vertex_functions },
+#if FEATURE_OES_EGL_image
+  {"GL_OES_EGL_image",                 GL_OES_EGL_image_functions},
+#endif
   {NULL,                               NULL}
   /* *INDENT-ON* */
 };
@@ -165,7 +169,6 @@ static const struct dri_extension mm_extensions[] = {
 static const struct dri_extension gl_20_extension[] = {
 #ifdef R600_ENABLE_GLSL_TEST
     {"GL_ARB_shading_language_100",                    GL_VERSION_2_0_functions },
-    {"GL_ARB_shading_language_120",                    GL_VERSION_2_1_functions },
 #else
   {"GL_VERSION_2_0",                   GL_VERSION_2_0_functions },
 #endif /* R600_ENABLE_GLSL_TEST */
@@ -209,7 +212,7 @@ static void r600_vtbl_pre_emit_atoms(radeonContextPtr radeon)
        r700Start3D((context_t *)radeon);
 }
 
-static void r600_fallback(GLcontext *ctx, GLuint bit, GLboolean mode)
+static void r600_fallback(struct gl_context *ctx, GLuint bit, GLboolean mode)
 {
        context_t *context = R700_CONTEXT(ctx);
        if (mode)
@@ -227,7 +230,7 @@ static void r600_emit_query_finish(radeonContextPtr radeon)
 
        BEGIN_BATCH_NO_AUTOSTATE(4 + 2);
        R600_OUT_BATCH(CP_PACKET3(R600_IT_EVENT_WRITE, 2));
-       R600_OUT_BATCH(ZPASS_DONE);
+       R600_OUT_BATCH(R600_EVENT_TYPE(ZPASS_DONE) | R600_EVENT_INDEX(1));
        R600_OUT_BATCH(query->curr_offset + 8); /* hw writes qwords */
        R600_OUT_BATCH(0x00000000);
        R600_OUT_BATCH_RELOC(VGT_EVENT_INITIATOR, query->bo, 0, 0, RADEON_GEM_DOMAIN_GTT, 0);
@@ -250,7 +253,7 @@ static void r600_init_vtbl(radeonContextPtr radeon)
        radeon->vtbl.is_format_renderable = r600IsFormatRenderable;
 }
 
-static void r600InitConstValues(GLcontext *ctx, radeonScreenPtr screen)
+static void r600InitConstValues(struct gl_context *ctx, radeonScreenPtr screen)
 {
     context_t         *context = R700_CONTEXT(ctx);
     R700_CHIP_CONTEXT *r700    = (R700_CHIP_CONTEXT*)(&context->hw);
@@ -265,6 +268,8 @@ static void r600InitConstValues(GLcontext *ctx, radeonScreenPtr screen)
         r700->bShaderUseMemConstant = GL_FALSE;
     }
 
+        ctx->Const.GLSLVersion = 120;
+
        ctx->Const.MaxTextureImageUnits = 16;
        /* 8 per clause on r6xx, 16 on r7xx
         * but I think mesa only supports 8 at the moment
@@ -334,7 +339,7 @@ static void r600ParseOptions(context_t *r600, radeonScreenPtr screen)
 
 }
 
-static void r600InitGLExtensions(GLcontext *ctx)
+static void r600InitGLExtensions(struct gl_context *ctx)
 {
        context_t *r600 = R700_CONTEXT(ctx);
 #ifdef R600_ENABLE_GLSL_TEST
@@ -379,7 +384,7 @@ static void r600InitGLExtensions(GLcontext *ctx)
 /* Create the device specific rendering context.
  */
 GLboolean r600CreateContext(gl_api api,
-                           const __GLcontextModes * glVisual,
+                           const struct gl_config * glVisual,
                            __DRIcontext * driContextPriv,
                            void *sharedContextPrivate)
 {
@@ -387,7 +392,7 @@ GLboolean r600CreateContext(gl_api api,
        radeonScreenPtr screen = (radeonScreenPtr) (sPriv->private);
        struct dd_function_table functions;
        context_t *r600;
-       GLcontext *ctx;
+       struct gl_context *ctx;
 
        assert(glVisual);
        assert(driContextPriv);
@@ -459,6 +464,9 @@ GLboolean r600CreateContext(gl_api api,
 
        r600InitConstValues(ctx, screen);
 
+       /* reinit, it depends on consts above */
+       _mesa_init_point(ctx);
+
        _mesa_set_mvp_with_dp4( ctx, GL_TRUE );
 
        /* Initialize the software rasterizer and helper modules.