meta_resolve_save(struct anv_meta_saved_state *saved_state,
struct anv_cmd_buffer *cmd_buffer)
{
- anv_meta_save(saved_state, cmd_buffer,
- (1 << VK_DYNAMIC_STATE_VIEWPORT) |
- (1 << VK_DYNAMIC_STATE_SCISSOR));
-
- cmd_buffer->state.dynamic.viewport.count = 0;
- cmd_buffer->state.dynamic.scissor.count = 0;
+ anv_meta_save(saved_state, cmd_buffer, 0);
}
static void
tex->dest_type = nir_type_float;
tex->is_array = false;
tex->coord_components = 3;
- nir_ssa_dest_init(&tex->instr, &tex->dest, /*num_components*/ 4, "tex");
+ nir_ssa_dest_init(&tex->instr, &tex->dest, 4, 32, "tex");
nir_builder_instr_insert(&b, &tex->instr);
accum = nir_fadd(&b, accum, &tex->dest.ssa);
&(struct anv_graphics_pipeline_create_info) {
.color_attachment_count = -1,
.use_repclear = false,
- .disable_viewport = true,
- .disable_scissor = true,
.disable_vs = true,
.use_rectlist = true
},
struct anv_device *device = cmd_buffer->device;
VkDevice device_h = anv_device_to_handle(device);
VkCommandBuffer cmd_buffer_h = anv_cmd_buffer_to_handle(cmd_buffer);
- const struct anv_framebuffer *fb = cmd_buffer->state.framebuffer;
const struct anv_image *src_image = src_iview->image;
const struct vertex_attrs vertex_data[3] = {
/*copyCount*/ 0,
/*copies */ NULL);
- ANV_CALL(CmdSetViewport)(cmd_buffer_h,
- /*firstViewport*/ 0,
- /*viewportCount*/ 1,
- (VkViewport[]) {
- {
- .x = 0,
- .y = 0,
- .width = fb->width,
- .height = fb->height,
- .minDepth = 0.0,
- .maxDepth = 1.0,
- },
- });
-
- ANV_CALL(CmdSetScissor)(cmd_buffer_h,
- /*firstScissor*/ 0,
- /*scissorCount*/ 1,
- (VkRect2D[]) {
- {
- .offset = { 0, 0 },
- .extent = (VkExtent2D) { fb->width, fb->height },
- },
- });
-
VkPipeline pipeline_h = *get_pipeline_h(device, src_image->samples);
ANV_FROM_HANDLE(anv_pipeline, pipeline, pipeline_h);
anv_meta_get_iview_layer(dest_image, ®ion->dstSubresource,
®ion->dstOffset);
+ /**
+ * From Vulkan 1.0.6 spec: 18.6 Resolving Multisample Images
+ *
+ * extent is the size in texels of the source image to resolve in width,
+ * height and depth. 1D images use only x and width. 2D images use x, y,
+ * width and height. 3D images use x, y, z, width, height and depth.
+ *
+ * srcOffset and dstOffset select the initial x, y, and z offsets in
+ * texels of the sub-regions of the source and destination image data.
+ * extent is the size in texels of the source image to resolve in width,
+ * height and depth. 1D images use only x and width. 2D images use x, y,
+ * width and height. 3D images use x, y, z, width, height and depth.
+ */
+ const struct VkExtent3D extent =
+ anv_sanitize_image_extent(src_image->type, region->extent);
+ const struct VkOffset3D srcOffset =
+ anv_sanitize_image_offset(src_image->type, region->srcOffset);
+ const struct VkOffset3D dstOffset =
+ anv_sanitize_image_offset(dest_image->type, region->dstOffset);
+
+
for (uint32_t layer = 0; layer < region->srcSubresource.layerCount;
++layer) {
.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
.image = src_image_h,
.viewType = anv_meta_get_view_type(src_image),
- .format = src_image->format->vk_format,
+ .format = src_image->vk_format,
.subresourceRange = {
.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
.baseMipLevel = region->srcSubresource.mipLevel,
.layerCount = 1,
},
},
- cmd_buffer, 0, VK_IMAGE_USAGE_SAMPLED_BIT);
+ cmd_buffer, VK_IMAGE_USAGE_SAMPLED_BIT);
struct anv_image_view dest_iview;
anv_image_view_init(&dest_iview, cmd_buffer->device,
.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
.image = dest_image_h,
.viewType = anv_meta_get_view_type(dest_image),
- .format = dest_image->format->vk_format,
+ .format = dest_image->vk_format,
.subresourceRange = {
.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
.baseMipLevel = region->dstSubresource.mipLevel,
.layerCount = 1,
},
},
- cmd_buffer, 0, VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT);
+ cmd_buffer, VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT);
VkFramebuffer fb_h;
anv_CreateFramebuffer(device_h,
.framebuffer = fb_h,
.renderArea = {
.offset = {
- region->dstOffset.x,
- region->dstOffset.y,
+ dstOffset.x,
+ dstOffset.y,
},
.extent = {
- region->extent.width,
- region->extent.height,
+ extent.width,
+ extent.height,
}
},
.clearValueCount = 0,
emit_resolve(cmd_buffer,
&src_iview,
&(VkOffset2D) {
- .x = region->srcOffset.x,
- .y = region->srcOffset.y,
+ .x = srcOffset.x,
+ .y = srcOffset.y,
},
&dest_iview,
&(VkOffset2D) {
- .x = region->dstOffset.x,
- .y = region->dstOffset.y,
+ .x = dstOffset.x,
+ .y = dstOffset.y,
},
&(VkExtent2D) {
- .width = region->extent.width,
- .height = region->extent.height,
+ .width = extent.width,
+ .height = extent.height,
});
ANV_CALL(CmdEndRenderPass)(cmd_buffer_h);