Compare commits
92 Commits
temp-gpu-t
...
tmp-vulkan
Author | SHA1 | Date | |
---|---|---|---|
b40787115b | |||
fc502a8710 | |||
d944b969f0 | |||
8e43757834 | |||
b65df10346 | |||
8bf8db8ca2 | |||
5bd7a2c416 | |||
8c3e8d0eb6 | |||
8bfdec76c0 | |||
9cc5075680 | |||
2ea8725339 | |||
a55bbedc06 | |||
5d52da2e65 | |||
25b341a4ae | |||
dfa5bc25ae | |||
ddd64ba03a | |||
0b3caae8a7 | |||
b1d5950471 | |||
99886f91a9 | |||
fa00caba88 | |||
f853163a54 | |||
87492f93a4 | |||
6152113b45 | |||
2741a4106a | |||
3420792ea8 | |||
3eaddb4da8 | |||
1a85a68a5e | |||
adba79a04f | |||
c73894ea5b | |||
48360afb10 | |||
0493a32803 | |||
79346fd72e | |||
44c875f59a | |||
a68be3b3c2 | |||
c124606d70 | |||
975b09e3e7 | |||
15ac620204 | |||
983f61e9c5 | |||
ed959cd912 | |||
193a17474e | |||
5b246fd4b3 | |||
f7d7a5aad7 | |||
8b68ee3a17 | |||
230b24159e | |||
a5a01cc0c3 | |||
e7b3a7028b | |||
fced6f19be | |||
402e19ddc8 | |||
af2bc8be40 | |||
72bce1be8e | |||
d390f01e48 | |||
0956a5134a | |||
9a08daae92 | |||
dd4405121c | |||
b996cc6440 | |||
0bcd24c0c4 | |||
12e88ee722 | |||
b908c3fa0a | |||
ef8e53c15b | |||
639829ea1a | |||
0ef5c14de0 | |||
26fd1c71e1 | |||
de062ffd10 | |||
fc0f409911 | |||
c72e6c25d7 | |||
816bd8bed6 | |||
47613a40f5 | |||
ea5a70973d | |||
70c0f652de | |||
e70dcde88b | |||
6d82ae3581 | |||
99fc68bf6a | |||
3efdb3f232 | |||
193cebd3c2 | |||
bdeca237ff | |||
a08d242acd | |||
5629ff5f69 | |||
eb23ecd1b3 | |||
a02da40732 | |||
bd0c1d8c53 | |||
73b585b0b2 | |||
b549b1f477 | |||
c155c10888 | |||
bc86701b58 | |||
6dc1d823ba | |||
392e744ed5 | |||
f56af0b899 | |||
78cbcccf34 | |||
b671b33871 | |||
be9dc493a4 | |||
8dec7e5219 | |||
b79e7f92bf |
@@ -12,8 +12,6 @@ Checks: >
|
||||
-readability-avoid-const-params-in-decls,
|
||||
-readability-simplify-boolean-expr,
|
||||
-readability-make-member-function-const,
|
||||
-readability-suspicious-call-argument,
|
||||
-readability-redundant-member-init,
|
||||
|
||||
-readability-misleading-indentation,
|
||||
|
||||
@@ -27,8 +25,6 @@ Checks: >
|
||||
-bugprone-branch-clone,
|
||||
-bugprone-macro-parentheses,
|
||||
-bugprone-reserved-identifier,
|
||||
-bugprone-easily-swappable-parameters,
|
||||
-bugprone-implicit-widening-of-multiplication-result,
|
||||
|
||||
-bugprone-sizeof-expression,
|
||||
-bugprone-integer-division,
|
||||
@@ -44,8 +40,7 @@ Checks: >
|
||||
-modernize-pass-by-value,
|
||||
# Cannot be enabled yet, because using raw string literals in tests breaks
|
||||
# the windows compiler currently.
|
||||
-modernize-raw-string-literal,
|
||||
-modernize-return-braced-init-list
|
||||
-modernize-raw-string-literal
|
||||
|
||||
CheckOptions:
|
||||
- key: modernize-use-default-member-init.UseAssignment
|
||||
|
@@ -187,13 +187,6 @@ mark_as_advanced(CPACK_OVERRIDE_PACKAGENAME)
|
||||
mark_as_advanced(BUILDINFO_OVERRIDE_DATE)
|
||||
mark_as_advanced(BUILDINFO_OVERRIDE_TIME)
|
||||
|
||||
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.16")
|
||||
option(WITH_UNITY_BUILD "Enable unity build for modules that support it to improve compile times" ON)
|
||||
mark_as_advanced(WITH_UNITY_BUILD)
|
||||
else()
|
||||
set(WITH_UNITY_BUILD OFF)
|
||||
endif()
|
||||
|
||||
option(WITH_IK_ITASC "Enable ITASC IK solver (only disable for development & for incompatible C++ compilers)" ON)
|
||||
option(WITH_IK_SOLVER "Enable Legacy IK solver (only disable for development)" ON)
|
||||
option(WITH_FFTW3 "Enable FFTW3 support (Used for smoke, ocean sim, and audio effects)" ON)
|
||||
@@ -502,8 +495,7 @@ endif()
|
||||
|
||||
# This should be turned off when Blender enter beta/rc/release
|
||||
if("${BLENDER_VERSION_CYCLE}" STREQUAL "release" OR
|
||||
"${BLENDER_VERSION_CYCLE}" STREQUAL "rc" OR
|
||||
"${BLENDER_VERSION_CYCLE}" STREQUAL "beta")
|
||||
"${BLENDER_VERSION_CYCLE}" STREQUAL "rc")
|
||||
set(WITH_EXPERIMENTAL_FEATURES OFF)
|
||||
else()
|
||||
set(WITH_EXPERIMENTAL_FEATURES ON)
|
||||
@@ -522,9 +514,13 @@ 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 and gawain (temporary option for development purposes)" ON)
|
||||
option(WITH_OPENGL "When off limits visibility of the opengl headers to just bf_gpu (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)
|
||||
@@ -534,6 +530,7 @@ mark_as_advanced(
|
||||
WITH_GLEW_ES
|
||||
WITH_GL_EGL
|
||||
WITH_GL_PROFILE_ES20
|
||||
WITH_VULKAN_SHADER_COMPILATION
|
||||
)
|
||||
|
||||
if(WIN32)
|
||||
@@ -1134,6 +1131,18 @@ 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.
|
||||
|
||||
|
66
build_files/cmake/Modules/FindShaderC.cmake
Normal file
66
build_files/cmake/Modules/FindShaderC.cmake
Normal file
@@ -0,0 +1,66 @@
|
||||
# - 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)
|
@@ -102,6 +102,11 @@ 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)
|
||||
|
@@ -874,5 +874,32 @@ 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)
|
||||
|
@@ -106,6 +106,24 @@ 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
|
||||
|
@@ -1103,7 +1103,6 @@ context_type_map = {
|
||||
"selectable_objects": ("Object", True),
|
||||
"selected_asset_files": ("FileSelectEntry", True),
|
||||
"selected_bones": ("EditBone", True),
|
||||
"selected_editable_actions": ("Action", True),
|
||||
"selected_editable_bones": ("EditBone", True),
|
||||
"selected_editable_fcurves": ("FCurve", True),
|
||||
"selected_editable_keyframes": ("Keyframe", True),
|
||||
@@ -1119,7 +1118,6 @@ context_type_map = {
|
||||
"selected_pose_bones": ("PoseBone", True),
|
||||
"selected_pose_bones_from_active_object": ("PoseBone", True),
|
||||
"selected_sequences": ("Sequence", True),
|
||||
"selected_visible_actions": ("Action", True),
|
||||
"selected_visible_fcurves": ("FCurve", True),
|
||||
"sequences": ("Sequence", True),
|
||||
"soft_body": ("SoftBodyModifier", False),
|
||||
|
4
extern/CMakeLists.txt
vendored
4
extern/CMakeLists.txt
vendored
@@ -116,3 +116,7 @@ endif()
|
||||
if (WITH_COMPOSITOR)
|
||||
add_subdirectory(smaa_areatex)
|
||||
endif()
|
||||
|
||||
if(WITH_VULKAN)
|
||||
add_subdirectory(vulkan_memory_allocator)
|
||||
endif()
|
||||
|
1
extern/hipew/include/hipew.h
vendored
1
extern/hipew/include/hipew.h
vendored
@@ -1333,7 +1333,6 @@ enum {
|
||||
HIPEW_SUCCESS = 0,
|
||||
HIPEW_ERROR_OPEN_FAILED = -1,
|
||||
HIPEW_ERROR_ATEXIT_FAILED = -2,
|
||||
HIPEW_ERROR_OLD_DRIVER = -3,
|
||||
};
|
||||
|
||||
enum {
|
||||
|
38
extern/hipew/src/hipew.c
vendored
38
extern/hipew/src/hipew.c
vendored
@@ -214,36 +214,6 @@ 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
|
||||
@@ -271,14 +241,6 @@ 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);
|
||||
|
||||
|
42
extern/vulkan_memory_allocator/CMakeLists.txt
vendored
Normal file
42
extern/vulkan_memory_allocator/CMakeLists.txt
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
# ***** 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()
|
19
extern/vulkan_memory_allocator/LICENSE.txt
vendored
Normal file
19
extern/vulkan_memory_allocator/LICENSE.txt
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
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.
|
5
extern/vulkan_memory_allocator/README.blender
vendored
Normal file
5
extern/vulkan_memory_allocator/README.blender
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
Project: VulkanMemoryAllocator
|
||||
URL: https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator
|
||||
License: MIT
|
||||
Upstream version: 4b047fd
|
||||
Local modifications: None
|
134
extern/vulkan_memory_allocator/README.md
vendored
Normal file
134
extern/vulkan_memory_allocator/README.md
vendored
Normal file
@@ -0,0 +1,134 @@
|
||||
# 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: [](https://ci.appveyor.com/project/adam-sawicki-amd/vulkanmemoryallocator/branch/master)
|
||||
- Linux: [](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.
|
19560
extern/vulkan_memory_allocator/vk_mem_alloc.h
vendored
Normal file
19560
extern/vulkan_memory_allocator/vk_mem_alloc.h
vendored
Normal file
File diff suppressed because it is too large
Load Diff
3
extern/vulkan_memory_allocator/vk_mem_alloc_impl.cc
vendored
Normal file
3
extern/vulkan_memory_allocator/vk_mem_alloc_impl.cc
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
#define VMA_IMPLEMENTATION
|
||||
|
||||
#include "vk_mem_alloc.h"
|
@@ -85,3 +85,7 @@ endif()
|
||||
if(UNIX AND NOT APPLE)
|
||||
add_subdirectory(libc_compat)
|
||||
endif()
|
||||
|
||||
if(WITH_VULKAN)
|
||||
add_subdirectory(shader_compiler)
|
||||
endif()
|
||||
|
@@ -429,7 +429,7 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
|
||||
)
|
||||
|
||||
direct_light_sampling_type: EnumProperty(
|
||||
name="Direct Light Sampling",
|
||||
name="Direct Light Sampling Type",
|
||||
description="The type of strategy used for sampling direct light contributions",
|
||||
items=enum_direct_light_sampling_type,
|
||||
default='MULTIPLE_IMPORTANCE_SAMPLING',
|
||||
@@ -790,7 +790,7 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
|
||||
)
|
||||
|
||||
use_auto_tile: BoolProperty(
|
||||
name="Use Tiling",
|
||||
name="Using Tiling",
|
||||
description="Render high resolution images in tiles to reduce memory usage, using the specified tile size. Tiles are cached to disk while rendering to save memory",
|
||||
default=True,
|
||||
)
|
||||
|
@@ -1819,38 +1819,37 @@ class CYCLES_RENDER_PT_debug(CyclesDebugButtonsPanel, Panel):
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
layout.use_property_split = True
|
||||
layout.use_property_decorate = False # No animation.
|
||||
|
||||
scene = context.scene
|
||||
cscene = scene.cycles
|
||||
|
||||
col = layout.column(heading="CPU")
|
||||
col = layout.column()
|
||||
|
||||
col.label(text="CPU Flags:")
|
||||
row = col.row(align=True)
|
||||
row.prop(cscene, "debug_use_cpu_sse2", toggle=True)
|
||||
row.prop(cscene, "debug_use_cpu_sse3", toggle=True)
|
||||
row.prop(cscene, "debug_use_cpu_sse41", toggle=True)
|
||||
row.prop(cscene, "debug_use_cpu_avx", toggle=True)
|
||||
row.prop(cscene, "debug_use_cpu_avx2", toggle=True)
|
||||
col.prop(cscene, "debug_bvh_layout", text="BVH")
|
||||
col.prop(cscene, "debug_bvh_layout")
|
||||
|
||||
col.separator()
|
||||
|
||||
col = layout.column(heading="CUDA")
|
||||
col = layout.column()
|
||||
col.label(text="CUDA Flags:")
|
||||
col.prop(cscene, "debug_use_cuda_adaptive_compile")
|
||||
col = layout.column(heading="OptiX")
|
||||
col.prop(cscene, "debug_use_optix_debug", text="Module Debug")
|
||||
|
||||
col.separator()
|
||||
|
||||
col.prop(cscene, "debug_bvh_type", text="Viewport BVH")
|
||||
col = layout.column()
|
||||
col.label(text="OptiX Flags:")
|
||||
col.prop(cscene, "debug_use_optix_debug")
|
||||
|
||||
col.separator()
|
||||
|
||||
import _cycles
|
||||
if _cycles.with_debug:
|
||||
col.prop(cscene, "direct_light_sampling_type")
|
||||
col = layout.column()
|
||||
col.prop(cscene, "debug_bvh_type")
|
||||
|
||||
|
||||
class CYCLES_RENDER_PT_simplify(CyclesButtonsPanel, Panel):
|
||||
|
@@ -819,14 +819,11 @@ void BlenderSync::sync_hair(BL::Depsgraph b_depsgraph, BObjectInfo &b_ob_info, H
|
||||
new_hair.set_used_shaders(used_shaders);
|
||||
|
||||
if (view_layer.use_hair) {
|
||||
#ifdef WITH_HAIR_NODES
|
||||
if (b_ob_info.object_data.is_a(&RNA_Hair)) {
|
||||
/* Hair object. */
|
||||
sync_hair(&new_hair, b_ob_info, false);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
else {
|
||||
/* Particle hair. */
|
||||
bool need_undeformed = new_hair.need_attribute(scene, ATTR_STD_GENERATED);
|
||||
BL::Mesh b_mesh = object_to_mesh(
|
||||
@@ -873,15 +870,12 @@ void BlenderSync::sync_hair_motion(BL::Depsgraph b_depsgraph,
|
||||
|
||||
/* Export deformed coordinates. */
|
||||
if (ccl::BKE_object_is_deform_modified(b_ob_info, b_scene, preview)) {
|
||||
#ifdef WITH_HAIR_NODES
|
||||
if (b_ob_info.object_data.is_a(&RNA_Hair)) {
|
||||
/* Hair object. */
|
||||
sync_hair(hair, b_ob_info, true, motion_step);
|
||||
return;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
else {
|
||||
/* Particle hair. */
|
||||
BL::Mesh b_mesh = object_to_mesh(
|
||||
b_data, b_ob_info, b_depsgraph, false, Mesh::SUBDIVISION_NONE);
|
||||
|
@@ -31,11 +31,7 @@ CCL_NAMESPACE_BEGIN
|
||||
|
||||
static Geometry::Type determine_geom_type(BObjectInfo &b_ob_info, bool use_particle_hair)
|
||||
{
|
||||
#ifdef WITH_HAIR_NODES
|
||||
if (b_ob_info.object_data.is_a(&RNA_Hair) || use_particle_hair) {
|
||||
#else
|
||||
if (use_particle_hair) {
|
||||
#endif
|
||||
return Geometry::HAIR;
|
||||
}
|
||||
|
||||
@@ -219,11 +215,7 @@ void BlenderSync::sync_geometry_motion(BL::Depsgraph &b_depsgraph,
|
||||
if (progress.get_cancel())
|
||||
return;
|
||||
|
||||
#ifdef WITH_HAIR_NODES
|
||||
if (b_ob_info.object_data.is_a(&RNA_Hair) || use_particle_hair) {
|
||||
#else
|
||||
if (use_particle_hair) {
|
||||
#endif
|
||||
Hair *hair = static_cast<Hair *>(geom);
|
||||
sync_hair_motion(b_depsgraph, b_ob_info, hair, motion_step);
|
||||
}
|
||||
|
@@ -1054,13 +1054,5 @@ void *CCL_python_module_init()
|
||||
Py_INCREF(Py_False);
|
||||
}
|
||||
|
||||
#ifdef WITH_CYCLES_DEBUG
|
||||
PyModule_AddObject(mod, "with_debug", Py_True);
|
||||
Py_INCREF(Py_True);
|
||||
#else /* WITH_CYCLES_DEBUG */
|
||||
PyModule_AddObject(mod, "with_debug", Py_False);
|
||||
Py_INCREF(Py_False);
|
||||
#endif /* WITH_CYCLES_DEBUG */
|
||||
|
||||
return (void *)mod;
|
||||
}
|
||||
|
@@ -57,16 +57,9 @@ bool device_hip_init()
|
||||
}
|
||||
}
|
||||
else {
|
||||
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";
|
||||
}
|
||||
VLOG(1) << "HIPEW initialization failed: "
|
||||
<< ((hipew_result == HIPEW_ERROR_ATEXIT_FAILED) ? "Error setting up atexit() handler" :
|
||||
"Error opening the library");
|
||||
}
|
||||
|
||||
return result;
|
||||
|
@@ -208,15 +208,11 @@ bool OptiXDevice::load_kernels(const uint kernel_features)
|
||||
}
|
||||
else {
|
||||
module_options.optLevel = OPTIX_COMPILE_OPTIMIZATION_LEVEL_3;
|
||||
module_options.debugLevel = OPTIX_COMPILE_DEBUG_LEVEL_NONE;
|
||||
module_options.debugLevel = OPTIX_COMPILE_DEBUG_LEVEL_LINEINFO;
|
||||
}
|
||||
|
||||
module_options.boundValues = nullptr;
|
||||
module_options.numBoundValues = 0;
|
||||
# if OPTIX_ABI_VERSION >= 55
|
||||
module_options.payloadTypes = nullptr;
|
||||
module_options.numPayloadTypes = 0;
|
||||
# endif
|
||||
|
||||
OptixPipelineCompileOptions pipeline_options = {};
|
||||
/* Default to no motion blur and two-level graph, since it is the fastest option. */
|
||||
@@ -231,11 +227,7 @@ bool OptiXDevice::load_kernels(const uint kernel_features)
|
||||
pipeline_options.usesPrimitiveTypeFlags = OPTIX_PRIMITIVE_TYPE_FLAGS_TRIANGLE;
|
||||
if (kernel_features & KERNEL_FEATURE_HAIR) {
|
||||
if (kernel_features & KERNEL_FEATURE_HAIR_THICK) {
|
||||
# if OPTIX_ABI_VERSION >= 55
|
||||
pipeline_options.usesPrimitiveTypeFlags |= OPTIX_PRIMITIVE_TYPE_FLAGS_ROUND_CATMULLROM;
|
||||
# else
|
||||
pipeline_options.usesPrimitiveTypeFlags |= OPTIX_PRIMITIVE_TYPE_FLAGS_ROUND_CUBIC_BSPLINE;
|
||||
# endif
|
||||
}
|
||||
else
|
||||
pipeline_options.usesPrimitiveTypeFlags |= OPTIX_PRIMITIVE_TYPE_FLAGS_CUSTOM;
|
||||
@@ -332,13 +324,7 @@ bool OptiXDevice::load_kernels(const uint kernel_features)
|
||||
if (kernel_features & KERNEL_FEATURE_HAIR_THICK) {
|
||||
/* Built-in thick curve intersection. */
|
||||
OptixBuiltinISOptions builtin_options = {};
|
||||
# if OPTIX_ABI_VERSION >= 55
|
||||
builtin_options.builtinISModuleType = OPTIX_PRIMITIVE_TYPE_ROUND_CATMULLROM;
|
||||
builtin_options.buildFlags = OPTIX_BUILD_FLAG_PREFER_FAST_TRACE;
|
||||
builtin_options.curveEndcapFlags = OPTIX_CURVE_ENDCAP_DEFAULT; /* Disable endcaps. */
|
||||
# else
|
||||
builtin_options.builtinISModuleType = OPTIX_PRIMITIVE_TYPE_ROUND_CUBIC_BSPLINE;
|
||||
# endif
|
||||
builtin_options.usesMotionBlur = false;
|
||||
|
||||
optix_assert(optixBuiltinISModuleGet(
|
||||
@@ -425,7 +411,7 @@ bool OptiXDevice::load_kernels(const uint kernel_features)
|
||||
link_options.debugLevel = OPTIX_COMPILE_DEBUG_LEVEL_FULL;
|
||||
}
|
||||
else {
|
||||
link_options.debugLevel = OPTIX_COMPILE_DEBUG_LEVEL_NONE;
|
||||
link_options.debugLevel = OPTIX_COMPILE_DEBUG_LEVEL_LINEINFO;
|
||||
}
|
||||
|
||||
if (kernel_features & KERNEL_FEATURE_NODE_RAYTRACE) {
|
||||
@@ -1192,15 +1178,6 @@ void OptiXDevice::build_bvh(BVH *bvh, Progress &progress, bool refit)
|
||||
int ka = max(k0 - 1, curve.first_key);
|
||||
int kb = min(k1 + 1, curve.first_key + curve.num_keys - 1);
|
||||
|
||||
index_data[i] = i * 4;
|
||||
float4 *const v = vertex_data.data() + step * num_vertices + index_data[i];
|
||||
|
||||
# if OPTIX_ABI_VERSION >= 55
|
||||
v[0] = make_float4(keys[ka].x, keys[ka].y, keys[ka].z, curve_radius[ka]);
|
||||
v[1] = make_float4(keys[k0].x, keys[k0].y, keys[k0].z, curve_radius[k0]);
|
||||
v[2] = make_float4(keys[k1].x, keys[k1].y, keys[k1].z, curve_radius[k1]);
|
||||
v[3] = make_float4(keys[kb].x, keys[kb].y, keys[kb].z, curve_radius[kb]);
|
||||
# else
|
||||
const float4 px = make_float4(keys[ka].x, keys[k0].x, keys[k1].x, keys[kb].x);
|
||||
const float4 py = make_float4(keys[ka].y, keys[k0].y, keys[k1].y, keys[kb].y);
|
||||
const float4 pz = make_float4(keys[ka].z, keys[k0].z, keys[k1].z, keys[kb].z);
|
||||
@@ -1213,6 +1190,8 @@ void OptiXDevice::build_bvh(BVH *bvh, Progress &progress, bool refit)
|
||||
static const float4 cr2bsp2 = make_float4(+1, -4, 11, -2) / 6.f;
|
||||
static const float4 cr2bsp3 = make_float4(-2, +5, -4, +7) / 6.f;
|
||||
|
||||
index_data[i] = i * 4;
|
||||
float4 *const v = vertex_data.data() + step * num_vertices + index_data[i];
|
||||
v[0] = make_float4(
|
||||
dot(cr2bsp0, px), dot(cr2bsp0, py), dot(cr2bsp0, pz), dot(cr2bsp0, pw));
|
||||
v[1] = make_float4(
|
||||
@@ -1221,7 +1200,6 @@ void OptiXDevice::build_bvh(BVH *bvh, Progress &progress, bool refit)
|
||||
dot(cr2bsp2, px), dot(cr2bsp2, py), dot(cr2bsp2, pz), dot(cr2bsp2, pw));
|
||||
v[3] = make_float4(
|
||||
dot(cr2bsp3, px), dot(cr2bsp3, py), dot(cr2bsp3, pz), dot(cr2bsp3, pw));
|
||||
# endif
|
||||
}
|
||||
else {
|
||||
BoundBox bounds = BoundBox::empty;
|
||||
@@ -1263,11 +1241,7 @@ void OptiXDevice::build_bvh(BVH *bvh, Progress &progress, bool refit)
|
||||
OptixBuildInput build_input = {};
|
||||
if (hair->curve_shape == CURVE_THICK) {
|
||||
build_input.type = OPTIX_BUILD_INPUT_TYPE_CURVES;
|
||||
# if OPTIX_ABI_VERSION >= 55
|
||||
build_input.curveArray.curveType = OPTIX_PRIMITIVE_TYPE_ROUND_CATMULLROM;
|
||||
# else
|
||||
build_input.curveArray.curveType = OPTIX_PRIMITIVE_TYPE_ROUND_CUBIC_BSPLINE;
|
||||
# endif
|
||||
build_input.curveArray.numPrimitives = num_segments;
|
||||
build_input.curveArray.vertexBuffers = (CUdeviceptr *)vertex_ptrs.data();
|
||||
build_input.curveArray.numVertices = num_vertices;
|
||||
@@ -1448,12 +1422,9 @@ void OptiXDevice::build_bvh(BVH *bvh, Progress &progress, bool refit)
|
||||
instance.sbtOffset = PG_HITD_MOTION - PG_HITD;
|
||||
}
|
||||
}
|
||||
# if OPTIX_ABI_VERSION < 55
|
||||
/* Cannot disable any-hit program for thick curves, since it needs to filter out endcaps. */
|
||||
else
|
||||
# endif
|
||||
{
|
||||
/* Can disable __anyhit__kernel_optix_visibility_test by default.
|
||||
else {
|
||||
/* Can disable __anyhit__kernel_optix_visibility_test by default (except for thick curves,
|
||||
* since it needs to filter out end-caps there).
|
||||
* It is enabled where necessary (visibility mask exceeds 8 bits or the other any-hit
|
||||
* programs like __anyhit__kernel_optix_shadow_all_hit) via OPTIX_RAY_FLAG_ENFORCE_ANYHIT.
|
||||
*/
|
||||
@@ -1523,6 +1494,9 @@ void OptiXDevice::build_bvh(BVH *bvh, Progress &progress, bool refit)
|
||||
cuMemcpyHtoD(motion_transform_gpu, &motion_transform, motion_transform_size);
|
||||
delete[] reinterpret_cast<uint8_t *>(&motion_transform);
|
||||
|
||||
/* Disable instance transform if object uses motion transform already. */
|
||||
instance.flags |= OPTIX_INSTANCE_FLAG_DISABLE_TRANSFORM;
|
||||
|
||||
/* Get traversable handle to motion transform. */
|
||||
optixConvertPointerToTraversableHandle(context,
|
||||
motion_transform_gpu,
|
||||
@@ -1536,6 +1510,10 @@ void OptiXDevice::build_bvh(BVH *bvh, Progress &progress, bool refit)
|
||||
/* Set transform matrix. */
|
||||
memcpy(instance.transform, &ob->get_tfm(), sizeof(instance.transform));
|
||||
}
|
||||
else {
|
||||
/* Disable instance transform if geometry already has it applied to vertex data. */
|
||||
instance.flags |= OPTIX_INSTANCE_FLAG_DISABLE_TRANSFORM;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -47,6 +47,9 @@ 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:
|
||||
@@ -544,6 +547,7 @@ 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)
|
||||
{
|
||||
@@ -578,20 +582,18 @@ 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);
|
||||
|
||||
@@ -618,11 +620,6 @@ 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
|
||||
|
@@ -482,11 +482,7 @@ void PathTrace::set_denoiser_params(const DenoiseParams ¶ms)
|
||||
}
|
||||
|
||||
denoiser_ = Denoiser::create(device_, params);
|
||||
|
||||
/* Only take into account the "immediate" cancel to have interactive rendering responding to
|
||||
* navigation as quickly as possible, but allow to run denoiser after user hit Esc button while
|
||||
* doing offline rendering. */
|
||||
denoiser_->is_cancelled_cb = [this]() { return render_cancel_.is_requested; };
|
||||
denoiser_->is_cancelled_cb = [this]() { return is_cancel_requested(); };
|
||||
}
|
||||
|
||||
void PathTrace::set_adaptive_sampling(const AdaptiveSampling &adaptive_sampling)
|
||||
|
@@ -258,8 +258,7 @@ void PathTraceWorkGPU::render_samples(RenderStatistics &statistics,
|
||||
* become busy after adding new tiles). This is especially important for the shadow catcher which
|
||||
* schedules work in halves of available number of paths. */
|
||||
work_tile_scheduler_.set_max_num_path_states(max_num_paths_ / 8);
|
||||
work_tile_scheduler_.set_accelerated_rt((device_->get_bvh_layout_mask() & BVH_LAYOUT_OPTIX) !=
|
||||
0);
|
||||
|
||||
work_tile_scheduler_.reset(effective_buffer_params_,
|
||||
start_sample,
|
||||
samples_num,
|
||||
|
@@ -406,9 +406,6 @@ bool RenderScheduler::set_postprocess_render_work(RenderWork *render_work)
|
||||
any_scheduled = true;
|
||||
}
|
||||
|
||||
/* Force update. */
|
||||
any_scheduled = true;
|
||||
|
||||
if (any_scheduled) {
|
||||
render_work->display.update = true;
|
||||
}
|
||||
|
@@ -46,8 +46,7 @@ ccl_device_inline uint round_up_to_power_of_two(uint x)
|
||||
return next_power_of_two(x);
|
||||
}
|
||||
|
||||
TileSize tile_calculate_best_size(const bool accel_rt,
|
||||
const int2 &image_size,
|
||||
TileSize tile_calculate_best_size(const int2 &image_size,
|
||||
const int num_samples,
|
||||
const int max_num_path_states,
|
||||
const float scrambling_distance)
|
||||
@@ -74,7 +73,7 @@ TileSize tile_calculate_best_size(const bool accel_rt,
|
||||
|
||||
TileSize tile_size;
|
||||
const int num_path_states_per_sample = max_num_path_states / num_samples;
|
||||
if (scrambling_distance < 0.9f && accel_rt) {
|
||||
if (scrambling_distance < 0.9f) {
|
||||
/* Prefer large tiles for scrambling distance, bounded by max num path states. */
|
||||
tile_size.width = min(image_size.x, max_num_path_states);
|
||||
tile_size.height = min(image_size.y, max(max_num_path_states / tile_size.width, 1));
|
||||
|
@@ -49,8 +49,7 @@ std::ostream &operator<<(std::ostream &os, const TileSize &tile_size);
|
||||
* of active path states.
|
||||
* Will attempt to provide best guess to keep path tracing threads of a device as localized as
|
||||
* possible, and have as many threads active for every tile as possible. */
|
||||
TileSize tile_calculate_best_size(const bool accel_rt,
|
||||
const int2 &image_size,
|
||||
TileSize tile_calculate_best_size(const int2 &image_size,
|
||||
const int num_samples,
|
||||
const int max_num_path_states,
|
||||
const float scrambling_distance);
|
||||
|
@@ -28,11 +28,6 @@ WorkTileScheduler::WorkTileScheduler()
|
||||
{
|
||||
}
|
||||
|
||||
void WorkTileScheduler::set_accelerated_rt(bool accelerated_rt)
|
||||
{
|
||||
accelerated_rt_ = accelerated_rt;
|
||||
}
|
||||
|
||||
void WorkTileScheduler::set_max_num_path_states(int max_num_path_states)
|
||||
{
|
||||
max_num_path_states_ = max_num_path_states;
|
||||
@@ -66,7 +61,7 @@ void WorkTileScheduler::reset(const BufferParams &buffer_params,
|
||||
void WorkTileScheduler::reset_scheduler_state()
|
||||
{
|
||||
tile_size_ = tile_calculate_best_size(
|
||||
accelerated_rt_, image_size_px_, samples_num_, max_num_path_states_, scrambling_distance_);
|
||||
image_size_px_, samples_num_, max_num_path_states_, scrambling_distance_);
|
||||
|
||||
VLOG(3) << "Will schedule tiles of size " << tile_size_;
|
||||
|
||||
|
@@ -31,9 +31,6 @@ class WorkTileScheduler {
|
||||
public:
|
||||
WorkTileScheduler();
|
||||
|
||||
/* To indicate if there is accelerated RT support. */
|
||||
void set_accelerated_rt(bool state);
|
||||
|
||||
/* MAximum path states which are allowed to be used by a single scheduled work tile.
|
||||
*
|
||||
* Affects the scheduled work size: the work size will be as big as possible, but will not exceed
|
||||
@@ -58,9 +55,6 @@ class WorkTileScheduler {
|
||||
protected:
|
||||
void reset_scheduler_state();
|
||||
|
||||
/* Used to indicate if there is accelerated ray tracing. */
|
||||
bool accelerated_rt_ = false;
|
||||
|
||||
/* Maximum allowed path states to be used.
|
||||
*
|
||||
* TODO(sergey): Naming can be improved. The fact that this is a limiting factor based on the
|
||||
|
@@ -29,20 +29,17 @@ ccl_device_inline void get_work_pixel(ccl_global const KernelWorkTile *tile,
|
||||
ccl_private uint *y,
|
||||
ccl_private uint *sample)
|
||||
{
|
||||
uint sample_offset, pixel_offset;
|
||||
|
||||
if (kernel_data.integrator.scrambling_distance < 0.9f) {
|
||||
/* Keep threads for the same sample together. */
|
||||
uint tile_pixels = tile->w * tile->h;
|
||||
sample_offset = global_work_index / tile_pixels;
|
||||
pixel_offset = global_work_index - sample_offset * tile_pixels;
|
||||
}
|
||||
else {
|
||||
/* Keeping threads for the same pixel together.
|
||||
* Appears to improve performance by a few % on CUDA and OptiX. */
|
||||
sample_offset = global_work_index % tile->num_samples;
|
||||
pixel_offset = global_work_index / tile->num_samples;
|
||||
}
|
||||
#if 0
|
||||
/* Keep threads for the same sample together. */
|
||||
uint tile_pixels = tile->w * tile->h;
|
||||
uint sample_offset = global_work_index / tile_pixels;
|
||||
uint pixel_offset = global_work_index - sample_offset * tile_pixels;
|
||||
#else
|
||||
/* Keeping threads for the same pixel together.
|
||||
* Appears to improve performance by a few % on CUDA and OptiX. */
|
||||
uint sample_offset = global_work_index % tile->num_samples;
|
||||
uint pixel_offset = global_work_index / tile->num_samples;
|
||||
#endif
|
||||
|
||||
uint y_offset = pixel_offset / tile->w;
|
||||
uint x_offset = pixel_offset - y_offset * tile->w;
|
||||
|
@@ -31,10 +31,8 @@
|
||||
#include "kernel/integrator/intersect_shadow.h"
|
||||
#include "kernel/integrator/intersect_subsurface.h"
|
||||
#include "kernel/integrator/intersect_volume_stack.h"
|
||||
// clang-format on
|
||||
|
||||
#define OPTIX_DEFINE_ABI_VERSION_ONLY
|
||||
#include <optix_function_table.h>
|
||||
// clang-format on
|
||||
|
||||
template<typename T> ccl_device_forceinline T *get_payload_ptr_0()
|
||||
{
|
||||
@@ -202,12 +200,10 @@ extern "C" __global__ void __anyhit__kernel_optix_shadow_all_hit()
|
||||
type = segment.type;
|
||||
prim = segment.prim;
|
||||
|
||||
# if OPTIX_ABI_VERSION < 55
|
||||
/* Filter out curve endcaps. */
|
||||
if (u == 0.0f || u == 1.0f) {
|
||||
return optixIgnoreIntersection();
|
||||
}
|
||||
# endif
|
||||
}
|
||||
# endif
|
||||
|
||||
@@ -314,7 +310,6 @@ extern "C" __global__ void __anyhit__kernel_optix_volume_test()
|
||||
extern "C" __global__ void __anyhit__kernel_optix_visibility_test()
|
||||
{
|
||||
#ifdef __HAIR__
|
||||
# if OPTIX_ABI_VERSION < 55
|
||||
if (!optixIsTriangleHit()) {
|
||||
/* Filter out curve endcaps. */
|
||||
const float u = __uint_as_float(optixGetAttribute_0());
|
||||
@@ -322,7 +317,6 @@ extern "C" __global__ void __anyhit__kernel_optix_visibility_test()
|
||||
return optixIgnoreIntersection();
|
||||
}
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef __VISIBILITY_FLAG__
|
||||
|
@@ -460,7 +460,7 @@ ccl_device_inline float4 film_calculate_shadow_catcher_matte_with_shadow(
|
||||
const float transparency = in_matte[3] * scale;
|
||||
const float alpha = saturatef(1.0f - transparency);
|
||||
|
||||
const float alpha_matte = (1.0f - alpha) * (1.0f - saturatef(average(shadow_catcher))) + alpha;
|
||||
const float alpha_matte = (1.0f - alpha) * (1.0f - average(shadow_catcher)) + alpha;
|
||||
|
||||
if (kfilm_convert->use_approximate_shadow_catcher_background) {
|
||||
kernel_assert(kfilm_convert->pass_background != PASS_UNUSED);
|
||||
|
@@ -699,10 +699,8 @@ 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);
|
||||
|
||||
if (!light_distribution_sample_from_volume_segment(
|
||||
kg, light_u, light_v, sd->time, sd->P, bounce, path_flag, ls)) {
|
||||
return false;
|
||||
}
|
||||
light_distribution_sample_from_volume_segment(
|
||||
kg, light_u, light_v, sd->time, sd->P, bounce, path_flag, ls);
|
||||
|
||||
if (ls->shader & SHADER_EXCLUDE_SCATTER) {
|
||||
return false;
|
||||
|
@@ -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 = 1.0f;
|
||||
ls->pdf = true;
|
||||
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 (!in_volume_segment && ls->eval_fac == 0.0f) {
|
||||
if (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 (!in_volume_segment && klight->area.tan_spread > 0.0f) {
|
||||
if (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 in_volume_segment || (ls->pdf > 0.0f);
|
||||
return (ls->pdf > 0.0f);
|
||||
}
|
||||
|
||||
ccl_device bool lights_intersect(KernelGlobals kg,
|
||||
|
@@ -24,26 +24,26 @@ CCL_NAMESPACE_BEGIN
|
||||
TEST(tile_calculate_best_size, Basic)
|
||||
{
|
||||
/* Make sure CPU-like case is handled properly. */
|
||||
EXPECT_EQ(tile_calculate_best_size(false, make_int2(1920, 1080), 1, 1, 1.0f), TileSize(1, 1, 1));
|
||||
EXPECT_EQ(tile_calculate_best_size(false, make_int2(1920, 1080), 100, 1, 1.0f), TileSize(1, 1, 1));
|
||||
EXPECT_EQ(tile_calculate_best_size(make_int2(1920, 1080), 1, 1, 1.0f), TileSize(1, 1, 1));
|
||||
EXPECT_EQ(tile_calculate_best_size(make_int2(1920, 1080), 100, 1, 1.0f), TileSize(1, 1, 1));
|
||||
|
||||
/* Enough path states to fit an entire image with all samples. */
|
||||
EXPECT_EQ(tile_calculate_best_size(false, make_int2(1920, 1080), 1, 1920 * 1080, 1.0f),
|
||||
EXPECT_EQ(tile_calculate_best_size(make_int2(1920, 1080), 1, 1920 * 1080, 1.0f),
|
||||
TileSize(1920, 1080, 1));
|
||||
EXPECT_EQ(tile_calculate_best_size(false, make_int2(1920, 1080), 100, 1920 * 1080 * 100, 1.0f),
|
||||
EXPECT_EQ(tile_calculate_best_size(make_int2(1920, 1080), 100, 1920 * 1080 * 100, 1.0f),
|
||||
TileSize(1920, 1080, 100));
|
||||
}
|
||||
|
||||
TEST(tile_calculate_best_size, Extreme)
|
||||
{
|
||||
EXPECT_EQ(tile_calculate_best_size(false, make_int2(32, 32), 262144, 131072, 1.0f),
|
||||
EXPECT_EQ(tile_calculate_best_size(make_int2(32, 32), 262144, 131072, 1.0f),
|
||||
TileSize(1, 1, 512));
|
||||
EXPECT_EQ(tile_calculate_best_size(false, make_int2(32, 32), 1048576, 131072, 1.0f),
|
||||
EXPECT_EQ(tile_calculate_best_size(make_int2(32, 32), 1048576, 131072, 1.0f),
|
||||
TileSize(1, 1, 1024));
|
||||
EXPECT_EQ(tile_calculate_best_size(false, make_int2(32, 32), 10485760, 131072, 1.0f),
|
||||
EXPECT_EQ(tile_calculate_best_size(make_int2(32, 32), 10485760, 131072, 1.0f),
|
||||
TileSize(1, 1, 4096));
|
||||
|
||||
EXPECT_EQ(tile_calculate_best_size(false, make_int2(32, 32), 8192 * 8192 * 2, 1024, 1.0f),
|
||||
EXPECT_EQ(tile_calculate_best_size(make_int2(32, 32), 8192 * 8192 * 2, 1024, 1.0f),
|
||||
TileSize(1, 1, 1024));
|
||||
}
|
||||
|
||||
|
@@ -89,6 +89,18 @@ 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
|
||||
|
@@ -195,6 +195,7 @@ 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);
|
||||
|
||||
/**
|
||||
@@ -542,6 +543,13 @@ 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.
|
||||
@@ -1159,6 +1167,50 @@ 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
|
||||
}
|
||||
|
||||
|
@@ -56,6 +56,11 @@ 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
|
||||
|
@@ -265,7 +265,8 @@ 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_GLSettings glSettings) = 0;
|
||||
virtual GHOST_IContext *createOffscreenContext(GHOST_TDrawingContextType type,
|
||||
GHOST_GLSettings glSettings) = 0;
|
||||
|
||||
/**
|
||||
* Dispose of a context.
|
||||
|
@@ -30,6 +30,8 @@
|
||||
#include <stdlib.h>
|
||||
#include <string>
|
||||
|
||||
class GHOST_IContext;
|
||||
|
||||
/**
|
||||
* Interface for GHOST windows.
|
||||
*
|
||||
@@ -71,6 +73,12 @@ 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.
|
||||
@@ -218,6 +226,18 @@ 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.
|
||||
|
@@ -29,6 +29,10 @@
|
||||
# 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##__ { \
|
||||
@@ -145,6 +149,9 @@ 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
|
||||
@@ -782,3 +789,20 @@ 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
|
@@ -35,6 +35,9 @@
|
||||
# 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"
|
||||
|
||||
@@ -137,11 +140,12 @@ 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(glSettings);
|
||||
return (GHOST_ContextHandle)system->createOffscreenContext(type, glSettings);
|
||||
}
|
||||
|
||||
GHOST_TSuccess GHOST_DisposeOpenGLContext(GHOST_SystemHandle systemhandle,
|
||||
@@ -493,6 +497,13 @@ 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)
|
||||
{
|
||||
@@ -1105,3 +1116,74 @@ 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 */
|
||||
|
@@ -135,6 +135,33 @@ 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();
|
||||
|
||||
|
1044
intern/ghost/intern/GHOST_ContextVK.cpp
Normal file
1044
intern/ghost/intern/GHOST_ContextVK.cpp
Normal file
File diff suppressed because it is too large
Load Diff
236
intern/ghost/intern/GHOST_ContextVK.h
Normal file
236
intern/ghost/intern/GHOST_ContextVK.h
Normal file
@@ -0,0 +1,236 @@
|
||||
/*
|
||||
* 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__
|
@@ -117,7 +117,8 @@ 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_GLSettings glSettings) = 0;
|
||||
virtual GHOST_IContext *createOffscreenContext(GHOST_TDrawingContextType type,
|
||||
GHOST_GLSettings glSettings) = 0;
|
||||
|
||||
/**
|
||||
* Returns whether a window is valid.
|
||||
|
@@ -116,7 +116,8 @@ 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_GLSettings glSettings);
|
||||
GHOST_IContext *createOffscreenContext(GHOST_TDrawingContextType type,
|
||||
GHOST_GLSettings glSettings);
|
||||
|
||||
/**
|
||||
* Dispose of a context.
|
||||
|
@@ -34,6 +34,10 @@
|
||||
|
||||
#include "GHOST_ContextCGL.h"
|
||||
|
||||
#if defined(WITH_VULKAN)
|
||||
# include "GHOST_ContextVK.h"
|
||||
#endif
|
||||
|
||||
#ifdef WITH_INPUT_NDOF
|
||||
# include "GHOST_NDOFManagerCocoa.h"
|
||||
#endif
|
||||
@@ -764,8 +768,21 @@ 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_GLSettings glSettings)
|
||||
GHOST_IContext *GHOST_SystemCocoa::createOffscreenContext(GHOST_TDrawingContextType type,
|
||||
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;
|
||||
|
@@ -81,7 +81,8 @@ class GHOST_SystemNULL : public GHOST_System {
|
||||
void getAllDisplayDimensions(uint32_t &width, uint32_t &height) const
|
||||
{ /* nop */
|
||||
}
|
||||
GHOST_IContext *createOffscreenContext(GHOST_GLSettings glSettings)
|
||||
GHOST_IContext *createOffscreenContext(GHOST_TDrawingContextType /* type */,
|
||||
GHOST_GLSettings glSettings)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
@@ -139,7 +139,8 @@ uint8_t GHOST_SystemSDL::getNumDisplays() const
|
||||
return SDL_GetNumVideoDisplays();
|
||||
}
|
||||
|
||||
GHOST_IContext *GHOST_SystemSDL::createOffscreenContext(GHOST_GLSettings glSettings)
|
||||
GHOST_IContext *GHOST_SystemSDL::createOffscreenContext(GHOST_TDrawingContextType /* type */,
|
||||
GHOST_GLSettings glSettings)
|
||||
{
|
||||
GHOST_Context *context = new GHOST_ContextSDL(0,
|
||||
NULL,
|
||||
|
@@ -72,7 +72,8 @@ class GHOST_SystemSDL : public GHOST_System {
|
||||
|
||||
void getMainDisplayDimensions(uint32_t &width, uint32_t &height) const;
|
||||
|
||||
GHOST_IContext *createOffscreenContext(GHOST_GLSettings glSettings);
|
||||
GHOST_IContext *createOffscreenContext(GHOST_TDrawingContextType type,
|
||||
GHOST_GLSettings glSettings);
|
||||
|
||||
GHOST_TSuccess disposeContext(GHOST_IContext *context);
|
||||
|
||||
|
@@ -30,6 +30,10 @@
|
||||
|
||||
#include "GHOST_ContextEGL.h"
|
||||
|
||||
#if defined(WITH_VULKAN)
|
||||
# include "GHOST_ContextVK.h"
|
||||
#endif
|
||||
|
||||
#include <EGL/egl.h>
|
||||
#include <wayland-egl.h>
|
||||
|
||||
@@ -1588,55 +1592,75 @@ void GHOST_SystemWayland::getAllDisplayDimensions(uint32_t &width, uint32_t &hei
|
||||
getMainDisplayDimensions(width, height);
|
||||
}
|
||||
|
||||
GHOST_IContext *GHOST_SystemWayland::createOffscreenContext(GHOST_GLSettings /*glSettings*/)
|
||||
GHOST_IContext *GHOST_SystemWayland::createOffscreenContext(GHOST_TDrawingContextType type,
|
||||
GHOST_GLSettings glSettings)
|
||||
{
|
||||
/* 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 defined(WITH_VULKAN)
|
||||
const bool debug_context = (glSettings.flags & GHOST_glDebugContext) != 0;
|
||||
|
||||
d->os_surfaces.push_back(os_surface);
|
||||
d->os_egl_windows.push_back(os_egl_window);
|
||||
if (type == GHOST_kDrawingContextTypeVulkan) {
|
||||
GHOST_Context *context = new GHOST_ContextVK(
|
||||
false, GHOST_kVulkanPlatformWayland, 0, NULL, NULL, d->display, 1, 0, debug_context);
|
||||
|
||||
GHOST_Context *context;
|
||||
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;
|
||||
}
|
||||
|
||||
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,
|
||||
3,
|
||||
3,
|
||||
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;
|
||||
}
|
||||
|
||||
|
@@ -73,7 +73,8 @@ class GHOST_SystemWayland : public GHOST_System {
|
||||
|
||||
void getAllDisplayDimensions(uint32_t &width, uint32_t &height) const override;
|
||||
|
||||
GHOST_IContext *createOffscreenContext(GHOST_GLSettings glSettings) override;
|
||||
GHOST_IContext *createOffscreenContext(GHOST_TDrawingContextType type,
|
||||
GHOST_GLSettings glSettings) override;
|
||||
|
||||
GHOST_TSuccess disposeContext(GHOST_IContext *context) override;
|
||||
|
||||
|
@@ -50,7 +50,15 @@
|
||||
#include "GHOST_WindowManager.h"
|
||||
#include "GHOST_WindowWin32.h"
|
||||
|
||||
#include "GHOST_ContextWGL.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
|
||||
|
||||
#ifdef WITH_INPUT_NDOF
|
||||
# include "GHOST_NDOFManagerWin32.h"
|
||||
@@ -263,10 +271,26 @@ 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_GLSettings glSettings)
|
||||
GHOST_IContext *GHOST_SystemWin32::createOffscreenContext(GHOST_TDrawingContextType type,
|
||||
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",
|
||||
@@ -1002,10 +1026,10 @@ void GHOST_SystemWin32::processWintabEvent(GHOST_WindowWin32 *window)
|
||||
DWORD pos = GetMessagePos();
|
||||
int x = GET_X_LPARAM(pos);
|
||||
int y = GET_Y_LPARAM(pos);
|
||||
GHOST_TabletData td = wt->getLastTabletData();
|
||||
|
||||
/* TODO supply tablet data */
|
||||
system->pushEvent(new GHOST_EventCursor(
|
||||
system->getMilliSeconds(), GHOST_kEventCursorMove, window, x, y, td));
|
||||
system->getMilliSeconds(), GHOST_kEventCursorMove, window, x, y, GHOST_TABLET_DATA_NONE));
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -142,7 +142,8 @@ 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_GLSettings glSettings);
|
||||
GHOST_IContext *createOffscreenContext(GHOST_TDrawingContextType type,
|
||||
GHOST_GLSettings glSettings);
|
||||
|
||||
/**
|
||||
* Dispose of a context.
|
||||
|
@@ -48,6 +48,10 @@
|
||||
|
||||
#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>
|
||||
@@ -394,7 +398,8 @@ 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_GLSettings glSettings)
|
||||
GHOST_IContext *GHOST_SystemX11::createOffscreenContext(GHOST_TDrawingContextType type,
|
||||
GHOST_GLSettings glSettings)
|
||||
{
|
||||
/* During development:
|
||||
* try 4.x compatibility profile
|
||||
@@ -408,46 +413,97 @@ GHOST_IContext *GHOST_SystemX11::createOffscreenContext(GHOST_GLSettings glSetti
|
||||
|
||||
const bool debug_context = (glSettings.flags & GHOST_glDebugContext) != 0;
|
||||
|
||||
#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();
|
||||
#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;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
const int profile_mask =
|
||||
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 =
|
||||
#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;
|
||||
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;
|
||||
}
|
||||
|
||||
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,
|
||||
3,
|
||||
3,
|
||||
GHOST_OPENGL_EGL_CONTEXT_FLAGS |
|
||||
(debug_context ? EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR : 0),
|
||||
GHOST_OPENGL_EGL_RESET_NOTIFICATION_STRATEGY,
|
||||
@@ -458,49 +514,21 @@ GHOST_IContext *GHOST_SystemX11::createOffscreenContext(GHOST_GLSettings glSetti
|
||||
m_display,
|
||||
(GLXFBConfig)NULL,
|
||||
profile_mask,
|
||||
4,
|
||||
minor,
|
||||
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())
|
||||
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;
|
||||
}
|
||||
|
||||
|
@@ -152,7 +152,8 @@ 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_GLSettings glSettings);
|
||||
GHOST_IContext *createOffscreenContext(GHOST_TDrawingContextType type,
|
||||
GHOST_GLSettings glSettings);
|
||||
|
||||
/**
|
||||
* Dispose of a context.
|
||||
|
@@ -26,7 +26,7 @@
|
||||
|
||||
#include "GHOST_IWindow.h"
|
||||
|
||||
class GHOST_Context;
|
||||
#include "GHOST_Context.h"
|
||||
|
||||
/**
|
||||
* Platform independent implementation of GHOST_IWindow.
|
||||
@@ -94,6 +94,22 @@ 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
|
||||
@@ -229,6 +245,12 @@ 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,
|
||||
@@ -411,6 +433,11 @@ 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;
|
||||
|
@@ -24,6 +24,10 @@
|
||||
|
||||
#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>
|
||||
@@ -819,8 +823,21 @@ GHOST_TSuccess GHOST_WindowCocoa::setOrder(GHOST_TWindowOrder order)
|
||||
|
||||
GHOST_Context *GHOST_WindowCocoa::newDrawingContext(GHOST_TDrawingContextType type)
|
||||
{
|
||||
if (type == GHOST_kDrawingContextTypeOpenGL) {
|
||||
#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);
|
||||
|
||||
|
@@ -26,6 +26,9 @@
|
||||
|
||||
#include "GHOST_ContextEGL.h"
|
||||
#include "GHOST_ContextNone.h"
|
||||
#if defined(WITH_VULKAN)
|
||||
# include "GHOST_ContextVK.h"
|
||||
#endif
|
||||
|
||||
#include <wayland-egl.h>
|
||||
|
||||
@@ -554,6 +557,21 @@ 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;
|
||||
|
@@ -30,8 +30,15 @@
|
||||
#include "utf_winfunc.h"
|
||||
#include "utfconv.h"
|
||||
|
||||
#include "GHOST_ContextWGL.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
|
||||
#ifdef WIN32_COMPOSITING
|
||||
# include <Dwmapi.h>
|
||||
#endif
|
||||
@@ -615,6 +622,18 @@ 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;
|
||||
}
|
||||
|
@@ -38,6 +38,10 @@
|
||||
# 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>
|
||||
@@ -1273,8 +1277,38 @@ GHOST_WindowX11::~GHOST_WindowX11()
|
||||
|
||||
GHOST_Context *GHOST_WindowX11::newDrawingContext(GHOST_TDrawingContextType type)
|
||||
{
|
||||
if (type == GHOST_kDrawingContextTypeOpenGL) {
|
||||
#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.
|
||||
|
@@ -266,6 +266,8 @@ class GHOST_WindowX11 : public GHOST_Window {
|
||||
XIC m_xic;
|
||||
#endif
|
||||
|
||||
GHOST_TDrawingContextType m_context_type;
|
||||
|
||||
bool m_valid_setup;
|
||||
bool m_is_debug_context;
|
||||
|
||||
|
@@ -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);
|
||||
mw->gpu_context = GPU_context_create(win, NULL);
|
||||
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);
|
||||
lw->gpu_context = GPU_context_create(win, NULL);
|
||||
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);
|
||||
ew->gpu_context = GPU_context_create(win, NULL);
|
||||
GPU_init();
|
||||
|
||||
ew->app = app;
|
||||
|
44
intern/shader_compiler/CMakeLists.txt
Normal file
44
intern/shader_compiler/CMakeLists.txt
Normal file
@@ -0,0 +1,44 @@
|
||||
# ***** 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}")
|
@@ -12,25 +12,21 @@
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/** \file
|
||||
* \ingroup edfile
|
||||
*/
|
||||
#pragma once
|
||||
#include "shader_compiler.hh"
|
||||
|
||||
#include "ED_file_indexer.h"
|
||||
#include "intern/shaderc/ShaderCCompiler.hh"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
namespace shader_compiler {
|
||||
|
||||
/**
|
||||
* Default indexer to use when listing files. The implementation is a no-operation indexing. When
|
||||
* set it won't use indexing. It is added to increase the code clarity.
|
||||
*/
|
||||
extern const FileIndexerType file_indexer_noop;
|
||||
|
||||
#ifdef __cplusplus
|
||||
Compiler *Compiler::create_default()
|
||||
{
|
||||
Compiler *compiler = new shaderc::ShaderCCompiler();
|
||||
return compiler;
|
||||
}
|
||||
#endif
|
||||
|
||||
} // namespace shader_compiler
|
29
intern/shader_compiler/intern/Result.cc
Normal file
29
intern/shader_compiler/intern/Result.cc
Normal file
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* 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
|
92
intern/shader_compiler/intern/shaderc/ShaderCCompiler.cc
Normal file
92
intern/shader_compiler/intern/shaderc/ShaderCCompiler.cc
Normal file
@@ -0,0 +1,92 @@
|
||||
/*
|
||||
* 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
|
48
intern/shader_compiler/intern/shaderc/ShaderCCompiler.hh
Normal file
48
intern/shader_compiler/intern/shaderc/ShaderCCompiler.hh
Normal file
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* 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
|
58
intern/shader_compiler/intern/shaderc/ShaderCResult.cc
Normal file
58
intern/shader_compiler/intern/shaderc/ShaderCResult.cc
Normal file
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* 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
|
39
intern/shader_compiler/intern/shaderc/ShaderCResult.hh
Normal file
39
intern/shader_compiler/intern/shaderc/ShaderCResult.hh
Normal file
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* 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
|
106
intern/shader_compiler/shader_compiler.hh
Normal file
106
intern/shader_compiler/shader_compiler.hh
Normal file
@@ -0,0 +1,106 @@
|
||||
/*
|
||||
* 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
|
@@ -8520,6 +8520,26 @@
|
||||
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)"
|
||||
@@ -13709,6 +13729,11 @@
|
||||
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"
|
||||
@@ -17348,136 +17373,6 @@
|
||||
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="g7580"
|
||||
style="display:inline;enable-background:new">
|
||||
<g
|
||||
id="g905">
|
||||
<g
|
||||
transform="matrix(0.6740384,0,0,0.6740384,192.80592,-339.68227)"
|
||||
style="display:inline;opacity:0.99;fill:#ffffff;stroke-width:1.07692;enable-background:new"
|
||||
id="g8599-6-7"
|
||||
inkscape:export-filename="C:\Users\Andrzej Ambroż\Desktop\mtrx.png"
|
||||
inkscape:export-xdpi="96"
|
||||
inkscape:export-ydpi="96">
|
||||
<path
|
||||
id="path8597-7-0"
|
||||
d="m 331.87142,629.24052 c 0,0.81936 -0.66423,1.48359 -1.48359,1.48359 -0.81937,0 -1.4836,-0.66422 -1.4836,-1.48359 0,-0.81937 0.66423,-1.4836 1.4836,-1.4836 0.81937,0 1.48359,0.66423 1.48359,1.4836 z"
|
||||
style="opacity:1;vector-effect:none;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:1.72218;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"
|
||||
sodipodi:nodetypes="sssss" />
|
||||
</g>
|
||||
<path
|
||||
sodipodi:nodetypes="cccccccccczzcczzzzz"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path8595-5-9"
|
||||
d="m 414.93725,78.999996 c -0.65344,-0.653443 -1.58833,0.255453 -0.88297,0.960812 L 415.18167,81 h -4.6057 c -0.88913,-0.01822 -0.88913,1.018254 0,1 l 2.19337,-0.004 -0.006,0.004 -3.27651,2.873468 c -0.64989,0.580999 0.2216,1.555837 0.87149,0.97484 L 412.00004,84.45 c 0,1.651946 1.15621,3.581251 3.47506,3.550001 C 417.79395,87.968751 419,86.250706 419,84.45 c 0,-1.800705 -1.00462,-2.558141 -1.45954,-3.013074 z M 415.5,82.2 c 1.22478,0 2.25,0.945047 2.25,2.25 0,1.304953 -1.05311,2.25 -2.25,2.25 -1.19689,0 -2.25,-0.960585 -2.25,-2.25 0,-1.289415 1.02522,-2.25 2.25,-2.25 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.3066;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>
|
||||
<g
|
||||
style="display:inline;fill:#ffffff;enable-background:new"
|
||||
id="g15543-3-3"
|
||||
transform="translate(21.029034,-20.999943)">
|
||||
<g
|
||||
id="g15520-6-5"
|
||||
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-6">
|
||||
<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 2.999953 c -0.01,0.676161 1.00956,0.676161 1,0 V 53.5 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.49914 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-2"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="ccccccccccccccccccccccccc" />
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
<g
|
||||
transform="translate(499.00086,52.015151)"
|
||||
id="g824"
|
||||
style="display:inline;enable-background:new">
|
||||
<g
|
||||
id="g4207"
|
||||
style="display:inline;enable-background:new"
|
||||
transform="translate(-499.00079,-52.007172)">
|
||||
<g
|
||||
transform="translate(105,-21.000376)"
|
||||
style="display:inline;enable-background:new"
|
||||
id="g7580-6">
|
||||
<g
|
||||
transform="matrix(0.6740384,0,0,0.6740384,192.80592,-339.68227)"
|
||||
style="display:inline;opacity:0.99;fill:#ffffff;stroke-width:1.07692;enable-background:new"
|
||||
id="g8599-6-7-2"
|
||||
inkscape:export-filename="C:\Users\Andrzej Ambroż\Desktop\mtrx.png"
|
||||
inkscape:export-xdpi="96"
|
||||
inkscape:export-ydpi="96">
|
||||
<path
|
||||
id="path8597-7-0-9"
|
||||
d="m 331.87142,629.2294 c 0,0.81936 -0.66423,1.48359 -1.48359,1.48359 -0.81937,0 -1.4836,-0.66422 -1.4836,-1.48359 0,-0.81937 0.66423,-1.4836 1.4836,-1.4836 0.81937,0 1.48359,0.66423 1.48359,1.4836 z"
|
||||
style="opacity:1;vector-effect:none;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:1.72218;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"
|
||||
sodipodi:nodetypes="sssss" />
|
||||
</g>
|
||||
<path
|
||||
sodipodi:nodetypes="cccccccccczzcczzzzz"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path8595-5-9-1"
|
||||
d="m 414.93725,78.992499 c -0.65344,-0.653443 -1.58833,0.255453 -0.88297,0.960812 l 1.12739,1.039192 h -4.6057 c -0.88913,-0.01822 -0.88913,1.018254 0,1 l 2.19337,-0.004 -0.006,0.004 -3.27651,2.873468 c -0.64989,0.580999 0.2216,1.555837 0.87149,0.97484 l 1.64161,-1.398308 c 0,1.651946 1.15632,3.581251 3.47517,3.550001 2.31885,-0.03125 3.5249,-1.749295 3.5249,-3.550001 0,-1.800705 -1.00462,-2.558141 -1.45954,-3.013074 z M 415.5,82.192503 c 1.22478,0 2.25,0.945047 2.25,2.25 0,1.304953 -1.05311,2.25 -2.25,2.25 -1.19689,0 -2.25,-0.960585 -2.25,-2.25 0,-1.289415 1.02522,-2.25 2.25,-2.25 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.3066;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>
|
||||
<g
|
||||
transform="translate(19.000003)"
|
||||
id="g28228-3-3"
|
||||
style="display:inline;opacity:0.6;stroke:#ffffff;enable-background:new"
|
||||
inkscape:export-filename="C:\Users\Andrzej Ambroż\Desktop\mtrx.png"
|
||||
inkscape:export-xdpi="96"
|
||||
inkscape:export-ydpi="96">
|
||||
<g
|
||||
id="g28217-6-6"
|
||||
transform="translate(338.99999,-439.99995)"
|
||||
style="display:inline;opacity:0.99;stroke:#ffffff;enable-background:new">
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
id="path28215-0"
|
||||
transform="translate(-337.99999,439.99995)"
|
||||
d="m 501.49219,52.992188 c -0.27615,0.0043 -0.49651,0.223792 -0.49219,0.499938 v 1 c -0.01,0.676161 1.00956,0.676161 1,0 v -1 c 0.004,-0.282265 -0.22554,-0.504353 -0.50781,-0.499938 z m -7.00781,0.0067 c -0.12718,0.004 -0.248,0.0564 -0.3379,0.146484 l -4,4.001116 c -0.10126,0.101337 -0.1304,0.223491 -0.13086,0.345704 L 490,57.507812 v 1.984314 c -0.01,0.676161 1.00956,0.676161 1,0 v -1.5 h 3.5 c 0.27613,-3e-5 0.49997,-0.22387 0.5,-0.5 v -3.5 h 1.5 c 0.67616,0.0096 0.67616,-1.002805 0,-0.993242 h -2 v 0.002 c -0.005,-5e-6 -0.0101,-0.0021 -0.0156,-0.002 z m 4.01562,-0.0068 c -0.67616,-0.0096 -0.67616,1.009563 0,1 h 1 c 0.67616,0.0096 0.67616,-1.009563 0,-1 z m 2.99219,3.000062 c -0.27615,0.0043 -0.49651,0.223792 -0.49219,0.499938 v 1 c -0.01,0.676161 1.00956,0.676161 1,0 v -1 c 0.004,-0.282265 -0.22554,-0.504353 -0.50781,-0.499938 z m -11,5 c -0.27615,0.0043 -0.49651,0.223792 -0.49219,0.499938 v 1 c -0.01,0.676161 1.00956,0.676161 1,0 v -1 c 0.004,-0.282265 -0.22554,-0.504353 -0.50781,-0.499938 z m 0,3 c -0.27615,0.0043 -0.49651,0.223792 -0.49219,0.499938 v 1 c -0.01,0.676161 1.00956,0.676161 1,0 v -1 c 0.004,-0.282265 -0.22554,-0.504353 -0.50781,-0.499938 z M 492.5,65.992126 c -0.67616,-0.0096 -0.67616,1.009563 0,1 h 1 c 0.67616,0.0096 0.67616,-1.009563 0,-1 z m 3,0 c -0.67616,-0.0096 -0.67616,1.009563 0,1 h 1 c 0.67616,0.0096 0.67616,-1.009563 0,-1 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: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:accumulate"
|
||||
sodipodi:nodetypes="cccccccccccccccccccccccccccccccccccccccccccccccccccccccc" />
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
<g
|
||||
transform="translate(-0.999993)"
|
||||
id="g4126"
|
||||
style="display:inline;enable-background:new">
|
||||
<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.65914281,0,0,0.65914281,248.47102,-214.89549)"
|
||||
id="g12839-3-5">
|
||||
<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 352.97527,473.19666 c -0.49613,-0.0451 -1.03862,0.15972 -1.49219,0.61328 l -0.41128,0.47153 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.41128,-0.47153 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.22807,6.22726 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 0,0 6.17898,-6.1737 6.22807,-6.22726 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-3"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="cccccccscccccccccccccccc" />
|
||||
</g>
|
||||
<path
|
||||
sodipodi:nodetypes="csscccccccccccssscccc"
|
||||
style="opacity:0.6;fill:#ffffff"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path2-6"
|
||||
d="m 469,101 v 7.5 c 0,0.276 0.224,0.5 0.5,0.5 h 11 c 0.30423,0 0.5,-0.22782 0.5,-0.5 v -4 c 0,-0.65459 -1,-0.65682 -1,0 v 3.5 h -10 v -7 z m 4.48081,-6 c -0.151,0.004 -0.293,0.077 -0.384,0.197 l -3.95,3.949 c -0.314,0.315 -0.091,0.854 0.354,0.854 h 4 c 0.276,0 0.5,-0.224 0.5,-0.5 V 96 H 480.5 c 0.68512,0 0.64092,-1 0,-1 z" />
|
||||
</g>
|
||||
</g>
|
||||
<g
|
||||
inkscape:groupmode="layer"
|
||||
|
Before Width: | Height: | Size: 2.5 MiB After Width: | Height: | Size: 2.5 MiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Submodule release/scripts/addons updated: 4de1bcce5a...1c390038f6
@@ -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 == 'MINIMUM':
|
||||
elif self.blend_type == 'MININUM':
|
||||
v1 = min(fac * v2, v1)
|
||||
elif self.blend_type == 'MAXIMUM':
|
||||
v1 = max(fac * v2, v1)
|
||||
|
@@ -2147,7 +2147,7 @@ def km_file_browser(params):
|
||||
("file.next", {"type": 'RIGHT_ARROW', "value": 'PRESS', "alt": True}, None),
|
||||
# The two refresh operators have polls excluding each other (so only one is available depending on context).
|
||||
("file.refresh", {"type": 'R', "value": 'PRESS'}, None),
|
||||
("asset.library_refresh", {"type": 'R', "value": 'PRESS'}, None),
|
||||
("file.asset_library_refresh", {"type": 'R', "value": 'PRESS'}, None),
|
||||
("file.parent", {"type": 'P', "value": 'PRESS'}, None),
|
||||
("file.previous", {"type": 'BACK_SPACE', "value": 'PRESS'}, None),
|
||||
("file.next", {"type": 'BACK_SPACE', "value": 'PRESS', "shift": True}, None),
|
||||
|
@@ -1229,7 +1229,7 @@ def km_file_browser(params):
|
||||
("file.next", {"type": 'RIGHT_ARROW', "value": 'PRESS', "ctrl": True}, None),
|
||||
# The two refresh operators have polls excluding each other (so only one is available depending on context).
|
||||
("file.refresh", {"type": 'R', "value": 'PRESS', "ctrl": True}, None),
|
||||
("asset.library_refresh", {"type": 'R', "value": 'PRESS', "ctrl": True}, None),
|
||||
("file.asset_library_refresh", {"type": 'R', "value": 'PRESS', "ctrl": True}, None),
|
||||
("file.previous", {"type": 'BACK_SPACE', "value": 'PRESS'}, None),
|
||||
("file.next", {"type": 'BACK_SPACE', "value": 'PRESS', "shift": True}, None),
|
||||
("wm.context_toggle", {"type": 'H', "value": 'PRESS'},
|
||||
@@ -1276,7 +1276,7 @@ def km_file_browser_main(params):
|
||||
("file.mouse_execute", {"type": 'LEFTMOUSE', "value": 'DOUBLE_CLICK'}, None),
|
||||
# The two refresh operators have polls excluding each other (so only one is available depending on context).
|
||||
("file.refresh", {"type": 'R', "value": 'PRESS', "ctrl": True}, None),
|
||||
("asset.library_refresh", {"type": 'R', "value": 'PRESS', "ctrl": True}, None),
|
||||
("file.asset_library_refresh", {"type": 'R', "value": 'PRESS', "ctrl": True}, None),
|
||||
("file.select", {"type": 'LEFTMOUSE', "value": 'DOUBLE_CLICK'}, None),
|
||||
("file.select", {"type": 'LEFTMOUSE', "value": 'CLICK'},
|
||||
{"properties": [("open", False), ("deselect_all", True)]}),
|
||||
|
@@ -142,8 +142,14 @@ class ASSET_OT_open_containing_blend_file(Operator):
|
||||
if returncode:
|
||||
self.report({'WARNING'}, "Blender sub-process exited with error code %d" % returncode)
|
||||
|
||||
if bpy.ops.asset.library_refresh.poll():
|
||||
bpy.ops.asset.library_refresh()
|
||||
# TODO(Sybren): Replace this with a generic "reload assets" operator
|
||||
# that can run outside of the Asset Browser context.
|
||||
if bpy.ops.file.refresh.poll():
|
||||
bpy.ops.file.refresh()
|
||||
if bpy.ops.asset.list_refresh.poll():
|
||||
bpy.ops.asset.list_refresh()
|
||||
if bpy.ops.file.asset_library_refresh.poll():
|
||||
bpy.ops.file.asset_library_refresh()
|
||||
|
||||
self.cancel(context)
|
||||
return {'FINISHED'}
|
||||
|
@@ -539,39 +539,6 @@ class DOPESHEET_MT_key_transform(Menu):
|
||||
layout.operator("transform.transform", text="Scale").mode = 'TIME_SCALE'
|
||||
|
||||
|
||||
class DopesheetActionPanelBase:
|
||||
bl_region_type = 'UI'
|
||||
bl_label = "Action"
|
||||
|
||||
@classmethod
|
||||
def draw_generic_panel(cls, context, layout, action):
|
||||
layout.label(text=action.name, icon='ACTION')
|
||||
|
||||
layout.prop(action, "use_frame_range")
|
||||
|
||||
col = layout.column()
|
||||
col.active = action.use_frame_range
|
||||
|
||||
row = col.row(align=True)
|
||||
row.prop(action, "frame_start", text="Start")
|
||||
row.prop(action, "frame_end", text="End")
|
||||
|
||||
col.prop(action, "use_cyclic")
|
||||
|
||||
|
||||
class DOPESHEET_PT_action(DopesheetActionPanelBase, Panel):
|
||||
bl_space_type = 'DOPESHEET_EDITOR'
|
||||
bl_category = "Item"
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
return bool(context.selected_visible_actions)
|
||||
|
||||
def draw(self, context):
|
||||
action = context.selected_visible_actions[0]
|
||||
self.draw_generic_panel(context, self.layout, action)
|
||||
|
||||
|
||||
#######################################
|
||||
# Grease Pencil Editing
|
||||
|
||||
@@ -825,7 +792,6 @@ classes = (
|
||||
DOPESHEET_MT_snap_pie,
|
||||
DOPESHEET_MT_view_pie,
|
||||
DOPESHEET_PT_filters,
|
||||
DOPESHEET_PT_action,
|
||||
DOPESHEET_PT_gpencil_mode,
|
||||
DOPESHEET_PT_gpencil_layer_masks,
|
||||
DOPESHEET_PT_gpencil_layer_transform,
|
||||
|
@@ -793,7 +793,7 @@ class ASSETBROWSER_MT_context_menu(AssetBrowserMenu, Menu):
|
||||
st = context.space_data
|
||||
params = st.params
|
||||
|
||||
layout.operator("asset.library_refresh")
|
||||
layout.operator("file.asset_library_refresh")
|
||||
|
||||
layout.separator()
|
||||
|
||||
|
@@ -22,7 +22,6 @@ from bpy.types import Header, Menu, Panel
|
||||
from bpy.app.translations import contexts as i18n_contexts
|
||||
from bl_ui.space_dopesheet import (
|
||||
DopesheetFilterPopoverBase,
|
||||
DopesheetActionPanelBase,
|
||||
dopesheet_filter,
|
||||
)
|
||||
|
||||
@@ -67,21 +66,6 @@ class NLA_PT_filters(DopesheetFilterPopoverBase, Panel):
|
||||
DopesheetFilterPopoverBase.draw_standard_filters(context, layout)
|
||||
|
||||
|
||||
class NLA_PT_action(DopesheetActionPanelBase, Panel):
|
||||
bl_space_type = 'NLA_EDITOR'
|
||||
bl_category = "Strip"
|
||||
bl_options = {'DEFAULT_CLOSED'}
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
strip = context.active_nla_strip
|
||||
return strip and strip.type == 'CLIP' and strip.action
|
||||
|
||||
def draw(self, context):
|
||||
action = context.active_nla_strip.action
|
||||
self.draw_generic_panel(context, self.layout, action)
|
||||
|
||||
|
||||
class NLA_MT_editor_menus(Menu):
|
||||
bl_idname = "NLA_MT_editor_menus"
|
||||
bl_label = ""
|
||||
@@ -332,7 +316,6 @@ classes = (
|
||||
NLA_MT_context_menu,
|
||||
NLA_MT_channel_context_menu,
|
||||
NLA_PT_filters,
|
||||
NLA_PT_action,
|
||||
)
|
||||
|
||||
if __name__ == "__main__": # only for live edit.
|
||||
|
@@ -721,10 +721,6 @@ 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):
|
||||
|
@@ -1818,7 +1818,7 @@ class USERPREF_PT_addons(AddOnPanel, Panel):
|
||||
bl_options = {'HIDE_HEADER'}
|
||||
|
||||
_support_icon_mapping = {
|
||||
'OFFICIAL': 'BLENDER',
|
||||
'OFFICIAL': 'FILE_BLEND',
|
||||
'COMMUNITY': 'COMMUNITY',
|
||||
'TESTING': 'EXPERIMENTAL',
|
||||
}
|
||||
|
@@ -91,16 +91,9 @@ short action_get_item_transforms(struct bAction *act,
|
||||
/* Some kind of bounding box operation on the action */
|
||||
void calc_action_range(const struct bAction *act, float *start, float *end, short incl_modifiers);
|
||||
|
||||
/* Retrieve the intended playback frame range, using the manually set range if available,
|
||||
* or falling back to scanning F-Curves for their first & last frames otherwise. */
|
||||
void BKE_action_get_frame_range(const struct bAction *act, float *r_start, float *r_end);
|
||||
|
||||
/* Does action have any motion data at all? */
|
||||
bool action_has_motion(const struct bAction *act);
|
||||
|
||||
/* Is the action configured as cyclic. */
|
||||
bool BKE_action_is_cyclic(const struct bAction *act);
|
||||
|
||||
/* Action Groups API ----------------- */
|
||||
|
||||
/* Get the active action-group for an Action */
|
||||
|
@@ -50,10 +50,6 @@ 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);
|
||||
|
@@ -158,7 +158,8 @@ 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_GHOST = (1 << 21), /* Debug GHOST module. */
|
||||
G_DEBUG_VK_CONTEXT = (1 << 22), /* not a debug flag, TODO move it. */
|
||||
};
|
||||
|
||||
#define G_DEBUG_ALL \
|
||||
|
@@ -149,13 +149,12 @@ typedef struct IDTypeInfo {
|
||||
/** Generic info flags about that data-block type. */
|
||||
uint32_t flags;
|
||||
|
||||
/**
|
||||
* Information and callbacks for assets, based on the type of asset.
|
||||
*/
|
||||
struct AssetTypeInfo *asset_type_info;
|
||||
|
||||
/* ********** ID management callbacks ********** */
|
||||
|
||||
/* TODO: Note about callbacks: Ideally we could also handle here `BKE_lib_query`'s behavior, as
|
||||
* well as read/write of files. However, this is a bit more involved than basic ID management
|
||||
* callbacks, so we'll check on this later. */
|
||||
|
||||
/**
|
||||
* Initialize a new, empty calloc'ed data-block. May be NULL if there is nothing to do.
|
||||
*/
|
||||
@@ -229,6 +228,11 @@ typedef struct IDTypeInfo {
|
||||
* \note Currently needed for some update operation on point caches.
|
||||
*/
|
||||
IDTypeLibOverrideApplyPost lib_override_apply_post;
|
||||
|
||||
/**
|
||||
* Callbacks for assets, based on the type of asset.
|
||||
*/
|
||||
struct AssetTypeInfo *asset_type_info;
|
||||
} IDTypeInfo;
|
||||
|
||||
/* ********** Declaration of each IDTypeInfo. ********** */
|
||||
|
@@ -24,8 +24,6 @@
|
||||
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#include "BLI_rect.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@@ -380,13 +378,8 @@ struct GPUTexture *BKE_image_get_gpu_tilemap(struct Image *image,
|
||||
bool BKE_image_has_gpu_texture_premultiplied_alpha(struct Image *image, struct ImBuf *ibuf);
|
||||
void BKE_image_update_gputexture(
|
||||
struct Image *ima, struct ImageUser *iuser, int x, int y, int w, int h);
|
||||
void BKE_image_update_gputexture_delayed(struct Image *ima,
|
||||
struct ImageTile *image_tile,
|
||||
struct ImBuf *ibuf,
|
||||
int x,
|
||||
int y,
|
||||
int w,
|
||||
int h);
|
||||
void BKE_image_update_gputexture_delayed(
|
||||
struct Image *ima, struct ImBuf *ibuf, int x, int y, int w, int h);
|
||||
void BKE_image_paint_set_mipmap(struct Main *bmain, bool mipmap);
|
||||
|
||||
/* Delayed free of OpenGL buffers by main thread */
|
||||
@@ -397,32 +390,6 @@ bool BKE_image_remove_renderslot(struct Image *ima, struct ImageUser *iuser, int
|
||||
struct RenderSlot *BKE_image_get_renderslot(struct Image *ima, int index);
|
||||
bool BKE_image_clear_renderslot(struct Image *ima, struct ImageUser *iuser, int slot);
|
||||
|
||||
/* --- image_partial_update.cc --- */
|
||||
/** Image partial updates. */
|
||||
struct PartialUpdateUser;
|
||||
|
||||
/**
|
||||
* \brief Create a new PartialUpdateUser. An Object that contains data to use partial updates.
|
||||
*/
|
||||
struct PartialUpdateUser *BKE_image_partial_update_create(const struct Image *image);
|
||||
|
||||
/**
|
||||
* \brief free a partial update user.
|
||||
*/
|
||||
void BKE_image_partial_update_free(struct PartialUpdateUser *user);
|
||||
|
||||
/* --- partial updater (image side) --- */
|
||||
struct PartialUpdateRegister;
|
||||
|
||||
void BKE_image_partial_update_register_free(struct Image *image);
|
||||
/** \brief Mark a region of the image to update. */
|
||||
void BKE_image_partial_update_mark_region(struct Image *image,
|
||||
const struct ImageTile *image_tile,
|
||||
const struct ImBuf *image_buffer,
|
||||
const rcti *updated_region);
|
||||
/** \brief Mark the whole image to be updated. */
|
||||
void BKE_image_partial_update_mark_full_update(struct Image *image);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@@ -1,295 +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.
|
||||
*
|
||||
* Copyright 2021, Blender Foundation.
|
||||
*/
|
||||
|
||||
/** \file
|
||||
* \ingroup bke
|
||||
*
|
||||
* To reduce the overhead of image processing this file contains a mechanism to detect areas of the
|
||||
* image that are changed. These areas are organized in chunks. Changes that happen over time are
|
||||
* organized in changesets.
|
||||
*
|
||||
* A common usecase is to update GPUTexture for drawing where only that part is uploaded that only
|
||||
* changed.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#include "BLI_rect.h"
|
||||
|
||||
#include "DNA_image_types.h"
|
||||
|
||||
extern "C" {
|
||||
struct PartialUpdateUser;
|
||||
struct PartialUpdateRegister;
|
||||
}
|
||||
|
||||
namespace blender::bke::image {
|
||||
|
||||
using TileNumber = int;
|
||||
|
||||
namespace partial_update {
|
||||
|
||||
/* --- image_partial_update.cc --- */
|
||||
/** Image partial updates. */
|
||||
|
||||
/**
|
||||
* \brief Result codes of #BKE_image_partial_update_collect_changes.
|
||||
*/
|
||||
enum class ePartialUpdateCollectResult {
|
||||
/** \brief Unable to construct partial updates. Caller should perform a full update. */
|
||||
FullUpdateNeeded,
|
||||
|
||||
/** \brief No changes detected since the last time requested. */
|
||||
NoChangesDetected,
|
||||
|
||||
/** \brief Changes detected since the last time requested. */
|
||||
PartialChangesDetected,
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief A region to update.
|
||||
*
|
||||
* Data is organized in tiles. These tiles are in texel space (1 unit is a single texel). When
|
||||
* tiles are requested they are merged with neighboring tiles.
|
||||
*/
|
||||
struct PartialUpdateRegion {
|
||||
/** \brief region of the image that has been updated. Region can be bigger than actual changes.
|
||||
*/
|
||||
struct rcti region;
|
||||
|
||||
/**
|
||||
* \brief Tile number (UDIM) that this region belongs to.
|
||||
*/
|
||||
TileNumber tile_number;
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief Return codes of #BKE_image_partial_update_get_next_change.
|
||||
*/
|
||||
enum class ePartialUpdateIterResult {
|
||||
/** \brief no tiles left when iterating over tiles. */
|
||||
Finished = 0,
|
||||
|
||||
/** \brief a chunk was available and has been loaded. */
|
||||
ChangeAvailable = 1,
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief collect the partial update since the last request.
|
||||
*
|
||||
* Invoke #BKE_image_partial_update_get_next_change to iterate over the collected tiles.
|
||||
*
|
||||
* \returns ePartialUpdateCollectResult::FullUpdateNeeded: called should not use partial updates
|
||||
* but recalculate the full image. This result can be expected when called for the first time for a
|
||||
* user and when it isn't possible to reconstruct the changes as the internal state doesn't have
|
||||
* enough data stored. ePartialUpdateCollectResult::NoChangesDetected: The have been no changes
|
||||
* detected since last invoke for the same user.
|
||||
* ePartialUpdateCollectResult::PartialChangesDetected: Parts of the image has been updated since
|
||||
* last invoke for the same user. The changes can be read by using
|
||||
* #BKE_image_partial_update_get_next_change.
|
||||
*/
|
||||
ePartialUpdateCollectResult BKE_image_partial_update_collect_changes(
|
||||
struct Image *image, struct PartialUpdateUser *user);
|
||||
|
||||
ePartialUpdateIterResult BKE_image_partial_update_get_next_change(
|
||||
struct PartialUpdateUser *user, struct PartialUpdateRegion *r_region);
|
||||
|
||||
/** \brief Abstract class to load tile data when using the PartialUpdateChecker. */
|
||||
class AbstractTileData {
|
||||
protected:
|
||||
virtual ~AbstractTileData() = default;
|
||||
|
||||
public:
|
||||
/**
|
||||
* \brief Load the data for the given tile_number.
|
||||
*
|
||||
* Invoked when changes are on a different tile compared to the previous tile..
|
||||
*/
|
||||
virtual void init_data(TileNumber tile_number) = 0;
|
||||
/**
|
||||
* \brief Unload the data that has been loaded.
|
||||
*
|
||||
* Invoked when changes are on a different tile compared to the previous tile or when finished
|
||||
* iterating over the changes.
|
||||
*/
|
||||
virtual void free_data() = 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief Class to not load any tile specific data when iterating over changes.
|
||||
*/
|
||||
class NoTileData : AbstractTileData {
|
||||
public:
|
||||
NoTileData(Image *UNUSED(image), ImageUser &UNUSED(image_user))
|
||||
{
|
||||
}
|
||||
|
||||
void init_data(TileNumber UNUSED(new_tile_number)) override
|
||||
{
|
||||
}
|
||||
|
||||
void free_data() override
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief Load the ImageTile and ImBuf associated with the partial change.
|
||||
*/
|
||||
class ImageTileData : AbstractTileData {
|
||||
public:
|
||||
/**
|
||||
* \brief Not owned Image that is being iterated over.
|
||||
*/
|
||||
Image *image;
|
||||
|
||||
/**
|
||||
* \brief Local copy of the image user.
|
||||
*
|
||||
* The local copy is required so we don't change the image user of the caller.
|
||||
* We need to change it in order to request data for a specific tile.
|
||||
*/
|
||||
ImageUser image_user;
|
||||
|
||||
/**
|
||||
* \brief ImageTile associated with the loaded tile.
|
||||
* Data is not owned by this instance but by the `image`.
|
||||
*/
|
||||
ImageTile *tile = nullptr;
|
||||
|
||||
/**
|
||||
* \brief ImBuf of the loaded tile.
|
||||
*
|
||||
* Can be nullptr when the file doesn't exist or when the tile hasn't been initialized.
|
||||
*/
|
||||
ImBuf *tile_buffer = nullptr;
|
||||
|
||||
ImageTileData(Image *image, ImageUser image_user) : image(image), image_user(image_user)
|
||||
{
|
||||
}
|
||||
|
||||
void init_data(TileNumber new_tile_number) override
|
||||
{
|
||||
image_user.tile = new_tile_number;
|
||||
tile = BKE_image_get_tile(image, new_tile_number);
|
||||
tile_buffer = BKE_image_acquire_ibuf(image, &image_user, NULL);
|
||||
}
|
||||
|
||||
void free_data() override
|
||||
{
|
||||
BKE_image_release_ibuf(image, tile_buffer, nullptr);
|
||||
tile = nullptr;
|
||||
tile_buffer = nullptr;
|
||||
}
|
||||
};
|
||||
|
||||
template<typename TileData = NoTileData> struct PartialUpdateChecker {
|
||||
|
||||
/**
|
||||
* \brief Not owned Image that is being iterated over.
|
||||
*/
|
||||
Image *image;
|
||||
ImageUser *image_user;
|
||||
|
||||
/**
|
||||
* \brief the collected changes are stored inside the PartialUpdateUser.
|
||||
*/
|
||||
PartialUpdateUser *user;
|
||||
|
||||
struct CollectResult {
|
||||
PartialUpdateChecker<TileData> *checker;
|
||||
|
||||
/**
|
||||
* \brief Tile specific data.
|
||||
*/
|
||||
TileData tile_data;
|
||||
PartialUpdateRegion changed_region;
|
||||
ePartialUpdateCollectResult result_code;
|
||||
|
||||
private:
|
||||
TileNumber last_tile_number;
|
||||
|
||||
public:
|
||||
CollectResult(PartialUpdateChecker<TileData> *checker, ePartialUpdateCollectResult result_code)
|
||||
: checker(checker),
|
||||
tile_data(checker->image, *checker->image_user),
|
||||
result_code(result_code)
|
||||
{
|
||||
}
|
||||
|
||||
const ePartialUpdateCollectResult get_result_code() const
|
||||
{
|
||||
return result_code;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Load the next changed region.
|
||||
*
|
||||
* This member function can only be called when partial changes are detected.
|
||||
* (`get_result_code()` returns `ePartialUpdateCollectResult::PartialChangesDetected`).
|
||||
*
|
||||
* When changes for another tile than the previous tile is loaded the #tile_data will be
|
||||
* updated.
|
||||
*/
|
||||
ePartialUpdateIterResult get_next_change()
|
||||
{
|
||||
BLI_assert(result_code == ePartialUpdateCollectResult::PartialChangesDetected);
|
||||
ePartialUpdateIterResult result = BKE_image_partial_update_get_next_change(checker->user,
|
||||
&changed_region);
|
||||
switch (result) {
|
||||
case ePartialUpdateIterResult::Finished:
|
||||
tile_data.free_data();
|
||||
return result;
|
||||
|
||||
case ePartialUpdateIterResult::ChangeAvailable:
|
||||
if (last_tile_number == changed_region.tile_number) {
|
||||
return result;
|
||||
}
|
||||
tile_data.free_data();
|
||||
tile_data.init_data(changed_region.tile_number);
|
||||
last_tile_number = changed_region.tile_number;
|
||||
return result;
|
||||
|
||||
default:
|
||||
BLI_assert_unreachable();
|
||||
return result;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
public:
|
||||
PartialUpdateChecker(Image *image, ImageUser *image_user, PartialUpdateUser *user)
|
||||
: image(image), image_user(image_user), user(user)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Check for new changes since the last time this method was invoked for this #user.
|
||||
*/
|
||||
CollectResult collect_changes()
|
||||
{
|
||||
ePartialUpdateCollectResult collect_result = BKE_image_partial_update_collect_changes(image,
|
||||
user);
|
||||
return CollectResult(this, collect_result);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace partial_update
|
||||
} // namespace blender::bke::image
|
@@ -43,12 +43,10 @@ void BKE_mesh_mirror_apply_mirror_on_axis(struct Main *bmain,
|
||||
const int axis,
|
||||
const float dist);
|
||||
|
||||
struct Mesh *BKE_mesh_mirror_apply_mirror_on_axis_for_modifier(
|
||||
struct MirrorModifierData *mmd,
|
||||
struct Object *ob,
|
||||
const struct Mesh *mesh,
|
||||
const int axis,
|
||||
const bool use_correct_order_on_merge);
|
||||
struct Mesh *BKE_mesh_mirror_apply_mirror_on_axis_for_modifier(struct MirrorModifierData *mmd,
|
||||
struct Object *ob,
|
||||
const struct Mesh *mesh,
|
||||
const int axis);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user