diff options
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/state_tracker/st_atom_clip.c | 24 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_atom_rasterizer.c | 7 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_cb_bitmap.c | 1 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_cb_clear.c | 4 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_cb_drawpixels.c | 1 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_context.h | 1 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_extensions.c | 2 |
7 files changed, 17 insertions, 23 deletions
diff --git a/src/mesa/state_tracker/st_atom_clip.c b/src/mesa/state_tracker/st_atom_clip.c index 236d3cf409d..2a51100984a 100644 --- a/src/mesa/state_tracker/st_atom_clip.c +++ b/src/mesa/state_tracker/st_atom_clip.c @@ -35,6 +35,7 @@ #include "pipe/p_context.h" #include "st_atom.h" #include "st_program.h" +#include "util/u_debug.h" #include "cso_cache/cso_context.h" @@ -44,10 +45,9 @@ static void update_clip( struct st_context *st ) { struct pipe_clip_state clip; const struct gl_context *ctx = st->ctx; - GLuint i; bool use_eye = FALSE; - memset(&clip, 0, sizeof(clip)); + assert(sizeof(clip.ucp) <= sizeof(ctx->Transform._ClipUserPlane)); /* if we have a vertex shader that writes clip vertex we need to pass the pre-projection transformed coordinates into the driver. */ @@ -56,21 +56,11 @@ static void update_clip( struct st_context *st ) use_eye = TRUE; } - for (i = 0; i < PIPE_MAX_CLIP_PLANES; i++) { - if (ctx->Transform.ClipPlanesEnabled & (1 << i)) { - memcpy(clip.ucp[clip.nr], - use_eye ? ctx->Transform.EyeUserPlane[i] : ctx->Transform._ClipUserPlane[i], - sizeof(clip.ucp[0])); - clip.nr++; - } - } - - clip.depth_clamp = ctx->Transform.DepthClamp != GL_FALSE; - - if (memcmp(&clip, &st->state.clip, sizeof(clip)) != 0) { - st->state.clip = clip; - cso_set_clip(st->cso_context, &clip); - } + memcpy(clip.ucp, + use_eye ? ctx->Transform.EyeUserPlane + : ctx->Transform._ClipUserPlane, sizeof(clip.ucp)); + st->state.clip = clip; + cso_set_clip(st->cso_context, &clip); } diff --git a/src/mesa/state_tracker/st_atom_rasterizer.c b/src/mesa/state_tracker/st_atom_rasterizer.c index 2d6ad45bad9..f3d28e675f5 100644 --- a/src/mesa/state_tracker/st_atom_rasterizer.c +++ b/src/mesa/state_tracker/st_atom_rasterizer.c @@ -261,6 +261,10 @@ static void update_raster_state( struct st_context *st ) /* _NEW_RASTERIZER_DISCARD */ raster->rasterizer_discard = ctx->RasterDiscard; + /* _NEW_TRANSFORM */ + raster->depth_clip = ctx->Transform.DepthClamp == GL_FALSE; + raster->clip_plane_enable = ctx->Transform.ClipPlanesEnabled; + cso_set_rasterizer(st->cso_context, raster); } @@ -276,7 +280,8 @@ const struct st_tracked_state st_update_rasterizer = { _NEW_PROGRAM | _NEW_SCISSOR | _NEW_FRAG_CLAMP | - _NEW_RASTERIZER_DISCARD), /* mesa state dependencies*/ + _NEW_RASTERIZER_DISCARD | + _NEW_TRANSFORM), /* mesa state dependencies*/ ST_NEW_VERTEX_PROGRAM, /* state tracker dependencies */ }, update_raster_state /* update function */ diff --git a/src/mesa/state_tracker/st_cb_bitmap.c b/src/mesa/state_tracker/st_cb_bitmap.c index af33bcf8605..a9709680208 100644 --- a/src/mesa/state_tracker/st_cb_bitmap.c +++ b/src/mesa/state_tracker/st_cb_bitmap.c @@ -870,6 +870,7 @@ 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.depth_clip = 1; /* find a usable texture format */ if (screen->is_format_supported(screen, PIPE_FORMAT_I8_UNORM, diff --git a/src/mesa/state_tracker/st_cb_clear.c b/src/mesa/state_tracker/st_cb_clear.c index 23700eeb7ed..a8365a70843 100644 --- a/src/mesa/state_tracker/st_cb_clear.c +++ b/src/mesa/state_tracker/st_cb_clear.c @@ -68,6 +68,7 @@ st_init_clear(struct st_context *st) memset(&st->clear, 0, sizeof(st->clear)); st->clear.raster.gl_rasterization_rules = 1; + st->clear.raster.depth_clip = 1; st->clear.enable_ds_separate = pscreen->get_param(pscreen, PIPE_CAP_DEPTHSTENCIL_CLEAR_SEPARATE); } @@ -248,7 +249,6 @@ clear_with_quad(struct gl_context *ctx, cso_save_depth_stencil_alpha(st->cso_context); cso_save_rasterizer(st->cso_context); cso_save_viewport(st->cso_context); - cso_save_clip(st->cso_context); cso_save_fragment_shader(st->cso_context); cso_save_stream_outputs(st->cso_context); cso_save_vertex_shader(st->cso_context); @@ -326,7 +326,6 @@ clear_with_quad(struct gl_context *ctx, cso_set_viewport(st->cso_context, &vp); } - cso_set_clip(st->cso_context, &st->clear.clip); set_fragment_shader(st); set_vertex_shader(st); cso_set_geometry_shader_handle(st->cso_context, NULL); @@ -346,7 +345,6 @@ clear_with_quad(struct gl_context *ctx, cso_restore_depth_stencil_alpha(st->cso_context); cso_restore_rasterizer(st->cso_context); cso_restore_viewport(st->cso_context); - cso_restore_clip(st->cso_context); cso_restore_fragment_shader(st->cso_context); cso_restore_vertex_shader(st->cso_context); cso_restore_geometry_shader(st->cso_context); diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c index 0609a54eab0..13c4f3369cc 100644 --- a/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/src/mesa/state_tracker/st_cb_drawpixels.c @@ -686,6 +686,7 @@ draw_textured_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z, memset(&rasterizer, 0, sizeof(rasterizer)); rasterizer.clamp_fragment_color = ctx->Color._ClampFragmentColor; rasterizer.gl_rasterization_rules = 1; + rasterizer.depth_clip = !ctx->Transform.DepthClamp; rasterizer.scissor = ctx->Scissor.Enabled; cso_set_rasterizer(cso, &rasterizer); } diff --git a/src/mesa/state_tracker/st_context.h b/src/mesa/state_tracker/st_context.h index c6078098963..9db50b3f4c8 100644 --- a/src/mesa/state_tracker/st_context.h +++ b/src/mesa/state_tracker/st_context.h @@ -167,7 +167,6 @@ struct st_context struct { struct pipe_rasterizer_state raster; struct pipe_viewport_state viewport; - struct pipe_clip_state clip; void *vs; void *fs; float vertices[4][2][4]; /**< vertex pos + color */ diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c index 4c8c67fca08..a9d40543638 100644 --- a/src/mesa/state_tracker/st_extensions.c +++ b/src/mesa/state_tracker/st_extensions.c @@ -592,7 +592,7 @@ void st_init_extensions(struct st_context *st) st->sw_primitive_restart = GL_TRUE; } - if (screen->get_param(screen, PIPE_CAP_DEPTH_CLAMP)) { + if (screen->get_param(screen, PIPE_CAP_DEPTH_CLIP_DISABLE)) { ctx->Extensions.ARB_depth_clamp = GL_TRUE; } |