summaryrefslogtreecommitdiffstats
path: root/src/amd/vulkan/radv_meta.h
diff options
context:
space:
mode:
authorDave Airlie <[email protected]>2016-10-07 09:16:09 +1000
committerDave Airlie <[email protected]>2016-10-07 09:16:09 +1000
commitf4e499ec79147f4172f3669ae9dafd941aaeeb65 (patch)
tree4e082d4d950ffd0a676a8131179ca0e7ce94d99f /src/amd/vulkan/radv_meta.h
parent28ecd3eac24ce41b8a855a50f366f1985d1dc934 (diff)
radv: add initial non-conformant radv vulkan driver
This squashes all the radv development up until now into one for merging. History can be found: https://github.com/airlied/mesa/tree/semi-interesting This requires llvm 3.9 and is in no way considered a conformant vulkan implementation. It can run a number of vulkan applications, and supports all GPUs using the amdgpu kernel driver. Thanks to Intel for providing anv and spirv->nir, and Emil Velikov for reviewing build integration. Parts of this are: Reviewed-by: Nicolai Hähnle <[email protected]> Acked-by: Edward O'Callaghan <[email protected]> Authors: Bas Nieuwenhuizen and Dave Airlie Signed-off-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src/amd/vulkan/radv_meta.h')
-rw-r--r--src/amd/vulkan/radv_meta.h190
1 files changed, 190 insertions, 0 deletions
diff --git a/src/amd/vulkan/radv_meta.h b/src/amd/vulkan/radv_meta.h
new file mode 100644
index 00000000000..ae63a308b2d
--- /dev/null
+++ b/src/amd/vulkan/radv_meta.h
@@ -0,0 +1,190 @@
+/*
+ * Copyright © 2016 Red Hat
+ * based on intel anv code:
+ * Copyright © 2015 Intel Corporation
+ *
+ * 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.
+ */
+
+#pragma once
+
+#include "radv_private.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define RADV_META_VERTEX_BINDING_COUNT 2
+
+struct radv_meta_saved_state {
+ struct radv_vertex_binding old_vertex_bindings[RADV_META_VERTEX_BINDING_COUNT];
+ struct radv_descriptor_set *old_descriptor_set0;
+ struct radv_pipeline *old_pipeline;
+
+ /**
+ * Bitmask of (1 << VK_DYNAMIC_STATE_*). Defines the set of saved dynamic
+ * state.
+ */
+ uint32_t dynamic_mask;
+ struct radv_dynamic_state dynamic;
+
+ char push_constants[128];
+};
+
+struct radv_meta_saved_pass_state {
+ struct radv_render_pass *pass;
+ const struct radv_subpass *subpass;
+ struct radv_attachment_state *attachments;
+ struct radv_framebuffer *framebuffer;
+ VkRect2D render_area;
+};
+
+struct radv_meta_saved_compute_state {
+ struct radv_descriptor_set *old_descriptor_set0;
+ struct radv_pipeline *old_pipeline;
+
+ char push_constants[128];
+};
+
+VkResult radv_device_init_meta_clear_state(struct radv_device *device);
+void radv_device_finish_meta_clear_state(struct radv_device *device);
+
+VkResult radv_device_init_meta_resolve_state(struct radv_device *device);
+void radv_device_finish_meta_resolve_state(struct radv_device *device);
+
+VkResult radv_device_init_meta_depth_decomp_state(struct radv_device *device);
+void radv_device_finish_meta_depth_decomp_state(struct radv_device *device);
+
+VkResult radv_device_init_meta_fast_clear_flush_state(struct radv_device *device);
+void radv_device_finish_meta_fast_clear_flush_state(struct radv_device *device);
+
+VkResult radv_device_init_meta_blit_state(struct radv_device *device);
+void radv_device_finish_meta_blit_state(struct radv_device *device);
+
+VkResult radv_device_init_meta_blit2d_state(struct radv_device *device);
+void radv_device_finish_meta_blit2d_state(struct radv_device *device);
+
+VkResult radv_device_init_meta_buffer_state(struct radv_device *device);
+void radv_device_finish_meta_buffer_state(struct radv_device *device);
+
+VkResult radv_device_init_meta_resolve_compute_state(struct radv_device *device);
+void radv_device_finish_meta_resolve_compute_state(struct radv_device *device);
+void radv_meta_save(struct radv_meta_saved_state *state,
+ const struct radv_cmd_buffer *cmd_buffer,
+ uint32_t dynamic_mask);
+
+void radv_meta_restore(const struct radv_meta_saved_state *state,
+ struct radv_cmd_buffer *cmd_buffer);
+
+void radv_meta_save_pass(struct radv_meta_saved_pass_state *state,
+ const struct radv_cmd_buffer *cmd_buffer);
+
+void radv_meta_restore_pass(const struct radv_meta_saved_pass_state *state,
+ struct radv_cmd_buffer *cmd_buffer);
+
+void radv_meta_save_compute(struct radv_meta_saved_compute_state *state,
+ const struct radv_cmd_buffer *cmd_buffer,
+ unsigned push_constant_size);
+
+void radv_meta_restore_compute(const struct radv_meta_saved_compute_state *state,
+ struct radv_cmd_buffer *cmd_buffer,
+ unsigned push_constant_size);
+
+VkImageViewType radv_meta_get_view_type(const struct radv_image *image);
+
+uint32_t radv_meta_get_iview_layer(const struct radv_image *dest_image,
+ const VkImageSubresourceLayers *dest_subresource,
+ const VkOffset3D *dest_offset);
+
+struct radv_meta_blit2d_surf {
+ /** The size of an element in bytes. */
+ uint8_t bs;
+ VkFormat format;
+
+ struct radv_image *image;
+ unsigned level;
+ unsigned layer;
+ VkImageAspectFlags aspect_mask;
+};
+
+struct radv_meta_blit2d_buffer {
+ struct radv_buffer *buffer;
+ uint32_t offset;
+ uint32_t pitch;
+ uint8_t bs;
+ VkFormat format;
+};
+
+struct radv_meta_blit2d_rect {
+ uint32_t src_x, src_y;
+ uint32_t dst_x, dst_y;
+ uint32_t width, height;
+};
+
+void radv_meta_begin_blit2d(struct radv_cmd_buffer *cmd_buffer,
+ struct radv_meta_saved_state *save);
+
+void radv_meta_blit2d(struct radv_cmd_buffer *cmd_buffer,
+ struct radv_meta_blit2d_surf *src_img,
+ struct radv_meta_blit2d_buffer *src_buf,
+ struct radv_meta_blit2d_surf *dst,
+ unsigned num_rects,
+ struct radv_meta_blit2d_rect *rects);
+
+void radv_meta_end_blit2d(struct radv_cmd_buffer *cmd_buffer,
+ struct radv_meta_saved_state *save);
+
+
+VkResult radv_device_init_meta_bufimage_state(struct radv_device *device);
+void radv_device_finish_meta_bufimage_state(struct radv_device *device);
+void radv_meta_begin_bufimage(struct radv_cmd_buffer *cmd_buffer,
+ struct radv_meta_saved_compute_state *save);
+void radv_meta_end_bufimage(struct radv_cmd_buffer *cmd_buffer,
+ struct radv_meta_saved_compute_state *save);
+
+void radv_meta_image_to_buffer(struct radv_cmd_buffer *cmd_buffer,
+ struct radv_meta_blit2d_surf *src,
+ struct radv_meta_blit2d_buffer *dst,
+ unsigned num_rects,
+ struct radv_meta_blit2d_rect *rects);
+
+void radv_decompress_depth_image_inplace(struct radv_cmd_buffer *cmd_buffer,
+ struct radv_image *image,
+ VkImageSubresourceRange *subresourceRange);
+void radv_resummarize_depth_image_inplace(struct radv_cmd_buffer *cmd_buffer,
+ struct radv_image *image,
+ VkImageSubresourceRange *subresourceRange);
+void radv_fast_clear_flush_image_inplace(struct radv_cmd_buffer *cmd_buffer,
+ struct radv_image *image);
+
+void radv_meta_save_graphics_reset_vport_scissor(struct radv_meta_saved_state *saved_state,
+ struct radv_cmd_buffer *cmd_buffer);
+
+void radv_meta_resolve_compute_image(struct radv_cmd_buffer *cmd_buffer,
+ struct radv_image *src_image,
+ VkImageLayout src_image_layout,
+ struct radv_image *dest_image,
+ VkImageLayout dest_image_layout,
+ uint32_t region_count,
+ const VkImageResolve *regions);
+
+#ifdef __cplusplus
+}
+#endif