gallium: Remove bypass_vs_clip_and_viewport from rasteriser state.
Needs testing.
This commit is contained in:
@@ -128,9 +128,7 @@ void draw_set_rasterizer_state( struct draw_context *draw,
|
||||
draw_do_flush( draw, DRAW_FLUSH_STATE_CHANGE );
|
||||
|
||||
draw->rasterizer = raster;
|
||||
draw->bypass_clipping =
|
||||
((draw->rasterizer && draw->rasterizer->bypass_vs_clip_and_viewport) ||
|
||||
draw->driver.bypass_clipping);
|
||||
draw->bypass_clipping = draw->driver.bypass_clipping;
|
||||
}
|
||||
|
||||
|
||||
@@ -140,9 +138,7 @@ void draw_set_driver_clipping( struct draw_context *draw,
|
||||
draw_do_flush( draw, DRAW_FLUSH_STATE_CHANGE );
|
||||
|
||||
draw->driver.bypass_clipping = bypass_clipping;
|
||||
draw->bypass_clipping =
|
||||
((draw->rasterizer && draw->rasterizer->bypass_vs_clip_and_viewport) ||
|
||||
draw->driver.bypass_clipping);
|
||||
draw->bypass_clipping = draw->driver.bypass_clipping;
|
||||
}
|
||||
|
||||
|
||||
|
@@ -87,10 +87,8 @@ draw_pt_arrays(struct draw_context *draw,
|
||||
opt |= PT_CLIPTEST;
|
||||
}
|
||||
|
||||
if (!draw->rasterizer->bypass_vs_clip_and_viewport) {
|
||||
opt |= PT_SHADE;
|
||||
}
|
||||
}
|
||||
|
||||
if (opt == 0)
|
||||
middle = draw->pt.middle.fetch_emit;
|
||||
|
@@ -100,8 +100,7 @@ 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->rasterizer->bypass_vs_clip_and_viewport &&
|
||||
!draw->identity_viewport);
|
||||
fse->key.viewport = !draw->identity_viewport;
|
||||
fse->key.clip = !draw->bypass_clipping;
|
||||
fse->key.const_vbuffers = 0;
|
||||
|
||||
|
@@ -96,8 +96,7 @@ 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 ||
|
||||
draw->rasterizer->bypass_vs_clip_and_viewport),
|
||||
(boolean)draw->identity_viewport,
|
||||
(boolean)draw->rasterizer->gl_rasterization_rules,
|
||||
(draw->vs.edgeflag_output ? true : false) );
|
||||
|
||||
@@ -154,9 +153,7 @@ 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, eg if
|
||||
* bypass_vs_clip_and_viewport, then the inputs == outputs, and are
|
||||
* already in the correct place.
|
||||
* the pipeline verts.
|
||||
*/
|
||||
if (opt & PT_SHADE)
|
||||
{
|
||||
@@ -239,9 +236,7 @@ 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 if
|
||||
* bypass_vs_clip_and_viewport, then the inputs == outputs, and are
|
||||
* already in the correct place.
|
||||
* the pipeline verts.
|
||||
*/
|
||||
if (opt & PT_SHADE)
|
||||
{
|
||||
@@ -319,9 +314,7 @@ 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 if
|
||||
* bypass_vs_clip_and_viewport, then the inputs == outputs, and are
|
||||
* already in the correct place.
|
||||
* the pipeline verts.
|
||||
*/
|
||||
if (opt & PT_SHADE)
|
||||
{
|
||||
|
@@ -101,7 +101,6 @@ 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_vs_clip_and_viewport = 1;
|
||||
ctx->rasterizer.gl_rasterization_rules = 1;
|
||||
|
||||
/* samplers */
|
||||
@@ -114,7 +113,6 @@ util_create_blit(struct pipe_context *pipe, struct cso_context *cso)
|
||||
ctx->sampler.mag_img_filter = 0; /* set later */
|
||||
ctx->sampler.normalized_coords = 1;
|
||||
|
||||
|
||||
/* vertex shader - still required to provide the linkage between
|
||||
* fragment shader input semantics and vertex_element/buffers.
|
||||
*/
|
||||
@@ -407,6 +405,7 @@ util_blit_pixels_writemask(struct blit_state *ctx,
|
||||
cso_save_rasterizer(ctx->cso);
|
||||
cso_save_samplers(ctx->cso);
|
||||
cso_save_sampler_textures(ctx->cso);
|
||||
cso_save_viewport(ctx->cso);
|
||||
cso_save_framebuffer(ctx->cso);
|
||||
cso_save_fragment_shader(ctx->cso);
|
||||
cso_save_vertex_shader(ctx->cso);
|
||||
@@ -422,6 +421,17 @@ util_blit_pixels_writemask(struct blit_state *ctx,
|
||||
cso_single_sampler(ctx->cso, 0, &ctx->sampler);
|
||||
cso_single_sampler_done(ctx->cso);
|
||||
|
||||
/* viewport */
|
||||
ctx->viewport.scale[0] = 0.5f * dst->width;
|
||||
ctx->viewport.scale[1] = 0.5f * dst->height;
|
||||
ctx->viewport.scale[2] = 1.0f;
|
||||
ctx->viewport.scale[3] = 1.0f;
|
||||
ctx->viewport.translate[0] = 0.5f * dst->width;
|
||||
ctx->viewport.translate[1] = 0.5f * dst->height;
|
||||
ctx->viewport.translate[2] = 0.0f;
|
||||
ctx->viewport.translate[3] = 0.0f;
|
||||
cso_set_viewport(ctx->cso, &ctx->viewport);
|
||||
|
||||
/* texture */
|
||||
cso_set_sampler_textures(ctx->cso, 1, &tex);
|
||||
|
||||
@@ -461,6 +471,7 @@ util_blit_pixels_writemask(struct blit_state *ctx,
|
||||
cso_restore_rasterizer(ctx->cso);
|
||||
cso_restore_samplers(ctx->cso);
|
||||
cso_restore_sampler_textures(ctx->cso);
|
||||
cso_restore_viewport(ctx->cso);
|
||||
cso_restore_framebuffer(ctx->cso);
|
||||
cso_restore_fragment_shader(ctx->cso);
|
||||
cso_restore_vertex_shader(ctx->cso);
|
||||
|
@@ -160,7 +160,6 @@ struct blitter_context *util_blitter_create(struct pipe_context *pipe)
|
||||
memset(&rs_state, 0, sizeof(rs_state));
|
||||
rs_state.front_winding = PIPE_WINDING_CW;
|
||||
rs_state.cull_mode = PIPE_WINDING_NONE;
|
||||
rs_state.bypass_vs_clip_and_viewport = 1;
|
||||
rs_state.gl_rasterization_rules = 1;
|
||||
rs_state.flatshade = 1;
|
||||
ctx->rs_state = pipe->create_rasterizer_state(pipe, &rs_state);
|
||||
|
@@ -318,7 +318,6 @@ util_dump_rasterizer_state(struct os_stream *stream, const struct pipe_rasterize
|
||||
util_dump_member(stream, uint, state, line_stipple_factor);
|
||||
util_dump_member(stream, uint, state, line_stipple_pattern);
|
||||
util_dump_member(stream, bool, state, line_last_pixel);
|
||||
util_dump_member(stream, bool, state, bypass_vs_clip_and_viewport);
|
||||
util_dump_member(stream, bool, state, flatshade_first);
|
||||
util_dump_member(stream, bool, state, gl_rasterization_rules);
|
||||
|
||||
|
@@ -1296,7 +1296,6 @@ 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_vs_clip_and_viewport = 1;
|
||||
ctx->rasterizer.gl_rasterization_rules = 1;
|
||||
|
||||
/* sampler state */
|
||||
@@ -1361,25 +1360,25 @@ get_next_slot(struct gen_mipmap_state *ctx)
|
||||
static unsigned
|
||||
set_vertex_data(struct gen_mipmap_state *ctx,
|
||||
enum pipe_texture_target tex_target,
|
||||
uint face, float width, float height)
|
||||
uint face)
|
||||
{
|
||||
unsigned offset;
|
||||
|
||||
/* vert[0].position */
|
||||
ctx->vertices[0][0][0] = 0.0f; /*x*/
|
||||
ctx->vertices[0][0][1] = 0.0f; /*y*/
|
||||
ctx->vertices[0][0][0] = -1.0f; /*x*/
|
||||
ctx->vertices[0][0][1] = -1.0f; /*y*/
|
||||
|
||||
/* vert[1].position */
|
||||
ctx->vertices[1][0][0] = width;
|
||||
ctx->vertices[1][0][1] = 0.0f;
|
||||
ctx->vertices[1][0][0] = 1.0f;
|
||||
ctx->vertices[1][0][1] = -1.0f;
|
||||
|
||||
/* vert[2].position */
|
||||
ctx->vertices[2][0][0] = width;
|
||||
ctx->vertices[2][0][1] = height;
|
||||
ctx->vertices[2][0][0] = 1.0f;
|
||||
ctx->vertices[2][0][1] = 1.0f;
|
||||
|
||||
/* vert[3].position */
|
||||
ctx->vertices[3][0][0] = 0.0f;
|
||||
ctx->vertices[3][0][1] = height;
|
||||
ctx->vertices[3][0][0] = -1.0f;
|
||||
ctx->vertices[3][0][1] = 1.0f;
|
||||
|
||||
/* Setup vertex texcoords. This is a little tricky for cube maps. */
|
||||
if (tex_target == PIPE_TEXTURE_CUBE) {
|
||||
@@ -1499,6 +1498,7 @@ 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);
|
||||
@@ -1522,6 +1522,7 @@ util_gen_mipmap(struct gen_mipmap_state *ctx,
|
||||
*/
|
||||
for (dstLevel = baseLevel + 1; dstLevel <= lastLevel; dstLevel++) {
|
||||
const uint srcLevel = dstLevel - 1;
|
||||
struct pipe_viewport_state vp;
|
||||
|
||||
struct pipe_surface *surf =
|
||||
screen->get_tex_surface(screen, pt, face, dstLevel, zslice,
|
||||
@@ -1535,6 +1536,17 @@ util_gen_mipmap(struct gen_mipmap_state *ctx,
|
||||
fb.height = u_minify(pt->height0, dstLevel);
|
||||
cso_set_framebuffer(ctx->cso, &fb);
|
||||
|
||||
/* viewport */
|
||||
vp.scale[0] = 0.5f * fb.width;
|
||||
vp.scale[1] = 0.5f * fb.height;
|
||||
vp.scale[2] = 1.0f;
|
||||
vp.scale[3] = 1.0f;
|
||||
vp.translate[0] = 0.5f * fb.width;
|
||||
vp.translate[1] = 0.5f * fb.height;
|
||||
vp.translate[2] = 0.0f;
|
||||
vp.translate[3] = 0.0f;
|
||||
cso_set_viewport(ctx->cso, &vp);
|
||||
|
||||
/*
|
||||
* Setup sampler state
|
||||
* Note: we should only have to set the min/max LOD clamps to ensure
|
||||
@@ -1549,12 +1561,10 @@ util_gen_mipmap(struct gen_mipmap_state *ctx,
|
||||
|
||||
cso_set_sampler_textures(ctx->cso, 1, &pt);
|
||||
|
||||
/* quad coords in window coords (bypassing vs, clip and viewport) */
|
||||
/* quad coords in clip coords */
|
||||
offset = set_vertex_data(ctx,
|
||||
pt->target,
|
||||
face,
|
||||
(float) u_minify(pt->width0, dstLevel),
|
||||
(float) u_minify(pt->height0, dstLevel));
|
||||
face);
|
||||
|
||||
util_draw_vertex_buffer(ctx->pipe,
|
||||
ctx->vbuf,
|
||||
@@ -1578,4 +1588,5 @@ 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);
|
||||
}
|
||||
|
@@ -10,18 +10,6 @@ multisample state, scissoring and flat/smooth shading.
|
||||
Members
|
||||
-------
|
||||
|
||||
bypass_vs_clip_and_viewport
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Whether the entire TCL pipeline should be bypassed. This implies that
|
||||
vertices are pre-transformed for the viewport, and will not be run
|
||||
through the vertex shader.
|
||||
|
||||
.. note::
|
||||
|
||||
Implementations may still clip away vertices that are not in the viewport
|
||||
when this is set.
|
||||
|
||||
flatshade
|
||||
^^^^^^^^^
|
||||
|
||||
|
@@ -101,7 +101,6 @@ struct nv30_blend_state {
|
||||
struct nv30_state {
|
||||
unsigned scissor_enabled;
|
||||
unsigned stipple_enabled;
|
||||
unsigned viewport_bypass;
|
||||
unsigned fp_samplers;
|
||||
|
||||
uint64_t dirty;
|
||||
|
@@ -5,22 +5,12 @@ nv30_state_viewport_validate(struct nv30_context *nv30)
|
||||
{
|
||||
struct pipe_viewport_state *vpt = &nv30->viewport;
|
||||
struct nouveau_stateobj *so;
|
||||
unsigned bypass;
|
||||
|
||||
if (/*nv30->render_mode == HW &&*/
|
||||
!nv30->rasterizer->pipe.bypass_vs_clip_and_viewport)
|
||||
bypass = 0;
|
||||
else
|
||||
bypass = 1;
|
||||
|
||||
if (nv30->state.hw[NV30_STATE_VIEWPORT] &&
|
||||
(bypass || !(nv30->dirty & NV30_NEW_VIEWPORT)) &&
|
||||
nv30->state.viewport_bypass == bypass)
|
||||
!(nv30->dirty & NV30_NEW_VIEWPORT))
|
||||
return FALSE;
|
||||
nv30->state.viewport_bypass = bypass;
|
||||
|
||||
so = so_new(3, 10, 0);
|
||||
if (!bypass) {
|
||||
so_method(so, nv30->screen->rankine,
|
||||
NV34TCL_VIEWPORT_TRANSLATE_X, 8);
|
||||
so_data (so, fui(vpt->translate[0]));
|
||||
@@ -33,27 +23,7 @@ nv30_state_viewport_validate(struct nv30_context *nv30)
|
||||
so_data (so, fui(vpt->scale[3]));
|
||||
/* so_method(so, nv30->screen->rankine, 0x1d78, 1);
|
||||
so_data (so, 1);
|
||||
*/ } else {
|
||||
so_method(so, nv30->screen->rankine,
|
||||
NV34TCL_VIEWPORT_TRANSLATE_X, 8);
|
||||
so_data (so, fui(0.0));
|
||||
so_data (so, fui(0.0));
|
||||
so_data (so, fui(0.0));
|
||||
so_data (so, fui(0.0));
|
||||
so_data (so, fui(1.0));
|
||||
so_data (so, fui(1.0));
|
||||
so_data (so, fui(1.0));
|
||||
so_data (so, fui(0.0));
|
||||
/* Not entirely certain what this is yet. The DDX uses this
|
||||
* value also as it fixes rendering when you pass
|
||||
* pre-transformed vertices to the GPU. My best gusss is that
|
||||
* this bypasses some culling/clipping stage. Might be worth
|
||||
* noting that points/lines are uneffected by whatever this
|
||||
* value fixes, only filled polygons are effected.
|
||||
*/
|
||||
/* so_method(so, nv30->screen->rankine, 0x1d78, 1);
|
||||
so_data (so, 0x110);
|
||||
*/ }
|
||||
/* TODO/FIXME: never saw value 0x0110 in renouveau dumps, only 0x0001 */
|
||||
so_method(so, nv30->screen->rankine, 0x1d78, 1);
|
||||
so_data (so, 1);
|
||||
|
@@ -101,7 +101,6 @@ struct nv40_blend_state {
|
||||
struct nv40_state {
|
||||
unsigned scissor_enabled;
|
||||
unsigned stipple_enabled;
|
||||
unsigned viewport_bypass;
|
||||
unsigned fp_samplers;
|
||||
|
||||
uint64_t dirty;
|
||||
|
@@ -5,22 +5,12 @@ nv40_state_viewport_validate(struct nv40_context *nv40)
|
||||
{
|
||||
struct pipe_viewport_state *vpt = &nv40->viewport;
|
||||
struct nouveau_stateobj *so;
|
||||
unsigned bypass;
|
||||
|
||||
if (nv40->render_mode == HW &&
|
||||
!nv40->rasterizer->pipe.bypass_vs_clip_and_viewport)
|
||||
bypass = 0;
|
||||
else
|
||||
bypass = 1;
|
||||
|
||||
if (nv40->state.hw[NV40_STATE_VIEWPORT] &&
|
||||
(bypass || !(nv40->dirty & NV40_NEW_VIEWPORT)) &&
|
||||
nv40->state.viewport_bypass == bypass)
|
||||
!(nv40->dirty & NV40_NEW_VIEWPORT))
|
||||
return FALSE;
|
||||
nv40->state.viewport_bypass = bypass;
|
||||
|
||||
so = so_new(2, 9, 0);
|
||||
if (!bypass) {
|
||||
so_method(so, nv40->screen->curie,
|
||||
NV40TCL_VIEWPORT_TRANSLATE_X, 8);
|
||||
so_data (so, fui(vpt->translate[0]));
|
||||
@@ -33,27 +23,6 @@ nv40_state_viewport_validate(struct nv40_context *nv40)
|
||||
so_data (so, fui(vpt->scale[3]));
|
||||
so_method(so, nv40->screen->curie, 0x1d78, 1);
|
||||
so_data (so, 1);
|
||||
} else {
|
||||
so_method(so, nv40->screen->curie,
|
||||
NV40TCL_VIEWPORT_TRANSLATE_X, 8);
|
||||
so_data (so, fui(0.0));
|
||||
so_data (so, fui(0.0));
|
||||
so_data (so, fui(0.0));
|
||||
so_data (so, fui(0.0));
|
||||
so_data (so, fui(1.0));
|
||||
so_data (so, fui(1.0));
|
||||
so_data (so, fui(1.0));
|
||||
so_data (so, fui(0.0));
|
||||
/* Not entirely certain what this is yet. The DDX uses this
|
||||
* value also as it fixes rendering when you pass
|
||||
* pre-transformed vertices to the GPU. My best gusss is that
|
||||
* this bypasses some culling/clipping stage. Might be worth
|
||||
* noting that points/lines are uneffected by whatever this
|
||||
* value fixes, only filled polygons are effected.
|
||||
*/
|
||||
so_method(so, nv40->screen->curie, 0x1d78, 1);
|
||||
so_data (so, 0x110);
|
||||
}
|
||||
|
||||
so_ref(so, &nv40->state.hw[NV40_STATE_VIEWPORT]);
|
||||
so_ref(NULL, &so);
|
||||
|
@@ -127,7 +127,6 @@ struct nv50_state {
|
||||
struct nouveau_stateobj *scissor;
|
||||
unsigned scissor_enabled;
|
||||
struct nouveau_stateobj *viewport;
|
||||
unsigned viewport_bypass;
|
||||
struct nouveau_stateobj *tsc_upload;
|
||||
struct nouveau_stateobj *tic_upload;
|
||||
unsigned miptree_nr[PIPE_SHADER_TYPES];
|
||||
|
@@ -375,21 +375,11 @@ nv50_state_validate(struct nv50_context *nv50)
|
||||
scissor_uptodate:
|
||||
|
||||
if (nv50->dirty & (NV50_NEW_VIEWPORT | NV50_NEW_RASTERIZER)) {
|
||||
unsigned bypass;
|
||||
|
||||
if (!nv50->rasterizer->pipe.bypass_vs_clip_and_viewport)
|
||||
bypass = 0;
|
||||
else
|
||||
bypass = 1;
|
||||
|
||||
if (nv50->state.viewport &&
|
||||
(bypass || !(nv50->dirty & NV50_NEW_VIEWPORT)) &&
|
||||
nv50->state.viewport_bypass == bypass)
|
||||
!(nv50->dirty & NV50_NEW_VIEWPORT))
|
||||
goto viewport_uptodate;
|
||||
nv50->state.viewport_bypass = bypass;
|
||||
|
||||
so = so_new(5, 9, 0);
|
||||
if (!bypass) {
|
||||
so_method(so, tesla, NV50TCL_VIEWPORT_TRANSLATE_X(0), 3);
|
||||
so_data (so, fui(nv50->viewport.translate[0]));
|
||||
so_data (so, fui(nv50->viewport.translate[1]));
|
||||
@@ -411,14 +401,6 @@ scissor_uptodate:
|
||||
/* no idea what 0f90 does */
|
||||
so_method(so, tesla, 0x0f90, 1);
|
||||
so_data (so, 0);
|
||||
} else {
|
||||
so_method(so, tesla, NV50TCL_VIEWPORT_TRANSFORM_EN, 1);
|
||||
so_data (so, 0);
|
||||
so_method(so, tesla, NV50TCL_VIEW_VOLUME_CLIP_CTRL, 1);
|
||||
so_data (so, 0x0000);
|
||||
so_method(so, tesla, 0x0f90, 1);
|
||||
so_data (so, 1);
|
||||
}
|
||||
|
||||
so_ref(so, &nv50->state.viewport);
|
||||
so_ref(NULL, &so);
|
||||
|
@@ -337,8 +337,6 @@ struct r300_context {
|
||||
uint32_t dirty_state;
|
||||
/* Flag indicating whether or not the HW is dirty. */
|
||||
uint32_t dirty_hw;
|
||||
/* Whether the TCL engine should be in bypass mode. */
|
||||
boolean tcl_bypass;
|
||||
/* Whether polygon offset is enabled. */
|
||||
boolean polygon_offset_enabled;
|
||||
/* Z buffer bit depth. */
|
||||
|
@@ -170,23 +170,15 @@ static const float * get_shader_constant(
|
||||
break;
|
||||
|
||||
case RC_STATE_R300_VIEWPORT_SCALE:
|
||||
if (r300->tcl_bypass) {
|
||||
vec[0] = 1;
|
||||
vec[1] = 1;
|
||||
vec[2] = 1;
|
||||
} else {
|
||||
vec[0] = viewport->xscale;
|
||||
vec[1] = viewport->yscale;
|
||||
vec[2] = viewport->zscale;
|
||||
}
|
||||
break;
|
||||
|
||||
case RC_STATE_R300_VIEWPORT_OFFSET:
|
||||
if (!r300->tcl_bypass) {
|
||||
vec[0] = viewport->xoffset;
|
||||
vec[1] = viewport->yoffset;
|
||||
vec[2] = viewport->zoffset;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -936,11 +928,6 @@ void r300_emit_viewport_state(struct r300_context* r300, void* state)
|
||||
struct r300_viewport_state* viewport = (struct r300_viewport_state*)state;
|
||||
CS_LOCALS(r300);
|
||||
|
||||
if (r300->tcl_bypass) {
|
||||
BEGIN_CS(2);
|
||||
OUT_CS_REG(R300_VAP_VTE_CNTL, 0);
|
||||
END_CS;
|
||||
} else {
|
||||
BEGIN_CS(9);
|
||||
OUT_CS_REG_SEQ(R300_SE_VPORT_XSCALE, 6);
|
||||
OUT_CS_32F(viewport->xscale);
|
||||
@@ -952,7 +939,6 @@ void r300_emit_viewport_state(struct r300_context* r300, void* state)
|
||||
OUT_CS_REG(R300_VAP_VTE_CNTL, viewport->vte_control);
|
||||
END_CS;
|
||||
}
|
||||
}
|
||||
|
||||
void r300_emit_texture_count(struct r300_context* r300)
|
||||
{
|
||||
|
@@ -711,8 +711,7 @@ static void* r300_create_rs_state(struct pipe_context* pipe,
|
||||
|
||||
/* If bypassing TCL, or if no TCL engine is present, turn off the HW TCL.
|
||||
* Else, enable HW TCL and force Draw's TCL off. */
|
||||
if (state->bypass_vs_clip_and_viewport ||
|
||||
!r300screen->caps->has_tcl) {
|
||||
if (!r300screen->caps->has_tcl) {
|
||||
rs->vap_control_status |= R300_VAP_TCL_BYPASS;
|
||||
}
|
||||
|
||||
@@ -824,10 +823,8 @@ static void r300_bind_rs_state(struct pipe_context* pipe, void* state)
|
||||
}
|
||||
|
||||
if (rs) {
|
||||
r300->tcl_bypass = rs->rs.bypass_vs_clip_and_viewport;
|
||||
r300->polygon_offset_enabled = rs->rs.offset_cw || rs->rs.offset_ccw;
|
||||
} else {
|
||||
r300->tcl_bypass = FALSE;
|
||||
r300->polygon_offset_enabled = FALSE;
|
||||
}
|
||||
|
||||
|
@@ -114,13 +114,7 @@ static void r300_vertex_psc(struct r300_context* r300)
|
||||
int identity[16] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
|
||||
int* stream_tab;
|
||||
|
||||
/* If TCL is bypassed, map vertex streams to equivalent VS output
|
||||
* locations. */
|
||||
if (r300->tcl_bypass) {
|
||||
stream_tab = r300->vs->stream_loc_notcl;
|
||||
} else {
|
||||
stream_tab = identity;
|
||||
}
|
||||
|
||||
/* Vertex shaders have no semantics on their inputs,
|
||||
* so PSC should just route stuff based on the vertex elements,
|
||||
|
@@ -174,7 +174,6 @@ init_pipe_state(struct sp_mpeg12_context *ctx)
|
||||
rast.line_stipple_factor = 0;
|
||||
rast.line_stipple_pattern = 0;
|
||||
rast.line_last_pixel = 0;
|
||||
rast.bypass_vs_clip_and_viewport = 0;
|
||||
rast.line_width = 1;
|
||||
rast.point_smooth = 0;
|
||||
rast.point_quad_rasterization = 0;
|
||||
|
@@ -120,37 +120,17 @@ static int emit_viewport( struct svga_context *svga,
|
||||
float fb_width = svga->curr.framebuffer.width;
|
||||
float fb_height = svga->curr.framebuffer.height;
|
||||
|
||||
float fx = viewport->scale[0] * -1.0 + viewport->translate[0];
|
||||
float fy = flip * viewport->scale[1] * -1.0 + viewport->translate[1];
|
||||
float fw = viewport->scale[0] * 2;
|
||||
float fh = flip * viewport->scale[1] * 2;
|
||||
|
||||
memset( &prescale, 0, sizeof(prescale) );
|
||||
|
||||
if (svga->curr.rast->templ.bypass_vs_clip_and_viewport) {
|
||||
|
||||
/* Avoid POSITIONT as it has a non trivial implementation outside the D3D
|
||||
* API. Always generate a vertex shader.
|
||||
*/
|
||||
rect.x = 0;
|
||||
rect.y = 0;
|
||||
rect.w = svga->curr.framebuffer.width;
|
||||
rect.h = svga->curr.framebuffer.height;
|
||||
|
||||
prescale.scale[0] = 2.0 / (float)rect.w;
|
||||
prescale.scale[1] = - 2.0 / (float)rect.h;
|
||||
prescale.scale[2] = 1.0;
|
||||
prescale.scale[3] = 1.0;
|
||||
prescale.translate[0] = -1.0f;
|
||||
prescale.translate[1] = 1.0f;
|
||||
prescale.translate[2] = 0;
|
||||
prescale.translate[3] = 0;
|
||||
prescale.enabled = TRUE;
|
||||
} else {
|
||||
|
||||
/* Examine gallium viewport transformation and produce a screen
|
||||
* rectangle and possibly vertex shader pre-transformation to
|
||||
* get the same results.
|
||||
*/
|
||||
float fx = viewport->scale[0] * -1.0 + viewport->translate[0];
|
||||
float fy = flip * viewport->scale[1] * -1.0 + viewport->translate[1];
|
||||
float fw = viewport->scale[0] * 2;
|
||||
float fh = flip * viewport->scale[1] * 2;
|
||||
|
||||
SVGA_DBG(DEBUG_VIEWPORT,
|
||||
"\ninitial %f,%f %fx%f\n",
|
||||
@@ -288,7 +268,6 @@ static int emit_viewport( struct svga_context *svga,
|
||||
range_max = range_tmp;
|
||||
prescale.scale[2] = -prescale.scale[2];
|
||||
}
|
||||
}
|
||||
|
||||
if (prescale.enabled) {
|
||||
float H[2];
|
||||
|
@@ -129,8 +129,7 @@ static int update_need_pipeline( struct svga_context *svga,
|
||||
|
||||
/* SVGA_NEW_CLIP
|
||||
*/
|
||||
if (!svga->curr.rast->templ.bypass_vs_clip_and_viewport &&
|
||||
svga->curr.clip.nr) {
|
||||
if (svga->curr.clip.nr) {
|
||||
SVGA_DBG(DEBUG_SWTNL, "%s: userclip\n", __FUNCTION__);
|
||||
need_pipeline = TRUE;
|
||||
}
|
||||
|
@@ -112,7 +112,6 @@ 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_vs_clip_and_viewport);
|
||||
trace_dump_member(bool, state, flatshade_first);
|
||||
trace_dump_member(bool, state, gl_rasterization_rules);
|
||||
|
||||
|
@@ -113,16 +113,6 @@ struct pipe_rasterizer_state
|
||||
unsigned line_stipple_pattern:16;
|
||||
unsigned line_last_pixel:1;
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* XXX: considered for removal.
|
||||
*/
|
||||
unsigned bypass_vs_clip_and_viewport:1;
|
||||
|
||||
/**
|
||||
* Use the first vertex of a primitive as the provoking vertex for
|
||||
* flat shading.
|
||||
|
@@ -65,9 +65,6 @@ st_init_clear(struct st_context *st)
|
||||
memset(&st->clear.raster, 0, sizeof(st->clear.raster));
|
||||
st->clear.raster.gl_rasterization_rules = 1;
|
||||
|
||||
/* 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 =
|
||||
util_make_fragment_passthrough_shader(pipe);
|
||||
@@ -104,9 +101,7 @@ st_destroy_clear(struct st_context *st)
|
||||
|
||||
/**
|
||||
* Draw a screen-aligned quadrilateral.
|
||||
* 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.
|
||||
* Coords are clip coords with y=0=bottom.
|
||||
*/
|
||||
static void
|
||||
draw_quad(GLcontext *ctx,
|
||||
@@ -192,18 +187,13 @@ clear_with_quad(GLcontext *ctx,
|
||||
GLboolean color, GLboolean depth, GLboolean stencil)
|
||||
{
|
||||
struct st_context *st = ctx->st;
|
||||
const GLfloat x0 = (GLfloat) ctx->DrawBuffer->_Xmin;
|
||||
const GLfloat x1 = (GLfloat) ctx->DrawBuffer->_Xmax;
|
||||
GLfloat y0, y1;
|
||||
|
||||
if (st_fb_orientation(ctx->DrawBuffer) == Y_0_TOP) {
|
||||
y0 = (GLfloat) (ctx->DrawBuffer->Height - ctx->DrawBuffer->_Ymax);
|
||||
y1 = (GLfloat) (ctx->DrawBuffer->Height - ctx->DrawBuffer->_Ymin);
|
||||
}
|
||||
else {
|
||||
y0 = (GLfloat) ctx->DrawBuffer->_Ymin;
|
||||
y1 = (GLfloat) ctx->DrawBuffer->_Ymax;
|
||||
}
|
||||
const struct gl_framebuffer *fb = ctx->DrawBuffer;
|
||||
const GLfloat fb_width = (GLfloat) fb->Width;
|
||||
const GLfloat fb_height = (GLfloat) fb->Height;
|
||||
const GLfloat x0 = (GLfloat) ctx->DrawBuffer->_Xmin / fb_width * 2.0f - 1.0f;
|
||||
const GLfloat x1 = (GLfloat) ctx->DrawBuffer->_Xmax / fb_width * 2.0f - 1.0f;
|
||||
const GLfloat y0 = (GLfloat) ctx->DrawBuffer->_Ymin / fb_height * 2.0f - 1.0f;
|
||||
const GLfloat y1 = (GLfloat) ctx->DrawBuffer->_Ymax / fb_height * 2.0f - 1.0f;
|
||||
|
||||
/*
|
||||
printf("%s %s%s%s %f,%f %f,%f\n", __FUNCTION__,
|
||||
@@ -218,6 +208,7 @@ clear_with_quad(GLcontext *ctx,
|
||||
cso_save_stencil_ref(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);
|
||||
|
||||
@@ -273,6 +264,21 @@ clear_with_quad(GLcontext *ctx,
|
||||
|
||||
cso_set_rasterizer(st->cso_context, &st->clear.raster);
|
||||
|
||||
/* viewport state: viewport matching window dims */
|
||||
{
|
||||
const GLboolean invert = (st_fb_orientation(fb) == Y_0_TOP);
|
||||
struct pipe_viewport_state vp;
|
||||
vp.scale[0] = 0.5f * fb_width;
|
||||
vp.scale[1] = fb_height * (invert ? -0.5f : 0.5f);
|
||||
vp.scale[2] = 1.0f;
|
||||
vp.scale[3] = 1.0f;
|
||||
vp.translate[0] = 0.5f * fb_width;
|
||||
vp.translate[1] = 0.5f * fb_height;
|
||||
vp.translate[2] = 0.0f;
|
||||
vp.translate[3] = 0.0f;
|
||||
cso_set_viewport(st->cso_context, &vp);
|
||||
}
|
||||
|
||||
cso_set_fragment_shader_handle(st->cso_context, st->clear.fs);
|
||||
cso_set_vertex_shader_handle(st->cso_context, st->clear.vs);
|
||||
|
||||
@@ -284,9 +290,9 @@ clear_with_quad(GLcontext *ctx,
|
||||
cso_restore_stencil_ref(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);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user