diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/gpu/GPU_framebuffer.h | 4 | ||||
-rw-r--r-- | source/blender/gpu/GPU_texture.h | 2 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_framebuffer.cc | 44 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_framebuffer_private.hh | 6 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_texture.cc | 2 | ||||
-rw-r--r-- | source/blender/gpu/opengl/gl_framebuffer.cc | 10 |
6 files changed, 33 insertions, 35 deletions
diff --git a/source/blender/gpu/GPU_framebuffer.h b/source/blender/gpu/GPU_framebuffer.h index 9a81ce07d9a..708ea291cd1 100644 --- a/source/blender/gpu/GPU_framebuffer.h +++ b/source/blender/gpu/GPU_framebuffer.h @@ -82,9 +82,7 @@ GPUFrameBuffer *GPU_framebuffer_back_get(void); /* Framebuffer setup : You need to call GPU_framebuffer_bind for these * to be effective. */ -void GPU_framebuffer_texture_attach_ex(GPUFrameBuffer *gpu_fb, - GPUAttachment attachement, - int slot); +void GPU_framebuffer_texture_attach_ex(GPUFrameBuffer *gpu_fb, GPUAttachment attachment, int slot); void GPU_framebuffer_texture_detach(GPUFrameBuffer *fb, struct GPUTexture *tex); /** diff --git a/source/blender/gpu/GPU_texture.h b/source/blender/gpu/GPU_texture.h index 93865c098b8..e75ba867662 100644 --- a/source/blender/gpu/GPU_texture.h +++ b/source/blender/gpu/GPU_texture.h @@ -278,7 +278,7 @@ void GPU_texture_swizzle_set(GPUTexture *tex, const char swizzle[4]); /* TODO should be private internal functions. */ void GPU_texture_attach_framebuffer(GPUTexture *tex, struct GPUFrameBuffer *fb, int attachment); void GPU_texture_detach_framebuffer(GPUTexture *tex, struct GPUFrameBuffer *fb); -int GPU_texture_framebuffer_attachement_get(GPUTexture *tex, struct GPUFrameBuffer *fb); +int GPU_texture_framebuffer_attachment_get(GPUTexture *tex, struct GPUFrameBuffer *fb); int GPU_texture_target(const GPUTexture *tex); int GPU_texture_width(const GPUTexture *tex); diff --git a/source/blender/gpu/intern/gpu_framebuffer.cc b/source/blender/gpu/intern/gpu_framebuffer.cc index 766b3348451..6af34a60ffb 100644 --- a/source/blender/gpu/intern/gpu_framebuffer.cc +++ b/source/blender/gpu/intern/gpu_framebuffer.cc @@ -86,7 +86,7 @@ void FrameBuffer::attachment_set(GPUAttachmentType type, const GPUAttachment &ne return; /* GPU_ATTACHMENT_LEAVE */ } - if (type >= GPU_FB_MAX_ATTACHEMENT) { + if (type >= GPU_FB_MAX_ATTACHMENT) { fprintf(stderr, "GPUFramebuffer: Error: Trying to attach texture to type %d but maximum slot is %d.\n", type - GPU_FB_COLOR_ATTACHMENT0, @@ -290,38 +290,38 @@ bool GPU_framebuffer_check_valid(GPUFrameBuffer *gpu_fb, char err_out[256]) return reinterpret_cast<FrameBuffer *>(gpu_fb)->check(err_out); } -void GPU_framebuffer_texture_attach_ex(GPUFrameBuffer *gpu_fb, GPUAttachment attachement, int slot) +void GPU_framebuffer_texture_attach_ex(GPUFrameBuffer *gpu_fb, GPUAttachment attachment, int slot) { - GPUAttachmentType type = blender::gpu::Texture::attachment_type(attachement.tex, slot); - reinterpret_cast<FrameBuffer *>(gpu_fb)->attachment_set(type, attachement); + GPUAttachmentType type = blender::gpu::Texture::attachment_type(attachment.tex, slot); + reinterpret_cast<FrameBuffer *>(gpu_fb)->attachment_set(type, attachment); } void GPU_framebuffer_texture_attach(GPUFrameBuffer *fb, GPUTexture *tex, int slot, int mip) { - GPUAttachment attachement = GPU_ATTACHMENT_TEXTURE_MIP(tex, mip); - GPU_framebuffer_texture_attach_ex(fb, attachement, slot); + GPUAttachment attachment = GPU_ATTACHMENT_TEXTURE_MIP(tex, mip); + GPU_framebuffer_texture_attach_ex(fb, attachment, slot); } void GPU_framebuffer_texture_layer_attach( GPUFrameBuffer *fb, GPUTexture *tex, int slot, int layer, int mip) { - GPUAttachment attachement = GPU_ATTACHMENT_TEXTURE_LAYER_MIP(tex, layer, mip); - GPU_framebuffer_texture_attach_ex(fb, attachement, slot); + GPUAttachment attachment = GPU_ATTACHMENT_TEXTURE_LAYER_MIP(tex, layer, mip); + GPU_framebuffer_texture_attach_ex(fb, attachment, slot); } void GPU_framebuffer_texture_cubeface_attach( GPUFrameBuffer *fb, GPUTexture *tex, int slot, int face, int mip) { - GPUAttachment attachement = GPU_ATTACHMENT_TEXTURE_CUBEFACE_MIP(tex, face, mip); - GPU_framebuffer_texture_attach_ex(fb, attachement, slot); + GPUAttachment attachment = GPU_ATTACHMENT_TEXTURE_CUBEFACE_MIP(tex, face, mip); + GPU_framebuffer_texture_attach_ex(fb, attachment, slot); } void GPU_framebuffer_texture_detach(GPUFrameBuffer *gpu_fb, GPUTexture *tex) { - GPUAttachment attachement = GPU_ATTACHMENT_NONE; - int type = GPU_texture_framebuffer_attachement_get(tex, gpu_fb); + GPUAttachment attachment = GPU_ATTACHMENT_NONE; + int type = GPU_texture_framebuffer_attachment_get(tex, gpu_fb); if (type != -1) { - reinterpret_cast<FrameBuffer *>(gpu_fb)->attachment_set((GPUAttachmentType)type, attachement); + reinterpret_cast<FrameBuffer *>(gpu_fb)->attachment_set((GPUAttachmentType)type, attachment); } else { BLI_assert(!"Error: Texture: Framebuffer is not attached"); @@ -340,27 +340,27 @@ void GPU_framebuffer_config_array(GPUFrameBuffer *gpu_fb, { FrameBuffer *fb = reinterpret_cast<FrameBuffer *>(gpu_fb); - const GPUAttachment &depth_attachement = config[0]; + const GPUAttachment &depth_attachment = config[0]; Span<GPUAttachment> color_attachments(config + 1, config_len - 1); - if (depth_attachement.mip == -1) { + if (depth_attachment.mip == -1) { /* GPU_ATTACHMENT_LEAVE */ } - else if (depth_attachement.tex == NULL) { + else if (depth_attachment.tex == NULL) { /* GPU_ATTACHMENT_NONE: Need to clear both targets. */ - fb->attachment_set(GPU_FB_DEPTH_STENCIL_ATTACHMENT, depth_attachement); - fb->attachment_set(GPU_FB_DEPTH_ATTACHMENT, depth_attachement); + fb->attachment_set(GPU_FB_DEPTH_STENCIL_ATTACHMENT, depth_attachment); + fb->attachment_set(GPU_FB_DEPTH_ATTACHMENT, depth_attachment); } else { - GPUAttachmentType type = GPU_texture_stencil(depth_attachement.tex) ? + GPUAttachmentType type = GPU_texture_stencil(depth_attachment.tex) ? GPU_FB_DEPTH_STENCIL_ATTACHMENT : GPU_FB_DEPTH_ATTACHMENT; - fb->attachment_set(type, depth_attachement); + fb->attachment_set(type, depth_attachment); } GPUAttachmentType type = GPU_FB_COLOR_ATTACHMENT0; - for (const GPUAttachment &attachement : color_attachments) { - fb->attachment_set(type, attachement); + for (const GPUAttachment &attachment : color_attachments) { + fb->attachment_set(type, attachment); ++type; } } diff --git a/source/blender/gpu/intern/gpu_framebuffer_private.hh b/source/blender/gpu/intern/gpu_framebuffer_private.hh index 1add3cd9b0f..0f442ff2b34 100644 --- a/source/blender/gpu/intern/gpu_framebuffer_private.hh +++ b/source/blender/gpu/intern/gpu_framebuffer_private.hh @@ -52,9 +52,9 @@ typedef enum GPUAttachmentType : int { * We support 6 outputs for now (usually we wouldn't need more to preserve fill rate). */ /* Keep in mind that GL max is GL_MAX_DRAW_BUFFERS and is at least 8, corresponding to * the maximum number of COLOR attachments specified by glDrawBuffers. */ - GPU_FB_MAX_ATTACHEMENT, + GPU_FB_MAX_ATTACHMENT, - GPU_FB_MAX_COLOR_ATTACHMENT = (GPU_FB_MAX_ATTACHEMENT - GPU_FB_COLOR_ATTACHMENT0), + GPU_FB_MAX_COLOR_ATTACHMENT = (GPU_FB_MAX_ATTACHMENT - GPU_FB_COLOR_ATTACHMENT0), } GPUAttachmentType; inline constexpr GPUAttachmentType operator-(GPUAttachmentType a, int b) @@ -91,7 +91,7 @@ namespace gpu { class FrameBuffer { protected: /** Set of texture attachments to render to. DEPTH and DEPTH_STENCIL are mutually exclusive. */ - GPUAttachment attachments_[GPU_FB_MAX_ATTACHEMENT]; + GPUAttachment attachments_[GPU_FB_MAX_ATTACHMENT]; /** Is true if internal representation need to be updated. */ bool dirty_attachments_; /** Size of attachment textures. */ diff --git a/source/blender/gpu/intern/gpu_texture.cc b/source/blender/gpu/intern/gpu_texture.cc index 1b7e1d4fd6a..3dedfcf763a 100644 --- a/source/blender/gpu/intern/gpu_texture.cc +++ b/source/blender/gpu/intern/gpu_texture.cc @@ -2149,7 +2149,7 @@ void GPU_texture_detach_framebuffer(GPUTexture *tex, GPUFrameBuffer *fb) } /* Return attachment type for the given framebuffer or -1 if not attached. */ -int GPU_texture_framebuffer_attachement_get(GPUTexture *tex, GPUFrameBuffer *fb) +int GPU_texture_framebuffer_attachment_get(GPUTexture *tex, GPUFrameBuffer *fb) { for (int i = 0; i < GPU_TEX_MAX_FBO_ATTACHED; i++) { if (tex->fb[i] == fb) { diff --git a/source/blender/gpu/opengl/gl_framebuffer.cc b/source/blender/gpu/opengl/gl_framebuffer.cc index 60b7a6b45cf..133d56a075d 100644 --- a/source/blender/gpu/opengl/gl_framebuffer.cc +++ b/source/blender/gpu/opengl/gl_framebuffer.cc @@ -168,9 +168,9 @@ void GLFrameBuffer::update_attachments(void) /* First color texture OR the depth texture if no color is attached. * Used to determine frame-buffer color-space and dimensions. */ - GPUAttachmentType first_attachment = GPU_FB_MAX_ATTACHEMENT; + GPUAttachmentType first_attachment = GPU_FB_MAX_ATTACHMENT; /* NOTE: Inverse iteration to get the first color texture. */ - for (GPUAttachmentType type = GPU_FB_MAX_ATTACHEMENT - 1; type >= 0; --type) { + for (GPUAttachmentType type = GPU_FB_MAX_ATTACHMENT - 1; type >= 0; --type) { GPUAttachment &attach = attachments_[type]; GLenum gl_attachment = to_gl(type); @@ -178,7 +178,7 @@ void GLFrameBuffer::update_attachments(void) gl_attachments_[type - GPU_FB_COLOR_ATTACHMENT0] = (attach.tex) ? gl_attachment : GL_NONE; first_attachment = (attach.tex) ? type : first_attachment; } - else if (first_attachment == GPU_FB_MAX_ATTACHEMENT) { + else if (first_attachment == GPU_FB_MAX_ATTACHMENT) { /* Only use depth texture to get information if there is no color attachment. */ first_attachment = (attach.tex) ? type : first_attachment; } @@ -226,7 +226,7 @@ void GLFrameBuffer::update_attachments(void) } } - if (first_attachment != GPU_FB_MAX_ATTACHEMENT) { + if (first_attachment != GPU_FB_MAX_ATTACHMENT) { GPUAttachment &attach = attachments_[first_attachment]; int size[3]; GPU_texture_get_mipmap_size(attach.tex, attach.mip, size); @@ -371,7 +371,7 @@ void GLFrameBuffer::clear_multi(const float (*clear_cols)[4]) * all attachments. * TODO(fclem) fix this insecurity? */ int type = GPU_FB_COLOR_ATTACHMENT0; - for (int i = 0; type < GPU_FB_MAX_ATTACHEMENT; i++, type++) { + for (int i = 0; type < GPU_FB_MAX_ATTACHMENT; i++, type++) { if (attachments_[type].tex != NULL) { glClearBufferfv(GL_COLOR, i, clear_cols[i]); } |