Cleanup: GPU: Update classes comments

This should avoid confusion about what is a class and what is an opaque
pointer.
This commit is contained in:
2020-08-21 14:14:56 +02:00
parent 220fbdf593
commit 3a6e981bcd
12 changed files with 51 additions and 4 deletions

View File

@@ -19,6 +19,13 @@
/** \file /** \file
* \ingroup gpu * \ingroup gpu
*
* Uniform buffers API. Used to handle many uniforms update at once.
* Make sure that the data structure is compatible with what the implementation expect.
* (see "7.6.2.2 Standard Uniform Block Layout" from the OpenGL spec for more info about std140
* layout)
* Rule of thumb: Padding to 16bytes, don't use vec3, don't use arrays of anything that is not vec4
* aligned .
*/ */
#pragma once #pragma once
@@ -29,7 +36,7 @@ extern "C" {
struct ListBase; struct ListBase;
/** Opaque pointer */ /** Opaque pointer hiding blender::gpu::UniformBuf. */
typedef struct GPUUniformBuf { typedef struct GPUUniformBuf {
void *dummy; void *dummy;
} GPUUniformBuf; } GPUUniformBuf;

View File

@@ -32,6 +32,10 @@
namespace blender { namespace blender {
namespace gpu { namespace gpu {
/**
* Base class which is then specialized for each implementation (GL, VK, ...).
* NOTE: Extends GPUBatch as we still needs to expose some of the internals to the outside C code.
**/
class Batch : public GPUBatch { class Batch : public GPUBatch {
public: public:
Batch(){}; Batch(){};

View File

@@ -28,6 +28,10 @@
namespace blender { namespace blender {
namespace gpu { namespace gpu {
/**
* Implementation of Multi Draw Indirect.
* Base class which is then specialized for each implementation (GL, VK, ...).
**/
class DrawList { class DrawList {
public: public:
virtual ~DrawList(){}; virtual ~DrawList(){};

View File

@@ -45,6 +45,10 @@ typedef struct ShaderInput {
int32_t binding; int32_t binding;
} ShaderInput; } ShaderInput;
/**
* Implementation of Shader interface.
* Base class which is then specialized for each implementation (GL, VK, ...).
**/
class ShaderInterface { class ShaderInterface {
/* TODO(fclem) should be protected. */ /* TODO(fclem) should be protected. */
public: public:

View File

@@ -29,6 +29,10 @@
namespace blender { namespace blender {
namespace gpu { namespace gpu {
/**
* Implementation of shader compilation and uniforms handling.
* Base class which is then specialized for each implementation (GL, VK, ...).
**/
class Shader { class Shader {
public: public:
/** Uniform & attribute locations for shader. */ /** Uniform & attribute locations for shader. */

View File

@@ -151,6 +151,10 @@ inline GPUStateMutable operator~(const GPUStateMutable &a)
return r; return r;
} }
/**
* State manager keeping track of the draw state and applying it before drawing.
* Base class which is then specialized for each implementation (GL, VK, ...).
**/
class GPUStateManager { class GPUStateManager {
public: public:
GPUState state; GPUState state;

View File

@@ -33,6 +33,10 @@ namespace gpu {
# define DEBUG_NAME_LEN 64 # define DEBUG_NAME_LEN 64
#endif #endif
/**
* Implementation of Uniform Buffers.
* Base class which is then specialized for each implementation (GL, VK, ...).
**/
class UniformBuf { class UniformBuf {
protected: protected:
/** Data size in bytes. */ /** Data size in bytes. */

View File

@@ -19,6 +19,9 @@
/** \file /** \file
* \ingroup gpu * \ingroup gpu
*
* Implementation of Multi Draw Indirect using OpenGL.
* Fallback if the needed extensions are not supported.
*/ */
#pragma once #pragma once
@@ -37,6 +40,9 @@
namespace blender { namespace blender {
namespace gpu { namespace gpu {
/**
* Implementation of Multi Draw Indirect using OpenGL.
**/
class GLDrawList : public DrawList { class GLDrawList : public DrawList {
public: public:
GLDrawList(int length); GLDrawList(int length);

View File

@@ -19,9 +19,6 @@
/** \file /** \file
* \ingroup gpu * \ingroup gpu
*
* GPUDrawList is an API to do lots of similar draw-calls very fast using
* multi-draw-indirect. There is a fallback if the feature is not supported.
*/ */
#pragma once #pragma once
@@ -35,6 +32,9 @@
namespace blender { namespace blender {
namespace gpu { namespace gpu {
/**
* Implementation of shader compilation and uniforms handling using OpenGL.
**/
class GLShader : public Shader { class GLShader : public Shader {
private: private:
/** Handle for full program (links shader stages below). */ /** Handle for full program (links shader stages below). */

View File

@@ -40,6 +40,9 @@ namespace blender::gpu {
class GLVaoCache; class GLVaoCache;
/**
* Implementation of Shader interface using OpenGL.
**/
class GLShaderInterface : public ShaderInterface { class GLShaderInterface : public ShaderInterface {
private: private:
/** Reference to VaoCaches using this interface */ /** Reference to VaoCaches using this interface */

View File

@@ -31,6 +31,10 @@
namespace blender { namespace blender {
namespace gpu { namespace gpu {
/**
* State manager keeping track of the draw state and applying it before drawing.
* Opengl Implementation.
**/
class GLStateManager : public GPUStateManager { class GLStateManager : public GPUStateManager {
private: private:
/** Current state of the GL implementation. Avoids resetting the whole state for every change. */ /** Current state of the GL implementation. Avoids resetting the whole state for every change. */

View File

@@ -32,6 +32,9 @@
namespace blender { namespace blender {
namespace gpu { namespace gpu {
/**
* Implementation of Uniform Buffers using OpenGL.
**/
class GLUniformBuf : public UniformBuf { class GLUniformBuf : public UniformBuf {
private: private:
int slot_ = -1; int slot_ = -1;