2011-02-21 06:58:46 +00:00
|
|
|
/*
|
2009-10-03 15:35:01 +00:00
|
|
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
2011-11-29 10:54:47 +00:00
|
|
|
* of the License, or (at your option) any later version.
|
2009-10-03 15:35:01 +00:00
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
2010-02-12 13:34:04 +00:00
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2009-10-03 15:35:01 +00:00
|
|
|
*
|
|
|
|
* The Original Code is Copyright (C) 2005 Blender Foundation.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* The Original Code is: all of this file.
|
|
|
|
*
|
|
|
|
* Contributor(s): Brecht Van Lommel.
|
|
|
|
*
|
|
|
|
* ***** END GPL LICENSE BLOCK *****
|
|
|
|
*/
|
|
|
|
|
2011-02-21 06:58:46 +00:00
|
|
|
/** \file GPU_buffers.h
|
|
|
|
* \ingroup gpu
|
|
|
|
*/
|
|
|
|
|
2009-10-03 15:35:01 +00:00
|
|
|
#ifndef __GPU_BUFFERS_H__
|
|
|
|
#define __GPU_BUFFERS_H__
|
|
|
|
|
2015-07-17 12:25:05 +02:00
|
|
|
#include <stddef.h>
|
|
|
|
|
2012-12-30 18:24:54 +00:00
|
|
|
struct BMesh;
|
2012-05-10 20:33:09 +00:00
|
|
|
struct CCGElem;
|
|
|
|
struct CCGKey;
|
|
|
|
struct DMFlagMat;
|
Remove Blender Internal and legacy viewport from Blender 2.8.
Brecht authored this commit, but he gave me the honours to actually
do it. Here it goes; Blender Internal. Bye bye, you did great!
* Point density, voxel data, ocean, environment map textures were removed,
as these only worked within BI rendering. Note that the ocean modifier
and the Cycles point density shader node continue to work.
* Dynamic paint using material shading was removed, as this only worked
with BI. If we ever wanted to support this again probably it should go
through the baking API.
* GPU shader export through the Python API was removed. This only worked
for the old BI GLSL shaders, which no longer exists. Doing something
similar for Eevee would be significantly more complicated because it
uses a lot of multiplass rendering and logic outside the shader, it's
probably impractical.
* Collada material import / export code is mostly gone, as it only worked
for BI materials. We need to add Cycles / Eevee material support at some
point.
* The mesh noise operator was removed since it only worked with BI
material texture slots. A displacement modifier can be used instead.
* The delete texture paint slot operator was removed since it only worked
for BI material texture slots. Could be added back with node support.
* Not all legacy viewport features are supported in the new viewport, but
their code was removed. If we need to bring anything back we can look at
older git revisions.
* There is some legacy viewport code that I could not remove yet, and some
that I probably missed.
* Shader node execution code was left mostly intact, even though it is not
used anywhere now. We may eventually use this to replace the texture
nodes with Cycles / Eevee shader nodes.
* The Cycles Bake panel now includes settings for baking multires normal
and displacement maps. The underlying code needs to be merged properly,
and we plan to add back support for multires AO baking and add support
to Cycles baking for features like vertex color, displacement, and other
missing baking features.
* This commit removes DNA and the Python API for BI material, lamp, world
and scene settings. This breaks a lot of addons.
* There is more DNA that can be removed or renamed, where Cycles or Eevee
are reusing some old BI properties but the names are not really correct
anymore.
* Texture slots for materials, lamps and world were removed. They remain
for brushes, particles and freestyle linestyles.
* 'BLENDER_RENDER' remains in the COMPAT_ENGINES of UI panels. Cycles and
other renderers use this to find all panels to show, minus a few panels
that they have their own replacement for.
2018-04-19 17:34:44 +02:00
|
|
|
struct GSet;
|
|
|
|
struct MLoop;
|
|
|
|
struct MLoopTri;
|
|
|
|
struct MPoly;
|
2015-07-16 16:22:28 +02:00
|
|
|
struct MVert;
|
Remove Blender Internal and legacy viewport from Blender 2.8.
Brecht authored this commit, but he gave me the honours to actually
do it. Here it goes; Blender Internal. Bye bye, you did great!
* Point density, voxel data, ocean, environment map textures were removed,
as these only worked within BI rendering. Note that the ocean modifier
and the Cycles point density shader node continue to work.
* Dynamic paint using material shading was removed, as this only worked
with BI. If we ever wanted to support this again probably it should go
through the baking API.
* GPU shader export through the Python API was removed. This only worked
for the old BI GLSL shaders, which no longer exists. Doing something
similar for Eevee would be significantly more complicated because it
uses a lot of multiplass rendering and logic outside the shader, it's
probably impractical.
* Collada material import / export code is mostly gone, as it only worked
for BI materials. We need to add Cycles / Eevee material support at some
point.
* The mesh noise operator was removed since it only worked with BI
material texture slots. A displacement modifier can be used instead.
* The delete texture paint slot operator was removed since it only worked
for BI material texture slots. Could be added back with node support.
* Not all legacy viewport features are supported in the new viewport, but
their code was removed. If we need to bring anything back we can look at
older git revisions.
* There is some legacy viewport code that I could not remove yet, and some
that I probably missed.
* Shader node execution code was left mostly intact, even though it is not
used anywhere now. We may eventually use this to replace the texture
nodes with Cycles / Eevee shader nodes.
* The Cycles Bake panel now includes settings for baking multires normal
and displacement maps. The underlying code needs to be merged properly,
and we plan to add back support for multires AO baking and add support
to Cycles baking for features like vertex color, displacement, and other
missing baking features.
* This commit removes DNA and the Python API for BI material, lamp, world
and scene settings. This breaks a lot of addons.
* There is more DNA that can be removed or renamed, where Cycles or Eevee
are reusing some old BI properties but the names are not really correct
anymore.
* Texture slots for materials, lamps and world were removed. They remain
for brushes, particles and freestyle linestyles.
* 'BLENDER_RENDER' remains in the COMPAT_ENGINES of UI panels. Cycles and
other renderers use this to find all panels to show, minus a few panels
that they have their own replacement for.
2018-04-19 17:34:44 +02:00
|
|
|
struct PBVH;
|
2015-07-14 16:48:23 +02:00
|
|
|
|
2018-09-27 15:54:10 +02:00
|
|
|
/* Buffers for drawing from PBVH grids. */
|
2014-01-02 22:22:36 +02:00
|
|
|
typedef struct GPU_PBVH_Buffers GPU_PBVH_Buffers;
|
2012-02-22 22:48:34 +00:00
|
|
|
|
2014-05-05 21:13:27 +03:00
|
|
|
/* build */
|
2017-05-11 22:03:50 +10:00
|
|
|
GPU_PBVH_Buffers *GPU_pbvh_mesh_buffers_build(
|
2016-07-06 19:15:47 +10:00
|
|
|
const int (*face_vert_indices)[3],
|
2015-07-17 03:36:03 +10:00
|
|
|
const struct MPoly *mpoly, const struct MLoop *mloop, const struct MLoopTri *looptri,
|
|
|
|
const struct MVert *verts,
|
|
|
|
const int *face_indices,
|
|
|
|
const int face_indices_len);
|
2012-02-22 22:48:34 +00:00
|
|
|
|
2017-05-11 22:03:50 +10:00
|
|
|
GPU_PBVH_Buffers *GPU_pbvh_grid_buffers_build(
|
2018-09-11 15:32:02 +02:00
|
|
|
int *grid_indices, int totgrid, unsigned int **grid_hidden, int gridsize, const struct CCGKey *key);
|
2012-02-22 22:48:34 +00:00
|
|
|
|
2017-05-11 22:03:50 +10:00
|
|
|
GPU_PBVH_Buffers *GPU_pbvh_bmesh_buffers_build(bool smooth_shading);
|
2012-12-30 18:24:54 +00:00
|
|
|
|
2014-05-05 21:13:27 +03:00
|
|
|
/* update */
|
|
|
|
|
2018-01-12 17:35:26 +01:00
|
|
|
enum {
|
2018-01-15 11:38:56 +01:00
|
|
|
GPU_PBVH_BUFFERS_SHOW_MASK = (1 << 1),
|
2018-01-12 17:35:26 +01:00
|
|
|
};
|
|
|
|
|
2017-05-11 22:03:50 +10:00
|
|
|
void GPU_pbvh_mesh_buffers_update(
|
2015-07-16 16:22:28 +02:00
|
|
|
GPU_PBVH_Buffers *buffers, const struct MVert *mvert,
|
2015-07-11 03:25:28 +10:00
|
|
|
const int *vert_indices, int totvert, const float *vmask,
|
2018-01-12 17:35:26 +01:00
|
|
|
const int (*face_vert_indices)[3],
|
|
|
|
const int update_flags);
|
2014-05-05 21:13:27 +03:00
|
|
|
|
2017-05-11 22:03:50 +10:00
|
|
|
void GPU_pbvh_bmesh_buffers_update(
|
|
|
|
GPU_PBVH_Buffers *buffers,
|
|
|
|
struct BMesh *bm,
|
|
|
|
struct GSet *bm_faces,
|
|
|
|
struct GSet *bm_unique_verts,
|
|
|
|
struct GSet *bm_other_verts,
|
2018-01-12 17:35:26 +01:00
|
|
|
const int update_flags);
|
2012-12-30 18:24:54 +00:00
|
|
|
|
2017-05-11 22:03:50 +10:00
|
|
|
void GPU_pbvh_grid_buffers_update(
|
|
|
|
GPU_PBVH_Buffers *buffers, struct CCGElem **grids,
|
|
|
|
const struct DMFlagMat *grid_flag_mats,
|
|
|
|
int *grid_indices, int totgrid, const struct CCGKey *key,
|
2018-01-12 17:35:26 +01:00
|
|
|
const int update_flags);
|
2012-02-22 22:48:34 +00:00
|
|
|
|
2014-05-05 21:13:27 +03:00
|
|
|
/* draw */
|
2018-07-18 00:12:21 +02:00
|
|
|
struct GPUBatch *GPU_pbvh_buffers_batch_get(GPU_PBVH_Buffers *buffers, bool fast);
|
2012-02-22 22:48:34 +00:00
|
|
|
|
2018-08-24 16:46:42 +02:00
|
|
|
bool GPU_pbvh_buffers_has_mask(GPU_PBVH_Buffers *buffers);
|
|
|
|
|
2017-03-02 21:40:13 -05:00
|
|
|
/* debug PBVH draw */
|
2017-05-11 22:15:58 +10:00
|
|
|
void GPU_pbvh_BB_draw(float min[3], float max[3], bool leaf, unsigned int pos);
|
2014-04-30 23:42:58 +03:00
|
|
|
|
2017-05-11 22:03:50 +10:00
|
|
|
void GPU_pbvh_buffers_free(GPU_PBVH_Buffers *buffers);
|
== GPU Buffers ==
This patch attempts to clean up and document the GPU buffers
code. There are a few bug fixes as well.
Patch reviewed here: http://codereview.appspot.com/4631052/
Summary:
* Bugfix: make GPU_buffer_copy_normal convert from shorts to floats
correctly, also fixed the use of cached face normal CustomData.
* Bugfix: changed the `mat_nr' field of GPUBufferMaterial from char to
short.
* Changed color buffer setup to not alloc a temporary copy of color
data, just passes the MCol data in directly.
* Changed the GPU buffer pool code to make clearer what operates
specifically on the global pool.
* Lots of refactoring for GPU_drawobject_new; should operate mostly
the same (except got rid of one unecessary allocation), just split
into more functions and without macros now.
* Converted some #defines into enumerations.
* Made some stuff private, pulled out of header file.
* Deleted unused function GPU_buffer_pool_free_unused().
* Removed GPU_interleaved_setup and related #defines. (I think this
was used for editmode VBOs, but those were disabled.)
* Added lots of comments.
* Added a few comments in the code signed `--nicholas' to note places
where I am unsure about design or usage, would be good to address
these better.
* Code formatting changed to be more consistent with the rest of
Blender.
* Renamed some fields and variables to be more consistent with
Blender's naming conventions.
* Renamed some fields and variables to use more descriptive names,
e.g. renamed `redir' to `mat_orig_to_new'.
* Removed print outs with DEBUG_VBO -- don't feel too strongly about
this one, just not used elsewhere in Blender, could be easily added
back if others disagree though.
* Moved the PBVH drawing code down to the bottom of the file, before
was sitting in the middle of the other VBO code
2011-07-08 19:58:02 +00:00
|
|
|
|
Remove Blender Internal and legacy viewport from Blender 2.8.
Brecht authored this commit, but he gave me the honours to actually
do it. Here it goes; Blender Internal. Bye bye, you did great!
* Point density, voxel data, ocean, environment map textures were removed,
as these only worked within BI rendering. Note that the ocean modifier
and the Cycles point density shader node continue to work.
* Dynamic paint using material shading was removed, as this only worked
with BI. If we ever wanted to support this again probably it should go
through the baking API.
* GPU shader export through the Python API was removed. This only worked
for the old BI GLSL shaders, which no longer exists. Doing something
similar for Eevee would be significantly more complicated because it
uses a lot of multiplass rendering and logic outside the shader, it's
probably impractical.
* Collada material import / export code is mostly gone, as it only worked
for BI materials. We need to add Cycles / Eevee material support at some
point.
* The mesh noise operator was removed since it only worked with BI
material texture slots. A displacement modifier can be used instead.
* The delete texture paint slot operator was removed since it only worked
for BI material texture slots. Could be added back with node support.
* Not all legacy viewport features are supported in the new viewport, but
their code was removed. If we need to bring anything back we can look at
older git revisions.
* There is some legacy viewport code that I could not remove yet, and some
that I probably missed.
* Shader node execution code was left mostly intact, even though it is not
used anywhere now. We may eventually use this to replace the texture
nodes with Cycles / Eevee shader nodes.
* The Cycles Bake panel now includes settings for baking multires normal
and displacement maps. The underlying code needs to be merged properly,
and we plan to add back support for multires AO baking and add support
to Cycles baking for features like vertex color, displacement, and other
missing baking features.
* This commit removes DNA and the Python API for BI material, lamp, world
and scene settings. This breaks a lot of addons.
* There is more DNA that can be removed or renamed, where Cycles or Eevee
are reusing some old BI properties but the names are not really correct
anymore.
* Texture slots for materials, lamps and world were removed. They remain
for brushes, particles and freestyle linestyles.
* 'BLENDER_RENDER' remains in the COMPAT_ENGINES of UI panels. Cycles and
other renderers use this to find all panels to show, minus a few panels
that they have their own replacement for.
2018-04-19 17:34:44 +02:00
|
|
|
void GPU_pbvh_fix_linking(void);
|
|
|
|
|
2009-10-03 15:35:01 +00:00
|
|
|
#endif
|