From e1238b5cad3845c029f60d92c08e810274517d33 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jos=C3=A9=20Fonseca?= Date: Tue, 11 May 2010 11:11:03 +0100 Subject: [PATCH 1/1] gallium: Make PIPE_CAP_xxx enums. --- src/gallium/drivers/cell/ppu/cell_screen.c | 4 +- src/gallium/drivers/i915/i915_screen.c | 4 +- src/gallium/drivers/i965/brw_screen.c | 4 +- src/gallium/drivers/identity/id_screen.c | 4 +- src/gallium/drivers/llvmpipe/lp_screen.c | 4 +- src/gallium/drivers/nv50/nv50_screen.c | 4 +- src/gallium/drivers/nvfx/nvfx_screen.c | 4 +- src/gallium/drivers/r300/r300_screen.c | 4 +- src/gallium/drivers/softpipe/sp_screen.c | 4 +- src/gallium/drivers/svga/svga_screen.c | 4 +- src/gallium/drivers/trace/tr_screen.c | 4 +- src/gallium/include/pipe/p_defines.h | 85 ++++++++++++---------- src/gallium/include/pipe/p_screen.h | 4 +- 13 files changed, 69 insertions(+), 64 deletions(-) diff --git a/src/gallium/drivers/cell/ppu/cell_screen.c b/src/gallium/drivers/cell/ppu/cell_screen.c index b4fd8d7235c..5af4eaa88b1 100644 --- a/src/gallium/drivers/cell/ppu/cell_screen.c +++ b/src/gallium/drivers/cell/ppu/cell_screen.c @@ -55,7 +55,7 @@ cell_get_name(struct pipe_screen *screen) static int -cell_get_param(struct pipe_screen *screen, int param) +cell_get_param(struct pipe_screen *screen, enum pipe_cap param) { switch (param) { case PIPE_CAP_MAX_TEXTURE_IMAGE_UNITS: @@ -105,7 +105,7 @@ cell_get_param(struct pipe_screen *screen, int param) static float -cell_get_paramf(struct pipe_screen *screen, int param) +cell_get_paramf(struct pipe_screen *screen, enum pipe_cap param) { switch (param) { case PIPE_CAP_MAX_LINE_WIDTH: diff --git a/src/gallium/drivers/i915/i915_screen.c b/src/gallium/drivers/i915/i915_screen.c index 9086f9fc3b1..d196c779e43 100644 --- a/src/gallium/drivers/i915/i915_screen.c +++ b/src/gallium/drivers/i915/i915_screen.c @@ -90,7 +90,7 @@ i915_get_name(struct pipe_screen *screen) } static int -i915_get_param(struct pipe_screen *screen, int param) +i915_get_param(struct pipe_screen *screen, enum pipe_cap param) { switch (param) { case PIPE_CAP_MAX_TEXTURE_IMAGE_UNITS: @@ -133,7 +133,7 @@ i915_get_param(struct pipe_screen *screen, int param) } static float -i915_get_paramf(struct pipe_screen *screen, int param) +i915_get_paramf(struct pipe_screen *screen, enum pipe_cap param) { switch (param) { case PIPE_CAP_MAX_LINE_WIDTH: diff --git a/src/gallium/drivers/i965/brw_screen.c b/src/gallium/drivers/i965/brw_screen.c index 0a7151bde44..d242691f2d2 100644 --- a/src/gallium/drivers/i965/brw_screen.c +++ b/src/gallium/drivers/i965/brw_screen.c @@ -149,7 +149,7 @@ brw_get_name(struct pipe_screen *screen) } static int -brw_get_param(struct pipe_screen *screen, int param) +brw_get_param(struct pipe_screen *screen, enum pipe_cap param) { switch (param) { case PIPE_CAP_MAX_TEXTURE_IMAGE_UNITS: @@ -192,7 +192,7 @@ brw_get_param(struct pipe_screen *screen, int param) } static float -brw_get_paramf(struct pipe_screen *screen, int param) +brw_get_paramf(struct pipe_screen *screen, enum pipe_cap param) { switch (param) { case PIPE_CAP_MAX_LINE_WIDTH: diff --git a/src/gallium/drivers/identity/id_screen.c b/src/gallium/drivers/identity/id_screen.c index 7671bded981..3c94e04a7a8 100644 --- a/src/gallium/drivers/identity/id_screen.c +++ b/src/gallium/drivers/identity/id_screen.c @@ -67,7 +67,7 @@ identity_screen_get_vendor(struct pipe_screen *_screen) static int identity_screen_get_param(struct pipe_screen *_screen, - int param) + enum pipe_cap param) { struct identity_screen *id_screen = identity_screen(_screen); struct pipe_screen *screen = id_screen->screen; @@ -78,7 +78,7 @@ identity_screen_get_param(struct pipe_screen *_screen, static float identity_screen_get_paramf(struct pipe_screen *_screen, - int param) + enum pipe_cap param) { struct identity_screen *id_screen = identity_screen(_screen); struct pipe_screen *screen = id_screen->screen; diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c index 65cc55b8ca2..226f7a145e2 100644 --- a/src/gallium/drivers/llvmpipe/lp_screen.c +++ b/src/gallium/drivers/llvmpipe/lp_screen.c @@ -82,7 +82,7 @@ llvmpipe_get_name(struct pipe_screen *screen) static int -llvmpipe_get_param(struct pipe_screen *screen, int param) +llvmpipe_get_param(struct pipe_screen *screen, enum pipe_cap param) { switch (param) { case PIPE_CAP_MAX_TEXTURE_IMAGE_UNITS: @@ -140,7 +140,7 @@ llvmpipe_get_param(struct pipe_screen *screen, int param) static float -llvmpipe_get_paramf(struct pipe_screen *screen, int param) +llvmpipe_get_paramf(struct pipe_screen *screen, enum pipe_cap param) { switch (param) { case PIPE_CAP_MAX_LINE_WIDTH: diff --git a/src/gallium/drivers/nv50/nv50_screen.c b/src/gallium/drivers/nv50/nv50_screen.c index bf46cebb590..ff3a7b2843d 100644 --- a/src/gallium/drivers/nv50/nv50_screen.c +++ b/src/gallium/drivers/nv50/nv50_screen.c @@ -102,7 +102,7 @@ nv50_screen_is_format_supported(struct pipe_screen *pscreen, } static int -nv50_screen_get_param(struct pipe_screen *pscreen, int param) +nv50_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param) { switch (param) { case PIPE_CAP_MAX_TEXTURE_IMAGE_UNITS: @@ -157,7 +157,7 @@ nv50_screen_get_param(struct pipe_screen *pscreen, int param) } static float -nv50_screen_get_paramf(struct pipe_screen *pscreen, int param) +nv50_screen_get_paramf(struct pipe_screen *pscreen, enum pipe_cap param) { switch (param) { case PIPE_CAP_MAX_LINE_WIDTH: diff --git a/src/gallium/drivers/nvfx/nvfx_screen.c b/src/gallium/drivers/nvfx/nvfx_screen.c index c70f254f8c8..0ff25e54f73 100644 --- a/src/gallium/drivers/nvfx/nvfx_screen.c +++ b/src/gallium/drivers/nvfx/nvfx_screen.c @@ -30,7 +30,7 @@ struct nouveau_winsys { #define NV6X_GRCLASS4497_CHIPSETS 0x00000088 static int -nvfx_screen_get_param(struct pipe_screen *pscreen, int param) +nvfx_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param) { struct nvfx_screen *screen = nvfx_screen(pscreen); @@ -91,7 +91,7 @@ nvfx_screen_get_param(struct pipe_screen *pscreen, int param) } static float -nvfx_screen_get_paramf(struct pipe_screen *pscreen, int param) +nvfx_screen_get_paramf(struct pipe_screen *pscreen, enum pipe_cap param) { struct nvfx_screen *screen = nvfx_screen(pscreen); diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c index c0391267031..89982c870d8 100644 --- a/src/gallium/drivers/r300/r300_screen.c +++ b/src/gallium/drivers/r300/r300_screen.c @@ -76,7 +76,7 @@ static const char* r300_get_name(struct pipe_screen* pscreen) return chip_families[r300screen->caps.family]; } -static int r300_get_param(struct pipe_screen* pscreen, int param) +static int r300_get_param(struct pipe_screen* pscreen, enum pipe_cap param) { struct r300_screen* r300screen = r300_screen(pscreen); @@ -166,7 +166,7 @@ static int r300_get_param(struct pipe_screen* pscreen, int param) } } -static float r300_get_paramf(struct pipe_screen* pscreen, int param) +static float r300_get_paramf(struct pipe_screen* pscreen, enum pipe_cap param) { struct r300_screen* r300screen = r300_screen(pscreen); diff --git a/src/gallium/drivers/softpipe/sp_screen.c b/src/gallium/drivers/softpipe/sp_screen.c index 8bb0294238a..88e5c11801f 100644 --- a/src/gallium/drivers/softpipe/sp_screen.c +++ b/src/gallium/drivers/softpipe/sp_screen.c @@ -56,7 +56,7 @@ softpipe_get_name(struct pipe_screen *screen) static int -softpipe_get_param(struct pipe_screen *screen, int param) +softpipe_get_param(struct pipe_screen *screen, enum pipe_cap param) { switch (param) { case PIPE_CAP_MAX_TEXTURE_IMAGE_UNITS: @@ -117,7 +117,7 @@ softpipe_get_param(struct pipe_screen *screen, int param) static float -softpipe_get_paramf(struct pipe_screen *screen, int param) +softpipe_get_paramf(struct pipe_screen *screen, enum pipe_cap param) { switch (param) { case PIPE_CAP_MAX_LINE_WIDTH: diff --git a/src/gallium/drivers/svga/svga_screen.c b/src/gallium/drivers/svga/svga_screen.c index 27ac09e275d..580340b237a 100644 --- a/src/gallium/drivers/svga/svga_screen.c +++ b/src/gallium/drivers/svga/svga_screen.c @@ -84,7 +84,7 @@ svga_get_name( struct pipe_screen *pscreen ) static float -svga_get_paramf(struct pipe_screen *screen, int param) +svga_get_paramf(struct pipe_screen *screen, enum pipe_cap param) { struct svga_screen *svgascreen = svga_screen(screen); struct svga_winsys_screen *sws = svgascreen->sws; @@ -186,7 +186,7 @@ svga_get_paramf(struct pipe_screen *screen, int param) /* This is a fairly pointless interface */ static int -svga_get_param(struct pipe_screen *screen, int param) +svga_get_param(struct pipe_screen *screen, enum pipe_cap param) { return (int) svga_get_paramf( screen, param ); } diff --git a/src/gallium/drivers/trace/tr_screen.c b/src/gallium/drivers/trace/tr_screen.c index 63a45d7e512..4513bde7846 100644 --- a/src/gallium/drivers/trace/tr_screen.c +++ b/src/gallium/drivers/trace/tr_screen.c @@ -86,7 +86,7 @@ trace_screen_get_vendor(struct pipe_screen *_screen) static int trace_screen_get_param(struct pipe_screen *_screen, - int param) + enum pipe_cap param) { struct trace_screen *tr_scr = trace_screen(_screen); struct pipe_screen *screen = tr_scr->screen; @@ -109,7 +109,7 @@ trace_screen_get_param(struct pipe_screen *_screen, static float trace_screen_get_paramf(struct pipe_screen *_screen, - int param) + enum pipe_cap param) { struct trace_screen *tr_scr = trace_screen(_screen); struct pipe_screen *screen = tr_scr->screen; diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h index 1aa54f1423a..7e43edcff8c 100644 --- a/src/gallium/include/pipe/p_defines.h +++ b/src/gallium/include/pipe/p_defines.h @@ -413,46 +413,51 @@ enum pipe_transfer_usage { * Implementation capabilities/limits which are queried through * pipe_screen::get_param() and pipe_screen::get_paramf(). */ -#define PIPE_CAP_MAX_TEXTURE_IMAGE_UNITS 1 -#define PIPE_CAP_NPOT_TEXTURES 2 -#define PIPE_CAP_TWO_SIDED_STENCIL 3 -#define PIPE_CAP_GLSL 4 /* XXX need something better */ -#define PIPE_CAP_DUAL_SOURCE_BLEND 5 -#define PIPE_CAP_ANISOTROPIC_FILTER 6 -#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_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 -#define PIPE_CAP_GUARD_BAND_LEFT 20 /*< float */ -#define PIPE_CAP_GUARD_BAND_TOP 21 /*< float */ -#define PIPE_CAP_GUARD_BAND_RIGHT 22 /*< float */ -#define PIPE_CAP_GUARD_BAND_BOTTOM 23 /*< float */ -#define PIPE_CAP_TEXTURE_MIRROR_CLAMP 24 -#define PIPE_CAP_TEXTURE_MIRROR_REPEAT 25 -#define PIPE_CAP_MAX_VERTEX_TEXTURE_UNITS 26 -#define PIPE_CAP_TGSI_CONT_SUPPORTED 27 -#define PIPE_CAP_BLEND_EQUATION_SEPARATE 28 -#define PIPE_CAP_SM3 29 /*< Shader Model 3 supported */ -#define PIPE_CAP_MAX_PREDICATE_REGISTERS 30 -#define PIPE_CAP_MAX_COMBINED_SAMPLERS 31 /*< Maximum texture image units accessible from vertex - and fragment shaders combined */ -#define PIPE_CAP_MAX_CONST_BUFFERS 32 -#define PIPE_CAP_MAX_CONST_BUFFER_SIZE 33 /*< In bytes */ -#define PIPE_CAP_INDEP_BLEND_ENABLE 34 /*< blend enables and write masks per rendertarget */ -#define PIPE_CAP_INDEP_BLEND_FUNC 35 /*< different blend funcs per rendertarget */ -#define PIPE_CAP_TGSI_FS_COORD_ORIGIN_UPPER_LEFT 36 -#define PIPE_CAP_TGSI_FS_COORD_ORIGIN_LOWER_LEFT 37 -#define PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER 38 -#define PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER 39 +enum pipe_cap { + PIPE_CAP_MAX_TEXTURE_IMAGE_UNITS, + PIPE_CAP_NPOT_TEXTURES, + PIPE_CAP_TWO_SIDED_STENCIL, + PIPE_CAP_GLSL, /* XXX need something better */ + PIPE_CAP_DUAL_SOURCE_BLEND, + PIPE_CAP_ANISOTROPIC_FILTER, + PIPE_CAP_POINT_SPRITE, + PIPE_CAP_MAX_RENDER_TARGETS, + PIPE_CAP_OCCLUSION_QUERY, + PIPE_CAP_TEXTURE_SHADOW_MAP, + PIPE_CAP_MAX_TEXTURE_2D_LEVELS, + PIPE_CAP_MAX_TEXTURE_3D_LEVELS, + PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS, + PIPE_CAP_MAX_LINE_WIDTH, + PIPE_CAP_MAX_LINE_WIDTH_AA, + PIPE_CAP_MAX_POINT_WIDTH, + PIPE_CAP_MAX_POINT_WIDTH_AA, + PIPE_CAP_MAX_TEXTURE_ANISOTROPY, + PIPE_CAP_MAX_TEXTURE_LOD_BIAS, + PIPE_CAP_GUARD_BAND_LEFT, /*< float */ + PIPE_CAP_GUARD_BAND_TOP, /*< float */ + PIPE_CAP_GUARD_BAND_RIGHT, /*< float */ + PIPE_CAP_GUARD_BAND_BOTTOM, /*< float */ + PIPE_CAP_TEXTURE_MIRROR_CLAMP, + PIPE_CAP_TEXTURE_MIRROR_REPEAT, + PIPE_CAP_MAX_VERTEX_TEXTURE_UNITS, + PIPE_CAP_TGSI_CONT_SUPPORTED, + PIPE_CAP_BLEND_EQUATION_SEPARATE, + PIPE_CAP_SM3, /*< Shader Model, supported */ + PIPE_CAP_MAX_PREDICATE_REGISTERS, + /** Maximum texture image units accessible from vertex and fragment shaders + * combined */ + PIPE_CAP_MAX_COMBINED_SAMPLERS, + PIPE_CAP_MAX_CONST_BUFFERS, + PIPE_CAP_MAX_CONST_BUFFER_SIZE, /*< In bytes */ + /** blend enables and write masks per rendertarget */ + PIPE_CAP_INDEP_BLEND_ENABLE, + /** different blend funcs per rendertarget */ + PIPE_CAP_INDEP_BLEND_FUNC, + PIPE_CAP_TGSI_FS_COORD_ORIGIN_UPPER_LEFT, + PIPE_CAP_TGSI_FS_COORD_ORIGIN_LOWER_LEFT, + PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER, + PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER, +}; /** diff --git a/src/gallium/include/pipe/p_screen.h b/src/gallium/include/pipe/p_screen.h index beff1ae8a92..7195dc03963 100644 --- a/src/gallium/include/pipe/p_screen.h +++ b/src/gallium/include/pipe/p_screen.h @@ -79,13 +79,13 @@ struct pipe_screen { * Query an integer-valued capability/parameter/limit * \param param one of PIPE_CAP_x */ - int (*get_param)( struct pipe_screen *, int param ); + int (*get_param)( struct pipe_screen *, enum pipe_cap param ); /** * Query a float-valued capability/parameter/limit * \param param one of PIPE_CAP_x */ - float (*get_paramf)( struct pipe_screen *, int param ); + float (*get_paramf)( struct pipe_screen *, enum pipe_cap param ); struct pipe_context * (*context_create)( struct pipe_screen *, void *priv ); -- 2.30.2