diff options
author | Brian <[email protected]> | 2007-11-08 08:22:42 -0700 |
---|---|---|
committer | Brian <[email protected]> | 2007-11-08 08:48:14 -0700 |
commit | 44254b92480115e5c8a2d5cf78f99195c03701eb (patch) | |
tree | 086564302fdb3ac15ef1bf25c5da44a11fc42e5b /src | |
parent | 95128c1d4c88238a79ead6e36215a646f83bbdd3 (diff) |
Added pipe->get_paramf() to query float limits.
So far max point size, line width, texture anistopy and lod bias.
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/pipe/failover/fo_context.c | 1 | ||||
-rw-r--r-- | src/mesa/pipe/i915simple/i915_context.c | 27 | ||||
-rw-r--r-- | src/mesa/pipe/p_context.h | 1 | ||||
-rw-r--r-- | src/mesa/pipe/p_defines.h | 7 | ||||
-rw-r--r-- | src/mesa/pipe/softpipe/sp_context.c | 26 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_extensions.c | 21 |
6 files changed, 82 insertions, 1 deletions
diff --git a/src/mesa/pipe/failover/fo_context.c b/src/mesa/pipe/failover/fo_context.c index e18b349ef3e..c5fab73fb13 100644 --- a/src/mesa/pipe/failover/fo_context.c +++ b/src/mesa/pipe/failover/fo_context.c @@ -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; diff --git a/src/mesa/pipe/i915simple/i915_context.c b/src/mesa/pipe/i915simple/i915_context.c index 50503a843a3..11be13705f9 100644 --- a/src/mesa/pipe/i915simple/i915_context.c +++ b/src/mesa/pipe/i915simple/i915_context.c @@ -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; diff --git a/src/mesa/pipe/p_context.h b/src/mesa/pipe/p_context.h index 48356bd0e64..8bed958feb3 100644 --- a/src/mesa/pipe/p_context.h +++ b/src/mesa/pipe/p_context.h @@ -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 ); /* diff --git a/src/mesa/pipe/p_defines.h b/src/mesa/pipe/p_defines.h index 6b5881b64db..a8536054861 100644 --- a/src/mesa/pipe/p_defines.h +++ b/src/mesa/pipe/p_defines.h @@ -250,5 +250,12 @@ #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 diff --git a/src/mesa/pipe/softpipe/sp_context.c b/src/mesa/pipe/softpipe/sp_context.c index 09c5a7152dc..be4da0ec64a 100644 --- a/src/mesa/pipe/softpipe/sp_context.c +++ b/src/mesa/pipe/softpipe/sp_context.c @@ -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; diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c index fc003d47764..97578e50027 100644 --- a/src/mesa/state_tracker/st_extensions.c +++ b/src/mesa/state_tracker/st_extensions.c @@ -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); } |