From d2686cdb2354b7cfe0e4eac3c5afab40cb947e0f Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Mon, 5 Apr 2010 02:11:26 +0200 Subject: r300g: raise the number of texture units to 16 for all supported chipsets As per Radeon 9700 Opengl Programming and Optimization Guide [1], there are 16 texture units even on the first r300 chipsets. If you think I am wrong, feel free to propose a patch. [1] Here's PDF: http://people.freedesktop.org/~mareko/ --- src/gallium/drivers/r300/r300_chipset.c | 2 +- src/gallium/drivers/r300/r300_chipset.h | 2 ++ src/gallium/drivers/r300/r300_context.h | 6 +++--- src/gallium/drivers/r300/r300_screen.c | 3 +-- src/gallium/drivers/r300/r300_state.c | 9 +++++---- src/gallium/drivers/r300/r300_state_inlines.h | 2 +- 6 files changed, 13 insertions(+), 11 deletions(-) (limited to 'src/gallium/drivers') diff --git a/src/gallium/drivers/r300/r300_chipset.c b/src/gallium/drivers/r300/r300_chipset.c index 41719862635..9b2163e44cc 100644 --- a/src/gallium/drivers/r300/r300_chipset.c +++ b/src/gallium/drivers/r300/r300_chipset.c @@ -34,12 +34,12 @@ void r300_parse_chipset(struct r300_capabilities* caps) { /* Reasonable defaults */ caps->num_vert_fpus = 4; + caps->num_tex_units = 16; caps->has_tcl = debug_get_bool_option("RADEON_NO_TCL", FALSE) ? FALSE : TRUE; caps->is_r400 = FALSE; caps->is_r500 = FALSE; caps->high_second_pipe = FALSE; - /* Note: These are not ordered by PCI ID. I leave that task to GCC, * which will perform the ordering while collating jump tables. Instead, * I've tried to group them according to capabilities and age. */ diff --git a/src/gallium/drivers/r300/r300_chipset.h b/src/gallium/drivers/r300/r300_chipset.h index 28084864929..ff957b7c29c 100644 --- a/src/gallium/drivers/r300/r300_chipset.h +++ b/src/gallium/drivers/r300/r300_chipset.h @@ -38,6 +38,8 @@ struct r300_capabilities { unsigned num_frag_pipes; /* The number of z pipes */ unsigned num_z_pipes; + /* The number of texture units. */ + unsigned num_tex_units; /* Whether or not TCL is physically present */ boolean has_tcl; /* Whether or not this is R400. The differences compared to their R3xx diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h index 4689701bd1d..108ab453a47 100644 --- a/src/gallium/drivers/r300/r300_context.h +++ b/src/gallium/drivers/r300/r300_context.h @@ -138,10 +138,10 @@ struct r300_texture_fb_state { struct r300_textures_state { /* Textures. */ - struct pipe_sampler_view *fragment_sampler_views[8]; + struct pipe_sampler_view *fragment_sampler_views[16]; int texture_count; /* Sampler states. */ - struct r300_sampler_state *sampler_states[8]; + struct r300_sampler_state *sampler_states[16]; int sampler_count; /* These is the merge of the texture and sampler states. */ @@ -152,7 +152,7 @@ struct r300_textures_state { uint32_t filter[2]; /* R300_TX_FILTER[0-1] */ uint32_t border_color; /* R300_TX_BORDER_COLOR: 0x45c0 */ uint32_t tile_config; /* R300_TX_OFFSET (subset thereof) */ - } regs[8]; + } regs[16]; }; struct r300_vertex_stream_state { diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c index 50e5e9307e9..0a98458dc37 100644 --- a/src/gallium/drivers/r300/r300_screen.c +++ b/src/gallium/drivers/r300/r300_screen.c @@ -82,8 +82,7 @@ static int r300_get_param(struct pipe_screen* pscreen, int param) switch (param) { case PIPE_CAP_MAX_TEXTURE_IMAGE_UNITS: case PIPE_CAP_MAX_COMBINED_SAMPLERS: - /* XXX I'm told this goes up to 16 */ - return 8; + return r300screen->caps->num_tex_units; case PIPE_CAP_NPOT_TEXTURES: /* XXX enable now to get GL2.1 API, * figure out later how to emulate this */ diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index dc94c95e69f..d1486a20395 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -908,8 +908,9 @@ static void r300_bind_sampler_states(struct pipe_context* pipe, struct r300_context* r300 = r300_context(pipe); struct r300_textures_state* state = (struct r300_textures_state*)r300->textures_state.state; + unsigned tex_units = r300_screen(r300->context.screen)->caps->num_tex_units; - if (count > 8) { + if (count > tex_units) { return; } @@ -947,11 +948,11 @@ static void r300_set_fragment_sampler_views(struct pipe_context* pipe, (struct r300_textures_state*)r300->textures_state.state; struct r300_texture *texture; unsigned i; + unsigned tex_units = r300_screen(r300->context.screen)->caps->num_tex_units; boolean is_r500 = r300_screen(r300->context.screen)->caps->is_r500; boolean dirty_tex = FALSE; - /* XXX magic num */ - if (count > 8) { + if (count > tex_units) { return; } @@ -977,7 +978,7 @@ static void r300_set_fragment_sampler_views(struct pipe_context* pipe, } } - for (i = count; i < 8; i++) { + for (i = count; i < tex_units; i++) { if (state->fragment_sampler_views[i]) { pipe_sampler_view_reference(&state->fragment_sampler_views[i], NULL); diff --git a/src/gallium/drivers/r300/r300_state_inlines.h b/src/gallium/drivers/r300/r300_state_inlines.h index 8a690039b6b..044d70cbe82 100644 --- a/src/gallium/drivers/r300/r300_state_inlines.h +++ b/src/gallium/drivers/r300/r300_state_inlines.h @@ -338,7 +338,7 @@ static INLINE uint32_t r500_anisotropy(unsigned max_aniso) // Map the range [0, 15] to [0, 63]. return R500_TX_MAX_ANISO(MIN2((unsigned)(max_aniso*4.2001), 63)) | - R500_TX_ANISO_HIGH_QUALITY;; + R500_TX_ANISO_HIGH_QUALITY; } /* Non-CSO state. (For now.) */ -- cgit v1.2.3