Added pipe->get_paramf() to query float limits.
authorBrian <brian.paul@tungstengraphics.com>
Thu, 8 Nov 2007 15:22:42 +0000 (08:22 -0700)
committerBrian <brian.paul@tungstengraphics.com>
Thu, 8 Nov 2007 15:48:14 +0000 (08:48 -0700)
So far max point size, line width, texture anistopy and lod bias.

src/mesa/pipe/failover/fo_context.c
src/mesa/pipe/i915simple/i915_context.c
src/mesa/pipe/p_context.h
src/mesa/pipe/p_defines.h
src/mesa/pipe/softpipe/sp_context.c
src/mesa/state_tracker/st_extensions.c

index e18b349ef3e0babe9684fd98a5fb171cde7f1b71..c5fab73fb137dcfd8a93d1a9f67436c24be7917d 100644 (file)
@@ -120,6 +120,7 @@ struct pipe_context *failover_create( struct pipe_context *hw,
    failover->pipe.get_name = hw->get_name;
    failover->pipe.get_vendor = hw->get_vendor;
    failover->pipe.get_param = hw->get_param;
+   failover->pipe.get_paramf = hw->get_paramf;
 
    failover->pipe.draw_arrays = failover_draw_arrays;
    failover->pipe.draw_elements = failover_draw_elements;
index 50503a843a3832fff52e9825b9560353e8706082..11be13705f95a13e689cbd562d0ea757a0368a17 100644 (file)
@@ -144,6 +144,32 @@ i915_get_param(struct pipe_context *pipe, int param)
 }
 
 
+static float
+i915_get_paramf(struct pipe_context *pipe, int param)
+{
+   switch (param) {
+   case PIPE_CAP_MAX_LINE_WIDTH:
+      /* fall-through */
+   case PIPE_CAP_MAX_LINE_WIDTH_AA:
+      return 7.5;
+
+   case PIPE_CAP_MAX_POINT_WIDTH:
+      /* fall-through */
+   case PIPE_CAP_MAX_POINT_WIDTH_AA:
+      return 255.0;
+
+   case PIPE_CAP_MAX_TEXTURE_ANISOTROPY:
+      return 0.0;
+
+   case PIPE_CAP_MAX_TEXTURE_LOD_BIAS:
+      return 16.0;
+
+   default:
+      return 0;
+   }
+}
+
+
 static void i915_destroy( struct pipe_context *pipe )
 {
    struct i915_context *i915 = i915_context( pipe );
@@ -301,6 +327,7 @@ struct pipe_context *i915_create( struct pipe_winsys *pipe_winsys,
    i915->pipe.destroy = i915_destroy;
    i915->pipe.is_format_supported = i915_is_format_supported;
    i915->pipe.get_param = i915_get_param;
+   i915->pipe.get_paramf = i915_get_paramf;
 
    i915->pipe.clear = i915_clear;
 
index 48356bd0e643a5b6df19ad23787985377228f937..8bed958feb38fd5e1f422ef6ff3e393d0fd3fd41 100644 (file)
@@ -58,6 +58,7 @@ struct pipe_context {
    const char *(*get_vendor)( struct pipe_context *pipe );
 
    int (*get_param)( struct pipe_context *pipe, int param );
+   float (*get_paramf)( struct pipe_context *pipe, int param );
 
 
    /*
index 6b5881b64db50288a365c3da2734c47b817844c6..a85360548619ee68995d37bbb2cd9a6c0e6eb2e7 100644 (file)
 #define PIPE_CAP_MAX_TEXTURE_2D_LEVELS   11
 #define PIPE_CAP_MAX_TEXTURE_3D_LEVELS   12
 #define PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS 13
+#define PIPE_CAP_MAX_LINE_WIDTH          14
+#define PIPE_CAP_MAX_LINE_WIDTH_AA       15
+#define PIPE_CAP_MAX_POINT_WIDTH         16
+#define PIPE_CAP_MAX_POINT_WIDTH_AA      17
+#define PIPE_CAP_MAX_TEXTURE_ANISOTROPY  18
+#define PIPE_CAP_MAX_TEXTURE_LOD_BIAS    19
+
 
 #endif
index 09c5a7152dcfa680a682208542795b4fc1f81667..be4da0ec64a23273bec7bb6a8b63014f4ba21ac3 100644 (file)
@@ -251,6 +251,30 @@ static int softpipe_get_param(struct pipe_context *pipe, int param)
    }
 }
 
+static float softpipe_get_paramf(struct pipe_context *pipe, int param)
+{
+   switch (param) {
+   case PIPE_CAP_MAX_LINE_WIDTH:
+      /* fall-through */
+   case PIPE_CAP_MAX_LINE_WIDTH_AA:
+      return 255.0; /* arbitrary */
+
+   case PIPE_CAP_MAX_POINT_WIDTH:
+      /* fall-through */
+   case PIPE_CAP_MAX_POINT_WIDTH_AA:
+      return 255.0; /* arbitrary */
+
+   case PIPE_CAP_MAX_TEXTURE_ANISOTROPY:
+      return 0.0;
+
+   case PIPE_CAP_MAX_TEXTURE_LOD_BIAS:
+      return 16.0; /* arbitrary */
+
+   default:
+      return 0;
+   }
+}
+
 struct pipe_context *softpipe_create( struct pipe_winsys *pipe_winsys,
                                      struct softpipe_winsys *softpipe_winsys )
 {
@@ -270,8 +294,8 @@ struct pipe_context *softpipe_create( struct pipe_winsys *pipe_winsys,
 
    /* queries */
    softpipe->pipe.is_format_supported = softpipe_is_format_supported;
-   //softpipe->pipe.max_texture_size = softpipe_max_texture_size;
    softpipe->pipe.get_param = softpipe_get_param;
+   softpipe->pipe.get_paramf = softpipe_get_paramf;
 
    /* state setters */
    softpipe->pipe.create_alpha_test_state = softpipe_create_alpha_test_state;
index fc003d47764f5313f7c34dfc2c6415b8f475345a..97578e50027103537a7b86e7de0cb11301a7d02c 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);
 }