When GLSL sources were first included in Blender they were treated as
data (like blend files) and had no license header.
Since then GLSL has been used for more sophisticated features
(EEVEE & real-time compositing)
where it makes sense to include licensing information.
Add SPDX copyright headers to *.glsl files, matching headers used for
C/C++, also include GLSL files in the license checking script.
As leading C-comments are now stripped,
added binary size of comments is no longer a concern.
Ref !111247
No user visible changes expected, the new button state is not used yet.
Setting a new uiBut drawflag shows items in an indeterminate state, not
indicating a specific value or state.
Pull Request: https://projects.blender.org/blender/blender/pulls/108210
Metal shading language follows the C++ 14 standard and in some cases requires a greater level of explicitness than GLSL. There are also some small language differences:
- Explicit type-casts (C++ requirements)
- Explicit constant values (C++ requirements, e.g. floating point values using 0.0 instead of 0).
- Metal/OpenGL compatibility paths
- GLSL Function prototypes
- Explicit accessors for vector types when sampling textures.
Authored by Apple: Michael Parkin-White
Ref T96261
Reviewed By: fclem
Maniphest Tasks: T96261
Differential Revision: https://developer.blender.org/D14378
This is a first part of the Shader Create Info system could be.
A shader create info provides a way to define shader structure, resources
and interfaces. This makes for a quick way to provide backend agnostic
binding informations while also making shader variations easy to declare.
- Clear source input (only one file). Cleans up the GPU api since we can create a
shader from one descriptor
- Resources and interfaces are generated by the backend (much simpler than parsing).
- Bindings are explicit from position in the array.
- GPUShaderInterface becomes a trivial translation of enums and string copy.
- No external dependency to third party lib.
- Cleaner code, less fragmentation of resources in several libs.
- Easy to modify / extend at runtime.
- no parser involve, very easy to code.
- Does not hold any data, can be static and kept on disc.
- Could hold precompiled bytecode for static shaders.
This also includes a new global dependency system.
GLSL shaders can include other sources by using #pragma BLENDER_REQUIRE(...).
This patch already migrated several builtin shaders. Other shaders should be migrated
one at a time, and could be done inside master.
There is a new compile directive `WITH_GPU_SHADER_BUILDER` this is an optional
directive for linting shaders to increase turn around time.
What is remaining:
- pyGPU API {T94975}
- Migration of other shaders. This could be a community effort.
Reviewed By: jbakker
Maniphest Tasks: T94975
Differential Revision: https://developer.blender.org/D13360
The SB back-end optimizer for the mesa R600g driver corrupts the vertex
shader for widget drawing. This will not be fixed upstream because SB is
getting replaced as part of the new NIR path. This was thought to be an
issue with instancing and an attempted fix was submitted in D8374, but
it did not fix the issue.
This patch reimplements the array look-up part of the code using switch
case as a workaround and removes the old workaround implemented as part
of D8374.
Reviewed By: Clement Foucault
Differential Revision: https://developer.blender.org/D10967
This was due to a bad driver which was not respecting this bit of the
specification:
`If the current primitive does not originate from an instanced draw command, the value of gl_InstanceID is zero.`
This means all the antiailasing is done inside the fragment shader.
We use a Signed Distance Field to draw the 2D rounded boxes. This ensure
the best quality for AA.
This reduce the averge Batch for widget to 16 verts instead of ~600 and
reduce overshading a lot.
Theme Emboss alpha and tria alpha needs to be changed after this refactor.
The shadow drawing is left unchanged and still use geometry.
Reviewed By: Severin
Differential Revision: https://developer.blender.org/D7833
Almost every pulldown menu and popover has a little dropdown arrow shape.
Unfortunately it is a bit wonky. The top of the right side of it is wider than the top of the left side. And both sides are narrower at the bottom than the top. It might be hard to see, but this image should help:
{F6728281}
The patch fixes the symmetry of the shape while keeping the weight as similar as possible. In the following image you can see the outline of the current version in red and this new version in green.
{F6728298}
With patch applied the arrow looks perfect:
{F6728302}
Reviewers: brecht, billreynish
Reviewed By: billreynish
Subscribers: pablovazquez
Tags: #bf_blender, #bf_blender_2.8, #user_interface
Differential Revision: https://developer.blender.org/D4424
Now we always fill the slider with a vertical boundary. A bit hard to explain,
but very easy to see the difference.
I split the widget in three parts and used fragment shader discard to remove the
undesired bits. That means all the widget program is doing a bit extra
calculation.
Reviewers: fclem
Subscribers: billreynish
Differential Revision: https://developer.blender.org/D3186
E.g. the vertices created for each of the defines would require a
certain offset. If you don't know what to look for, finding out about
this is pretty difficult. Make them easily searchable instead.
There is quite some mess going on in that most of the old triangle
drawing code is still there, but does almost nothing effectively.
Instead values are hardcoded in the shader, however it doesn't support
the drawing options the triangle functions expose.
E.g. the 'where' variable to set triangle direction doesn't work.