Merge branch '7.8'
[mesa.git] / src / mesa / state_tracker / st_extensions.c
index ef3cbc53ee0c85d401bf866aa5dfc365c797d3a9..b2045cf3fcbd568aedfd098985ec12f1c9c16bbe 100644 (file)
@@ -28,7 +28,6 @@
 
 #include "main/imports.h"
 #include "main/context.h"
-#include "main/extensions.h"
 #include "main/macros.h"
 
 #include "pipe/p_context.h"
@@ -114,6 +113,15 @@ void st_init_limits(struct st_context *st)
       = _maxf(1.0f, screen->get_paramf(screen, PIPE_CAP_MAX_POINT_WIDTH));
    c->MaxPointSizeAA
       = _maxf(1.0f, screen->get_paramf(screen, PIPE_CAP_MAX_POINT_WIDTH_AA));
+   /* called after _mesa_create_context/_mesa_init_point, fix default user
+    * settable max point size up
+    */
+   st->ctx->Point.MaxSize = MAX2(c->MaxPointSize, c->MaxPointSizeAA);
+   /* these are not queryable. Note that GL basically mandates a 1.0 minimum
+    * for non-aa sizes, but we can go down to 0.0 for aa points.
+    */
+   c->MinPointSize = 1.0f;
+   c->MinPointSizeAA = 0.0f;
 
    c->MaxTextureMaxAnisotropy
       = _maxf(2.0f, screen->get_paramf(screen, PIPE_CAP_MAX_TEXTURE_ANISOTROPY));
@@ -129,6 +137,9 @@ void st_init_limits(struct st_context *st)
    /* XXX separate query for early function return? */
    st->ctx->Shader.EmitContReturn =
       screen->get_param(screen, PIPE_CAP_TGSI_CONT_SUPPORTED);
+
+   /* Quads always follow GL provoking rules. */
+   c->QuadsFollowProvokingVertexConvention = GL_FALSE;
 }
 
 
@@ -148,6 +159,7 @@ void st_init_extensions(struct st_context *st)
     * Extensions that are supported by all Gallium drivers:
     */
    ctx->Extensions.ARB_copy_buffer = GL_TRUE;
+   ctx->Extensions.ARB_fragment_coord_conventions = GL_TRUE;
    ctx->Extensions.ARB_fragment_program = GL_TRUE;
    ctx->Extensions.ARB_map_buffer_range = GL_TRUE;
    ctx->Extensions.ARB_multisample = GL_TRUE;
@@ -160,6 +172,7 @@ void st_init_extensions(struct st_context *st)
    ctx->Extensions.ARB_vertex_array_object = GL_TRUE;
    ctx->Extensions.ARB_vertex_buffer_object = GL_TRUE;
    ctx->Extensions.ARB_vertex_program = GL_TRUE;
+   ctx->Extensions.ARB_window_pos = GL_TRUE;
 
    ctx->Extensions.EXT_blend_color = GL_TRUE;
    ctx->Extensions.EXT_blend_func_separate = GL_TRUE;
@@ -168,7 +181,9 @@ void st_init_extensions(struct st_context *st)
    ctx->Extensions.EXT_blend_subtract = GL_TRUE;
    ctx->Extensions.EXT_framebuffer_blit = GL_TRUE;
    ctx->Extensions.EXT_framebuffer_object = GL_TRUE;
+   ctx->Extensions.EXT_framebuffer_multisample = GL_TRUE;
    ctx->Extensions.EXT_fog_coord = GL_TRUE;
+   ctx->Extensions.EXT_gpu_program_parameters = GL_TRUE;
    ctx->Extensions.EXT_multi_draw_arrays = GL_TRUE;
    ctx->Extensions.EXT_pixel_buffer_object = GL_TRUE;
    ctx->Extensions.EXT_point_parameters = GL_TRUE;
@@ -183,9 +198,24 @@ void st_init_extensions(struct st_context *st)
 
    ctx->Extensions.APPLE_vertex_array_object = GL_TRUE;
 
+   ctx->Extensions.MESA_pack_invert = GL_TRUE;
+
    ctx->Extensions.NV_blend_square = GL_TRUE;
    ctx->Extensions.NV_texgen_reflection = GL_TRUE;
    ctx->Extensions.NV_texture_env_combine4 = GL_TRUE;
+   ctx->Extensions.NV_texture_rectangle = GL_TRUE;
+#if 0
+   /* possibly could support the following two */
+   ctx->Extensions.NV_vertex_program = GL_TRUE;
+   ctx->Extensions.NV_vertex_program1_1 = GL_TRUE;
+#endif
+
+#if FEATURE_OES_EGL_image
+   ctx->Extensions.OES_EGL_image = GL_TRUE;
+#endif
+#if FEATURE_OES_draw_texture
+   ctx->Extensions.OES_draw_texture = GL_TRUE;
+#endif
 
    ctx->Extensions.SGI_color_matrix = GL_TRUE;
    ctx->Extensions.SGIS_generate_mipmap = GL_TRUE;
@@ -215,11 +245,11 @@ void st_init_extensions(struct st_context *st)
 
    if (screen->get_param(screen, PIPE_CAP_TEXTURE_MIRROR_CLAMP) > 0) {
       ctx->Extensions.EXT_texture_mirror_clamp = GL_TRUE;
+      ctx->Extensions.ATI_texture_mirror_once = GL_TRUE;
    }
 
    if (screen->get_param(screen, PIPE_CAP_NPOT_TEXTURES)) {
       ctx->Extensions.ARB_texture_non_power_of_two = GL_TRUE;
-      ctx->Extensions.NV_texture_rectangle = GL_TRUE;
    }
 
    if (screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_IMAGE_UNITS) > 1) {
@@ -256,48 +286,52 @@ void st_init_extensions(struct st_context *st)
    /* GL_EXT_packed_depth_stencil requires both the ability to render to
     * a depth/stencil buffer and texture from depth/stencil source.
     */
-   if (screen->is_format_supported(screen, PIPE_FORMAT_Z24S8_UNORM,
+   if (screen->is_format_supported(screen, PIPE_FORMAT_S8_USCALED_Z24_UNORM,
                                    PIPE_TEXTURE_2D, 
-                                   PIPE_TEXTURE_USAGE_DEPTH_STENCIL, 0) &&
-       screen->is_format_supported(screen, PIPE_FORMAT_Z24S8_UNORM,
+                                   PIPE_BIND_DEPTH_STENCIL, 0) &&
+       screen->is_format_supported(screen, PIPE_FORMAT_S8_USCALED_Z24_UNORM,
                                    PIPE_TEXTURE_2D, 
-                                   PIPE_TEXTURE_USAGE_SAMPLER, 0)) {
+                                   PIPE_BIND_SAMPLER_VIEW, 0)) {
       ctx->Extensions.EXT_packed_depth_stencil = GL_TRUE;
    }
-   else if (screen->is_format_supported(screen, PIPE_FORMAT_S8Z24_UNORM,
+   else if (screen->is_format_supported(screen, PIPE_FORMAT_Z24_UNORM_S8_USCALED,
                                         PIPE_TEXTURE_2D, 
-                                        PIPE_TEXTURE_USAGE_DEPTH_STENCIL, 0) &&
-            screen->is_format_supported(screen, PIPE_FORMAT_S8Z24_UNORM,
+                                        PIPE_BIND_DEPTH_STENCIL, 0) &&
+            screen->is_format_supported(screen, PIPE_FORMAT_Z24_UNORM_S8_USCALED,
                                         PIPE_TEXTURE_2D, 
-                                        PIPE_TEXTURE_USAGE_SAMPLER, 0)) {
+                                        PIPE_BIND_SAMPLER_VIEW, 0)) {
       ctx->Extensions.EXT_packed_depth_stencil = GL_TRUE;
    }
 
    /* sRGB support */
-   if (screen->is_format_supported(screen, PIPE_FORMAT_R8G8B8A8_SRGB,
+   if (screen->is_format_supported(screen, PIPE_FORMAT_A8B8G8R8_SRGB,
                                    PIPE_TEXTURE_2D, 
-                                   PIPE_TEXTURE_USAGE_SAMPLER, 0) ||
-      screen->is_format_supported(screen, PIPE_FORMAT_A8R8G8B8_SRGB,
+                                   PIPE_BIND_SAMPLER_VIEW, 0) ||
+      screen->is_format_supported(screen, PIPE_FORMAT_B8G8R8A8_SRGB,
                                    PIPE_TEXTURE_2D, 
-                                   PIPE_TEXTURE_USAGE_SAMPLER, 0)) {
+                                   PIPE_BIND_SAMPLER_VIEW, 0)) {
       ctx->Extensions.EXT_texture_sRGB = GL_TRUE;
    }
 
    /* s3tc support */
    if (screen->is_format_supported(screen, PIPE_FORMAT_DXT5_RGBA,
-                                   PIPE_TEXTURE_2D, 
-                                   PIPE_TEXTURE_USAGE_SAMPLER, 0)) {
+                                   PIPE_TEXTURE_2D,
+                                   PIPE_BIND_SAMPLER_VIEW, 0) &&
+       (ctx->Mesa_DXTn ||
+        screen->is_format_supported(screen, PIPE_FORMAT_DXT5_RGBA,
+                                    PIPE_TEXTURE_2D,
+                                    PIPE_BIND_RENDER_TARGET, 0))) {
       ctx->Extensions.EXT_texture_compression_s3tc = GL_TRUE;
       ctx->Extensions.S3_s3tc = GL_TRUE;
    }
 
    /* ycbcr support */
-   if (screen->is_format_supported(screen, PIPE_FORMAT_YCBCR
+   if (screen->is_format_supported(screen, PIPE_FORMAT_UYVY
                                    PIPE_TEXTURE_2D, 
-                                   PIPE_TEXTURE_USAGE_SAMPLER, 0) ||
-       screen->is_format_supported(screen, PIPE_FORMAT_YCBCR_REV, 
+                                   PIPE_BIND_SAMPLER_VIEW, 0) ||
+       screen->is_format_supported(screen, PIPE_FORMAT_YUYV, 
                                    PIPE_TEXTURE_2D, 
-                                   PIPE_TEXTURE_USAGE_SAMPLER, 0)) {
+                                   PIPE_BIND_SAMPLER_VIEW, 0)) {
       ctx->Extensions.MESA_ycbcr_texture = GL_TRUE;
    }
 
@@ -306,4 +340,18 @@ void st_init_extensions(struct st_context *st)
       /* we support always support GL_EXT_framebuffer_blit */
       ctx->Extensions.ARB_framebuffer_object = GL_TRUE;
    }
+
+   if (st->pipe->render_condition) {
+      ctx->Extensions.NV_conditional_render = GL_TRUE;
+   }
+
+   if (screen->get_param(screen, PIPE_CAP_INDEP_BLEND_ENABLE)) {
+      ctx->Extensions.EXT_draw_buffers2 = GL_TRUE;
+   }
+
+#if 0 /* not yet */
+   if (screen->get_param(screen, PIPE_CAP_INDEP_BLEND_FUNC)) {
+      ctx->Extensions.ARB_draw_buffers_blend = GL_TRUE;
+   }
+#endif
 }