From ab95cdaba970a30127d804bd1e66ad25ab021ec1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Foucault?= Date: Sat, 5 Sep 2020 17:33:56 +0200 Subject: GPUTexture: Change texture creation API This is to modernize the API: - Add meaningful name to all textures (except DRW textures). - Remove unused err_out argument: only used for offscreen python. - Add mipmap count to creation functions for future changes. - Clarify the data usage in creation functions. This is a cleanup commit, there is no functional change. # Conflicts: # source/blender/gpu/GPU_texture.h --- intern/opencolorio/ocio_impl_glsl.cc | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'intern') diff --git a/intern/opencolorio/ocio_impl_glsl.cc b/intern/opencolorio/ocio_impl_glsl.cc index 6765d569d2f..1461be42578 100644 --- a/intern/opencolorio/ocio_impl_glsl.cc +++ b/intern/opencolorio/ocio_impl_glsl.cc @@ -282,18 +282,20 @@ static void ensureGLSLLut3d(OCIO_GLSLLut3d **lut3d_ptr, OCIO_GLSLLut3d *lut3d = OBJECT_GUARDED_NEW(OCIO_GLSLLut3d); - for (int i = 0; i < 2; i++) { - int extent[3] = {LUT3D_EDGE_SIZE, LUT3D_EDGE_SIZE, LUT3D_EDGE_SIZE}; - GPUTexture *tex = GPU_texture_create_3d(UNPACK3(extent), GPU_RGB16F, NULL, NULL); - GPU_texture_filter_mode(tex, true); - GPU_texture_wrap_mode(tex, false, true); + int extent[3] = {LUT3D_EDGE_SIZE, LUT3D_EDGE_SIZE, LUT3D_EDGE_SIZE}; - (&lut3d->texture)[i] = tex; - } + lut3d->texture = GPU_texture_create_3d("OCIOLut", UNPACK3(extent), 1, GPU_RGB16F, NULL); + GPU_texture_filter_mode(lut3d->texture, true); + GPU_texture_wrap_mode(lut3d->texture, false, true); + + lut3d->texture_display = GPU_texture_create_3d( + "OCIOLutDisplay", UNPACK3(extent), 1, GPU_RGB16F, NULL); + GPU_texture_filter_mode(lut3d->texture_display, true); + GPU_texture_wrap_mode(lut3d->texture_display, false, true); updateGLSLLut3d(lut3d, processor_scene_to_ui, processpr_ui_to_display, shaderDesc, cache_id); - lut3d->valid = (lut3d->texture != 0); + lut3d->valid = (lut3d->texture && lut3d->texture_display); *lut3d_ptr = lut3d; } @@ -316,7 +318,7 @@ static void allocateCurveMappingTexture(OCIO_GLSLCurveMappping *curvemap, { int lut_size = curve_mapping_settings ? curve_mapping_settings->lut_size : 1; /* Do not initialize. Only if used. */ - curvemap->texture = GPU_texture_create_1d(lut_size, GPU_RGBA16F, NULL, NULL); + curvemap->texture = GPU_texture_create_1d("OCIOCurveMap", lut_size, 1, GPU_RGBA16F, NULL); GPU_texture_filter_mode(curvemap->texture, false); GPU_texture_wrap_mode(curvemap->texture, false, true); } -- cgit v1.2.3