Cleanup: Abbreviate enums with 'UNSIGNED_' in the name
This commit is contained in:
parent
4430e8a008
commit
89c79c3ed8
|
@ -192,7 +192,7 @@ static GPUTexture *blf_batch_cache_texture_load(void)
|
|||
int remain_row = tex_width - offset_x;
|
||||
int width = remain > remain_row ? remain_row : remain;
|
||||
GPU_texture_update_sub(gc->texture,
|
||||
GPU_DATA_UNSIGNED_BYTE,
|
||||
GPU_DATA_UBYTE,
|
||||
&gc->bitmap_result[bitmap_len_landed],
|
||||
offset_x,
|
||||
offset_y,
|
||||
|
|
|
@ -647,7 +647,7 @@ static void gpu_texture_update_scaled(GPUTexture *tex,
|
|||
}
|
||||
|
||||
void *data = (ibuf->rect_float) ? (void *)(ibuf->rect_float) : (void *)(ibuf->rect);
|
||||
eGPUDataFormat data_format = (ibuf->rect_float) ? GPU_DATA_FLOAT : GPU_DATA_UNSIGNED_BYTE;
|
||||
eGPUDataFormat data_format = (ibuf->rect_float) ? GPU_DATA_FLOAT : GPU_DATA_UBYTE;
|
||||
|
||||
GPU_texture_update_sub(tex, data_format, data, x, y, layer, w, h, 1);
|
||||
|
||||
|
@ -673,7 +673,7 @@ static void gpu_texture_update_unscaled(GPUTexture *tex,
|
|||
}
|
||||
|
||||
void *data = (rect_float) ? (void *)(rect_float + tex_offset) : (void *)(rect + tex_offset);
|
||||
eGPUDataFormat data_format = (rect_float) ? GPU_DATA_FLOAT : GPU_DATA_UNSIGNED_BYTE;
|
||||
eGPUDataFormat data_format = (rect_float) ? GPU_DATA_FLOAT : GPU_DATA_UBYTE;
|
||||
|
||||
/* Partial update without scaling. Stride and offset are used to copy only a
|
||||
* subset of a possible larger buffer than what we are updating. */
|
||||
|
|
|
@ -403,7 +403,7 @@ static bool eevee_lightcache_static_load(LightCache *lcache)
|
|||
if (lcache->grid_tx.tex == NULL) {
|
||||
lcache->grid_tx.tex = GPU_texture_create_2d_array(
|
||||
"lightcache_irradiance", UNPACK3(lcache->grid_tx.tex_size), 1, IRRADIANCE_FORMAT, NULL);
|
||||
GPU_texture_update(lcache->grid_tx.tex, GPU_DATA_UNSIGNED_BYTE, lcache->grid_tx.data);
|
||||
GPU_texture_update(lcache->grid_tx.tex, GPU_DATA_UBYTE, lcache->grid_tx.data);
|
||||
|
||||
if (lcache->grid_tx.tex == NULL) {
|
||||
lcache->flag |= LIGHTCACHE_NOT_USABLE;
|
||||
|
@ -470,7 +470,7 @@ bool EEVEE_lightcache_load(LightCache *lcache)
|
|||
static void eevee_lightbake_readback_irradiance(LightCache *lcache)
|
||||
{
|
||||
MEM_SAFE_FREE(lcache->grid_tx.data);
|
||||
lcache->grid_tx.data = GPU_texture_read(lcache->grid_tx.tex, GPU_DATA_UNSIGNED_BYTE, 0);
|
||||
lcache->grid_tx.data = GPU_texture_read(lcache->grid_tx.tex, GPU_DATA_UBYTE, 0);
|
||||
lcache->grid_tx.data_type = LIGHTCACHETEX_BYTE;
|
||||
lcache->grid_tx.components = 4;
|
||||
}
|
||||
|
|
|
@ -58,11 +58,11 @@ void GPENCIL_antialiasing_init(struct GPENCIL_Data *vedata)
|
|||
if (txl->smaa_search_tx == NULL) {
|
||||
txl->smaa_search_tx = GPU_texture_create_2d(
|
||||
"smaa_search", SEARCHTEX_WIDTH, SEARCHTEX_HEIGHT, 1, GPU_R8, NULL);
|
||||
GPU_texture_update(txl->smaa_search_tx, GPU_DATA_UNSIGNED_BYTE, searchTexBytes);
|
||||
GPU_texture_update(txl->smaa_search_tx, GPU_DATA_UBYTE, searchTexBytes);
|
||||
|
||||
txl->smaa_area_tx = GPU_texture_create_2d(
|
||||
"smaa_area", AREATEX_WIDTH, AREATEX_HEIGHT, 1, GPU_RG8, NULL);
|
||||
GPU_texture_update(txl->smaa_area_tx, GPU_DATA_UNSIGNED_BYTE, areaTexBytes);
|
||||
GPU_texture_update(txl->smaa_area_tx, GPU_DATA_UBYTE, areaTexBytes);
|
||||
|
||||
GPU_texture_filter_mode(txl->smaa_search_tx, true);
|
||||
GPU_texture_filter_mode(txl->smaa_area_tx, true);
|
||||
|
|
|
@ -244,11 +244,11 @@ void workbench_antialiasing_engine_init(WORKBENCH_Data *vedata)
|
|||
if (txl->smaa_search_tx == NULL) {
|
||||
txl->smaa_search_tx = GPU_texture_create_2d(
|
||||
"smaa_search", SEARCHTEX_WIDTH, SEARCHTEX_HEIGHT, 1, GPU_R8, NULL);
|
||||
GPU_texture_update(txl->smaa_search_tx, GPU_DATA_UNSIGNED_BYTE, searchTexBytes);
|
||||
GPU_texture_update(txl->smaa_search_tx, GPU_DATA_UBYTE, searchTexBytes);
|
||||
|
||||
txl->smaa_area_tx = GPU_texture_create_2d(
|
||||
"smaa_area", AREATEX_WIDTH, AREATEX_HEIGHT, 1, GPU_RG8, NULL);
|
||||
GPU_texture_update(txl->smaa_area_tx, GPU_DATA_UNSIGNED_BYTE, areaTexBytes);
|
||||
GPU_texture_update(txl->smaa_area_tx, GPU_DATA_UBYTE, areaTexBytes);
|
||||
|
||||
GPU_texture_filter_mode(txl->smaa_search_tx, true);
|
||||
GPU_texture_filter_mode(txl->smaa_area_tx, true);
|
||||
|
|
|
@ -91,7 +91,7 @@ uint *DRW_select_buffer_read(struct Depsgraph *depsgraph,
|
|||
BLI_rcti_size_y(&rect_clamp),
|
||||
1,
|
||||
0,
|
||||
GPU_DATA_UNSIGNED_INT,
|
||||
GPU_DATA_UINT,
|
||||
r_buf);
|
||||
|
||||
if (!BLI_rcti_compare(rect, &rect_clamp)) {
|
||||
|
|
|
@ -723,7 +723,7 @@ static bool gpencil_render_offscreen(tGPDfill *tgpf)
|
|||
GPU_offscreen_read_pixels(offscreen, GPU_DATA_FLOAT, ibuf->rect_float);
|
||||
}
|
||||
else if (ibuf->rect) {
|
||||
GPU_offscreen_read_pixels(offscreen, GPU_DATA_UNSIGNED_BYTE, ibuf->rect);
|
||||
GPU_offscreen_read_pixels(offscreen, GPU_DATA_UBYTE, ibuf->rect);
|
||||
}
|
||||
if (ibuf->rect_float && ibuf->rect) {
|
||||
IMB_rect_from_float(ibuf);
|
||||
|
|
|
@ -889,15 +889,15 @@ void UI_icons_reload_internal_textures(void)
|
|||
icongltex.invh = 1.0f / b32buf->y;
|
||||
|
||||
icongltex.tex[0] = GPU_texture_create_2d("icons", b32buf->x, b32buf->y, 2, GPU_RGBA8, NULL);
|
||||
GPU_texture_update_mipmap(icongltex.tex[0], 0, GPU_DATA_UNSIGNED_BYTE, b32buf->rect);
|
||||
GPU_texture_update_mipmap(icongltex.tex[0], 1, GPU_DATA_UNSIGNED_BYTE, b16buf->rect);
|
||||
GPU_texture_update_mipmap(icongltex.tex[0], 0, GPU_DATA_UBYTE, b32buf->rect);
|
||||
GPU_texture_update_mipmap(icongltex.tex[0], 1, GPU_DATA_UBYTE, b16buf->rect);
|
||||
}
|
||||
|
||||
if (need_icons_with_border && icongltex.tex[1] == NULL) {
|
||||
icongltex.tex[1] = GPU_texture_create_2d(
|
||||
"icons_border", b32buf_border->x, b32buf_border->y, 2, GPU_RGBA8, NULL);
|
||||
GPU_texture_update_mipmap(icongltex.tex[1], 0, GPU_DATA_UNSIGNED_BYTE, b32buf_border->rect);
|
||||
GPU_texture_update_mipmap(icongltex.tex[1], 1, GPU_DATA_UNSIGNED_BYTE, b16buf_border->rect);
|
||||
GPU_texture_update_mipmap(icongltex.tex[1], 0, GPU_DATA_UBYTE, b32buf_border->rect);
|
||||
GPU_texture_update_mipmap(icongltex.tex[1], 1, GPU_DATA_UBYTE, b16buf_border->rect);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -351,7 +351,7 @@ static void screen_opengl_render_doit(const bContext *C, OGLRender *oglrender, R
|
|||
G.f &= ~G_FLAG_RENDER_VIEWPORT;
|
||||
|
||||
gp_rect = MEM_mallocN(sizeof(uchar[4]) * sizex * sizey, "offscreen rect");
|
||||
GPU_offscreen_read_pixels(oglrender->ofs, GPU_DATA_UNSIGNED_BYTE, gp_rect);
|
||||
GPU_offscreen_read_pixels(oglrender->ofs, GPU_DATA_UBYTE, gp_rect);
|
||||
|
||||
for (i = 0; i < sizex * sizey * 4; i += 4) {
|
||||
blend_color_mix_byte(&render_rect[i], &render_rect[i], &gp_rect[i]);
|
||||
|
|
|
@ -131,7 +131,7 @@ void immDrawPixelsTexScaled_clipping(IMMDrawPixelsTexState *state,
|
|||
}
|
||||
|
||||
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;
|
||||
eGPUDataFormat gpu_data = (use_float_data) ? GPU_DATA_FLOAT : GPU_DATA_UBYTE;
|
||||
size_t stride = components * ((use_float_data) ? sizeof(float) : sizeof(uchar));
|
||||
|
||||
GPUTexture *tex = GPU_texture_create_2d("immDrawPixels", tex_w, tex_h, 1, gpu_format, NULL);
|
||||
|
|
|
@ -610,7 +610,7 @@ void ED_screen_preview_render(const bScreen *screen, int size_x, int size_y, uin
|
|||
|
||||
screen_preview_draw(screen, size_x, size_y);
|
||||
|
||||
GPU_offscreen_read_pixels(offscreen, GPU_DATA_UNSIGNED_BYTE, r_rect);
|
||||
GPU_offscreen_read_pixels(offscreen, GPU_DATA_UBYTE, r_rect);
|
||||
GPU_offscreen_unbind(offscreen, true);
|
||||
|
||||
GPU_offscreen_free(offscreen);
|
||||
|
|
|
@ -350,7 +350,7 @@ static int load_tex(Brush *br, ViewContext *vc, float zoom, bool col, bool prima
|
|||
eGPUTextureFormat format = col ? GPU_RGBA8 : GPU_R8;
|
||||
target->overlay_texture = GPU_texture_create_2d(
|
||||
"paint_cursor_overlay", size, size, 1, format, NULL);
|
||||
GPU_texture_update(target->overlay_texture, GPU_DATA_UNSIGNED_BYTE, buffer);
|
||||
GPU_texture_update(target->overlay_texture, GPU_DATA_UBYTE, buffer);
|
||||
|
||||
if (!col) {
|
||||
GPU_texture_swizzle_set(target->overlay_texture, "rrrr");
|
||||
|
@ -358,7 +358,7 @@ static int load_tex(Brush *br, ViewContext *vc, float zoom, bool col, bool prima
|
|||
}
|
||||
|
||||
if (init) {
|
||||
GPU_texture_update(target->overlay_texture, GPU_DATA_UNSIGNED_BYTE, buffer);
|
||||
GPU_texture_update(target->overlay_texture, GPU_DATA_UBYTE, buffer);
|
||||
}
|
||||
|
||||
if (buffer) {
|
||||
|
@ -469,13 +469,13 @@ static int load_tex_cursor(Brush *br, ViewContext *vc, float zoom)
|
|||
if (!cursor_snap.overlay_texture) {
|
||||
cursor_snap.overlay_texture = GPU_texture_create_2d(
|
||||
"cursor_snap_overaly", size, size, 1, GPU_R8, NULL);
|
||||
GPU_texture_update(cursor_snap.overlay_texture, GPU_DATA_UNSIGNED_BYTE, buffer);
|
||||
GPU_texture_update(cursor_snap.overlay_texture, GPU_DATA_UBYTE, buffer);
|
||||
|
||||
GPU_texture_swizzle_set(cursor_snap.overlay_texture, "rrrr");
|
||||
}
|
||||
|
||||
if (init) {
|
||||
GPU_texture_update(cursor_snap.overlay_texture, GPU_DATA_UNSIGNED_BYTE, buffer);
|
||||
GPU_texture_update(cursor_snap.overlay_texture, GPU_DATA_UBYTE, buffer);
|
||||
}
|
||||
|
||||
if (buffer) {
|
||||
|
|
|
@ -1207,7 +1207,7 @@ static void draw_plane_marker_image(Scene *scene,
|
|||
|
||||
GPUTexture *texture = GPU_texture_create_2d(
|
||||
"plane_marker_image", ibuf->x, ibuf->y, 1, GPU_RGBA8, NULL);
|
||||
GPU_texture_update(texture, GPU_DATA_UNSIGNED_BYTE, display_buffer);
|
||||
GPU_texture_update(texture, GPU_DATA_UBYTE, display_buffer);
|
||||
GPU_texture_filter_mode(texture, false);
|
||||
|
||||
GPU_matrix_push();
|
||||
|
|
|
@ -1533,7 +1533,7 @@ static void *sequencer_OCIO_transform_ibuf(const bContext *C,
|
|||
|
||||
/* Default */
|
||||
*r_format = GPU_RGBA8;
|
||||
*r_data = GPU_DATA_UNSIGNED_BYTE;
|
||||
*r_data = GPU_DATA_UBYTE;
|
||||
|
||||
/* Fallback to CPU based color space conversion. */
|
||||
if (force_fallback) {
|
||||
|
@ -1580,7 +1580,7 @@ static void *sequencer_OCIO_transform_ibuf(const bContext *C,
|
|||
if ((ibuf->rect || ibuf->rect_float) && !*r_glsl_used) {
|
||||
display_buffer = IMB_display_buffer_acquire_ctx(C, ibuf, &cache_handle);
|
||||
*r_format = GPU_RGBA8;
|
||||
*r_data = GPU_DATA_UNSIGNED_BYTE;
|
||||
*r_data = GPU_DATA_UBYTE;
|
||||
}
|
||||
if (cache_handle) {
|
||||
IMB_display_buffer_release(cache_handle);
|
||||
|
@ -1682,7 +1682,7 @@ static void sequencer_draw_display_buffer(const bContext *C,
|
|||
|
||||
display_buffer = (uchar *)ibuf->rect;
|
||||
format = GPU_RGBA8;
|
||||
data = GPU_DATA_UNSIGNED_BYTE;
|
||||
data = GPU_DATA_UBYTE;
|
||||
}
|
||||
else {
|
||||
display_buffer = sequencer_OCIO_transform_ibuf(C, ibuf, &glsl_used, &format, &data);
|
||||
|
|
|
@ -2002,7 +2002,7 @@ ImBuf *ED_view3d_draw_offscreen_imbuf(Depsgraph *depsgraph,
|
|||
GPU_offscreen_read_pixels(ofs, GPU_DATA_FLOAT, ibuf->rect_float);
|
||||
}
|
||||
else if (ibuf->rect) {
|
||||
GPU_offscreen_read_pixels(ofs, GPU_DATA_UNSIGNED_BYTE, ibuf->rect);
|
||||
GPU_offscreen_read_pixels(ofs, GPU_DATA_UBYTE, ibuf->rect);
|
||||
}
|
||||
|
||||
/* unbind */
|
||||
|
|
|
@ -171,9 +171,9 @@ typedef enum eGPUTextureFormat {
|
|||
typedef enum eGPUDataFormat {
|
||||
GPU_DATA_FLOAT,
|
||||
GPU_DATA_INT,
|
||||
GPU_DATA_UNSIGNED_INT,
|
||||
GPU_DATA_UNSIGNED_BYTE,
|
||||
GPU_DATA_UNSIGNED_INT_24_8,
|
||||
GPU_DATA_UINT,
|
||||
GPU_DATA_UBYTE,
|
||||
GPU_DATA_UINT_24_8,
|
||||
GPU_DATA_10_11_11_REV,
|
||||
} eGPUDataFormat;
|
||||
|
||||
|
|
|
@ -656,7 +656,7 @@ void GPU_offscreen_draw_to_screen(GPUOffScreen *ofs, int x, int y)
|
|||
|
||||
void GPU_offscreen_read_pixels(GPUOffScreen *ofs, eGPUDataFormat format, void *pixels)
|
||||
{
|
||||
BLI_assert(ELEM(format, GPU_DATA_UNSIGNED_BYTE, GPU_DATA_FLOAT));
|
||||
BLI_assert(ELEM(format, GPU_DATA_UBYTE, GPU_DATA_FLOAT));
|
||||
|
||||
const int w = GPU_texture_width(ofs->color);
|
||||
const int h = GPU_texture_height(ofs->color);
|
||||
|
|
|
@ -483,7 +483,7 @@ bool gpu_select_pick_load_id(uint id, bool end)
|
|||
const uint rect_len = ps->src.rect_len;
|
||||
GPUFrameBuffer *fb = GPU_framebuffer_active_get();
|
||||
GPU_framebuffer_read_depth(
|
||||
fb, UNPACK4(ps->gl.clip_readpixels), GPU_DATA_UNSIGNED_INT, ps->gl.rect_depth_test->buf);
|
||||
fb, UNPACK4(ps->gl.clip_readpixels), GPU_DATA_UINT, ps->gl.rect_depth_test->buf);
|
||||
/* perform initial check since most cases the array remains unchanged */
|
||||
|
||||
bool do_pass = false;
|
||||
|
|
|
@ -387,13 +387,13 @@ inline int to_component_len(eGPUTextureFormat format)
|
|||
inline size_t to_bytesize(eGPUDataFormat data_format)
|
||||
{
|
||||
switch (data_format) {
|
||||
case GPU_DATA_UNSIGNED_BYTE:
|
||||
case GPU_DATA_UBYTE:
|
||||
return 1;
|
||||
case GPU_DATA_FLOAT:
|
||||
case GPU_DATA_INT:
|
||||
case GPU_DATA_UNSIGNED_INT:
|
||||
case GPU_DATA_UINT:
|
||||
return 4;
|
||||
case GPU_DATA_UNSIGNED_INT_24_8:
|
||||
case GPU_DATA_UINT_24_8:
|
||||
case GPU_DATA_10_11_11_REV:
|
||||
return 4;
|
||||
default:
|
||||
|
@ -417,12 +417,12 @@ inline bool validate_data_format(eGPUTextureFormat tex_format, eGPUDataFormat da
|
|||
return data_format == GPU_DATA_FLOAT;
|
||||
case GPU_DEPTH24_STENCIL8:
|
||||
case GPU_DEPTH32F_STENCIL8:
|
||||
return data_format == GPU_DATA_UNSIGNED_INT_24_8;
|
||||
return data_format == GPU_DATA_UINT_24_8;
|
||||
case GPU_R8UI:
|
||||
case GPU_R16UI:
|
||||
case GPU_RG16UI:
|
||||
case GPU_R32UI:
|
||||
return data_format == GPU_DATA_UNSIGNED_INT;
|
||||
return data_format == GPU_DATA_UINT;
|
||||
case GPU_RG16I:
|
||||
case GPU_R16I:
|
||||
return data_format == GPU_DATA_INT;
|
||||
|
@ -431,7 +431,7 @@ inline bool validate_data_format(eGPUTextureFormat tex_format, eGPUDataFormat da
|
|||
case GPU_RGBA8:
|
||||
case GPU_RGBA8UI:
|
||||
case GPU_SRGB8_A8:
|
||||
return ELEM(data_format, GPU_DATA_UNSIGNED_BYTE, GPU_DATA_FLOAT);
|
||||
return ELEM(data_format, GPU_DATA_UBYTE, GPU_DATA_FLOAT);
|
||||
case GPU_R11F_G11F_B10F:
|
||||
return ELEM(data_format, GPU_DATA_10_11_11_REV, GPU_DATA_FLOAT);
|
||||
default:
|
||||
|
@ -449,12 +449,12 @@ inline eGPUDataFormat to_data_format(eGPUTextureFormat tex_format)
|
|||
return GPU_DATA_FLOAT;
|
||||
case GPU_DEPTH24_STENCIL8:
|
||||
case GPU_DEPTH32F_STENCIL8:
|
||||
return GPU_DATA_UNSIGNED_INT_24_8;
|
||||
return GPU_DATA_UINT_24_8;
|
||||
case GPU_R8UI:
|
||||
case GPU_R16UI:
|
||||
case GPU_RG16UI:
|
||||
case GPU_R32UI:
|
||||
return GPU_DATA_UNSIGNED_INT;
|
||||
return GPU_DATA_UINT;
|
||||
case GPU_RG16I:
|
||||
case GPU_R16I:
|
||||
return GPU_DATA_INT;
|
||||
|
@ -463,7 +463,7 @@ inline eGPUDataFormat to_data_format(eGPUTextureFormat tex_format)
|
|||
case GPU_RGBA8:
|
||||
case GPU_RGBA8UI:
|
||||
case GPU_SRGB8_A8:
|
||||
return GPU_DATA_UNSIGNED_BYTE;
|
||||
return GPU_DATA_UBYTE;
|
||||
case GPU_R11F_G11F_B10F:
|
||||
return GPU_DATA_10_11_11_REV;
|
||||
default:
|
||||
|
|
|
@ -365,7 +365,7 @@ void GLFrameBuffer::clear_attachment(GPUAttachmentType type,
|
|||
context_->state_manager->apply_state();
|
||||
|
||||
if (type == GPU_FB_DEPTH_STENCIL_ATTACHMENT) {
|
||||
BLI_assert(data_format == GPU_DATA_UNSIGNED_INT_24_8);
|
||||
BLI_assert(data_format == GPU_DATA_UINT_24_8);
|
||||
float depth = ((*(uint32_t *)clear_value) & 0x00FFFFFFu) / (float)0x00FFFFFFu;
|
||||
int stencil = ((*(uint32_t *)clear_value) >> 24);
|
||||
glClearBufferfi(GL_DEPTH_STENCIL, 0, depth, stencil);
|
||||
|
@ -374,7 +374,7 @@ void GLFrameBuffer::clear_attachment(GPUAttachmentType type,
|
|||
if (data_format == GPU_DATA_FLOAT) {
|
||||
glClearBufferfv(GL_DEPTH, 0, (GLfloat *)clear_value);
|
||||
}
|
||||
else if (data_format == GPU_DATA_UNSIGNED_INT) {
|
||||
else if (data_format == GPU_DATA_UINT) {
|
||||
float depth = *(uint32_t *)clear_value / (float)0xFFFFFFFFu;
|
||||
glClearBufferfv(GL_DEPTH, 0, &depth);
|
||||
}
|
||||
|
@ -388,7 +388,7 @@ void GLFrameBuffer::clear_attachment(GPUAttachmentType type,
|
|||
case GPU_DATA_FLOAT:
|
||||
glClearBufferfv(GL_COLOR, slot, (GLfloat *)clear_value);
|
||||
break;
|
||||
case GPU_DATA_UNSIGNED_INT:
|
||||
case GPU_DATA_UINT:
|
||||
glClearBufferuiv(GL_COLOR, slot, (GLuint *)clear_value);
|
||||
break;
|
||||
case GPU_DATA_INT:
|
||||
|
|
|
@ -274,11 +274,11 @@ inline GLenum to_gl(eGPUDataFormat format)
|
|||
return GL_FLOAT;
|
||||
case GPU_DATA_INT:
|
||||
return GL_INT;
|
||||
case GPU_DATA_UNSIGNED_INT:
|
||||
case GPU_DATA_UINT:
|
||||
return GL_UNSIGNED_INT;
|
||||
case GPU_DATA_UNSIGNED_BYTE:
|
||||
case GPU_DATA_UBYTE:
|
||||
return GL_UNSIGNED_BYTE;
|
||||
case GPU_DATA_UNSIGNED_INT_24_8:
|
||||
case GPU_DATA_UINT_24_8:
|
||||
return GL_UNSIGNED_INT_24_8;
|
||||
case GPU_DATA_10_11_11_REV:
|
||||
return GL_UNSIGNED_INT_10F_11F_11F_REV;
|
||||
|
|
|
@ -49,7 +49,7 @@ static void imb_gpu_get_format(const ImBuf *ibuf,
|
|||
!IMB_colormanagement_space_is_scene_linear(ibuf->rect_colorspace));
|
||||
high_bitdepth = (!(ibuf->flags & IB_halffloat) && high_bitdepth);
|
||||
|
||||
*r_data_format = (float_rect) ? GPU_DATA_FLOAT : GPU_DATA_UNSIGNED_BYTE;
|
||||
*r_data_format = (float_rect) ? GPU_DATA_FLOAT : GPU_DATA_UBYTE;
|
||||
|
||||
if (float_rect) {
|
||||
*r_texture_format = high_bitdepth ? GPU_RGBA32F : GPU_RGBA16F;
|
||||
|
|
|
@ -36,9 +36,9 @@
|
|||
struct PyC_StringEnumItems bpygpu_dataformat_items[] = {
|
||||
{GPU_DATA_FLOAT, "FLOAT"},
|
||||
{GPU_DATA_INT, "INT"},
|
||||
{GPU_DATA_UNSIGNED_INT, "UINT"},
|
||||
{GPU_DATA_UNSIGNED_BYTE, "UBYTE"},
|
||||
{GPU_DATA_UNSIGNED_INT_24_8, "UINT_24_8"},
|
||||
{GPU_DATA_UINT, "UINT"},
|
||||
{GPU_DATA_UBYTE, "UBYTE"},
|
||||
{GPU_DATA_UINT_24_8, "UINT_24_8"},
|
||||
{GPU_DATA_10_11_11_REV, "10_11_11_REV"},
|
||||
{0, NULL},
|
||||
};
|
||||
|
|
|
@ -57,11 +57,11 @@ static const char *pygpu_buffer_formatstr(eGPUDataFormat data_format)
|
|||
return "f";
|
||||
case GPU_DATA_INT:
|
||||
return "i";
|
||||
case GPU_DATA_UNSIGNED_INT:
|
||||
case GPU_DATA_UINT:
|
||||
return "I";
|
||||
case GPU_DATA_UNSIGNED_BYTE:
|
||||
case GPU_DATA_UBYTE:
|
||||
return "B";
|
||||
case GPU_DATA_UNSIGNED_INT_24_8:
|
||||
case GPU_DATA_UINT_24_8:
|
||||
case GPU_DATA_10_11_11_REV:
|
||||
return "I";
|
||||
default:
|
||||
|
@ -114,10 +114,10 @@ static PyObject *pygpu_buffer__sq_item(BPyGPUBuffer *self, int i)
|
|||
return Py_BuildValue(formatstr, self->buf.as_float[i]);
|
||||
case GPU_DATA_INT:
|
||||
return Py_BuildValue(formatstr, self->buf.as_int[i]);
|
||||
case GPU_DATA_UNSIGNED_BYTE:
|
||||
case GPU_DATA_UBYTE:
|
||||
return Py_BuildValue(formatstr, self->buf.as_byte[i]);
|
||||
case GPU_DATA_UNSIGNED_INT:
|
||||
case GPU_DATA_UNSIGNED_INT_24_8:
|
||||
case GPU_DATA_UINT:
|
||||
case GPU_DATA_UINT_24_8:
|
||||
case GPU_DATA_10_11_11_REV:
|
||||
return Py_BuildValue(formatstr, self->buf.as_uint[i]);
|
||||
}
|
||||
|
@ -433,10 +433,10 @@ static int pygpu_buffer__sq_ass_item(BPyGPUBuffer *self, int i, PyObject *v)
|
|||
return PyArg_Parse(v, "f:Expected floats", &self->buf.as_float[i]) ? 0 : -1;
|
||||
case GPU_DATA_INT:
|
||||
return PyArg_Parse(v, "i:Expected ints", &self->buf.as_int[i]) ? 0 : -1;
|
||||
case GPU_DATA_UNSIGNED_BYTE:
|
||||
case GPU_DATA_UBYTE:
|
||||
return PyArg_Parse(v, "b:Expected ints", &self->buf.as_byte[i]) ? 0 : -1;
|
||||
case GPU_DATA_UNSIGNED_INT:
|
||||
case GPU_DATA_UNSIGNED_INT_24_8:
|
||||
case GPU_DATA_UINT:
|
||||
case GPU_DATA_UINT_24_8:
|
||||
case GPU_DATA_10_11_11_REV:
|
||||
return PyArg_Parse(v, "b:Expected ints", &self->buf.as_uint[i]) ? 0 : -1;
|
||||
default:
|
||||
|
|
|
@ -314,7 +314,7 @@ static PyObject *pygpu_texture_clear(BPyGPUTexture *self, PyObject *args, PyObje
|
|||
}
|
||||
|
||||
if (shape != 1 &&
|
||||
ELEM(pygpu_dataformat.value_found, GPU_DATA_UNSIGNED_INT_24_8, GPU_DATA_10_11_11_REV)) {
|
||||
ELEM(pygpu_dataformat.value_found, GPU_DATA_UINT_24_8, GPU_DATA_10_11_11_REV)) {
|
||||
PyErr_SetString(PyExc_AttributeError,
|
||||
"`UINT_24_8` and `10_11_11_REV` only support single values");
|
||||
return NULL;
|
||||
|
@ -330,7 +330,7 @@ static PyObject *pygpu_texture_clear(BPyGPUTexture *self, PyObject *args, PyObje
|
|||
return NULL;
|
||||
}
|
||||
|
||||
if (pygpu_dataformat.value_found == GPU_DATA_UNSIGNED_BYTE) {
|
||||
if (pygpu_dataformat.value_found == GPU_DATA_UBYTE) {
|
||||
/* Convert to byte. */
|
||||
values.c[0] = values.i[0];
|
||||
values.c[1] = values.i[1];
|
||||
|
@ -362,13 +362,13 @@ static PyObject *pygpu_texture_read(BPyGPUTexture *self)
|
|||
break;
|
||||
case GPU_DEPTH24_STENCIL8:
|
||||
case GPU_DEPTH32F_STENCIL8:
|
||||
best_data_format = GPU_DATA_UNSIGNED_INT_24_8;
|
||||
best_data_format = GPU_DATA_UINT_24_8;
|
||||
break;
|
||||
case GPU_R8UI:
|
||||
case GPU_R16UI:
|
||||
case GPU_RG16UI:
|
||||
case GPU_R32UI:
|
||||
best_data_format = GPU_DATA_UNSIGNED_INT;
|
||||
best_data_format = GPU_DATA_UINT;
|
||||
break;
|
||||
case GPU_RG16I:
|
||||
case GPU_R16I:
|
||||
|
@ -379,7 +379,7 @@ static PyObject *pygpu_texture_read(BPyGPUTexture *self)
|
|||
case GPU_RGBA8:
|
||||
case GPU_RGBA8UI:
|
||||
case GPU_SRGB8_A8:
|
||||
best_data_format = GPU_DATA_UNSIGNED_BYTE;
|
||||
best_data_format = GPU_DATA_UBYTE;
|
||||
break;
|
||||
case GPU_R11F_G11F_B10F:
|
||||
best_data_format = GPU_DATA_10_11_11_REV;
|
||||
|
|
|
@ -2026,7 +2026,7 @@ uint *WM_window_pixels_read(wmWindowManager *wm, wmWindow *win, int r_size[2])
|
|||
const uint rect_len = r_size[0] * r_size[1];
|
||||
uint *rect = MEM_mallocN(sizeof(*rect) * rect_len, __func__);
|
||||
|
||||
GPU_frontbuffer_read_pixels(0, 0, r_size[0], r_size[1], 4, GPU_DATA_UNSIGNED_BYTE, rect);
|
||||
GPU_frontbuffer_read_pixels(0, 0, r_size[0], r_size[1], 4, GPU_DATA_UBYTE, rect);
|
||||
|
||||
if (setup_context) {
|
||||
if (wm->windrawable) {
|
||||
|
|
Loading…
Reference in New Issue