Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGermano Cavalcantemano-wii <germano.costa@ig.com.br>2020-12-11 07:18:24 +0300
committerGermano Cavalcantemano-wii <germano.costa@ig.com.br>2021-01-11 01:01:53 +0300
commit9db3d1951da15254efbbcf028176facb78118ec1 (patch)
tree2cdc94f9143d3df00f2541263cb25369dff2679f /source/blender/gpu
parent1d3b92bdeabc4a556372603c548155fad1e87be0 (diff)
Fix typo; Documentation; Expose layer for framebuffer attachament; Add framebuffer viewport setter; Remove framebuffer restore; Expose framebuffer push/pop stack API; Remove blend modes; Remove depth_range_set; Implement GPU_face_culling, GPU_front_facing, GPU_point_size, GPU_line_width, GPU_viewport, GPU_color_mask and GPU_depth_mask
Diffstat (limited to 'source/blender/gpu')
-rw-r--r--source/blender/gpu/GPU_framebuffer.h4
-rw-r--r--source/blender/gpu/intern/gpu_framebuffer.cc26
2 files changed, 23 insertions, 7 deletions
diff --git a/source/blender/gpu/GPU_framebuffer.h b/source/blender/gpu/GPU_framebuffer.h
index c0f91756bf6..726dcbf0174 100644
--- a/source/blender/gpu/GPU_framebuffer.h
+++ b/source/blender/gpu/GPU_framebuffer.h
@@ -209,6 +209,10 @@ void GPU_framebuffer_recursive_downsample(GPUFrameBuffer *fb,
void (*callback)(void *userData, int level),
void *userData);
+void GPU_framebuffer_push(GPUFrameBuffer *fb);
+GPUFrameBuffer *GPU_framebuffer_pop(void);
+uint GPU_framebuffer_stack_level_get(void);
+
/* GPU OffScreen
* - wrapper around frame-buffer and texture for simple off-screen drawing
*/
diff --git a/source/blender/gpu/intern/gpu_framebuffer.cc b/source/blender/gpu/intern/gpu_framebuffer.cc
index d5d7994a154..910bdc531fe 100644
--- a/source/blender/gpu/intern/gpu_framebuffer.cc
+++ b/source/blender/gpu/intern/gpu_framebuffer.cc
@@ -476,10 +476,8 @@ void GPU_framebuffer_recursive_downsample(GPUFrameBuffer *gpu_fb,
/** \} */
/* -------------------------------------------------------------------- */
-/** \name GPUOffScreen
+/** \name Framebuffer Push/Pop
*
- * Container that holds a frame-buffer and its textures.
- * Might be bound to multiple contexts.
* \{ */
#define FRAMEBUFFER_STACK_DEPTH 16
@@ -489,22 +487,36 @@ static struct {
uint top;
} FrameBufferStack = {{nullptr}};
-static void gpuPushFrameBuffer(GPUFrameBuffer *fb)
+void GPU_framebuffer_push(GPUFrameBuffer *fb)
{
BLI_assert(FrameBufferStack.top < FRAMEBUFFER_STACK_DEPTH);
FrameBufferStack.framebuffers[FrameBufferStack.top] = fb;
FrameBufferStack.top++;
}
-static GPUFrameBuffer *gpuPopFrameBuffer()
+GPUFrameBuffer *GPU_framebuffer_pop(void)
{
BLI_assert(FrameBufferStack.top > 0);
FrameBufferStack.top--;
return FrameBufferStack.framebuffers[FrameBufferStack.top];
}
+uint GPU_framebuffer_stack_level_get(void)
+{
+ return FrameBufferStack.top;
+}
+
#undef FRAMEBUFFER_STACK_DEPTH
+/** \} */
+
+/* -------------------------------------------------------------------- */
+/** \name GPUOffScreen
+ *
+ * Container that holds a frame-buffer and its textures.
+ * Might be bound to multiple contexts.
+ * \{ */
+
#define MAX_CTX_FB_LEN 3
struct GPUOffScreen {
@@ -614,7 +626,7 @@ void GPU_offscreen_bind(GPUOffScreen *ofs, bool save)
{
if (save) {
GPUFrameBuffer *fb = GPU_framebuffer_active_get();
- gpuPushFrameBuffer(fb);
+ GPU_framebuffer_push(fb);
}
unwrap(gpu_offscreen_fb_get(ofs))->bind(false);
}
@@ -623,7 +635,7 @@ void GPU_offscreen_unbind(GPUOffScreen *UNUSED(ofs), bool restore)
{
GPUFrameBuffer *fb = nullptr;
if (restore) {
- fb = gpuPopFrameBuffer();
+ fb = GPU_framebuffer_pop();
}
if (fb) {