virglrenderer: move scissor enables out of draw path.

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
macos/master
Dave Airlie 6 years ago
parent 827bee8f78
commit 2ebcc6d69a
  1. 23
      src/vrend_renderer.c

@ -3342,16 +3342,10 @@ void vrend_clear(struct vrend_context *ctx,
static void vrend_update_scissor_state(struct vrend_context *ctx) static void vrend_update_scissor_state(struct vrend_context *ctx)
{ {
struct pipe_scissor_state *ss; struct pipe_scissor_state *ss;
struct pipe_rasterizer_state *state = &ctx->sub->rs_state;
GLint y; GLint y;
GLuint idx; GLuint idx;
unsigned mask = ctx->sub->scissor_state_dirty; unsigned mask = ctx->sub->scissor_state_dirty;
if (state->scissor)
glEnable(GL_SCISSOR_TEST);
else
glDisable(GL_SCISSOR_TEST);
while (mask) { while (mask) {
idx = u_bit_scan(&mask); idx = u_bit_scan(&mask);
if (idx >= PIPE_MAX_VIEWPORTS) { if (idx >= PIPE_MAX_VIEWPORTS) {
@ -4886,6 +4880,12 @@ static void vrend_hw_emit_rs(struct vrend_context *ctx)
glDisable(GL_SAMPLE_SHADING); glDisable(GL_SAMPLE_SHADING);
} }
} }
if (state->scissor)
glEnable(GL_SCISSOR_TEST);
else
glDisable(GL_SCISSOR_TEST);
} }
void vrend_object_bind_rasterizer(struct vrend_context *ctx, void vrend_object_bind_rasterizer(struct vrend_context *ctx,
@ -4906,7 +4906,6 @@ void vrend_object_bind_rasterizer(struct vrend_context *ctx,
} }
ctx->sub->rs_state = *state; ctx->sub->rs_state = *state;
ctx->sub->scissor_state_dirty = (1 << 0);
ctx->sub->shader_dirty = true; ctx->sub->shader_dirty = true;
vrend_hw_emit_rs(ctx); vrend_hw_emit_rs(ctx);
} }
@ -7274,6 +7273,9 @@ void vrend_renderer_resource_copy_region(struct vrend_context *ctx,
dy2, dy2,
glmask, GL_NEAREST); glmask, GL_NEAREST);
glBindFramebuffer(GL_FRAMEBUFFER, ctx->sub->fb_id); glBindFramebuffer(GL_FRAMEBUFFER, ctx->sub->fb_id);
if (ctx->sub->rs_state.scissor)
glEnable(GL_SCISSOR_TEST);
} }
static void vrend_renderer_blit_int(struct vrend_context *ctx, static void vrend_renderer_blit_int(struct vrend_context *ctx,
@ -7373,10 +7375,10 @@ static void vrend_renderer_blit_int(struct vrend_context *ctx,
if (info->scissor_enable) { if (info->scissor_enable) {
glScissor(info->scissor.minx, info->scissor.miny, info->scissor.maxx - info->scissor.minx, info->scissor.maxy - info->scissor.miny); glScissor(info->scissor.minx, info->scissor.miny, info->scissor.maxx - info->scissor.minx, info->scissor.maxy - info->scissor.miny);
ctx->sub->scissor_state_dirty = (1 << 0);
glEnable(GL_SCISSOR_TEST); glEnable(GL_SCISSOR_TEST);
} else } else
glDisable(GL_SCISSOR_TEST); glDisable(GL_SCISSOR_TEST);
ctx->sub->scissor_state_dirty = (1 << 0);
/* An GLES GL_INVALID_OPERATION is generated if one wants to blit from a /* An GLES GL_INVALID_OPERATION is generated if one wants to blit from a
* multi-sample fbo to a non multi-sample fbo and the source and destination * multi-sample fbo to a non multi-sample fbo and the source and destination
@ -7487,6 +7489,11 @@ static void vrend_renderer_blit_int(struct vrend_context *ctx,
vrend_renderer_resource_destroy(intermediate_copy, false); vrend_renderer_resource_destroy(intermediate_copy, false);
glDeleteFramebuffers(1, &intermediate_fbo); glDeleteFramebuffers(1, &intermediate_fbo);
} }
if (ctx->sub->rs_state.scissor)
glEnable(GL_SCISSOR_TEST);
else
glDisable(GL_SCISSOR_TEST);
} }
void vrend_renderer_blit(struct vrend_context *ctx, void vrend_renderer_blit(struct vrend_context *ctx,

Loading…
Cancel
Save