Compare commits

..

38 Commits

Author SHA1 Message Date
5be8cc6556 FIx: Change to instance domain 2021-11-24 01:29:45 +01:00
c853826ed1 Merge branch 'master' into temp-geometry-nodes-text 2021-11-23 17:59:13 +01:00
e4986f92f3 Geometry Nodes: Node execution time overlay
Adds a new overlay called "Timings" to the Geometry Node editor.
This shows the node execution time in milliseconds above the node.
For group nodes and frames, the total time for all nodes inside
(recursively) is shown. Group output node shows the node tree total.
The code is prepared for easily adding new rows of information
to the box above the node in the future.

Differential Revision: https://developer.blender.org/D13256
2021-11-23 17:37:31 +01:00
fab39440e9 Cleanup: Simplify geometry node function names
With this commit, we no longer use the prefixes for every node type
function like `geo_node_translate_instances_`. They just added more
places to change when adding a new node, for no real benefit.

Differential Revision: https://developer.blender.org/D13337
2021-11-23 10:55:51 -05:00
a9eb4e6f59 Merge branch 'blender-v3.0-release' 2021-11-23 16:41:53 +01:00
a6b7f32112 Fix T93297: incorrect eevee motion blur with geometry instances
This disables motion blur for geometry instances in eevee, which did
not work correctly anyway. See code comment for more details.

Differential Revision: https://developer.blender.org/D13334
2021-11-23 16:40:21 +01:00
db450c9320 Merge branch 'blender-v3.0-release' 2021-11-23 16:38:30 +01:00
70424195a8 Cycles: Fix possible access to non-initialized light sample in volume
Happened in barbershop file where number of bounces to the light was
reached.

Differential Revision: https://developer.blender.org/D13336
2021-11-23 16:38:15 +01:00
71c80bd939 Merge branch 'blender-v3.0-release' 2021-11-23 16:32:13 +01:00
2cbb9d7a76 Fix T93322: Freestyle Sinus Displacement Division by Zero Crash
This happens if the Wavelength is set to 0.0f.

Not sure if we really need a do_version patch for old files, as an
alternative we could also force a slight offset in the
SinusDisplacementShader. This patch does not do either, just force a
positive range from now on.

Maniphest Tasks: T93322

Differential Revision: https://developer.blender.org/D13329
2021-11-23 16:29:37 +01:00
b716a771b4 Merge branch 'blender-v3.0-release' 2021-11-23 15:46:28 +01:00
Sayak Biswas
3bb8d173e7 Fix T93109: Cycles HIP missing check for correct driver version
21.Q4 is required, older version should not show devices in the preferences.
This adds a check for the file version of amdhip64.dll file during hipew
initialization.

Differential Revision: https://developer.blender.org/D13324
2021-11-23 15:45:37 +01:00
fca8eb0185 Cleanup: Suppress clang-tidy warning. 2021-11-23 15:41:28 +01:00
2c2b79191f Merge branch 'blender-v3.0-release' 2021-11-23 15:41:09 +01:00
1a7c32a0ab Fix T93320: Freestyle LineStyleModifier blend 'Minimum' error
This was just a typo in {rBb408d8af31c9}
Must be 'MINIMUM' (instead of 'MININUM').

Maniphest Tasks: T93320

Differential Revision: https://developer.blender.org/D13328
2021-11-23 15:38:52 +01:00
4b13dcaf02 Merge branch 'blender-v3.0-release' 2021-11-23 15:35:09 +01:00
ceb25cbeba Fix compilation warnings when building without OpenImageDenoiser
Reported by Sybren, thanks!
2021-11-23 15:34:54 +01:00
8897e0aa8f Fix add-on Preferences using the .blend file icon, not the Blender logo
Intention of the icon is to mark add-ons that are official/bundled.
Doesn't make much sense to use the .blend file icon for that. It's
arguable if the Blender logo should be used for this, but the file icon
is definitely the wrong choice.
2021-11-23 15:30:28 +01:00
5efddc4347 Fix add-on Preferences using the .blend file icon, not the Blender logo
Intention of the icon is to mark add-ons that are official/bundled.
Doesn't make much sense to use the .blend file icon for that. It's
arguable if the Blender logo should be used for this, but the file icon
is definitely the wrong choice.
2021-11-23 15:30:05 +01:00
1df8abff25 Geometry Nodes: add namespace for every file
This puts all static functions in geometry node files into a new
namespace. This allows using unity build which can improve
compile times significantly (P2578).

* The name space name is derived from the file name. That makes
  it possible to write some tooling that checks the names later on.
  The file name extension (`cc`) is added to the namespace name as
  well. This also possibly simplifies tooling but also makes it more
  obvious that this namespace is specific to a file.
* In the register function of every node, I added a namespace alias
  `namespace file_ns = blender::nodes::node_geo_*_cc;`. This avoids
  some duplication of the file name and may also simplify tooling,
  because this line is easy to detect. The name `file_ns` stands for "file
  namespace" and also indicates that this namespace corresponds to
  the current file. In the beginning I used `node_ns` but `file_ns` is more
  generic which may make it more suitable when we want to use unity
  builds outside of the nodes modules in the future.
* Some node files contain code that is actually shared between
  different nodes. For now I left that code in the `blender::nodes`
  namespace and moved it to the top of the file (couldn't move it to
  the bottom in all cases, so I just moved it to the top everywhere).
  As a separate cleanup step, this shared code should actually be
  moved to a separate file.

Differential Revision: https://developer.blender.org/D13330
2021-11-23 14:56:01 +01:00
47276b8470 Geometry Nodes: reduce overhead when processing single values
Currently the geometry nodes evaluator always stores a field for every
type that supports it, even if it is just a single value. This results in a lot
of overhead when there are many sockets that just contain a single
value, which is often the case.

This introduces a new `ValueOrField<T>` type that is used by the geometry
nodes evaluator. Now a field will only be created when it is actually
necessary. See D13307 for more details. In extrem cases this can speed
up the evaluation 2-3x (those cases are probably never hit in practice
though, but it's good to get rid of unnecessary overhead nevertheless).

Differential Revision: https://developer.blender.org/D13307
2021-11-23 14:49:26 +01:00
0bedd5d14f Merge branch 'blender-v3.0-release' 2021-11-23 14:39:55 +01:00
436ce22194 Fix T93296: raycast node uses wrong domain for face corner attributes
This changes what domain is used by the raycast mode. This should fix the
behavior for face corner attributes (but may make it a bit slower for other
attributes). I think for 3.0 this is an acceptable trade off. For 3.1 we can do
what the comment suggests already.

Differential Revision: https://developer.blender.org/D13333
2021-11-23 14:38:02 +01:00
dab04bc053 Fix T93231: crash when overwriting vertex group with other domain
The problem was that we forgot to actually remove the vertex group when
it should be deleted. We only removed all the data that was attached to it.

Differential Revision: https://developer.blender.org/D13326
2021-11-23 14:38:02 +01:00
d7b7cbb047 Merge branch 'blender-v3.0-release' 2021-11-23 14:36:57 +01:00
0479a66313 Fix broken versionning after recent refactor of insertion in liboverrides.
rB33c5e7bcd5e5b79 doversion code was incorrectly dealing with 'insert in
first position' case from older blendfiles.

Specifically, a NULL anchor is valid (it means that the new item is the
first of the stored override data, and should be inserted at start of
the list).

Reported as part of T93321.
2021-11-23 14:36:40 +01:00
611e4ffaab Icons: Replace .blend file icons, add "Current File" icon
The Blender icon must not be used to refer to anything that is not
Blender itself. Using the Blender icon on its own to refer to .blend
files or the currently open file is a no-go, which was brought up by
Ton.

This does the following changes to the icon file:
* Add new "Current File" icon
* Change the .blend file icon to contain a file icon with the Blender
  logo, but not merely the Blender logo.
* Change the backup .blend file icon accordingly.

The new "Current File" icon is used in the Asset Browser, but
could/should be used in the Outliner as well. That needs more design
discussion though.
2021-11-23 14:32:35 +01:00
89b927a720 Cleanup: Silence compilation warning.
For now made DRW_notify_view_update_offscreen static.
2021-11-23 14:30:14 +01:00
fecdf9d44b Merge branch 'blender-v3.0-release'
Conflicts:
	source/blender/editors/transform/transform_generics.c
2021-11-23 10:17:24 -03:00
b7c98c87ac Cleanup: clang-tidy warnings
Silenciate warnings of usage of 'else' after 'return'
2021-11-23 10:15:00 -03:00
a6d1a2d3fc Merge branch 'blender-v3.0-release' 2021-11-23 14:08:53 +01:00
Christian Stolze
bba6fe83e2 Fix T89204: slow repeated rendering with GPUOffscreen.draw_view3d.
Reviewed By: fclem
Differential Revision: D13235
2021-11-23 14:08:38 +01:00
6ab3349bd4 Documentation: Remove deprecated glColor* from bgl module.
glColor isn't supported but still part of the documentation. This
patch removes the glColor from the documentation.

Ref {T93315}
2021-11-23 13:03:12 +01:00
3aab18f0ae Add default value to String to Curves string input 2021-10-29 16:59:07 +02:00
423a931ce5 Rename socket "Curves" to "Curve Instances" on String to Curves-node 2021-10-29 16:58:30 +02:00
be109b60e7 Fix typo Curve -> Curves in socket name 2021-10-29 16:57:27 +02:00
98df4c4040 Add Line and Pivot outputs to String to Curves 2021-10-29 16:56:20 +02:00
43a56ea1e7 Initial support for custom attributes on instances 2021-10-29 16:54:05 +02:00
312 changed files with 3230 additions and 26745 deletions

View File

@@ -514,13 +514,9 @@ if(UNIX AND NOT APPLE)
endif()
# Vulkan
option(WITH_VULKAN "Enable Vulkan backend (Experimental)" OFF)
option(WITH_VULKAN_SHADER_COMPILATION "Temporary flag to enable vulkan shader compilation needed to continue development during the migration of GLSL to Vulkan." OFF)
# OpenGL
option(WITH_OPENGL "When off limits visibility of the opengl headers to just bf_gpu (temporary option for development purposes)" ON)
option(WITH_OPENGL "When off limits visibility of the opengl headers to just bf_gpu and gawain (temporary option for development purposes)" ON)
option(WITH_GLEW_ES "Switches to experimental copy of GLEW that has support for OpenGL ES. (temporary option for development purposes)" OFF)
option(WITH_GL_EGL "Use the EGL OpenGL system library instead of the platform specific OpenGL system library (CGL, glX, or WGL)" OFF)
option(WITH_GL_PROFILE_ES20 "Support using OpenGL ES 2.0. (through either EGL or the AGL/WGL/XGL 'es20' profile)" OFF)
@@ -530,7 +526,6 @@ mark_as_advanced(
WITH_GLEW_ES
WITH_GL_EGL
WITH_GL_PROFILE_ES20
WITH_VULKAN_SHADER_COMPILATION
)
if(WIN32)
@@ -1131,18 +1126,6 @@ if(WITH_OPENVDB)
list(APPEND OPENVDB_LIBRARIES ${BOOST_LIBRARIES} ${TBB_LIBRARIES})
endif()
#-----------------------------------------------------------------------------
# Configure Vulkan.
if(WITH_VULKAN)
list(APPEND BLENDER_GL_LIBRARIES ${Vulkan_LIBRARY})
add_definitions(-DWITH_VULKAN)
if(WITH_VULKAN_SHADER_COMPILATION)
add_definitions(-DWITH_VULKAN_SHADER_COMPILATION)
endif()
endif()
#-----------------------------------------------------------------------------
# Configure OpenGL.

View File

@@ -1,66 +0,0 @@
# - Find SHADERC library
# Find the native Haru includes and library
# This module defines
# SHADERC_INCLUDE_DIRS, where to find hpdf.h, set when
# SHADERC_INCLUDE_DIR is found.
# SHADERC_LIBRARIES, libraries to link against to use Haru.
# SHADERC_ROOT_DIR, The base directory to search for Haru.
# This can also be an environment variable.
# SHADERC_FOUND, If false, do not try to use Haru.
#
# also defined, but not for general use are
# SHADERC_LIBRARY, where to find the Haru library.
#=============================================================================
# Copyright 2021 Blender Foundation.
#
# Distributed under the OSI-approved BSD 3-Clause License,
# see accompanying file BSD-3-Clause-license.txt for details.
#=============================================================================
# If SHADERC_ROOT_DIR was defined in the environment, use it.
if(NOT SHADERC_ROOT_DIR AND NOT $ENV{SHADERC_ROOT_DIR} STREQUAL "")
set(SHADERC_ROOT_DIR $ENV{SHADERC_ROOT_DIR})
endif()
set(_shaderc_SEARCH_DIRS
${SHADERC_ROOT_DIR}
/opt/lib/haru
)
find_path(SHADERC_INCLUDE_DIR
NAMES
shaderc.hpp
HINTS
${_shaderc_SEARCH_DIRS}
PATH_SUFFIXES
include/shaderc
include
)
find_library(SHADERC_LIBRARY
NAMES
shaderc_combined
shaderc
HINTS
${_shaderc_SEARCH_DIRS}
PATH_SUFFIXES
lib64 lib
)
# Handle the QUIETLY and REQUIRED arguments and set SHADERC_FOUND to TRUE if
# all listed variables are TRUE.
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(ShaderC DEFAULT_MSG SHADERC_LIBRARY SHADERC_INCLUDE_DIR)
if(SHADERC_FOUND)
set(SHADERC_LIBRARIES ${SHADERC_LIBRARY})
set(SHADERC_INCLUDE_DIRS ${SHADERC_INCLUDE_DIR})
endif()
mark_as_advanced(
SHADERC_INCLUDE_DIR
SHADERC_LIBRARY
)
unset(_shaderc_SEARCH_DIRS)

View File

@@ -102,11 +102,6 @@ find_package_wrapper(ZLIB REQUIRED)
find_package_wrapper(Zstd REQUIRED)
find_package_wrapper(Freetype REQUIRED)
if(WITH_VULKAN)
find_package_wrapper(Vulkan REQUIRED)
find_package(ShaderC REQUIRED)
endif()
if(WITH_PYTHON)
# No way to set py35, remove for now.
# find_package(PythonLibs)

View File

@@ -874,32 +874,5 @@ if(WITH_HARU)
endif()
endif()
if(WITH_VULKAN)
if(EXISTS ${LIBDIR}/vulkan)
set(Vulkan_FOUND On)
set(Vulkan_ROOT_DIR ${LIBDIR}/vulkan)
set(Vulkan_INCLUDE_DIR ${Vulkan_ROOT_DIR}/include)
set(Vulkan_INCLUDE_DIRS ${Vulkan_INCLUDE_DIR})
set(Vulkan_LIBRARY ${Vulkan_ROOT_DIR}/lib/vulkan-1.lib)
set(Vulkan_LIBRARIES ${Vulkan_LIBRARY})
else()
message(WARNING "vulkan was not found, disabling WITH_VULKAN")
set(WITH_VULKAN OFF)
endif()
endif()
if(WITH_VULKAN)
if(EXISTS ${LIBDIR}/shaderc)
set(SHADERC_ROOT_DIR ${LIBDIR}/shaderc)
set(SHADERC_INCLUDE_DIR ${SHADERC_ROOT_DIR}/include)
set(SHADERC_INCLUDE_DIRS ${SHADERC_INCLUDE_DIR})
set(SHADERC_LIBRARY optimized ${SHADERC_ROOT_DIR}/lib/shaderc_shared.lib debug ${SHADERC_ROOT_DIR}/lib/shaderc_shared_d.lib)
set(SHADERC_LIBRARIES ${SHADERC_LIBRARY})
else()
message(WARNING "shaderc was not found, disabling WITH_VULKAN")
set(WITH_VULKAN OFF)
endif()
endif()
set(ZSTD_INCLUDE_DIRS ${LIBDIR}/zstd/include)
set(ZSTD_LIBRARIES ${LIBDIR}/zstd/lib/zstd_static.lib)

View File

@@ -106,24 +106,6 @@ including advanced features.
floating-point values. These values are interpreted as a plane equation.
.. function:: glColor (red, green, blue, alpha):
B{glColor3b, glColor3d, glColor3f, glColor3i, glColor3s, glColor3ub, glColor3ui, glColor3us,
glColor4b, glColor4d, glColor4f, glColor4i, glColor4s, glColor4ub, glColor4ui, glColor4us,
glColor3bv, glColor3dv, glColor3fv, glColor3iv, glColor3sv, glColor3ubv, glColor3uiv,
glColor3usv, glColor4bv, glColor4dv, glColor4fv, glColor4iv, glColor4sv, glColor4ubv,
glColor4uiv, glColor4usv}
Set a new color.
.. seealso:: `OpenGL Docs <https://khronos.org/registry/OpenGL-Refpages/gl4/html/glColor.xhtml>`__
:type red, green, blue, alpha: Depends on function prototype.
:arg red, green, blue: Specify new red, green, and blue values for the current color.
:arg alpha: Specifies a new alpha value for the current color. Included only in the
four-argument glColor4 commands. (With '4' colors only)
.. function:: glColorMask(red, green, blue, alpha):
Enable and disable writing of frame buffer color components

View File

@@ -116,7 +116,3 @@ endif()
if (WITH_COMPOSITOR)
add_subdirectory(smaa_areatex)
endif()
if(WITH_VULKAN)
add_subdirectory(vulkan_memory_allocator)
endif()

View File

@@ -1333,6 +1333,7 @@ enum {
HIPEW_SUCCESS = 0,
HIPEW_ERROR_OPEN_FAILED = -1,
HIPEW_ERROR_ATEXIT_FAILED = -2,
HIPEW_ERROR_OLD_DRIVER = -3,
};
enum {

View File

@@ -214,6 +214,36 @@ static void hipewHipExit(void) {
}
}
#ifdef _WIN32
static int hipewHasOldDriver(const char *hip_path) {
DWORD verHandle = 0;
DWORD verSize = GetFileVersionInfoSize(hip_path, &verHandle);
int old_driver = 0;
if(verSize != 0) {
LPSTR verData = (LPSTR)malloc(verSize);
if(GetFileVersionInfo(hip_path, verHandle, verSize, verData)) {
LPBYTE lpBuffer = NULL;
UINT size = 0;
if(VerQueryValue(verData, "\\", (VOID FAR * FAR *)&lpBuffer, &size)) {
if(size) {
VS_FIXEDFILEINFO *verInfo = (VS_FIXEDFILEINFO *)lpBuffer;
/* Magic value from
* https://docs.microsoft.com/en-us/windows/win32/api/verrsrc/ns-verrsrc-vs_fixedfileinfo */
if(verInfo->dwSignature == 0xfeef04bd) {
unsigned int fileVersionLS0 = (verInfo->dwFileVersionLS >> 16) & 0xffff;
unsigned int fileversionLS1 = (verInfo->dwFileVersionLS >> 0) & 0xffff;
/* Corresponds to versions older than AMD Radeon Pro 21.Q4. */
old_driver = ((fileVersionLS0 < 3354) || (fileVersionLS0 == 3354 && fileversionLS1 < 13));
}
}
}
}
free(verData);
}
return old_driver;
}
#endif
static int hipewHipInit(void) {
/* Library paths. */
#ifdef _WIN32
@@ -241,6 +271,14 @@ static int hipewHipInit(void) {
return result;
}
#ifdef _WIN32
/* Test for driver version. */
if(hipewHasOldDriver(hip_paths[0])) {
result = HIPEW_ERROR_OLD_DRIVER;
return result;
}
#endif
/* Load library. */
hip_lib = dynamic_library_open_find(hip_paths);

View File

@@ -1,42 +0,0 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# The Original Code is Copyright (C) 2012, Blender Foundation
# All rights reserved.
# ***** END GPL LICENSE BLOCK *****
set(INC
.
)
set(INC_SYS
${Vulkan_INCLUDE_DIRS}
)
set(SRC
vk_mem_alloc_impl.cc
vk_mem_alloc.h
)
blender_add_lib(extern_vulkan_memory_allocator "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")
target_compile_options(extern_vulkan_memory_allocator
PRIVATE "-Wno-nullability-completeness"
)
endif()

View File

@@ -1,19 +0,0 @@
Copyright (c) 2017-2021 Advanced Micro Devices, Inc. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@@ -1,5 +0,0 @@
Project: VulkanMemoryAllocator
URL: https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator
License: MIT
Upstream version: 4b047fd
Local modifications: None

View File

@@ -1,134 +0,0 @@
# Vulkan Memory Allocator
Easy to integrate Vulkan memory allocation library.
**Documentation:** See [Vulkan Memory Allocator](https://gpuopen-librariesandsdks.github.io/VulkanMemoryAllocator/html/) (generated from Doxygen-style comments in [src/vk_mem_alloc.h](src/vk_mem_alloc.h))
**License:** MIT. See [LICENSE.txt](LICENSE.txt)
**Changelog:** See [CHANGELOG.md](CHANGELOG.md)
**Product page:** [Vulkan Memory Allocator on GPUOpen](https://gpuopen.com/gaming-product/vulkan-memory-allocator/)
**Build status:**
- Windows: [![Build status](https://ci.appveyor.com/api/projects/status/4vlcrb0emkaio2pn/branch/master?svg=true)](https://ci.appveyor.com/project/adam-sawicki-amd/vulkanmemoryallocator/branch/master)
- Linux: [![Build Status](https://travis-ci.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator.svg?branch=master)](https://travis-ci.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator)
# Problem
Memory allocation and resource (buffer and image) creation in Vulkan is difficult (comparing to older graphics API-s, like D3D11 or OpenGL) for several reasons:
- It requires a lot of boilerplate code, just like everything else in Vulkan, because it is a low-level and high-performance API.
- There is additional level of indirection: `VkDeviceMemory` is allocated separately from creating `VkBuffer`/`VkImage` and they must be bound together.
- Driver must be queried for supported memory heaps and memory types. Different IHVs provide different types of it.
- It is recommended practice to allocate bigger chunks of memory and assign parts of them to particular resources.
# Features
This library can help game developers to manage memory allocations and resource creation by offering some higher-level functions:
1. Functions that help to choose correct and optimal memory type based on intended usage of the memory.
- Required or preferred traits of the memory are expressed using higher-level description comparing to Vulkan flags.
2. Functions that allocate memory blocks, reserve and return parts of them (`VkDeviceMemory` + offset + size) to the user.
- Library keeps track of allocated memory blocks, used and unused ranges inside them, finds best matching unused ranges for new allocations, respects all the rules of alignment and buffer/image granularity.
3. Functions that can create an image/buffer, allocate memory for it and bind them together - all in one call.
Additional features:
- Well-documented - description of all functions and structures provided, along with chapters that contain general description and example code.
- Thread-safety: Library is designed to be used in multithreaded code. Access to a single device memory block referred by different buffers and textures (binding, mapping) is synchronized internally.
- Configuration: Fill optional members of CreateInfo structure to provide custom CPU memory allocator, pointers to Vulkan functions and other parameters.
- Customization: Predefine appropriate macros to provide your own implementation of all external facilities used by the library, from assert, mutex, and atomic, to vector and linked list.
- Support for memory mapping, reference-counted internally. Support for persistently mapped memory: Just allocate with appropriate flag and you get access to mapped pointer.
- Support for non-coherent memory. Functions that flush/invalidate memory. `nonCoherentAtomSize` is respected automatically.
- Support for resource aliasing (overlap).
- Support for sparse binding and sparse residency: Convenience functions that allocate or free multiple memory pages at once.
- Custom memory pools: Create a pool with desired parameters (e.g. fixed or limited maximum size) and allocate memory out of it.
- Linear allocator: Create a pool with linear algorithm and use it for much faster allocations and deallocations in free-at-once, stack, double stack, or ring buffer fashion.
- Support for Vulkan 1.0, 1.1, 1.2.
- Support for extensions (and equivalent functionality included in new Vulkan versions):
- VK_EXT_memory_budget: Used internally if available to query for current usage and budget. If not available, it falls back to an estimation based on memory heap sizes.
- VK_KHR_dedicated_allocation: Just enable it and it will be used automatically by the library.
- VK_AMD_device_coherent_memory
- VK_KHR_buffer_device_address
- Defragmentation of GPU and CPU memory: Let the library move data around to free some memory blocks and make your allocations better compacted.
- Lost allocations: Allocate memory with appropriate flags and let the library remove allocations that are not used for many frames to make room for new ones.
- Statistics: Obtain detailed statistics about the amount of memory used, unused, number of allocated blocks, number of allocations etc. - globally, per memory heap, and per memory type.
- Debug annotations: Associate string with name or opaque pointer to your own data with every allocation.
- JSON dump: Obtain a string in JSON format with detailed map of internal state, including list of allocations and gaps between them.
- Convert this JSON dump into a picture to visualize your memory. See [tools/VmaDumpVis](tools/VmaDumpVis/README.md).
- Debugging incorrect memory usage: Enable initialization of all allocated memory with a bit pattern to detect usage of uninitialized or freed memory. Enable validation of a magic number before and after every allocation to detect out-of-bounds memory corruption.
- Record and replay sequence of calls to library functions to a file to check correctness, measure performance, and gather statistics.
# Prequisites
- Self-contained C++ library in single header file. No external dependencies other than standard C and C++ library and of course Vulkan. STL containers are not used by default.
- Public interface in C, in same convention as Vulkan API. Implementation in C++.
- Error handling implemented by returning `VkResult` error codes - same way as in Vulkan.
- Interface documented using Doxygen-style comments.
- Platform-independent, but developed and tested on Windows using Visual Studio. Continuous integration setup for Windows and Linux. Used also on Android, MacOS, and other platforms.
# Example
Basic usage of this library is very simple. Advanced features are optional. After you created global `VmaAllocator` object, a complete code needed to create a buffer may look like this:
```cpp
VkBufferCreateInfo bufferInfo = { VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO };
bufferInfo.size = 65536;
bufferInfo.usage = VK_BUFFER_USAGE_VERTEX_BUFFER_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT;
VmaAllocationCreateInfo allocInfo = {};
allocInfo.usage = VMA_MEMORY_USAGE_GPU_ONLY;
VkBuffer buffer;
VmaAllocation allocation;
vmaCreateBuffer(allocator, &bufferInfo, &allocInfo, &buffer, &allocation, nullptr);
```
With this one function call:
1. `VkBuffer` is created.
2. `VkDeviceMemory` block is allocated if needed.
3. An unused region of the memory block is bound to this buffer.
`VmaAllocation` is an object that represents memory assigned to this buffer. It can be queried for parameters like Vulkan memory handle and offset.
# Binaries
The release comes with precompiled binary executables for "VulkanSample" application which contains test suite and "VmaReplay" tool. They are compiled using Visual Studio 2019, so they require appropriate libraries to work, including "MSVCP140.dll", "VCRUNTIME140.dll", "VCRUNTIME140_1.dll". If their launch fails with error message telling about those files missing, please download and install [Microsoft Visual C++ Redistributable for Visual Studio 2015, 2017 and 2019](https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads), "x64" version.
# Read more
See **[Documentation](https://gpuopen-librariesandsdks.github.io/VulkanMemoryAllocator/html/)**.
# Software using this library
- **[Detroit: Become Human](https://gpuopen.com/learn/porting-detroit-3/)**
- **[Vulkan Samples](https://github.com/LunarG/VulkanSamples)** - official Khronos Vulkan samples. License: Apache-style.
- **[Anvil](https://github.com/GPUOpen-LibrariesAndSDKs/Anvil)** - cross-platform framework for Vulkan. License: MIT.
- **[Filament](https://github.com/google/filament)** - physically based rendering engine for Android, Windows, Linux and macOS, from Google. Apache License 2.0.
- **[Atypical Games - proprietary game engine](https://developer.samsung.com/galaxy-gamedev/gamedev-blog/infinitejet.html)**
- **[Flax Engine](https://flaxengine.com/)**
- **[Lightweight Java Game Library (LWJGL)](https://www.lwjgl.org/)** - includes binding of the library for Java. License: BSD.
- **[PowerVR SDK](https://github.com/powervr-graphics/Native_SDK)** - C++ cross-platform 3D graphics SDK, from Imagination. License: MIT.
- **[Skia](https://github.com/google/skia)** - complete 2D graphic library for drawing Text, Geometries, and Images, from Google.
- **[The Forge](https://github.com/ConfettiFX/The-Forge)** - cross-platform rendering framework. Apache License 2.0.
- **[VK9](https://github.com/disks86/VK9)** - Direct3D 9 compatibility layer using Vulkan. Zlib lincese.
- **[vkDOOM3](https://github.com/DustinHLand/vkDOOM3)** - Vulkan port of GPL DOOM 3 BFG Edition. License: GNU GPL.
- **[vkQuake2](https://github.com/kondrak/vkQuake2)** - vanilla Quake 2 with Vulkan support. License: GNU GPL.
- **[Vulkan Best Practice for Mobile Developers](https://github.com/ARM-software/vulkan_best_practice_for_mobile_developers)** from ARM. License: MIT.
- **[RPCS3](https://github.com/RPCS3/rpcs3)** - PlayStation 3 emulator/debugger. License: GNU GPLv2.
[Many other projects on GitHub](https://github.com/search?q=AMD_VULKAN_MEMORY_ALLOCATOR_H&type=Code) and some game development studios that use Vulkan in their games.
# See also
- **[D3D12 Memory Allocator](https://github.com/GPUOpen-LibrariesAndSDKs/D3D12MemoryAllocator)** - equivalent library for Direct3D 12. License: MIT.
- **[Awesome Vulkan](https://github.com/vinjn/awesome-vulkan)** - a curated list of awesome Vulkan libraries, debuggers and resources.
- **[VulkanMemoryAllocator-Hpp](https://github.com/malte-v/VulkanMemoryAllocator-Hpp)** - C++ binding for this library. License: CC0-1.0.
- **[PyVMA](https://github.com/realitix/pyvma)** - Python wrapper for this library. Author: Jean-Sébastien B. (@realitix). License: Apache 2.0.
- **[vk-mem](https://github.com/gwihlidal/vk-mem-rs)** - Rust binding for this library. Author: Graham Wihlidal. License: Apache 2.0 or MIT.
- **[Haskell bindings](https://hackage.haskell.org/package/VulkanMemoryAllocator)**, **[github](https://github.com/expipiplus1/vulkan/tree/master/VulkanMemoryAllocator)** - Haskell bindings for this library. Author: Joe Hermaszewski (@expipiplus1). License BSD-3-Clause.
- **[vma_sample_sdl](https://github.com/rextimmy/vma_sample_sdl)** - SDL port of the sample app of this library (with the goal of running it on multiple platforms, including MacOS). Author: @rextimmy. License: MIT.
- **[vulkan-malloc](https://github.com/dylanede/vulkan-malloc)** - Vulkan memory allocation library for Rust. Based on version 1 of this library. Author: Dylan Ede (@dylanede). License: MIT / Apache 2.0.

File diff suppressed because it is too large Load Diff

View File

@@ -1,3 +0,0 @@
#define VMA_IMPLEMENTATION
#include "vk_mem_alloc.h"

View File

@@ -85,7 +85,3 @@ endif()
if(UNIX AND NOT APPLE)
add_subdirectory(libc_compat)
endif()
if(WITH_VULKAN)
add_subdirectory(shader_compiler)
endif()

View File

@@ -57,9 +57,16 @@ bool device_hip_init()
}
}
else {
VLOG(1) << "HIPEW initialization failed: "
<< ((hipew_result == HIPEW_ERROR_ATEXIT_FAILED) ? "Error setting up atexit() handler" :
"Error opening the library");
if (hipew_result == HIPEW_ERROR_ATEXIT_FAILED) {
VLOG(1) << "HIPEW initialization failed: Error setting up atexit() handler";
}
else if (hipew_result == HIPEW_ERROR_OLD_DRIVER) {
VLOG(1) << "HIPEW initialization failed: Driver version too old, requires AMD Radeon Pro "
"21.Q4 driver or newer";
}
else {
VLOG(1) << "HIPEW initialization failed: Error opening HIP dynamic library";
}
}
return result;

View File

@@ -47,9 +47,6 @@ static bool oidn_progress_monitor_function(void *user_ptr, double /*n*/)
OIDNDenoiser *oidn_denoiser = reinterpret_cast<OIDNDenoiser *>(user_ptr);
return !oidn_denoiser->is_cancelled();
}
#endif
#ifdef WITH_OPENIMAGEDENOISE
class OIDNPass {
public:
@@ -547,7 +544,6 @@ class OIDNDenoiseContext {
* the fake values and denoising of passes which do need albedo can no longer happen. */
bool albedo_replaced_with_fake_ = false;
};
#endif
static unique_ptr<DeviceQueue> create_device_queue(const RenderBuffers *render_buffers)
{
@@ -582,18 +578,20 @@ static void copy_render_buffers_to_device(unique_ptr<DeviceQueue> &queue,
}
}
#endif
bool OIDNDenoiser::denoise_buffer(const BufferParams &buffer_params,
RenderBuffers *render_buffers,
const int num_samples,
bool allow_inplace_modification)
{
#ifdef WITH_OPENIMAGEDENOISE
thread_scoped_lock lock(mutex_);
/* Make sure the host-side data is available for denoising. */
unique_ptr<DeviceQueue> queue = create_device_queue(render_buffers);
copy_render_buffers_from_device(queue, render_buffers);
#ifdef WITH_OPENIMAGEDENOISE
OIDNDenoiseContext context(
this, params_, buffer_params, render_buffers, num_samples, allow_inplace_modification);
@@ -620,6 +618,11 @@ bool OIDNDenoiser::denoise_buffer(const BufferParams &buffer_params,
* copies data from the device it doesn't overwrite the denoiser buffers. */
copy_render_buffers_to_device(queue, render_buffers);
}
#else
(void)buffer_params;
(void)render_buffers;
(void)num_samples;
(void)allow_inplace_modification;
#endif
/* This code is not supposed to run when compiled without OIDN support, so can assume if we made

View File

@@ -699,8 +699,10 @@ ccl_device_forceinline bool integrate_volume_sample_light(
float light_u, light_v;
path_state_rng_2D(kg, rng_state, PRNG_LIGHT_U, &light_u, &light_v);
light_distribution_sample_from_volume_segment(
kg, light_u, light_v, sd->time, sd->P, bounce, path_flag, ls);
if (!light_distribution_sample_from_volume_segment(
kg, light_u, light_v, sd->time, sd->P, bounce, path_flag, ls)) {
return false;
}
if (ls->shader & SHADER_EXCLUDE_SCATTER) {
return false;

View File

@@ -73,7 +73,7 @@ ccl_device_inline bool light_sample(KernelGlobals kg,
ls->P = zero_float3();
ls->Ng = zero_float3();
ls->D = zero_float3();
ls->pdf = true;
ls->pdf = 1.0f;
ls->t = FLT_MAX;
return true;
}
@@ -131,7 +131,7 @@ ccl_device_inline bool light_sample(KernelGlobals kg,
float3 dir = make_float3(klight->spot.dir[0], klight->spot.dir[1], klight->spot.dir[2]);
ls->eval_fac *= spot_light_attenuation(
dir, klight->spot.spot_angle, klight->spot.spot_smooth, ls->Ng);
if (ls->eval_fac == 0.0f) {
if (!in_volume_segment && ls->eval_fac == 0.0f) {
return false;
}
}
@@ -170,7 +170,7 @@ ccl_device_inline bool light_sample(KernelGlobals kg,
float3 sample_axisu = axisu;
float3 sample_axisv = axisv;
if (klight->area.tan_spread > 0.0f) {
if (!in_volume_segment && klight->area.tan_spread > 0.0f) {
if (!light_spread_clamp_area_light(
P, Ng, &ls->P, &sample_axisu, &sample_axisv, klight->area.tan_spread)) {
return false;
@@ -203,7 +203,7 @@ ccl_device_inline bool light_sample(KernelGlobals kg,
ls->pdf *= kernel_data.integrator.pdf_lights;
return (ls->pdf > 0.0f);
return in_volume_segment || (ls->pdf > 0.0f);
}
ccl_device bool lights_intersect(KernelGlobals kg,

View File

@@ -89,18 +89,6 @@ set(LIB
${GLEW_LIBRARY}
)
if(WITH_VULKAN)
list(APPEND SRC
intern/GHOST_ContextVK.cpp
intern/GHOST_ContextVK.h
)
list(APPEND INC_SYS
${Vulkan_INCLUDE_DIRS}
)
endif()
if(WITH_GHOST_DEBUG)
list(APPEND SRC
intern/GHOST_EventPrinter.cpp

View File

@@ -195,7 +195,6 @@ extern GHOST_WindowHandle GHOST_CreateWindow(GHOST_SystemHandle systemhandle,
* \return A handle to the new context ( == NULL if creation failed).
*/
extern GHOST_ContextHandle GHOST_CreateOpenGLContext(GHOST_SystemHandle systemhandle,
GHOST_TDrawingContextType type,
GHOST_GLSettings glSettings);
/**
@@ -543,13 +542,6 @@ extern int GHOST_GetValid(GHOST_WindowHandle windowhandle);
*/
extern GHOST_TDrawingContextType GHOST_GetDrawingContextType(GHOST_WindowHandle windowhandle);
/**
* Returns the drawing context used in this window.
* \param windowhandle: The handle to the window.
* \return The window drawing context.
*/
extern GHOST_ContextHandle GHOST_GetDrawingContext(GHOST_WindowHandle windowhandle);
/**
* Tries to install a rendering context in this window.
* \param windowhandle: The handle to the window.
@@ -1167,50 +1159,6 @@ int GHOST_XrGetControllerModelData(GHOST_XrContextHandle xr_context,
#endif /* WITH_XR_OPENXR */
#ifdef WITH_VULKAN
/**
* Return vulkan handles for the given context.
*/
void GHOST_GetVulkanHandles(GHOST_ContextHandle context,
void *r_instance,
void *r_physical_device,
void *r_device,
uint32_t *r_graphic_queue_familly);
/**
* Return vulkan backbuffer resources handles for the given window.
*/
void GHOST_GetVulkanBackbuffer(GHOST_WindowHandle windowhandle,
void *image,
void *framebuffer,
void *command_buffer,
void *render_pass,
void *extent,
uint32_t *fb_id);
/**
* \brief Query vulkan devices.
*
* \returns a device list handle or NULL when there is no vulkan available.
*/
GHOST_VulkanDeviceListHandle GHOST_QueryVulkanDevices(GHOST_ContextHandle system);
/**
* \brief Destroy the given device list.
*/
GHOST_TSuccess GHOST_DestroyVulkanDeviceList(GHOST_VulkanDeviceListHandle device_list_handle);
/**
* \brief Get an item from the given device list.
*
* \returns GHOST_kSuccess when device is loaded. GHOST_kFailure when the given device_list_handle
* is incorrect or the given index is out of range.
*/
GHOST_TSuccess GHOST_GetVulkanDeviceListItem(GHOST_VulkanDeviceListHandle device_list_handle,
int64_t index,
GHOST_VulkanPhysicalDevice *r_device);
#endif
#ifdef __cplusplus
}

View File

@@ -56,11 +56,6 @@ class GHOST_IContext {
virtual unsigned int getDefaultFramebuffer() = 0;
virtual GHOST_TSuccess getVulkanHandles(void *, void *, void *, uint32_t *) = 0;
virtual GHOST_TSuccess getVulkanBackbuffer(
void *, void *, void *, void *, void *, uint32_t *) = 0;
virtual GHOST_TSuccess swapBuffers() = 0;
#ifdef WITH_CXX_GUARDEDALLOC

View File

@@ -265,8 +265,7 @@ class GHOST_ISystem {
* Never explicitly delete the context, use #disposeContext() instead.
* \return The new context (or 0 if creation failed).
*/
virtual GHOST_IContext *createOffscreenContext(GHOST_TDrawingContextType type,
GHOST_GLSettings glSettings) = 0;
virtual GHOST_IContext *createOffscreenContext(GHOST_GLSettings glSettings) = 0;
/**
* Dispose of a context.

View File

@@ -30,8 +30,6 @@
#include <stdlib.h>
#include <string>
class GHOST_IContext;
/**
* Interface for GHOST windows.
*
@@ -73,12 +71,6 @@ class GHOST_IWindow {
*/
virtual GHOST_TDrawingContextType getDrawingContextType() = 0;
/**
* Returns the type of drawing context used in this window.
* \return The current type of drawing context.
*/
virtual GHOST_IContext *getDrawingContext() = 0;
/**
* Tries to install a rendering context in this window.
* \param type: The type of rendering context installed.
@@ -226,18 +218,6 @@ class GHOST_IWindow {
*/
virtual unsigned int getDefaultFramebuffer() = 0;
/**
* Gets the Vulkan framebuffer related resource handles associated with the Vulkan context.
* Needs to be called after each swap events as the framebuffer will change.
* \return A boolean success indicator.
*/
virtual GHOST_TSuccess getVulkanBackbuffer(void * /*image*/,
void * /*framebuffer*/,
void * /*command_buffer*/,
void * /*render_pass*/,
void * /*extent*/,
uint32_t * /*fb_id*/) = 0;
/**
* Invalidates the contents of this window.
* \return Indication of success.

View File

@@ -29,10 +29,6 @@
# include "MEM_guardedalloc.h"
#endif
#ifdef WITH_VULKAN
# include "vulkan/vulkan.h"
#endif
#if defined(WITH_CXX_GUARDEDALLOC) && defined(__cplusplus)
# define GHOST_DECLARE_HANDLE(name) \
typedef struct name##__ { \
@@ -149,9 +145,6 @@ typedef enum { GHOST_kWindowOrderTop = 0, GHOST_kWindowOrderBottom } GHOST_TWind
typedef enum {
GHOST_kDrawingContextTypeNone = 0,
GHOST_kDrawingContextTypeOpenGL,
#ifdef WITH_VULKAN
GHOST_kDrawingContextTypeVulkan,
#endif
#ifdef WIN32
GHOST_kDrawingContextTypeD3D,
#endif
@@ -789,20 +782,3 @@ typedef struct GHOST_XrControllerModelData {
} GHOST_XrControllerModelData;
#endif /* WITH_XR_OPENXR */
#ifdef WITH_VULKAN
GHOST_DECLARE_HANDLE(GHOST_VulkanDeviceListHandle);
typedef struct GHOST_VulkanPhysicalDeviceID {
uint32_t vendor_id;
uint32_t device_id;
int32_t index;
} GHOST_VulkanPhysicalDeviceID;
typedef struct GHOST_VulkanPhysicalDevice {
GHOST_VulkanPhysicalDeviceID device_id;
VkPhysicalDeviceProperties device_properties;
} GHOST_VulkanPhysicalDevice;
#endif

View File

@@ -35,9 +35,6 @@
# include "GHOST_IXrContext.h"
# include "intern/GHOST_XrSession.h"
#endif
#ifdef WITH_VULKAN
# include "intern/GHOST_ContextVK.h"
#endif
#include "intern/GHOST_CallbackEventConsumer.h"
#include "intern/GHOST_XrException.h"
@@ -140,12 +137,11 @@ void GHOST_GetAllDisplayDimensions(GHOST_SystemHandle systemhandle,
}
GHOST_ContextHandle GHOST_CreateOpenGLContext(GHOST_SystemHandle systemhandle,
GHOST_TDrawingContextType type,
GHOST_GLSettings glSettings)
{
GHOST_ISystem *system = (GHOST_ISystem *)systemhandle;
return (GHOST_ContextHandle)system->createOffscreenContext(type, glSettings);
return (GHOST_ContextHandle)system->createOffscreenContext(glSettings);
}
GHOST_TSuccess GHOST_DisposeOpenGLContext(GHOST_SystemHandle systemhandle,
@@ -497,13 +493,6 @@ GHOST_TDrawingContextType GHOST_GetDrawingContextType(GHOST_WindowHandle windowh
return window->getDrawingContextType();
}
GHOST_ContextHandle GHOST_GetDrawingContext(GHOST_WindowHandle windowhandle)
{
GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
return (GHOST_ContextHandle)window->getDrawingContext();
}
GHOST_TSuccess GHOST_SetDrawingContextType(GHOST_WindowHandle windowhandle,
GHOST_TDrawingContextType type)
{
@@ -1116,74 +1105,3 @@ int GHOST_XrGetControllerModelData(GHOST_XrContextHandle xr_contexthandle,
}
#endif /* WITH_XR_OPENXR */
#ifdef WITH_VULKAN
/**
* Return vulkan handles for the given context.
*/
void GHOST_GetVulkanHandles(GHOST_ContextHandle contexthandle,
void *r_instance,
void *r_physical_device,
void *r_device,
uint32_t *r_graphic_queue_familly)
{
GHOST_IContext *context = (GHOST_IContext *)contexthandle;
context->getVulkanHandles(r_instance, r_physical_device, r_device, r_graphic_queue_familly);
}
/**
* Return vulkan backbuffer resources handles for the given window.
*/
void GHOST_GetVulkanBackbuffer(GHOST_WindowHandle windowhandle,
void *image,
void *framebuffer,
void *command_buffer,
void *render_pass,
void *extent,
uint32_t *fb_id)
{
GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
window->getVulkanBackbuffer(image, framebuffer, command_buffer, render_pass, extent, fb_id);
}
/**
* \brief Query vulkan devices.
*
* \returns a device list handle or NULL when there is no vulkan available.
*/
GHOST_VulkanDeviceListHandle GHOST_QueryVulkanDevices(GHOST_ContextHandle contexthandle)
{
GHOST_ContextVK *context = (GHOST_ContextVK *)contexthandle;
return (GHOST_VulkanDeviceListHandle)context->queryDevices();
}
/**
* \brief Destroy the given device list.
*/
GHOST_TSuccess GHOST_DestroyVulkanDeviceList(GHOST_VulkanDeviceListHandle device_list_handle)
{
if (device_list_handle == nullptr) {
return GHOST_kFailure;
}
GHOST_ContextVK::destroyDeviceList((GHOST_VulkanDeviceList *)device_list_handle);
return GHOST_kSuccess;
}
/**
* \brief Get an item from the given device list.
*
* \returns GHOST_kSuccess when device is loaded. GHOST_kFailure when the given device_list_handle
* is incorrect or the given index is out of range.
*/
GHOST_TSuccess GHOST_GetVulkanDeviceListItem(GHOST_VulkanDeviceListHandle device_list_handle,
int64_t index,
GHOST_VulkanPhysicalDevice *r_device)
{
return GHOST_kFailure;
}
#endif /* WITH_VULKAN */

View File

@@ -135,33 +135,6 @@ class GHOST_Context : public GHOST_IContext {
return 0;
}
/**
* Gets the Vulkan context related resource handles.
* \return A boolean success indicator.
*/
virtual GHOST_TSuccess getVulkanHandles(void * /*r_instance*/,
void * /*r_physical_device*/,
void * /*r_device*/,
uint32_t * /*r_graphic_queue_familly*/)
{
return GHOST_kFailure;
};
/**
* Gets the Vulkan framebuffer related resource handles associated with the Vulkan context.
* Needs to be called after each swap events as the framebuffer will change.
* \return A boolean success indicator.
*/
virtual GHOST_TSuccess getVulkanBackbuffer(void * /*image*/,
void * /*framebuffer*/,
void * /*command_buffer*/,
void * /*render_pass*/,
void * /*extent*/,
uint32_t * /*fb_id*/)
{
return GHOST_kFailure;
}
protected:
void initContextGLEW();

File diff suppressed because it is too large Load Diff

View File

@@ -1,236 +0,0 @@
/*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* The Original Code is Copyright (C) 2014 Blender Foundation.
* All rights reserved.
*/
/** \file
* \ingroup GHOST
*/
#ifndef __GHOST_CONTEXTVK_H__
#define __GHOST_CONTEXTVK_H__
#include "GHOST_Context.h"
#ifdef _WIN32
# include "GHOST_SystemWin32.h"
#elif defined(__APPLE__)
# include "GHOST_SystemCocoa.h"
#else
# include "GHOST_SystemX11.h"
# ifdef WITH_GHOST_WAYLAND
# include "GHOST_SystemWayland.h"
# else
# define wl_surface void
# define wl_display void
# endif
#endif
#include <vector>
#ifdef __APPLE__
# include <MoltenVK/vk_mvk_moltenvk.h>
#else
# include <vulkan/vulkan.h>
#endif
#ifndef GHOST_OPENGL_VK_CONTEXT_FLAGS
/* leave as convenience define for the future */
# define GHOST_OPENGL_VK_CONTEXT_FLAGS 0
#endif
#ifndef GHOST_OPENGL_VK_RESET_NOTIFICATION_STRATEGY
# define GHOST_OPENGL_VK_RESET_NOTIFICATION_STRATEGY 0
#endif
typedef enum {
GHOST_kVulkanPlatformX11 = 0,
#ifdef WITH_GHOST_WAYLAND
GHOST_kVulkanPlatformWayland,
#endif
} GHOST_TVulkanPlatformType;
struct GHOST_VulkanDeviceList {
std::vector<GHOST_VulkanPhysicalDevice> m_devices;
};
class GHOST_ContextVK : public GHOST_Context {
/* XR code needs low level graphics data to send to OpenXR. */
// friend class GHOST_XrGraphicsBindingOpenGL;
public:
/**
* Constructor.
*/
GHOST_ContextVK(bool stereoVisual,
#ifdef _WIN32
HWND hwnd,
#elif defined(__APPLE__)
/* FIXME CAMetalLayer but have issue with linking. */
void *metal_layer,
#else
GHOST_TVulkanPlatformType platform,
/* X11 */
Window window,
Display *display,
/* Wayland */
wl_surface *wayland_surface,
wl_display *wayland_display,
#endif
int contextMajorVersion,
int contextMinorVersion,
int m_debug);
/**
* Destructor.
*/
~GHOST_ContextVK();
/**
* Swaps front and back buffers of a window.
* \return A boolean success indicator.
*/
GHOST_TSuccess swapBuffers();
/**
* Activates the drawing context of this window.
* \return A boolean success indicator.
*/
GHOST_TSuccess activateDrawingContext();
/**
* Release the drawing context of the calling thread.
* \return A boolean success indicator.
*/
GHOST_TSuccess releaseDrawingContext();
/**
* Call immediately after new to initialize. If this fails then immediately delete the object.
* \return Indication as to whether initialization has succeeded.
*/
GHOST_TSuccess initializeDrawingContext();
/**
* Removes references to native handles from this context and then returns
* \return GHOST_kSuccess if it is OK for the parent to release the handles and
* GHOST_kFailure if releasing the handles will interfere with sharing
*/
GHOST_TSuccess releaseNativeHandles();
/**
* Gets the Vulkan context related resource handles.
* \return A boolean success indicator.
*/
GHOST_TSuccess getVulkanHandles(void *r_instance,
void *r_physical_device,
void *r_device,
uint32_t *r_graphic_queue_familly);
/**
* Gets the Vulkan framebuffer related resource handles associated with the Vulkan context.
* Needs to be called after each swap events as the framebuffer will change.
* \return A boolean success indicator.
*/
GHOST_TSuccess getVulkanBackbuffer(void *image,
void *framebuffer,
void *command_buffer,
void *render_pass,
void *extent,
uint32_t *fb_id);
/**
* Sets the swap interval for swapBuffers.
* \param interval The swap interval to use.
* \return A boolean success indicator.
*/
GHOST_TSuccess setSwapInterval(int /* interval */)
{
return GHOST_kFailure;
}
/**
* Gets the current swap interval for swapBuffers.
* \param intervalOut Variable to store the swap interval if it can be read.
* \return Whether the swap interval can be read.
*/
GHOST_TSuccess getSwapInterval(int &)
{
return GHOST_kFailure;
};
GHOST_VulkanDeviceList *queryDevices();
static void destroyDeviceList(GHOST_VulkanDeviceList *device_list);
private:
#ifdef _WIN32
HWND m_hwnd;
#elif defined(__APPLE__)
/* FIXME CAMetalLayer but have issue with linking. */
void *m_metal_layer;
#else /* Linux */
GHOST_TVulkanPlatformType m_platform;
/* X11 */
Display *m_display;
Window m_window;
/* Wayland */
wl_surface *m_wayland_surface;
wl_display *m_wayland_display;
#endif
const int m_context_major_version;
const int m_context_minor_version;
const int m_debug;
VkInstance m_instance;
VkPhysicalDevice m_physical_device;
VkDevice m_device;
VkCommandPool m_command_pool;
uint32_t m_queue_family_graphic;
uint32_t m_queue_family_present;
VkQueue m_graphic_queue;
VkQueue m_present_queue;
/* For display only. */
VkSurfaceKHR m_surface;
VkSwapchainKHR m_swapchain;
std::vector<VkImage> m_swapchain_images;
std::vector<VkImageView> m_swapchain_image_views;
std::vector<VkFramebuffer> m_swapchain_framebuffers;
std::vector<VkCommandBuffer> m_command_buffers;
VkRenderPass m_render_pass;
VkExtent2D m_render_extent;
std::vector<VkSemaphore> m_image_available_semaphores;
std::vector<VkSemaphore> m_render_finished_semaphores;
std::vector<VkFence> m_in_flight_fences;
std::vector<VkFence> m_in_flight_images;
/** frame modulo swapchain_len. Used as index for sync objects. */
int m_currentFrame = 0;
/** Image index in the swapchain. Used as index for render objects. */
uint32_t m_currentImage = 0;
/** Used to unique framebuffer ids to return when swapchain is recreated. */
uint32_t m_swapchain_id = 0;
const char *getPlatformSpecificSurfaceExtension() const;
GHOST_TSuccess pickPhysicalDevice(std::vector<const char *> required_exts);
GHOST_TSuccess createSwapchain(void);
GHOST_TSuccess destroySwapchain(void);
GHOST_TSuccess createCommandBuffers(void);
GHOST_TSuccess recordCommandBuffers(void);
};
#endif // __GHOST_CONTEXTVK_H__

View File

@@ -117,8 +117,7 @@ class GHOST_System : public GHOST_ISystem {
* Never explicitly delete the context, use #disposeContext() instead.
* \return The new context (or 0 if creation failed).
*/
virtual GHOST_IContext *createOffscreenContext(GHOST_TDrawingContextType type,
GHOST_GLSettings glSettings) = 0;
virtual GHOST_IContext *createOffscreenContext(GHOST_GLSettings glSettings) = 0;
/**
* Returns whether a window is valid.

View File

@@ -116,8 +116,7 @@ class GHOST_SystemCocoa : public GHOST_System {
* Never explicitly delete the context, use #disposeContext() instead.
* \return The new context (or 0 if creation failed).
*/
GHOST_IContext *createOffscreenContext(GHOST_TDrawingContextType type,
GHOST_GLSettings glSettings);
GHOST_IContext *createOffscreenContext(GHOST_GLSettings glSettings);
/**
* Dispose of a context.

View File

@@ -34,10 +34,6 @@
#include "GHOST_ContextCGL.h"
#if defined(WITH_VULKAN)
# include "GHOST_ContextVK.h"
#endif
#ifdef WITH_INPUT_NDOF
# include "GHOST_NDOFManagerCocoa.h"
#endif
@@ -768,21 +764,8 @@ GHOST_IWindow *GHOST_SystemCocoa::createWindow(const char *title,
* Never explicitly delete the context, use #disposeContext() instead.
* \return The new context (or 0 if creation failed).
*/
GHOST_IContext *GHOST_SystemCocoa::createOffscreenContext(GHOST_TDrawingContextType type,
GHOST_GLSettings glSettings)
GHOST_IContext *GHOST_SystemCocoa::createOffscreenContext(GHOST_GLSettings glSettings)
{
#ifdef WITH_VULKAN
if (type == GHOST_kDrawingContextTypeVulkan) {
const bool debug_context = (glSettings.flags & GHOST_glDebugContext) != 0;
GHOST_Context *context = new GHOST_ContextVK(false, NULL, 1, 0, debug_context);
if (context->initializeDrawingContext()) {
return context;
}
delete context;
type = GHOST_kDrawingContextTypeOpenGL;
}
#endif
GHOST_Context *context = new GHOST_ContextCGL(false, NULL, NULL, NULL);
if (context->initializeDrawingContext())
return context;

View File

@@ -81,8 +81,7 @@ class GHOST_SystemNULL : public GHOST_System {
void getAllDisplayDimensions(uint32_t &width, uint32_t &height) const
{ /* nop */
}
GHOST_IContext *createOffscreenContext(GHOST_TDrawingContextType /* type */,
GHOST_GLSettings glSettings)
GHOST_IContext *createOffscreenContext(GHOST_GLSettings glSettings)
{
return NULL;
}

View File

@@ -139,8 +139,7 @@ uint8_t GHOST_SystemSDL::getNumDisplays() const
return SDL_GetNumVideoDisplays();
}
GHOST_IContext *GHOST_SystemSDL::createOffscreenContext(GHOST_TDrawingContextType /* type */,
GHOST_GLSettings glSettings)
GHOST_IContext *GHOST_SystemSDL::createOffscreenContext(GHOST_GLSettings glSettings)
{
GHOST_Context *context = new GHOST_ContextSDL(0,
NULL,

View File

@@ -72,8 +72,7 @@ class GHOST_SystemSDL : public GHOST_System {
void getMainDisplayDimensions(uint32_t &width, uint32_t &height) const;
GHOST_IContext *createOffscreenContext(GHOST_TDrawingContextType type,
GHOST_GLSettings glSettings);
GHOST_IContext *createOffscreenContext(GHOST_GLSettings glSettings);
GHOST_TSuccess disposeContext(GHOST_IContext *context);

View File

@@ -30,10 +30,6 @@
#include "GHOST_ContextEGL.h"
#if defined(WITH_VULKAN)
# include "GHOST_ContextVK.h"
#endif
#include <EGL/egl.h>
#include <wayland-egl.h>
@@ -1592,75 +1588,55 @@ void GHOST_SystemWayland::getAllDisplayDimensions(uint32_t &width, uint32_t &hei
getMainDisplayDimensions(width, height);
}
GHOST_IContext *GHOST_SystemWayland::createOffscreenContext(GHOST_TDrawingContextType type,
GHOST_GLSettings glSettings)
GHOST_IContext *GHOST_SystemWayland::createOffscreenContext(GHOST_GLSettings /*glSettings*/)
{
#if defined(WITH_VULKAN)
const bool debug_context = (glSettings.flags & GHOST_glDebugContext) != 0;
/* Create new off-screen window. */
wl_surface *os_surface = wl_compositor_create_surface(compositor());
wl_egl_window *os_egl_window = wl_egl_window_create(os_surface, int(1), int(1));
if (type == GHOST_kDrawingContextTypeVulkan) {
GHOST_Context *context = new GHOST_ContextVK(
false, GHOST_kVulkanPlatformWayland, 0, NULL, NULL, d->display, 1, 0, debug_context);
d->os_surfaces.push_back(os_surface);
d->os_egl_windows.push_back(os_egl_window);
if (context->initializeDrawingContext()) {
return context;
}
else {
delete context;
}
}
#else
(void)glSettings;
#endif
if (type == GHOST_kDrawingContextTypeOpenGL) {
/* Create new off-screen window. */
wl_surface *os_surface = wl_compositor_create_surface(compositor());
wl_egl_window *os_egl_window = wl_egl_window_create(os_surface, int(1), int(1));
d->os_surfaces.push_back(os_surface);
d->os_egl_windows.push_back(os_egl_window);
GHOST_Context *context;
for (int minor = 6; minor >= 0; --minor) {
context = new GHOST_ContextEGL(this,
false,
EGLNativeWindowType(os_egl_window),
EGLNativeDisplayType(d->display),
EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT,
4,
minor,
GHOST_OPENGL_EGL_CONTEXT_FLAGS,
GHOST_OPENGL_EGL_RESET_NOTIFICATION_STRATEGY,
EGL_OPENGL_API);
if (context->initializeDrawingContext())
return context;
else
delete context;
}
GHOST_Context *context;
for (int minor = 6; minor >= 0; --minor) {
context = new GHOST_ContextEGL(this,
false,
EGLNativeWindowType(os_egl_window),
EGLNativeDisplayType(d->display),
EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT,
3,
3,
4,
minor,
GHOST_OPENGL_EGL_CONTEXT_FLAGS,
GHOST_OPENGL_EGL_RESET_NOTIFICATION_STRATEGY,
EGL_OPENGL_API);
if (context->initializeDrawingContext()) {
if (context->initializeDrawingContext())
return context;
}
else {
else
delete context;
}
GHOST_PRINT("Cannot create off-screen EGL context" << std::endl);
}
context = new GHOST_ContextEGL(this,
false,
EGLNativeWindowType(os_egl_window),
EGLNativeDisplayType(d->display),
EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT,
3,
3,
GHOST_OPENGL_EGL_CONTEXT_FLAGS,
GHOST_OPENGL_EGL_RESET_NOTIFICATION_STRATEGY,
EGL_OPENGL_API);
if (context->initializeDrawingContext()) {
return context;
}
else {
delete context;
}
GHOST_PRINT("Cannot create off-screen EGL context" << std::endl);
return nullptr;
}

View File

@@ -73,8 +73,7 @@ class GHOST_SystemWayland : public GHOST_System {
void getAllDisplayDimensions(uint32_t &width, uint32_t &height) const override;
GHOST_IContext *createOffscreenContext(GHOST_TDrawingContextType type,
GHOST_GLSettings glSettings) override;
GHOST_IContext *createOffscreenContext(GHOST_GLSettings glSettings) override;
GHOST_TSuccess disposeContext(GHOST_IContext *context) override;

View File

@@ -50,15 +50,7 @@
#include "GHOST_WindowManager.h"
#include "GHOST_WindowWin32.h"
#if defined(WITH_VULKAN)
# include "GHOST_ContextVK.h"
#endif
#if defined(WITH_GL_EGL)
# include "GHOST_ContextEGL.h"
#else
# include "GHOST_ContextWGL.h"
#endif
#include "GHOST_ContextWGL.h"
#ifdef WITH_INPUT_NDOF
# include "GHOST_NDOFManagerWin32.h"
@@ -271,26 +263,10 @@ GHOST_IWindow *GHOST_SystemWin32::createWindow(const char *title,
* Never explicitly delete the window, use #disposeContext() instead.
* \return The new context (or 0 if creation failed).
*/
GHOST_IContext *GHOST_SystemWin32::createOffscreenContext(GHOST_TDrawingContextType type,
GHOST_GLSettings glSettings)
GHOST_IContext *GHOST_SystemWin32::createOffscreenContext(GHOST_GLSettings glSettings)
{
const bool debug_context = (glSettings.flags & GHOST_glDebugContext) != 0;
#if defined(WITH_VULKAN)
/* Vulkan does not need a window. */
if (type == GHOST_kDrawingContextTypeVulkan) {
GHOST_Context *context = new GHOST_ContextVK(false, (HWND)0, 1, 0, debug_context);
if (context->initializeDrawingContext()) {
return context;
}
else {
delete context;
return NULL;
}
}
#endif
GHOST_Context *context;
HWND wnd = CreateWindowA("STATIC",

View File

@@ -142,8 +142,7 @@ class GHOST_SystemWin32 : public GHOST_System {
* Never explicitly delete the window, use #disposeContext() instead.
* \return The new context (or 0 if creation failed).
*/
GHOST_IContext *createOffscreenContext(GHOST_TDrawingContextType type,
GHOST_GLSettings glSettings);
GHOST_IContext *createOffscreenContext(GHOST_GLSettings glSettings);
/**
* Dispose of a context.

View File

@@ -48,10 +48,6 @@
#include "GHOST_Debug.h"
#if defined(WITH_VULKAN)
# include "GHOST_ContextVK.h"
#endif
#if defined(WITH_GL_EGL)
# include "GHOST_ContextEGL.h"
# include <EGL/eglext.h>
@@ -398,8 +394,7 @@ GHOST_IWindow *GHOST_SystemX11::createWindow(const char *title,
* Never explicitly delete the context, use #disposeContext() instead.
* \return The new context (or 0 if creation failed).
*/
GHOST_IContext *GHOST_SystemX11::createOffscreenContext(GHOST_TDrawingContextType type,
GHOST_GLSettings glSettings)
GHOST_IContext *GHOST_SystemX11::createOffscreenContext(GHOST_GLSettings glSettings)
{
/* During development:
* try 4.x compatibility profile
@@ -413,97 +408,46 @@ GHOST_IContext *GHOST_SystemX11::createOffscreenContext(GHOST_TDrawingContextTyp
const bool debug_context = (glSettings.flags & GHOST_glDebugContext) != 0;
#if defined(WITH_VULKAN)
if (type == GHOST_kDrawingContextTypeVulkan) {
GHOST_Context *context = new GHOST_ContextVK(
false, GHOST_kVulkanPlatformX11, 0, m_display, NULL, NULL, 1, 0, debug_context);
if (context->initializeDrawingContext()) {
return context;
}
else {
delete context;
#if defined(WITH_GL_PROFILE_CORE)
{
const char *version_major = (char *)glewGetString(GLEW_VERSION_MAJOR);
if (version_major != NULL && version_major[0] == '1') {
fprintf(stderr, "Error: GLEW version 2.0 and above is required.\n");
abort();
}
}
#endif
if (type == GHOST_kDrawingContextTypeOpenGL) {
/* Final Blender 2.8:
* try 4.x core profile
* try 3.3 core profile
* no fallbacks. */
#if defined(WITH_GL_PROFILE_CORE)
{
const char *version_major = (char *)glewGetString(GLEW_VERSION_MAJOR);
if (version_major != NULL && version_major[0] == '1') {
fprintf(stderr, "Error: GLEW version 2.0 and above is required.\n");
abort();
}
}
#endif
const int profile_mask =
const int profile_mask =
#ifdef WITH_GL_EGL
# if defined(WITH_GL_PROFILE_CORE)
EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT;
EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT;
# elif defined(WITH_GL_PROFILE_COMPAT)
EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT;
EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT;
# else
# error // must specify either core or compat at build time
# endif
#else
# if defined(WITH_GL_PROFILE_CORE)
GLX_CONTEXT_CORE_PROFILE_BIT_ARB;
GLX_CONTEXT_CORE_PROFILE_BIT_ARB;
# elif defined(WITH_GL_PROFILE_COMPAT)
GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB;
GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB;
# else
# error // must specify either core or compat at build time
# endif
#endif
GHOST_Context *context;
for (int minor = 5; minor >= 0; --minor) {
#if defined(WITH_GL_EGL)
context = new GHOST_ContextEGL(this,
false,
EGLNativeWindowType(nullptr),
EGLNativeDisplayType(m_display),
profile_mask,
4,
minor,
GHOST_OPENGL_EGL_CONTEXT_FLAGS |
(false ? EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR : 0),
GHOST_OPENGL_EGL_RESET_NOTIFICATION_STRATEGY,
EGL_OPENGL_API);
#else
context = new GHOST_ContextGLX(false,
(Window)NULL,
m_display,
(GLXFBConfig)NULL,
profile_mask,
4,
minor,
GHOST_OPENGL_GLX_CONTEXT_FLAGS |
(false ? GLX_CONTEXT_DEBUG_BIT_ARB : 0),
GHOST_OPENGL_GLX_RESET_NOTIFICATION_STRATEGY);
#endif
if (context->initializeDrawingContext())
return context;
else
delete context;
}
GHOST_Context *context;
for (int minor = 5; minor >= 0; --minor) {
#if defined(WITH_GL_EGL)
context = new GHOST_ContextEGL(this,
false,
EGLNativeWindowType(nullptr),
EGLNativeDisplayType(m_display),
profile_mask,
3,
3,
4,
minor,
GHOST_OPENGL_EGL_CONTEXT_FLAGS |
(debug_context ? EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR : 0),
GHOST_OPENGL_EGL_RESET_NOTIFICATION_STRATEGY,
@@ -514,21 +458,49 @@ GHOST_IContext *GHOST_SystemX11::createOffscreenContext(GHOST_TDrawingContextTyp
m_display,
(GLXFBConfig)NULL,
profile_mask,
3,
3,
4,
minor,
GHOST_OPENGL_GLX_CONTEXT_FLAGS |
(debug_context ? GLX_CONTEXT_DEBUG_BIT_ARB : 0),
GHOST_OPENGL_GLX_RESET_NOTIFICATION_STRATEGY);
#endif
if (context->initializeDrawingContext()) {
if (context->initializeDrawingContext())
return context;
}
else {
else
delete context;
}
}
#if defined(WITH_GL_EGL)
context = new GHOST_ContextEGL(this,
false,
EGLNativeWindowType(nullptr),
EGLNativeDisplayType(m_display),
profile_mask,
3,
3,
GHOST_OPENGL_EGL_CONTEXT_FLAGS |
(debug_context ? EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR : 0),
GHOST_OPENGL_EGL_RESET_NOTIFICATION_STRATEGY,
EGL_OPENGL_API);
#else
context = new GHOST_ContextGLX(false,
(Window)NULL,
m_display,
(GLXFBConfig)NULL,
profile_mask,
3,
3,
GHOST_OPENGL_GLX_CONTEXT_FLAGS |
(debug_context ? GLX_CONTEXT_DEBUG_BIT_ARB : 0),
GHOST_OPENGL_GLX_RESET_NOTIFICATION_STRATEGY);
#endif
if (context->initializeDrawingContext())
return context;
else
delete context;
return NULL;
}

View File

@@ -152,8 +152,7 @@ class GHOST_SystemX11 : public GHOST_System {
* Never explicitly delete the context, use #disposeContext() instead.
* \return The new context (or 0 if creation failed).
*/
GHOST_IContext *createOffscreenContext(GHOST_TDrawingContextType type,
GHOST_GLSettings glSettings);
GHOST_IContext *createOffscreenContext(GHOST_GLSettings glSettings);
/**
* Dispose of a context.

View File

@@ -26,7 +26,7 @@
#include "GHOST_IWindow.h"
#include "GHOST_Context.h"
class GHOST_Context;
/**
* Platform independent implementation of GHOST_IWindow.
@@ -94,22 +94,6 @@ class GHOST_Window : public GHOST_IWindow {
return m_context != NULL;
}
/**
* Gets the Vulkan framebuffer related resource handles associated with the Vulkan context.
* Needs to be called after each swap events as the framebuffer will change.
* \return A boolean success indicator.
*/
GHOST_TSuccess getVulkanBackbuffer(void *image,
void *framebuffer,
void *command_buffer,
void *render_pass,
void *extent,
uint32_t *fb_id)
{
return m_context->getVulkanBackbuffer(
image, framebuffer, command_buffer, render_pass, extent, fb_id);
};
/**
* Returns the associated OS object/handle
* \return The associated OS object/handle
@@ -245,12 +229,6 @@ class GHOST_Window : public GHOST_IWindow {
*/
inline GHOST_TDrawingContextType getDrawingContextType();
/**
* Returns the drawing context used in this window.
* \return The drawing context.
*/
inline GHOST_IContext *getDrawingContext();
/**
* Tries to install a rendering context in this window.
* Child classes do not need to overload this method,
@@ -433,11 +411,6 @@ inline GHOST_TDrawingContextType GHOST_Window::getDrawingContextType()
return m_drawingContextType;
}
inline GHOST_IContext *GHOST_Window::getDrawingContext()
{
return m_context;
}
inline bool GHOST_Window::getCursorVisibility() const
{
return m_cursorVisible;

View File

@@ -24,10 +24,6 @@
#include "GHOST_ContextCGL.h"
#if defined(WITH_VULKAN)
# include "GHOST_ContextVK.h"
#endif
#include <Cocoa/Cocoa.h>
#include <Metal/Metal.h>
#include <QuartzCore/QuartzCore.h>
@@ -823,21 +819,8 @@ GHOST_TSuccess GHOST_WindowCocoa::setOrder(GHOST_TWindowOrder order)
GHOST_Context *GHOST_WindowCocoa::newDrawingContext(GHOST_TDrawingContextType type)
{
#ifdef WITH_VULKAN
if (type == GHOST_kDrawingContextTypeVulkan) {
GHOST_Context *context = new GHOST_ContextVK(m_wantStereoVisual, m_metalLayer, 1, 0, true);
if (context->initializeDrawingContext()) {
return context;
}
delete context;
/* Fallback to opengl. */
type = GHOST_kDrawingContextTypeOpenGL;
}
#endif
if (type == GHOST_kDrawingContextTypeOpenGL) {
GHOST_Context *context = new GHOST_ContextCGL(
m_wantStereoVisual, m_metalView, m_metalLayer, m_openGLView);

View File

@@ -26,9 +26,6 @@
#include "GHOST_ContextEGL.h"
#include "GHOST_ContextNone.h"
#if defined(WITH_VULKAN)
# include "GHOST_ContextVK.h"
#endif
#include <wayland-egl.h>
@@ -557,21 +554,6 @@ GHOST_Context *GHOST_WindowWayland::newDrawingContext(GHOST_TDrawingContextType
GHOST_OPENGL_EGL_CONTEXT_FLAGS,
GHOST_OPENGL_EGL_RESET_NOTIFICATION_STRATEGY,
EGL_OPENGL_API);
break;
#if defined(WITH_VULKAN)
case GHOST_kDrawingContextTypeVulkan:
context = new GHOST_ContextVK(m_wantStereoVisual,
GHOST_kVulkanPlatformWayland,
0,
NULL,
w->surface,
m_system->display(),
1,
0,
false);
break;
#endif
}
return (context->initializeDrawingContext() == GHOST_kSuccess) ? context : nullptr;

View File

@@ -30,15 +30,8 @@
#include "utf_winfunc.h"
#include "utfconv.h"
#if defined(WITH_VULKAN)
# include "GHOST_ContextVK.h"
#endif
#include "GHOST_ContextWGL.h"
#if defined(WITH_GL_EGL)
# include "GHOST_ContextEGL.h"
#else
# include "GHOST_ContextWGL.h"
#endif
#ifdef WIN32_COMPOSITING
# include <Dwmapi.h>
#endif
@@ -622,18 +615,6 @@ GHOST_Context *GHOST_WindowWin32::newDrawingContext(GHOST_TDrawingContextType ty
return context;
}
#if defined(WITH_VULKAN)
else if (type == GHOST_kDrawingContextTypeVulkan) {
GHOST_Context *context = new GHOST_ContextVK(false, m_hWnd, 1, 0, m_debug_context);
if (context->initializeDrawingContext()) {
return context;
}
else {
delete context;
}
}
#endif
return NULL;
}

View File

@@ -38,10 +38,6 @@
# include "GHOST_DropTargetX11.h"
#endif
#if defined(WITH_VULKAN)
# include "GHOST_ContextVK.h"
#endif
#ifdef WITH_GL_EGL
# include "GHOST_ContextEGL.h"
# include <EGL/eglext.h>
@@ -1277,38 +1273,8 @@ GHOST_WindowX11::~GHOST_WindowX11()
GHOST_Context *GHOST_WindowX11::newDrawingContext(GHOST_TDrawingContextType type)
{
#if defined(WITH_VULKAN)
if (type == GHOST_kDrawingContextTypeVulkan) {
/* Vulkan port
* try vulkan
* fallback to OGL */
GHOST_Context *context = new GHOST_ContextVK(m_wantStereoVisual,
GHOST_kVulkanPlatformX11,
m_window,
m_display,
NULL,
NULL,
1,
0,
m_is_debug_context);
if (context->initializeDrawingContext()) {
return context;
}
else {
delete context;
}
fprintf(stderr, "Error! Unsupported graphics card or driver.\n");
fprintf(stderr, "A graphics card and driver with support for Vulkan 1.0.\n");
fprintf(stderr, "You can try the `--debug-gpu' option to have more information.\n");
fprintf(stderr, "The program will now close.\n");
fflush(stderr);
exit(1);
}
#endif
if (type == GHOST_kDrawingContextTypeOpenGL) {
/* During development:
* - Try 4.x compatibility profile.
* - Try 3.3 compatibility profile.

View File

@@ -266,8 +266,6 @@ class GHOST_WindowX11 : public GHOST_Window {
XIC m_xic;
#endif
GHOST_TDrawingContextType m_context_type;
bool m_valid_setup;
bool m_is_debug_context;

View File

@@ -332,7 +332,7 @@ MainWindow *mainwindow_new(MultiTestApp *app)
if (win) {
MainWindow *mw = MEM_callocN(sizeof(*mw), "mainwindow_new");
mw->gpu_context = GPU_context_create(win, NULL);
mw->gpu_context = GPU_context_create(win);
GPU_init();
mw->app = app;
@@ -589,7 +589,7 @@ LoggerWindow *loggerwindow_new(MultiTestApp *app)
if (win) {
LoggerWindow *lw = MEM_callocN(sizeof(*lw), "loggerwindow_new");
lw->gpu_context = GPU_context_create(win, NULL);
lw->gpu_context = GPU_context_create(win);
GPU_init();
int bbox[2][2];
@@ -791,7 +791,7 @@ ExtraWindow *extrawindow_new(MultiTestApp *app)
if (win) {
ExtraWindow *ew = MEM_callocN(sizeof(*ew), "mainwindow_new");
ew->gpu_context = GPU_context_create(win, NULL);
ew->gpu_context = GPU_context_create(win);
GPU_init();
ew->app = app;

View File

@@ -1,44 +0,0 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# The Original Code is Copyright (C) 2012, Blender Foundation
# All rights reserved.
# ***** END GPL LICENSE BLOCK *****
set(INC
.
../guardedalloc
)
set(INC_SYS
${SHADERC_INCLUDE_DIRS}
)
set(SRC
intern/Compiler.cc
intern/Result.cc
intern/shaderc/ShaderCCompiler.cc
intern/shaderc/ShaderCResult.cc
shader_compiler.hh
)
set(LIB
${SHADERC_LIBRARIES}
)
blender_add_lib(bf_intern_shadercompiler "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")

View File

@@ -1,32 +0,0 @@
/*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* The Original Code is Copyright (C) 2021 by Blender Foundation.
* All rights reserved.
*/
#include "shader_compiler.hh"
#include "intern/shaderc/ShaderCCompiler.hh"
namespace shader_compiler {
Compiler *Compiler::create_default()
{
Compiler *compiler = new shaderc::ShaderCCompiler();
return compiler;
}
} // namespace shader_compiler

View File

@@ -1,29 +0,0 @@
/*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* The Original Code is Copyright (C) 2021 by Blender Foundation.
* All rights reserved.
*/
#include "shader_compiler.hh"
namespace shader_compiler {
void Result::init(const Job &job)
{
type = job.compilation_target;
}
} // namespace shader_compiler

View File

@@ -1,92 +0,0 @@
/*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* The Original Code is Copyright (C) 2021 by Blender Foundation.
* All rights reserved.
*/
#include "ShaderCCompiler.hh"
#include "ShaderCResult.hh"
#include "shaderc/shaderc.hpp"
namespace shader_compiler::shaderc {
ShaderCCompiler::ShaderCCompiler()
{
}
ShaderCCompiler::~ShaderCCompiler()
{
}
void ShaderCCompiler::set_optimization_level(::shaderc::CompileOptions options,
const OptimizationLevel new_value)
{
switch (new_value) {
case OptimizationLevel::NotOptimized:
options.SetOptimizationLevel(shaderc_optimization_level_zero);
break;
case OptimizationLevel::SizeOptimized:
options.SetOptimizationLevel(shaderc_optimization_level_size);
break;
case OptimizationLevel::SpeedOptimized:
options.SetOptimizationLevel(shaderc_optimization_level_performance);
break;
}
}
shaderc_shader_kind ShaderCCompiler::get_source_kind(SourceType source_type)
{
switch (source_type) {
case SourceType::GlslVertexShader:
return shaderc_glsl_vertex_shader;
case SourceType::GlslGeometryShader:
return shaderc_glsl_geometry_shader;
case SourceType::GlslFragmentShader:
return shaderc_glsl_fragment_shader;
case SourceType::GlslComputeShader:
return shaderc_glsl_compute_shader;
}
return shaderc_glsl_vertex_shader;
}
ShaderCResult *ShaderCCompiler::compile_spirv(const Job &job)
{
::shaderc::CompileOptions options;
set_optimization_level(options, job.optimization_level);
shaderc_shader_kind kind = get_source_kind(job.source_type);
::shaderc::SpvCompilationResult shaderc_result = compiler_.CompileGlslToSpv(
job.source.c_str(), kind, job.name.c_str(), options);
ShaderCResult *result = new ShaderCResult();
result->init(job, shaderc_result);
return result;
}
Result *ShaderCCompiler::compile(const Job &job)
{
switch (job.compilation_target) {
case TargetType::SpirV:
return compile_spirv(job);
break;
}
return nullptr;
}
} // namespace shader_compiler::shaderc

View File

@@ -1,48 +0,0 @@
/*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* The Original Code is Copyright (C) 2021 by Blender Foundation.
* All rights reserved.
*/
#pragma once
#include "shader_compiler.hh"
#include "shaderc/shaderc.hpp"
namespace shader_compiler::shaderc {
class ShaderCResult;
class ShaderCCompiler : public Compiler {
private:
::shaderc::Compiler compiler_;
public:
ShaderCCompiler();
~ShaderCCompiler() override;
Result *compile(const Job &job) override;
private:
ShaderCResult *compile_spirv(const Job &job);
static void set_optimization_level(::shaderc::CompileOptions options,
const OptimizationLevel new_value);
static shaderc_shader_kind get_source_kind(SourceType source_type);
};
} // namespace shader_compiler::shaderc

View File

@@ -1,58 +0,0 @@
/*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* The Original Code is Copyright (C) 2021 by Blender Foundation.
* All rights reserved.
*/
#include "ShaderCResult.hh"
namespace shader_compiler::shaderc {
void ShaderCResult::init(const Job &job, ::shaderc::SpvCompilationResult &shaderc_result)
{
Result::init(job);
status_code = status_code_from(shaderc_result);
switch (status_code) {
case StatusCode::Ok:
bin = {shaderc_result.cbegin(), shaderc_result.cend()};
break;
case StatusCode::CompilationError:
error_log = shaderc_result.GetErrorMessage();
break;
}
}
StatusCode ShaderCResult::status_code_from(::shaderc::SpvCompilationResult &shaderc_result)
{
if (shaderc_result.GetCompilationStatus() != shaderc_compilation_status_success) {
return StatusCode::CompilationError;
}
return StatusCode::Ok;
}
std::vector<uint32_t> ShaderCResult::bin_from(::shaderc::SpvCompilationResult &shaderc_result)
{
return {shaderc_result.cbegin(), shaderc_result.cend()};
}
std::string ShaderCResult::error_log_from(::shaderc::SpvCompilationResult &shaderc_result)
{
return shaderc_result.GetErrorMessage();
}
} // namespace shader_compiler::shaderc

View File

@@ -1,39 +0,0 @@
/*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* The Original Code is Copyright (C) 2021 by Blender Foundation.
* All rights reserved.
*/
#pragma once
#include "shader_compiler.hh"
#include "shaderc/shaderc.hpp"
namespace shader_compiler::shaderc {
class ShaderCResult : public Result {
public:
void init(const Job &job, ::shaderc::SpvCompilationResult &shaderc_result);
private:
StatusCode status_code_from(::shaderc::SpvCompilationResult &shaderc_result);
std::string error_log_from(::shaderc::SpvCompilationResult &shaderc_result);
std::vector<uint32_t> bin_from(::shaderc::SpvCompilationResult &shaderc_result);
};
} // namespace shader_compiler::shaderc

View File

@@ -1,106 +0,0 @@
/*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* The Original Code is Copyright (C) 2021 by Blender Foundation.
* All rights reserved.
*/
#pragma once
#include <stdint.h>
#include <string>
#include <vector>
#ifdef WITH_CXX_GUARDEDALLOC
# include "MEM_guardedalloc.h"
#endif
namespace shader_compiler {
enum class SourceType {
GlslVertexShader,
GlslGeometryShader,
GlslFragmentShader,
GlslComputeShader,
};
enum class TargetType {
SpirV,
// SpirVAssembly,
};
enum class OptimizationLevel {
NotOptimized,
SizeOptimized,
SpeedOptimized,
};
enum class StatusCode {
Ok,
CompilationError,
};
class Job;
class Result;
class Compiler {
protected:
Compiler(){};
public:
virtual ~Compiler(){};
static Compiler *create_default();
virtual Result *compile(const Job &job) = 0;
#ifdef WITH_CXX_GUARDEDALLOC
MEM_CXX_CLASS_ALLOC_FUNCS("ShadeCompiler:Compiler")
#endif
};
class Job {
public:
std::string name;
std::string source;
SourceType source_type;
TargetType compilation_target;
OptimizationLevel optimization_level = OptimizationLevel::NotOptimized;
#ifdef WITH_CXX_GUARDEDALLOC
MEM_CXX_CLASS_ALLOC_FUNCS("ShaderCompiler:Job")
#endif
};
class Result {
public:
TargetType type;
StatusCode status_code;
std::string error_log;
std::vector<uint32_t> bin;
virtual ~Result(){};
protected:
void init(const Job &job);
#ifdef WITH_CXX_GUARDEDALLOC
MEM_CXX_CLASS_ALLOC_FUNCS("ShaderCompiler:Result")
#endif
};
void init();
void free();
} // namespace shader_compiler

View File

@@ -8520,26 +8520,6 @@
inkscape:connector-curvature="0"
sodipodi:nodetypes="sssssssssssssss" />
</g>
<g
transform="matrix(0.92857149,0,0,0.92857137,106.93015,-501.7093)"
style="display:inline;opacity:0.98999999;fill:#ffffff;stroke-width:1.07692313;enable-background:new"
id="g8599"
inkscape:export-filename="C:\Users\Andrzej Ambroż\Desktop\mtrx.png"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96">
<path
sodipodi:nodetypes="cccccccccccssccsssss"
inkscape:connector-curvature="0"
id="path8595"
transform="matrix(1.076923,0,0,1.0769231,-739.76878,506.92345)"
d="m 992.67578,105.26367 c -0.19597,-0.18575 -0.45872,-0.28437 -0.72851,-0.27344 -0.89539,0.0396 -1.29072,1.14623 -0.62305,1.74415 L 992.69727,108 H 986 c -1.36099,-0.0279 -1.36099,2.02794 0,2 h 3.0918 c -0.003,0.002 -0.005,0.004 -0.008,0.006 l -4.75,4.24805 c -0.99479,0.88933 0.3392,2.38151 1.33399,1.49218 l 2.33984,-2.09375 C 988.08993,116.60772 990.52575,119 993.5,119 c 3.02565,0 5.49805,-2.47428 5.49805,-5.5 0,-1.56564 -0.66395,-2.97983 -1.72241,-3.98356 z M 993.5,110 c 1.94471,0 3.5,1.5551 3.5,3.5 0,1.94489 -1.55529,3.5 -3.5,3.5 -1.94472,0 -3.5,-1.55511 -3.5,-3.5 0,-1.9449 1.55528,-3.5 3.5,-3.5 z"
style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;paint-order:fill markers stroke;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate" />
<path
id="path8597"
d="m 331.99999,629.15424 a 1.86519,1.8457757 0 0 1 -1.86519,1.84577 1.86519,1.8457757 0 0 1 -1.86519,-1.84577 1.86519,1.8457757 0 0 1 1.86519,-1.84578 1.86519,1.8457757 0 0 1 1.86519,1.84578 z"
style="opacity:1;vector-effect:none;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:2.15384626;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;paint-order:fill markers stroke"
inkscape:connector-curvature="0" />
</g>
<g
id="g12575"
transform="matrix(0.8666665,0,0,0.8666665,-253.07368,16.407198)"
@@ -13729,11 +13709,6 @@
id="g16343-6"
style="display:inline;opacity:0.98999999;fill:#ffffff;enable-background:new" />
</g>
<path
inkscape:connector-curvature="0"
id="path18041"
d="m 517.0019,53.000264 c -0.47496,-0.0438 -0.94252,0.0803 -1.30468,0.35742 -0.28815,0.22047 -0.55389,0.56737 -0.6211,1.0332 -0.0672,0.46584 0.11485,1.01133 0.57227,1.46876 l 0.14648,0.14648 h -4.29297 c -0.53506,4e-5 -1.03128,0.28661 -1.29883,0.75 -0.26752,0.46339 -0.26752,1.03661 0,1.5 0.26755,0.46339 0.76375,0.75 1.29883,0.75 h 0.79297 l -2.64648,2.64648 c -0.79091,0.79079 -0.84722,1.93194 -0.29297,2.65625 0.22044,0.28814 0.56748,0.55402 1.0332,0.6211 0.46572,0.0671 1.0091,-0.11342 1.4668,-0.57031 l 1.4043,-1.40235 c 0.55515,1.96585 2.10614,3.53021 4.16406,3.94141 2.37442,0.47444 4.78539,-0.66388 5.92773,-2.79883 1.14235,-2.13495 0.75134,-4.77035 -0.96094,-6.48242 a 0.50005,0.50005 0 0 0 -0.002,-0.004 l -4.0332,-3.96094 c -0.39539,-0.39541 -0.87856,-0.60853 -1.35352,-0.65234 z m -0.0957,1.00195 c 0.24304,0.0198 0.50958,0.1248 0.74219,0.35743 a 0.50005,0.50005 0 0 0 0.004,0.002 l 4.03125,3.96289 c 1.40369,1.40351 1.72164,3.55449 0.78516,5.30469 -0.93648,1.7502 -2.90114,2.678 -4.84766,2.28906 -1.9465,-0.38894 -3.40679,-2.00407 -3.60937,-3.97266 a 0.50005,0.50005 0 0 0 -0.85156,-0.30273 l -2.01172,2.00976 c -0.29296,0.29245 -0.47153,0.30809 -0.61719,0.28711 -0.14566,-0.021 -0.29945,-0.12932 -0.38281,-0.23828 -0.21096,-0.27568 -0.25826,-0.87658 0.20703,-1.34179 l 3.5,-3.5 a 0.50005,0.50005 0 0 0 -0.35352,-0.85352 h -2 c -0.17943,0 -0.34387,-0.0946 -0.43359,-0.25 -0.0897,-0.15539 -0.0897,-0.34461 0,-0.5 0.0897,-0.15539 0.25413,-0.24999 0.43359,-0.25 h 5.5 a 0.50005,0.50005 0 0 0 0.35352,-0.85352 l -1,-1 c -0.29258,-0.29257 -0.31008,-0.47147 -0.28906,-0.61718 0.021,-0.14571 0.13127,-0.29945 0.24023,-0.38282 0.13784,-0.10546 0.35657,-0.17021 0.59961,-0.15039 z m 1.5957,5.00391 c -1.37479,0 -2.5,1.12521 -2.5,2.5 0,1.37479 1.12521,2.5 2.5,2.5 1.37479,0 2.5,-1.12521 2.5,-2.5 0,-1.37479 -1.12521,-2.5 -2.5,-2.5 z m 0,1 c 0.83435,0 1.5,0.66565 1.5,1.5 0,0.83435 -0.66565,1.5 -1.5,1.5 -0.83435,0 -1.5,-0.66565 -1.5,-1.5 0,-0.83435 0.66565,-1.5 1.5,-1.5 z"
style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:0.98999999;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;paint-order:fill markers stroke;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate" />
<path
id="path14479-6"
style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.99999994;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;paint-order:fill markers stroke;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:new"
@@ -17373,6 +17348,107 @@
d="m 417.92349,304.73964 c -0.7818,-0.0644 -0.86293,1.09626 -0.0796,1.1383 l 0.41758,0.0202 c 0.78182,0.0644 0.86296,-1.09626 0.0796,-1.13831 z m -7.87437,1.29265 c -0.65325,0.42724 0.0163,1.38626 0.65667,0.94062 l 0.34001,-0.23929 c 0.65327,-0.42727 -0.0163,-1.38631 -0.65662,-0.94061 z m 5.26412,-0.10772 c 0.785,-0.0185 0.73895,-1.18175 -0.0451,-1.14009 -0.6811,-0.0652 -1.43225,-0.0213 -2.22341,0.0851 -0.785,0.0185 -0.73896,1.18176 0.0451,1.14011 0.8585,-0.10954 1.60282,-0.14009 2.22342,-0.0852 z m -5.74172,5.34858 c -0.17789,-0.75187 -1.32618,-0.47161 -1.12597,0.27482 -0.008,0.72815 0.18352,1.43475 0.53595,2.12392 0.17789,0.75187 1.32617,0.47159 1.12598,-0.27483 -0.40688,-0.70818 -0.47775,-1.41605 -0.53596,-2.12391 z m 1.14987,4.81425 c 0.55238,0.5479 1.3799,-0.2833 0.81165,-0.81524 l -0.30437,-0.28193 c -0.55238,-0.54789 -1.37991,0.2833 -0.81163,0.81524 z m 2.55883,0.11471 c -0.78112,0.0716 -0.65484,1.22767 0.12391,1.13446 0.79706,0.0708 1.5429,0.0136 2.2124,-0.23372 0.7811,-0.0716 0.65482,-1.22768 -0.12391,-1.13445 -0.66955,0.35373 -1.42049,0.37687 -2.2124,0.23371 z m 4.35036,-1.24066 c 0.39775,-0.66505 -0.63058,-1.23994 -1.00859,-0.56384 l -0.19953,0.36135 c -0.39776,0.66506 0.63057,1.23995 1.00857,0.56383 z m -1.53457,-4.82813 c -0.44444,-0.63566 -1.409,0.0364 -0.94666,0.65956 0.53116,0.53126 0.99257,1.10609 1.28624,1.78569 0.44445,0.63565 1.40902,-0.0364 0.94667,-0.65956 -0.24301,-0.74231 -0.69323,-1.32054 -1.28625,-1.78569 z m -2.73483,-1.49223 c -0.72218,-0.30138 -1.16808,0.7761 -0.43732,1.05681 l 0.39025,0.14758 c 0.7222,0.30141 1.1681,-0.7761 0.43732,-1.0568 z m -7.60223,1.91562 c -0.52109,0.57678 0.37464,1.33651 0.87855,0.74515 l 0.26685,-0.31654 c 0.52111,-0.57679 -0.37465,-1.33654 -0.87854,-0.74516 z m 1.15912,7.09355 c -0.1906,-0.74845 -1.33363,-0.44917 -1.12109,0.29354 l 0.11543,0.39523 c 0.19062,0.74845 1.33365,0.44917 1.12109,-0.29354 z m -0.68592,-4.36328 c -0.0858,-0.76698 -1.25912,-0.62352 -1.15127,0.14077 -0.065,0.75431 -0.008,1.50847 0.28594,2.26232 0.0859,0.76696 1.25912,0.62352 1.15129,-0.14076 -0.28468,-0.81162 -0.29126,-1.53878 -0.28596,-2.26233 z m 1.97398,-4.7241 c -0.77314,0.13162 -0.55483,1.27463 0.21417,1.12135 0.7762,-0.30633 1.5005,-0.42412 2.18687,-0.40397 0.77313,-0.13163 0.55482,-1.27462 -0.21418,-1.12137 -0.74152,0.0229 -1.4733,0.13255 -2.18686,0.40399 z"
style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1.15052;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:2.2;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:new"
id="path4101-2-6-9-1_GP_dotdash" />
<g
id="g4112">
<g
transform="matrix(0.55059923,0,0,0.55059916,233.59783,-262.1787)"
style="display:inline;opacity:0.99;fill:#ffffff;stroke-width:1.07692;enable-background:new"
id="g8599"
inkscape:export-filename="C:\Users\Andrzej Ambroż\Desktop\mtrx.png"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96">
<path
id="path8597"
d="m 331.99999,629.15424 a 1.86519,1.8457757 0 0 1 -1.86519,1.84577 1.86519,1.8457757 0 0 1 -1.86519,-1.84577 1.86519,1.8457757 0 0 1 1.86519,-1.84578 1.86519,1.8457757 0 0 1 1.86519,1.84578 z"
style="opacity:1;vector-effect:none;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:2.15385;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;paint-order:fill markers stroke"
inkscape:connector-curvature="0" />
</g>
<path
sodipodi:nodetypes="cccccccccccssccsssss"
inkscape:connector-curvature="0"
id="path8595"
d="m 414.89176,79.34933 c -0.1162,-0.110141 -0.272,-0.168618 -0.43197,-0.162137 -0.53092,0.02348 -0.76534,0.67966 -0.36944,1.034198 l 0.81415,0.750454 h -3.97116 c -0.807,-0.01654 -0.807,1.202473 0,1.185905 h 1.83329 c -0.002,0.0012 -0.003,0.0024 -0.005,0.0036 l -2.81653,2.518894 c -0.58986,0.527331 0.20113,1.412123 0.79099,0.884793 l 1.38742,-1.241496 c 0.0488,1.752319 1.49313,3.170828 3.25672,3.170828 1.79406,0 3.26008,-1.467132 3.26008,-3.261241 0,-0.928351 -0.39369,-1.766899 -1.02131,-2.362064 z m 0.48873,2.80842 c 1.15312,0 2.07533,0.922102 2.07533,2.075336 0,1.153228 -0.92221,2.075335 -2.07533,2.075335 -1.15313,0 -2.07534,-0.922107 -2.07534,-2.075335 0,-1.153234 0.92221,-2.075336 2.07534,-2.075336 z"
style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1.18591;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;paint-order:fill markers stroke;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate" />
<g
style="display:inline;fill:#ffffff;enable-background:new"
id="g15543-3"
transform="translate(21.029034,-20.999943)">
<g
id="g15520-6"
transform="translate(231.97182,-397.99995)"
style="display:inline;opacity:0.6;fill:#ffffff;enable-background:new"
inkscape:export-filename="C:\Users\Andrzej Ambroż\Desktop\mtrx.png"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96">
<g
id="g4103">
<path
style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:new"
d="m 430.48047,53 c -0.15153,0.004 -0.29304,0.07659 -0.38477,0.197266 l -3.94922,3.949218 C 425.83169,57.461484 426.05468,57.99983 426.5,58 h 4 c 0.27613,-3e-5 0.49997,-0.22387 0.5,-0.5 V 54 h 6 v 3.5 c -0.01,0.676161 1.00956,0.676161 1,0 v -4 c -3e-5,-0.276131 -0.22387,-0.499972 -0.5,-0.5 h -7 c -0.005,-6.2e-5 -0.009,-6.2e-5 -0.0137,0 -6.7e-4,1.8e-5 -0.001,-2.1e-5 -0.002,0 -0.001,4.1e-5 -0.003,-5e-5 -0.004,0 z M 426,59.000004 V 66.5 c 3e-5,0.276131 0.22387,0.499972 0.5,0.5 h 4.25 c 0.67616,0.0096 0.67616,-1.009563 0,-1 H 427 v -6.999996 z"
transform="translate(-273.99999,439.99994)"
id="path15514-7"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccccccccccccccccccccccc" />
</g>
</g>
</g>
</g>
<g
id="g4115"
transform="matrix(1.1626173,0,0,1.1626173,-76.104888,-15.461598)">
<g
id="g4081"
transform="matrix(0.83071001,0,0,0.85634802,340.90207,-327.16835)"
style="display:inline;opacity:0.6;fill:#ffffff;enable-background:new"
inkscape:export-filename="C:\Users\Andrzej Ambroż\Desktop\mtrx.png"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96">
<path
style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:new"
d="m 164.00001,502.51502 v 3.48493 h -10 v -6 h -1 v 6.5 c 3e-5,0.27613 0.22387,0.49997 0.5,0.5 h 11 c 0.27613,-3e-5 0.49997,-0.22387 0.5,-0.5 v -3.98493 c 0,-0.20663 -0.12519,-0.386 -0.5,-0.386 -0.35128,0 -0.5,0.17937 -0.5,0.386 z m 1,-8.21753 v -0.79754 c -3e-5,-0.27613 -0.22387,-0.49997 -0.5,-0.5 h -6 c -0.005,-6e-5 -0.009,-6e-5 -0.0137,0 -6.7e-4,2e-5 -0.001,-2e-5 -0.002,0 -0.001,4e-5 -0.003,-5e-5 -0.004,0 h 1.7e-4 c -0.15153,0.004 -0.29304,0.0766 -0.38477,0.19727 l -4.94922,4.94921 c -0.31479,0.315 -0.0918,0.85335 0.35352,0.85352 h 5 c 0.27613,-3e-5 0.49997,-0.22387 0.5,-0.5 v -4.5 h 5 v 0.2975 c 0,0.23264 0.20298,0.33811 0.5,0.33811 0.34336,0 0.5,-0.1072 0.5,-0.33807 z"
id="path4079"
inkscape:connector-curvature="0"
sodipodi:nodetypes="sccccccccssscccccccccccccccscc" />
</g>
<g
style="display:inline;fill:#ffffff;enable-background:new"
inkscape:export-ydpi="96"
inkscape:export-xdpi="96"
inkscape:export-filename="C:\Users\Andrzej Ambroż\Desktop\mtrx.png"
transform="matrix(0.56694736,0,0,0.56694736,277.87149,-171.0587)"
id="g12839-3">
<path
style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:new"
d="m 353.13867,473.0332 c -0.49613,-0.0451 -1.03862,0.15972 -1.49219,0.61328 l -0.75,0.75 c -0.19519,0.19527 -0.19519,0.51177 0,0.70704 l 3,3 c 0.19527,0.19519 0.51177,0.19519 0.70704,0 l 0.75,-0.75 c 0.45356,-0.45357 0.65838,-0.99606 0.61328,-1.49219 -0.0451,-0.49613 -0.30436,-0.90592 -0.61328,-1.21485 l -1,-1 c -0.30893,-0.30892 -0.71872,-0.56817 -1.21485,-0.61328 z m -3.39644,2.7168 c -0.12989,0.002 -0.25387,0.0546 -0.34571,0.14648 l -6.25,6.25 c -0.0639,0.0642 -0.10909,0.14453 -0.13086,0.23243 l -1,4 c -0.0904,0.36537 0.2401,0.69582 0.60547,0.60547 l 4,-1 c 0.0879,-0.0218 0.16823,-0.067 0.23243,-0.13086 l 6.25,-6.25 c 0.19519,-0.19527 0.19519,-0.51177 0,-0.70704 l -3,-3 c -0.0957,-0.0957 -0.22605,-0.14856 -0.36137,-0.14648 z"
id="path12837-6"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccccccscccccccccccccccc" />
</g>
</g>
<g
id="g4125"
transform="translate(1.6871136,-0.5076635)">
<path
inkscape:connector-curvature="0"
id="path18041"
d="m 517.77147,58.722239 c -0.2809,-0.0259 -0.5574,0.04749 -0.77158,0.211377 -0.17042,0.130386 -0.32757,0.335543 -0.36733,0.611033 -0.0396,0.275496 0.0679,0.598097 0.33844,0.868617 l 0.0866,0.08662 h -2.53884 c -0.31644,2.9e-5 -0.60991,0.1695 -0.76813,0.44355 -0.1582,0.274049 -0.1582,0.61305 0,0.8871 0.15822,0.274039 0.45168,0.44354 0.76813,0.44354 h 0.46895 l -1.56512,1.565122 c -0.46774,0.467671 -0.50105,1.142542 -0.17326,1.570897 0.13038,0.170405 0.33561,0.327646 0.61103,0.367321 0.27542,0.03967 0.59678,-0.06708 0.86747,-0.337281 l 0.83049,-0.829342 c 0.32831,1.162599 1.24557,2.08775 2.46262,2.330933 1.40423,0.280582 2.83006,-0.392618 3.50563,-1.655214 0.6756,-1.262608 0.44435,-2.821177 -0.56829,-3.83369 a 0.29572815,0.29572815 0 0 0 -9.4e-4,-0.0019 l -2.38521,-2.342487 c -0.23385,-0.233844 -0.51957,-0.359883 -0.80048,-0.385791 z m -0.0567,0.592551 c 0.14373,0.01171 0.30137,0.0738 0.43893,0.211383 a 0.29572815,0.29572815 0 0 0 0.002,0.0013 l 2.38407,2.343643 c 0.83014,0.830032 1.01818,2.102118 0.46434,3.137175 -0.55382,1.035068 -1.71572,1.583769 -2.86689,1.35375 -1.15115,-0.230019 -2.01477,-1.185201 -2.13458,-2.349424 a 0.29572815,0.29572815 0 0 0 -0.50361,-0.179037 l -1.18971,1.188575 c -0.17327,0.172952 -0.27888,0.182198 -0.36501,0.169792 -0.0861,-0.01244 -0.17709,-0.07651 -0.22639,-0.140918 -0.12477,-0.163036 -0.15274,-0.518409 0.12244,-0.793527 l 2.06987,-2.069891 a 0.29572815,0.29572815 0 0 0 -0.20906,-0.504769 h -1.1828 c -0.10611,0 -0.20337,-0.0559 -0.25643,-0.147851 -0.0529,-0.09187 -0.0529,-0.203798 0,-0.295699 0.053,-0.09188 0.1503,-0.14784 0.25643,-0.14785 h 3.2527 a 0.29572815,0.29572815 0 0 0 0.20906,-0.504769 l -0.5914,-0.591399 c -0.17302,-0.173025 -0.18336,-0.278826 -0.17094,-0.364998 0.0124,-0.08618 0.0776,-0.177095 0.14206,-0.226399 0.0815,-0.06238 0.21088,-0.100658 0.35461,-0.08895 z m 0.94369,2.959298 c -0.81305,0 -1.47849,0.665441 -1.47849,1.47849 0,0.813049 0.66544,1.478491 1.47849,1.478491 0.81305,0 1.47849,-0.665442 1.47849,-1.478491 0,-0.813049 -0.66544,-1.47849 -1.47849,-1.47849 z m 0,0.5914 c 0.49344,0 0.8871,0.393657 0.8871,0.88709 0,0.493434 -0.39366,0.887101 -0.8871,0.887101 -0.49343,0 -0.88709,-0.393667 -0.88709,-0.887101 0,-0.493433 0.39366,-0.88709 0.88709,-0.88709 z"
style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:0.99;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.591397;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;paint-order:fill markers stroke;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate" />
<g
id="g4092"
transform="translate(356.31374,-439.49223)"
style="display:inline;opacity:0.6;fill:#ffffff;enable-background:new"
inkscape:export-filename="C:\Users\Andrzej Ambroż\Desktop\mtrx.png"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96">
<path
style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:new"
d="m 430.48047,53 c -0.15153,0.004 -0.29304,0.07659 -0.38477,0.197266 l -3.94922,3.949218 C 425.83169,57.461484 426.05468,57.99983 426.5,58 h 4 c 0.27613,-3e-5 0.49997,-0.22387 0.5,-0.5 V 54 h 6 v 3.5 c -0.01,0.676161 1.00956,0.676161 1,0 v -4 c -3e-5,-0.276131 -0.22387,-0.499972 -0.5,-0.5 h -7 c -0.005,-6.2e-5 -0.009,-6.2e-5 -0.0137,0 -6.7e-4,1.8e-5 -0.001,-2.1e-5 -0.002,0 -0.001,4.1e-5 -0.003,-5e-5 -0.004,0 z M 426,59.000004 V 66.5 c 3e-5,0.276131 0.22387,0.499972 0.5,0.5 h 4.25 c 0.67616,0.0096 0.67616,-1.009563 0,-1 H 427 v -6.999996 z"
transform="translate(-273.99999,439.99994)"
id="path4090"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccccccccccccccccccccccc" />
</g>
</g>
</g>
<g
inkscape:groupmode="layer"

Before

Width:  |  Height:  |  Size: 2.5 MiB

After

Width:  |  Height:  |  Size: 2.5 MiB

View File

@@ -166,7 +166,7 @@ class ScalarBlendModifier(StrokeShader):
v1 = facm * v1 + fac * v1 / v2 if v2 != 0.0 else v1
elif self.blend_type == 'DIFFERENCE':
v1 = facm * v1 + fac * abs(v1 - v2)
elif self.blend_type == 'MININUM':
elif self.blend_type == 'MINIMUM':
v1 = min(fac * v2, v1)
elif self.blend_type == 'MAXIMUM':
v1 = max(fac * v2, v1)

View File

@@ -721,6 +721,10 @@ class NODE_PT_overlay(Panel):
col.prop(snode, "show_annotation", text="Annotations")
if snode.tree_type == 'GeometryNodeTree':
col.separator()
col.prop(overlay, "show_timing", text="Timings")
class NODE_UL_interface_sockets(bpy.types.UIList):
def draw_item(self, context, layout, _data, item, icon, _active_data, _active_propname, _index):

View File

@@ -1818,7 +1818,7 @@ class USERPREF_PT_addons(AddOnPanel, Panel):
bl_options = {'HIDE_HEADER'}
_support_icon_mapping = {
'OFFICIAL': 'FILE_BLEND',
'OFFICIAL': 'BLENDER',
'COMMUNITY': 'COMMUNITY',
'TESTING': 'EXPERIMENTAL',
}

View File

@@ -50,6 +50,10 @@ void BKE_object_defgroup_active_index_set(struct Object *ob, const int new_index
const struct ListBase *BKE_id_defgroup_list_get(const struct ID *id);
struct ListBase *BKE_id_defgroup_list_get_mutable(struct ID *id);
int BKE_id_defgroup_name_index(const struct ID *id, const char *name);
bool BKE_id_defgroup_name_find(const struct ID *id,
const char *name,
int *r_index,
struct bDeformGroup **r_group);
struct bDeformGroup *BKE_object_defgroup_new(struct Object *ob, const char *name);
void BKE_defgroup_copy_list(struct ListBase *outbase, const struct ListBase *inbase);

View File

@@ -158,8 +158,7 @@ enum {
G_DEBUG_XR = (1 << 19), /* XR/OpenXR messages */
G_DEBUG_XR_TIME = (1 << 20), /* XR/OpenXR timing messages */
G_DEBUG_GHOST = (1 << 21), /* Debug GHOST module. */
G_DEBUG_VK_CONTEXT = (1 << 22), /* not a debug flag, TODO move it. */
G_DEBUG_GHOST = (1 << 21), /* Debug GHOST module. */
};
#define G_DEBUG_ALL \

View File

@@ -557,11 +557,35 @@ bDeformGroup *BKE_object_defgroup_find_name(const Object *ob, const char *name)
int BKE_id_defgroup_name_index(const ID *id, const char *name)
{
if (name == NULL || name[0] == '\0') {
int index;
if (!BKE_id_defgroup_name_find(id, name, &index, NULL)) {
return -1;
}
return index;
}
bool BKE_id_defgroup_name_find(const struct ID *id,
const char *name,
int *r_index,
struct bDeformGroup **r_group)
{
if (name == NULL || name[0] == '\0') {
return false;
}
const ListBase *defbase = BKE_id_defgroup_list_get(id);
return BLI_findstringindex(defbase, name, offsetof(bDeformGroup, name));
int index;
LISTBASE_FOREACH_INDEX (bDeformGroup *, group, defbase, index) {
if (STREQ(name, group->name)) {
if (r_index != NULL) {
*r_index = index;
}
if (r_group != NULL) {
*r_group = group;
}
return true;
}
}
return false;
}
const ListBase *BKE_object_defgroup_list(const Object *ob)

View File

@@ -1127,16 +1127,19 @@ class VertexGroupsAttributeProvider final : public DynamicAttributesProvider {
}
const std::string name = attribute_id.name();
const int vertex_group_index = BLI_findstringindex(
&mesh->vertex_group_names, name.c_str(), offsetof(bDeformGroup, name));
if (vertex_group_index < 0) {
int index;
bDeformGroup *group;
if (!BKE_id_defgroup_name_find(&mesh->id, name.c_str(), &index, &group)) {
return false;
}
BLI_remlink(&mesh->vertex_group_names, group);
MEM_freeN(group);
if (mesh->dvert == nullptr) {
return true;
}
for (MDeformVert &dvert : MutableSpan(mesh->dvert, mesh->totvert)) {
MDeformWeight *weight = BKE_defvert_find_index(&dvert, vertex_group_index);
MDeformWeight *weight = BKE_defvert_find_index(&dvert, index);
BKE_defvert_remove_group(&dvert, weight);
}
return true;

View File

@@ -170,7 +170,7 @@ TEST(virtual_array, MutableToImmutable)
EXPECT_TRUE(varray.is_span());
EXPECT_EQ(varray.size(), 4);
EXPECT_EQ(varray[1], 2);
EXPECT_EQ(mutable_varray.size(), 0);
EXPECT_EQ(mutable_varray.size(), 0); /* NOLINT: bugprone-use-after-move */
}
{
VArray<int> varray = VMutableArray<int>::ForSpan(array);

View File

@@ -1321,13 +1321,16 @@ static void version_liboverride_rnacollections_insertion_object_constraints(
opop->subitem_local_name,
offsetof(bConstraint, name),
opop->subitem_local_index);
if (constraint_anchor == NULL || constraint_anchor->next == NULL) {
bConstraint *constraint_src = constraint_anchor != NULL ? constraint_anchor->next :
constraints->first;
if (constraint_src == NULL) {
/* Invalid case, just remove that override property operation. */
CLOG_ERROR(&LOG, "Could not find anchor or source constraints in stored override data");
CLOG_ERROR(&LOG, "Could not find source constraint in stored override data");
BKE_lib_override_library_property_operation_delete(op, opop);
continue;
}
bConstraint *constraint_src = constraint_anchor->next;
opop->subitem_reference_name = opop->subitem_local_name;
opop->subitem_local_name = BLI_strdup(constraint_src->name);
opop->subitem_reference_index = opop->subitem_local_index;
@@ -1350,13 +1353,15 @@ static void version_liboverride_rnacollections_insertion_object(Object *object)
opop->subitem_local_name,
offsetof(ModifierData, name),
opop->subitem_local_index);
if (mod_anchor == NULL || mod_anchor->next == NULL) {
ModifierData *mod_src = mod_anchor != NULL ? mod_anchor->next : object->modifiers.first;
if (mod_src == NULL) {
/* Invalid case, just remove that override property operation. */
CLOG_ERROR(&LOG, "Could not find anchor or source modifiers in stored override data");
CLOG_ERROR(&LOG, "Could not find source modifier in stored override data");
BKE_lib_override_library_property_operation_delete(op, opop);
continue;
}
ModifierData *mod_src = mod_anchor->next;
opop->subitem_reference_name = opop->subitem_local_name;
opop->subitem_local_name = BLI_strdup(mod_src->name);
opop->subitem_reference_index = opop->subitem_local_index;
@@ -1375,13 +1380,17 @@ static void version_liboverride_rnacollections_insertion_object(Object *object)
opop->subitem_local_name,
offsetof(GpencilModifierData, name),
opop->subitem_local_index);
if (gp_mod_anchor == NULL || gp_mod_anchor->next == NULL) {
GpencilModifierData *gp_mod_src = gp_mod_anchor != NULL ?
gp_mod_anchor->next :
object->greasepencil_modifiers.first;
if (gp_mod_src == NULL) {
/* Invalid case, just remove that override property operation. */
CLOG_ERROR(&LOG, "Could not find anchor GP modifier in stored override data");
CLOG_ERROR(&LOG, "Could not find source GP modifier in stored override data");
BKE_lib_override_library_property_operation_delete(op, opop);
continue;
}
GpencilModifierData *gp_mod_src = gp_mod_anchor->next;
opop->subitem_reference_name = opop->subitem_local_name;
opop->subitem_local_name = BLI_strdup(gp_mod_src->name);
opop->subitem_reference_index = opop->subitem_local_index;
@@ -2395,6 +2404,12 @@ void blo_do_versions_300(FileData *fd, Library *UNUSED(lib), Main *bmain)
* \note Keep this message at the bottom of the function.
*/
{
LISTBASE_FOREACH (bNodeTree *, ntree, &bmain->nodetrees) {
if (ntree->type == NTREE_GEOMETRY) {
version_node_output_socket_name(
ntree, GEO_NODE_STRING_TO_CURVES, "Curves", "Curve Instances");
}
}
/* Keep this block, even when empty. */
}
}

View File

@@ -530,7 +530,7 @@ if(WITH_GTESTS)
set(TEST_SRC
tests/draw_testing.cc
tests/shaders_test.cc
tests/performance_test.cc
tests/draw_testing.hh
)
set(TEST_INC

View File

@@ -612,7 +612,7 @@ static void eevee_lightbake_context_enable(EEVEE_LightBake *lbake)
if (lbake->gl_context) {
DRW_opengl_render_context_enable(lbake->gl_context);
if (lbake->gpu_context == NULL) {
lbake->gpu_context = GPU_context_create(NULL, lbake->gl_context);
lbake->gpu_context = GPU_context_create(NULL);
}
DRW_gpu_render_context_enable(lbake->gpu_context);
}

View File

@@ -29,6 +29,7 @@
#include "BKE_animsys.h"
#include "BKE_camera.h"
#include "BKE_duplilist.h"
#include "BKE_object.h"
#include "BKE_screen.h"
@@ -318,6 +319,14 @@ void EEVEE_motion_blur_cache_populate(EEVEE_ViewLayerData *UNUSED(sldata),
return;
}
const DupliObject *dup = DRW_object_get_dupli(ob);
if (dup != NULL && dup->ob->data != dup->ob_data) {
/* Geometry instances do not support motion blur correctly yet. The #key used in
* #motion_blur_deform_data_get has to take ids of instances (#DupliObject.persistent_id) into
* account. Otherwise it can't find matching geometry instances at different points in time. */
return;
}
EEVEE_ObjectMotionData *mb_data = EEVEE_motion_blur_object_data_get(
&effects->motion_blur, ob, false);

View File

@@ -59,7 +59,7 @@ void main()
{
ivec2 tex_size = textureSize(cocBuffer, 0);
int t_id = gl_VertexIndex / 3; /* Triangle Id */
int t_id = gl_VertexID / 3; /* Triangle Id */
/* Some math to get the target pixel. */
ivec2 texelco = ivec2(t_id % spritePerRow, t_id / spritePerRow) * 2;
@@ -118,7 +118,7 @@ void main()
*/
/* Generate Triangle : less memory fetches from a VBO */
int v_id = gl_VertexIndex % 3; /* Vertex Id */
int v_id = gl_VertexID % 3; /* Vertex Id */
gl_Position.x = float(v_id / 2) * extend - 1.0; /* int divisor round down */
gl_Position.y = float(v_id % 2) * extend - 1.0;
gl_Position.z = 0.0;

View File

@@ -30,8 +30,8 @@ const vec2 pos[6] = vec2[6](vec2(-1.0, -1.0),
void main()
{
pid = 1 + (gl_VertexIndex / 6); /* +1 for the world */
int vert_id = gl_VertexIndex % 6;
pid = 1 + (gl_VertexID / 6); /* +1 for the world */
int vert_id = gl_VertexID % 6;
quadCoord = pos[vert_id];

View File

@@ -23,8 +23,8 @@ const vec2 pos[6] = vec2[6](vec2(-1.0, -1.0),
void main()
{
int cell_id = gl_VertexIndex / 6;
int vert_id = gl_VertexIndex % 6;
int cell_id = gl_VertexID / 6;
int vert_id = gl_VertexID % 6;
vec3 ls_cell_location;
/* Keep in sync with update_irradiance_probe */

View File

@@ -4,9 +4,9 @@ out vec2 vPos;
void main()
{
int v = gl_VertexIndex % 3;
int v = gl_VertexID % 3;
vPos.x = -1.0 + float((v & 1) << 2);
vPos.y = -1.0 + float((v & 2) << 1);
instance = gl_VertexIndex / 3;
instance = gl_VertexID / 3;
}

View File

@@ -8,8 +8,8 @@ RESOURCE_ID_VARYING
void main()
{
/* Generate Triangle : less memory fetches from a VBO */
int v_id = gl_VertexIndex % 3; /* Vertex Id */
int t_id = gl_VertexIndex / 3; /* Triangle Id */
int v_id = gl_VertexID % 3; /* Vertex Id */
int t_id = gl_VertexID / 3; /* Triangle Id */
/* Crappy diagram
* ex 1

View File

@@ -5,7 +5,7 @@ out vec4 offset[3];
void main()
{
int v = gl_VertexIndex % 3;
int v = gl_VertexID % 3;
float x = -1.0 + float((v & 1) << 2);
float y = -1.0 + float((v & 2) << 1);
gl_Position = vec4(x, y, 1.0, 1.0);

View File

@@ -245,7 +245,7 @@ in vec4 col1;
in vec4 col2;
in vec4 fcol1;
/* WARNING: Max attribute count is actually 14 because OSX OpenGL implementation
* considers gl_VertexIndex and gl_InstanceID as vertex attribute. (see T74536) */
* considers gl_VertexID and gl_InstanceID as vertex attribute. (see T74536) */
# define stroke_id1 ma1.y
# define point_id1 ma1.z
# define thickness1 pos1.w
@@ -408,8 +408,8 @@ void stroke_vertex()
mat4 model_mat = model_matrix_get();
/* Avoid using a vertex attribute for quad positioning. */
float x = float(gl_VertexIndex & 1) * 2.0 - 1.0; /* [-1..1] */
float y = float(gl_VertexIndex & 2) - 1.0; /* [-1..1] */
float x = float(gl_VertexID & 1) * 2.0 - 1.0; /* [-1..1] */
float y = float(gl_VertexID & 2) - 1.0; /* [-1..1] */
bool use_curr = is_dot || (x == -1.0);

View File

@@ -4,7 +4,7 @@ uniform vec4 gpModelMatrix[4];
void main()
{
mat4 model_matrix = mat4(gpModelMatrix[0], gpModelMatrix[1], gpModelMatrix[2], gpModelMatrix[3]);
int v = gl_VertexIndex % 3;
int v = gl_VertexID % 3;
float x = -1.0 + float((v & 1) << 2);
float y = -1.0 + float((v & 2) << 1);
gl_Position = ViewProjectionMatrix * (model_matrix * vec4(x, y, 0.0, 1.0));

View File

@@ -3,7 +3,7 @@ out vec2 uvs;
void main()
{
int v = gl_VertexIndex % 3;
int v = gl_VertexID % 3;
float x = float((v & 1) << 2);
float y = float((v & 2) << 1);
gl_Position = vec4(x - 1.0, y - 1.0, 1.0, 1.0);

View File

@@ -3,7 +3,7 @@ uniform vec3 boundbox[8];
void main()
{
vec3 world_pos = boundbox[gl_VertexIndex];
vec3 world_pos = boundbox[gl_VertexID];
gl_Position = point_world_to_ndc(world_pos);
/* Result in a position at 1.0 (far plane). Small epsilon to avoid precision issue.

View File

@@ -16,7 +16,7 @@ void main()
float flip = (gl_InstanceID != 0) ? -1.0 : 1.0;
if (gl_VertexIndex % 2 == 0) {
if (gl_VertexID % 2 == 0) {
final_pos += normalSize * rad * (flip * nor - tan);
}

View File

@@ -14,8 +14,8 @@ void main()
GPU_INTEL_VERTEX_SHADER_WORKAROUND
vec2 pos;
pos.x = float(gl_VertexIndex % 2);
pos.y = float(gl_VertexIndex / 2) / float(halfLineCount - 1);
pos.x = float(gl_VertexID % 2);
pos.y = float(gl_VertexID / 2) / float(halfLineCount - 1);
if (pos.y > 1.0) {
pos.xy = pos.yx;

View File

@@ -17,7 +17,7 @@ void main()
vec4 pos_4d = ModelMatrix * vec4(local_pos + screen_pos, 1.0);
gl_Position = ViewProjectionMatrix * pos_4d;
/* Manual stipple: one segment out of 2 is transparent. */
finalColor = ((gl_VertexIndex & 1) == 0) ? colorSkinRoot : vec4(0.0);
finalColor = ((gl_VertexID & 1) == 0) ? colorSkinRoot : vec4(0.0);
#ifdef USE_WORLD_CLIP_PLANES
world_clip_planes_calc_clip_distance(pos_4d.xyz);

View File

@@ -37,9 +37,9 @@ void main()
vec3 ls_cell_location;
/* Keep in sync with update_irradiance_probe */
ls_cell_location.z = float(gl_VertexIndex % grid_resolution.z);
ls_cell_location.y = float((gl_VertexIndex / grid_resolution.z) % grid_resolution.y);
ls_cell_location.x = float(gl_VertexIndex / (grid_resolution.z * grid_resolution.y));
ls_cell_location.z = float(gl_VertexID % grid_resolution.z);
ls_cell_location.y = float((gl_VertexID / grid_resolution.z) % grid_resolution.y);
ls_cell_location.x = float(gl_VertexID / (grid_resolution.z * grid_resolution.y));
ls_cell_location += 0.5;
ls_cell_location /= vec3(grid_resolution);

View File

@@ -225,7 +225,7 @@ void main()
/* HACK: to avoid losing sub-pixel object in selections, we add a bit of randomness to the
* wire to at least create one fragment that will pass the occlusion query. */
/* TODO(fclem): Limit this workaround to selection. It's not very noticeable but still... */
gl_Position.xy += sizeViewportInv.xy * gl_Position.w * ((gl_VertexIndex % 2 == 0) ? -1.0 : 1.0);
gl_Position.xy += sizeViewportInv.xy * gl_Position.w * ((gl_VertexID % 2 == 0) ? -1.0 : 1.0);
#endif
#ifdef USE_WORLD_CLIP_PLANES

View File

@@ -21,7 +21,7 @@ void main()
/* HACK: to avoid losing sub-pixel object in selections, we add a bit of randomness to the
* wire to at least create one fragment that will pass the occlusion query. */
/* TODO(fclem): Limit this workaround to selection. It's not very noticeable but still... */
gl_Position.xy += sizeViewportInv.xy * gl_Position.w * ((gl_VertexIndex % 2 == 0) ? -1.0 : 1.0);
gl_Position.xy += sizeViewportInv.xy * gl_Position.w * ((gl_VertexID % 2 == 0) ? -1.0 : 1.0);
#endif
stipple_coord = stipple_start = screen_position(gl_Position);

View File

@@ -28,7 +28,7 @@ void main()
ssPos = proj(gl_Position);
int frame = gl_VertexIndex + cacheStart;
int frame = gl_VertexID + cacheStart;
float intensity; /* how faint */

View File

@@ -21,14 +21,14 @@ void main()
gl_Position = ViewProjectionMatrix * vec4(pos, 1.0);
gl_PointSize = float(pointSize + 2);
int frame = gl_VertexIndex + cacheStart;
int frame = gl_VertexID + cacheStart;
bool use_custom_color = customColor.x >= 0.0;
finalColor = (use_custom_color) ? vec4(customColor, 1.0) : vec4(1.0);
/* Bias to reduce z fighting with the path */
gl_Position.z -= 1e-4;
if (gl_VertexIndex % stepSize == 0) {
if (gl_VertexID % stepSize == 0) {
gl_PointSize = float(pointSize) + 4;
}

View File

@@ -61,7 +61,7 @@ vec4 flag_to_color(uint flag)
void main()
{
int cell = gl_VertexIndex / 8;
int cell = gl_VertexID / 8;
mat3 rot_mat = mat3(0.0);
vec3 cell_offset = vec3(0.5);
@@ -113,7 +113,7 @@ void main()
#endif
vec3 pos = domainOriginOffset + cellSize * (vec3(cell_co + adaptiveCellOffset) + cell_offset);
vec3 rotated_pos = rot_mat * corners[indices[gl_VertexIndex % 8]];
vec3 rotated_pos = rot_mat * corners[indices[gl_VertexID % 8]];
pos += rotated_pos * cellSize;
vec3 world_pos = point_object_to_world(pos);

View File

@@ -118,11 +118,11 @@ vec3 get_vector_mac(ivec3 cell_co)
void main()
{
#ifdef USE_NEEDLE
int cell = gl_VertexIndex / 12;
int cell = gl_VertexID / 12;
#elif defined(USE_MAC)
int cell = gl_VertexIndex / 6;
int cell = gl_VertexID / 6;
#else
int cell = gl_VertexIndex / 2;
int cell = gl_VertexID / 2;
#endif
ivec3 volume_size = textureSize(velocityX, 0);
@@ -156,7 +156,7 @@ void main()
vec3 color;
vector = (isCellCentered) ? get_vector_mac(cell_co) : get_vector(cell_co);
switch (gl_VertexIndex % 6) {
switch (gl_VertexID % 6) {
case 0: /* Tail of X component. */
pos.x += (drawMACX) ? -0.5 * cellSize.x : 0.0;
color = vec3(1.0, 0.0, 0.0); /* red */
@@ -201,12 +201,12 @@ void main()
mat3 rot_mat = rotation_from_vector(vector);
# ifdef USE_NEEDLE
vec3 rotated_pos = rot_mat * corners[indices[gl_VertexIndex % 12]];
vec3 rotated_pos = rot_mat * corners[indices[gl_VertexID % 12]];
pos += rotated_pos * vector_length * displaySize * cellSize;
# else
vec3 rotated_pos = rot_mat * vec3(0.0, 0.0, 1.0);
pos += ((gl_VertexIndex % 2) == 1) ? rotated_pos * vector_length * displaySize * cellSize :
vec3(0.0);
pos += ((gl_VertexID % 2) == 1) ? rotated_pos * vector_length * displaySize * cellSize :
vec3(0.0);
# endif
#endif

View File

@@ -156,7 +156,7 @@ void main()
#ifdef SELECT_EDGES
/* HACK: to avoid losing sub-pixel object in selections, we add a bit of randomness to the
* wire to at least create one fragment that will pass the occlusion query. */
gl_Position.xy += sizeViewportInv.xy * gl_Position.w * ((gl_VertexIndex % 2 == 0) ? -1.0 : 1.0);
gl_Position.xy += sizeViewportInv.xy * gl_Position.w * ((gl_VertexID % 2 == 0) ? -1.0 : 1.0);
#endif
#ifdef USE_WORLD_CLIP_PLANES

View File

@@ -5,7 +5,7 @@ out vec4 offset[3];
void main()
{
int v = gl_VertexIndex % 3;
int v = gl_VertexID % 3;
float x = -1.0 + float((v & 1) << 2);
float y = -1.0 + float((v & 2) << 1);
gl_Position = vec4(x, y, 1.0, 1.0);

View File

@@ -22,12 +22,6 @@
#pragma once
#include "BKE_mesh_types.h"
#ifdef __cplusplus
extern "C" {
#endif
struct GPUBatch;
struct GPUIndexBuf;
struct GPUMaterial;
@@ -47,6 +41,12 @@ struct PointCloud;
struct Volume;
struct bGPdata;
#include "BKE_mesh_types.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Expose via BKE callbacks */
void DRW_mball_batch_cache_dirty_tag(struct MetaBall *mb, int mode);
void DRW_mball_batch_cache_validate(struct MetaBall *mb);

View File

@@ -1367,6 +1367,61 @@ void DRW_notify_view_update(const DRWUpdateContext *update_ctx)
BLI_ticket_mutex_unlock(DST.gl_context_mutex);
}
/* update a viewport which belongs to a GPUOffscreen */
static void DRW_notify_view_update_offscreen(struct Depsgraph *depsgraph,
RenderEngineType *engine_type,
ARegion *region,
View3D *v3d,
GPUViewport *viewport)
{
if (viewport && GPU_viewport_do_update(viewport)) {
Scene *scene = DEG_get_evaluated_scene(depsgraph);
ViewLayer *view_layer = DEG_get_evaluated_view_layer(depsgraph);
RegionView3D *rv3d = region->regiondata;
const bool gpencil_engine_needed = drw_gpencil_engine_needed(depsgraph, v3d);
/* Reset before using it. */
drw_state_prepare_clean_for_draw(&DST);
DST.draw_ctx = (DRWContextState){
.region = region,
.rv3d = rv3d,
.v3d = v3d,
.scene = scene,
.view_layer = view_layer,
.obact = OBACT(view_layer),
.engine_type = engine_type,
.depsgraph = depsgraph,
};
/* Custom lightweight initialize to avoid resetting the memory-pools. */
DST.viewport = viewport;
DST.vmempool = drw_viewport_data_ensure(DST.viewport);
/* Separate update for each stereo view. */
int view_count = GPU_viewport_is_stereo_get(viewport) ? 2 : 1;
for (int view = 0; view < view_count; view++) {
DST.view_data_active = DST.vmempool->view_data[view];
drw_engines_enable(view_layer, engine_type, gpencil_engine_needed);
drw_engines_data_validate();
DRW_ENABLED_ENGINE_ITER (DST.view_data_active, draw_engine, data) {
if (draw_engine->view_update) {
draw_engine->view_update(data);
}
}
drw_engines_disable();
}
drw_manager_exit(&DST);
}
}
/** \} */
/* -------------------------------------------------------------------- */
@@ -1742,11 +1797,14 @@ void DRW_draw_render_loop_offscreen(struct Depsgraph *depsgraph,
GPUOffScreen *ofs,
GPUViewport *viewport)
{
/* Create temporary viewport if needed. */
/* Create temporary viewport if needed or update the existing viewport. */
GPUViewport *render_viewport = viewport;
if (viewport == NULL) {
render_viewport = GPU_viewport_create();
}
else {
DRW_notify_view_update_offscreen(depsgraph, engine_type, region, v3d, render_viewport);
}
GPU_viewport_bind_from_offscreen(render_viewport, ofs);
@@ -3108,7 +3166,7 @@ void DRW_opengl_context_create(void)
DST.gl_context = WM_opengl_context_create();
WM_opengl_context_activate(DST.gl_context);
/* Be sure to create gpu_context too. */
DST.gpu_context = GPU_context_create(NULL, DST.gl_context);
DST.gpu_context = GPU_context_create(NULL);
/* So we activate the window's one afterwards. */
wm_window_reset_drawable();
}

Some files were not shown because too many files have changed in this diff Show More