Commit Graph

66 Commits

Author SHA1 Message Date
Hans Goudey 8b514bccd1 Cleanup: Move remaining GPU headers to C++
Pull Request: https://projects.blender.org/blender/blender/pulls/119807
2024-03-23 01:24:18 +01:00
Hans Goudey 7fa5fc02b7 Cleanup: Move BLF headers to C++ 2024-01-31 14:04:56 -05:00
Aras Pranckevicius a705259b4b Cleanup: move imbuf .h files to .hh 2024-01-19 20:29:38 +01:00
Campbell Barton 41d62f36d5 Fix uninitialized variable use accessing the screen size under Wayland
It's possible for there to be no outputs under Wayland
(when unplugging monitors for e.g.) so this must be accounted for.

Also avoid calculating the window position when the GHOST backend
doesn't support window positions (which is the case for Wayland).

Add checks for the SDL backend too, where accessing the
screen & desktop size may fail.
2023-10-03 15:40:58 +11:00
Campbell Barton 057c9364fc Cleanup: use braces around statements 2023-09-12 14:48:20 +10: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
Campbell Barton 7cc3ef3260 Cleanup: use C++ includes, various non-functional changes for C++ 2023-08-02 20:30:02 +10:00
Campbell Barton a2c6371e3e License headers: use SPDX-FileCopyrightText in intern/ghost 2023-06-14 17:42:15 +10:00
Brecht Van Lommel a2bd080cf3 Cleanup: renaming of GPU contexts for clarity
* opengl_context -> system_gpu_context. This is the operating system OpenGL,
  Metal or Vulkan context provided by GHOST.
* gpu_context -> blender_gpu_context. This is the GPUContext provided by
  the Blender GPU module, which wraps the GHOST context and adds some state.
* Various functions create/destroy/enable/disable both contexts, these have
  just gpu_context in the name now.

Pull Request: https://projects.blender.org/blender/blender/pulls/108723
2023-06-08 15:46:53 +02:00
Sergey Sharybin a12a8a71bb Remove "All Rights Reserved" from Blender Foundation copyright code
The goal is to solve confusion of the "All rights reserved" for licensing
code under an open-source license.

The phrase "All rights reserved" comes from a historical convention that
required this phrase for the copyright protection to apply. This convention
is no longer relevant.

However, even though the phrase has no meaning in establishing the copyright
it has not lost meaning in terms of licensing.

This change makes it so code under the Blender Foundation copyright does
not use "all rights reserved". This is also how the GPL license itself
states how to apply it to the source code:

    <one line to give the program's name and a brief idea of what it does.>
    Copyright (C) <year>  <name of author>

    This program is free software ...

This change does not change copyright notice in cases when the copyright
is dual (BF and an author), or just an author of the code. It also does
mot change copyright which is inherited from NaN Holding BV as it needs
some further investigation about what is the proper way to handle it.
2023-03-30 10:51:59 +02:00
Sergey Sharybin d32d787f5f Clang-Format: Allow empty functions to be single-line
For example

```
OIIOOutputDriver::~OIIOOutputDriver()
{
}
```

becomes

```
OIIOOutputDriver::~OIIOOutputDriver() {}
```

Saves quite some vertical space, which is especially handy for
constructors.

Pull Request: https://projects.blender.org/blender/blender/pulls/105594
2023-03-29 16:50:54 +02:00
Thomas Dinges 697b447c20 Metal: MTLContext implementation and immediate mode rendering support.
MTLContext provides functionality for command encoding, binding management and graphics device management. MTLImmediate provides simple draw enablement with dynamically encoded data. These draws utilise temporary scratch buffer memory to provide minimal bandwidth overhead during workload submission.

This patch also contains empty placeholders for MTLBatch and MTLDrawList to enable testing of first pixels on-screen without failure.

The Metal API also requires access to the GHOST_Context to ensure the same pre-initialized Metal GPU device is used by the viewport. Given the explicit nature of Metal, explicit control is also needed over presentation, to ensure correct work scheduling and rendering pipeline state.

Authored by Apple: Michael Parkin-White

Ref T96261

(The diff is based on 043f59cb3b)

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D15953
2022-09-22 17:32:43 +02:00
Campbell Barton fe63124c3e Cleanup: add missing braces in GHOST 2022-08-12 11:13:07 +10:00
Campbell Barton d6fef73ef1 WM: Remove ASCII members from wmEvent & GHOST_TEventKeyData
The `ascii` member was only kept for historic reason as some platforms
didn't support utf8 when it was first introduced.

Remove the `ascii` struct members since many checks used this as a
fall-back for utf8_buf not being set which isn't needed.
There are a few cases where it's convenient to access the ASCII value
of an event (or nil) so a function has been added to do that.

*Details*

- WM_event_utf8_to_ascii() has been added for the few cases an events
  ASCII value needs to be accessed, this just avoids having to do
  multi-byte character checks in-line.

- RNA Event.ascii remains, using utf8_buf[0] for single byte characters.

- GHOST_TEventKeyData.ascii has been removed.

- To avoid regressions non-ASCII Latin1 characters from GHOST are
  converted into multi-byte UTF8, when building X11 without
  XInput & X_HAVE_UTF8_STRING it seems like could still occur.
2022-07-14 15:59:19 +10:00
Campbell Barton f59418fd92 Cleanup: use booleans for GHOST C-API
Also use GHOST_ prefix for public functions.
2022-06-17 17:18:06 +10:00
Campbell Barton c434782e3a File headers: SPDX License migration
Use a shorter/simpler license convention, stops the header taking so
much space.

Follow the SPDX license specification: https://spdx.org/licenses

- C/C++/objc/objc++
- Python
- Shell Scripts
- CMake, GNUmakefile

While most of the source tree has been included

- `./extern/` was left out.
- `./intern/cycles` & `./intern/atomic` are also excluded because they
  use different header conventions.

doc/license/SPDX-license-identifiers.txt has been added to list SPDX all
used identifiers.

See P2788 for the script that automated these edits.

Reviewed By: brecht, mont29, sergey

Ref D14069
2022-02-11 09:14:36 +11:00
Nicholas Rishel f3ec0d8e58 Replace Ghost integrals with stdint fixed width integers.
Also replace integer with bool in Ghost API when only used as boolean,
and uint8* with char* in Ghost API when variable is a string.

Reviewed By: brecht

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

Signed-off-by: Nicholas Rishel <rishel.nick@gmail.com>
2021-07-05 11:00:45 -07:00
Campbell Barton df9597cfba Cleanup: use const for datatoc declarations 2021-06-30 16:42:19 +10:00
Campbell Barton 3e4863376e Cleanup: use boolean for has_event variable & return value 2021-05-04 00:17:45 +10:00
Harley Acheson 1c4ae8a11c UI: Removal of GHOST_CreateDialogWindow
Simplification of window creation code to allow greater flexibility.

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

Reviewed by Brecht Van Lommel
2021-02-09 16:14:31 -08:00
Clément Foucault ccc512cc61 GPUImmediate: Make activation / deactivation implicit
This avoids unecessary complexity.

Also makes the GPUImmediate threadsafe by using a threadlocal imm variable.
2020-09-08 04:15:50 +02:00
Clément Foucault 0ccf3f89d2 GPU: Move ghost default framebuffer getter to context creation 2020-08-08 01:15:28 +02:00
Brecht Van Lommel 68e341e9d5 UI: remove non-unicode font and simplify default font loading code
There is no need to have another font embedded in the Blender executable, we
can assume the bundled font exists. In the future we may provide a fallback
if the font specified by the user in the preferences is missing a character,
but that can use our bundled international font.

Differential Revision: https://developer.blender.org/D6854
2020-03-25 16:39:58 +01:00
Dalai Felinto 2d1cce8331 Cleanup: `make format` after SortedIncludes change 2020-03-19 09:33:58 +01:00
Campbell Barton 60e3f690cb Cleanup: sort file lists & struct declatations 2020-03-14 15:39:59 +11:00
Campbell Barton 1c9829f351 GHOST: tests now build again
GLX gears work as expected, multitest_c only creates windows
but misses font drawing still.
2020-03-11 15:17:27 +11:00
Campbell Barton 15983243a4 Cleanup: remove bitmap font drawing ifdef from MultiTest.c 2020-03-11 15:01:14 +11:00
Campbell Barton 7d90ff08f3 Fix incorrect enum in GHOST test 2020-02-15 10:40:42 +11:00
Brecht Van Lommel 087a489867 Cleanup: simplify GHOST cursor API, no functional changes 2019-06-16 19:58:26 +02:00
Campbell Barton 0b36780fb4 Revert "Cleanup: Cleanup: style, use braces for GHOST (X11/SDL)"
This reverts commit 935c9ab0de.

Clang-tidy was making unrelated *fixes*.
2019-06-04 11:36:54 +10:00
Campbell Barton 935c9ab0de Cleanup: Cleanup: style, use braces for GHOST (X11/SDL) 2019-06-04 11:30:31 +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
Campbell Barton 3316853323 Cleanup: conform headers to have license first
Also remove doxy comments for licenses and add missing GPL header.
2019-02-18 08:22:11 +11:00
Campbell Barton 65ec7ec524 Cleanup: remove redundant, invalid info from headers
BF-admins agree to remove header information that isn't useful,
to reduce noise.

- BEGIN/END license blocks

  Developers should add non license comments as separate comment blocks.
  No need for separator text.

- Contributors

  This is often invalid, outdated or misleading
  especially when splitting files.

  It's more useful to git-blame to find out who has developed the code.

See P901 for script to perform these edits.
2019-02-02 01:36:28 +11:00
Campbell Barton c0f88ed8a8 Cleanup: sort forward declarations of enum & struct
Done using:
  source/tools/utils_maintenance/c_sort_blocks.py
2019-01-28 21:17:58 +11:00
Campbell Barton af36dd4664 Cleanup: trailing newlines 2018-06-29 08:02:49 +02:00
Campbell Barton 58e8c71cbd Cleanup: strip ghost trailing space 2018-06-04 18:47:57 +02:00
Sergey Sharybin 3c45fdd171 GHOST: Solve compilation error of test programs 2018-03-26 14:51:56 +02:00
Campbell Barton e84b0e4c35 Ghost: update tests for recent changes 2015-04-04 17:21:18 +11:00
Campbell Barton 1f58bfb8be Code cleanup: de-duplicate cotangent weight function & add arg sizes 2014-03-30 11:08:33 +11:00
Campbell Barton 1bfa64895e Ghost: update multitest for changes in BLF 2014-01-11 23:53:23 +11:00
Campbell Barton 43c83e2458 fix double free in ghost c++ gears test program. 2013-09-11 01:15:13 +00:00
Sergey Sharybin be42cd54df Ghost test application could be compiled again
Was an IRC request to have Ghost application up
and running for investigation purposes.
2013-09-05 16:22:07 +00:00
Campbell Barton e903701450 style cleanup 2012-10-27 01:46:47 +00:00
Campbell Barton 4d4664d98f code cleanup: check for msvc directly when using warning pragma's. 2012-10-15 02:15:07 +00:00
Campbell Barton f6251a1f32 code cleanup: warning and style 2012-09-17 22:34:42 +00:00
Campbell Barton 1a7eb3454e style cleanup 2012-09-08 08:59:47 +00:00
Campbell Barton 5189356d58 style cleanup 2012-06-04 20:11:09 +00:00
Campbell Barton b33f0ef0e3 style cleanup 2012-05-27 19:40:36 +00:00
Campbell Barton 857dedbc58 style cleanup 2012-05-27 00:36:50 +00:00