summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/r300/r300_state.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/drivers/r300/r300_state.c')
-rw-r--r--src/gallium/drivers/r300/r300_state.c33
1 files changed, 25 insertions, 8 deletions
diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c
index d704057e466..3606e0bf505 100644
--- a/src/gallium/drivers/r300/r300_state.c
+++ b/src/gallium/drivers/r300/r300_state.c
@@ -756,7 +756,7 @@ static void r300_print_fb_surf_info(struct pipe_surface *surf, unsigned index,
"r300: %s[%i] Dim: %ix%i, Firstlayer: %i, "
"Lastlayer: %i, Level: %i, Format: %s\n"
- "r300: TEX: Macro: %s, Micro: %s, Pitch: %i, "
+ "r300: TEX: Macro: %s, Micro: %s, "
"Dim: %ix%ix%i, LastLevel: %i, Format: %s\n",
binding, index, surf->width, surf->height,
@@ -765,9 +765,8 @@ static void r300_print_fb_surf_info(struct pipe_surface *surf, unsigned index,
rtex->tex.macrotile[0] ? "YES" : " NO",
rtex->tex.microtile ? "YES" : " NO",
- rtex->tex.stride_in_pixels[0],
tex->width0, tex->height0, tex->depth0,
- tex->last_level, util_format_short_name(tex->format));
+ tex->last_level, util_format_short_name(surf->format));
}
void r300_mark_fb_state_dirty(struct r300_context *r300,
@@ -888,7 +887,7 @@ r300_set_framebuffer_state(struct pipe_context* pipe,
r300_mark_fb_state_dirty(r300, R300_CHANGED_FB_STATE);
if (state->zsbuf) {
- switch (util_format_get_blocksize(state->zsbuf->texture->format)) {
+ switch (util_format_get_blocksize(state->zsbuf->format)) {
case 2:
zbuffer_bpp = 16;
break;
@@ -1458,10 +1457,12 @@ static void r300_set_fragment_sampler_views(struct pipe_context* pipe,
}
}
-static struct pipe_sampler_view *
-r300_create_sampler_view(struct pipe_context *pipe,
+struct pipe_sampler_view *
+r300_create_sampler_view_custom(struct pipe_context *pipe,
struct pipe_resource *texture,
- const struct pipe_sampler_view *templ)
+ const struct pipe_sampler_view *templ,
+ unsigned width0_override,
+ unsigned height0_override)
{
struct r300_sampler_view *view = CALLOC_STRUCT(r300_sampler_view);
struct r300_resource *tex = r300_resource(texture);
@@ -1477,6 +1478,8 @@ r300_create_sampler_view(struct pipe_context *pipe,
view->base.texture = NULL;
pipe_resource_reference(&view->base.texture, texture);
+ view->width0_override = width0_override;
+ view->height0_override = height0_override;
view->swizzle[0] = templ->swizzle_r;
view->swizzle[1] = templ->swizzle_g;
view->swizzle[2] = templ->swizzle_b;
@@ -1493,7 +1496,10 @@ r300_create_sampler_view(struct pipe_context *pipe,
}
assert(hwformat != ~0);
- view->format = tex->tx_format;
+ r300_texture_setup_format_state(r300_screen(pipe->screen), tex,
+ templ->format, 0,
+ width0_override, height0_override,
+ &view->format);
view->format.format1 |= hwformat;
if (is_r500) {
view->format.format2 |= r500_tx_format_msb_bit(templ->format);
@@ -1503,6 +1509,17 @@ r300_create_sampler_view(struct pipe_context *pipe,
return (struct pipe_sampler_view*)view;
}
+static struct pipe_sampler_view *
+r300_create_sampler_view(struct pipe_context *pipe,
+ struct pipe_resource *texture,
+ const struct pipe_sampler_view *templ)
+{
+ return r300_create_sampler_view_custom(pipe, texture, templ,
+ r300_resource(texture)->tex.width0,
+ r300_resource(texture)->tex.height0);
+}
+
+
static void
r300_sampler_view_destroy(struct pipe_context *pipe,
struct pipe_sampler_view *view)