Mesa (master): zink: move all the clear stuff to zink_clear.h
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Feb 24 02:08:20 UTC 2021
Module: Mesa
Branch: master
Commit: 5fe329e3077c222e316f5ef60d30040f1d87da5e
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=5fe329e3077c222e316f5ef60d30040f1d87da5e
Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date: Thu Sep 17 16:41:19 2020 -0400
zink: move all the clear stuff to zink_clear.h
this was getting way too crowded in zink_context.h
Reviewed-by: Dave Airlie <airlied at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9206>
---
src/gallium/drivers/zink/zink_clear.h | 108 ++++++++++++++++++++++++++++++++
src/gallium/drivers/zink/zink_context.h | 75 +---------------------
2 files changed, 109 insertions(+), 74 deletions(-)
diff --git a/src/gallium/drivers/zink/zink_clear.h b/src/gallium/drivers/zink/zink_clear.h
new file mode 100644
index 00000000000..34bc0157fd4
--- /dev/null
+++ b/src/gallium/drivers/zink/zink_clear.h
@@ -0,0 +1,108 @@
+/*
+ * Copyright © 2020 Mike Blumenkrantz
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ *
+ * Authors:
+ * Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
+ */
+
+#include "util/u_dynarray.h"
+#include "pipe/p_state.h"
+#include <vulkan/vulkan.h>
+#include "util/u_rect.h"
+
+struct zink_context;
+struct zink_resource;
+
+struct zink_framebuffer_clear_data {
+ union {
+ struct {
+ union pipe_color_union color;
+ bool srgb;
+ } color;
+ struct {
+ float depth;
+ unsigned stencil;
+ uint8_t bits : 2; // PIPE_CLEAR_DEPTH, PIPE_CLEAR_STENCIL
+ } zs;
+ };
+ struct pipe_scissor_state scissor;
+ bool has_scissor;
+ bool conditional;
+};
+
+struct zink_framebuffer_clear {
+ struct util_dynarray clears;
+ bool enabled;
+};
+
+void
+zink_clear(struct pipe_context *pctx,
+ unsigned buffers,
+ const struct pipe_scissor_state *scissor_state,
+ const union pipe_color_union *pcolor,
+ double depth, unsigned stencil);
+void
+zink_clear_texture(struct pipe_context *ctx,
+ struct pipe_resource *p_res,
+ unsigned level,
+ const struct pipe_box *box,
+ const void *data);
+
+bool
+zink_fb_clear_needs_explicit(struct zink_framebuffer_clear *fb_clear);
+
+void
+zink_clear_framebuffer(struct zink_context *ctx, unsigned clear_buffers);
+
+static inline struct zink_framebuffer_clear_data *
+zink_fb_clear_element(struct zink_framebuffer_clear *fb_clear, int idx)
+{
+ return util_dynarray_element(&fb_clear->clears, struct zink_framebuffer_clear_data, idx);
+}
+
+static inline unsigned
+zink_fb_clear_count(struct zink_framebuffer_clear *fb_clear)
+{
+ return util_dynarray_num_elements(&fb_clear->clears, struct zink_framebuffer_clear_data);
+}
+
+static inline void
+zink_fb_clear_reset(struct zink_framebuffer_clear *fb_clear)
+{
+ util_dynarray_fini(&fb_clear->clears);
+ fb_clear->enabled = false;
+}
+
+void
+zink_clear_apply_conditionals(struct zink_context *ctx);
+
+void
+zink_fb_clears_apply(struct zink_context *ctx, struct pipe_resource *pres);
+
+void
+zink_fb_clears_discard(struct zink_context *ctx, struct pipe_resource *pres);
+
+void
+zink_fb_clears_apply_or_discard(struct zink_context *ctx, struct pipe_resource *pres, struct u_rect region, bool discard_only);
+
+void
+zink_fb_clears_apply_region(struct zink_context *ctx, struct pipe_resource *pres, struct u_rect region);
diff --git a/src/gallium/drivers/zink/zink_context.h b/src/gallium/drivers/zink/zink_context.h
index 2c6156bd630..0b1b3c94cb5 100644
--- a/src/gallium/drivers/zink/zink_context.h
+++ b/src/gallium/drivers/zink/zink_context.h
@@ -24,6 +24,7 @@
#ifndef ZINK_CONTEXT_H
#define ZINK_CONTEXT_H
+#include "zink_clear.h"
#include "zink_pipeline.h"
#include "zink_batch.h"
@@ -97,27 +98,6 @@ struct zink_viewport_state {
uint8_t num_viewports;
};
-struct zink_framebuffer_clear_data {
- union {
- struct {
- union pipe_color_union color;
- bool srgb;
- } color;
- struct {
- float depth;
- unsigned stencil;
- uint8_t bits : 2; // PIPE_CLEAR_DEPTH, PIPE_CLEAR_STENCIL
- } zs;
- };
- struct pipe_scissor_state scissor;
- bool has_scissor;
- bool conditional;
-};
-
-struct zink_framebuffer_clear {
- struct util_dynarray clears;
- bool enabled;
-};
#define ZINK_SHADER_COUNT (PIPE_SHADER_TYPES - 1)
#define ZINK_NUM_GFX_BATCHES 4
@@ -293,59 +273,6 @@ zink_rect_from_box(const struct pipe_box *box)
return (struct u_rect){box->x, box->x + box->width, box->y, box->y + box->height};
}
-void
-zink_clear(struct pipe_context *pctx,
- unsigned buffers,
- const struct pipe_scissor_state *scissor_state,
- const union pipe_color_union *pcolor,
- double depth, unsigned stencil);
-void
-zink_clear_texture(struct pipe_context *ctx,
- struct pipe_resource *p_res,
- unsigned level,
- const struct pipe_box *box,
- const void *data);
-
-bool
-zink_fb_clear_needs_explicit(struct zink_framebuffer_clear *fb_clear);
-
-void
-zink_clear_framebuffer(struct zink_context *ctx, unsigned clear_buffers);
-
-static inline struct zink_framebuffer_clear_data *
-zink_fb_clear_element(struct zink_framebuffer_clear *fb_clear, int idx)
-{
- return util_dynarray_element(&fb_clear->clears, struct zink_framebuffer_clear_data, idx);
-}
-
-static inline unsigned
-zink_fb_clear_count(struct zink_framebuffer_clear *fb_clear)
-{
- return util_dynarray_num_elements(&fb_clear->clears, struct zink_framebuffer_clear_data);
-}
-
-static inline void
-zink_fb_clear_reset(struct zink_framebuffer_clear *fb_clear)
-{
- util_dynarray_fini(&fb_clear->clears);
- fb_clear->enabled = false;
-}
-
-void
-zink_clear_apply_conditionals(struct zink_context *ctx);
-
-void
-zink_fb_clears_apply(struct zink_context *ctx, struct pipe_resource *pres);
-
-void
-zink_fb_clears_discard(struct zink_context *ctx, struct pipe_resource *pres);
-
-void
-zink_fb_clears_apply_or_discard(struct zink_context *ctx, struct pipe_resource *pres, struct u_rect region, bool discard_only);
-
-void
-zink_fb_clears_apply_region(struct zink_context *ctx, struct pipe_resource *pres, struct u_rect region);
-
void
zink_draw_vbo(struct pipe_context *pctx,
const struct pipe_draw_info *dinfo,
More information about the mesa-commit
mailing list