[Mesa-dev] [PATCH 3/6] ddebug: implement pipe_context::generate_mipmap

Marek Olšák maraeo at gmail.com
Thu Jun 30 23:21:49 UTC 2016


From: Marek Olšák <marek.olsak at amd.com>

---
 src/gallium/drivers/ddebug/dd_draw.c | 53 +++++++++++++++++++++++++++++++++++-
 1 file changed, 52 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/ddebug/dd_draw.c b/src/gallium/drivers/ddebug/dd_draw.c
index 22337e0..f0f6fb6 100644
--- a/src/gallium/drivers/ddebug/dd_draw.c
+++ b/src/gallium/drivers/ddebug/dd_draw.c
@@ -43,6 +43,7 @@ enum call_type
    CALL_CLEAR_BUFFER,
    CALL_CLEAR_RENDER_TARGET,
    CALL_CLEAR_DEPTH_STENCIL,
+   CALL_GENERATE_MIPMAP,
 };
 
 struct call_resource_copy_region
@@ -72,6 +73,15 @@ struct call_clear_buffer
    int clear_value_size;
 };
 
+struct call_generate_mipmap {
+   struct pipe_resource *res;
+   enum pipe_format format;
+   unsigned base_level;
+   unsigned last_level;
+   unsigned first_layer;
+   unsigned last_layer;
+};
+
 struct dd_call
 {
    enum call_type type;
@@ -84,6 +94,7 @@ struct dd_call
       struct pipe_resource *flush_resource;
       struct call_clear clear;
       struct call_clear_buffer clear_buffer;
+      struct call_generate_mipmap generate_mipmap;
    } info;
 };
 
@@ -425,6 +436,13 @@ dd_dump_blit(struct dd_context *dctx, struct pipe_blit_info *info, FILE *f)
 }
 
 static void
+dd_dump_generate_mipmap(struct dd_context *dctx, FILE *f)
+{
+   fprintf(f, "%s:\n", __func__+8);
+   /* TODO */
+}
+
+static void
 dd_dump_flush_resource(struct dd_context *dctx, struct pipe_resource *res,
                        FILE *f)
 {
@@ -521,6 +539,10 @@ dd_dump_call(struct dd_context *dctx, struct dd_call *call, unsigned flags)
       break;
    case CALL_CLEAR_DEPTH_STENCIL:
       dd_dump_clear_depth_stencil(dctx, f);
+      break;
+   case CALL_GENERATE_MIPMAP:
+      dd_dump_generate_mipmap(dctx, f);
+      break;
    }
 
    dd_dump_driver_state(dctx, f, flags);
@@ -723,6 +745,35 @@ dd_context_blit(struct pipe_context *_pipe, const struct pipe_blit_info *info)
    dd_after_draw(dctx, &call);
 }
 
+static boolean
+dd_context_generate_mipmap(struct pipe_context *_pipe,
+                           struct pipe_resource *res,
+                           enum pipe_format format,
+                           unsigned base_level,
+                           unsigned last_level,
+                           unsigned first_layer,
+                           unsigned last_layer)
+{
+   struct dd_context *dctx = dd_context(_pipe);
+   struct pipe_context *pipe = dctx->pipe;
+   struct dd_call call;
+   boolean result;
+
+   call.type = CALL_GENERATE_MIPMAP;
+   call.info.generate_mipmap.res = res;
+   call.info.generate_mipmap.format = format;
+   call.info.generate_mipmap.base_level = base_level;
+   call.info.generate_mipmap.last_level = last_level;
+   call.info.generate_mipmap.first_layer = first_layer;
+   call.info.generate_mipmap.last_layer = last_layer;
+
+   dd_before_draw(dctx);
+   result = pipe->generate_mipmap(pipe, res, format, base_level, last_level,
+                                  first_layer, last_layer);
+   dd_after_draw(dctx, &call);
+   return result;
+}
+
 static void
 dd_context_flush_resource(struct pipe_context *_pipe,
                           struct pipe_resource *resource)
@@ -829,5 +880,5 @@ dd_init_draw_functions(struct dd_context *dctx)
    CTX_INIT(clear_depth_stencil);
    CTX_INIT(clear_buffer);
    CTX_INIT(flush_resource);
-   /* launch_grid */
+   CTX_INIT(generate_mipmap);
 }
-- 
2.7.4



More information about the mesa-dev mailing list