radv: silent a compiler warning in radv_CmdPushDescriptorSetKHR()
[mesa.git] / src / amd / vulkan / radv_private.h
index 55c34d204b3cee7b9214a2f141b61727289d6d90..d6f396f0056565ad32a3eeda26ecc2dc813fe29f 100644 (file)
@@ -91,6 +91,7 @@ typedef uint32_t xcb_window_t;
 #define MAX_VIEWPORTS   16
 #define MAX_SCISSORS    16
 #define MAX_DISCARD_RECTANGLES 4
+#define MAX_SAMPLE_LOCATIONS 32
 #define MAX_PUSH_CONSTANTS_SIZE 128
 #define MAX_PUSH_DESCRIPTORS 32
 #define MAX_DYNAMIC_UNIFORM_BUFFERS 16
@@ -315,6 +316,9 @@ struct radv_physical_device {
        /* Whether LOAD_CONTEXT_REG packets are supported. */
        bool has_load_ctx_reg_pkt;
 
+       /* Whether to enable the AMD_shader_ballot extension */
+       bool use_shader_ballot;
+
        /* This is the drivers on-disk cache used as a fallback as opposed to
         * the pipeline cache defined by apps.
         */
@@ -701,9 +705,8 @@ struct radv_device {
        float sample_locations_2x[2][2];
        float sample_locations_4x[4][2];
        float sample_locations_8x[8][2];
-       float sample_locations_16x[16][2];
 
-       /* CIK and later */
+       /* GFX7 and later */
        uint32_t gfx_init_size_dw;
        struct radeon_winsys_bo                      *gfx_init;
 
@@ -853,7 +856,8 @@ enum radv_dynamic_state_bits {
        RADV_DYNAMIC_STENCIL_WRITE_MASK   = 1 << 7,
        RADV_DYNAMIC_STENCIL_REFERENCE    = 1 << 8,
        RADV_DYNAMIC_DISCARD_RECTANGLE    = 1 << 9,
-       RADV_DYNAMIC_ALL                  = (1 << 10) - 1,
+       RADV_DYNAMIC_SAMPLE_LOCATIONS     = 1 << 10,
+       RADV_DYNAMIC_ALL                  = (1 << 11) - 1,
 };
 
 enum radv_cmd_dirty_bits {
@@ -869,12 +873,13 @@ enum radv_cmd_dirty_bits {
        RADV_CMD_DIRTY_DYNAMIC_STENCIL_WRITE_MASK        = 1 << 7,
        RADV_CMD_DIRTY_DYNAMIC_STENCIL_REFERENCE         = 1 << 8,
        RADV_CMD_DIRTY_DYNAMIC_DISCARD_RECTANGLE         = 1 << 9,
-       RADV_CMD_DIRTY_DYNAMIC_ALL                       = (1 << 10) - 1,
-       RADV_CMD_DIRTY_PIPELINE                          = 1 << 10,
-       RADV_CMD_DIRTY_INDEX_BUFFER                      = 1 << 11,
-       RADV_CMD_DIRTY_FRAMEBUFFER                       = 1 << 12,
-       RADV_CMD_DIRTY_VERTEX_BUFFER                     = 1 << 13,
-       RADV_CMD_DIRTY_STREAMOUT_BUFFER                  = 1 << 14,
+       RADV_CMD_DIRTY_DYNAMIC_SAMPLE_LOCATIONS          = 1 << 10,
+       RADV_CMD_DIRTY_DYNAMIC_ALL                       = (1 << 11) - 1,
+       RADV_CMD_DIRTY_PIPELINE                          = 1 << 11,
+       RADV_CMD_DIRTY_INDEX_BUFFER                      = 1 << 12,
+       RADV_CMD_DIRTY_FRAMEBUFFER                       = 1 << 13,
+       RADV_CMD_DIRTY_VERTEX_BUFFER                     = 1 << 14,
+       RADV_CMD_DIRTY_STREAMOUT_BUFFER                  = 1 << 15,
 };
 
 enum radv_cmd_flush_bits {
@@ -951,6 +956,13 @@ struct radv_discard_rectangle_state {
        VkRect2D                                          rectangles[MAX_DISCARD_RECTANGLES];
 };
 
+struct radv_sample_locations_state {
+       VkSampleCountFlagBits per_pixel;
+       VkExtent2D grid_size;
+       uint32_t count;
+       VkSampleLocationEXT locations[MAX_SAMPLE_LOCATIONS];
+};
+
 struct radv_dynamic_state {
        /**
         * Bitmask of (1 << VK_DYNAMIC_STATE_*).
@@ -993,6 +1005,8 @@ struct radv_dynamic_state {
        } stencil_reference;
 
        struct radv_discard_rectangle_state               discard_rectangle;
+
+       struct radv_sample_locations_state                sample_location;
 };
 
 extern const struct radv_dynamic_state default_dynamic_state;
@@ -1013,6 +1027,7 @@ struct radv_attachment_state {
        uint32_t                                     cleared_views;
        VkClearValue                                 clear_value;
        VkImageLayout                                current_layout;
+       struct radv_sample_locations_state           sample_location;
 };
 
 struct radv_descriptor_state {
@@ -1024,6 +1039,11 @@ struct radv_descriptor_state {
        uint32_t dynamic_buffers[4 * MAX_DYNAMIC_BUFFERS];
 };
 
+struct radv_subpass_sample_locs_state {
+       uint32_t subpass_idx;
+       struct radv_sample_locations_state sample_location;
+};
+
 struct radv_cmd_state {
        /* Vertex descriptors */
        uint64_t                                      vb_va;
@@ -1046,6 +1066,9 @@ struct radv_cmd_state {
        struct radv_streamout_state                  streamout;
        VkRect2D                                     render_area;
 
+       uint32_t                                     num_subpass_sample_locs;
+       struct radv_subpass_sample_locs_state *      subpass_sample_locs;
+
        /* Index buffer */
        struct radv_buffer                           *index_buffer;
        uint64_t                                     index_offset;
@@ -1143,6 +1166,11 @@ struct radv_cmd_buffer {
         * Whether a query pool has been resetted and we have to flush caches.
         */
        bool pending_reset_query;
+
+       /**
+        * Bitmask of pending active query flushes.
+        */
+       enum radv_cmd_flush_bits active_query_flush_bits;
 };
 
 struct radv_image;
@@ -1213,8 +1241,8 @@ void radv_cmd_buffer_clear_subpass(struct radv_cmd_buffer *cmd_buffer);
 void radv_cmd_buffer_resolve_subpass(struct radv_cmd_buffer *cmd_buffer);
 void radv_cmd_buffer_resolve_subpass_cs(struct radv_cmd_buffer *cmd_buffer);
 void radv_cmd_buffer_resolve_subpass_fs(struct radv_cmd_buffer *cmd_buffer);
-void radv_cayman_emit_msaa_sample_locs(struct radeon_cmdbuf *cs, int nr_samples);
-unsigned radv_cayman_get_maxdist(int log_samples);
+void radv_emit_default_sample_locations(struct radeon_cmdbuf *cs, int nr_samples);
+unsigned radv_get_default_max_sample_dist(int log_samples);
 void radv_device_init_msaa(struct radv_device *device);
 
 void radv_update_ds_clear_metadata(struct radv_cmd_buffer *cmd_buffer,
@@ -1717,6 +1745,7 @@ struct radv_image_create_info {
        const VkImageCreateInfo *vk_info;
        bool scanout;
        bool no_metadata_planes;
+       const struct radeon_bo_metadata *bo_metadata;
 };
 
 VkResult radv_image_create(VkDevice _device,
@@ -1904,7 +1933,8 @@ struct radv_render_pass_attachment {
        VkImageLayout                                initial_layout;
        VkImageLayout                                final_layout;
 
-       /* The subpass id in which the attachment will be used last. */
+       /* The subpass id in which the attachment will be used first/last. */
+       uint32_t                                     first_subpass_idx;
        uint32_t                                     last_subpass_idx;
 };
 
@@ -1974,8 +2004,6 @@ void radv_initialize_fmask(struct radv_cmd_buffer *cmd_buffer,
 struct radv_fence {
        struct radeon_winsys_fence *fence;
        struct wsi_fence *fence_wsi;
-       bool submitted;
-       bool signalled;
 
        uint32_t syncobj;
        uint32_t temp_syncobj;