GPU: Add CreateInfo Structs for builtin shaders #95009

Closed
opened 2022-01-18 13:28:26 +01:00 by Jeroen Bakker · 12 comments
Member

Recently the GPU module has a new way of creating shaders (D13360: GPUShaderCreateInfo for interface abstraction). This new way would allow us to cross compile to other (future) GPU backends like vulkan.

This task give an overview of the builtin shaders that still needs to be converted and the proposed way how to do this.
Community members that want to dive into the way how GPU is setup in Blender are welcome to help with the conversion.

Please reach out in the chat to jeroen-bakker or fclem for coordination and help to get started.
Most important would be to compile WITH_GPU_SHADER_BUILDER=On. This will validate the shaders already at compile time for quick turn around times.

More Resources

Recently the GPU module has a new way of creating shaders ([D13360: GPUShaderCreateInfo for interface abstraction](https://archive.blender.org/developer/D13360)). This new way would allow us to cross compile to other (future) GPU backends like vulkan. This task give an overview of the builtin shaders that still needs to be converted and the proposed way how to do this. Community members that want to dive into the way how GPU is setup in Blender are welcome to help with the conversion. Please reach out in the chat to jeroen-bakker or fclem for coordination and help to get started. Most important would be to compile `WITH_GPU_SHADER_BUILDER=On`. This will validate the shaders already at compile time for quick turn around times. ## More Resources * https://wiki.blender.org/wiki/EEVEE_%26_Viewport/GPU_Module/GLSL_Cross_Compilation Documentation about the cross compilation. (Not complete yet, and in some parts still confusing.) * 08d008a508 an example how to convert a shader.
Author
Member

Changed status from 'Needs Triage' to: 'Confirmed'

Changed status from 'Needs Triage' to: 'Confirmed'
Author
Member

Added subscriber: @Jeroen-Bakker

Added subscriber: @Jeroen-Bakker

Added subscriber: @geocentric_wage

Added subscriber: @geocentric_wage

Added subscriber: @SHREY-AGGARWAL

Added subscriber: @SHREY-AGGARWAL

Added subscriber: @mariek

Added subscriber: @mariek

Added subscriber: @brecht

Added subscriber: @brecht

Removing this from the 3.1 workboard so it's clear which actual works remains for the release.

Removing this from the 3.1 workboard so it's clear which actual works remains for the release.

Added subscriber: @Ujwal-Kundur

Added subscriber: @Ujwal-Kundur

Hi, I'm new here. Should I claim this task before working on it ( to prevent duplicate effort ) or should I claim it after I have a diff?

This may seem like low effort on my part, but I need some help getting started:

  • In the source/blender/gpu/GPU_shader_shared.h file, what does the following code segment do? Is the function expected to be called multiple times, if so, why a cap of 16?
#define MAX_CALLS 16

struct MultiRectCallData {
  float4 calls_data[MAX_CALLS * 3];
};
BLI_STATIC_ASSERT_ALIGN(struct MultiRectCallData, 16)
Hi, I'm new here. Should I claim this task before working on it ( to prevent duplicate effort ) or should I claim it after I have a diff? This may seem like low effort on my part, but I need some help getting started: - In the source/blender/gpu/GPU_shader_shared.h file, what does the following code segment do? Is the function expected to be called multiple times, if so, why a cap of 16? ``` #define MAX_CALLS 16 struct MultiRectCallData { float4 calls_data[MAX_CALLS * 3]; }; BLI_STATIC_ASSERT_ALIGN(struct MultiRectCallData, 16) ```
Author
Member

@Ujwal-Kundur you can claim the task you want to work on. Note that there is already a patch for one shader I forgot to administrate correctly. Will do that on Monday. D14159: Add CreateInfo for GPU_SHADER_2D_WIDGET_BASE

On the GPU the structs are organized differently than on a CPU. the assert will make sure that it follows the GPU struct sized so CPU memory can be copied directly to the GPU.

@Ujwal-Kundur you can claim the task you want to work on. Note that there is already a patch for one shader I forgot to administrate correctly. Will do that on Monday. [D14159: Add CreateInfo for GPU_SHADER_2D_WIDGET_BASE](https://archive.blender.org/developer/D14159) On the GPU the structs are organized differently than on a CPU. the assert will make sure that it follows the GPU struct sized so CPU memory can be copied directly to the GPU.

@Jeroen-Bakker thanks for the info! I'll take a shot at #95013 (Add CreateInfo for GPU_SHADER_INSTANCE_VARIYING_COLOR_VARIYING_SIZE) for my first patch

@Jeroen-Bakker thanks for the info! I'll take a shot at #95013 (Add CreateInfo for GPU_SHADER_INSTANCE_VARIYING_COLOR_VARIYING_SIZE) for my first patch
Author
Member

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
Jeroen Bakker self-assigned this 2022-06-03 11:22:10 +02:00
Sign in to join this conversation.
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 project
No Assignees
6 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#95009
No description provided.