2011-02-21 06:58:46 +00:00
|
|
|
/*
|
2011-11-29 10:54:47 +00:00
|
|
|
* This program is free software; you can redistribute it and/or
|
Merge of first part of changes from the apricot branch, especially
the features that are needed to run the game. Compile tested with
scons, make, but not cmake, that seems to have an issue not related
to these changes. The changes include:
* GLSL support in the viewport and game engine, enable in the game
menu in textured draw mode.
* Synced and merged part of the duplicated blender and gameengine/
gameplayer drawing code.
* Further refactoring of game engine drawing code, especially mesh
storage changed a lot.
* Optimizations in game engine armatures to avoid recomputations.
* A python function to get the framerate estimate in game.
* An option take object color into account in materials.
* An option to restrict shadow casters to a lamp's layers.
* Increase from 10 to 18 texture slots for materials, lamps, word.
An extra texture slot shows up once the last slot is used.
* Memory limit for undo, not enabled by default yet because it
needs the .B.blend to be changed.
* Multiple undo for image painting.
* An offset for dupligroups, so not all objects in a group have to
be at the origin.
2008-09-04 20:51:28 +00:00
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
2011-11-29 10:54:47 +00:00
|
|
|
* of the License, or (at your option) any later version.
|
Merge of first part of changes from the apricot branch, especially
the features that are needed to run the game. Compile tested with
scons, make, but not cmake, that seems to have an issue not related
to these changes. The changes include:
* GLSL support in the viewport and game engine, enable in the game
menu in textured draw mode.
* Synced and merged part of the duplicated blender and gameengine/
gameplayer drawing code.
* Further refactoring of game engine drawing code, especially mesh
storage changed a lot.
* Optimizations in game engine armatures to avoid recomputations.
* A python function to get the framerate estimate in game.
* An option take object color into account in materials.
* An option to restrict shadow casters to a lamp's layers.
* Increase from 10 to 18 texture slots for materials, lamps, word.
An extra texture slot shows up once the last slot is used.
* Memory limit for undo, not enabled by default yet because it
needs the .B.blend to be changed.
* Multiple undo for image painting.
* An offset for dupligroups, so not all objects in a group have to
be at the origin.
2008-09-04 20:51:28 +00:00
|
|
|
*
|
2011-11-29 10:54:47 +00:00
|
|
|
* This program is distributed in the hope that it will be useful,
|
Merge of first part of changes from the apricot branch, especially
the features that are needed to run the game. Compile tested with
scons, make, but not cmake, that seems to have an issue not related
to these changes. The changes include:
* GLSL support in the viewport and game engine, enable in the game
menu in textured draw mode.
* Synced and merged part of the duplicated blender and gameengine/
gameplayer drawing code.
* Further refactoring of game engine drawing code, especially mesh
storage changed a lot.
* Optimizations in game engine armatures to avoid recomputations.
* A python function to get the framerate estimate in game.
* An option take object color into account in materials.
* An option to restrict shadow casters to a lamp's layers.
* Increase from 10 to 18 texture slots for materials, lamps, word.
An extra texture slot shows up once the last slot is used.
* Memory limit for undo, not enabled by default yet because it
needs the .B.blend to be changed.
* Multiple undo for image painting.
* An offset for dupligroups, so not all objects in a group have to
be at the origin.
2008-09-04 20:51:28 +00:00
|
|
|
* 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
|
2011-11-29 10:54:47 +00:00
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
2010-02-12 13:34:04 +00:00
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
Merge of first part of changes from the apricot branch, especially
the features that are needed to run the game. Compile tested with
scons, make, but not cmake, that seems to have an issue not related
to these changes. The changes include:
* GLSL support in the viewport and game engine, enable in the game
menu in textured draw mode.
* Synced and merged part of the duplicated blender and gameengine/
gameplayer drawing code.
* Further refactoring of game engine drawing code, especially mesh
storage changed a lot.
* Optimizations in game engine armatures to avoid recomputations.
* A python function to get the framerate estimate in game.
* An option take object color into account in materials.
* An option to restrict shadow casters to a lamp's layers.
* Increase from 10 to 18 texture slots for materials, lamps, word.
An extra texture slot shows up once the last slot is used.
* Memory limit for undo, not enabled by default yet because it
needs the .B.blend to be changed.
* Multiple undo for image painting.
* An offset for dupligroups, so not all objects in a group have to
be at the origin.
2008-09-04 20:51:28 +00:00
|
|
|
*
|
|
|
|
* The Original Code is Copyright (C) 2005 Blender Foundation.
|
|
|
|
* All rights reserved.
|
|
|
|
*/
|
|
|
|
|
2019-02-18 08:08:12 +11:00
|
|
|
/** \file
|
|
|
|
* \ingroup gpu
|
2011-02-21 06:58:46 +00:00
|
|
|
*/
|
|
|
|
|
2012-02-17 18:59:41 +00:00
|
|
|
#pragma once
|
Merge of first part of changes from the apricot branch, especially
the features that are needed to run the game. Compile tested with
scons, make, but not cmake, that seems to have an issue not related
to these changes. The changes include:
* GLSL support in the viewport and game engine, enable in the game
menu in textured draw mode.
* Synced and merged part of the duplicated blender and gameengine/
gameplayer drawing code.
* Further refactoring of game engine drawing code, especially mesh
storage changed a lot.
* Optimizations in game engine armatures to avoid recomputations.
* A python function to get the framerate estimate in game.
* An option take object color into account in materials.
* An option to restrict shadow casters to a lamp's layers.
* Increase from 10 to 18 texture slots for materials, lamps, word.
An extra texture slot shows up once the last slot is used.
* Memory limit for undo, not enabled by default yet because it
needs the .B.blend to be changed.
* Multiple undo for image painting.
* An offset for dupligroups, so not all objects in a group have to
be at the origin.
2008-09-04 20:51:28 +00:00
|
|
|
|
2015-01-24 13:25:49 +01:00
|
|
|
#include "DNA_customdata_types.h" /* for CustomDataType */
|
2011-09-09 11:55:38 +00:00
|
|
|
#include "DNA_listBase.h"
|
|
|
|
|
2014-10-07 15:46:19 -05:00
|
|
|
#include "BLI_sys_types.h" /* for bool */
|
|
|
|
|
2020-06-03 13:35:15 +02:00
|
|
|
#include "GPU_texture.h" /* for eGPUSamplerState */
|
|
|
|
|
Merge of first part of changes from the apricot branch, especially
the features that are needed to run the game. Compile tested with
scons, make, but not cmake, that seems to have an issue not related
to these changes. The changes include:
* GLSL support in the viewport and game engine, enable in the game
menu in textured draw mode.
* Synced and merged part of the duplicated blender and gameengine/
gameplayer drawing code.
* Further refactoring of game engine drawing code, especially mesh
storage changed a lot.
* Optimizations in game engine armatures to avoid recomputations.
* A python function to get the framerate estimate in game.
* An option take object color into account in materials.
* An option to restrict shadow casters to a lamp's layers.
* Increase from 10 to 18 texture slots for materials, lamps, word.
An extra texture slot shows up once the last slot is used.
* Memory limit for undo, not enabled by default yet because it
needs the .B.blend to be changed.
* Multiple undo for image painting.
* An offset for dupligroups, so not all objects in a group have to
be at the origin.
2008-09-04 20:51:28 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
Materials: add custom object properties as uniform attributes.
This patch allows the user to type a property name into the
Attribute node, which will then output the value of the property
for each individual object, allowing to e.g. customize shaders
by object without duplicating the shader.
In order to make supporting this easier for Eevee, it is necessary
to explicitly choose whether the attribute is varying or uniform
via a dropdown option of the Attribute node. The dropdown also
allows choosing whether instancing should be taken into account.
The Cycles design treats all attributes as one common namespace,
so the Blender interface converts the enum to a name prefix that
can't be entered using keyboard.
In Eevee, the attributes are provided to the shader via a UBO indexed
with resource_id, similar to the existing Object Info data. Unlike it,
however, it is necessary to maintain a separate buffer for every
requested combination of attributes.
This is done using a hash table with the attribute set as the key,
as it is expected that technically different but similar materials
may use the same set of attributes. In addition, in order to minimize
wasted memory, a sparse UBO pool is implemented, so that chunks that
don't contain any data don't have to be allocated.
The back-end Cycles code is already refactored and committed by Brecht.
Differential Revision: https://developer.blender.org/D2057
2020-08-05 19:14:40 +03:00
|
|
|
struct GHash;
|
2019-01-28 21:08:24 +11:00
|
|
|
struct GPUMaterial;
|
|
|
|
struct GPUNode;
|
|
|
|
struct GPUNodeLink;
|
|
|
|
struct GPUNodeStack;
|
|
|
|
struct GPUTexture;
|
2020-08-20 23:09:37 +02:00
|
|
|
struct GPUUniformBuf;
|
Merge of first part of changes from the apricot branch, especially
the features that are needed to run the game. Compile tested with
scons, make, but not cmake, that seems to have an issue not related
to these changes. The changes include:
* GLSL support in the viewport and game engine, enable in the game
menu in textured draw mode.
* Synced and merged part of the duplicated blender and gameengine/
gameplayer drawing code.
* Further refactoring of game engine drawing code, especially mesh
storage changed a lot.
* Optimizations in game engine armatures to avoid recomputations.
* A python function to get the framerate estimate in game.
* An option take object color into account in materials.
* An option to restrict shadow casters to a lamp's layers.
* Increase from 10 to 18 texture slots for materials, lamps, word.
An extra texture slot shows up once the last slot is used.
* Memory limit for undo, not enabled by default yet because it
needs the .B.blend to be changed.
* Multiple undo for image painting.
* An offset for dupligroups, so not all objects in a group have to
be at the origin.
2008-09-04 20:51:28 +00:00
|
|
|
struct Image;
|
|
|
|
struct ImageUser;
|
2017-07-14 17:40:54 +02:00
|
|
|
struct ListBase;
|
2018-06-25 12:32:48 +02:00
|
|
|
struct Main;
|
Merge of first part of changes from the apricot branch, especially
the features that are needed to run the game. Compile tested with
scons, make, but not cmake, that seems to have an issue not related
to these changes. The changes include:
* GLSL support in the viewport and game engine, enable in the game
menu in textured draw mode.
* Synced and merged part of the duplicated blender and gameengine/
gameplayer drawing code.
* Further refactoring of game engine drawing code, especially mesh
storage changed a lot.
* Optimizations in game engine armatures to avoid recomputations.
* A python function to get the framerate estimate in game.
* An option take object color into account in materials.
* An option to restrict shadow casters to a lamp's layers.
* Increase from 10 to 18 texture slots for materials, lamps, word.
An extra texture slot shows up once the last slot is used.
* Memory limit for undo, not enabled by default yet because it
needs the .B.blend to be changed.
* Multiple undo for image painting.
* An offset for dupligroups, so not all objects in a group have to
be at the origin.
2008-09-04 20:51:28 +00:00
|
|
|
struct Material;
|
2019-01-28 21:08:24 +11:00
|
|
|
struct Scene;
|
2017-07-14 17:40:54 +02:00
|
|
|
struct bNode;
|
2017-04-27 22:27:09 +02:00
|
|
|
struct bNodeTree;
|
Merge of first part of changes from the apricot branch, especially
the features that are needed to run the game. Compile tested with
scons, make, but not cmake, that seems to have an issue not related
to these changes. The changes include:
* GLSL support in the viewport and game engine, enable in the game
menu in textured draw mode.
* Synced and merged part of the duplicated blender and gameengine/
gameplayer drawing code.
* Further refactoring of game engine drawing code, especially mesh
storage changed a lot.
* Optimizations in game engine armatures to avoid recomputations.
* A python function to get the framerate estimate in game.
* An option take object color into account in materials.
* An option to restrict shadow casters to a lamp's layers.
* Increase from 10 to 18 texture slots for materials, lamps, word.
An extra texture slot shows up once the last slot is used.
* Memory limit for undo, not enabled by default yet because it
needs the .B.blend to be changed.
* Multiple undo for image painting.
* An offset for dupligroups, so not all objects in a group have to
be at the origin.
2008-09-04 20:51:28 +00:00
|
|
|
|
2019-01-28 21:08:24 +11:00
|
|
|
typedef struct GPUMaterial GPUMaterial;
|
Merge of first part of changes from the apricot branch, especially
the features that are needed to run the game. Compile tested with
scons, make, but not cmake, that seems to have an issue not related
to these changes. The changes include:
* GLSL support in the viewport and game engine, enable in the game
menu in textured draw mode.
* Synced and merged part of the duplicated blender and gameengine/
gameplayer drawing code.
* Further refactoring of game engine drawing code, especially mesh
storage changed a lot.
* Optimizations in game engine armatures to avoid recomputations.
* A python function to get the framerate estimate in game.
* An option take object color into account in materials.
* An option to restrict shadow casters to a lamp's layers.
* Increase from 10 to 18 texture slots for materials, lamps, word.
An extra texture slot shows up once the last slot is used.
* Memory limit for undo, not enabled by default yet because it
needs the .B.blend to be changed.
* Multiple undo for image painting.
* An offset for dupligroups, so not all objects in a group have to
be at the origin.
2008-09-04 20:51:28 +00:00
|
|
|
typedef struct GPUNode GPUNode;
|
|
|
|
typedef struct GPUNodeLink GPUNodeLink;
|
2017-04-03 15:38:00 +02:00
|
|
|
|
2021-12-09 20:01:47 +11:00
|
|
|
/* Functions to create GPU Materials nodes. */
|
Merge of first part of changes from the apricot branch, especially
the features that are needed to run the game. Compile tested with
scons, make, but not cmake, that seems to have an issue not related
to these changes. The changes include:
* GLSL support in the viewport and game engine, enable in the game
menu in textured draw mode.
* Synced and merged part of the duplicated blender and gameengine/
gameplayer drawing code.
* Further refactoring of game engine drawing code, especially mesh
storage changed a lot.
* Optimizations in game engine armatures to avoid recomputations.
* A python function to get the framerate estimate in game.
* An option take object color into account in materials.
* An option to restrict shadow casters to a lamp's layers.
* Increase from 10 to 18 texture slots for materials, lamps, word.
An extra texture slot shows up once the last slot is used.
* Memory limit for undo, not enabled by default yet because it
needs the .B.blend to be changed.
* Multiple undo for image painting.
* An offset for dupligroups, so not all objects in a group have to
be at the origin.
2008-09-04 20:51:28 +00:00
|
|
|
|
2019-01-23 14:15:43 +11:00
|
|
|
typedef enum eGPUType {
|
2017-09-14 01:02:10 +02:00
|
|
|
/* Keep in sync with GPU_DATATYPE_STR */
|
2015-01-24 13:43:57 +01:00
|
|
|
/* The value indicates the number of elements in each type */
|
Merge of first part of changes from the apricot branch, especially
the features that are needed to run the game. Compile tested with
scons, make, but not cmake, that seems to have an issue not related
to these changes. The changes include:
* GLSL support in the viewport and game engine, enable in the game
menu in textured draw mode.
* Synced and merged part of the duplicated blender and gameengine/
gameplayer drawing code.
* Further refactoring of game engine drawing code, especially mesh
storage changed a lot.
* Optimizations in game engine armatures to avoid recomputations.
* A python function to get the framerate estimate in game.
* An option take object color into account in materials.
* An option to restrict shadow casters to a lamp's layers.
* Increase from 10 to 18 texture slots for materials, lamps, word.
An extra texture slot shows up once the last slot is used.
* Memory limit for undo, not enabled by default yet because it
needs the .B.blend to be changed.
* Multiple undo for image painting.
* An offset for dupligroups, so not all objects in a group have to
be at the origin.
2008-09-04 20:51:28 +00:00
|
|
|
GPU_NONE = 0,
|
|
|
|
GPU_FLOAT = 1,
|
|
|
|
GPU_VEC2 = 2,
|
|
|
|
GPU_VEC3 = 3,
|
|
|
|
GPU_VEC4 = 4,
|
|
|
|
GPU_MAT3 = 9,
|
|
|
|
GPU_MAT4 = 16,
|
2020-02-27 13:55:29 +01:00
|
|
|
GPU_MAX_CONSTANT_DATA = GPU_MAT4,
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2017-09-14 01:02:10 +02:00
|
|
|
/* Values not in GPU_DATATYPE_STR */
|
2018-08-10 15:13:39 +02:00
|
|
|
GPU_TEX1D_ARRAY = 1001,
|
Merge of first part of changes from the apricot branch, especially
the features that are needed to run the game. Compile tested with
scons, make, but not cmake, that seems to have an issue not related
to these changes. The changes include:
* GLSL support in the viewport and game engine, enable in the game
menu in textured draw mode.
* Synced and merged part of the duplicated blender and gameengine/
gameplayer drawing code.
* Further refactoring of game engine drawing code, especially mesh
storage changed a lot.
* Optimizations in game engine armatures to avoid recomputations.
* A python function to get the framerate estimate in game.
* An option take object color into account in materials.
* An option to restrict shadow casters to a lamp's layers.
* Increase from 10 to 18 texture slots for materials, lamps, word.
An extra texture slot shows up once the last slot is used.
* Memory limit for undo, not enabled by default yet because it
needs the .B.blend to be changed.
* Multiple undo for image painting.
* An offset for dupligroups, so not all objects in a group have to
be at the origin.
2008-09-04 20:51:28 +00:00
|
|
|
GPU_TEX2D = 1002,
|
Fix T73133: UDIM texture count in Eevee is limited by OpenGL
Based on @fclem's suggestion in D6421, this commit implements support for
storing all tiles of a UDIM texture in a single 2D array texture on the GPU.
Previously, Eevee was binding one OpenGL texture per tile, quickly running
into hardware limits with nontrivial UDIM texture sets.
Workbench meanwhile had no UDIM support at all, as reusing the per-tile
approach would require splitting the mesh by tile as well as texture.
With this commit, both Workbench as well as Eevee now support huge numbers
of tiles, with the eventual limits being GPU memory and ultimately
GL_MAX_ARRAY_TEXTURE_LAYERS, which tends to be in the 1000s on modern GPUs.
Initially my plan was to have one array texture per unique size, but managing
the different textures and keeping everything consistent ended up being way
too complex.
Therefore, we now use a simpler version that allocates a texture that
is large enough to fit the largest tile and then packs all tiles into as many
layers as necessary.
As a result, each UDIM texture only binds two textures (one for the actual
images, one for metadata) regardless of how many tiles are used.
Note that this rolls back per-tile GPUTextures, meaning that we again have
per-Image GPUTextures like we did before the original UDIM commit,
but now with four instead of two types.
Reviewed By: fclem
Differential Revision: https://developer.blender.org/D6456
2020-01-14 00:33:21 +01:00
|
|
|
GPU_TEX2D_ARRAY = 1003,
|
|
|
|
GPU_TEX3D = 1004,
|
|
|
|
GPU_SHADOW2D = 1005,
|
|
|
|
GPU_TEXCUBE = 1006,
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2017-09-14 01:02:10 +02:00
|
|
|
/* GLSL Struct types */
|
Fix T73133: UDIM texture count in Eevee is limited by OpenGL
Based on @fclem's suggestion in D6421, this commit implements support for
storing all tiles of a UDIM texture in a single 2D array texture on the GPU.
Previously, Eevee was binding one OpenGL texture per tile, quickly running
into hardware limits with nontrivial UDIM texture sets.
Workbench meanwhile had no UDIM support at all, as reusing the per-tile
approach would require splitting the mesh by tile as well as texture.
With this commit, both Workbench as well as Eevee now support huge numbers
of tiles, with the eventual limits being GPU memory and ultimately
GL_MAX_ARRAY_TEXTURE_LAYERS, which tends to be in the 1000s on modern GPUs.
Initially my plan was to have one array texture per unique size, but managing
the different textures and keeping everything consistent ended up being way
too complex.
Therefore, we now use a simpler version that allocates a texture that
is large enough to fit the largest tile and then packs all tiles into as many
layers as necessary.
As a result, each UDIM texture only binds two textures (one for the actual
images, one for metadata) regardless of how many tiles are used.
Note that this rolls back per-tile GPUTextures, meaning that we again have
per-Image GPUTextures like we did before the original UDIM commit,
but now with four instead of two types.
Reviewed By: fclem
Differential Revision: https://developer.blender.org/D6456
2020-01-14 00:33:21 +01:00
|
|
|
GPU_CLOSURE = 1007,
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2017-09-14 01:02:10 +02:00
|
|
|
/* Opengl Attributes */
|
2019-01-29 07:46:25 +11:00
|
|
|
GPU_ATTR = 3001,
|
2019-01-23 14:15:43 +11:00
|
|
|
} eGPUType;
|
Merge of first part of changes from the apricot branch, especially
the features that are needed to run the game. Compile tested with
scons, make, but not cmake, that seems to have an issue not related
to these changes. The changes include:
* GLSL support in the viewport and game engine, enable in the game
menu in textured draw mode.
* Synced and merged part of the duplicated blender and gameengine/
gameplayer drawing code.
* Further refactoring of game engine drawing code, especially mesh
storage changed a lot.
* Optimizations in game engine armatures to avoid recomputations.
* A python function to get the framerate estimate in game.
* An option take object color into account in materials.
* An option to restrict shadow casters to a lamp's layers.
* Increase from 10 to 18 texture slots for materials, lamps, word.
An extra texture slot shows up once the last slot is used.
* Memory limit for undo, not enabled by default yet because it
needs the .B.blend to be changed.
* Multiple undo for image painting.
* An offset for dupligroups, so not all objects in a group have to
be at the origin.
2008-09-04 20:51:28 +00:00
|
|
|
|
2019-01-23 14:15:43 +11:00
|
|
|
typedef enum eGPUBuiltin {
|
2015-02-02 14:25:44 +01:00
|
|
|
GPU_VIEW_MATRIX = (1 << 0),
|
|
|
|
GPU_OBJECT_MATRIX = (1 << 1),
|
|
|
|
GPU_INVERSE_VIEW_MATRIX = (1 << 2),
|
|
|
|
GPU_INVERSE_OBJECT_MATRIX = (1 << 3),
|
|
|
|
GPU_VIEW_POSITION = (1 << 4),
|
|
|
|
GPU_VIEW_NORMAL = (1 << 5),
|
2019-08-22 14:26:09 +02:00
|
|
|
GPU_OBJECT_COLOR = (1 << 6),
|
2015-02-02 14:25:44 +01:00
|
|
|
GPU_AUTO_BUMPSCALE = (1 << 7),
|
2015-03-23 15:29:42 -04:00
|
|
|
GPU_CAMERA_TEXCO_FACTORS = (1 << 8),
|
2016-12-28 17:30:58 +01:00
|
|
|
GPU_PARTICLE_SCALAR_PROPS = (1 << 9),
|
2018-07-18 23:09:31 +10:00
|
|
|
GPU_PARTICLE_LOCATION = (1 << 10),
|
2016-12-28 17:30:58 +01:00
|
|
|
GPU_PARTICLE_VELOCITY = (1 << 11),
|
|
|
|
GPU_PARTICLE_ANG_VELOCITY = (1 << 12),
|
|
|
|
GPU_LOC_TO_VIEW_MATRIX = (1 << 13),
|
Vector Transform node support for GLSL mode and the internal renderer
The Vector Transform node is a useful node which is present in the Cycles renderer.
{F144283}
This patch implements the Vector Transform node for GLSL mode and the internal renderer.
Example: {F273060}
Alexander (Blend4Web Team)
Reviewers: brecht, campbellbarton, sergey
Reviewed By: campbellbarton, sergey
Subscribers: psy-fi, duarteframos, RobM, lightbwk, sergey, AlexKowel, valentin_b4w, Evgeny_Rodygin, yurikovelenov
Projects: #bf_blender:_next
Differential Revision: https://developer.blender.org/D909
2016-01-23 15:27:36 +03:00
|
|
|
GPU_INVERSE_LOC_TO_VIEW_MATRIX = (1 << 14),
|
2017-10-27 22:35:48 +02:00
|
|
|
GPU_OBJECT_INFO = (1 << 15),
|
2020-03-11 14:58:19 +01:00
|
|
|
GPU_BARYCENTRIC_TEXCO = (1 << 16),
|
|
|
|
GPU_BARYCENTRIC_DIST = (1 << 17),
|
|
|
|
GPU_WORLD_NORMAL = (1 << 18),
|
2019-01-23 14:15:43 +11:00
|
|
|
} eGPUBuiltin;
|
Merge of first part of changes from the apricot branch, especially
the features that are needed to run the game. Compile tested with
scons, make, but not cmake, that seems to have an issue not related
to these changes. The changes include:
* GLSL support in the viewport and game engine, enable in the game
menu in textured draw mode.
* Synced and merged part of the duplicated blender and gameengine/
gameplayer drawing code.
* Further refactoring of game engine drawing code, especially mesh
storage changed a lot.
* Optimizations in game engine armatures to avoid recomputations.
* A python function to get the framerate estimate in game.
* An option take object color into account in materials.
* An option to restrict shadow casters to a lamp's layers.
* Increase from 10 to 18 texture slots for materials, lamps, word.
An extra texture slot shows up once the last slot is used.
* Memory limit for undo, not enabled by default yet because it
needs the .B.blend to be changed.
* Multiple undo for image painting.
* An offset for dupligroups, so not all objects in a group have to
be at the origin.
2008-09-04 20:51:28 +00:00
|
|
|
|
2019-01-23 14:15:43 +11:00
|
|
|
typedef enum eGPUMatFlag {
|
2018-08-03 18:53:36 +02:00
|
|
|
GPU_MATFLAG_DIFFUSE = (1 << 0),
|
|
|
|
GPU_MATFLAG_GLOSSY = (1 << 1),
|
|
|
|
GPU_MATFLAG_REFRACT = (1 << 2),
|
2018-08-08 18:34:25 +02:00
|
|
|
GPU_MATFLAG_SSS = (1 << 3),
|
2020-07-30 13:55:13 +02:00
|
|
|
GPU_MATFLAG_BARYCENTRIC = (1 << 4),
|
2019-01-23 14:15:43 +11:00
|
|
|
} eGPUMatFlag;
|
2014-11-24 17:18:56 +01:00
|
|
|
|
Merge of first part of changes from the apricot branch, especially
the features that are needed to run the game. Compile tested with
scons, make, but not cmake, that seems to have an issue not related
to these changes. The changes include:
* GLSL support in the viewport and game engine, enable in the game
menu in textured draw mode.
* Synced and merged part of the duplicated blender and gameengine/
gameplayer drawing code.
* Further refactoring of game engine drawing code, especially mesh
storage changed a lot.
* Optimizations in game engine armatures to avoid recomputations.
* A python function to get the framerate estimate in game.
* An option take object color into account in materials.
* An option to restrict shadow casters to a lamp's layers.
* Increase from 10 to 18 texture slots for materials, lamps, word.
An extra texture slot shows up once the last slot is used.
* Memory limit for undo, not enabled by default yet because it
needs the .B.blend to be changed.
* Multiple undo for image painting.
* An offset for dupligroups, so not all objects in a group have to
be at the origin.
2008-09-04 20:51:28 +00:00
|
|
|
typedef struct GPUNodeStack {
|
2019-01-23 14:15:43 +11:00
|
|
|
eGPUType type;
|
Merge of first part of changes from the apricot branch, especially
the features that are needed to run the game. Compile tested with
scons, make, but not cmake, that seems to have an issue not related
to these changes. The changes include:
* GLSL support in the viewport and game engine, enable in the game
menu in textured draw mode.
* Synced and merged part of the duplicated blender and gameengine/
gameplayer drawing code.
* Further refactoring of game engine drawing code, especially mesh
storage changed a lot.
* Optimizations in game engine armatures to avoid recomputations.
* A python function to get the framerate estimate in game.
* An option take object color into account in materials.
* An option to restrict shadow casters to a lamp's layers.
* Increase from 10 to 18 texture slots for materials, lamps, word.
An extra texture slot shows up once the last slot is used.
* Memory limit for undo, not enabled by default yet because it
needs the .B.blend to be changed.
* Multiple undo for image painting.
* An offset for dupligroups, so not all objects in a group have to
be at the origin.
2008-09-04 20:51:28 +00:00
|
|
|
float vec[4];
|
|
|
|
struct GPUNodeLink *link;
|
2014-04-11 11:25:41 +10:00
|
|
|
bool hasinput;
|
|
|
|
bool hasoutput;
|
Merge of first part of changes from the apricot branch, especially
the features that are needed to run the game. Compile tested with
scons, make, but not cmake, that seems to have an issue not related
to these changes. The changes include:
* GLSL support in the viewport and game engine, enable in the game
menu in textured draw mode.
* Synced and merged part of the duplicated blender and gameengine/
gameplayer drawing code.
* Further refactoring of game engine drawing code, especially mesh
storage changed a lot.
* Optimizations in game engine armatures to avoid recomputations.
* A python function to get the framerate estimate in game.
* An option take object color into account in materials.
* An option to restrict shadow casters to a lamp's layers.
* Increase from 10 to 18 texture slots for materials, lamps, word.
An extra texture slot shows up once the last slot is used.
* Memory limit for undo, not enabled by default yet because it
needs the .B.blend to be changed.
* Multiple undo for image painting.
* An offset for dupligroups, so not all objects in a group have to
be at the origin.
2008-09-04 20:51:28 +00:00
|
|
|
short sockettype;
|
2018-02-22 20:52:08 +01:00
|
|
|
bool end;
|
Merge of first part of changes from the apricot branch, especially
the features that are needed to run the game. Compile tested with
scons, make, but not cmake, that seems to have an issue not related
to these changes. The changes include:
* GLSL support in the viewport and game engine, enable in the game
menu in textured draw mode.
* Synced and merged part of the duplicated blender and gameengine/
gameplayer drawing code.
* Further refactoring of game engine drawing code, especially mesh
storage changed a lot.
* Optimizations in game engine armatures to avoid recomputations.
* A python function to get the framerate estimate in game.
* An option take object color into account in materials.
* An option to restrict shadow casters to a lamp's layers.
* Increase from 10 to 18 texture slots for materials, lamps, word.
An extra texture slot shows up once the last slot is used.
* Memory limit for undo, not enabled by default yet because it
needs the .B.blend to be changed.
* Multiple undo for image painting.
* An offset for dupligroups, so not all objects in a group have to
be at the origin.
2008-09-04 20:51:28 +00:00
|
|
|
} GPUNodeStack;
|
|
|
|
|
2019-01-23 14:15:43 +11:00
|
|
|
typedef enum eGPUMaterialStatus {
|
2018-03-05 00:54:31 +01:00
|
|
|
GPU_MAT_FAILED = 0,
|
|
|
|
GPU_MAT_QUEUED,
|
|
|
|
GPU_MAT_SUCCESS,
|
2019-01-23 14:15:43 +11:00
|
|
|
} eGPUMaterialStatus;
|
2015-05-21 08:08:27 +10:00
|
|
|
|
2020-09-03 15:26:52 +02:00
|
|
|
typedef enum eGPUVolumeDefaultValue {
|
|
|
|
GPU_VOLUME_DEFAULT_0,
|
|
|
|
GPU_VOLUME_DEFAULT_1,
|
|
|
|
} eGPUVolumeDefaultValue;
|
|
|
|
|
2020-07-30 17:01:13 +02:00
|
|
|
typedef void (*GPUMaterialEvalCallbackFn)(GPUMaterial *mat,
|
|
|
|
int options,
|
|
|
|
const char **vert_code,
|
|
|
|
const char **geom_code,
|
|
|
|
const char **frag_lib,
|
|
|
|
const char **defines);
|
2020-07-30 13:55:13 +02:00
|
|
|
|
2020-02-27 13:55:29 +01:00
|
|
|
GPUNodeLink *GPU_constant(const float *num);
|
|
|
|
GPUNodeLink *GPU_uniform(const float *num);
|
|
|
|
GPUNodeLink *GPU_attribute(GPUMaterial *mat, CustomDataType type, const char *name);
|
Materials: add custom object properties as uniform attributes.
This patch allows the user to type a property name into the
Attribute node, which will then output the value of the property
for each individual object, allowing to e.g. customize shaders
by object without duplicating the shader.
In order to make supporting this easier for Eevee, it is necessary
to explicitly choose whether the attribute is varying or uniform
via a dropdown option of the Attribute node. The dropdown also
allows choosing whether instancing should be taken into account.
The Cycles design treats all attributes as one common namespace,
so the Blender interface converts the enum to a name prefix that
can't be entered using keyboard.
In Eevee, the attributes are provided to the shader via a UBO indexed
with resource_id, similar to the existing Object Info data. Unlike it,
however, it is necessary to maintain a separate buffer for every
requested combination of attributes.
This is done using a hash table with the attribute set as the key,
as it is expected that technically different but similar materials
may use the same set of attributes. In addition, in order to minimize
wasted memory, a sparse UBO pool is implemented, so that chunks that
don't contain any data don't have to be allocated.
The back-end Cycles code is already refactored and committed by Brecht.
Differential Revision: https://developer.blender.org/D2057
2020-08-05 19:14:40 +03:00
|
|
|
GPUNodeLink *GPU_uniform_attribute(GPUMaterial *mat, const char *name, bool use_dupli);
|
2020-06-03 13:35:15 +02:00
|
|
|
GPUNodeLink *GPU_image(GPUMaterial *mat,
|
|
|
|
struct Image *ima,
|
|
|
|
struct ImageUser *iuser,
|
|
|
|
eGPUSamplerState sampler_state);
|
|
|
|
GPUNodeLink *GPU_image_tiled(GPUMaterial *mat,
|
|
|
|
struct Image *ima,
|
|
|
|
struct ImageUser *iuser,
|
|
|
|
eGPUSamplerState sampler_state);
|
2020-02-27 13:55:29 +01:00
|
|
|
GPUNodeLink *GPU_image_tiled_mapping(GPUMaterial *mat, struct Image *ima, struct ImageUser *iuser);
|
2020-09-04 20:59:13 +02:00
|
|
|
GPUNodeLink *GPU_color_band(GPUMaterial *mat, int size, float *pixels, float *row);
|
2020-09-03 15:26:52 +02:00
|
|
|
GPUNodeLink *GPU_volume_grid(GPUMaterial *mat,
|
|
|
|
const char *name,
|
|
|
|
eGPUVolumeDefaultValue default_value);
|
2019-01-23 14:15:43 +11:00
|
|
|
GPUNodeLink *GPU_builtin(eGPUBuiltin builtin);
|
Merge of first part of changes from the apricot branch, especially
the features that are needed to run the game. Compile tested with
scons, make, but not cmake, that seems to have an issue not related
to these changes. The changes include:
* GLSL support in the viewport and game engine, enable in the game
menu in textured draw mode.
* Synced and merged part of the duplicated blender and gameengine/
gameplayer drawing code.
* Further refactoring of game engine drawing code, especially mesh
storage changed a lot.
* Optimizations in game engine armatures to avoid recomputations.
* A python function to get the framerate estimate in game.
* An option take object color into account in materials.
* An option to restrict shadow casters to a lamp's layers.
* Increase from 10 to 18 texture slots for materials, lamps, word.
An extra texture slot shows up once the last slot is used.
* Memory limit for undo, not enabled by default yet because it
needs the .B.blend to be changed.
* Multiple undo for image painting.
* An offset for dupligroups, so not all objects in a group have to
be at the origin.
2008-09-04 20:51:28 +00:00
|
|
|
|
2014-02-03 18:55:59 +11:00
|
|
|
bool GPU_link(GPUMaterial *mat, const char *name, ...);
|
2017-07-14 17:40:54 +02:00
|
|
|
bool GPU_stack_link(GPUMaterial *mat,
|
|
|
|
struct bNode *node,
|
|
|
|
const char *name,
|
|
|
|
GPUNodeStack *in,
|
|
|
|
GPUNodeStack *out,
|
|
|
|
...);
|
2020-08-20 23:09:37 +02:00
|
|
|
GPUNodeLink *GPU_uniformbuf_link_out(struct GPUMaterial *mat,
|
|
|
|
struct bNode *node,
|
|
|
|
struct GPUNodeStack *stack,
|
|
|
|
const int index);
|
Merge of first part of changes from the apricot branch, especially
the features that are needed to run the game. Compile tested with
scons, make, but not cmake, that seems to have an issue not related
to these changes. The changes include:
* GLSL support in the viewport and game engine, enable in the game
menu in textured draw mode.
* Synced and merged part of the duplicated blender and gameengine/
gameplayer drawing code.
* Further refactoring of game engine drawing code, especially mesh
storage changed a lot.
* Optimizations in game engine armatures to avoid recomputations.
* A python function to get the framerate estimate in game.
* An option take object color into account in materials.
* An option to restrict shadow casters to a lamp's layers.
* Increase from 10 to 18 texture slots for materials, lamps, word.
An extra texture slot shows up once the last slot is used.
* Memory limit for undo, not enabled by default yet because it
needs the .B.blend to be changed.
* Multiple undo for image painting.
* An offset for dupligroups, so not all objects in a group have to
be at the origin.
2008-09-04 20:51:28 +00:00
|
|
|
|
|
|
|
void GPU_material_output_link(GPUMaterial *material, GPUNodeLink *link);
|
2020-12-04 08:13:54 +01:00
|
|
|
void GPU_material_add_output_link_aov(GPUMaterial *material, GPUNodeLink *link, int hash);
|
Merge of first part of changes from the apricot branch, especially
the features that are needed to run the game. Compile tested with
scons, make, but not cmake, that seems to have an issue not related
to these changes. The changes include:
* GLSL support in the viewport and game engine, enable in the game
menu in textured draw mode.
* Synced and merged part of the duplicated blender and gameengine/
gameplayer drawing code.
* Further refactoring of game engine drawing code, especially mesh
storage changed a lot.
* Optimizations in game engine armatures to avoid recomputations.
* A python function to get the framerate estimate in game.
* An option take object color into account in materials.
* An option to restrict shadow casters to a lamp's layers.
* Increase from 10 to 18 texture slots for materials, lamps, word.
An extra texture slot shows up once the last slot is used.
* Memory limit for undo, not enabled by default yet because it
needs the .B.blend to be changed.
* Multiple undo for image painting.
* An offset for dupligroups, so not all objects in a group have to
be at the origin.
2008-09-04 20:51:28 +00:00
|
|
|
|
Cycles: merge of cycles-x branch, a major update to the renderer
This includes much improved GPU rendering performance, viewport interactivity,
new shadow catcher, revamped sampling settings, subsurface scattering anisotropy,
new GPU volume sampling, improved PMJ sampling pattern, and more.
Some features have also been removed or changed, breaking backwards compatibility.
Including the removal of the OpenCL backend, for which alternatives are under
development.
Release notes and code docs:
https://wiki.blender.org/wiki/Reference/Release_Notes/3.0/Cycles
https://wiki.blender.org/wiki/Source/Render/Cycles
Credits:
* Sergey Sharybin
* Brecht Van Lommel
* Patrick Mours (OptiX backend)
* Christophe Hery (subsurface scattering anisotropy)
* William Leeson (PMJ sampling pattern)
* Alaska (various fixes and tweaks)
* Thomas Dinges (various fixes)
For the full commit history, see the cycles-x branch. This squashes together
all the changes since intermediate changes would often fail building or tests.
Ref T87839, T87837, T87836
Fixes T90734, T89353, T80267, T80267, T77185, T69800
2021-09-20 17:59:20 +02:00
|
|
|
void GPU_material_sss_profile_create(GPUMaterial *material, float radii[3]);
|
2020-08-20 23:09:37 +02:00
|
|
|
struct GPUUniformBuf *GPU_material_sss_profile_get(GPUMaterial *material,
|
|
|
|
int sample_len,
|
|
|
|
struct GPUTexture **tex_profile);
|
2017-11-14 00:49:54 +01:00
|
|
|
|
2021-12-09 20:01:47 +11:00
|
|
|
/**
|
|
|
|
* High level functions to create and use GPU materials.
|
|
|
|
*/
|
2017-06-28 10:50:33 +10:00
|
|
|
GPUMaterial *GPU_material_from_nodetree_find(struct ListBase *gpumaterials,
|
|
|
|
const void *engine_type,
|
|
|
|
int options);
|
2021-12-09 20:01:47 +11:00
|
|
|
/**
|
|
|
|
* \note Caller must use #GPU_material_from_nodetree_find to re-use existing materials,
|
|
|
|
* This is enforced since constructing other arguments to this function may be expensive
|
|
|
|
* so only do this when they are needed.
|
|
|
|
*/
|
2017-04-27 22:27:09 +02:00
|
|
|
GPUMaterial *GPU_material_from_nodetree(struct Scene *scene,
|
2019-05-11 14:37:27 +02:00
|
|
|
struct Material *ma,
|
2018-06-07 11:58:15 +02:00
|
|
|
struct bNodeTree *ntree,
|
|
|
|
struct ListBase *gpumaterials,
|
|
|
|
const void *engine_type,
|
2020-03-11 14:58:19 +01:00
|
|
|
const int options,
|
|
|
|
const bool is_volume_shader,
|
2018-08-02 18:31:38 +02:00
|
|
|
const char *vert_code,
|
|
|
|
const char *geom_code,
|
|
|
|
const char *frag_lib,
|
|
|
|
const char *defines,
|
2020-07-30 13:55:13 +02:00
|
|
|
const char *name,
|
2020-07-30 17:01:13 +02:00
|
|
|
GPUMaterialEvalCallbackFn callback);
|
2018-06-07 11:58:15 +02:00
|
|
|
void GPU_material_compile(GPUMaterial *mat);
|
2014-11-24 17:18:56 +01:00
|
|
|
void GPU_material_free(struct ListBase *gpumaterial);
|
Merge of first part of changes from the apricot branch, especially
the features that are needed to run the game. Compile tested with
scons, make, but not cmake, that seems to have an issue not related
to these changes. The changes include:
* GLSL support in the viewport and game engine, enable in the game
menu in textured draw mode.
* Synced and merged part of the duplicated blender and gameengine/
gameplayer drawing code.
* Further refactoring of game engine drawing code, especially mesh
storage changed a lot.
* Optimizations in game engine armatures to avoid recomputations.
* A python function to get the framerate estimate in game.
* An option take object color into account in materials.
* An option to restrict shadow casters to a lamp's layers.
* Increase from 10 to 18 texture slots for materials, lamps, word.
An extra texture slot shows up once the last slot is used.
* Memory limit for undo, not enabled by default yet because it
needs the .B.blend to be changed.
* Multiple undo for image painting.
* An offset for dupligroups, so not all objects in a group have to
be at the origin.
2008-09-04 20:51:28 +00:00
|
|
|
|
2018-06-25 12:32:48 +02:00
|
|
|
void GPU_materials_free(struct Main *bmain);
|
Merge of first part of changes from the apricot branch, especially
the features that are needed to run the game. Compile tested with
scons, make, but not cmake, that seems to have an issue not related
to these changes. The changes include:
* GLSL support in the viewport and game engine, enable in the game
menu in textured draw mode.
* Synced and merged part of the duplicated blender and gameengine/
gameplayer drawing code.
* Further refactoring of game engine drawing code, especially mesh
storage changed a lot.
* Optimizations in game engine armatures to avoid recomputations.
* A python function to get the framerate estimate in game.
* An option take object color into account in materials.
* An option to restrict shadow casters to a lamp's layers.
* Increase from 10 to 18 texture slots for materials, lamps, word.
An extra texture slot shows up once the last slot is used.
* Memory limit for undo, not enabled by default yet because it
needs the .B.blend to be changed.
* Multiple undo for image painting.
* An offset for dupligroups, so not all objects in a group have to
be at the origin.
2008-09-04 20:51:28 +00:00
|
|
|
|
2013-11-25 20:58:23 +09:00
|
|
|
struct Scene *GPU_material_scene(GPUMaterial *material);
|
2017-04-27 22:27:09 +02:00
|
|
|
struct GPUPass *GPU_material_get_pass(GPUMaterial *material);
|
2020-06-02 16:58:07 +02:00
|
|
|
struct GPUShader *GPU_material_get_shader(GPUMaterial *material);
|
2021-12-09 20:01:47 +11:00
|
|
|
/**
|
|
|
|
* Return can be NULL if it's a world material.
|
|
|
|
*/
|
2019-05-11 14:37:27 +02:00
|
|
|
struct Material *GPU_material_get_material(GPUMaterial *material);
|
2021-12-09 20:01:47 +11:00
|
|
|
/**
|
|
|
|
* Return true if the material compilation has not yet begin or begin.
|
|
|
|
*/
|
2019-01-23 14:15:43 +11:00
|
|
|
eGPUMaterialStatus GPU_material_status(GPUMaterial *mat);
|
Merge of first part of changes from the apricot branch, especially
the features that are needed to run the game. Compile tested with
scons, make, but not cmake, that seems to have an issue not related
to these changes. The changes include:
* GLSL support in the viewport and game engine, enable in the game
menu in textured draw mode.
* Synced and merged part of the duplicated blender and gameengine/
gameplayer drawing code.
* Further refactoring of game engine drawing code, especially mesh
storage changed a lot.
* Optimizations in game engine armatures to avoid recomputations.
* A python function to get the framerate estimate in game.
* An option take object color into account in materials.
* An option to restrict shadow casters to a lamp's layers.
* Increase from 10 to 18 texture slots for materials, lamps, word.
An extra texture slot shows up once the last slot is used.
* Memory limit for undo, not enabled by default yet because it
needs the .B.blend to be changed.
* Multiple undo for image painting.
* An offset for dupligroups, so not all objects in a group have to
be at the origin.
2008-09-04 20:51:28 +00:00
|
|
|
|
2020-08-20 23:09:37 +02:00
|
|
|
struct GPUUniformBuf *GPU_material_uniform_buffer_get(GPUMaterial *material);
|
2021-12-09 20:01:47 +11:00
|
|
|
/**
|
|
|
|
* Create dynamic UBO from parameters
|
|
|
|
*
|
|
|
|
* \param inputs: Items are #LinkData, data is #GPUInput (`BLI_genericNodeN(GPUInput)`).
|
|
|
|
*/
|
2018-06-07 19:40:47 +02:00
|
|
|
void GPU_material_uniform_buffer_create(GPUMaterial *material, ListBase *inputs);
|
2020-08-20 23:09:37 +02:00
|
|
|
struct GPUUniformBuf *GPU_material_create_sss_profile_ubo(void);
|
2017-07-14 17:40:54 +02:00
|
|
|
|
2020-03-11 14:58:19 +01:00
|
|
|
bool GPU_material_has_surface_output(GPUMaterial *mat);
|
|
|
|
bool GPU_material_has_volume_output(GPUMaterial *mat);
|
|
|
|
|
|
|
|
bool GPU_material_is_volume_shader(GPUMaterial *mat);
|
2012-09-09 11:04:49 +00:00
|
|
|
|
2019-01-23 14:15:43 +11:00
|
|
|
void GPU_material_flag_set(GPUMaterial *mat, eGPUMatFlag flag);
|
|
|
|
bool GPU_material_flag_get(GPUMaterial *mat, eGPUMatFlag flag);
|
2018-08-03 18:53:36 +02:00
|
|
|
|
2018-06-07 11:58:15 +02:00
|
|
|
void GPU_pass_cache_init(void);
|
2018-03-11 23:43:09 +01:00
|
|
|
void GPU_pass_cache_garbage_collect(void);
|
|
|
|
void GPU_pass_cache_free(void);
|
|
|
|
|
2020-02-14 10:47:20 +01:00
|
|
|
/* Requested Material Attributes and Textures */
|
|
|
|
|
|
|
|
typedef struct GPUMaterialAttribute {
|
|
|
|
struct GPUMaterialAttribute *next, *prev;
|
|
|
|
int type; /* CustomDataType */
|
|
|
|
char name[64]; /* MAX_CUSTOMDATA_LAYER_NAME */
|
2020-02-27 13:55:29 +01:00
|
|
|
eGPUType gputype;
|
2020-02-14 10:47:20 +01:00
|
|
|
int id;
|
2020-02-27 13:55:29 +01:00
|
|
|
int users;
|
2020-02-14 10:47:20 +01:00
|
|
|
} GPUMaterialAttribute;
|
|
|
|
|
|
|
|
typedef struct GPUMaterialTexture {
|
|
|
|
struct GPUMaterialTexture *next, *prev;
|
|
|
|
struct Image *ima;
|
|
|
|
struct ImageUser *iuser;
|
|
|
|
struct GPUTexture **colorband;
|
2020-02-27 13:55:29 +01:00
|
|
|
char sampler_name[32]; /* Name of sampler in GLSL. */
|
|
|
|
char tiled_mapping_name[32]; /* Name of tile mapping sampler in GLSL. */
|
|
|
|
int users;
|
2020-06-03 13:35:15 +02:00
|
|
|
int sampler_state; /* eGPUSamplerState */
|
2020-02-14 10:47:20 +01:00
|
|
|
} GPUMaterialTexture;
|
|
|
|
|
2020-03-11 14:58:19 +01:00
|
|
|
typedef struct GPUMaterialVolumeGrid {
|
|
|
|
struct GPUMaterialVolumeGrid *next, *prev;
|
|
|
|
char *name;
|
2020-09-03 15:26:52 +02:00
|
|
|
eGPUVolumeDefaultValue default_value;
|
2020-03-17 16:27:08 +01:00
|
|
|
char sampler_name[32]; /* Name of sampler in GLSL. */
|
|
|
|
char transform_name[32]; /* Name of 4x4 matrix in GLSL. */
|
2020-03-11 14:58:19 +01:00
|
|
|
int users;
|
|
|
|
} GPUMaterialVolumeGrid;
|
|
|
|
|
2020-02-14 10:47:20 +01:00
|
|
|
ListBase GPU_material_attributes(GPUMaterial *material);
|
|
|
|
ListBase GPU_material_textures(GPUMaterial *material);
|
2020-03-11 14:58:19 +01:00
|
|
|
ListBase GPU_material_volume_grids(GPUMaterial *material);
|
2020-02-14 10:47:20 +01:00
|
|
|
|
Materials: add custom object properties as uniform attributes.
This patch allows the user to type a property name into the
Attribute node, which will then output the value of the property
for each individual object, allowing to e.g. customize shaders
by object without duplicating the shader.
In order to make supporting this easier for Eevee, it is necessary
to explicitly choose whether the attribute is varying or uniform
via a dropdown option of the Attribute node. The dropdown also
allows choosing whether instancing should be taken into account.
The Cycles design treats all attributes as one common namespace,
so the Blender interface converts the enum to a name prefix that
can't be entered using keyboard.
In Eevee, the attributes are provided to the shader via a UBO indexed
with resource_id, similar to the existing Object Info data. Unlike it,
however, it is necessary to maintain a separate buffer for every
requested combination of attributes.
This is done using a hash table with the attribute set as the key,
as it is expected that technically different but similar materials
may use the same set of attributes. In addition, in order to minimize
wasted memory, a sparse UBO pool is implemented, so that chunks that
don't contain any data don't have to be allocated.
The back-end Cycles code is already refactored and committed by Brecht.
Differential Revision: https://developer.blender.org/D2057
2020-08-05 19:14:40 +03:00
|
|
|
typedef struct GPUUniformAttr {
|
|
|
|
struct GPUUniformAttr *next, *prev;
|
|
|
|
|
|
|
|
/* Meaningful part of the attribute set key. */
|
|
|
|
char name[64]; /* MAX_CUSTOMDATA_LAYER_NAME */
|
|
|
|
bool use_dupli;
|
|
|
|
|
|
|
|
/* Helper fields used by code generation. */
|
|
|
|
short id;
|
|
|
|
int users;
|
|
|
|
} GPUUniformAttr;
|
|
|
|
|
|
|
|
typedef struct GPUUniformAttrList {
|
|
|
|
ListBase list; /* GPUUniformAttr */
|
|
|
|
|
|
|
|
/* List length and hash code precomputed for fast lookup and comparison. */
|
|
|
|
unsigned int count, hash_code;
|
|
|
|
} GPUUniformAttrList;
|
|
|
|
|
|
|
|
GPUUniformAttrList *GPU_material_uniform_attributes(GPUMaterial *material);
|
|
|
|
|
|
|
|
struct GHash *GPU_uniform_attr_list_hash_new(const char *info);
|
|
|
|
void GPU_uniform_attr_list_copy(GPUUniformAttrList *dest, GPUUniformAttrList *src);
|
|
|
|
void GPU_uniform_attr_list_free(GPUUniformAttrList *set);
|
|
|
|
|
Merge of first part of changes from the apricot branch, especially
the features that are needed to run the game. Compile tested with
scons, make, but not cmake, that seems to have an issue not related
to these changes. The changes include:
* GLSL support in the viewport and game engine, enable in the game
menu in textured draw mode.
* Synced and merged part of the duplicated blender and gameengine/
gameplayer drawing code.
* Further refactoring of game engine drawing code, especially mesh
storage changed a lot.
* Optimizations in game engine armatures to avoid recomputations.
* A python function to get the framerate estimate in game.
* An option take object color into account in materials.
* An option to restrict shadow casters to a lamp's layers.
* Increase from 10 to 18 texture slots for materials, lamps, word.
An extra texture slot shows up once the last slot is used.
* Memory limit for undo, not enabled by default yet because it
needs the .B.blend to be changed.
* Multiple undo for image painting.
* An offset for dupligroups, so not all objects in a group have to
be at the origin.
2008-09-04 20:51:28 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|