Commit Graph

318 Commits

Author SHA1 Message Date
Clément Foucault
e36cc4dcf7 Cleanup: Grease Pencil: Remove uneeded push-constants
All of these push-constants were either redundant or
not used anymore.

Pull Request: https://projects.blender.org/blender/blender/pulls/135561
2025-03-06 15:14:05 +01:00
Clément Foucault
bb2d123fbd Cleanup: DRW: Remove ObjectInfos legacy GLSL macros
_No response_

Pull Request: https://projects.blender.org/blender/blender/pulls/135542
2025-03-06 11:06:26 +01:00
Campbell Barton
d951428422 Cleanup: spelling in comments
Address warnings from check_spelling.py
2025-03-06 10:49:51 +11:00
Clément Foucault
bacc58b142 Cleanup: DRW: Remove duplicated glsl library 2025-03-05 15:31:35 +01:00
Clément Foucault
9bddb57960 Cleanup: DRW: Relace drw_view macros by function calls 2025-03-05 15:31:35 +01:00
Clément Foucault
a92f6ebf13 Cleanup: DRW: Remove ModelMatrix legacy GLSL macros 2025-03-05 15:31:35 +01:00
Clément Foucault
5916c39fa4 Cleanup: DRW: Simplify resource id and custom id 2025-03-05 15:31:35 +01:00
Clément Foucault
783472671e Cleanup: GPU: Add macro for default constructor compatibility on MSL 2025-03-03 12:50:45 +01:00
Jeroen Bakker
22aad0fde7 SubDiv: Use shader create info for patch evaluation shader
This PR migrates the subdiv_patch_evaluation_comp.glsl to use
shader create info.

The part of OSD that is used is included as a typedef source (osd_patch_basis.glsl).

Pull Request: https://projects.blender.org/blender/blender/pulls/134917
2025-02-27 15:42:08 +01:00
Jeroen Bakker
fcc5681624 SubDiv: Use shader create info for custom data
This PR migrates the custom_data_interp_comp.glsl to use
shader create info.

During development tests have been conducted to use specialization constants,
but due to limitations inside Metal we didn't use them.

Number of ShaderCreateInfos have been reduced by using macros. Variadic macros
have not been used as they don't support CPP compilation.

Pull Request: https://projects.blender.org/blender/blender/pulls/134932
2025-02-27 09:50:36 +01:00
Jeroen Bakker
e2793ab3da Fix: SubDiv: CPP Shader compilation
Some shaders were missing and didn't
compile using CPP compilation

Pull Request: https://projects.blender.org/blender/blender/pulls/135090
2025-02-27 08:54:34 +01:00
Clément Foucault
f47f990594 Cleanup: DRW: Remove uniforms declaration and dangerous defines 2025-02-25 23:46:27 +01:00
Clément Foucault
b2ed7eb45c Cleanup: DRW: Remove unused legacy shader libraries 2025-02-25 23:10:19 +01:00
Clément Foucault
3a7d086200 Cleanup: DRW: Remove legacy create info and rename new ones
This is just mass renaming
2025-02-25 23:05:12 +01:00
Hans Goudey
24e67d9d49 Point Cloud: Remove multiplication in radius extraction and shaders
This multiplication by 100/0.01 was there for historical reasons.
This commit just removes it everywhere.

Pull Request: https://projects.blender.org/blender/blender/pulls/135123
2025-02-25 19:10:45 +01:00
Clément Foucault
cb7d9222cf Cleanup: DRW: Remove legacy object data create infos
Remove deprecated (and unused) create infos and mass
rename the `*_new` ones.
2025-02-25 18:46:42 +01:00
Clément Foucault
d8387a82ff Cleanup: DRW: Remove legacy common_math_lib 2025-02-25 18:12:33 +01:00
Jeroen Bakker
3b5c3e70b1 SubDiv: Use shader create info for stretch overlays
This PR migrates subdiv_vbo_edituv_strech_*_comp.glsl to use
shader create info.

Pull Request: https://projects.blender.org/blender/blender/pulls/135038
2025-02-24 13:32:53 +01:00
Jeroen Bakker
1f0bc6bbe6 SubDiv: Use shader create info for sculpt data
This PR migrates subdiv_vbo_sculpt_data_comp.glsl to use
shader create info.

Pull Request: https://projects.blender.org/blender/blender/pulls/135032
2025-02-24 12:58:13 +01:00
Jeroen Bakker
3e030e3de0 SubDiv: Use shader create info for edge fac shader
This PR migrates the subdiv_vbo_edge_fac.glsl to use
shader create info.

Pull Request: https://projects.blender.org/blender/blender/pulls/134907
2025-02-21 16:26:28 +01:00
Jeroen Bakker
8299b30269 SubDiv: Use shader create info for lnor shader
This PR migrates the subdiv_vbo_lnor_comp.glsl to use
shader create info.

Pull Request: https://projects.blender.org/blender/blender/pulls/134916
2025-02-21 15:43:09 +01:00
Jeroen Bakker
8e72bf937f SubDiv: Use shader create info for triangle indices shader
This PR migrates the subdiv_ibo_tris_comp.glsl to use
shader create info. Due to naming collision shader_data
needs to be accessed directly.

Pull Request: https://projects.blender.org/blender/blender/pulls/134867
2025-02-21 14:55:18 +01:00
Jeroen Bakker
c436972b2b SubDiv: Use shader create info for lines shader
This PR migrates the subdiv_ibo_lines_comp.glsl to use
shader create info.

Pull Request: https://projects.blender.org/blender/blender/pulls/134857
2025-02-21 14:16:57 +01:00
Jeroen Bakker
310d103600 SubDiv: Use shader create info for normal accumulation shader
This PR migrates the subdiv_normal_accumulation_comp.glsl to use
shader create info.

Pull Request: https://projects.blender.org/blender/blender/pulls/134837
2025-02-21 12:38:57 +01:00
Jeroen Bakker
3969e30c6f SubDiv: Add base for polygon offset
Subdiv shader library contains an optional part that shaders can include.
As we are migrating each shader at a time there are now multiple PRs doing
the same thing. Best to add the changes to main already so it doesn't add
confusion during review.

Pull Request: https://projects.blender.org/blender/blender/pulls/134906
2025-02-21 10:21:44 +01:00
Jeroen Bakker
e39669e3c3 SubDiv: Use shader create info for SubdivNormalsFinalize shaders.
This change migrates the first 2 subdiv shaders  to use the ShaderCreateInfo.
Other shaders will follow in separate PRs.

- Should compile when using `WITH_GPU_SHADER_CPP_COMPILATION`
- A `subdiv_` prefix is added only to the functions related to `PosNorLoop`.
    But eventually the prefix should also be added to other lib functions.
- Due to Metal restrictions `subdiv_set_vertex_*` is implemented using a
    functional paradigma. Our Metal backend only supports `inout` qualifier
    on thead local data structures.

Pull Request: https://projects.blender.org/blender/blender/pulls/134218
2025-02-20 12:30:51 +01:00
Clément Foucault
f8195e0bb4 Fix: Overlay: Broken shader compilation
Caused by the changes in UBO members.
This removes the duplicated lib used by overlay
and reuse the same side clip plane UBO mechanism
as workbench.
2025-02-19 17:46:47 +01:00
Clément Foucault
a961c9050d Cleanup: GPU: Remove dependency on legacy common_math_lib.glsl
Replace usage of `common_math_lib.glsl` (deprecated) with gpu shader libs.

Pull Request: https://projects.blender.org/blender/blender/pulls/131579
2025-02-10 18:14:50 +01:00
Campbell Barton
e659e87a67 Cleanup: cmake formatting, sort file lists 2025-02-10 19:40:06 +11:00
Jeroen Bakker
d496e69eca Cleanup: Subdiv: Remove common_ prefix
The `common_` prefix can be confusing as there are other common_ files as well.

Pull Request: https://projects.blender.org/blender/blender/pulls/134184
2025-02-07 07:48:49 +01:00
Clément Foucault
1ac4651778 Cleanup: DRW: Remove legacy common_view_lib.glsl
No functional changes. Only moving and renaming stuff.

Pull Request: https://projects.blender.org/blender/blender/pulls/131558
2025-01-23 18:06:22 +01:00
Campbell Barton
a3213dc82a Cleanup: trailing space 2024-12-09 09:23:23 +11:00
Miguel Pozo
e3c6c2c6fc Cleanup: CMake: De-duplicate with_shader_cpp_compilation code
Move the common setup and function to `macros.cmake`.

Pull Request: https://projects.blender.org/blender/blender/pulls/131391
2024-12-06 21:03:11 +01:00
Miguel Pozo
72aaaa0c24 Fix: GPU: Errors and warnings for CPP shaders in MSVC
Pull Request: https://projects.blender.org/blender/blender/pulls/131332
2024-12-04 17:33:12 +01:00
Clément Foucault
01f1e9a2c4 GPU: Silence most GLSL C++ compilation warnings 2024-12-02 23:01:12 +01:00
Clément Foucault
2c3ccdf77a GPU: GLSL compilation as C++ for eevee static shaders
Rel #127983

Pull Request: https://projects.blender.org/blender/blender/pulls/130298
2024-12-02 21:26:15 +01:00
Clément Foucault
a15a4c9c9a GPU: GLSL compilation as C++ for grease pencil shaders
Rel #127983
2024-12-02 13:21:12 +01:00
Falk David
ed1c262bb3 Cleanup: Remove unused Grease Pencil shader file
This file was completely unused and caused confusion.

Pull Request: https://projects.blender.org/blender/blender/pulls/130982
2024-11-26 17:09:42 +01:00
Clément Foucault
23ac825a15 Cleanup: Overlay-Next: Deduplicate global UBO binding
No functional changes.
2024-11-24 01:23:10 +01:00
Clément Foucault
92aa3fe46b Cleanup: Workbench: Address shader warnings 2024-11-14 23:39:01 +01:00
Clément Foucault
c0c816f846 GPU: GLSL compilation as C++ for workbench static shaders 2024-11-14 23:15:06 +01:00
Clément Foucault
b76cc897b6 Cleanu: GPU: Address GLSL warnings 2024-11-13 12:38:00 +01:00
Clément Foucault
1aea4fb5c7 GPU: GLSL C++ shaders: Silence unuseful warnings 2024-11-13 12:37:00 +01:00
Clément Foucault
29b3df7504 GPU: GLSL compilation as C++ for draw intern shaders
Allow compilation of shaders using C++ for linting and
IDE support.

Related #127983

Pull Request: https://projects.blender.org/blender/blender/pulls/130193
2024-11-13 12:32:39 +01:00
Clément Foucault
62a5671587 Cleanup: DRW: Remove unused shader functions 2024-11-08 00:27:42 +01:00
Clément Foucault
d2c378984d Cleanup: GPU: Avoid glsl functions with only one void argument 2024-11-01 18:57:22 +01:00
Clément Foucault
d712be0662 GPU: Change global scope variable to defines to avoid overhead on Metal 2024-10-15 20:06:46 +02:00
Clément Foucault
62826931b0 GPU: Move more linting and processing of GLSL to compile time
The goal is to reduce the startup time cost of
all of these parsing and string replacement.

All comments are now stripped at compile time.
This comment check added noticeable slowdown at
startup in debug builds and during preprocessing.

Put all metadatas between start and end token.
Use very simple parsing using `StringRef` and
hash all identifiers.

Move all the complexity to the preprocessor that
massagess the metadata into a well expected input
to the runtime parser.

All identifiers are compile time hashed so that no string
comparison is made at runtime.

Speed up the source loading:
- from 10ms to 1.6ms (6.25x speedup) in release
- from 194ms to 6ms (32.3x speedup) in debug

Follow up #129009

Pull Request: https://projects.blender.org/blender/blender/pulls/128927
2024-10-15 19:47:30 +02:00
Clément Foucault
2514e119cb Merge branch 'blender-v4.3-release'
# Conflicts:
#	source/blender/draw/intern/shaders/draw_view_info.hh
2024-10-11 18:30:11 +02:00
Clément Foucault
ac1069805c Fix: DRW: Broken multiview support with inverted scale object instances
If a `DrawGroup` contained both inverted and non-inverted scale
the command generate shader would output the `resource_id`
content at conflicting indices. This is because the number of
instances stored inside the `DrawGroup` are the original
count before multiview. Actually, only `start` was taking the
multi-view count into account.

We cannot modify the value on CPU otherwise it would increase
the instance count for each submission. So the fix is to
pass the view count to the command generate shader and
multiply the instance count where needed.

Fix #128085

Pull Request: https://projects.blender.org/blender/blender/pulls/128854
2024-10-11 18:09:57 +02:00