113 GPUViewport *viewport = MEM_new<GPUViewport>(
"GPUViewport");
115 viewport->
size[0] = viewport->
size[1] = -1;
134 int *size = viewport->
size;
135 float const empty_pixel[4] = {0.0f, 0.0f, 0.0f, 0.0f};
145 gpu::TextureFormat::SFLOAT_16_16_16_16,
149 "dtxl_color_overlay",
UNPACK2(size), 1, gpu::TextureFormat::SRGBA_8_8_8_8, usage,
nullptr);
159 gpu::TextureFormat::SFLOAT_16_16_16_16,
165 gpu::TextureFormat::SRGBA_8_8_8_8,
174 if (viewport->
depth_tx ==
nullptr) {
180 gpu::TextureFormat::SFLOAT_32_DEPTH_UINT_8,
184 const float depth_clear = 0.0f;
199 for (
int i = 0; i < 2; i++) {
238 if (!is_xr_surface) {
283 viewport->
dither = dither;
308 GPU_ATTACHMENT_TEXTURE(viewport->color_overlay_tx[0]),
309 GPU_ATTACHMENT_TEXTURE(viewport->color_render_tx[0]),
315 vert_format,
"texCoord", gpu::VertAttrType::SFLOAT_32_32);
380 format,
"pos", gpu::VertAttrType::SFLOAT_32_32);
382 format,
"texCoord", gpu::VertAttrType::SFLOAT_32_32);
390 const uint vbo_len = 4;
418 const rctf *rect_pos,
421 const float compare_limit = 0.0001f;
422 const bool parameters_changed =
427 if (viewport->
batch.
batch && parameters_changed) {
452 const rctf *rect_pos,
454 bool display_colorspace,
455 bool do_overlay_merge)
460 bool use_ocio =
false;
504 bool display_colorspace,
505 bool do_overlay_merge)
509 if (
color ==
nullptr) {
517 rcti sanitized_rect = *rect;
528 pos_rect.
xmin = sanitized_rect.
xmin;
529 pos_rect.
ymin = sanitized_rect.
ymin;
531 pos_rect.
ymax = sanitized_rect.
ymin + h;
534 uv_rect.
xmin = halfx;
535 uv_rect.
ymin = halfy;
536 uv_rect.
xmax = halfx + 1.0f;
537 uv_rect.
ymax = halfy + 1.0f;
542 std::swap(uv_rect.
xmin, uv_rect.
xmax);
545 std::swap(uv_rect.
ymin, uv_rect.
ymax);
549 viewport, view, &pos_rect, &uv_rect, display_colorspace, do_overlay_merge);
559 bool display_colorspace,
560 bool do_overlay_merge)
572 pos_rect.
xmin = -1.0f;
573 pos_rect.
ymin = -1.0f;
574 pos_rect.
xmax = 1.0f;
575 pos_rect.
ymax = 1.0f;
584 viewport, view, &pos_rect, &uv_rect, display_colorspace, do_overlay_merge);
626 GPU_ATTACHMENT_TEXTURE(viewport->depth_tx),
627 GPU_ATTACHMENT_TEXTURE(viewport->color_render_tx[viewport->active_view]),
637 GPU_ATTACHMENT_TEXTURE(viewport->depth_tx),
638 GPU_ATTACHMENT_TEXTURE(viewport->color_overlay_tx[viewport->active_view]),
654 MEM_delete(viewport);
#define GPU_batch_uniform_1i(batch, name, x)
#define GPU_FRAMEBUFFER_FREE_SAFE(fb)
#define GPU_framebuffer_ensure_config(_fb,...)
#define GPU_TEXTURE_FREE_SAFE(texture)
Read Blender memory allocation and freeing.
#define SET_FLAG_FROM_TEST(value, test, flag)
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
void DRW_gpu_context_enable()
void GPU_viewport_stereo_composite(GPUViewport *viewport, Stereo3dFormat *stereo_format)
void GPU_framebuffer_bind(gpu::FrameBuffer *fb)
void GPU_viewport_draw_to_screen_ex(GPUViewport *viewport, int view, const rcti *rect, bool display_colorspace, bool do_overlay_merge)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
gpu::Texture * GPU_viewport_color_texture(GPUViewport *viewport, int view)
static struct blender::@173001173141073324343215237207056221242135144335 g_viewport
CurveMapping * BKE_curvemapping_copy(const CurveMapping *cumap)
MINLINE void copy_v2_v2_int(int r[2], const int a[2])
void GPU_viewport_colorspace_set(GPUViewport *viewport, const ColorManagedViewSettings *view_settings, const ColorManagedDisplaySettings *display_settings, float dither)
gpu::Batch * GPU_batch_create_ex(GPUPrimType primitive_type, gpu::VertBuf *vertex_buf, gpu::IndexBuf *index_buf, GPUBatchFlag owns_flag)
void GPU_framebuffer_restore()
bool IMB_colormanagement_display_is_hdr(const ColorManagedDisplaySettings *display_settings, const char *view_name)
void IMB_colormanagement_finish_glsl_draw()
BLI_INLINE float fb(float length, float L)
void GPU_matrix_identity_set()
void GPU_viewport_tag_update(GPUViewport *viewport)
GPUVertFormat * immVertexFormat()
void BKE_color_managed_view_settings_copy_keep_curve_mapping(ColorManagedViewSettings *new_settings, const ColorManagedViewSettings *settings)
void immBegin(GPUPrimType, uint vertex_len)
void GPU_viewport_bind_from_offscreen(GPUViewport *viewport, GPUOffScreen *ofs, bool is_xr_surface)
gpu::FrameBuffer * GPU_viewport_framebuffer_render_get(GPUViewport *viewport)
bool IMB_colormanagement_setup_glsl_draw_from_space(const ColorManagedViewSettings *view_settings, const ColorManagedDisplaySettings *display_settings, const ColorSpace *from_colorspace, float dither, bool predivide, bool do_overlay_merge, ColorManagedDisplaySpace display_space=DISPLAY_SPACE_DRAW, float opacity=1.0f)
void GPU_batch_discard(gpu::Batch *batch)
void GPU_matrix_identity_projection_set()
int GPU_offscreen_width(const GPUOffScreen *offscreen)
void immAttr2f(uint attr_id, float x, float y)
GPU_INLINE void * GPU_vertbuf_raw_step(GPUVertBufRaw *a)
static const GPUVertFormat & gpu_viewport_batch_format()
void BLI_rcti_sanitize(struct rcti *rect)
gpu::Texture * GPU_viewport_overlay_texture(GPUViewport *viewport, int view)
void DRW_viewport_data_free(DRWData *drw_data)
DRWData ** GPU_viewport_data_get(GPUViewport *viewport)
void GPU_viewport_unbind(GPUViewport *viewport)
void immBindBuiltinProgram(GPUBuiltinShader shader_id)
void DRW_gpu_context_disable()
static gpu::Batch * gpu_viewport_batch_create(const rctf *rect_pos, const rctf *rect_uv)
void GPU_viewport_colorspace_clear(GPUViewport *viewport)
BLI_INLINE int BLI_rcti_size_y(const struct rcti *rct)
VecBase< int32_t, 2 > int2
int GPU_offscreen_height(const GPUOffScreen *offscreen)
void immVertex2f(uint attr_id, float x, float y)
void BKE_color_managed_display_settings_copy(ColorManagedDisplaySettings *new_settings, const ColorManagedDisplaySettings *settings)
@ GPU_TEXTURE_USAGE_FORMAT_VIEW
@ GPU_TEXTURE_USAGE_SHADER_READ
@ GPU_TEXTURE_USAGE_SHADER_WRITE
@ GPU_TEXTURE_USAGE_HOST_READ
@ GPU_TEXTURE_USAGE_ATTACHMENT
bool BLI_rctf_compare(const struct rctf *rect_a, const struct rctf *rect_b, float limit)
void GPU_offscreen_viewport_data_get(GPUOffScreen *offscreen, gpu::FrameBuffer **r_fb, gpu::Texture **r_color, gpu::Texture **r_depth)
@ GPU_SHADER_2D_IMAGE_OVERLAYS_MERGE
@ GPU_SHADER_2D_IMAGE_OVERLAYS_STEREO_MERGE
static gpu::Batch * gpu_viewport_batch_get(GPUViewport *viewport, const rctf *rect_pos, const rctf *rect_uv)
void GPU_color_mask(bool r, bool g, bool b, bool a)
int GPU_texture_width(const gpu::Texture *texture)
void GPU_batch_program_set_imm_shader(gpu::Batch *batch)
void GPU_batch_draw(gpu::Batch *batch)
MINLINE void copy_v2_fl2(float v[2], float x, float y)
void GPU_offscreen_bind(GPUOffScreen *offscreen, bool save)
void GPU_viewport_bind(GPUViewport *viewport, int view, const rcti *rect)
void GPU_vertbuf_attr_get_raw_data(gpu::VertBuf *, uint a_idx, GPUVertBufRaw *access)
uint GPU_vertformat_attr_add(GPUVertFormat *format, StringRef name, gpu::VertAttrType type)
BLI_INLINE int BLI_rcti_size_x(const struct rcti *rct)
void GPU_batch_program_set_builtin(gpu::Batch *batch, GPUBuiltinShader shader_id)
static void gpu_viewport_draw_colormanaged(GPUViewport *viewport, int view, const rctf *rect_pos, const rctf *rect_uv, bool display_colorspace, bool do_overlay_merge)
gpu::FrameBuffer * GPU_viewport_framebuffer_overlay_get(GPUViewport *viewport)
void GPU_viewport_free(GPUViewport *viewport)
gpu::Texture * GPU_viewport_depth_texture(GPUViewport *viewport)
void GPU_matrix_pop_projection()
static void gpu_viewport_batch_free(GPUViewport *viewport)
void GPU_texture_clear(gpu::Texture *texture, eGPUDataFormat data_format, const void *data)
void GPU_texture_bind(gpu::Texture *texture, int unit)
int GPU_texture_height(const gpu::Texture *texture)
void GPU_vertbuf_data_alloc(gpu::VertBuf &verts, uint v_len)
@ S3D_ANAGLYPH_YELLOWBLUE
@ S3D_ANAGLYPH_GREENMAGENTA
void GPU_viewport_draw_to_screen(GPUViewport *viewport, int view, const rcti *rect)
void GPU_texture_unbind(gpu::Texture *texture)
void BKE_color_managed_view_settings_free(ColorManagedViewSettings *settings)
bool GPU_viewport_is_stereo_get(GPUViewport *viewport)
static void gpu_viewport_textures_free(GPUViewport *viewport)
void immUniform1i(const char *name, int x)
GPUViewport * GPU_viewport_stereo_create()
void GPU_matrix_push_projection()
void GPU_depth_test(GPUDepthTest test)
int GPU_viewport_active_view_get(GPUViewport *viewport)
gpu::Texture * GPU_texture_create_2d(const char *name, int width, int height, int mip_len, gpu::TextureFormat format, eGPUTextureUsage usage, const float *data)
bool GPU_viewport_do_update(GPUViewport *viewport)
GPUViewport * GPU_viewport_create()
void GPU_viewport_unbind_from_offscreen(GPUViewport *viewport, GPUOffScreen *ofs, bool display_colorspace, bool do_overlay_merge)
static void gpu_viewport_textures_create(GPUViewport *viewport)
ccl_device_inline int rect_size(const int4 rect)
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_PATH_GUIDING float
struct CurveMapping * curve_mapping
struct blender::GPUViewportBatch::@032165141313147065042054252172166113232122301022 last_used_parameters
ColorManagedDisplaySettings display_settings
gpu::FrameBuffer * overlay_fb
gpu::FrameBuffer * stereo_comp_fb
gpu::Texture * color_render_tx[2]
CurveMapping * orig_curve_mapping
gpu::FrameBuffer * render_fb
ColorManagedViewSettings view_settings
gpu::Texture * color_overlay_tx[2]
struct blender::@173001173141073324343215237207056221242135144335::@165201342376101213023223344052306163034031243201 attr_id