[Bf-blender-cvs] [2bd9a28ff8d] master: Cleanup: Rename `#if GPU_USE_PY_REFERENCES` to `#ifndef GPU_NO_USE_PY_REFERENCES`

Germano Cavalcante noreply at git.blender.org
Fri Apr 30 16:21:06 CEST 2021


Commit: 2bd9a28ff8d7a7bcb5481b8f9e029959b8b055e8
Author: Germano Cavalcante
Date:   Fri Apr 30 11:20:39 2021 -0300
Branches: master
https://developer.blender.org/rB2bd9a28ff8d7a7bcb5481b8f9e029959b8b055e8

Cleanup: Rename `#if GPU_USE_PY_REFERENCES` to `#ifndef GPU_NO_USE_PY_REFERENCES`

This is safer for incremental build.

And there was already a macro `GPU_USE_PY_REFERENCES` used elsewhere.

===================================================================

M	source/blender/gpu/GPU_common.h
M	source/blender/gpu/GPU_framebuffer.h
M	source/blender/gpu/GPU_texture.h
M	source/blender/gpu/intern/gpu_framebuffer.cc
M	source/blender/gpu/intern/gpu_framebuffer_private.hh
M	source/blender/gpu/intern/gpu_texture.cc
M	source/blender/gpu/intern/gpu_texture_private.hh
M	source/blender/python/gpu/gpu_py_framebuffer.c
M	source/blender/python/gpu/gpu_py_framebuffer.h
M	source/blender/python/gpu/gpu_py_texture.c

===================================================================

diff --git a/source/blender/gpu/GPU_common.h b/source/blender/gpu/GPU_common.h
index bc57a381f00..c00bf581e8c 100644
--- a/source/blender/gpu/GPU_common.h
+++ b/source/blender/gpu/GPU_common.h
@@ -24,7 +24,7 @@
 #pragma once
 
 #define PROGRAM_NO_OPTI 0
-#define USE_PY_REFERENCES 1
+//#define GPU_NO_USE_PY_REFERENCES
 
 #if defined(NDEBUG)
 #  define TRUST_NO_ONE 0
diff --git a/source/blender/gpu/GPU_framebuffer.h b/source/blender/gpu/GPU_framebuffer.h
index ccab80c5702..6482d9a9d3e 100644
--- a/source/blender/gpu/GPU_framebuffer.h
+++ b/source/blender/gpu/GPU_framebuffer.h
@@ -209,7 +209,7 @@ void GPU_framebuffer_recursive_downsample(GPUFrameBuffer *fb,
                                           void (*callback)(void *userData, int level),
                                           void *userData);
 
-#if USE_PY_REFERENCES
+#ifndef GPU_NO_USE_PY_REFERENCES
 void **GPU_framebuffer_py_reference_get(GPUFrameBuffer *gpu_fb);
 void GPU_framebuffer_py_reference_set(GPUFrameBuffer *gpu_fb, void **py_ref);
 #endif
diff --git a/source/blender/gpu/GPU_texture.h b/source/blender/gpu/GPU_texture.h
index 21d3070e252..f980c8fdcd7 100644
--- a/source/blender/gpu/GPU_texture.h
+++ b/source/blender/gpu/GPU_texture.h
@@ -270,7 +270,7 @@ bool GPU_texture_depth(const GPUTexture *tex);
 bool GPU_texture_stencil(const GPUTexture *tex);
 bool GPU_texture_integer(const GPUTexture *tex);
 
-#if USE_PY_REFERENCES
+#ifndef GPU_NO_USE_PY_REFERENCES
 void **GPU_texture_py_reference_get(GPUTexture *tex);
 void GPU_texture_py_reference_set(GPUTexture *tex, void **py_ref);
 #endif
diff --git a/source/blender/gpu/intern/gpu_framebuffer.cc b/source/blender/gpu/intern/gpu_framebuffer.cc
index 487835a9d35..1293cc0953d 100644
--- a/source/blender/gpu/intern/gpu_framebuffer.cc
+++ b/source/blender/gpu/intern/gpu_framebuffer.cc
@@ -72,7 +72,7 @@ FrameBuffer::~FrameBuffer()
     }
   }
 
-#if USE_PY_REFERENCES
+#ifndef GPU_NO_USE_PY_REFERENCES
   if (this->py_ref) {
     *this->py_ref = nullptr;
   }
@@ -479,7 +479,7 @@ void GPU_framebuffer_recursive_downsample(GPUFrameBuffer *gpu_fb,
   unwrap(gpu_fb)->recursive_downsample(max_lvl, callback, userData);
 }
 
-#if USE_PY_REFERENCES
+#ifndef GPU_NO_USE_PY_REFERENCES
 void **GPU_framebuffer_py_reference_get(GPUFrameBuffer *gpu_fb)
 {
   return unwrap(gpu_fb)->py_ref;
diff --git a/source/blender/gpu/intern/gpu_framebuffer_private.hh b/source/blender/gpu/intern/gpu_framebuffer_private.hh
index d6a30677840..ab4e22ebb80 100644
--- a/source/blender/gpu/intern/gpu_framebuffer_private.hh
+++ b/source/blender/gpu/intern/gpu_framebuffer_private.hh
@@ -100,7 +100,7 @@ class FrameBuffer {
   bool scissor_test_ = false;
   bool dirty_state_ = true;
 
-#if USE_PY_REFERENCES
+#ifndef GPU_NO_USE_PY_REFERENCES
  public:
   /**
    * Reference of a pointer that needs to be cleaned when deallocating the frame-buffer.
diff --git a/source/blender/gpu/intern/gpu_texture.cc b/source/blender/gpu/intern/gpu_texture.cc
index b0b0fb970d7..997064e82a2 100644
--- a/source/blender/gpu/intern/gpu_texture.cc
+++ b/source/blender/gpu/intern/gpu_texture.cc
@@ -61,7 +61,7 @@ Texture::~Texture()
     }
   }
 
-#if USE_PY_REFERENCES
+#ifndef GPU_NO_USE_PY_REFERENCES
   if (this->py_ref) {
     *this->py_ref = nullptr;
   }
@@ -587,7 +587,7 @@ bool GPU_texture_array(const GPUTexture *tex)
   return (reinterpret_cast<const Texture *>(tex)->type_get() & GPU_TEXTURE_ARRAY) != 0;
 }
 
-#if USE_PY_REFERENCES
+#ifndef GPU_NO_USE_PY_REFERENCES
 void **GPU_texture_py_reference_get(GPUTexture *tex)
 {
   return unwrap(tex)->py_ref;
diff --git a/source/blender/gpu/intern/gpu_texture_private.hh b/source/blender/gpu/intern/gpu_texture_private.hh
index 9f185e03493..a8f2e482bdd 100644
--- a/source/blender/gpu/intern/gpu_texture_private.hh
+++ b/source/blender/gpu/intern/gpu_texture_private.hh
@@ -80,7 +80,7 @@ class Texture {
   int refcount = 1;
   /** Width & Height (of source data), optional. */
   int src_w = 0, src_h = 0;
-#if USE_PY_REFERENCES
+#ifndef GPU_NO_USE_PY_REFERENCES
   /**
    * Reference of a pointer that needs to be cleaned when deallocating the texture.
    * Points to #BPyGPUTexture.tex
diff --git a/source/blender/python/gpu/gpu_py_framebuffer.c b/source/blender/python/gpu/gpu_py_framebuffer.c
index 70938cf1ecc..adb3c485537 100644
--- a/source/blender/python/gpu/gpu_py_framebuffer.c
+++ b/source/blender/python/gpu/gpu_py_framebuffer.c
@@ -75,7 +75,7 @@ static void pygpu_framebuffer_free_if_possible(GPUFrameBuffer *fb)
 static void pygpu_framebuffer_free_safe(BPyGPUFrameBuffer *self)
 {
   if (self->fb) {
-#if GPU_USE_PY_REFERENCES
+#ifndef GPU_NO_USE_PY_REFERENCES
     GPU_framebuffer_py_reference_set(self->fb, NULL);
     if (!self->shared_reference)
 #endif
@@ -639,7 +639,7 @@ PyObject *BPyGPUFrameBuffer_CreatePyObject(GPUFrameBuffer *fb, bool shared_refer
 {
   BPyGPUFrameBuffer *self;
 
-#if GPU_USE_PY_REFERENCES
+#ifndef GPU_NO_USE_PY_REFERENCES
   if (shared_reference) {
     void **ref = GPU_framebuffer_py_reference_get(fb);
     if (ref) {
@@ -657,7 +657,7 @@ PyObject *BPyGPUFrameBuffer_CreatePyObject(GPUFrameBuffer *fb, bool shared_refer
   self = PyObject_New(BPyGPUFrameBuffer, &BPyGPUFrameBuffer_Type);
   self->fb = fb;
 
-#if GPU_USE_PY_REFERENCES
+#ifndef GPU_NO_USE_PY_REFERENCES
   self->shared_reference = shared_reference;
 
   BLI_assert(GPU_framebuffer_py_reference_get(fb) == NULL);
diff --git a/source/blender/python/gpu/gpu_py_framebuffer.h b/source/blender/python/gpu/gpu_py_framebuffer.h
index 0049cc2fac7..6727328518c 100644
--- a/source/blender/python/gpu/gpu_py_framebuffer.h
+++ b/source/blender/python/gpu/gpu_py_framebuffer.h
@@ -29,7 +29,7 @@ extern PyTypeObject BPyGPUFrameBuffer_Type;
 typedef struct BPyGPUFrameBuffer {
   PyObject_HEAD struct GPUFrameBuffer *fb;
 
-#if GPU_USE_PY_REFERENCES
+#ifndef GPU_NO_USE_PY_REFERENCES
   bool shared_reference;
 #endif
 } BPyGPUFrameBuffer;
diff --git a/source/blender/python/gpu/gpu_py_texture.c b/source/blender/python/gpu/gpu_py_texture.c
index 9cc6a9df8fa..7e0a642dbbc 100644
--- a/source/blender/python/gpu/gpu_py_texture.c
+++ b/source/blender/python/gpu/gpu_py_texture.c
@@ -412,7 +412,7 @@ static PyObject *pygpu_texture_free(BPyGPUTexture *self)
 static void BPyGPUTexture__tp_dealloc(BPyGPUTexture *self)
 {
   if (self->tex) {
-#if GPU_USE_PY_REFERENCES
+#ifndef GPU_NO_USE_PY_REFERENCES
     GPU_texture_py_reference_set(self->tex, NULL);
 #endif
     GPU_texture_free(self->tex);
@@ -600,7 +600,7 @@ PyObject *BPyGPUTexture_CreatePyObject(GPUTexture *tex, bool shared_reference)
   BPyGPUTexture *self;
 
   if (shared_reference) {
-#if GPU_USE_PY_REFERENCES
+#ifndef GPU_NO_USE_PY_REFERENCES
     void **ref = GPU_texture_py_reference_get(tex);
     if (ref) {
       /* Retrieve BPyGPUTexture reference. */
@@ -617,7 +617,7 @@ PyObject *BPyGPUTexture_CreatePyObject(GPUTexture *tex, bool shared_reference)
   self = PyObject_New(BPyGPUTexture, &BPyGPUTexture_Type);
   self->tex = tex;
 
-#if GPU_USE_PY_REFERENCES
+#ifndef GPU_NO_USE_PY_REFERENCES
   BLI_assert(GPU_texture_py_reference_get(tex) == NULL);
   GPU_texture_py_reference_set(tex, &self->tex);
 #endif



More information about the Bf-blender-cvs mailing list