Changeset View
Changeset View
Standalone View
Standalone View
source/blender/imbuf/intern/util_gpu.c
| Show First 20 Lines • Show All 345 Lines • ▼ Show 20 Lines | #endif | ||||
| eGPUDataFormat data_format; | eGPUDataFormat data_format; | ||||
| eGPUTextureFormat tex_format; | eGPUTextureFormat tex_format; | ||||
| imb_gpu_get_format(ibuf, use_high_bitdepth, true, &data_format, &tex_format); | imb_gpu_get_format(ibuf, use_high_bitdepth, true, &data_format, &tex_format); | ||||
| bool freebuf = false; | bool freebuf = false; | ||||
| /* Create Texture. */ | /* Create Texture. */ | ||||
| tex = GPU_texture_create_2d_ex( | tex = GPU_texture_create_2d_ex(name, | ||||
| name, UNPACK2(size), 9999, tex_format, GPU_TEXTURE_USAGE_SHADER_READ, NULL); | UNPACK2(size), | ||||
| 9999, | |||||
| tex_format, | |||||
| GPU_TEXTURE_USAGE_SHADER_READ | | |||||
| GPU_TEXTURE_USAGE_MIP_SWIZZLE_VIEW, | |||||
| NULL); | |||||
| if (tex == NULL) { | if (tex == NULL) { | ||||
| size[0] = max_ii(1, size[0] / 2); | size[0] = max_ii(1, size[0] / 2); | ||||
| size[1] = max_ii(1, size[1] / 2); | size[1] = max_ii(1, size[1] / 2); | ||||
| tex = GPU_texture_create_2d_ex( | tex = GPU_texture_create_2d_ex(name, | ||||
| name, UNPACK2(size), 9999, tex_format, GPU_TEXTURE_USAGE_SHADER_READ, NULL); | UNPACK2(size), | ||||
| 9999, | |||||
| tex_format, | |||||
| GPU_TEXTURE_USAGE_SHADER_READ | | |||||
| GPU_TEXTURE_USAGE_MIP_SWIZZLE_VIEW, | |||||
| NULL); | |||||
| do_rescale = true; | do_rescale = true; | ||||
| } | } | ||||
| BLI_assert(tex != NULL); | BLI_assert(tex != NULL); | ||||
| void *data = imb_gpu_get_data(ibuf, do_rescale, size, use_premult, &freebuf); | void *data = imb_gpu_get_data(ibuf, do_rescale, size, use_premult, &freebuf); | ||||
| GPU_texture_update(tex, data_format, data); | GPU_texture_update(tex, data_format, data); | ||||
| GPU_texture_swizzle_set(tex, imb_gpu_get_swizzle(ibuf)); | GPU_texture_swizzle_set(tex, imb_gpu_get_swizzle(ibuf)); | ||||
| GPU_texture_anisotropic_filter(tex, true); | GPU_texture_anisotropic_filter(tex, true); | ||||
| Show All 35 Lines | |||||