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);
}
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);
}
opt |= PT_CLIPTEST;
}
- if (!draw->rasterizer->bypass_vs) {
+ if (!draw->rasterizer->bypass_vs_clip_and_viewport) {
opt |= PT_SHADE;
}
}
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 );
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;
*/
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 );
(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)
{
(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)
{
(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)
{
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;
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 */
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 };
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;
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);
}
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;
cso_restore_framebuffer(ctx->cso);
cso_restore_fragment_shader(ctx->cso);
cso_restore_vertex_shader(ctx->cso);
- cso_restore_viewport(ctx->cso);
}
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;
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 */
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 };
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);
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]);
cso_restore_framebuffer(ctx->cso);
cso_restore_fragment_shader(ctx->cso);
cso_restore_vertex_shader(ctx->cso);
- cso_restore_viewport(ctx->cso);
}
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);
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? */
/* 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,
{
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 =
/**
* 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,
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);
}
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);
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);
}