GPU: Remove GL constant from BIF_glutil

This commit is contained in:
Clément Foucault 2020-07-26 19:50:15 +02:00
parent 18cca0e704
commit 025dc31d28
Notes: blender-bot 2023-02-13 21:35:00 +01:00
Referenced by issue #79573, Assert displaying Z-Buffer in image editor
16 changed files with 126 additions and 188 deletions

View File

@ -194,6 +194,8 @@ static GPUTexture *blf_batch_cache_texture_load(void)
int offset_x = bitmap_len_landed % tex_width;
int offset_y = bitmap_len_landed / tex_width;
GPU_texture_bind(gc->texture, 0);
/* TODO(germano): Update more than one row in a single call. */
while (remain) {
int remain_row = tex_width - offset_x;

View File

@ -24,6 +24,8 @@
#ifndef __BIF_GLUTIL_H__
#define __BIF_GLUTIL_H__
#include "GPU_texture.h"
#ifdef __cplusplus
extern "C" {
#endif
@ -66,9 +68,8 @@ void immDrawPixelsTex(IMMDrawPixelsTexState *state,
float y,
int img_w,
int img_h,
int format,
int type,
int zoomfilter,
eGPUTextureFormat gpu_format,
bool use_filter,
void *rect,
float xzoom,
float yzoom,
@ -78,9 +79,8 @@ void immDrawPixelsTex_clipping(IMMDrawPixelsTexState *state,
float y,
int img_w,
int img_h,
int format,
int type,
int zoomfilter,
eGPUTextureFormat gpu_format,
bool use_filter,
void *rect,
float clip_min_x,
float clip_min_y,
@ -94,9 +94,8 @@ void immDrawPixelsTexScaled(IMMDrawPixelsTexState *state,
float y,
int img_w,
int img_h,
int format,
int type,
int zoomfilter,
eGPUTextureFormat gpu_format,
bool use_filter,
void *rect,
float scaleX,
float scaleY,
@ -108,9 +107,8 @@ void immDrawPixelsTexScaled_clipping(IMMDrawPixelsTexState *state,
float y,
int img_w,
int img_h,
int format,
int type,
int zoomfilter,
eGPUTextureFormat gpu_format,
bool use_filter,
void *rect,
float scaleX,
float scaleY,
@ -133,7 +131,7 @@ void immDrawPixelsTexScaled_clipping(IMMDrawPixelsTexState *state,
void ED_draw_imbuf(struct ImBuf *ibuf,
float x,
float y,
int zoomfilter,
bool use_filter,
struct ColorManagedViewSettings *view_settings,
struct ColorManagedDisplaySettings *display_settings,
float zoom_x,
@ -141,7 +139,7 @@ void ED_draw_imbuf(struct ImBuf *ibuf,
void ED_draw_imbuf_clipping(struct ImBuf *ibuf,
float x,
float y,
int zoomfilter,
bool use_filter,
struct ColorManagedViewSettings *view_settings,
struct ColorManagedDisplaySettings *display_settings,
float clip_min_x,
@ -155,14 +153,14 @@ void ED_draw_imbuf_ctx(const struct bContext *C,
struct ImBuf *ibuf,
float x,
float y,
int zoomfilter,
bool use_filter,
float zoom_x,
float zoom_y);
void ED_draw_imbuf_ctx_clipping(const struct bContext *C,
struct ImBuf *ibuf,
float x,
float y,
int zoomfilter,
bool use_filter,
float clip_min_x,
float clip_min_y,
float clip_max_x,

View File

@ -773,9 +773,8 @@ void ui_draw_but_IMAGE(ARegion *UNUSED(region),
(float)rect->ymin,
ibuf->x,
ibuf->y,
GL_RGBA,
GL_UNSIGNED_BYTE,
GL_NEAREST,
GPU_RGBA8,
false,
ibuf->rect,
1.0f,
1.0f,
@ -2545,9 +2544,8 @@ void ui_draw_but_TRACKPREVIEW(ARegion *UNUSED(region),
rect.ymin + 1,
drawibuf->x,
drawibuf->y,
GL_RGBA,
GL_UNSIGNED_BYTE,
GL_LINEAR,
GPU_RGBA8,
true,
drawibuf->rect,
1.0f,
1.0f,

View File

@ -1517,18 +1517,8 @@ static void icon_draw_rect(float x,
immUniform1f("factor", desaturate);
}
immDrawPixelsTex(&state,
draw_x,
draw_y,
draw_w,
draw_h,
GL_RGBA,
GL_UNSIGNED_BYTE,
GL_NEAREST,
rect,
1.0f,
1.0f,
col);
immDrawPixelsTex(
&state, draw_x, draw_y, draw_w, draw_h, GPU_RGBA8, false, rect, 1.0f, 1.0f, col);
if (ima) {
IMB_freeImBuf(ima);

View File

@ -753,8 +753,7 @@ void ED_mask_draw_region(
IMMDrawPixelsTexState state = immDrawPixelsTexSetup(GPU_SHADER_2D_IMAGE_SHUFFLE_COLOR);
GPU_shader_uniform_vector(
state.shader, GPU_shader_get_uniform(state.shader, "shuffle"), 4, 1, red);
immDrawPixelsTex(
&state, 0.0f, 0.0f, width, height, GL_RED, GL_FLOAT, GL_NEAREST, buffer, 1.0f, 1.0f, NULL);
immDrawPixelsTex(&state, 0.0f, 0.0f, width, height, GL_R16F, false, buffer, 1.0f, 1.0f, NULL);
GPU_matrix_pop();

View File

@ -632,18 +632,8 @@ static bool ed_preview_draw_rect(ScrArea *area, int split, int first, rcti *rect
}
IMMDrawPixelsTexState state = immDrawPixelsTexSetup(GPU_SHADER_2D_IMAGE_COLOR);
immDrawPixelsTex(&state,
fx,
fy,
rres.rectx,
rres.recty,
GL_RGBA,
GL_UNSIGNED_BYTE,
GL_NEAREST,
rect_byte,
1.0f,
1.0f,
NULL);
immDrawPixelsTex(
&state, fx, fy, rres.rectx, rres.recty, GPU_RGBA8, false, rect_byte, 1.0f, 1.0f, NULL);
MEM_freeN(rect_byte);

View File

@ -95,9 +95,8 @@ void immDrawPixelsTexScaled_clipping(IMMDrawPixelsTexState *state,
float y,
int img_w,
int img_h,
int format,
int type,
int zoomfilter,
eGPUTextureFormat gpu_format,
bool use_filter,
void *rect,
float scaleX,
float scaleY,
@ -115,21 +114,30 @@ void immDrawPixelsTexScaled_clipping(IMMDrawPixelsTexState *state,
const bool use_clipping = ((clip_min_x < clip_max_x) && (clip_min_y < clip_max_y));
float white[4] = {1.0f, 1.0f, 1.0f, 1.0f};
if (type != GL_FLOAT) {
BLI_assert(type == GL_UNSIGNED_BYTE);
type = GL_UNSIGNED_BYTE;
if (ELEM(gpu_format, GPU_RGBA8, GPU_RGBA16F)) {
components = 4;
}
else if (ELEM(gpu_format, GPU_RGB16F)) {
components = 3;
}
else if (ELEM(gpu_format, GPU_R8, GPU_R16F)) {
components = 1;
}
else {
BLI_assert(!"Incompatible format passed to immDrawPixels");
return;
}
eGPUTextureFormat gpu_format = (type == GL_FLOAT) ? GPU_RGBA16F : GPU_RGBA8;
eGPUDataFormat gpu_data = (type == GL_FLOAT) ? GPU_DATA_FLOAT : GPU_DATA_UNSIGNED_BYTE;
GPUTexture *texture = GPU_texture_create_nD(
tex_w, tex_h, 0, 2, NULL, gpu_format, gpu_data, 0, false, NULL);
const bool use_float_data = ELEM(gpu_format, GPU_RGBA16F, GPU_RGB16F, GPU_R16F);
eGPUDataFormat gpu_data = (use_float_data) ? GPU_DATA_FLOAT : GPU_DATA_UNSIGNED_BYTE;
size_t stride = components * ((use_float_data) ? sizeof(float) : sizeof(uchar));
/* TODO replace GL_NEAREST/LINEAR in callers. */
GPU_texture_filter_mode(texture, (zoomfilter == GL_LINEAR));
GPU_texture_wrap_mode(texture, false, true);
GPUTexture *tex = GPU_texture_create_2d(tex_w, tex_h, gpu_format, NULL, NULL);
GPU_texture_bind(texture, 0);
GPU_texture_filter_mode(tex, use_filter);
GPU_texture_wrap_mode(tex, false, true);
GPU_texture_bind(tex, 0);
/* setup seamless 2=on, 0=off */
seamless = ((tex_w < img_w || tex_h < img_h) && tex_w > 2 && tex_h > 2) ? 2 : 0;
@ -140,20 +148,6 @@ void immDrawPixelsTexScaled_clipping(IMMDrawPixelsTexState *state,
nsubparts_x = (img_w + (offset_x - 1)) / (offset_x);
nsubparts_y = (img_h + (offset_y - 1)) / (offset_y);
if (format == GL_RGBA) {
components = 4;
}
else if (format == GL_RGB) {
components = 3;
}
else if (format == GL_RED) {
components = 1;
}
else {
BLI_assert(!"Incompatible format passed to glaDrawPixelsTexScaled");
return;
}
/* optional */
/* NOTE: Shader could be null for GLSL OCIO drawing, it is fine, since
* it does not need color.
@ -199,26 +193,32 @@ void immDrawPixelsTexScaled_clipping(IMMDrawPixelsTexState *state,
{
int src_y = subpart_y * offset_y;
int src_x = subpart_x * offset_x;
size_t stride = components * ((type == GL_FLOAT) ? sizeof(float) : sizeof(uchar));
#define DATA(_y, _x) ((char *)rect + stride * ((size_t)(_y)*img_w + (_x)))
{
void *data = DATA(src_y, src_x);
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, subpart_w, subpart_h, format, type, data);
GPU_texture_update_sub(tex, gpu_data, data, 0, 0, 0, subpart_w, subpart_h, 0);
}
/* Add an extra border of pixels so linear interpolation looks ok
* at edges of full image. */
if (subpart_w < tex_w) {
void *data = DATA(src_y, src_x + subpart_w - 1);
glTexSubImage2D(GL_TEXTURE_2D, 0, subpart_w, 0, 1, subpart_h, format, type, data);
int offset[2] = {subpart_w, 0};
int extent[2] = {1, subpart_h};
GPU_texture_update_sub(tex, gpu_data, data, UNPACK2(offset), 0, UNPACK2(extent), 0);
}
if (subpart_h < tex_h) {
void *data = DATA(src_y + subpart_h - 1, src_x);
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, subpart_h, subpart_w, 1, format, type, data);
int offset[2] = {0, subpart_h};
int extent[2] = {subpart_w, 1};
GPU_texture_update_sub(tex, gpu_data, data, UNPACK2(offset), 0, UNPACK2(extent), 0);
}
if (subpart_w < tex_w && subpart_h < tex_h) {
void *data = DATA(src_y + subpart_h - 1, src_x + subpart_w - 1);
glTexSubImage2D(GL_TEXTURE_2D, 0, subpart_w, subpart_h, 1, 1, format, type, data);
int offset[2] = {subpart_w, subpart_h};
int extent[2] = {1, 1};
GPU_texture_update_sub(tex, gpu_data, data, UNPACK2(offset), 0, UNPACK2(extent), 0);
}
#undef DATA
}
@ -253,8 +253,8 @@ void immDrawPixelsTexScaled_clipping(IMMDrawPixelsTexState *state,
immUnbindProgram();
}
GPU_texture_unbind(texture);
GPU_texture_free(texture);
GPU_texture_unbind(tex);
GPU_texture_free(tex);
/* Restore default. */
GPU_unpack_row_length_set(0);
@ -265,9 +265,8 @@ void immDrawPixelsTexScaled(IMMDrawPixelsTexState *state,
float y,
int img_w,
int img_h,
int format,
int type,
int zoomfilter,
eGPUTextureFormat gpu_format,
bool use_filter,
void *rect,
float scaleX,
float scaleY,
@ -280,9 +279,8 @@ void immDrawPixelsTexScaled(IMMDrawPixelsTexState *state,
y,
img_w,
img_h,
format,
type,
zoomfilter,
gpu_format,
use_filter,
rect,
scaleX,
scaleY,
@ -300,9 +298,8 @@ void immDrawPixelsTex(IMMDrawPixelsTexState *state,
float y,
int img_w,
int img_h,
int format,
int type,
int zoomfilter,
eGPUTextureFormat gpu_format,
bool use_filter,
void *rect,
float xzoom,
float yzoom,
@ -313,9 +310,8 @@ void immDrawPixelsTex(IMMDrawPixelsTexState *state,
y,
img_w,
img_h,
format,
type,
zoomfilter,
gpu_format,
use_filter,
rect,
1.0f,
1.0f,
@ -333,9 +329,8 @@ void immDrawPixelsTex_clipping(IMMDrawPixelsTexState *state,
float y,
int img_w,
int img_h,
int format,
int type,
int zoomfilter,
eGPUTextureFormat gpu_format,
bool use_filter,
void *rect,
float clip_min_x,
float clip_min_y,
@ -350,9 +345,8 @@ void immDrawPixelsTex_clipping(IMMDrawPixelsTexState *state,
y,
img_w,
img_h,
format,
type,
zoomfilter,
gpu_format,
use_filter,
rect,
1.0f,
1.0f,
@ -371,7 +365,7 @@ void immDrawPixelsTex_clipping(IMMDrawPixelsTexState *state,
void ED_draw_imbuf_clipping(ImBuf *ibuf,
float x,
float y,
int zoomfilter,
bool use_filter,
ColorManagedViewSettings *view_settings,
ColorManagedDisplaySettings *display_settings,
float clip_min_x,
@ -421,13 +415,13 @@ void ED_draw_imbuf_clipping(ImBuf *ibuf,
if (ok) {
if (ibuf->rect_float) {
int format = 0;
eGPUTextureFormat format = 0;
if (ibuf->channels == 3) {
format = GL_RGB;
format = GPU_RGB16F;
}
else if (ibuf->channels == 4) {
format = GL_RGBA;
format = GPU_RGBA16F;
}
else {
BLI_assert(!"Incompatible number of channels for GLSL display");
@ -440,8 +434,7 @@ void ED_draw_imbuf_clipping(ImBuf *ibuf,
ibuf->x,
ibuf->y,
format,
GL_FLOAT,
zoomfilter,
use_filter,
ibuf->rect_float,
clip_min_x,
clip_min_y,
@ -459,9 +452,8 @@ void ED_draw_imbuf_clipping(ImBuf *ibuf,
y,
ibuf->x,
ibuf->y,
GL_RGBA,
GL_UNSIGNED_BYTE,
zoomfilter,
GPU_RGBA8,
use_filter,
ibuf->rect,
clip_min_x,
clip_min_y,
@ -493,9 +485,8 @@ void ED_draw_imbuf_clipping(ImBuf *ibuf,
y,
ibuf->x,
ibuf->y,
GL_RGBA,
GL_UNSIGNED_BYTE,
zoomfilter,
GPU_RGBA8,
use_filter,
display_buffer,
clip_min_x,
clip_min_y,
@ -513,7 +504,7 @@ void ED_draw_imbuf_clipping(ImBuf *ibuf,
void ED_draw_imbuf(ImBuf *ibuf,
float x,
float y,
int zoomfilter,
bool use_filter,
ColorManagedViewSettings *view_settings,
ColorManagedDisplaySettings *display_settings,
float zoom_x,
@ -522,7 +513,7 @@ void ED_draw_imbuf(ImBuf *ibuf,
ED_draw_imbuf_clipping(ibuf,
x,
y,
zoomfilter,
use_filter,
view_settings,
display_settings,
0.0f,
@ -537,7 +528,7 @@ void ED_draw_imbuf_ctx_clipping(const bContext *C,
ImBuf *ibuf,
float x,
float y,
int zoomfilter,
bool use_filter,
float clip_min_x,
float clip_min_y,
float clip_max_x,
@ -553,7 +544,7 @@ void ED_draw_imbuf_ctx_clipping(const bContext *C,
ED_draw_imbuf_clipping(ibuf,
x,
y,
zoomfilter,
use_filter,
view_settings,
display_settings,
clip_min_x,
@ -565,9 +556,9 @@ void ED_draw_imbuf_ctx_clipping(const bContext *C,
}
void ED_draw_imbuf_ctx(
const bContext *C, ImBuf *ibuf, float x, float y, int zoomfilter, float zoom_x, float zoom_y)
const bContext *C, ImBuf *ibuf, float x, float y, bool use_filter, float zoom_x, float zoom_y)
{
ED_draw_imbuf_ctx_clipping(C, ibuf, x, y, zoomfilter, 0.0f, 0.0f, 0.0f, 0.0f, zoom_x, zoom_y);
ED_draw_imbuf_ctx_clipping(C, ibuf, x, y, use_filter, 0.0f, 0.0f, 0.0f, 0.0f, zoom_x, zoom_y);
}
int ED_draw_imbuf_method(ImBuf *ibuf)

View File

@ -322,7 +322,7 @@ static void draw_movieclip_buffer(const bContext *C,
float zoomy)
{
MovieClip *clip = ED_space_clip_get_clip(sc);
int filter = GL_LINEAR;
bool use_filter = true;
int x, y;
/* find window pixel coordinates of origin */
@ -340,10 +340,10 @@ static void draw_movieclip_buffer(const bContext *C,
/* non-scaled proxy shouldn't use filtering */
if ((clip->flag & MCLIP_USE_PROXY) == 0 ||
ELEM(sc->user.render_size, MCLIP_PROXY_RENDER_SIZE_FULL, MCLIP_PROXY_RENDER_SIZE_100)) {
filter = GL_NEAREST;
use_filter = false;
}
ED_draw_imbuf_ctx(C, ibuf, x, y, filter, zoomx * width / ibuf->x, zoomy * height / ibuf->y);
ED_draw_imbuf_ctx(C, ibuf, x, y, use_filter, zoomx * width / ibuf->x, zoomy * height / ibuf->y);
if (ibuf->planes == 32) {
GPU_blend(false);

View File

@ -300,9 +300,8 @@ static void file_draw_preview(uiBlock *block,
(float)yco,
imb->x,
imb->y,
GL_RGBA,
GL_UNSIGNED_BYTE,
GL_NEAREST,
GPU_RGBA8,
false,
imb->rect,
scale,
scale,

View File

@ -468,20 +468,19 @@ static void sima_draw_zbuf_pixels(
float red[4] = {1.0f, 0.0f, 0.0f, 0.0f};
/* Slowwww */
int *recti = MEM_mallocN(rectx * recty * sizeof(int), "temp");
float *rectf = MEM_mallocN(rectx * recty * sizeof(float), "temp");
for (int a = rectx * recty - 1; a >= 0; a--) {
/* zbuffer values are signed, so we need to shift color range */
recti[a] = rect[a] * 0.5f + 0.5f;
rectf[a] = rect[a] * 0.5f + 0.5f;
}
IMMDrawPixelsTexState state = immDrawPixelsTexSetup(GPU_SHADER_2D_IMAGE_SHUFFLE_COLOR);
GPU_shader_uniform_vector(
state.shader, GPU_shader_get_uniform(state.shader, "shuffle"), 4, 1, red);
immDrawPixelsTex(
&state, x1, y1, rectx, recty, GL_RED, GL_INT, GL_NEAREST, recti, zoomx, zoomy, NULL);
immDrawPixelsTex(&state, x1, y1, rectx, recty, GPU_R16F, false, rectf, zoomx, zoomy, NULL);
MEM_freeN(recti);
MEM_freeN(rectf);
}
static void sima_draw_zbuffloat_pixels(Scene *scene,
@ -526,8 +525,7 @@ static void sima_draw_zbuffloat_pixels(Scene *scene,
GPU_shader_uniform_vector(
state.shader, GPU_shader_get_uniform(state.shader, "shuffle"), 4, 1, red);
immDrawPixelsTex(
&state, x1, y1, rectx, recty, GL_RED, GL_FLOAT, GL_NEAREST, rectf, zoomx, zoomy, NULL);
immDrawPixelsTex(&state, x1, y1, rectx, recty, GL_R16F, false, rectf, zoomx, zoomy, NULL);
MEM_freeN(rectf);
}
@ -612,8 +610,7 @@ static void draw_image_buffer(const bContext *C,
/* If RGBA display with color management */
if ((sima_flag & (SI_SHOW_R | SI_SHOW_G | SI_SHOW_B | SI_SHOW_ALPHA)) == 0) {
ED_draw_imbuf_ctx_clipping(
C, ibuf, x, y, GL_NEAREST, 0, 0, clip_max_x, clip_max_y, zoomx, zoomy);
ED_draw_imbuf_ctx_clipping(C, ibuf, x, y, false, 0, 0, clip_max_x, clip_max_y, zoomx, zoomy);
}
else {
float shuffle[4] = {0.0f, 0.0f, 0.0f, 0.0f};
@ -649,9 +646,8 @@ static void draw_image_buffer(const bContext *C,
y,
ibuf->x,
ibuf->y,
GL_RGBA,
GL_UNSIGNED_BYTE,
GL_NEAREST,
GPU_RGBA8,
false,
display_buffer,
0,
0,
@ -780,18 +776,8 @@ static void draw_image_paint_helpers(
GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
IMMDrawPixelsTexState state = immDrawPixelsTexSetup(GPU_SHADER_2D_IMAGE_COLOR);
immDrawPixelsTex(&state,
x,
y,
ibuf->x,
ibuf->y,
GL_RGBA,
GL_UNSIGNED_BYTE,
GL_NEAREST,
display_buffer,
zoomx,
zoomy,
col);
immDrawPixelsTex(
&state, x, y, ibuf->x, ibuf->y, GPU_RGBA8, false, display_buffer, zoomx, zoomy, col);
GPU_blend(false);

View File

@ -3676,9 +3676,8 @@ void draw_nodespace_back_pix(const bContext *C,
y,
ibuf->x,
ibuf->y,
GL_RGBA,
GL_UNSIGNED_BYTE,
GL_NEAREST,
GPU_RGBA8,
false,
display_buffer,
snode->zoom,
snode->zoom,
@ -3691,12 +3690,12 @@ void draw_nodespace_back_pix(const bContext *C,
GPU_blend_set_func_separate(
GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
ED_draw_imbuf_ctx(C, ibuf, x, y, GL_NEAREST, snode->zoom, snode->zoom);
ED_draw_imbuf_ctx(C, ibuf, x, y, false, snode->zoom, snode->zoom);
GPU_blend(false);
}
else {
ED_draw_imbuf_ctx(C, ibuf, x, y, GL_NEAREST, snode->zoom, snode->zoom);
ED_draw_imbuf_ctx(C, ibuf, x, y, false, snode->zoom, snode->zoom);
}
if (cache_handle) {

View File

@ -947,9 +947,8 @@ static void node_draw_preview(bNodePreview *preview, rctf *prv)
draw_rect.ymin,
preview->xsize,
preview->ysize,
GL_RGBA,
GL_UNSIGNED_BYTE,
GL_LINEAR,
GPU_RGBA8,
true,
preview->rect,
scale,
scale,

View File

@ -45,6 +45,16 @@
#include "gpu_context_private.h"
#define WARN_NOT_BOUND(_tex) \
{ \
if (_tex->number == -1) { \
fprintf(stderr, "Warning : Trying to set parameter on a texture not bound.\n"); \
BLI_assert(0); \
return; \
} \
} \
((void)0)
static struct GPUTextureGlobal {
/** Texture used in place of invalid textures (not loaded correctly, missing). */
GPUTexture *invalid_tex_1D;
@ -1468,7 +1478,8 @@ void GPU_texture_update_sub(GPUTexture *tex,
GLenum data_format = gpu_get_gl_dataformat(tex->format, &tex->format_flag);
GLenum data_type = gpu_get_gl_datatype(gpu_data_format);
glBindTexture(tex->target, tex->bindcode);
WARN_NOT_BOUND(tex);
switch (tex->target) {
case GL_TEXTURE_1D:
glTexSubImage1D(tex->target, 0, offset_x, width, data_format, data_type, pixels);
@ -1496,8 +1507,6 @@ void GPU_texture_update_sub(GPUTexture *tex,
default:
BLI_assert(!"tex->target mode not supported");
}
glBindTexture(tex->target, 0);
}
void *GPU_texture_read(GPUTexture *tex, eGPUDataFormat gpu_data_format, int miplvl)
@ -1791,16 +1800,6 @@ void GPU_texture_unbind_all(void)
glActiveTexture(GL_TEXTURE0);
}
#define WARN_NOT_BOUND(_tex) \
{ \
if (_tex->number == -1) { \
fprintf(stderr, "Warning : Trying to set parameter on a texture not bound.\n"); \
BLI_assert(0); \
return; \
} \
} \
((void)0)
void GPU_texture_generate_mipmap(GPUTexture *tex)
{
WARN_NOT_BOUND(tex);

View File

@ -424,9 +424,8 @@ void wm_drags_draw(bContext *C, wmWindow *win, rcti *rect)
y,
drag->imb->x,
drag->imb->y,
GL_RGBA,
GL_UNSIGNED_BYTE,
GL_NEAREST,
GPU_RGBA8,
false,
drag->imb->rect,
drag->scale,
drag->scale,

View File

@ -362,18 +362,8 @@ static void draw_filled_lasso(wmGesture *gt)
GPU_shader_uniform_vector(
state.shader, GPU_shader_get_uniform(state.shader, "shuffle"), 4, 1, red);
immDrawPixelsTex(&state,
rect.xmin,
rect.ymin,
w,
h,
GL_RED,
GL_UNSIGNED_BYTE,
GL_NEAREST,
pixel_buf,
1.0f,
1.0f,
NULL);
immDrawPixelsTex(
&state, rect.xmin, rect.ymin, w, h, GL_R8, false, pixel_buf, 1.0f, 1.0f, NULL);
GPU_shader_unbind();

View File

@ -335,9 +335,8 @@ static void playanim_toscreen(
offs_y + (ps->draw_flip[1] ? span_y : 0.0f),
ibuf->x,
ibuf->y,
GL_RGBA,
GL_UNSIGNED_BYTE,
GL_NEAREST,
GPU_RGBA8,
false,
ibuf->rect,
((ps->draw_flip[0] ? -1.0f : 1.0f)) * (ps->zoom / (float)ps->win_x),
((ps->draw_flip[1] ? -1.0f : 1.0f)) * (ps->zoom / (float)ps->win_y),