Commit Graph

40 Commits

Author SHA1 Message Date
Habib Gahbiche f54ed1c639 Cleanup: Metal: Silence sometimes-uninitialized warning
Warning message:
`warning: variable 'pos' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]`

Pull Request: https://projects.blender.org/blender/blender/pulls/114360
2023-11-01 16:12:30 +01:00
Campbell Barton eec449ffe8 Cleanup: correct spelling, comments
Hyphenate words in GLSL code-comments.
2023-08-29 15:55:09 +10:00
Campbell Barton 3de8900ed6 Cleanup: spelling in comments 2023-08-25 09:40:42 +10:00
Campbell Barton 0148293520 License headers: add SPDX licenses for '*.glsl' files
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
2023-08-24 10:57:03 +10:00
Harley Acheson 69cc84fa6c Cleanup: Make format
Removing unnecessary whitespace added with 1b1349cee4
2023-07-17 10:56:03 -07:00
Harley Acheson 1b1349cee4 UI: Indeterminate Button State
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
2023-07-17 19:37:15 +02:00
Campbell Barton 87d737cd79 Cleanup: spelling in code comments 2022-10-06 12:13:00 +11:00
Clément Foucault fc872d738e GPUShader: Port 2D widget shaders to use shaderCreateInfo
This should have no functional changes.
2022-05-01 21:12:59 +02:00
Jason Fielder 19c793af35 Metal: Make GLSL shader source MSL compliant also
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
2022-03-22 12:54:44 +01:00
Jeroen Bakker 9d3f35a0bf Revert "Revert "GPUShaderCreateInfo for interface abstraction""
This reverts commit edee5a947b.

Fixes compilation error (Missing file BLI_float2.hh)
2022-01-17 14:46:32 +01:00
Jeroen Bakker edee5a947b Revert "GPUShaderCreateInfo for interface abstraction"
This reverts commit 8fb2ff458b.
Missing some files.
2022-01-17 14:34:28 +01:00
Jeroen Bakker 8fb2ff458b GPUShaderCreateInfo for interface abstraction
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
2022-01-17 14:32:28 +01:00
Omar Emara d63b72e9f9 Fix T78803: Bad widget drawing with the R600g driver
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
2021-04-13 22:36:24 +02:00
luzpaz a4a9d14ba7 UI: Fix Typos in Comments and Docs
Approximately 91 spelling corrections, almost all in comments.

Differential Revision: https://developer.blender.org/D10288

Reviewed by Harley Acheson
2021-02-05 19:08:14 -08:00
Clément Foucault 998b680e5b UI: Widget: Add conservative raster to avoid cut widget borders
This avoids incorrect AA when the widget is not perfectly alligned with the
pixel grid.
2020-09-01 16:08:50 +02:00
Clément Foucault 630c6226e2 Fix T78307 UI: Drawing artifacts in the Blender UI on macOS
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.`
2020-07-07 16:26:01 +02:00
Clément Foucault b0da78084b UI: Attempt to fix OSX widget shader issue
Some OSX GL driver implementation needs a dummy vbo read. This fixed issues
with the Hair shaders in the past.

Related to T78307
2020-07-04 01:27:59 +02:00
Clément Foucault 46815753cf Fix T78237 UI: NLA colors black and broken
This was caused by missing GL blend. This patch also fix the broken
strip appearance under timeline zoom.
2020-06-26 01:27:36 +02:00
Clément Foucault 15dda0115c UI: Widget: Replace geometry by fragment shader drawing
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
2020-06-22 19:57:53 +02:00
Clément Foucault dcf67fdf7f UI: Widget: Make emboss offset dependent of line width 2020-05-18 15:27:30 +02:00
Clément Foucault 27b23148fa UI: Widgets: Reduce constants count in shader 2020-05-18 15:27:29 +02:00
Campbell Barton 0efe89bdd8 Cleanup: style, use braces in GPU 2019-06-04 00:42:22 +10:00
Campbell Barton e12c08e8d1 ClangFormat: apply to source, most of intern
Apply clang format as proposed in T53211.

For details on usage and instructions for migrating branches
without conflicts, see:

https://wiki.blender.org/wiki/Tools/ClangFormat
2019-04-17 06:21:24 +02:00
Pablo Vazquez 8ca45e929a Wonky Menu Down Arrow
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
2019-02-28 17:05:13 +01:00
mano-wii 9d81e937d2 Optimizadion: Fix performanse issue of UI on some old GPUs.
Apparently the registry is not large enough and the compiler does something bad in indexing the array.
2018-10-22 12:59:09 -03:00
Campbell Barton ee6b95f7e0 UI: move toolbar arrow closer to button edge
Could overlap icons.
2018-09-07 12:21:24 +10:00
Campbell Barton 4cfc54a5cb UI: adjust menu triangle
Was not centered for single icon buttons.
2018-06-20 21:34:27 +02:00
Campbell Barton 54a0247f59 Cleanup: whitespace 2018-06-20 16:42:19 +02:00
Pablo Vazquez 84c2ef0eaf UI: Use chevrons for number sliders, pulldowns and popovers
In the future popovers/pulldowns should have different indicators

Patch by William Reynish and Clement Foucault
2018-06-20 12:24:24 +02:00
Dalai Felinto 9b0ea92be7 UI: Number slider uniform filling
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
2018-04-28 16:54:57 +02:00
Dalai Felinto c06bfe9d09 UI: Remove hardcoded 11 uniform parameters
Using a define makes it easy to increase this later.
2018-04-28 16:33:15 +02:00
Campbell Barton 8430249791 UI: shrink operator menu hold triangle a little 2018-04-25 21:24:55 +02:00
Julian Eisel 4b080ff18f Cleanup: Make access to widget triangle defines explicit
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.
2018-04-15 21:36:21 +02:00
Julian Eisel 7c02008e74 Fix button triangle for "hold action" not working
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.
2018-04-15 21:24:24 +02:00
Germano 2a0dca4252 UI: Fix widget shader on certain compiler.
There was a crash with `Intel(R) HD Graphics 4000`.
Thanks to @fclem for the help and review.
2018-04-09 13:45:17 -03:00
Clément Foucault 2d618974d1 UI: Perf: Port color widgets to batch.
This is more for completeness than perf.

Shader is tiny bit more complex but we get less overdraw and drawcalls.
2018-04-06 23:54:39 +02:00
Clément Foucault fcb4aaf7a9 GPUShader: Add GPU_SHADER_2D_WIDGET_BASE_INST shader.
This will let us draw multiple widget base at once.
2018-04-06 14:22:20 +02:00
Clément Foucault e1d6e524b3 UI: Perf: Batch Trias with widgets.
This remove another portion of imm calls and reduce overall drawcall count.
2018-04-02 18:47:56 +02:00
Clément Foucault d93e7e6430 UI: Perf: Group fill/border/emboss batches together.
This roughly halves the number of drawcalls from widgetbase_draw.
2018-03-29 16:36:01 +02:00
Clément Foucault ba9c2746b6 GPUShader: Add specialized widget base shader.
This vertex shader let us draw widgets with batches instead of imm calls.
2018-03-29 14:22:50 +02:00