|
Blender V4.3
|
#include <cstdio>#include <cstring>#include "DNA_userdef_types.h"#include "DNA_vec_types.h"#include "BLI_utildefines.h"#include "BIF_glutil.hh"#include "IMB_colormanagement.hh"#include "IMB_imbuf_types.hh"#include "GPU_context.hh"#include "GPU_immediate.hh"#include "GPU_texture.hh"Go to the source code of this file.
Macros | |
| #define | DATA(_y, _x) (static_cast<const char *>(rect) + stride * (size_t(_y) * img_w + (_x))) |
Functions | |
| static void | immDrawPixelsTexSetupAttributes (IMMDrawPixelsTexState *state) |
| IMMDrawPixelsTexState | immDrawPixelsTexSetup (int builtin) |
| void | immDrawPixelsTexScaledFullSize (const IMMDrawPixelsTexState *state, const float x, const float y, const int img_w, const int img_h, const eGPUTextureFormat gpu_format, const bool use_filter, const void *rect, const float scaleX, const float scaleY, const float xzoom, const float yzoom, const float color[4]) |
| void | immDrawPixelsTexTiled_scaling_clipping (IMMDrawPixelsTexState *state, float x, float y, int img_w, int img_h, eGPUTextureFormat gpu_format, bool use_filter, const void *rect, float scaleX, float scaleY, float clip_min_x, float clip_min_y, float clip_max_x, float clip_max_y, float xzoom, float yzoom, const float color[4]) |
| void | immDrawPixelsTexTiled_scaling (IMMDrawPixelsTexState *state, float x, float y, int img_w, int img_h, eGPUTextureFormat gpu_format, bool use_filter, const void *rect, float scaleX, float scaleY, float xzoom, float yzoom, const float color[4]) |
| void | immDrawPixelsTexTiled (IMMDrawPixelsTexState *state, float x, float y, int img_w, int img_h, eGPUTextureFormat gpu_format, bool use_filter, const void *rect, float xzoom, float yzoom, const float color[4]) |
| void | immDrawPixelsTexTiled_clipping (IMMDrawPixelsTexState *state, float x, float y, int img_w, int img_h, eGPUTextureFormat gpu_format, bool use_filter, const void *rect, float clip_min_x, float clip_min_y, float clip_max_x, float clip_max_y, float xzoom, float yzoom, const float color[4]) |
| void | ED_draw_imbuf_clipping (ImBuf *ibuf, float x, float y, bool use_filter, const ColorManagedViewSettings *view_settings, const ColorManagedDisplaySettings *display_settings, float clip_min_x, float clip_min_y, float clip_max_x, float clip_max_y, float zoom_x, float zoom_y) |
| void | ED_draw_imbuf (ImBuf *ibuf, float x, float y, bool use_filter, const ColorManagedViewSettings *view_settings, const ColorManagedDisplaySettings *display_settings, float zoom_x, float zoom_y) |
| void | ED_draw_imbuf_ctx_clipping (const bContext *C, ImBuf *ibuf, float x, float y, bool use_filter, float clip_min_x, float clip_min_y, float clip_max_x, float clip_max_y, float zoom_x, float zoom_y) |
| void | ED_draw_imbuf_ctx (const bContext *C, ImBuf *ibuf, float x, float y, bool use_filter, float zoom_x, float zoom_y) |
| int | ED_draw_imbuf_method (const ImBuf *ibuf) |
| void | immDrawBorderCorners (uint pos, const rcti *border, float zoomx, float zoomy) |
| #define DATA | ( | _y, | |
| _x ) (static_cast<const char *>(rect) + stride * (size_t(_y) * img_w + (_x))) |
Referenced by BKE_modifier_blend_write(), and immDrawPixelsTexTiled_scaling_clipping().
| void ED_draw_imbuf | ( | ImBuf * | ibuf, |
| float | x, | ||
| float | y, | ||
| bool | use_filter, | ||
| const ColorManagedViewSettings * | view_settings, | ||
| const ColorManagedDisplaySettings * | display_settings, | ||
| float | zoom_x, | ||
| float | zoom_y ) |
Definition at line 549 of file glutil.cc.
References ED_draw_imbuf_clipping().
Referenced by ed_preview_draw_rect(), and blender::ed::space_node::node_draw_preview().
| void ED_draw_imbuf_clipping | ( | ImBuf * | ibuf, |
| float | x, | ||
| float | y, | ||
| bool | use_filter, | ||
| const ColorManagedViewSettings * | view_settings, | ||
| const ColorManagedDisplaySettings * | display_settings, | ||
| float | clip_min_x, | ||
| float | clip_min_y, | ||
| float | clip_max_x, | ||
| float | clip_max_y, | ||
| float | zoom_x, | ||
| float | zoom_y ) |
Draw given image buffer on a screen using GLSL for display transform.
Definition at line 402 of file glutil.cc.
References BLI_assert_msg, ImBuf::byte_buffer, ImBuf::channels, ImBufByteBuffer::colorspace, ImBufFloatBuffer::colorspace, ImBufByteBuffer::data, ImBufFloatBuffer::data, ImBuf::dither, IMMDrawPixelsTexState::do_shader_unbind, ED_draw_imbuf_method(), ImBuf::float_buffer, GPU_RGB16F, GPU_RGBA16F, GPU_RGBA8, GPU_SHADER_3D_IMAGE_COLOR, IMAGE_DRAW_METHOD_GLSL, IMB_colormanagement_finish_glsl_draw(), IMB_colormanagement_setup_glsl_draw(), IMB_colormanagement_setup_glsl_draw_from_space(), IMB_display_buffer_acquire(), IMB_display_buffer_release(), immDrawPixelsTexSetup(), immDrawPixelsTexSetupAttributes(), immDrawPixelsTexTiled_clipping(), state, ImBuf::x, and ImBuf::y.
Referenced by ED_draw_imbuf(), and ED_draw_imbuf_ctx_clipping().
| void ED_draw_imbuf_ctx | ( | const bContext * | C, |
| ImBuf * | ibuf, | ||
| float | x, | ||
| float | y, | ||
| bool | use_filter, | ||
| float | zoom_x, | ||
| float | zoom_y ) |
Definition at line 603 of file glutil.cc.
References ED_draw_imbuf_ctx_clipping().
Referenced by draw_movieclip_buffer().
| void ED_draw_imbuf_ctx_clipping | ( | const bContext * | C, |
| ImBuf * | ibuf, | ||
| float | x, | ||
| float | y, | ||
| bool | use_filter, | ||
| float | clip_min_x, | ||
| float | clip_min_y, | ||
| float | clip_max_x, | ||
| float | clip_max_y, | ||
| float | zoom_x, | ||
| float | zoom_y ) |
Definition at line 572 of file glutil.cc.
References ED_draw_imbuf_clipping(), and IMB_colormanagement_display_settings_from_ctx().
Referenced by ED_draw_imbuf_ctx().
Definition at line 609 of file glutil.cc.
References ImBuf::channels, ImBufFloatBuffer::data, ImBuf::float_buffer, IMAGE_DRAW_METHOD_2DTEXTURE, IMAGE_DRAW_METHOD_AUTO, IMAGE_DRAW_METHOD_GLSL, ImBuf::x, and ImBuf::y.
Referenced by ED_draw_imbuf_clipping(), image_rect_update(), ocio_transform_ibuf(), and sequencer_OCIO_transform_ibuf().
Don't move to GPU_immediate_util.hh because this uses user-prefs and isn't very low level.
Definition at line 623 of file glutil.cc.
References GPU_PRIM_LINE_STRIP, immBegin(), immEnd(), immVertex2f(), min_ff(), pos, UI_SCALE_FAC, rcti::xmax, rcti::xmin, rcti::ymax, and rcti::ymin.
Referenced by blender::ed::space_node::draw_nodespace_back_pix(), and draw_render_info().
| void immDrawPixelsTexScaledFullSize | ( | const IMMDrawPixelsTexState * | state, |
| float | x, | ||
| float | y, | ||
| int | img_w, | ||
| int | img_h, | ||
| eGPUTextureFormat | gpu_format, | ||
| bool | use_filter, | ||
| const void * | rect, | ||
| float | scaleX, | ||
| float | scaleY, | ||
| float | xzoom, | ||
| float | yzoom, | ||
| const float | color[4] ) |
Unlike the immDrawPixelsTexTiled functions, this doesn't do tiled drawing, but draws into a full texture.
Use the currently bound shader.
Use immDrawPixelsTexSetup to bind the shader you want before calling #immDrawPixelsTex.
If using a special shader double check it uses the same attributes "pos" "texCoord" and uniform "image".
If color is NULL then use white by default
Unless state->do_shader_unbind is explicitly set to false, the shader is unbound when finished.
Definition at line 55 of file glutil.cc.
References ELEM, GPU_DATA_FLOAT, GPU_DATA_UBYTE, GPU_PRIM_TRI_FAN, GPU_R16F, GPU_RGB16F, GPU_RGBA16F, GPU_SAMPLER_EXTEND_MODE_EXTEND, GPU_shader_get_uniform(), GPU_texture_bind(), GPU_texture_create_2d(), GPU_texture_extend_mode(), GPU_texture_filter_mode(), GPU_texture_free(), GPU_texture_mipmap_mode(), GPU_texture_unbind(), GPU_texture_update(), GPU_texture_update_mipmap_chain(), GPU_TEXTURE_USAGE_SHADER_READ, immAttr2f(), immBegin(), immEnd(), immUnbindProgram(), immUniformColor4fv(), immVertex2f(), pos, state, and tex.
Referenced by icon_draw_rect(), and ui_tooltip_region_draw_cb().
| IMMDrawPixelsTexState immDrawPixelsTexSetup | ( | int | builtin | ) |
To be used before calling #immDrawPixelsTex Default shader is #GPU_SHADER_2D_IMAGE_COLOR You can still set uniforms with: GPU_shader_uniform_*(shader, "name", value);
Definition at line 40 of file glutil.cc.
References GPU_shader_get_builtin_shader(), immBindBuiltinProgram(), immDrawPixelsTexSetupAttributes(), immUniform1i(), and state.
Referenced by draw_filled_lasso(), ED_draw_imbuf_clipping(), ED_mask_draw_region(), file_draw_preview(), icon_draw_rect(), ui_draw_but_IMAGE(), ui_draw_but_TRACKPREVIEW(), ui_tooltip_region_draw_cb(), and wm_drag_draw_icon().
|
static |
Definition at line 32 of file glutil.cc.
References GPU_COMP_F32, GPU_FETCH_FLOAT, GPU_vertformat_attr_add(), immVertexFormat(), and state.
Referenced by ED_draw_imbuf_clipping(), and immDrawPixelsTexSetup().
| void immDrawPixelsTexTiled | ( | IMMDrawPixelsTexState * | state, |
| float | x, | ||
| float | y, | ||
| int | img_w, | ||
| int | img_h, | ||
| eGPUTextureFormat | gpu_format, | ||
| bool | use_filter, | ||
| const void * | rect, | ||
| float | xzoom, | ||
| float | yzoom, | ||
| const float | color[4] ) |
#immDrawPixelsTex - Functions like a limited #glDrawPixels, but actually draws the image using textures, which can be tremendously faster on low-end cards, and also avoids problems with the raster position being clipped when off-screen. Pixel unpacking parameters and the #glPixelZoom values are not respected.
rect data is expected to be in RGBA byte or float format, and the model-view and projection matrices are assumed to define a 1-to-1 mapping to screen space. Definition at line 334 of file glutil.cc.
References immDrawPixelsTexTiled_scaling_clipping(), and state.
Referenced by draw_filled_lasso(), ED_mask_draw_region(), ui_draw_but_IMAGE(), and ui_draw_but_TRACKPREVIEW().
| void immDrawPixelsTexTiled_clipping | ( | IMMDrawPixelsTexState * | state, |
| float | x, | ||
| float | y, | ||
| int | img_w, | ||
| int | img_h, | ||
| eGPUTextureFormat | gpu_format, | ||
| bool | use_filter, | ||
| const void * | rect, | ||
| float | clip_min_x, | ||
| float | clip_min_y, | ||
| float | clip_max_x, | ||
| float | clip_max_y, | ||
| float | xzoom, | ||
| float | yzoom, | ||
| const float | color[4] ) |
Definition at line 365 of file glutil.cc.
References immDrawPixelsTexTiled_scaling_clipping(), and state.
Referenced by ED_draw_imbuf_clipping().
| void immDrawPixelsTexTiled_scaling | ( | IMMDrawPixelsTexState * | state, |
| float | x, | ||
| float | y, | ||
| int | img_w, | ||
| int | img_h, | ||
| eGPUTextureFormat | gpu_format, | ||
| bool | use_filter, | ||
| const void * | rect, | ||
| float | scaleX, | ||
| float | scaleY, | ||
| float | xzoom, | ||
| float | yzoom, | ||
| const float | color[4] ) |
Definition at line 301 of file glutil.cc.
References immDrawPixelsTexTiled_scaling_clipping(), and state.
Referenced by file_draw_preview(), and wm_drag_draw_icon().
| void immDrawPixelsTexTiled_scaling_clipping | ( | IMMDrawPixelsTexState * | state, |
| float | x, | ||
| float | y, | ||
| int | img_w, | ||
| int | img_h, | ||
| eGPUTextureFormat | gpu_format, | ||
| bool | use_filter, | ||
| const void * | rect, | ||
| float | scaleX, | ||
| float | scaleY, | ||
| float | clip_min_x, | ||
| float | clip_min_y, | ||
| float | clip_max_x, | ||
| float | clip_max_y, | ||
| float | xzoom, | ||
| float | yzoom, | ||
| const float | color[4] ) |
Use the currently bound shader.
Use immDrawPixelsTexSetup to bind the shader you want before calling #immDrawPixelsTex.
If using a special shader double check it uses the same attributes "pos" "texCoord" and uniform "image".
If color is NULL then use white by default
Unless state->do_shader_unbind is explicitly set to false, the shader is unbound when finished.
Definition at line 126 of file glutil.cc.
References BLI_assert_msg, DATA, ELEM, GPU_backend_get_type(), GPU_BACKEND_METAL, GPU_BACKEND_VULKAN, GPU_DATA_FLOAT, GPU_DATA_UBYTE, GPU_PRIM_TRI_FAN, GPU_R16F, GPU_R8, GPU_RGB16F, GPU_RGBA16F, GPU_RGBA8, GPU_SAMPLER_EXTEND_MODE_EXTEND, GPU_shader_get_uniform(), GPU_texture_bind(), GPU_texture_create_2d(), GPU_texture_extend_mode(), GPU_texture_filter_mode(), GPU_texture_free(), GPU_texture_unbind(), GPU_texture_update_sub(), GPU_TEXTURE_USAGE_SHADER_READ, GPU_unpack_row_length_set(), immAttr2f(), immBegin(), immEnd(), immUnbindProgram(), immUniformColor4fv(), immVertex2f(), pos, state, tex, and UNPACK2.
Referenced by immDrawPixelsTexTiled(), immDrawPixelsTexTiled_clipping(), and immDrawPixelsTexTiled_scaling().