X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fvulkan%2Fanv_private.h;h=03d033ff0c5d8cb405c88d5b89e316efd4cebf80;hb=3ee923f1c2ef0832ebd6da445548e0a651aaae80;hp=915460dadf4acd481355270acc028d94c4a65003;hpb=219a1929f7a9c3fcf0fa1cdecac592cc01dc4cf3;p=mesa.git diff --git a/src/vulkan/anv_private.h b/src/vulkan/anv_private.h index 915460dadf4..03d033ff0c5 100644 --- a/src/vulkan/anv_private.h +++ b/src/vulkan/anv_private.h @@ -46,8 +46,8 @@ #define VK_PROTOTYPES #include #include -#include -#include +#include +#include #include "anv_entrypoints.h" @@ -115,6 +115,11 @@ anv_clear_mask(uint32_t *inout_mask, uint32_t clear_mask) (b) = __builtin_ffs(__dword) - 1, __dword; \ __dword &= ~(1 << (b))) +#define typed_memcpy(dest, src, count) ({ \ + static_assert(sizeof(*src) == sizeof(*dest), ""); \ + memcpy((dest), (src), (count) * sizeof(*(src))); \ +}) + /* Define no kernel as 1, since that's an illegal offset for a kernel */ #define NO_KERNEL 1 @@ -159,6 +164,16 @@ void anv_loge_v(const char *format, va_list va); #define anv_assert(x) #endif +/** + * If a block of code is annotated with anv_validate, then the block runs only + * in debug builds. + */ +#ifdef DEBUG +#define anv_validate if (1) +#else +#define anv_validate if (0) +#endif + void anv_abortf(const char *format, ...) anv_noreturn anv_printflike(1, 2); void anv_abortfv(const char *format, va_list va) anv_noreturn; @@ -412,8 +427,12 @@ struct anv_physical_device { const char * name; const struct brw_device_info * info; uint64_t aperture_size; + struct brw_compiler * compiler; }; +bool anv_is_scalar_shader_stage(const struct brw_compiler *compiler, + VkShaderStage stage); + struct anv_instance { VK_LOADER_DATA _loader_data; @@ -421,10 +440,10 @@ struct anv_instance { PFN_vkAllocFunction pfnAlloc; PFN_vkFreeFunction pfnFree; uint32_t apiVersion; - uint32_t physicalDeviceCount; + int physicalDeviceCount; struct anv_physical_device physicalDevice; - struct anv_wsi_implementation * wsi_impl[VK_PLATFORM_NUM_WSI]; + struct anv_wsi_implementation * wsi_impl[VK_PLATFORM_NUM_KHR]; }; VkResult anv_init_wsi(struct anv_instance *instance); @@ -432,10 +451,15 @@ void anv_finish_wsi(struct anv_instance *instance); struct anv_meta_state { struct { - VkPipeline pipeline; + struct anv_pipeline *color_pipeline; + struct anv_pipeline *depth_only_pipeline; + struct anv_pipeline *stencil_only_pipeline; + struct anv_pipeline *depthstencil_pipeline; } clear; struct { + VkRenderPass render_pass; + /** Pipeline that blits from a 2D image. */ VkPipeline pipeline_2d_src; @@ -445,12 +469,6 @@ struct anv_meta_state { VkPipelineLayout pipeline_layout; VkDescriptorSetLayout ds_layout; } blit; - - struct { - VkDynamicRasterState rs_state; - VkDynamicColorBlendState cb_state; - VkDynamicDepthStencilState ds_state; - } shared; }; struct anv_queue { @@ -459,20 +477,6 @@ struct anv_queue { struct anv_device * device; struct anv_state_pool * pool; - - /** - * Serial number of the most recently completed batch executed on the - * engine. - */ - struct anv_state completed_serial; - - /** - * The next batch submitted to the engine will be assigned this serial - * number. - */ - uint32_t next_serial; - - uint32_t last_collected_serial; }; struct anv_device { @@ -501,7 +505,6 @@ struct anv_device { struct anv_block_pool scratch_block_pool; - struct anv_compiler * compiler; pthread_mutex_t mutex; }; @@ -572,6 +575,9 @@ struct anv_batch_bo { /* Bytes actually consumed in this batch BO */ size_t length; + /* Last seen surface state block pool bo offset */ + uint32_t last_ss_pool_bo_offset; + struct anv_reloc_list relocs; }; @@ -672,65 +678,76 @@ struct anv_device_memory { void * map; }; -struct anv_dynamic_vp_state { - struct anv_state sf_clip_vp; - struct anv_state cc_vp; - struct anv_state scissor; +/** + * Header for Vertex URB Entry (VUE) + */ +struct anv_vue_header { + uint32_t Reserved; + uint32_t RTAIndex; /* RenderTargetArrayIndex */ + uint32_t ViewportIndex; + float PointWidth; }; -struct anv_dynamic_rs_state { - struct { - uint32_t sf[GEN7_3DSTATE_SF_length]; - } gen7; +struct anv_descriptor_set_binding_layout { + /* Number of array elements in this binding */ + uint16_t array_size; - struct { - uint32_t sf[GEN8_3DSTATE_SF_length]; - uint32_t raster[GEN8_3DSTATE_RASTER_length]; - } gen8; -}; + /* Index into the flattend descriptor set */ + uint16_t descriptor_index; -struct anv_dynamic_ds_state { - struct { - uint32_t depth_stencil_state[GEN7_DEPTH_STENCIL_STATE_length]; - uint32_t color_calc_state[GEN8_COLOR_CALC_STATE_length]; - } gen7; + /* Index into the dynamic state array for a dynamic buffer */ + int16_t dynamic_offset_index; struct { - uint32_t wm_depth_stencil[GEN8_3DSTATE_WM_DEPTH_STENCIL_length]; - uint32_t color_calc_state[GEN8_COLOR_CALC_STATE_length]; - } gen8; -}; - -struct anv_dynamic_cb_state { - uint32_t color_calc_state[GEN8_COLOR_CALC_STATE_length]; + /* Index into the binding table for the associated surface */ + int16_t surface_index; -}; + /* Index into the sampler table for the associated sampler */ + int16_t sampler_index; + } stage[VK_SHADER_STAGE_NUM]; -struct anv_descriptor_slot { - int8_t dynamic_slot; - uint8_t index; + /* Immutable samplers (or NULL if no immutable samplers) */ + struct anv_sampler **immutable_samplers; }; struct anv_descriptor_set_layout { - struct { - uint32_t surface_count; - struct anv_descriptor_slot *surface_start; - uint32_t sampler_count; - struct anv_descriptor_slot *sampler_start; - } stage[VK_SHADER_STAGE_NUM]; + /* Number of bindings in this descriptor set */ + uint16_t binding_count; + + /* Total size of the descriptor set with room for all array entries */ + uint16_t size; + + /* Shader stages affected by this descriptor set */ + uint16_t shader_stages; + + /* Number of dynamic offsets used by this descriptor set */ + uint16_t dynamic_offset_count; - uint32_t count; - uint32_t num_dynamic_buffers; - uint32_t shader_stages; - struct anv_descriptor_slot entries[0]; + /* Bindings in this descriptor set */ + struct anv_descriptor_set_binding_layout binding[0]; }; struct anv_descriptor { - struct anv_sampler *sampler; - struct anv_surface_view *view; + VkDescriptorType type; + + union { + struct { + union { + struct anv_image_view *image_view; + }; + struct anv_sampler *sampler; + }; + + struct { + struct anv_buffer *buffer; + uint64_t offset; + uint64_t range; + }; + }; }; struct anv_descriptor_set { + const struct anv_descriptor_set_layout *layout; struct anv_descriptor descriptors[0]; }; @@ -743,13 +760,23 @@ void anv_descriptor_set_destroy(struct anv_device *device, struct anv_descriptor_set *set); -#define MAX_VBS 32 -#define MAX_SETS 8 -#define MAX_RTS 8 +#define MAX_VBS 32 +#define MAX_SETS 8 +#define MAX_RTS 8 +#define MAX_VIEWPORTS 16 +#define MAX_SCISSORS 16 #define MAX_PUSH_CONSTANTS_SIZE 128 #define MAX_DYNAMIC_BUFFERS 16 #define MAX_IMAGES 8 +struct anv_pipeline_binding { + /* The descriptor set this surface corresponds to */ + uint16_t set; + + /* Offset into the descriptor set */ + uint16_t offset; +}; + struct anv_pipeline_layout { struct { struct anv_descriptor_set_layout *layout; @@ -765,8 +792,12 @@ struct anv_pipeline_layout { struct { bool has_dynamic_offsets; uint32_t surface_count; + struct anv_pipeline_binding *surface_to_descriptor; uint32_t sampler_count; + struct anv_pipeline_binding *sampler_to_descriptor; } stage[VK_SHADER_STAGE_NUM]; + + struct anv_pipeline_binding entries[0]; }; struct anv_buffer { @@ -778,23 +809,27 @@ struct anv_buffer { VkDeviceSize offset; }; -#define ANV_CMD_BUFFER_PIPELINE_DIRTY (1 << 0) -#define ANV_CMD_BUFFER_RS_DIRTY (1 << 2) -#define ANV_CMD_BUFFER_DS_DIRTY (1 << 3) -#define ANV_CMD_BUFFER_CB_DIRTY (1 << 4) -#define ANV_CMD_BUFFER_VP_DIRTY (1 << 5) -#define ANV_CMD_BUFFER_INDEX_BUFFER_DIRTY (1 << 6) +enum anv_cmd_dirty_bits { + ANV_CMD_DIRTY_DYNAMIC_VIEWPORT = 1 << 0, /* VK_DYNAMIC_STATE_VIEWPORT */ + ANV_CMD_DIRTY_DYNAMIC_SCISSOR = 1 << 1, /* VK_DYNAMIC_STATE_SCISSOR */ + ANV_CMD_DIRTY_DYNAMIC_LINE_WIDTH = 1 << 2, /* VK_DYNAMIC_STATE_LINE_WIDTH */ + ANV_CMD_DIRTY_DYNAMIC_DEPTH_BIAS = 1 << 3, /* VK_DYNAMIC_STATE_DEPTH_BIAS */ + ANV_CMD_DIRTY_DYNAMIC_BLEND_CONSTANTS = 1 << 4, /* VK_DYNAMIC_STATE_BLEND_CONSTANTS */ + ANV_CMD_DIRTY_DYNAMIC_DEPTH_BOUNDS = 1 << 5, /* VK_DYNAMIC_STATE_DEPTH_BOUNDS */ + ANV_CMD_DIRTY_DYNAMIC_STENCIL_COMPARE_MASK = 1 << 6, /* VK_DYNAMIC_STATE_STENCIL_COMPARE_MASK */ + ANV_CMD_DIRTY_DYNAMIC_STENCIL_WRITE_MASK = 1 << 7, /* VK_DYNAMIC_STATE_STENCIL_WRITE_MASK */ + ANV_CMD_DIRTY_DYNAMIC_STENCIL_REFERENCE = 1 << 8, /* VK_DYNAMIC_STATE_STENCIL_REFERENCE */ + ANV_CMD_DIRTY_DYNAMIC_ALL = (1 << 9) - 1, + ANV_CMD_DIRTY_PIPELINE = 1 << 9, + ANV_CMD_DIRTY_INDEX_BUFFER = 1 << 10, +}; +typedef uint32_t anv_cmd_dirty_mask_t; struct anv_vertex_binding { struct anv_buffer * buffer; VkDeviceSize offset; }; -struct anv_descriptor_set_binding { - struct anv_descriptor_set * set; - uint32_t dynamic_offsets[128]; -}; - struct anv_push_constants { /* Current allocated size of this push constants data structure. * Because a decent chunk of it may not be used (images on SKL, for @@ -812,39 +847,87 @@ struct anv_push_constants { uint32_t base_vertex; uint32_t base_instance; - /* Offsets for dynamically bound buffers */ - uint32_t dynamic_offsets[MAX_DYNAMIC_BUFFERS]; + /* Offsets and ranges for dynamically bound buffers */ + struct { + uint32_t offset; + uint32_t range; + } dynamic[MAX_DYNAMIC_BUFFERS]; /* Image data for image_load_store on pre-SKL */ struct brw_image_param images[MAX_IMAGES]; }; +struct anv_dynamic_state { + struct { + uint32_t count; + VkViewport viewports[MAX_VIEWPORTS]; + } viewport; + + struct { + uint32_t count; + VkRect2D scissors[MAX_SCISSORS]; + } scissor; + + float line_width; + + struct { + float bias; + float clamp; + float slope_scaled; + } depth_bias; + + float blend_constants[4]; + + struct { + float min; + float max; + } depth_bounds; + + struct { + uint32_t front; + uint32_t back; + } stencil_compare_mask; + + struct { + uint32_t front; + uint32_t back; + } stencil_write_mask; + + struct { + uint32_t front; + uint32_t back; + } stencil_reference; +}; + +extern const struct anv_dynamic_state default_dynamic_state; + +void anv_dynamic_state_copy(struct anv_dynamic_state *dest, + const struct anv_dynamic_state *src, + uint32_t copy_mask); + /** State required while building cmd buffer */ struct anv_cmd_state { uint32_t current_pipeline; uint32_t vb_dirty; - uint32_t dirty; - uint32_t compute_dirty; - uint32_t descriptors_dirty; - uint32_t push_constants_dirty; + anv_cmd_dirty_mask_t dirty; + anv_cmd_dirty_mask_t compute_dirty; + VkShaderStageFlags descriptors_dirty; + VkShaderStageFlags push_constants_dirty; uint32_t scratch_size; struct anv_pipeline * pipeline; struct anv_pipeline * compute_pipeline; struct anv_framebuffer * framebuffer; struct anv_render_pass * pass; struct anv_subpass * subpass; - struct anv_dynamic_rs_state * rs_state; - struct anv_dynamic_ds_state * ds_state; - struct anv_dynamic_vp_state * vp_state; - struct anv_dynamic_cb_state * cb_state; uint32_t state_vf[GEN8_3DSTATE_VF_length]; struct anv_vertex_binding vertex_bindings[MAX_VBS]; - struct anv_descriptor_set_binding descriptors[MAX_SETS]; + struct anv_descriptor_set * descriptors[MAX_SETS]; struct anv_push_constants * push_constants[VK_SHADER_STAGE_NUM]; + struct anv_dynamic_state dynamic; struct { struct anv_buffer * index_buffer; - uint32_t index_type; + uint32_t index_type; /**< 3DSTATE_INDEX_BUFFER.IndexFormat */ uint32_t index_offset; } gen7; }; @@ -876,8 +959,6 @@ struct anv_cmd_buffer { * These fields are initialized by anv_cmd_buffer_init_batch_bo_chain(). */ struct list_head batch_bos; - struct list_head surface_bos; - uint32_t surface_next; enum anv_cmd_buffer_exec_mode exec_mode; /* A vector of anv_batch_bo pointers for every batch or surface buffer @@ -887,6 +968,14 @@ struct anv_cmd_buffer { */ struct anv_vector seen_bbos; + /* A vector of int32_t's for every block of binding tables. + * + * initialized by anv_cmd_buffer_init_batch_bo_chain() + */ + struct anv_vector bt_blocks; + uint32_t bt_next; + struct anv_reloc_list surface_relocs; + /* Information needed for execbuf * * These fields are generated by anv_cmd_buffer_prepare_execbuf(). @@ -940,21 +1029,22 @@ struct anv_state anv_cmd_buffer_merge_dynamic(struct anv_cmd_buffer *cmd_buffer, void anv_cmd_buffer_begin_subpass(struct anv_cmd_buffer *cmd_buffer, struct anv_subpass *subpass); -struct anv_reloc_list * -anv_cmd_buffer_current_surface_relocs(struct anv_cmd_buffer *cmd_buffer); struct anv_address anv_cmd_buffer_surface_base_address(struct anv_cmd_buffer *cmd_buffer); struct anv_state -anv_cmd_buffer_alloc_surface_state(struct anv_cmd_buffer *cmd_buffer, - uint32_t size, uint32_t alignment); -struct anv_state anv_cmd_buffer_alloc_binding_table(struct anv_cmd_buffer *cmd_buffer, - uint32_t entries); + uint32_t entries, uint32_t *state_offset); +struct anv_state +anv_cmd_buffer_alloc_surface_state(struct anv_cmd_buffer *cmd_buffer); struct anv_state anv_cmd_buffer_alloc_dynamic_state(struct anv_cmd_buffer *cmd_buffer, uint32_t size, uint32_t alignment); -VkResult anv_cmd_buffer_new_surface_state_bo(struct anv_cmd_buffer *cmd_buffer); +VkResult +anv_cmd_buffer_new_binding_table_block(struct anv_cmd_buffer *cmd_buffer); + +void anv_cmd_buffer_emit_viewport(struct anv_cmd_buffer *cmd_buffer); +void anv_cmd_buffer_emit_scissor(struct anv_cmd_buffer *cmd_buffer); void gen7_cmd_buffer_emit_state_base_address(struct anv_cmd_buffer *cmd_buffer); void gen8_cmd_buffer_emit_state_base_address(struct anv_cmd_buffer *cmd_buffer); @@ -977,7 +1067,7 @@ anv_cmd_buffer_push_constants(struct anv_cmd_buffer *cmd_buffer, void anv_cmd_buffer_clear_attachments(struct anv_cmd_buffer *cmd_buffer, struct anv_render_pass *pass, const VkClearValue *clear_values); -const struct anv_depth_stencil_view * +const struct anv_image_view * anv_cmd_buffer_get_depth_stencil_view(const struct anv_cmd_buffer *cmd_buffer); void anv_cmd_buffer_dump(struct anv_cmd_buffer *cmd_buffer); @@ -989,7 +1079,11 @@ struct anv_fence { bool ready; }; +struct nir_shader; + struct anv_shader_module { + struct nir_shader * nir; + uint32_t size; char data[0]; }; @@ -1002,9 +1096,11 @@ struct anv_shader { struct anv_pipeline { struct anv_device * device; struct anv_batch batch; - uint32_t batch_data[256]; + uint32_t batch_data[512]; struct anv_reloc_list batch_relocs; - struct anv_shader * shaders[VK_SHADER_STAGE_NUM]; + uint32_t dynamic_state_mask; + struct anv_dynamic_state dynamic_state; + struct anv_pipeline_layout * layout; bool use_repclear; @@ -1025,7 +1121,7 @@ struct anv_pipeline { uint32_t nr_gs_entries; } urb; - uint32_t active_stages; + VkShaderStageFlags active_stages; struct anv_state_stream program_stream; struct anv_state blend_state; uint32_t vs_simd8; @@ -1075,6 +1171,11 @@ anv_pipeline_init(struct anv_pipeline *pipeline, struct anv_device *device, const VkGraphicsPipelineCreateInfo *pCreateInfo, const struct anv_graphics_pipeline_create_info *extra); +VkResult +anv_pipeline_compile_cs(struct anv_pipeline *pipeline, + const VkComputePipelineCreateInfo *info, + struct anv_shader *shader); + VkResult anv_graphics_pipeline_create(VkDevice device, const VkGraphicsPipelineCreateInfo *pCreateInfo, @@ -1102,16 +1203,11 @@ gen8_compute_pipeline_create(VkDevice _device, const VkComputePipelineCreateInfo *pCreateInfo, VkPipeline *pPipeline); -struct anv_compiler *anv_compiler_create(struct anv_device *device); -void anv_compiler_destroy(struct anv_compiler *compiler); -int anv_compiler_run(struct anv_compiler *compiler, struct anv_pipeline *pipeline); -void anv_compiler_free(struct anv_pipeline *pipeline); - struct anv_format { const VkFormat vk_format; const char *name; uint16_t surface_format; /**< RENDER_SURFACE_STATE.SurfaceFormat */ - uint8_t cpp; /**< Bytes-per-pixel of anv_format::surface_format. */ + uint8_t bs; /**< Block size (in bytes) of anv_format::surface_format. */ uint8_t num_channels; uint16_t depth_format; /**< 3DSTATE_DEPTH_BUFFER.SurfaceFormat */ bool has_stencil; @@ -1145,7 +1241,7 @@ struct anv_image_view_info { bool is_cube:1; /**< RENDER_SURFACE_STATE.CubeFaceEnable* */ }; -const struct anv_image_view_info * +struct anv_image_view_info anv_image_view_info_for_vk_image_view_type(VkImageViewType type); /** @@ -1181,6 +1277,7 @@ struct anv_image { VkExtent3D extent; uint32_t levels; uint32_t array_size; + VkImageUsageFlags usage; /**< Superset of VkImageCreateInfo::usage. */ VkDeviceSize size; uint32_t alignment; @@ -1189,8 +1286,10 @@ struct anv_image { struct anv_bo *bo; VkDeviceSize offset; - /** RENDER_SURFACE_STATE.SurfaceType */ - uint8_t surf_type; + uint8_t surface_type; /**< RENDER_SURFACE_STATE.SurfaceType */ + + bool needs_nonrt_surface_state:1; + bool needs_color_rt_surface_state:1; /** * Image subsurfaces @@ -1214,42 +1313,18 @@ struct anv_image { }; }; -struct anv_surface_view { - struct anv_state surface_state; /**< RENDER_SURFACE_STATE */ - struct anv_bo *bo; - uint32_t offset; /**< VkBufferCreateInfo::offset */ - uint32_t range; /**< VkBufferCreateInfo::range */ - const struct anv_format *format; /**< VkBufferCreateInfo::format */ -}; - -struct anv_buffer_view { - struct anv_surface_view view; -}; - struct anv_image_view { - struct anv_surface_view view; - VkExtent3D extent; -}; - -enum anv_attachment_view_type { - ANV_ATTACHMENT_VIEW_TYPE_COLOR, - ANV_ATTACHMENT_VIEW_TYPE_DEPTH_STENCIL, -}; - -struct anv_attachment_view { - enum anv_attachment_view_type attachment_type; - VkExtent3D extent; -}; + const struct anv_image *image; /**< VkImageViewCreateInfo::image */ + const struct anv_format *format; /**< VkImageViewCreateInfo::format */ + struct anv_bo *bo; + uint32_t offset; /**< Offset into bo. */ + VkExtent3D extent; /**< Extent of VkImageViewCreateInfo::baseMipLevel. */ -struct anv_color_attachment_view { - struct anv_attachment_view base; - struct anv_surface_view view; -}; + /** RENDER_SURFACE_STATE when using image as a color render target. */ + struct anv_state color_rt_surface_state; -struct anv_depth_stencil_view { - struct anv_attachment_view base; - const struct anv_image *image; /**< VkAttachmentViewCreateInfo::image */ - const struct anv_format *format; /**< VkAttachmentViewCreateInfo::format */ + /** RENDER_SURFACE_STATE when using image as a non render target. */ + struct anv_state nonrt_surface_state; }; struct anv_image_create_info { @@ -1264,10 +1339,8 @@ VkResult anv_image_create(VkDevice _device, VkImage *pImage); struct anv_surface * -anv_image_get_surface_for_aspect(struct anv_image *image, VkImageAspect aspect); - -struct anv_surface * -anv_image_get_surface_for_color_attachment(struct anv_image *image); +anv_image_get_surface_for_aspect_mask(struct anv_image *image, + VkImageAspectFlags aspect_mask); void anv_image_view_init(struct anv_image_view *view, struct anv_device *device, @@ -1286,36 +1359,17 @@ gen8_image_view_init(struct anv_image_view *iview, const VkImageViewCreateInfo* pCreateInfo, struct anv_cmd_buffer *cmd_buffer); -void anv_color_attachment_view_init(struct anv_color_attachment_view *view, - struct anv_device *device, - const VkAttachmentViewCreateInfo* pCreateInfo, - struct anv_cmd_buffer *cmd_buffer); - -void gen7_color_attachment_view_init(struct anv_color_attachment_view *aview, - struct anv_device *device, - const VkAttachmentViewCreateInfo* pCreateInfo, - struct anv_cmd_buffer *cmd_buffer); - -void gen8_color_attachment_view_init(struct anv_color_attachment_view *aview, - struct anv_device *device, - const VkAttachmentViewCreateInfo* pCreateInfo, - struct anv_cmd_buffer *cmd_buffer); - -VkResult anv_buffer_view_create(struct anv_device *device, - const VkBufferViewCreateInfo *pCreateInfo, - struct anv_buffer_view **view_out); - void anv_fill_buffer_surface_state(struct anv_device *device, void *state, const struct anv_format *format, - uint32_t offset, uint32_t range); + uint32_t offset, uint32_t range, + uint32_t stride); void gen7_fill_buffer_surface_state(void *state, const struct anv_format *format, - uint32_t offset, uint32_t range); + uint32_t offset, uint32_t range, + uint32_t stride); void gen8_fill_buffer_surface_state(void *state, const struct anv_format *format, - uint32_t offset, uint32_t range); - -void anv_surface_view_fini(struct anv_device *device, - struct anv_surface_view *view); + uint32_t offset, uint32_t range, + uint32_t stride); struct anv_sampler { uint32_t state[4]; @@ -1326,11 +1380,8 @@ struct anv_framebuffer { uint32_t height; uint32_t layers; - /* Viewport for clears */ - VkDynamicViewportState vp_state; - uint32_t attachment_count; - const struct anv_attachment_view * attachments[0]; + const struct anv_image_view * attachments[0]; }; struct anv_subpass { @@ -1352,15 +1403,12 @@ struct anv_render_pass_attachment { struct anv_render_pass { uint32_t attachment_count; uint32_t subpass_count; - - uint32_t num_color_clear_attachments; - bool has_depth_clear_attachment; - bool has_stencil_clear_attachment; - struct anv_render_pass_attachment * attachments; struct anv_subpass subpasses[0]; }; +extern struct anv_render_pass anv_meta_dummy_renderpass; + struct anv_query_pool_slot { uint64_t begin; uint64_t end; @@ -1378,6 +1426,10 @@ void anv_device_finish_meta(struct anv_device *device); void *anv_lookup_entrypoint(const char *name); +void anv_dump_image_to_ppm(struct anv_device *device, + struct anv_image *image, unsigned miplevel, + unsigned array_layer, const char *filename); + #define ANV_DEFINE_HANDLE_CASTS(__anv_type, __VkType) \ \ static inline struct __anv_type * \ @@ -1416,16 +1468,10 @@ ANV_DEFINE_HANDLE_CASTS(anv_physical_device, VkPhysicalDevice) ANV_DEFINE_HANDLE_CASTS(anv_queue, VkQueue) ANV_DEFINE_NONDISP_HANDLE_CASTS(anv_cmd_pool, VkCmdPool) -ANV_DEFINE_NONDISP_HANDLE_CASTS(anv_attachment_view, VkAttachmentView) ANV_DEFINE_NONDISP_HANDLE_CASTS(anv_buffer, VkBuffer) -ANV_DEFINE_NONDISP_HANDLE_CASTS(anv_buffer_view, VkBufferView); ANV_DEFINE_NONDISP_HANDLE_CASTS(anv_descriptor_set, VkDescriptorSet) ANV_DEFINE_NONDISP_HANDLE_CASTS(anv_descriptor_set_layout, VkDescriptorSetLayout) ANV_DEFINE_NONDISP_HANDLE_CASTS(anv_device_memory, VkDeviceMemory) -ANV_DEFINE_NONDISP_HANDLE_CASTS(anv_dynamic_cb_state, VkDynamicColorBlendState) -ANV_DEFINE_NONDISP_HANDLE_CASTS(anv_dynamic_ds_state, VkDynamicDepthStencilState) -ANV_DEFINE_NONDISP_HANDLE_CASTS(anv_dynamic_rs_state, VkDynamicRasterState) -ANV_DEFINE_NONDISP_HANDLE_CASTS(anv_dynamic_vp_state, VkDynamicViewportState) ANV_DEFINE_NONDISP_HANDLE_CASTS(anv_fence, VkFence) ANV_DEFINE_NONDISP_HANDLE_CASTS(anv_framebuffer, VkFramebuffer) ANV_DEFINE_NONDISP_HANDLE_CASTS(anv_image, VkImage)