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:
Diffstat (limited to 'source/blender/gpu/intern/gpu_framebuffer.cc')
-rw-r--r--source/blender/gpu/intern/gpu_framebuffer.cc39
1 files changed, 20 insertions, 19 deletions
diff --git a/source/blender/gpu/intern/gpu_framebuffer.cc b/source/blender/gpu/intern/gpu_framebuffer.cc
index 88779dead28..f11f1cea753 100644
--- a/source/blender/gpu/intern/gpu_framebuffer.cc
+++ b/source/blender/gpu/intern/gpu_framebuffer.cc
@@ -58,7 +58,7 @@ FrameBuffer::FrameBuffer(const char *name)
dirty_state_ = true;
for (int i = 0; i < ARRAY_SIZE(attachments_); i++) {
- attachments_[i].tex = NULL;
+ attachments_[i].tex = nullptr;
attachments_[i].mip = -1;
attachments_[i].layer = -1;
}
@@ -67,7 +67,7 @@ FrameBuffer::FrameBuffer(const char *name)
FrameBuffer::~FrameBuffer()
{
for (int i = 0; i < ARRAY_SIZE(attachments_); i++) {
- if (attachments_[i].tex != NULL) {
+ if (attachments_[i].tex != nullptr) {
reinterpret_cast<Texture *>(attachments_[i].tex)->detach_from(this);
}
}
@@ -112,7 +112,7 @@ void FrameBuffer::attachment_set(GPUAttachmentType type, const GPUAttachment &ne
return; /* Exact same texture already bound here. */
}
/* Unbind previous and bind new. */
- /* TODO(fclem) cleanup the casts. */
+ /* TODO(fclem): cleanup the casts. */
if (attachment.tex) {
reinterpret_cast<Texture *>(attachment.tex)->detach_from(this);
}
@@ -150,7 +150,7 @@ void FrameBuffer::recursive_downsample(int max_lvl,
/* Replace attached mip-level for each attachment. */
for (int att = 0; att < ARRAY_SIZE(attachments_); att++) {
Texture *tex = reinterpret_cast<Texture *>(attachments_[att].tex);
- if (tex != NULL) {
+ if (tex != nullptr) {
/* Some Intel HDXXX have issue with rendering to a mipmap that is below
* the texture GL_TEXTURE_MAX_LEVEL. So even if it not correct, in this case
* we allow GL_TEXTURE_MAX_LEVEL to be one level lower. In practice it does work! */
@@ -169,7 +169,7 @@ void FrameBuffer::recursive_downsample(int max_lvl,
}
for (int att = 0; att < ARRAY_SIZE(attachments_); att++) {
- if (attachments_[att].tex != NULL) {
+ if (attachments_[att].tex != nullptr) {
/* Reset mipmap level range. */
reinterpret_cast<Texture *>(attachments_[att].tex)->mip_range_set(0, max_lvl);
/* Reset base level. NOTE: might not be the one bound at the start of this function. */
@@ -242,14 +242,14 @@ void GPU_framebuffer_restore(void)
GPUFrameBuffer *GPU_framebuffer_active_get(void)
{
Context *ctx = Context::get();
- return wrap(ctx ? ctx->active_fb : NULL);
+ return wrap(ctx ? ctx->active_fb : nullptr);
}
/* Returns the default frame-buffer. Will always exists even if it's just a dummy. */
GPUFrameBuffer *GPU_framebuffer_back_get(void)
{
Context *ctx = Context::get();
- return wrap(ctx ? ctx->back_left : NULL);
+ return wrap(ctx ? ctx->back_left : nullptr);
}
bool GPU_framebuffer_bound(GPUFrameBuffer *gpu_fb)
@@ -314,7 +314,7 @@ void GPU_framebuffer_config_array(GPUFrameBuffer *gpu_fb,
if (depth_attachment.mip == -1) {
/* GPU_ATTACHMENT_LEAVE */
}
- else if (depth_attachment.tex == NULL) {
+ else if (depth_attachment.tex == nullptr) {
/* GPU_ATTACHMENT_NONE: Need to clear both targets. */
fb->attachment_set(GPU_FB_DEPTH_STENCIL_ATTACHMENT, depth_attachment);
fb->attachment_set(GPU_FB_DEPTH_ATTACHMENT, depth_attachment);
@@ -411,7 +411,7 @@ void GPU_framebuffer_read_color(GPUFrameBuffer *gpu_fb,
unwrap(gpu_fb)->read(GPU_COLOR_BIT, format, rect, channels, slot, data);
}
-/* TODO(fclem) rename to read_color. */
+/* TODO(fclem): rename to read_color. */
void GPU_frontbuffer_read_pixels(
int x, int y, int w, int h, int channels, eGPUDataFormat format, void *data)
{
@@ -420,7 +420,7 @@ void GPU_frontbuffer_read_pixels(
}
/* read_slot and write_slot are only used for color buffers. */
-/* TODO(fclem) port as texture operation. */
+/* TODO(fclem): port as texture operation. */
void GPU_framebuffer_blit(GPUFrameBuffer *gpufb_read,
int read_slot,
GPUFrameBuffer *gpufb_write,
@@ -487,7 +487,7 @@ void GPU_framebuffer_recursive_downsample(GPUFrameBuffer *gpu_fb,
static struct {
GPUFrameBuffer *framebuffers[FRAMEBUFFER_STACK_DEPTH];
uint top;
-} FrameBufferStack = {{0}};
+} FrameBufferStack = {{nullptr}};
static void gpuPushFrameBuffer(GPUFrameBuffer *fb)
{
@@ -496,7 +496,7 @@ static void gpuPushFrameBuffer(GPUFrameBuffer *fb)
FrameBufferStack.top++;
}
-static GPUFrameBuffer *gpuPopFrameBuffer(void)
+static GPUFrameBuffer *gpuPopFrameBuffer()
{
BLI_assert(FrameBufferStack.top > 0);
FrameBufferStack.top--;
@@ -526,7 +526,7 @@ static GPUFrameBuffer *gpu_offscreen_fb_get(GPUOffScreen *ofs)
BLI_assert(ctx);
for (int i = 0; i < MAX_CTX_FB_LEN; i++) {
- if (ofs->framebuffers[i].fb == NULL) {
+ if (ofs->framebuffers[i].fb == nullptr) {
ofs->framebuffers[i].ctx = ctx;
GPU_framebuffer_ensure_config(&ofs->framebuffers[i].fb,
{
@@ -552,7 +552,7 @@ static GPUFrameBuffer *gpu_offscreen_fb_get(GPUOffScreen *ofs)
for (int i = 0; i < MAX_CTX_FB_LEN; i++) {
GPU_framebuffer_free(ofs->framebuffers[i].fb);
- ofs->framebuffers[i].fb = NULL;
+ ofs->framebuffers[i].fb = nullptr;
}
return gpu_offscreen_fb_get(ofs);
@@ -569,16 +569,17 @@ GPUOffScreen *GPU_offscreen_create(
width = max_ii(1, width);
ofs->color = GPU_texture_create_2d(
- "ofs_color", width, height, 1, (high_bitdepth) ? GPU_RGBA16F : GPU_RGBA8, NULL);
+ "ofs_color", width, height, 1, (high_bitdepth) ? GPU_RGBA16F : GPU_RGBA8, nullptr);
if (depth) {
- ofs->depth = GPU_texture_create_2d("ofs_depth", width, height, 1, GPU_DEPTH24_STENCIL8, NULL);
+ ofs->depth = GPU_texture_create_2d(
+ "ofs_depth", width, height, 1, GPU_DEPTH24_STENCIL8, nullptr);
}
if ((depth && !ofs->depth) || !ofs->color) {
BLI_snprintf(err_out, 256, "GPUTexture: Texture allocation failed.");
GPU_offscreen_free(ofs);
- return NULL;
+ return nullptr;
}
GPUFrameBuffer *fb = gpu_offscreen_fb_get(ofs);
@@ -586,7 +587,7 @@ GPUOffScreen *GPU_offscreen_create(
/* check validity at the very end! */
if (!GPU_framebuffer_check_valid(fb, err_out)) {
GPU_offscreen_free(ofs);
- return NULL;
+ return nullptr;
}
GPU_framebuffer_restore();
return ofs;
@@ -620,7 +621,7 @@ void GPU_offscreen_bind(GPUOffScreen *ofs, bool save)
void GPU_offscreen_unbind(GPUOffScreen *UNUSED(ofs), bool restore)
{
- GPUFrameBuffer *fb = NULL;
+ GPUFrameBuffer *fb = nullptr;
if (restore) {
fb = gpuPopFrameBuffer();
}