Commit Graph

2519 Commits

Author SHA1 Message Date
Jeroen Bakker
e93bf13626 Windows: Update Min OpenGL Version
https://archive.blender.org/developer/D13885 has added several
messages that mentioned OpenGL 3.3 as minimum requirement.
Blender 4.0 requires OpenGL 4.3 and this PR updates these messages.

Pull Request: https://projects.blender.org/blender/blender/pulls/112575
2023-09-20 09:20:56 +02:00
Campbell Barton
085b094f18 Cleanup: use const arguments & variables 2023-09-19 11:09:20 +10:00
Jeroen Bakker
915256eb0a Vulkan: Enable Device Features for EEVEE-Next
This PR enabled device features that are required for EEVEE-Next.
Enabling these features would allow an initial screen drawn by
EEVEE-Next.

Note:
* Changes to EEVEE-Next after this commit, might require other changes
* Not all features are working, but a basic diffuse cube without shadows
  is.
* Vulkan views are not correct and leads to incorrect lighting.

Pull Request: https://projects.blender.org/blender/blender/pulls/112519
2023-09-18 13:54:02 +02:00
Campbell Barton
75afef1372 Cleanup: use braces for GHOST Cocoa *.mm sources 2023-09-17 09:16:09 +10:00
Campbell Barton
635a4eac05 Fix delete key setting a control character in wmEvent::utf8_buf
The check for control characters didn't account for delete (127).
This wasn't noticeable in most cases as delete is mapped to delete text.
Pressing Shift-Delete would enter 127 control character in the
text-editor, 3D text & Python console. This happened X11 & Wayland,
I didn't check other platforms.
2023-09-15 16:01:00 +10:00
Campbell Barton
b7f3e0d84e Cleanup: spelling & punctuation in comments
Also remove some unhelpful/redundant comments.
2023-09-14 13:25:24 +10:00
Ray Molenkamp
5f8dfa231d CMake: Fix building with WITH_VULKAN_BACKEND
Ghost uses vulkan in its public headers but none of the projects that
depend on ghost had the vulkan headers in its includes nor did
bf_intern_ghost expose this vulkan dependency itself publicly yet.

bf_windowmanager also did not express its dependency on
bf_intern_ghost yet used its headers.

this change fixes both issues.

Pull Request: https://projects.blender.org/blender/blender/pulls/112259
2023-09-12 15:07:41 +02:00
Campbell Barton
057c9364fc Cleanup: use braces around statements 2023-09-12 14:48:20 +10:00
Jeroen Bakker
81c6eb9c7f Vulkan: Enable Shader Draw Parameters Support
Shader draw parameter support is needed for Workbench-next. (Almost) All
devices that we support also supports shader draw parameters. This PR
doesn't include a workaround for devices that don't have support.

For end-users this PR will allow workbench-next to render the object on
the correct location. Before this patch they were always drawn on the origin.

The catch is that OpenGL uses gl_InstanceID which always starts counting at 0.
Vulkan has gl_InstanceIndex which holds the correct instance number. By
subtracting the gl_InstanceIndex from gl_BaseInstance will get the correct
gl_InstanceID.

This patch also activates some device extensions to perform in shader printf
statements inside a shader. Documentation for this will be added to the dev
docs how to use them.

Pull Request: https://projects.blender.org/blender/blender/pulls/111461
2023-09-11 15:04:54 +02:00
Campbell Barton
4fc5d287ac Cleanup: doxygen parameters, blank comment lines 2023-09-08 16:53:30 +10:00
ChengduLittleA
bf8d3c157a Fix #111820: Missing type casting in XrGraphicsBinding.cc
The line `oxr_binding.egl.getProcAddress = eglGetProcAddress` supposedly
needs a type casting for it to compile successfully under llvm16.

Pull Request: https://projects.blender.org/blender/blender/pulls/111915
2023-09-06 15:26:51 +02:00
Campbell Barton
4dd5385807 GHOST/Wayland: remove exception if wl_keyboard_listener::keymap fails
This would cause Blender to exist, log the message & return instead.
2023-09-06 16:19:33 +10:00
Campbell Barton
d06bd5d1f0 GHOST: remove prefix from exception messages
The back-end name is already included remove duplicate information.
2023-09-06 16:08:06 +10:00
Campbell Barton
51e3cd1603 Fix Wayland error message displaying when running on X11
Problem caused by [0], resolve by only printing error messages
when none of the GHOST back-ends are able to start.

[0]: f58d596c36c81245ed8c5723e5fa8369106a7a80
2023-09-06 15:38:34 +10:00
Campbell Barton
bedfc68e3f Cleanup: use function style integer casts, modernize headers 2023-09-05 11:10:44 +10:00
Campbell Barton
0c26c84704 Cleanup: spelling in comments 2023-09-05 11:04:27 +10:00
Campbell Barton
e8c812a307 Cleanup: spelling in comments, update dictionary 2023-09-03 21:35:07 +10:00
Campbell Barton
e3fd80dd64 Fix building with GHOST/Wayland & Vulkan 2023-09-01 22:04:34 +10:00
Campbell Barton
cc5dd9e3d3 Cleanup: use libdecor_ prefix for libdecor_frame_interface callbacks
These names weren't obviously related to libdecor.
2023-09-01 16:09:16 +10:00
Campbell Barton
e711af8987 GHOST/Wayland: correction to xdg_toplevel_listener::configure use
Zero width/height should be ignored, don't overwrite the window
size set by the client in this case.
2023-09-01 16:09:16 +10:00
Campbell Barton
0026d20c8c Cleanup: quiet compiler warnings, correct doxy section 2023-08-30 10:57:17 +10:00
Jeroen Bakker
bee3f645d8 Vulkan: Rewrite GHOST_ContextVK
This is a rewrite of GHOST_ContextVK to align with Metal backend as described
in #111389 - solution 3 with the adaptation that GHOST is still responsible
for presenting the swap chain image and a post callback is still needed in
case the swapchain is recreated.

This PR also includes some smaller improvements in stability.

Technical documentation: https://developer.blender.org/docs/eevee_and_viewport/gpu/vulkan/swap_chain/

* Renderpasses and framebuffers are not owned anymore by GHOST_ContextVK
* VKFramebuffer doesn't contain a swap chain image.
* Swapchain images can only be used as a blit destination or present source.
  Not as an attachment.
* GHOST_ContextVK::swapBuffers would call a callback with the image the
  GPU module needs to blit the results to.
* Clearing of depth/stencil attachments when no depth write state is set.
* Enable VK_KHR_maintenance4 to relax the stage interface mapping.
* Removes most vulkan validation warnings/errors.
* Detection of frame buffer changes that needs to be applied before
  performing a command requiring render pass (draw/clear attachment)

**Benefits**

* Late retrieval of a swap chain image results in better overall performance as
  Blender doesn't need to wait until the image is presented on the screen.
* Easier API and clearer state (transitions)
* More control over Image layouts and command buffer states. (Better alignment with
  Vulkan API)

Pull Request: https://projects.blender.org/blender/blender/pulls/111473
2023-08-29 15:05:08 +02:00
Hans Goudey
eafe8332c7 Fix: Compile error with Ghost X11 off and Wayland on
‘const’ qualifiers cannot be applied to ‘const std::runtime_error&’
2023-08-28 16:15:21 -04:00
Vitor Boschi
e5a0d11c4e UI: Allow eyedropper outside of Blender (X11)
Implements the GHOST_GetPixelAtCursor for the X11 backend, allowing
the user to sample any color displayed on the screen.

Noted some limitations in the code-comments.

Ref !111493.
2023-08-26 17:20:05 +10:00
Harley Acheson
f69c7afe57 Fix #111295: Add Missing Win32 Platform-Specific Window functions
Add platform-specific (Windows) versions of getOSWindow() and
getWindowUnderCursor().

Pull Request: https://projects.blender.org/blender/blender/pulls/111359
2023-08-25 22:09:54 +02:00
Campbell Barton
0f0a2d9038 Correct error printing NDOF rotation 2023-08-23 15:36:34 +10:00
Campbell Barton
3405e14446 GHOST: handle all event types in GHOST_EventPrinter::processEvent
- Adjust switch statement to warn when members aren't accounted for.
- Print NDOF button/motion data.
2023-08-23 15:31:21 +10:00
Campbell Barton
c52965e9c7 Cleanup: simplify struct declarations 2023-08-23 13:45:19 +10:00
Campbell Barton
f58d596c36 GHOST/Wayland: print the exception message on failure
When GHOST_SystemWayland can't be created, print the run-time error
unless X11 is available as a fallback.
2023-08-22 16:08:55 +10:00
Campbell Barton
4760908b6e Fix potential buffer overflow & un-terminated strings on macOS
- GHOST_SystemPathsCocoa::getUserSpecialDir
  used `strncpy` without ensuring the string was null terminated.
- GHOST_SystemPathsCocoa::getBinaryDir
  used `strcpy` without checking the destination buffer size.
2023-08-21 11:53:22 +10:00
Campbell Barton
0a04a6d1a1 Cleanup: quiet GCC's -Wsuggest-attribute=format warning 2023-08-17 16:52:45 +10:00
Campbell Barton
a7c1a57957 CMake: correct WITH_X11_XF86VMODE include path 2023-08-17 11:53:49 +10:00
Germano Cavalcante
fc39963b31 Cleanup: Deduplicate code
By unifying the return, we don't need to duplicate the `CoTaskMemFree`
call.

Ref 84718feb4b.
2023-08-16 18:29:12 -03:00
Guillermo Venegas
84718feb4b Fix potential leaks using SHGetKnownFolderPath
Documentation for `SHGetKnownFolderPath` remarks that the `PWSTR`
parameter should always be freed with `CoTaskMemFree`  even if it
succeeds or not.

Pull Request: https://projects.blender.org/blender/blender/pulls/111128
2023-08-16 23:10:00 +02:00
Campbell Barton
92c4756d02 Fix replacement of "Blender Foundation" in recent header change
The recent change to header copyrights [0] unintentionally changed
"Blender Foundation" to "Blender Authors" for the WIN32 file path
which blender is installed into.

Revert lines changed that aren't related to copyright text.

[0]: e955c94ed38595cb12fa6cf517b6ba8033017141
2023-08-16 21:21:55 +10:00
Harley Acheson
5741a5d433 UI: Allow Eyedropper Outside of Blender
This adds a new Ghost function, GHOST_GetPixelAtCursor, that allows
picking colors from outside of Blender windows. This only has an
implementation for the Windows platform, but this should allow other
platforms to also do so if possible.

Pull Request: https://projects.blender.org/blender/blender/pulls/105324
2023-08-16 01:14:36 +02:00
Campbell Barton
e955c94ed3 License Headers: Set copyright to "Blender Authors", add AUTHORS
Listing the "Blender Foundation" as copyright holder implied the Blender
Foundation holds copyright to files which may include work from many
developers.

While keeping copyright on headers makes sense for isolated libraries,
Blender's own code may be refactored or moved between files in a way
that makes the per file copyright holders less meaningful.

Copyright references to the "Blender Foundation" have been replaced with
"Blender Authors", with the exception of `./extern/` since these this
contains libraries which are more isolated, any changed to license
headers there can be handled on a case-by-case basis.

Some directories in `./intern/` have also been excluded:

- `./intern/cycles/` it's own `AUTHORS` file is planned.
- `./intern/opensubdiv/`.

An "AUTHORS" file has been added, using the chromium projects authors
file as a template.

Design task: #110784

Ref !110783.
2023-08-16 00:20:26 +10:00
Jeroen Bakker
dd4ab50065 GPU: Add Dummy Backend For Unsupported Platforms
With the introduction of metal and vulkan we use a different
GPU backend selection which broke the dialog box for unsupported
platforms.

Blender asserted and segfaulted before the dialog was being shown
to the user.

This patch solves this by introducing a dummy GPU backend in case no
GPU backend was supported by OpenGL, Metal and Vulkan Backend.

It also adds the showMessageBox to GHOST_SystemCocoa.

Related to #110335

Pull Request: https://projects.blender.org/blender/blender/pulls/110919
2023-08-15 14:15:12 +02:00
Campbell Barton
311fa9768d Cleanup: spelling in comments 2023-08-12 16:29:51 +10:00
Campbell Barton
9810942adf Cleanup: avoid uninitialized members in GHOST classes 2023-08-11 09:34:08 +10:00
Campbell Barton
cc95c02a89 Fix building WITH_OPENGL_BACKEND=OFF 2023-08-10 17:40:24 +10:00
Campbell Barton
ea10e601fd Cleanup: use _get() suffix for GHOST/Wayland methods
Avoid variables shadowing methods for common names such as
scale & outputs.
2023-08-10 17:38:34 +10:00
Campbell Barton
23cd37de25 Cleanup: redundant checks 2023-08-10 17:11:24 +10:00
Jason Fielder
2367ed2ef2 macOS: Enable support for EDR rendering
Add a High Dynamic Range option in the Color Management > Display panel.
This enables display of extended color ranges above 1.0 for the 3D
viewport, image editor and render previews.

This requires a monitor that can display HDR colors, and a view
transform designed for HDR output. The Standard view transform works,
but Filmic does not as it was designed to bring values into the 0..1
range for SDR displays.

This patch is limited to allowing the display to visualize extended
colors, but does not include future looking work to better integrate HDR
into the full workflow.

It is implemented by rendering to high bit-depth texture formats for
the user interface, and uncapping the color range in color management.

Authored by Apple: Michael Parkin-White

Pull Request: https://projects.blender.org/blender/blender/pulls/105662
2023-08-09 14:25:15 +02:00
Campbell Barton
da0fef65c0 Cleanup: remove unsafe string API use
This was only enabled WITH_GHOST_DEBUG, getKeyString now returns
a static string instead of filling in a buffer.
2023-08-09 15:50:32 +10:00
Campbell Barton
bff7962c80 Cleanup: remove redundant struct/void in C++, function style casts 2023-08-09 13:37:37 +10:00
Campbell Barton
5f1b02937a Cleanup: remove 'struct' prefix from GHOST/Wayland types
Move struct members into sub-structs (wl/wp/xdg/xkb) to prevent
naming collisions with the types & struct members.
2023-08-09 12:54:19 +10:00
Clément Foucault
983ff8e616 GPU: Framebuffer: Add multi viewport support
This add the possibility to define different
viewports inside a single framebuffer and
let the vertex shader decide which viewport
to render to.

This only contain the GL and VK implementation.
The Vulkan implementation works but still
has a validation error related to shader features
and extension. The test passes nonetheless.

Pull Request: https://projects.blender.org/blender/blender/pulls/110923
2023-08-08 17:12:49 +02:00
Jeroen Bakker
b1357f6790 Vulkan: Error When Creating Windows Offscreen Context
Thanks to UPBGE developers to point this one out.

Pull Request: https://projects.blender.org/blender/blender/pulls/110892
2023-08-07 14:58:06 +02:00
Campbell Barton
7f34ad736a Cleanup: spelling in comments 2023-08-05 13:54:25 +10:00