summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2010-04-05 02:11:26 +0200
committerMarek Olšák <[email protected]>2010-04-05 07:09:45 +0200
commitd2686cdb2354b7cfe0e4eac3c5afab40cb947e0f (patch)
tree48c64d7fa0e6151e7a74563dfc7c63ece8bfd1d7
parente41a64591bf1a74465bf0adc7d35c991c4cfb4fe (diff)
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/
-rw-r--r--src/gallium/drivers/r300/r300_chipset.c2
-rw-r--r--src/gallium/drivers/r300/r300_chipset.h2
-rw-r--r--src/gallium/drivers/r300/r300_context.h6
-rw-r--r--src/gallium/drivers/r300/r300_screen.c3
-rw-r--r--src/gallium/drivers/r300/r300_state.c9
-rw-r--r--src/gallium/drivers/r300/r300_state_inlines.h2
6 files changed, 13 insertions, 11 deletions
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.) */