}
static uint32_t r300_get_border_color(enum pipe_format format,
- const float border[4])
+ const float border[4],
+ boolean is_r500)
{
const struct util_format_description *desc;
float border_swizzled[4] = {0};
desc = util_format_description(format);
+ /* Do depth formats first. */
+ if (util_format_is_depth_or_stencil(format)) {
+ switch (format) {
+ case PIPE_FORMAT_Z16_UNORM:
+ return util_pack_z(PIPE_FORMAT_Z16_UNORM, border[0]);
+ case PIPE_FORMAT_X8Z24_UNORM:
+ case PIPE_FORMAT_S8_USCALED_Z24_UNORM:
+ if (is_r500) {
+ return util_pack_z(PIPE_FORMAT_X8Z24_UNORM, border[0]);
+ } else {
+ return util_pack_z(PIPE_FORMAT_Z16_UNORM, border[0]) << 16;
+ }
+ default:
+ assert(0);
+ return 0;
+ }
+ }
+
/* Apply inverse swizzle of the format. */
for (i = 0; i < 4; i++) {
switch (desc->swizzle[i]) {
}
}
+ /* Compressed formats. */
+ if (util_format_is_compressed(format)) {
+ util_pack_color(border_swizzled, PIPE_FORMAT_R8G8B8A8_UNORM, &uc);
+ return uc.ui;
+ }
+
switch (desc->channel[0].size) {
case 4:
util_pack_color(border_swizzled, PIPE_FORMAT_B4G4R4A4_UNORM, &uc);
case 10:
util_pack_color(border_swizzled, PIPE_FORMAT_B10G10R10A2_UNORM, &uc);
break;
+
+ case 16:
+ if (desc->nr_channels <= 2) {
+ border_swizzled[0] = border_swizzled[2];
+ util_pack_color(border_swizzled, PIPE_FORMAT_R16G16_UNORM, &uc);
+ } else {
+ util_pack_color(border_swizzled, PIPE_FORMAT_B8G8R8A8_UNORM, &uc);
+ }
+ break;
}
return uc.ui;
/* Set the border color. */
texstate->border_color =
r300_get_border_color(view->base.format,
- sampler->state.border_color);
+ sampler->state.border_color,
+ r300->screen->caps.is_r500);
/* determine min/max levels */
max_level = MIN3(sampler->max_lod + view->base.first_level,