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
|
|
|
*/
|
|
|
|
|
2020-08-07 09:50:34 +02: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
|
|
|
|
|
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
|
|
|
|
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
|
|
|
/* Functions to create GPU Materials nodes */
|
|
|
|
|
2019-01-23 14:15:43 +11:00
|
|
|
typedef enum eGPUType {
|
2019-04-17 06:17:24 +02:00
|
|
|
/* Keep in sync with GPU_DATATYPE_STR */
|
|
|
|
/* The value indicates the number of elements in each type */
|
|
|
|
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
|
|
|
|
|
|
|
/* Values not in GPU_DATATYPE_STR */
|
|
|
|
GPU_TEX1D_ARRAY = 1001,
|
|
|
|
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
|
|
|
|
|
|
|
/* 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
|
|
|
|
|
|
|
/* Opengl Attributes */
|
|
|
|
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 {
|
2019-04-17 06:17:24 +02: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),
|
2019-04-17 06:17:24 +02:00
|
|
|
GPU_AUTO_BUMPSCALE = (1 << 7),
|
|
|
|
GPU_CAMERA_TEXCO_FACTORS = (1 << 8),
|
|
|
|
GPU_PARTICLE_SCALAR_PROPS = (1 << 9),
|
|
|
|
GPU_PARTICLE_LOCATION = (1 << 10),
|
|
|
|
GPU_PARTICLE_VELOCITY = (1 << 11),
|
|
|
|
GPU_PARTICLE_ANG_VELOCITY = (1 << 12),
|
|
|
|
GPU_LOC_TO_VIEW_MATRIX = (1 << 13),
|
|
|
|
GPU_INVERSE_LOC_TO_VIEW_MATRIX = (1 << 14),
|
|
|
|
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 {
|
2019-04-17 06:17:24 +02:00
|
|
|
GPU_MATFLAG_DIFFUSE = (1 << 0),
|
|
|
|
GPU_MATFLAG_GLOSSY = (1 << 1),
|
|
|
|
GPU_MATFLAG_REFRACT = (1 << 2),
|
|
|
|
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-04-17 06:17:24 +02:00
|
|
|
eGPUType type;
|
|
|
|
float vec[4];
|
|
|
|
struct GPUNodeLink *link;
|
|
|
|
bool hasinput;
|
|
|
|
bool hasoutput;
|
|
|
|
short sockettype;
|
|
|
|
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 {
|
2019-04-17 06:17:24 +02: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);
|
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, ...);
|
2019-04-17 06:17:24 +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);
|
|
|
|
|
2019-04-17 06:17:24 +02:00
|
|
|
void GPU_material_sss_profile_create(GPUMaterial *material,
|
|
|
|
float radii[3],
|
2020-07-13 11:27:09 +02:00
|
|
|
const short *falloff_type,
|
|
|
|
const float *sharpness);
|
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
|
|
|
|
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
|
|
|
/* High level functions to create and use GPU materials */
|
2019-04-17 06:17:24 +02:00
|
|
|
GPUMaterial *GPU_material_from_nodetree_find(struct ListBase *gpumaterials,
|
|
|
|
const void *engine_type,
|
|
|
|
int options);
|
|
|
|
GPUMaterial *GPU_material_from_nodetree(struct Scene *scene,
|
2019-05-11 14:37:27 +02:00
|
|
|
struct Material *ma,
|
2019-04-17 06:17:24 +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,
|
2019-04-17 06:17:24 +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);
|
2019-05-11 14:37:27 +02:00
|
|
|
struct Material *GPU_material_get_material(GPUMaterial *material);
|
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);
|
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
|
|
|
|
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
|