ddebug: implement pipe_context::generate_mipmap
authorMarek Olšák <marek.olsak@amd.com>
Wed, 29 Jun 2016 23:53:04 +0000 (01:53 +0200)
committerMarek Olšák <marek.olsak@amd.com>
Mon, 4 Jul 2016 22:47:12 +0000 (00:47 +0200)
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
src/gallium/drivers/ddebug/dd_draw.c

index 22337e02a87df2ab128c5a4bd262dc7dce9d9cc4..f0f6fb68b2dd5397e83a3af0ab18fcde76028337 100644 (file)
@@ -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;
 };
 
@@ -424,6 +435,13 @@ dd_dump_blit(struct dd_context *dctx, struct pipe_blit_info *info, FILE *f)
       dd_dump_render_condition(dctx, 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);
 }