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/tags/mesa-7.9-rc1
@@ -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. */ |
@@ -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 |
@@ -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 { |
@@ -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 */ |
@@ -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); |
@@ -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.) */ |