summaryrefslogtreecommitdiff
path: root/src/gallium/auxiliary/util/u_blitter.c
diff options
context:
space:
mode:
authorMarek Olšák <maraeo@gmail.com>2010-11-28 16:59:03 +0100
committerMarek Olšák <maraeo@gmail.com>2010-11-28 17:45:39 +0100
commit5d4d8b6205af9a09e67f53631eefad77054aa8e9 (patch)
treee730d61f48f9b01ef3152559380bf4e45e4f780a /src/gallium/auxiliary/util/u_blitter.c
parentc6ea4c0e8a6aa84a590ae63da3eb06c08c7356ed (diff)
u_blitter: interpolate clear color using a GENERIC varying instead of COLOR
There are also some u_simple_shaders changes. On r300, the TGSI_SEMANTIC_COLOR varying is a fixed-point number clamped to the range [0,1] and limited to 12 bits of precision. Therefore we can't use it for passing through a clear color in order to clear high precision texture formats. This also makes u_blitter use only one vertex shader instead of two.
Diffstat (limited to 'src/gallium/auxiliary/util/u_blitter.c')
-rw-r--r--src/gallium/auxiliary/util/u_blitter.c32
1 files changed, 12 insertions, 20 deletions
diff --git a/src/gallium/auxiliary/util/u_blitter.c b/src/gallium/auxiliary/util/u_blitter.c
index 31fc75aa11..bd9e65f43b 100644
--- a/src/gallium/auxiliary/util/u_blitter.c
+++ b/src/gallium/auxiliary/util/u_blitter.c
@@ -63,8 +63,7 @@ struct blitter_context_priv
/* Constant state objects. */
/* Vertex shaders. */
- void *vs_col; /**< Vertex shader which passes {pos, color} to the output */
- void *vs_tex; /**< Vertex shader which passes {pos, texcoord} to the output.*/
+ void *vs; /**< Vertex shader which passes {pos, generic} to the output.*/
/* Fragment shaders. */
/* The shader at index i outputs color to color buffers 0,1,...,i-1. */
@@ -211,20 +210,12 @@ struct blitter_context *util_blitter_create(struct pipe_context *pipe)
/* fragment shaders are created on-demand */
- /* vertex shaders */
- {
- const uint semantic_names[] = { TGSI_SEMANTIC_POSITION,
- TGSI_SEMANTIC_COLOR };
- const uint semantic_indices[] = { 0, 0 };
- ctx->vs_col =
- util_make_vertex_passthrough_shader(pipe, 2, semantic_names,
- semantic_indices);
- }
+ /* vertex shader */
{
const uint semantic_names[] = { TGSI_SEMANTIC_POSITION,
TGSI_SEMANTIC_GENERIC };
const uint semantic_indices[] = { 0, 0 };
- ctx->vs_tex =
+ ctx->vs =
util_make_vertex_passthrough_shader(pipe, 2, semantic_names,
semantic_indices);
}
@@ -257,8 +248,7 @@ void util_blitter_destroy(struct blitter_context *blitter)
pipe->delete_depth_stencil_alpha_state(pipe, ctx->dsa_flush_depth_stencil);
pipe->delete_rasterizer_state(pipe, ctx->rs_state);
- pipe->delete_vs_state(pipe, ctx->vs_col);
- pipe->delete_vs_state(pipe, ctx->vs_tex);
+ pipe->delete_vs_state(pipe, ctx->vs);
pipe->delete_vertex_elements_state(pipe, ctx->velem_state);
for (i = 0; i < PIPE_MAX_TEXTURE_TYPES; i++) {
@@ -569,7 +559,9 @@ void *blitter_get_fs_col(struct blitter_context_priv *ctx, unsigned num_cbufs)
if (!ctx->fs_col[num_cbufs])
ctx->fs_col[num_cbufs] =
- util_make_fragment_clonecolor_shader(pipe, num_cbufs);
+ util_make_fragment_cloneinput_shader(pipe, num_cbufs,
+ TGSI_SEMANTIC_GENERIC,
+ TGSI_INTERPOLATE_LINEAR);
return ctx->fs_col[num_cbufs];
}
@@ -700,7 +692,7 @@ void util_blitter_clear(struct blitter_context *blitter,
pipe->bind_rasterizer_state(pipe, ctx->rs_state);
pipe->bind_vertex_elements_state(pipe, ctx->velem_state);
pipe->bind_fs_state(pipe, blitter_get_fs_col(ctx, num_cbufs));
- pipe->bind_vs_state(pipe, ctx->vs_col);
+ pipe->bind_vs_state(pipe, ctx->vs);
blitter_set_dst_dimensions(ctx, width, height);
blitter->draw_rectangle(blitter, 0, 0, width, height, depth,
@@ -813,7 +805,7 @@ void util_blitter_copy_region(struct blitter_context *blitter,
/* Set rasterizer state, shaders, and textures. */
pipe->bind_rasterizer_state(pipe, ctx->rs_state);
- pipe->bind_vs_state(pipe, ctx->vs_tex);
+ pipe->bind_vs_state(pipe, ctx->vs);
pipe->bind_fragment_sampler_states(pipe, 1,
blitter_get_sampler_state(ctx, subsrc.level, normalized));
pipe->bind_vertex_elements_state(pipe, ctx->velem_state);
@@ -890,7 +882,7 @@ void util_blitter_clear_render_target(struct blitter_context *blitter,
pipe->bind_depth_stencil_alpha_state(pipe, ctx->dsa_keep_depth_stencil);
pipe->bind_rasterizer_state(pipe, ctx->rs_state);
pipe->bind_fs_state(pipe, blitter_get_fs_col(ctx, 1));
- pipe->bind_vs_state(pipe, ctx->vs_col);
+ pipe->bind_vs_state(pipe, ctx->vs);
pipe->bind_vertex_elements_state(pipe, ctx->velem_state);
/* set a framebuffer state */
@@ -950,7 +942,7 @@ void util_blitter_clear_depth_stencil(struct blitter_context *blitter,
pipe->bind_rasterizer_state(pipe, ctx->rs_state);
pipe->bind_fs_state(pipe, blitter_get_fs_col(ctx, 0));
- pipe->bind_vs_state(pipe, ctx->vs_col);
+ pipe->bind_vs_state(pipe, ctx->vs);
pipe->bind_vertex_elements_state(pipe, ctx->velem_state);
/* set a framebuffer state */
@@ -991,7 +983,7 @@ void util_blitter_custom_depth_stencil(struct blitter_context *blitter,
pipe->bind_rasterizer_state(pipe, ctx->rs_state);
pipe->bind_fs_state(pipe, blitter_get_fs_col(ctx, 0));
- pipe->bind_vs_state(pipe, ctx->vs_col);
+ pipe->bind_vs_state(pipe, ctx->vs);
pipe->bind_vertex_elements_state(pipe, ctx->velem_state);
/* set a framebuffer state */