Vulkan: Support for Framebuffer with Missing Attachments #113141

Merged
Jeroen Bakker merged 9 commits from Jeroen-Bakker/blender:vulkan/wireframe-shading-mode into main 2023-10-10 09:27:14 +02:00
Member

Wireframe mode wasn't working and viewport had flickering artifacts.
Reason was that the render pass creation failed for its framebuffer as
the input data was filled with garbage for attachments that were unused.

Vulkan requires every attachment to be filled upto the highest used attachment
slot. This PR fills missing attachments with a dummy texture.

Wireframe mode wasn't working and viewport had flickering artifacts. Reason was that the render pass creation failed for its framebuffer as the input data was filled with garbage for attachments that were unused. Vulkan requires every attachment to be filled upto the highest used attachment slot. This PR fills missing attachments with a dummy texture.
Jeroen Bakker added 2 commits 2023-10-02 12:58:10 +02:00
Jeroen Bakker added 4 commits 2023-10-10 08:44:30 +02:00
Jeroen Bakker added 1 commit 2023-10-10 08:55:59 +02:00
Jeroen Bakker added 1 commit 2023-10-10 09:07:37 +02:00
Jeroen Bakker added 1 commit 2023-10-10 09:24:02 +02:00
Jeroen Bakker added the
Interest
Vulkan
label 2023-10-10 09:25:15 +02:00
Jeroen Bakker added this to the 4.1 milestone 2023-10-10 09:25:19 +02:00
Jeroen Bakker added this to the EEVEE & Viewport project 2023-10-10 09:25:22 +02:00
Jeroen Bakker self-assigned this 2023-10-10 09:25:26 +02:00
Jeroen Bakker merged commit d67ec32747 into main 2023-10-10 09:27:14 +02:00
Contributor

we can leave unused attachments by using VK_ATTACHMENT_UNUSED.
(vk_framebuffer)[f3dc49f605/source/blender/gpu/vulkan/vk_framebuffer.cc (L1041)]

we can leave unused attachments by using `VK_ATTACHMENT_UNUSED`. (vk_framebuffer)[https://projects.blender.org/vnapdv/blender/src/commit/f3dc49f60505c0da94759c7123d148721a073727/source/blender/gpu/vulkan/vk_framebuffer.cc#L1041]
Author
Member

@vnapdv in the renderpass they can be left unused, but in the list of image views they still need to exist according to the vulkan specs. https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkFramebufferCreateInfo.html#VUID-VkFramebufferCreateInfo-flags-02778

If flags does not include VK_FRAMEBUFFER_CREATE_IMAGELESS_BIT and attachmentCount is not 0, pAttachments must be a valid pointer to an array of attachmentCount valid VkImageView handles

Having a framebuffer that for example has a color attachement on slot 1, but not on slot 0, slot 0 still needs to be filled with a valid handle. Other solutions would be to change the binding points in the shader, But that would reduce performance as Blender allows skipping attachment slots by design.

@vnapdv in the renderpass they can be left unused, but in the list of image views they still need to exist according to the vulkan specs. https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkFramebufferCreateInfo.html#VUID-VkFramebufferCreateInfo-flags-02778 >If flags does not include VK_FRAMEBUFFER_CREATE_IMAGELESS_BIT and attachmentCount is not 0, pAttachments must be a valid pointer to an array of attachmentCount valid VkImageView handles Having a framebuffer that for example has a color attachement on slot 1, but not on slot 0, slot 0 still needs to be filled with a valid handle. Other solutions would be to change the binding points in the shader, But that would reduce performance as Blender allows skipping attachment slots by design.
Contributor

In my implementation, Image-view is not necessary. If you set VK_ATTACHMENT_UNUSED to attachment 0 in the subpass descriptions, you can actually set the reference of attachment 1 to 0, so there is only one Image-view and there is no need to change the shader.

In my implementation, Image-view is not necessary. If you set VK_ATTACHMENT_UNUSED to attachment 0 in the subpass descriptions, you can actually set the reference of attachment 1 to 0, so there is only one Image-view and there is no need to change the shader.
Author
Member

I see, yes that could also work

I see, yes that could also work
Sign in to join this conversation.
No reviewers
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#113141
No description provided.