aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gallium/drivers/iris/iris_context.h1
-rw-r--r--src/gallium/drivers/iris/iris_state.c16
2 files changed, 15 insertions, 2 deletions
diff --git a/src/gallium/drivers/iris/iris_context.h b/src/gallium/drivers/iris/iris_context.h
index 520ce055ea2..44040bf923d 100644
--- a/src/gallium/drivers/iris/iris_context.h
+++ b/src/gallium/drivers/iris/iris_context.h
@@ -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];
diff --git a/src/gallium/drivers/iris/iris_state.c b/src/gallium/drivers/iris/iris_state.c
index 353043c0595..f0f426cebab 100644
--- a/src/gallium/drivers/iris/iris_state.c
+++ b/src/gallium/drivers/iris/iris_state.c
@@ -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;
}