Vulkan: Convert VertexBuffer to Contain Supported Attributes #107733

Merged
Jeroen Bakker merged 7 commits from Jeroen-Bakker/blender:vulkan-attribute-data-conversions into main 2023-05-11 12:23:29 +02:00
Member

Vulkan doesn't have a conversion from uint32_t/int32_t to float. It does
have conversions from 16/8 bits. Main reason is that Vulkan expects that
there is no benefit when converting 32 bits from one type to the other
and should be solved by passing the right data type.

In Blender however this isn't the case as there are benefits on other
GPU backends (OpenGL for example).

This PR adds helper function to check if conversion is needed and
perform any conversions in place. It also implements the function to
upload vertex buffers to the GPU.

NOTE: Test cases have been added to validate this, but they are not
able to run on the Vulkan backend just yet, because they require the
graphics pipeline to be available.

Vulkan doesn't have a conversion from uint32_t/int32_t to float. It does have conversions from 16/8 bits. Main reason is that Vulkan expects that there is no benefit when converting 32 bits from one type to the other and should be solved by passing the right data type. In Blender however this isn't the case as there are benefits on other GPU backends (OpenGL for example). This PR adds helper function to check if conversion is needed and perform any conversions in place. It also implements the function to upload vertex buffers to the GPU. NOTE: Test cases have been added to validate this, but they are not able to run on the Vulkan backend just yet, because they require the graphics pipeline to be available.
Jeroen Bakker added this to the 3.6 LTS milestone 2023-05-08 12:33:21 +02:00
Jeroen Bakker added the
Interest
Vulkan
label 2023-05-08 12:33:21 +02:00
Jeroen Bakker self-assigned this 2023-05-08 12:33:21 +02:00
Jeroen Bakker added 1 commit 2023-05-08 12:33:26 +02:00
ad7465be67 Vulkan: Convert VertexBuffer to Contain Supported Attributes
Vulkan doesn't have a conversion from uint32_t/int32_t to float. It does
have conversions from 16/8 bits. Main reason is that Vulkan expects that
there is no benefit when converting 32 bits from one type to the other
and should be solved by passing the right data type.

In Blender however this isn't the case as there are benefits on other
GPU backends (OpenGL for example).

This PR adds helper function to check if conversion is needed and
perform any conversions in place. It also implements the function to
upload vertex buffers to the GPU.
Jeroen Bakker added this to the EEVEE & Viewport project 2023-05-08 12:33:33 +02:00
Jeroen Bakker added 1 commit 2023-05-08 13:49:50 +02:00
Jeroen Bakker reviewed 2023-05-08 14:48:58 +02:00
@ -304,0 +389,4 @@
case GPU_COMP_I32:
case GPU_COMP_U32:
/* NOTE: GPU_COMP_I32/U32 using GPU_FETCH_INT_TO_FLOAT isn't natively supported. These are
* converted on the host and therefor needs to be attached as signed floats. */
Author
Member

spelling

spelling
Jeroen-Bakker marked this conversation as resolved
Jeroen Bakker force-pushed vulkan-attribute-data-conversions from 548461b029 to 253527cd8a 2023-05-11 12:19:05 +02:00 Compare
Jeroen Bakker added 1 commit 2023-05-11 12:21:29 +02:00
Jeroen Bakker merged commit 8aff713270 into main 2023-05-11 12:23:29 +02:00
Jeroen Bakker deleted branch vulkan-attribute-data-conversions 2023-05-11 12:23:30 +02:00
Howard Trickey referenced this issue from a commit 2023-05-29 02:51:40 +02:00
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
1 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#107733
No description provided.