From e2feb80a90f3e9300c70a4a4eb3e966131f5c313 Mon Sep 17 00:00:00 2001 From: Brian Date: Tue, 6 Nov 2007 09:41:45 -0700 Subject: Remove pipe->max_texture_size(), use get_param() instead. Also, in st_init_limits(), clamp driver's values against Mesa's internal limits. --- src/mesa/pipe/failover/fo_context.c | 2 +- src/mesa/pipe/i915simple/i915_context.c | 37 +++++------------------------ src/mesa/pipe/p_context.h | 6 ----- src/mesa/pipe/p_defines.h | 5 +++- src/mesa/pipe/softpipe/sp_context.c | 41 ++++++--------------------------- 5 files changed, 18 insertions(+), 73 deletions(-) (limited to 'src/mesa/pipe') diff --git a/src/mesa/pipe/failover/fo_context.c b/src/mesa/pipe/failover/fo_context.c index aa5d0885e6..e18b349ef3 100644 --- a/src/mesa/pipe/failover/fo_context.c +++ b/src/mesa/pipe/failover/fo_context.c @@ -117,9 +117,9 @@ struct pipe_context *failover_create( struct pipe_context *hw, failover->pipe.winsys = hw->winsys; failover->pipe.destroy = failover_destroy; failover->pipe.is_format_supported = hw->is_format_supported; - failover->pipe.max_texture_size = hw->max_texture_size; failover->pipe.get_name = hw->get_name; failover->pipe.get_vendor = hw->get_vendor; + failover->pipe.get_param = hw->get_param; 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 6de1e68f73..50503a843a 100644 --- a/src/mesa/pipe/i915simple/i915_context.c +++ b/src/mesa/pipe/i915simple/i915_context.c @@ -108,36 +108,6 @@ i915_is_format_supported( struct pipe_context *pipe, } -/** - * We might want to return max texture levels instead... - */ -static void -i915_max_texture_size(struct pipe_context *pipe, unsigned textureType, - unsigned *maxWidth, unsigned *maxHeight, unsigned *maxDepth) -{ - switch (textureType) { - case PIPE_TEXTURE_1D: - *maxWidth = 2048; - break; - case PIPE_TEXTURE_2D: - *maxWidth = - *maxHeight = 2048; - break; - case PIPE_TEXTURE_3D: - *maxWidth = - *maxHeight = - *maxDepth = 256; - break; - case PIPE_TEXTURE_CUBE: - *maxWidth = - *maxHeight = 2048; - break; - default: - assert(0); - } -} - - static int i915_get_param(struct pipe_context *pipe, int param) { @@ -162,6 +132,12 @@ i915_get_param(struct pipe_context *pipe, int param) return 0; case PIPE_CAP_TEXTURE_SHADOW_MAP: return 0; + case PIPE_CAP_MAX_TEXTURE_2D_LEVELS: + return 11; /* max 1024x1024 */ + case PIPE_CAP_MAX_TEXTURE_3D_LEVELS: + return 8; /* max 128x128x128 */ + case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS: + return 11; /* max 1024x1024 */ default: return 0; } @@ -324,7 +300,6 @@ 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.max_texture_size = i915_max_texture_size; i915->pipe.get_param = i915_get_param; i915->pipe.clear = i915_clear; diff --git a/src/mesa/pipe/p_context.h b/src/mesa/pipe/p_context.h index 4f5e786334..ddc7acc747 100644 --- a/src/mesa/pipe/p_context.h +++ b/src/mesa/pipe/p_context.h @@ -51,12 +51,6 @@ struct pipe_context { boolean (*is_format_supported)( struct pipe_context *pipe, uint format ); - void (*max_texture_size)(struct pipe_context *pipe, - unsigned textureType, /* PIPE_TEXTURE_x */ - unsigned *maxWidth, - unsigned *maxHeight, - unsigned *maxDepth); - const char *(*get_name)( struct pipe_context *pipe ); const char *(*get_vendor)( struct pipe_context *pipe ); diff --git a/src/mesa/pipe/p_defines.h b/src/mesa/pipe/p_defines.h index cc0232cdcd..ca9929bfee 100644 --- a/src/mesa/pipe/p_defines.h +++ b/src/mesa/pipe/p_defines.h @@ -245,6 +245,9 @@ #define PIPE_CAP_POINT_SPRITE 7 #define PIPE_CAP_MAX_RENDER_TARGETS 8 #define PIPE_CAP_OCCLUSION_QUERY 9 -#define PIPE_CAP_TEXTURE_SHADOW_MAP 10 +#define PIPE_CAP_TEXTURE_SHADOW_MAP 10 +#define PIPE_CAP_MAX_TEXTURE_2D_LEVELS 11 +#define PIPE_CAP_MAX_TEXTURE_3D_LEVELS 12 +#define PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS 13 #endif diff --git a/src/mesa/pipe/softpipe/sp_context.c b/src/mesa/pipe/softpipe/sp_context.c index effecda87e..954884e7e9 100644 --- a/src/mesa/pipe/softpipe/sp_context.c +++ b/src/mesa/pipe/softpipe/sp_context.c @@ -83,39 +83,6 @@ softpipe_is_format_supported( struct pipe_context *pipe, } -/** XXX remove these? */ -#define MAX_TEXTURE_LEVELS 11 -#define MAX_TEXTURE_RECT_SIZE 2048 -#define MAX_3D_TEXTURE_LEVELS 8 - -static void -softpipe_max_texture_size(struct pipe_context *pipe, unsigned textureType, - unsigned *maxWidth, unsigned *maxHeight, - unsigned *maxDepth) -{ - switch (textureType) { - case PIPE_TEXTURE_1D: - *maxWidth = 1 << (MAX_TEXTURE_LEVELS - 1); - break; - case PIPE_TEXTURE_2D: - *maxWidth = - *maxHeight = 1 << (MAX_TEXTURE_LEVELS - 1); - break; - case PIPE_TEXTURE_3D: - *maxWidth = - *maxHeight = - *maxDepth = 1 << (MAX_3D_TEXTURE_LEVELS - 1); - break; - case PIPE_TEXTURE_CUBE: - *maxWidth = - *maxHeight = MAX_TEXTURE_RECT_SIZE; - break; - default: - assert(0); - } -} - - /** * Map any drawing surfaces which aren't already mapped */ @@ -297,6 +264,12 @@ static int softpipe_get_param(struct pipe_context *pipe, int param) return 1; case PIPE_CAP_TEXTURE_SHADOW_MAP: return 1; + case PIPE_CAP_MAX_TEXTURE_2D_LEVELS: + return 12; /* max 2Kx2K */ + case PIPE_CAP_MAX_TEXTURE_3D_LEVELS: + return 8; /* max 128x128x128 */ + case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS: + return 12; /* max 2Kx2K */ default: return 0; } @@ -321,7 +294,7 @@ 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.max_texture_size = softpipe_max_texture_size; softpipe->pipe.get_param = softpipe_get_param; /* state setters */ -- cgit v1.2.3