diff --git a/intern/ghost/intern/GHOST_ContextVK.cc b/intern/ghost/intern/GHOST_ContextVK.cc index 6e893efcfa1..cd088e3e979 100644 --- a/intern/ghost/intern/GHOST_ContextVK.cc +++ b/intern/ghost/intern/GHOST_ContextVK.cc @@ -644,7 +644,9 @@ GHOST_TSuccess GHOST_ContextVK::swapBuffers() /* Wait for previous time that the frame was used to finish rendering. Presenting can * still happen in parallel, but acquiring needs can only happen when the frame acquire semaphore * has been signaled and waited for. */ - vkWaitForFences(device, 1, &submission_frame_data.submission_fence, true, UINT64_MAX); + if (submission_frame_data.submission_fence) { + vkWaitForFences(device, 1, &submission_frame_data.submission_fence, true, UINT64_MAX); + } submission_frame_data.discard_pile.destroy(device); bool use_hdr_swapchain = true; #ifdef WITH_GHOST_WAYLAND @@ -1227,10 +1229,8 @@ const char *GHOST_ContextVK::getPlatformSpecificSurfaceExtension() const GHOST_TSuccess GHOST_ContextVK::initializeDrawingContext() { - bool use_hdr_swapchain = false; #ifdef _WIN32 const bool use_window_surface = (hwnd_ != nullptr); - use_hdr_swapchain = true; #elif defined(__APPLE__) const bool use_window_surface = (metal_layer_ != nullptr); #else /* UNIX/Linux */ @@ -1244,9 +1244,6 @@ GHOST_TSuccess GHOST_ContextVK::initializeDrawingContext() # ifdef WITH_GHOST_WAYLAND case GHOST_kVulkanPlatformWayland: use_window_surface = (wayland_display_ != nullptr) && (wayland_surface_ != nullptr); - if (wayland_window_info_) { - use_hdr_swapchain = wayland_window_info_->is_color_managed; - } break; # endif case GHOST_kVulkanPlatformHeadless: @@ -1399,9 +1396,9 @@ GHOST_TSuccess GHOST_ContextVK::initializeDrawingContext() vulkan_device->users++; vulkan_device->ensure_device(required_device_extensions, optional_device_extensions); - if (use_window_surface) { - recreateSwapchain(use_hdr_swapchain); - } + render_extent_ = {0, 0}; + render_extent_min_ = {0, 0}; + surface_format_ = {VK_FORMAT_R8G8B8A8_UNORM, VK_COLOR_SPACE_SRGB_NONLINEAR_KHR}; active_context_ = this; return GHOST_kSuccess; diff --git a/source/blender/gpu/vulkan/vk_context.cc b/source/blender/gpu/vulkan/vk_context.cc index ef81e7f92e2..17d004f3f44 100644 --- a/source/blender/gpu/vulkan/vk_context.cc +++ b/source/blender/gpu/vulkan/vk_context.cc @@ -85,8 +85,8 @@ void VKContext::sync_backbuffer(bool cycle_resource_pool) vk_extent_.height = max_uu(vk_extent_.height, 1u); surface_texture_ = GPU_texture_create_2d( "back-left", - swap_chain_data.extent.width, - swap_chain_data.extent.height, + vk_extent_.width, + vk_extent_.height, 1, to_gpu_format(swap_chain_data.surface_format.format), GPU_TEXTURE_USAGE_ATTACHMENT | GPU_TEXTURE_USAGE_SHADER_READ, diff --git a/source/blender/gpu/vulkan/vk_framebuffer.cc b/source/blender/gpu/vulkan/vk_framebuffer.cc index 6f2ac160d09..776fca22f4b 100644 --- a/source/blender/gpu/vulkan/vk_framebuffer.cc +++ b/source/blender/gpu/vulkan/vk_framebuffer.cc @@ -100,6 +100,14 @@ void VKFrameBuffer::render_area_update(VkRect2D &render_area) const render_area.extent.width = width_; render_area.extent.height = height_; } + +#ifndef NDEBUG + const VKDevice &device = VKBackend::get().device; + BLI_assert(render_area.offset.x + render_area.extent.width <= + device.physical_device_properties_get().limits.maxFramebufferWidth); + BLI_assert(render_area.offset.y + render_area.extent.height <= + device.physical_device_properties_get().limits.maxFramebufferHeight); +#endif } void VKFrameBuffer::vk_render_areas_append(Vector &r_render_areas) const