Added pipe->get_paramf() to query float limits.
So far max point size, line width, texture anistopy and lod bias.
This commit is contained in:
@@ -120,6 +120,7 @@ struct pipe_context *failover_create( struct pipe_context *hw,
|
|||||||
failover->pipe.get_name = hw->get_name;
|
failover->pipe.get_name = hw->get_name;
|
||||||
failover->pipe.get_vendor = hw->get_vendor;
|
failover->pipe.get_vendor = hw->get_vendor;
|
||||||
failover->pipe.get_param = hw->get_param;
|
failover->pipe.get_param = hw->get_param;
|
||||||
|
failover->pipe.get_paramf = hw->get_paramf;
|
||||||
|
|
||||||
failover->pipe.draw_arrays = failover_draw_arrays;
|
failover->pipe.draw_arrays = failover_draw_arrays;
|
||||||
failover->pipe.draw_elements = failover_draw_elements;
|
failover->pipe.draw_elements = failover_draw_elements;
|
||||||
|
@@ -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 )
|
static void i915_destroy( struct pipe_context *pipe )
|
||||||
{
|
{
|
||||||
struct i915_context *i915 = i915_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.destroy = i915_destroy;
|
||||||
i915->pipe.is_format_supported = i915_is_format_supported;
|
i915->pipe.is_format_supported = i915_is_format_supported;
|
||||||
i915->pipe.get_param = i915_get_param;
|
i915->pipe.get_param = i915_get_param;
|
||||||
|
i915->pipe.get_paramf = i915_get_paramf;
|
||||||
|
|
||||||
i915->pipe.clear = i915_clear;
|
i915->pipe.clear = i915_clear;
|
||||||
|
|
||||||
|
@@ -58,6 +58,7 @@ struct pipe_context {
|
|||||||
const char *(*get_vendor)( struct pipe_context *pipe );
|
const char *(*get_vendor)( struct pipe_context *pipe );
|
||||||
|
|
||||||
int (*get_param)( struct pipe_context *pipe, int param );
|
int (*get_param)( struct pipe_context *pipe, int param );
|
||||||
|
float (*get_paramf)( struct pipe_context *pipe, int param );
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@@ -250,5 +250,12 @@
|
|||||||
#define PIPE_CAP_MAX_TEXTURE_2D_LEVELS 11
|
#define PIPE_CAP_MAX_TEXTURE_2D_LEVELS 11
|
||||||
#define PIPE_CAP_MAX_TEXTURE_3D_LEVELS 12
|
#define PIPE_CAP_MAX_TEXTURE_3D_LEVELS 12
|
||||||
#define PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS 13
|
#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
|
#endif
|
||||||
|
@@ -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 pipe_context *softpipe_create( struct pipe_winsys *pipe_winsys,
|
||||||
struct softpipe_winsys *softpipe_winsys )
|
struct softpipe_winsys *softpipe_winsys )
|
||||||
{
|
{
|
||||||
@@ -270,8 +294,8 @@ struct pipe_context *softpipe_create( struct pipe_winsys *pipe_winsys,
|
|||||||
|
|
||||||
/* queries */
|
/* queries */
|
||||||
softpipe->pipe.is_format_supported = softpipe_is_format_supported;
|
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_param = softpipe_get_param;
|
||||||
|
softpipe->pipe.get_paramf = softpipe_get_paramf;
|
||||||
|
|
||||||
/* state setters */
|
/* state setters */
|
||||||
softpipe->pipe.create_alpha_test_state = softpipe_create_alpha_test_state;
|
softpipe->pipe.create_alpha_test_state = softpipe_create_alpha_test_state;
|
||||||
|
@@ -42,6 +42,11 @@ static int min(int a, int b)
|
|||||||
return (a < b) ? a : 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)
|
static int clamp(int a, int min, int max)
|
||||||
{
|
{
|
||||||
if (a < min)
|
if (a < min)
|
||||||
@@ -85,6 +90,22 @@ void st_init_limits(struct st_context *st)
|
|||||||
c->MaxDrawBuffers
|
c->MaxDrawBuffers
|
||||||
= clamp(pipe->get_param(pipe, PIPE_CAP_MAX_RENDER_TARGETS),
|
= clamp(pipe->get_param(pipe, PIPE_CAP_MAX_RENDER_TARGETS),
|
||||||
1, MAX_DRAW_BUFFERS);
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user