Hide texture layout details from the state tracker.
[mesa.git] / src / mesa / state_tracker / st_extensions.c
index 0707c489a6f59a82d1a6fc936cf2ca398aa2986b..0157bdd6b321a522e147e45d080d0f9360a38416 100644 (file)
@@ -42,6 +42,11 @@ static int min(int a, int b)
    return (a < b) ? a : b;
 }
 
+static int max(int a, int b)
+{
+   return (a > b) ? a : b;
+}
+
 static int clamp(int a, int min, int max)
 {
    if (a < min)
@@ -85,6 +90,22 @@ void st_init_limits(struct st_context *st)
    c->MaxDrawBuffers
       = clamp(pipe->get_param(pipe, PIPE_CAP_MAX_RENDER_TARGETS),
               1, MAX_DRAW_BUFFERS);
+
+   c->MaxLineWidth
+      = max(1.0, pipe->get_paramf(pipe, PIPE_CAP_MAX_LINE_WIDTH));
+   c->MaxLineWidthAA
+      = max(1.0, pipe->get_paramf(pipe, PIPE_CAP_MAX_LINE_WIDTH_AA));
+
+   c->MaxPointSize
+      = max(1.0, pipe->get_paramf(pipe, PIPE_CAP_MAX_POINT_WIDTH));
+   c->MaxPointSizeAA
+      = max(1.0, pipe->get_paramf(pipe, PIPE_CAP_MAX_POINT_WIDTH_AA));
+
+   c->MaxTextureMaxAnisotropy
+      = max(2.0, pipe->get_paramf(pipe, PIPE_CAP_MAX_TEXTURE_ANISOTROPY));
+
+   c->MaxTextureLodBias
+      = pipe->get_paramf(pipe, PIPE_CAP_MAX_TEXTURE_LOD_BIAS);
 }
 
 
@@ -99,11 +120,16 @@ void st_init_extensions(struct st_context *st)
    /*
     * Extensions that are supported by all Gallium drivers:
     */
+   ctx->Extensions.ARB_multisample = GL_TRUE; /* API support */
    ctx->Extensions.ARB_fragment_program = GL_TRUE;
+   ctx->Extensions.ARB_texture_border_clamp = GL_TRUE; /* XXX temp */
+   ctx->Extensions.ARB_texture_compression = GL_TRUE; /* API support only */
    ctx->Extensions.ARB_texture_cube_map = GL_TRUE;
    ctx->Extensions.ARB_texture_env_combine = GL_TRUE;
    ctx->Extensions.ARB_texture_env_crossbar = GL_TRUE;
    ctx->Extensions.ARB_texture_env_dot3 = GL_TRUE;
+   ctx->Extensions.ARB_texture_mirrored_repeat = GL_TRUE; /* XXX temp */
+
    ctx->Extensions.ARB_vertex_program = GL_TRUE;
    ctx->Extensions.ARB_vertex_buffer_object = GL_TRUE;
 
@@ -124,19 +150,21 @@ void st_init_extensions(struct st_context *st)
    ctx->Extensions.EXT_texture_env_combine = GL_TRUE;
    ctx->Extensions.EXT_texture_env_dot3 = GL_TRUE;
    ctx->Extensions.EXT_texture_lod_bias = GL_TRUE;
+   ctx->Extensions.EXT_texture_sRGB = GL_TRUE; /* XXX temp */
 
    ctx->Extensions.NV_blend_square = GL_TRUE;
    ctx->Extensions.NV_texgen_reflection = GL_TRUE;
 
+   ctx->Extensions.SGIS_generate_mipmap = GL_TRUE; /* XXX temp */
 
    /*
     * Extensions that depend on the driver/hardware:
     */
-   if (pipe->get_param(pipe, PIPE_CAP_MAX_RENDER_TARGETS) > 1) {
+   if (pipe->get_param(pipe, PIPE_CAP_MAX_RENDER_TARGETS) > 0) {
       ctx->Extensions.ARB_draw_buffers = GL_TRUE;
    }
 
-   if (pipe->get_param(pipe, PIPE_CAP_GLSL) > 1) {
+   if (pipe->get_param(pipe, PIPE_CAP_GLSL)) {
       ctx->Extensions.ARB_fragment_shader = GL_TRUE;
       ctx->Extensions.ARB_vertex_shader = GL_TRUE;
       ctx->Extensions.ARB_shader_objects = GL_TRUE;
@@ -153,12 +181,11 @@ void st_init_extensions(struct st_context *st)
       ctx->Extensions.ARB_multitexture = GL_TRUE;
    }
 
-   if (pipe->get_param(pipe, PIPE_CAP_TWO_SIDED_STENCIL) > 1) {
+   if (pipe->get_param(pipe, PIPE_CAP_TWO_SIDED_STENCIL)) {
       ctx->Extensions.ATI_separate_stencil = GL_TRUE;
    }
 
-   if (pipe->get_param(pipe, PIPE_CAP_S3TC) > 1) {
-      ctx->Extensions.ARB_texture_compression = GL_TRUE;
+   if (pipe->get_param(pipe, PIPE_CAP_S3TC)) {
       ctx->Extensions.EXT_texture_compression_s3tc = GL_TRUE;
    }
 
@@ -168,15 +195,17 @@ void st_init_extensions(struct st_context *st)
 
    if (pipe->get_param(pipe, PIPE_CAP_POINT_SPRITE)) {
       ctx->Extensions.ARB_point_sprite = GL_TRUE;
+      ctx->Extensions.NV_point_sprite = GL_TRUE;
    }
 
-   if (pipe->get_param(pipe, PIPE_CAP_OCCLUSION_QUERY) > 1) {
+   if (pipe->get_param(pipe, PIPE_CAP_OCCLUSION_QUERY)) {
       ctx->Extensions.ARB_occlusion_query = GL_TRUE;
    }
 
-   if (pipe->get_param(pipe, PIPE_CAP_TEXTURE_SHADOW_MAP) > 1) {
+   if (pipe->get_param(pipe, PIPE_CAP_TEXTURE_SHADOW_MAP)) {
       ctx->Extensions.ARB_depth_texture = GL_TRUE;
       ctx->Extensions.ARB_shadow = GL_TRUE;
+      ctx->Extensions.EXT_shadow_funcs = GL_TRUE;
       /*ctx->Extensions.ARB_shadow_ambient = GL_TRUE;*/
    }