iris: actually upload clip planes.
authorKenneth Graunke <kenneth@whitecape.org>
Fri, 9 Nov 2018 10:11:16 +0000 (02:11 -0800)
committerKenneth Graunke <kenneth@whitecape.org>
Thu, 21 Feb 2019 18:26:09 +0000 (10:26 -0800)
src/gallium/drivers/iris/iris_context.h
src/gallium/drivers/iris/iris_state.c

index 520ce055ea224321228b1d36e1569b021e22c3ff..44040bf923de4ce1f34e042e53276b627398bf09 100644 (file)
@@ -437,6 +437,7 @@ struct iris_context {
       struct pipe_scissor_state scissors[IRIS_MAX_VIEWPORTS];
       struct pipe_stencil_ref stencil_ref;
       struct pipe_framebuffer_state framebuffer;
+      struct pipe_clip_state clip_planes;
 
       float default_outer_level[4];
       float default_inner_level[2];
index 353043c0595dc6f339427db904b89dcbe789150b..f0f426cebab5b2b124611ad2fff64c29491032e8 100644 (file)
@@ -1748,11 +1748,17 @@ iris_surface_destroy(struct pipe_context *ctx, struct pipe_surface *p_surf)
    free(surf);
 }
 
-// XXX: actually implement user clip planes
 static void
 iris_set_clip_state(struct pipe_context *ctx,
                     const struct pipe_clip_state *state)
 {
+   struct iris_context *ice = (struct iris_context *) ctx;
+   struct iris_shader_state *shs = &ice->state.shaders[MESA_SHADER_VERTEX];
+
+   memcpy(&ice->state.clip_planes, state, sizeof(*state));
+
+   ice->state.dirty |= IRIS_DIRTY_CONSTANTS_VS;
+   shs->cbuf0_needs_upload = true;
 }
 
 /**
@@ -2184,7 +2190,13 @@ upload_uniforms(struct iris_context *ice,
       uint32_t sysval = shader->system_values[i];
       uint32_t value = 0;
 
-      printf("got a param to upload - %u\n", sysval);
+      if (BRW_PARAM_BUILTIN_IS_CLIP_PLANE(sysval)) {
+         int plane = BRW_PARAM_BUILTIN_CLIP_PLANE_IDX(sysval);
+         int comp  = BRW_PARAM_BUILTIN_CLIP_PLANE_COMP(sysval);
+         value = fui(ice->state.clip_planes.ucp[plane][comp]);
+      } else {
+         assert(!"unhandled system value");
+      }
 
       *map++ = value;
    }