Cleanup: spelling
This commit is contained in:
@@ -1501,8 +1501,7 @@ static void scene_graph_update_tagged(Depsgraph *depsgraph, Main *bmain, bool on
|
||||
/* Flush editing data if needed. */
|
||||
prepare_mesh_for_viewport_render(bmain, view_layer);
|
||||
/* Update all objects: drivers, matrices, displists, etc. flags set
|
||||
* by depgraph or manual, no layer check here, gets correct flushed.
|
||||
*/
|
||||
* by depsgraph or manual, no layer check here, gets correct flushed. */
|
||||
DEG_evaluate_on_refresh(depsgraph);
|
||||
/* Update sound system. */
|
||||
BKE_scene_update_sound(depsgraph, bmain);
|
||||
|
||||
@@ -121,9 +121,9 @@ namespace robust_pred {
|
||||
* and to export only the following declared non-static functions.
|
||||
*
|
||||
* Since this is C++, an instantiated singleton class is used to make
|
||||
* sure that exactinit() is called once.
|
||||
* (Because of undefinedness of when this is called in initialization of all
|
||||
* modules, other modules shouldn't use these functions in initialization.)
|
||||
* sure that #exactinit() is called once.
|
||||
* (Because it's undefined when this is called in initialization of all modules,
|
||||
other modules shouldn't use these functions in initialization.)
|
||||
*/
|
||||
|
||||
void exactinit();
|
||||
|
||||
@@ -996,10 +996,10 @@ static void fill_grid_data(int x_subdiv,
|
||||
|
||||
static void spheregrid_test(int nrings, int grid_level, double z_offset, bool use_self)
|
||||
{
|
||||
/* Make a uvsphere and a grid.
|
||||
* The sphere is radius 1, has nrings rings and 2 * nrings segs,
|
||||
/* Make a uv-sphere and a grid.
|
||||
* The sphere is radius 1, has `nrings` rings and `2 * nrings` segments,
|
||||
* and is centered at (0,0,z_offset).
|
||||
* The plane is 4x4, has 2**grid_level subdivisions x and y,
|
||||
* The plane is 4x4, has `2 ** grid_level` subdivisions x and y,
|
||||
* and is centered at the origin. */
|
||||
if (nrings < 2 || grid_level < 1) {
|
||||
return;
|
||||
|
||||
@@ -293,7 +293,7 @@ static void draw_seq_waveform(View2D *v2d,
|
||||
return;
|
||||
}
|
||||
|
||||
/* Fcurve lookup is quite expensive, so do this after precondition. */
|
||||
/* F-curve lookup is quite expensive, so do this after precondition. */
|
||||
FCurve *fcu = id_data_find_fcurve(&scene->id, seq, &RNA_Sequence, "volume", 0, NULL);
|
||||
|
||||
GPU_blend(GPU_BLEND_ALPHA);
|
||||
@@ -586,9 +586,8 @@ static void draw_seq_outline(Sequence *seq,
|
||||
immUniformColor3ubv(col);
|
||||
|
||||
/* 2px wide outline for selected strips. */
|
||||
/* XXX: some platforms don't support glLines wider than 1px (see T57570),
|
||||
* draw outline as four boxes instead.
|
||||
*/
|
||||
/* XXX: some platforms don't support OpenGL lines wider than 1px (see T57570),
|
||||
* draw outline as four boxes instead. */
|
||||
if (seq->flag & SELECT) {
|
||||
/* Left */
|
||||
immRectf(pos, x1 - pixelx, y1, x1 + pixelx, y2);
|
||||
@@ -1232,8 +1231,9 @@ void ED_sequencer_special_preview_clear(void)
|
||||
|
||||
/**
|
||||
* Rendering using opengl will change the current viewport/context.
|
||||
* This is why we need the ARegion, to set back the render area.
|
||||
* TODO do not rely on such hack and just update the ibuf ouside of
|
||||
* This is why we need the \a region, to set back the render area.
|
||||
*
|
||||
* TODO: do not rely on such hack and just update the \a ibuf outside of
|
||||
* the UI drawing code.
|
||||
**/
|
||||
ImBuf *sequencer_ibuf_get(struct Main *bmain,
|
||||
@@ -1280,7 +1280,7 @@ ImBuf *sequencer_ibuf_get(struct Main *bmain,
|
||||
GPU_viewport_unbind(viewport);
|
||||
}
|
||||
else {
|
||||
/* Rendering can change OGL context. Save & Restore framebuffer. */
|
||||
/* Rendering can change OGL context. Save & Restore frame-buffer. */
|
||||
GPU_framebuffer_restore();
|
||||
}
|
||||
|
||||
@@ -1364,7 +1364,7 @@ static void sequencer_draw_gpencil(const bContext *C)
|
||||
/* Draw grease-pencil (image aligned). */
|
||||
ED_annotation_draw_2dimage(C);
|
||||
|
||||
/* Ortho at pixel level. */
|
||||
/* Orthographic at pixel level. */
|
||||
UI_view2d_view_restore(C);
|
||||
|
||||
/* Draw grease-pencil (screen aligned). */
|
||||
@@ -1422,7 +1422,7 @@ static void sequencer_draw_borders(const SpaceSeq *sseq, const View2D *v2d, cons
|
||||
#if 0
|
||||
void sequencer_draw_maskedit(const bContext *C, Scene *scene, ARegion *region, SpaceSeq *sseq)
|
||||
{
|
||||
/* NOTE: sequencer mask editing isnt finished, the draw code is working but editing not.
|
||||
/* NOTE: sequencer mask editing isn't finished, the draw code is working but editing not.
|
||||
* For now just disable drawing since the strip frame will likely be offset. */
|
||||
|
||||
// if (sc->mode == SC_MODE_MASKEDIT)
|
||||
@@ -1537,7 +1537,7 @@ static void sequencer_stop_running_jobs(const bContext *C, Scene *scene)
|
||||
{
|
||||
if (G.is_rendering == false && (scene->r.seq_prev_type) == OB_RENDER) {
|
||||
/* Stop all running jobs, except screen one. Currently previews frustrate Render.
|
||||
* Need to make so sequencer's rendering doesn't conflict with compositor. */
|
||||
* Need to make so sequencers rendering doesn't conflict with compositor. */
|
||||
WM_jobs_kill_type(CTX_wm_manager(C), NULL, WM_JOB_TYPE_COMPOSITE);
|
||||
|
||||
/* In case of final rendering used for preview, kill all previews,
|
||||
@@ -1607,7 +1607,7 @@ static void sequencer_draw_display_buffer(const bContext *C,
|
||||
GPU_blend(GPU_BLEND_ALPHA);
|
||||
}
|
||||
|
||||
/* Format needs to be created prior to any immBindShader call.
|
||||
/* Format needs to be created prior to any #immBindShader call.
|
||||
* Do it here because OCIO binds it's own shader. */
|
||||
eGPUTextureFormat format;
|
||||
eGPUDataFormat data;
|
||||
@@ -1787,7 +1787,7 @@ void sequencer_draw_preview(const bContext *C,
|
||||
ibuf = sequencer_ibuf_get(
|
||||
bmain, region, depsgraph, scene, sseq, cfra, frame_ofs, names[sseq->multiview_eye]);
|
||||
|
||||
/* Setup offscreen buffers. */
|
||||
/* Setup off-screen buffers. */
|
||||
GPUViewport *viewport = WM_draw_region_get_viewport(region);
|
||||
GPUFrameBuffer *framebuffer_overlay = GPU_viewport_framebuffer_overlay_get(viewport);
|
||||
GPU_framebuffer_bind_no_srgb(framebuffer_overlay);
|
||||
@@ -1837,7 +1837,7 @@ void sequencer_draw_preview(const bContext *C,
|
||||
sequencer_draw_maskedit(C, scene, region, sseq);
|
||||
#endif
|
||||
|
||||
/* Scope is freed in sequencer_check_scopes when ibuf changes and redraw is needed. */
|
||||
/* Scope is freed in sequencer_check_scopes when `ibuf` changes and redraw is needed. */
|
||||
if (ibuf) {
|
||||
IMB_freeImBuf(ibuf);
|
||||
}
|
||||
@@ -1902,7 +1902,7 @@ static void draw_seq_strips(const bContext *C, Editing *ed, ARegion *region)
|
||||
Sequence *seq;
|
||||
/* Loop through strips, checking for those that are visible. */
|
||||
for (seq = ed->seqbasep->first; seq; seq = seq->next) {
|
||||
/* Boundbox and selection tests for NOT drawing the strip. */
|
||||
/* Bound-box and selection tests for NOT drawing the strip. */
|
||||
if ((seq->flag & SELECT) != sel) {
|
||||
continue;
|
||||
}
|
||||
@@ -1939,7 +1939,7 @@ static void draw_seq_strips(const bContext *C, Editing *ed, ARegion *region)
|
||||
if (BKE_sequence_effect_get_num_inputs(last_seq->type) > 0) {
|
||||
draw_effect_inputs_highlight(last_seq);
|
||||
}
|
||||
/* When active is a Multicam strip, highlight its source channel. */
|
||||
/* When active is a Multi-cam strip, highlight its source channel. */
|
||||
else if (last_seq->type == SEQ_TYPE_MULTICAM) {
|
||||
int channel = last_seq->multicam_source;
|
||||
if (channel != 0) {
|
||||
@@ -2285,7 +2285,7 @@ void draw_timeline_seq(const bContext *C, ARegion *region)
|
||||
}
|
||||
|
||||
UI_view2d_view_ortho(v2d);
|
||||
/* Get timeline boundbox, needed for the scrollers. */
|
||||
/* Get timeline bound-box, needed for the scroll-bars. */
|
||||
boundbox_seq(scene, &v2d->tot);
|
||||
draw_seq_backdrop(v2d);
|
||||
UI_view2d_constant_grid_draw(v2d, FPS);
|
||||
|
||||
@@ -211,7 +211,7 @@ void GPU_framebuffer_recursive_downsample(GPUFrameBuffer *fb,
|
||||
void *userData);
|
||||
|
||||
/* GPU OffScreen
|
||||
* - wrapper around framebuffer and texture for simple offscreen drawing
|
||||
* - wrapper around frame-buffer and texture for simple off-screen drawing
|
||||
*/
|
||||
|
||||
GPUOffScreen *GPU_offscreen_create(
|
||||
|
||||
@@ -44,7 +44,7 @@ struct GPUMatrixState;
|
||||
|
||||
struct GPUContext {
|
||||
public:
|
||||
/** State managment */
|
||||
/** State management */
|
||||
blender::gpu::Shader *shader = NULL;
|
||||
blender::gpu::FrameBuffer *active_fb = NULL;
|
||||
GPUMatrixState *matrix_state = NULL;
|
||||
@@ -52,11 +52,11 @@ struct GPUContext {
|
||||
blender::gpu::Immediate *imm = NULL;
|
||||
|
||||
/**
|
||||
* All 4 window framebuffers.
|
||||
* None of them are valid in an offscreen context.
|
||||
* Right framebuffers are only available if using stereo rendering.
|
||||
* Front framebuffers contains (in principle, but not always) the last frame color.
|
||||
* Default framebuffer is back_left.
|
||||
* All 4 window frame-buffers.
|
||||
* None of them are valid in an off-screen context.
|
||||
* Right frame-buffers are only available if using stereo rendering.
|
||||
* Front frame-buffers contains (in principle, but not always) the last frame color.
|
||||
* Default frame-buffer is back_left.
|
||||
*/
|
||||
blender::gpu::FrameBuffer *back_left = NULL;
|
||||
blender::gpu::FrameBuffer *front_left = NULL;
|
||||
@@ -67,7 +67,7 @@ struct GPUContext {
|
||||
/** Thread on which this context is active. */
|
||||
pthread_t thread_;
|
||||
bool is_active_;
|
||||
/** Avoid including GHOST headers. Can be NULL for offscreen contexts. */
|
||||
/** Avoid including GHOST headers. Can be NULL for off-screen contexts. */
|
||||
void *ghost_window_;
|
||||
|
||||
public:
|
||||
@@ -82,13 +82,13 @@ struct GPUContext {
|
||||
MEM_CXX_CLASS_ALLOC_FUNCS("GPUContext")
|
||||
};
|
||||
|
||||
/* These require a gl ctx bound. */
|
||||
/* These require a OpenGL ctx bound. */
|
||||
GLuint GPU_buf_alloc(void);
|
||||
GLuint GPU_tex_alloc(void);
|
||||
GLuint GPU_vao_alloc(void);
|
||||
GLuint GPU_fbo_alloc(void);
|
||||
|
||||
/* These can be called any threads even without gl ctx. */
|
||||
/* These can be called any threads even without OpenGL ctx. */
|
||||
void GPU_buf_free(GLuint buf_id);
|
||||
void GPU_tex_free(GLuint tex_id);
|
||||
/* These two need the ctx the id was created with. */
|
||||
|
||||
@@ -77,7 +77,7 @@ FrameBuffer::~FrameBuffer()
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Attachments managment
|
||||
/** \name Attachments Management
|
||||
* \{ */
|
||||
|
||||
void FrameBuffer::attachment_set(GPUAttachmentType type, const GPUAttachment &new_attachment)
|
||||
@@ -139,13 +139,13 @@ void FrameBuffer::recursive_downsample(int max_lvl,
|
||||
void *userData)
|
||||
{
|
||||
GPUContext *ctx = GPU_context_active_get();
|
||||
/* Bind to make sure the framebuffer is up to date. */
|
||||
/* Bind to make sure the frame-buffer is up to date. */
|
||||
this->bind(true);
|
||||
|
||||
if (width_ == 1 && height_ == 1) {
|
||||
return;
|
||||
}
|
||||
/* HACK: Make the framebuffer appear not bound to avoid assert in GPU_texture_bind. */
|
||||
/* HACK: Make the frame-buffer appear not bound to avoid assert in GPU_texture_bind. */
|
||||
ctx->active_fb = NULL;
|
||||
|
||||
int levels = floor(log2(max_ii(width_, height_)));
|
||||
@@ -157,7 +157,7 @@ void FrameBuffer::recursive_downsample(int max_lvl,
|
||||
/* calculate next viewport size */
|
||||
current_dim[0] = max_ii(current_dim[0] / 2, 1);
|
||||
current_dim[1] = max_ii(current_dim[1] / 2, 1);
|
||||
/* Replace attaached miplevel for each attachement. */
|
||||
/* Replace attached mip-level for each attachment. */
|
||||
for (int att = 0; att < ARRAY_SIZE(attachments_); att++) {
|
||||
GPUTexture *tex = attachments_[att].tex;
|
||||
if (tex != NULL) {
|
||||
@@ -177,7 +177,7 @@ void FrameBuffer::recursive_downsample(int max_lvl,
|
||||
/* Update the internal attachments and viewport size. */
|
||||
dirty_attachments_ = true;
|
||||
this->bind(true);
|
||||
/* HACK: Make the framebuffer appear not bound to avoid assert in GPU_texture_bind. */
|
||||
/* HACK: Make the frame-buffer appear not bound to avoid assert in GPU_texture_bind. */
|
||||
ctx->active_fb = NULL;
|
||||
|
||||
callback(userData, mip_lvl);
|
||||
@@ -217,7 +217,7 @@ using namespace blender::gpu;
|
||||
GPUFrameBuffer *GPU_framebuffer_create(const char *name)
|
||||
{
|
||||
/* We generate the FB object later at first use in order to
|
||||
* create the framebuffer in the right opengl context. */
|
||||
* create the frame-buffer in the right opengl context. */
|
||||
return (GPUFrameBuffer *)GPUBackend::get()->framebuffer_alloc(name);
|
||||
}
|
||||
|
||||
@@ -235,7 +235,9 @@ void GPU_framebuffer_bind(GPUFrameBuffer *gpu_fb)
|
||||
fb->bind(enable_srgb);
|
||||
}
|
||||
|
||||
/* Workaround for binding a srgb framebuffer without doing the srgb transform. */
|
||||
/**
|
||||
* Workaround for binding a SRGB frame-buffer without doing the SRGB transform.
|
||||
*/
|
||||
void GPU_framebuffer_bind_no_srgb(GPUFrameBuffer *gpu_fb)
|
||||
{
|
||||
FrameBuffer *fb = reinterpret_cast<FrameBuffer *>(gpu_fb);
|
||||
@@ -243,7 +245,9 @@ void GPU_framebuffer_bind_no_srgb(GPUFrameBuffer *gpu_fb)
|
||||
fb->bind(enable_srgb);
|
||||
}
|
||||
|
||||
/* For stereo rendering. */
|
||||
/**
|
||||
* For stereo rendering.
|
||||
*/
|
||||
void GPU_backbuffer_bind(eGPUBackBuffer buffer)
|
||||
{
|
||||
GPUContext *ctx = GPU_context_active_get();
|
||||
@@ -267,7 +271,7 @@ GPUFrameBuffer *GPU_framebuffer_active_get(void)
|
||||
return reinterpret_cast<GPUFrameBuffer *>(ctx ? ctx->active_fb : NULL);
|
||||
}
|
||||
|
||||
/* Returns the default framebuffer. Will always exists even if it's just a dummy. */
|
||||
/* Returns the default frame-buffer. Will always exists even if it's just a dummy. */
|
||||
GPUFrameBuffer *GPU_framebuffer_back_get(void)
|
||||
{
|
||||
GPUContext *ctx = GPU_context_active_get();
|
||||
@@ -363,9 +367,11 @@ void GPU_framebuffer_config_array(GPUFrameBuffer *gpu_fb,
|
||||
|
||||
/* ---------- Viewport & Scissor Region ----------- */
|
||||
|
||||
/* Viewport and scissor size is stored per framebuffer.
|
||||
* It is only reset to its original dimensions explicitely OR when binding the framebuffer after
|
||||
* modifiying its attachments. */
|
||||
/**
|
||||
* Viewport and scissor size is stored per frame-buffer.
|
||||
* It is only reset to its original dimensions explicitly OR when binding the frame-buffer after
|
||||
* modifying its attachments.
|
||||
*/
|
||||
void GPU_framebuffer_viewport_set(GPUFrameBuffer *gpu_fb, int x, int y, int width, int height)
|
||||
{
|
||||
int viewport_rect[4] = {x, y, width, height};
|
||||
@@ -377,7 +383,9 @@ void GPU_framebuffer_viewport_get(GPUFrameBuffer *gpu_fb, int r_viewport[4])
|
||||
reinterpret_cast<FrameBuffer *>(gpu_fb)->viewport_get(r_viewport);
|
||||
}
|
||||
|
||||
/* Reset to its attachement(s) size. */
|
||||
/**
|
||||
* Reset to its attachment(s) size.
|
||||
*/
|
||||
void GPU_framebuffer_viewport_reset(GPUFrameBuffer *gpu_fb)
|
||||
{
|
||||
reinterpret_cast<FrameBuffer *>(gpu_fb)->viewport_reset();
|
||||
@@ -394,7 +402,9 @@ void GPU_framebuffer_clear(GPUFrameBuffer *gpu_fb,
|
||||
reinterpret_cast<FrameBuffer *>(gpu_fb)->clear(buffers, clear_col, clear_depth, clear_stencil);
|
||||
}
|
||||
|
||||
/* Clear all textures attached to this framebuffer with a different color. */
|
||||
/**
|
||||
* Clear all textures attached to this frame-buffer with a different color.
|
||||
*/
|
||||
void GPU_framebuffer_multi_clear(GPUFrameBuffer *gpu_fb, const float (*clear_cols)[4])
|
||||
{
|
||||
reinterpret_cast<FrameBuffer *>(gpu_fb)->clear_multi(clear_cols);
|
||||
@@ -487,7 +497,7 @@ void GPU_framebuffer_blit(GPUFrameBuffer *gpufb_read,
|
||||
}
|
||||
|
||||
/**
|
||||
* Use this if you need to custom down-sample your texture and use the previous mip level as
|
||||
* Use this if you need to custom down-sample your texture and use the previous mip-level as
|
||||
* input. This function only takes care of the correct texture handling. It execute the callback
|
||||
* for each texture level.
|
||||
*/
|
||||
@@ -504,7 +514,7 @@ void GPU_framebuffer_recursive_downsample(GPUFrameBuffer *gpu_fb,
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name GPUOffScreen
|
||||
*
|
||||
* Container that holds a framebuffer and its textures.
|
||||
* Container that holds a frame-buffer and its textures.
|
||||
* Might be bound to multiple contexts.
|
||||
* \{ */
|
||||
|
||||
@@ -543,7 +553,9 @@ struct GPUOffScreen {
|
||||
GPUTexture *depth;
|
||||
};
|
||||
|
||||
/* Returns the correct framebuffer for the current context. */
|
||||
/**
|
||||
* Returns the correct frame-buffer for the current context.
|
||||
*/
|
||||
static GPUFrameBuffer *gpu_offscreen_fb_get(GPUOffScreen *ofs)
|
||||
{
|
||||
GPUContext *ctx = GPU_context_active_get();
|
||||
@@ -689,7 +701,9 @@ GPUTexture *GPU_offscreen_color_texture(const GPUOffScreen *ofs)
|
||||
return ofs->color;
|
||||
}
|
||||
|
||||
/* only to be used by viewport code! */
|
||||
/**
|
||||
* \note only to be used by viewport code!
|
||||
*/
|
||||
void GPU_offscreen_viewport_data_get(GPUOffScreen *ofs,
|
||||
GPUFrameBuffer **r_fb,
|
||||
GPUTexture **r_color,
|
||||
@@ -700,4 +714,4 @@ void GPU_offscreen_viewport_data_get(GPUOffScreen *ofs,
|
||||
*r_depth = ofs->depth;
|
||||
}
|
||||
|
||||
/** \} */
|
||||
/** \} */
|
||||
|
||||
@@ -90,15 +90,15 @@ namespace gpu {
|
||||
|
||||
class FrameBuffer {
|
||||
protected:
|
||||
/** Set of texture attachements to render to. DEPTH and DEPTH_STENCIL are mutualy exclusive. */
|
||||
/** Set of texture attachments to render to. DEPTH and DEPTH_STENCIL are mutually exclusive. */
|
||||
GPUAttachment attachments_[GPU_FB_MAX_ATTACHEMENT];
|
||||
/** Is true if internal representation need to be updated. */
|
||||
bool dirty_attachments_;
|
||||
/** Size of attachement textures. */
|
||||
/** Size of attachment textures. */
|
||||
int width_, height_;
|
||||
/** Debug name. */
|
||||
char name_[DEBUG_NAME_LEN];
|
||||
/** Framebuffer state. */
|
||||
/** Frame-buffer state. */
|
||||
int viewport_[4];
|
||||
int scissor_[4];
|
||||
bool scissor_test_ = false;
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace blender::gpu::debug {
|
||||
/** \name Debug Callbacks
|
||||
*
|
||||
* Hooks up debug callbacks to a debug OpenGL context using extensions or 4.3 core debug
|
||||
* capabiliities.
|
||||
* capabilities.
|
||||
* \{ */
|
||||
|
||||
/* Debug callbacks need the same calling convention as OpenGL functions. */
|
||||
@@ -204,4 +204,4 @@ void check_gl_resources(const char *info)
|
||||
|
||||
/** \} */
|
||||
|
||||
} // namespace blender::gpu::debug
|
||||
} // namespace blender::gpu::debug
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace blender::gpu {
|
||||
|
||||
GLFrameBuffer::GLFrameBuffer(const char *name) : FrameBuffer(name)
|
||||
{
|
||||
/* Just-In-Time init. See GLFrameBuffer::init(). */
|
||||
/* Just-In-Time init. See #GLFrameBuffer::init(). */
|
||||
immutable_ = false;
|
||||
fbo_id_ = 0;
|
||||
}
|
||||
@@ -52,7 +52,7 @@ GLFrameBuffer::GLFrameBuffer(
|
||||
immutable_ = true;
|
||||
fbo_id_ = fbo;
|
||||
gl_attachments_[0] = target;
|
||||
/* Never update an internal framebuffer. */
|
||||
/* Never update an internal frame-buffer. */
|
||||
dirty_attachments_ = false;
|
||||
width_ = w;
|
||||
height_ = h;
|
||||
@@ -79,15 +79,15 @@ GLFrameBuffer::~GLFrameBuffer()
|
||||
}
|
||||
|
||||
if (context_ == GPU_context_active_get()) {
|
||||
/* Context might be partially freed. This happens when destroying the window framebuffers. */
|
||||
/* Context might be partially freed. This happens when destroying the window frame-buffers. */
|
||||
glDeleteFramebuffers(1, &fbo_id_);
|
||||
}
|
||||
else {
|
||||
context_->fbo_free(fbo_id_);
|
||||
}
|
||||
/* Restore default framebuffer if this framebuffer was bound. */
|
||||
/* Restore default frame-buffer if this frame-buffer was bound. */
|
||||
if (context_->active_fb == this && context_->back_left != this) {
|
||||
/* If this assert triggers it means the framebuffer is being freed while in use by another
|
||||
/* If this assert triggers it means the frame-buffer is being freed while in use by another
|
||||
* context which, by the way, is TOTALLY UNSAFE!!! */
|
||||
BLI_assert(context_ == GPU_context_active_get());
|
||||
GPU_framebuffer_restore();
|
||||
@@ -149,7 +149,7 @@ bool GLFrameBuffer::check(char err_out[256])
|
||||
|
||||
#undef FORMAT_STATUS
|
||||
|
||||
const char *format = "GPUFrameBuffer: framebuffer status %s\n";
|
||||
const char *format = "GPUFrameBuffer: frame-buffer status %s\n";
|
||||
|
||||
if (err_out) {
|
||||
BLI_snprintf(err_out, 256, format, err);
|
||||
@@ -163,11 +163,11 @@ bool GLFrameBuffer::check(char err_out[256])
|
||||
|
||||
void GLFrameBuffer::update_attachments(void)
|
||||
{
|
||||
/* Default framebuffers cannot have attachements. */
|
||||
/* Default frame-buffers cannot have attachments. */
|
||||
BLI_assert(immutable_ == false);
|
||||
|
||||
/* First color texture OR the depth texture if no color is attached.
|
||||
* Used to determine framebuffer colorspace and dimensions. */
|
||||
* Used to determine frame-buffer color-space and dimensions. */
|
||||
GPUAttachmentType first_attachment = GPU_FB_MAX_ATTACHEMENT;
|
||||
/* NOTE: Inverse iteration to get the first color texture. */
|
||||
for (GPUAttachmentType type = GPU_FB_MAX_ATTACHEMENT - 1; type >= 0; --type) {
|
||||
@@ -179,7 +179,7 @@ void GLFrameBuffer::update_attachments(void)
|
||||
first_attachment = (attach.tex) ? type : first_attachment;
|
||||
}
|
||||
else if (first_attachment == GPU_FB_MAX_ATTACHEMENT) {
|
||||
/* Only use depth texture to get infos if there is no color attachment. */
|
||||
/* Only use depth texture to get information if there is no color attachment. */
|
||||
first_attachment = (attach.tex) ? type : first_attachment;
|
||||
}
|
||||
|
||||
@@ -190,7 +190,7 @@ void GLFrameBuffer::update_attachments(void)
|
||||
GLuint gl_tex = GPU_texture_opengl_bindcode(attach.tex);
|
||||
if (attach.layer > -1 && GPU_texture_cube(attach.tex) && !GPU_texture_array(attach.tex)) {
|
||||
/* Could be avoided if ARB_direct_state_access is required. In this case
|
||||
* glFramebufferTextureLayer would bind the correct face. */
|
||||
* #glFramebufferTextureLayer would bind the correct face. */
|
||||
GLenum gl_target = GL_TEXTURE_CUBE_MAP_POSITIVE_X + attach.layer;
|
||||
glFramebufferTexture2D(GL_FRAMEBUFFER, gl_attachment, gl_target, gl_tex, attach.mip);
|
||||
}
|
||||
@@ -198,7 +198,7 @@ void GLFrameBuffer::update_attachments(void)
|
||||
glFramebufferTextureLayer(GL_FRAMEBUFFER, gl_attachment, gl_tex, attach.mip, attach.layer);
|
||||
}
|
||||
else {
|
||||
/* The whole texture level is attached. The framebuffer is potentially layered. */
|
||||
/* The whole texture level is attached. The frame-buffer is potentially layered. */
|
||||
glFramebufferTexture(GL_FRAMEBUFFER, gl_attachment, gl_tex, attach.mip);
|
||||
}
|
||||
/* We found one depth buffer type. Stop here, otherwise we would
|
||||
@@ -275,13 +275,13 @@ void GLFrameBuffer::bind(bool enabled_srgb)
|
||||
}
|
||||
|
||||
if (context_ != GPU_context_active_get()) {
|
||||
BLI_assert(!"Trying to use the same framebuffer in multiple context");
|
||||
BLI_assert(!"Trying to use the same frame-buffer in multiple context");
|
||||
return;
|
||||
}
|
||||
|
||||
if (context_->active_fb != this) {
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, fbo_id_);
|
||||
/* Internal framebuffers have only one color output and needs to be set everytime. */
|
||||
/* Internal frame-buffers have only one color output and needs to be set every time. */
|
||||
if (immutable_ && fbo_id_ == 0) {
|
||||
glDrawBuffer(gl_attachments_[0]);
|
||||
}
|
||||
@@ -367,7 +367,7 @@ void GLFrameBuffer::clear_multi(const float (*clear_cols)[4])
|
||||
|
||||
context_->state_manager->apply_state();
|
||||
|
||||
/* WATCH: This can easilly access clear_cols out of bounds it clear_cols is not big enough for
|
||||
/* WATCH: This can easily access clear_cols out of bounds it clear_cols is not big enough for
|
||||
* all attachments.
|
||||
* TODO(fclem) fix this insecurity? */
|
||||
int type = GPU_FB_COLOR_ATTACHMENT0;
|
||||
@@ -406,7 +406,7 @@ void GLFrameBuffer::read(eGPUFrameBufferBits plane,
|
||||
fprintf(stderr, "GPUFramebuffer: Error: Trying to read stencil bit. Unsupported.");
|
||||
return;
|
||||
default:
|
||||
fprintf(stderr, "GPUFramebuffer: Error: Trying to read more than one framebuffer plane.");
|
||||
fprintf(stderr, "GPUFramebuffer: Error: Trying to read more than one frame-buffer plane.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -415,14 +415,16 @@ void GLFrameBuffer::read(eGPUFrameBufferBits plane,
|
||||
glReadPixels(UNPACK4(area), format, type, r_data);
|
||||
}
|
||||
|
||||
/* Copy src at the give offset inside dst. */
|
||||
/**
|
||||
* Copy \a src at the give offset inside \a dst.
|
||||
*/
|
||||
void GLFrameBuffer::blit_to(
|
||||
eGPUFrameBufferBits planes, int src_slot, FrameBuffer *dst_, int dst_slot, int x, int y)
|
||||
{
|
||||
GLFrameBuffer *src = this;
|
||||
GLFrameBuffer *dst = static_cast<GLFrameBuffer *>(dst_);
|
||||
|
||||
/* Framebuffers must be up to date. This simplify this function. */
|
||||
/* Frame-buffers must be up to date. This simplify this function. */
|
||||
if (src->dirty_attachments_) {
|
||||
src->bind(true);
|
||||
}
|
||||
@@ -457,4 +459,4 @@ void GLFrameBuffer::blit_to(
|
||||
|
||||
/** \} */
|
||||
|
||||
} // namespace blender::gpu
|
||||
} // namespace blender::gpu
|
||||
|
||||
@@ -44,8 +44,8 @@ TEST_F(USDStageCreationTest, JSONFileLoadingTest)
|
||||
const size_t path_len = BLI_path_join(
|
||||
usd_datafiles_dir, FILE_MAX, release_dir.c_str(), "datafiles", "usd", nullptr);
|
||||
|
||||
/* BLI_path_join removes trailing slashes, but the USD library requires one in order to recognise
|
||||
* the path as directory. */
|
||||
/* #BLI_path_join removes trailing slashes, but the USD library requires one in order to
|
||||
* recognize the path as directory. */
|
||||
BLI_assert(path_len + 1 < FILE_MAX);
|
||||
usd_datafiles_dir[path_len] = '/';
|
||||
usd_datafiles_dir[path_len + 1] = '\0';
|
||||
|
||||
Reference in New Issue
Block a user