summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gallium/auxiliary/draw/draw_context.c4
-rw-r--r--src/gallium/auxiliary/draw/draw_pt.c2
-rw-r--r--src/gallium/auxiliary/draw/draw_pt.h2
-rw-r--r--src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c3
-rw-r--r--src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c21
-rw-r--r--src/gallium/auxiliary/draw/draw_pt_post_vs.c4
-rw-r--r--src/gallium/auxiliary/util/u_blit.c24
-rw-r--r--src/gallium/auxiliary/util/u_gen_mipmap.c23
-rw-r--r--src/gallium/drivers/trace/tr_state.c3
-rw-r--r--src/gallium/include/pipe/p_state.h12
-rw-r--r--src/mesa/state_tracker/st_cb_bitmap.c1
-rw-r--r--src/mesa/state_tracker/st_cb_clear.c23
12 files changed, 45 insertions, 77 deletions
diff --git a/src/gallium/auxiliary/draw/draw_context.c b/src/gallium/auxiliary/draw/draw_context.c
index 581532c1c9f..a4f1fcddc1a 100644
--- a/src/gallium/auxiliary/draw/draw_context.c
+++ b/src/gallium/auxiliary/draw/draw_context.c
@@ -127,7 +127,7 @@ void draw_set_rasterizer_state( struct draw_context *draw,
draw->rasterizer = raster;
draw->bypass_clipping =
- ((draw->rasterizer && draw->rasterizer->bypass_clipping) ||
+ ((draw->rasterizer && draw->rasterizer->bypass_vs_clip_and_viewport) ||
draw->driver.bypass_clipping);
}
@@ -139,7 +139,7 @@ void draw_set_driver_clipping( struct draw_context *draw,
draw->driver.bypass_clipping = bypass_clipping;
draw->bypass_clipping =
- ((draw->rasterizer && draw->rasterizer->bypass_clipping) ||
+ ((draw->rasterizer && draw->rasterizer->bypass_vs_clip_and_viewport) ||
draw->driver.bypass_clipping);
}
diff --git a/src/gallium/auxiliary/draw/draw_pt.c b/src/gallium/auxiliary/draw/draw_pt.c
index 4e5ffa09305..9ea0cbe5990 100644
--- a/src/gallium/auxiliary/draw/draw_pt.c
+++ b/src/gallium/auxiliary/draw/draw_pt.c
@@ -87,7 +87,7 @@ draw_pt_arrays(struct draw_context *draw,
opt |= PT_CLIPTEST;
}
- if (!draw->rasterizer->bypass_vs) {
+ if (!draw->rasterizer->bypass_vs_clip_and_viewport) {
opt |= PT_SHADE;
}
}
diff --git a/src/gallium/auxiliary/draw/draw_pt.h b/src/gallium/auxiliary/draw/draw_pt.h
index aecaeee5b9e..6f3e1e0289b 100644
--- a/src/gallium/auxiliary/draw/draw_pt.h
+++ b/src/gallium/auxiliary/draw/draw_pt.h
@@ -215,7 +215,7 @@ boolean draw_pt_post_vs_run( struct pt_post_vs *pvs,
void draw_pt_post_vs_prepare( struct pt_post_vs *pvs,
boolean bypass_clipping,
- boolean identity_viewport,
+ boolean bypass_viewport,
boolean opengl );
struct pt_post_vs *draw_pt_post_vs_create( struct draw_context *draw );
diff --git a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c
index cd9cd4b53fd..44147aed9be 100644
--- a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c
+++ b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c
@@ -101,7 +101,8 @@ static void fse_prepare( struct draw_pt_middle_end *middle,
fse->key.nr_elements = MAX2(fse->key.nr_outputs, /* outputs - translate to hw format */
fse->key.nr_inputs); /* inputs - fetch from api format */
- fse->key.viewport = !draw->identity_viewport;
+ fse->key.viewport = (!draw->rasterizer->bypass_vs_clip_and_viewport &&
+ !draw->identity_viewport);
fse->key.clip = !draw->bypass_clipping;
fse->key.const_vbuffers = 0;
diff --git a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c
index 38f9b604d37..11ac90fc563 100644
--- a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c
+++ b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c
@@ -84,7 +84,8 @@ static void fetch_pipeline_prepare( struct draw_pt_middle_end *middle,
*/
draw_pt_post_vs_prepare( fpme->post_vs,
(boolean)draw->bypass_clipping,
- (boolean)draw->identity_viewport,
+ (boolean)(draw->identity_viewport ||
+ draw->rasterizer->bypass_vs_clip_and_viewport),
(boolean)draw->rasterizer->gl_rasterization_rules );
@@ -140,9 +141,9 @@ static void fetch_pipeline_run( struct draw_pt_middle_end *middle,
(char *)pipeline_verts );
/* Run the shader, note that this overwrites the data[] parts of
- * the pipeline verts. If there is no shader, ie a bypass shader,
- * then the inputs == outputs, and are already in the correct
- * place.
+ * the pipeline verts. If there is no shader, eg if
+ * bypass_vs_clip_and_viewport, then the inputs == outputs, and are
+ * already in the correct place.
*/
if (opt & PT_SHADE)
{
@@ -216,9 +217,9 @@ static void fetch_pipeline_linear_run( struct draw_pt_middle_end *middle,
(char *)pipeline_verts );
/* Run the shader, note that this overwrites the data[] parts of
- * the pipeline verts. If there is no shader, ie a bypass shader,
- * then the inputs == outputs, and are already in the correct
- * place.
+ * the pipeline verts. If there is no shader, ie if
+ * bypass_vs_clip_and_viewport, then the inputs == outputs, and are
+ * already in the correct place.
*/
if (opt & PT_SHADE)
{
@@ -286,9 +287,9 @@ static boolean fetch_pipeline_linear_run_elts( struct draw_pt_middle_end *middle
(char *)pipeline_verts );
/* Run the shader, note that this overwrites the data[] parts of
- * the pipeline verts. If there is no shader, ie a bypass shader,
- * then the inputs == outputs, and are already in the correct
- * place.
+ * the pipeline verts. If there is no shader, ie if
+ * bypass_vs_clip_and_viewport, then the inputs == outputs, and are
+ * already in the correct place.
*/
if (opt & PT_SHADE)
{
diff --git a/src/gallium/auxiliary/draw/draw_pt_post_vs.c b/src/gallium/auxiliary/draw/draw_pt_post_vs.c
index 96dc706b998..00d7197b132 100644
--- a/src/gallium/auxiliary/draw/draw_pt_post_vs.c
+++ b/src/gallium/auxiliary/draw/draw_pt_post_vs.c
@@ -200,11 +200,11 @@ boolean draw_pt_post_vs_run( struct pt_post_vs *pvs,
void draw_pt_post_vs_prepare( struct pt_post_vs *pvs,
boolean bypass_clipping,
- boolean identity_viewport,
+ boolean bypass_viewport,
boolean opengl )
{
if (bypass_clipping) {
- if (identity_viewport)
+ if (bypass_viewport)
pvs->run = post_vs_none;
else
pvs->run = post_vs_viewport;
diff --git a/src/gallium/auxiliary/util/u_blit.c b/src/gallium/auxiliary/util/u_blit.c
index 98bb6a2ce70..deb68c43a6c 100644
--- a/src/gallium/auxiliary/util/u_blit.c
+++ b/src/gallium/auxiliary/util/u_blit.c
@@ -102,8 +102,7 @@ util_create_blit(struct pipe_context *pipe, struct cso_context *cso)
memset(&ctx->rasterizer, 0, sizeof(ctx->rasterizer));
ctx->rasterizer.front_winding = PIPE_WINDING_CW;
ctx->rasterizer.cull_mode = PIPE_WINDING_NONE;
- ctx->rasterizer.bypass_clipping = 1;
- /*ctx->rasterizer.bypass_vs = 1;*/
+ ctx->rasterizer.bypass_vs_clip_and_viewport = 1;
ctx->rasterizer.gl_rasterization_rules = 1;
/* samplers */
@@ -116,17 +115,10 @@ util_create_blit(struct pipe_context *pipe, struct cso_context *cso)
ctx->sampler.mag_img_filter = 0; /* set later */
ctx->sampler.normalized_coords = 1;
- /* viewport (identity, we setup vertices in wincoords) */
- ctx->viewport.scale[0] = 1.0;
- ctx->viewport.scale[1] = 1.0;
- ctx->viewport.scale[2] = 1.0;
- ctx->viewport.scale[3] = 1.0;
- ctx->viewport.translate[0] = 0.0;
- ctx->viewport.translate[1] = 0.0;
- ctx->viewport.translate[2] = 0.0;
- ctx->viewport.translate[3] = 0.0;
-
- /* vertex shader */
+
+ /* vertex shader - still required to provide the linkage between
+ * fragment shader input semantics and vertex_element/buffers.
+ */
{
const uint semantic_names[] = { TGSI_SEMANTIC_POSITION,
TGSI_SEMANTIC_GENERIC };
@@ -374,13 +366,11 @@ util_blit_pixels(struct blit_state *ctx,
cso_save_framebuffer(ctx->cso);
cso_save_fragment_shader(ctx->cso);
cso_save_vertex_shader(ctx->cso);
- cso_save_viewport(ctx->cso);
/* set misc state we care about */
cso_set_blend(ctx->cso, &ctx->blend);
cso_set_depth_stencil_alpha(ctx->cso, &ctx->depthstencil);
cso_set_rasterizer(ctx->cso, &ctx->rasterizer);
- cso_set_viewport(ctx->cso, &ctx->viewport);
/* sampler */
ctx->sampler.min_img_filter = filter;
@@ -422,7 +412,6 @@ util_blit_pixels(struct blit_state *ctx,
cso_restore_framebuffer(ctx->cso);
cso_restore_fragment_shader(ctx->cso);
cso_restore_vertex_shader(ctx->cso);
- cso_restore_viewport(ctx->cso);
pipe_texture_reference(&tex, NULL);
}
@@ -485,13 +474,11 @@ util_blit_pixels_tex(struct blit_state *ctx,
cso_save_framebuffer(ctx->cso);
cso_save_fragment_shader(ctx->cso);
cso_save_vertex_shader(ctx->cso);
- cso_save_viewport(ctx->cso);
/* set misc state we care about */
cso_set_blend(ctx->cso, &ctx->blend);
cso_set_depth_stencil_alpha(ctx->cso, &ctx->depthstencil);
cso_set_rasterizer(ctx->cso, &ctx->rasterizer);
- cso_set_viewport(ctx->cso, &ctx->viewport);
/* sampler */
ctx->sampler.min_img_filter = filter;
@@ -536,5 +523,4 @@ util_blit_pixels_tex(struct blit_state *ctx,
cso_restore_framebuffer(ctx->cso);
cso_restore_fragment_shader(ctx->cso);
cso_restore_vertex_shader(ctx->cso);
- cso_restore_viewport(ctx->cso);
}
diff --git a/src/gallium/auxiliary/util/u_gen_mipmap.c b/src/gallium/auxiliary/util/u_gen_mipmap.c
index 847b4a6075e..df4a8668630 100644
--- a/src/gallium/auxiliary/util/u_gen_mipmap.c
+++ b/src/gallium/auxiliary/util/u_gen_mipmap.c
@@ -62,7 +62,6 @@ struct gen_mipmap_state
struct pipe_depth_stencil_alpha_state depthstencil;
struct pipe_rasterizer_state rasterizer;
struct pipe_sampler_state sampler;
- struct pipe_viewport_state viewport;
void *vs;
void *fs;
@@ -1292,8 +1291,7 @@ util_create_gen_mipmap(struct pipe_context *pipe,
memset(&ctx->rasterizer, 0, sizeof(ctx->rasterizer));
ctx->rasterizer.front_winding = PIPE_WINDING_CW;
ctx->rasterizer.cull_mode = PIPE_WINDING_NONE;
- ctx->rasterizer.bypass_clipping = 1;
- /*ctx->rasterizer.bypass_vs = 1;*/
+ ctx->rasterizer.bypass_vs_clip_and_viewport = 1;
ctx->rasterizer.gl_rasterization_rules = 1;
/* sampler state */
@@ -1304,17 +1302,9 @@ util_create_gen_mipmap(struct pipe_context *pipe,
ctx->sampler.min_mip_filter = PIPE_TEX_MIPFILTER_NEAREST;
ctx->sampler.normalized_coords = 1;
- /* viewport state (identity, verts are in wincoords) */
- ctx->viewport.scale[0] = 1.0;
- ctx->viewport.scale[1] = 1.0;
- ctx->viewport.scale[2] = 1.0;
- ctx->viewport.scale[3] = 1.0;
- ctx->viewport.translate[0] = 0.0;
- ctx->viewport.translate[1] = 0.0;
- ctx->viewport.translate[2] = 0.0;
- ctx->viewport.translate[3] = 0.0;
-
- /* vertex shader */
+ /* vertex shader - still needed to specify mapping from fragment
+ * shader input semantics to vertex elements
+ */
{
const uint semantic_names[] = { TGSI_SEMANTIC_POSITION,
TGSI_SEMANTIC_GENERIC };
@@ -1465,13 +1455,11 @@ util_gen_mipmap(struct gen_mipmap_state *ctx,
cso_save_framebuffer(ctx->cso);
cso_save_fragment_shader(ctx->cso);
cso_save_vertex_shader(ctx->cso);
- cso_save_viewport(ctx->cso);
/* bind our state */
cso_set_blend(ctx->cso, &ctx->blend);
cso_set_depth_stencil_alpha(ctx->cso, &ctx->depthstencil);
cso_set_rasterizer(ctx->cso, &ctx->rasterizer);
- cso_set_viewport(ctx->cso, &ctx->viewport);
cso_set_fragment_shader_handle(ctx->cso, ctx->fs);
cso_set_vertex_shader_handle(ctx->cso, ctx->vs);
@@ -1517,7 +1505,7 @@ util_gen_mipmap(struct gen_mipmap_state *ctx,
cso_set_sampler_textures(ctx->cso, 1, &pt);
- /* quad coords in window coords (bypassing clipping, viewport mapping) */
+ /* quad coords in window coords (bypassing vs, clip and viewport) */
offset = set_vertex_data(ctx,
(float) pt->width[dstLevel],
(float) pt->height[dstLevel]);
@@ -1544,5 +1532,4 @@ util_gen_mipmap(struct gen_mipmap_state *ctx,
cso_restore_framebuffer(ctx->cso);
cso_restore_fragment_shader(ctx->cso);
cso_restore_vertex_shader(ctx->cso);
- cso_restore_viewport(ctx->cso);
}
diff --git a/src/gallium/drivers/trace/tr_state.c b/src/gallium/drivers/trace/tr_state.c
index 11384b9892b..c305b093354 100644
--- a/src/gallium/drivers/trace/tr_state.c
+++ b/src/gallium/drivers/trace/tr_state.c
@@ -122,8 +122,7 @@ void trace_dump_rasterizer_state(const struct pipe_rasterizer_state *state)
trace_dump_member(uint, state, line_stipple_factor);
trace_dump_member(uint, state, line_stipple_pattern);
trace_dump_member(bool, state, line_last_pixel);
- trace_dump_member(bool, state, bypass_clipping);
- trace_dump_member(bool, state, bypass_vs);
+ trace_dump_member(bool, state, bypass_vs_clip_and_viewport);
trace_dump_member(bool, state, origin_lower_left);
trace_dump_member(bool, state, flatshade_first);
trace_dump_member(bool, state, gl_rasterization_rules);
diff --git a/src/gallium/include/pipe/p_state.h b/src/gallium/include/pipe/p_state.h
index 57a7672d6c3..aad41fab110 100644
--- a/src/gallium/include/pipe/p_state.h
+++ b/src/gallium/include/pipe/p_state.h
@@ -108,9 +108,15 @@ struct pipe_rasterizer_state
unsigned line_stipple_factor:8; /**< [1..256] actually */
unsigned line_stipple_pattern:16;
unsigned line_last_pixel:1;
- unsigned bypass_clipping:1;
- unsigned bypass_vs:1; /**< Skip the vertex shader. Note that the shader is
- still needed though, to indicate inputs/outputs */
+
+ /**
+ * Vertex coordinates are pre-transformed to screen space. Skip
+ * the vertex shader, clipping and viewport processing. Note that
+ * a vertex shader is still needed though, to indicate the mapping
+ * from vertex elements to fragment shader input semantics.
+ */
+ unsigned bypass_vs_clip_and_viewport:1;
+
unsigned origin_lower_left:1; /**< Is (0,0) the lower-left corner? */
unsigned flatshade_first:1; /**< take color attribute from the first vertex of a primitive */
unsigned gl_rasterization_rules:1; /**< enable tweaks for GL rasterization? */
diff --git a/src/mesa/state_tracker/st_cb_bitmap.c b/src/mesa/state_tracker/st_cb_bitmap.c
index f9f1780ba88..2d547dd0722 100644
--- a/src/mesa/state_tracker/st_cb_bitmap.c
+++ b/src/mesa/state_tracker/st_cb_bitmap.c
@@ -787,7 +787,6 @@ st_init_bitmap(struct st_context *st)
/* init baseline rasterizer state once */
memset(&st->bitmap.rasterizer, 0, sizeof(st->bitmap.rasterizer));
st->bitmap.rasterizer.gl_rasterization_rules = 1;
- st->bitmap.rasterizer.bypass_vs = 1;
/* find a usable texture format */
if (screen->is_format_supported(screen, PIPE_FORMAT_I8_UNORM, PIPE_TEXTURE_2D,
diff --git a/src/mesa/state_tracker/st_cb_clear.c b/src/mesa/state_tracker/st_cb_clear.c
index 8206733f766..dd9ba2881f9 100644
--- a/src/mesa/state_tracker/st_cb_clear.c
+++ b/src/mesa/state_tracker/st_cb_clear.c
@@ -60,20 +60,11 @@ st_init_clear(struct st_context *st)
{
struct pipe_context *pipe = st->pipe;
- /* rasterizer state: bypass clipping */
memset(&st->clear.raster, 0, sizeof(st->clear.raster));
st->clear.raster.gl_rasterization_rules = 1;
- st->clear.raster.bypass_clipping = 1;
-
- /* viewport state: identity since we're drawing in window coords */
- st->clear.viewport.scale[0] = 1.0;
- st->clear.viewport.scale[1] = 1.0;
- st->clear.viewport.scale[2] = 1.0;
- st->clear.viewport.scale[3] = 1.0;
- st->clear.viewport.translate[0] = 0.0;
- st->clear.viewport.translate[1] = 0.0;
- st->clear.viewport.translate[2] = 0.0;
- st->clear.viewport.translate[3] = 0.0;
+
+ /* rasterizer state: bypass vertex shader, clipping and viewport */
+ st->clear.raster.bypass_vs_clip_and_viewport = 1;
/* fragment shader state: color pass-through program */
st->clear.fs =
@@ -125,8 +116,9 @@ is_depth_stencil_format(enum pipe_format pipeFormat)
/**
* Draw a screen-aligned quadrilateral.
- * Coords are window coords with y=0=bottom. These coords will be transformed
- * by the vertex shader and viewport transform (which will flip Y if needed).
+ * Coords are window coords with y=0=bottom. These will be passed
+ * through unmodified to the rasterizer as we have set
+ * rasterizer->bypass_vs_clip_and_viewport.
*/
static void
draw_quad(GLcontext *ctx,
@@ -226,7 +218,6 @@ clear_with_quad(GLcontext *ctx,
cso_save_blend(st->cso_context);
cso_save_depth_stencil_alpha(st->cso_context);
cso_save_rasterizer(st->cso_context);
- cso_save_viewport(st->cso_context);
cso_save_fragment_shader(st->cso_context);
cso_save_vertex_shader(st->cso_context);
@@ -278,7 +269,6 @@ clear_with_quad(GLcontext *ctx,
}
cso_set_rasterizer(st->cso_context, &st->clear.raster);
- cso_set_viewport(st->cso_context, &st->clear.viewport);
cso_set_fragment_shader_handle(st->cso_context, st->clear.fs);
cso_set_vertex_shader_handle(st->cso_context, st->clear.vs);
@@ -290,7 +280,6 @@ clear_with_quad(GLcontext *ctx,
cso_restore_blend(st->cso_context);
cso_restore_depth_stencil_alpha(st->cso_context);
cso_restore_rasterizer(st->cso_context);
- cso_restore_viewport(st->cso_context);
cso_restore_fragment_shader(st->cso_context);
cso_restore_vertex_shader(st->cso_context);
}