Module: Mesa
Branch: master
Commit: da9fbbac42f4531f66165aa810257f6ae2661bd1
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=da9fbbac42f4531f66165aa810257f6ae2661bd1

Author: Erico Nunes <[email protected]>
Date:   Fri Sep 25 22:21:54 2020 +0200

lima: define set_clip_state implementation

In applications using clip planes, set_clip_state is expected to be
implemented in the backend. If it is not defined, it may cause the
application to segfault.

glClipPlane it is not part of GLES 2, so it is not trivial to reverse
engineer if something needs to be done in lima.
Other drivers just define a placeholder implementation for
set_clip_state, so for now let's just define one for lima too.

Signed-off-by: Erico Nunes <[email protected]>
Reviewed-by: Qiang Yu <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7088>

---

 src/gallium/drivers/lima/lima_context.h |  2 ++
 src/gallium/drivers/lima/lima_state.c   | 11 +++++++++++
 2 files changed, 13 insertions(+)

diff --git a/src/gallium/drivers/lima/lima_context.h 
b/src/gallium/drivers/lima/lima_context.h
index c8f4cf6f0e3..8ed9db9fadc 100644
--- a/src/gallium/drivers/lima/lima_context.h
+++ b/src/gallium/drivers/lima/lima_context.h
@@ -177,6 +177,7 @@ struct lima_context {
       LIMA_CONTEXT_DIRTY_STENCIL_REF  = (1 << 12),
       LIMA_CONTEXT_DIRTY_CONST_BUFF   = (1 << 13),
       LIMA_CONTEXT_DIRTY_TEXTURES     = (1 << 14),
+      LIMA_CONTEXT_DIRTY_CLIP         = (1 << 15),
    } dirty;
 
    struct u_upload_mgr *uploader;
@@ -197,6 +198,7 @@ struct lima_context {
    struct pipe_blend_color blend_color;
    struct lima_blend_state *blend;
    struct pipe_stencil_ref stencil_ref;
+   struct pipe_clip_state clip;
    struct lima_context_constant_buffer const_buffer[PIPE_SHADER_TYPES];
    struct lima_texture_stateobj tex_stateobj;
    struct lima_pp_stream_state pp_stream;
diff --git a/src/gallium/drivers/lima/lima_state.c 
b/src/gallium/drivers/lima/lima_state.c
index 727b200d6db..74a1a275db2 100644
--- a/src/gallium/drivers/lima/lima_state.c
+++ b/src/gallium/drivers/lima/lima_state.c
@@ -254,6 +254,16 @@ lima_set_stencil_ref(struct pipe_context *pctx,
    ctx->dirty |= LIMA_CONTEXT_DIRTY_STENCIL_REF;
 }
 
+static void
+lima_set_clip_state(struct pipe_context *pctx,
+                    const struct pipe_clip_state *clip)
+{
+   struct lima_context *ctx = lima_context(pctx);
+   ctx->clip = *clip;
+
+   ctx->dirty |= LIMA_CONTEXT_DIRTY_CLIP;
+}
+
 static void
 lima_set_constant_buffer(struct pipe_context *pctx,
                          enum pipe_shader_type shader, uint index,
@@ -396,6 +406,7 @@ lima_state_init(struct lima_context *ctx)
    ctx->base.set_scissor_states = lima_set_scissor_states;
    ctx->base.set_blend_color = lima_set_blend_color;
    ctx->base.set_stencil_ref = lima_set_stencil_ref;
+   ctx->base.set_clip_state = lima_set_clip_state;
 
    ctx->base.set_vertex_buffers = lima_set_vertex_buffers;
    ctx->base.set_constant_buffer = lima_set_constant_buffer;

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to