[Bf-blender-cvs] [d7b3e33af43] blender2.8: GL_TEXTURE_2D_ARRAY wasn't handled in GPU_texture_update

Dalai Felinto noreply at git.blender.org
Tue Aug 22 14:37:35 CEST 2017


Commit: d7b3e33af43fa5a42e87689b441e6aa08e544754
Author: Dalai Felinto
Date:   Tue Aug 22 14:33:57 2017 +0200
Branches: blender2.8
https://developer.blender.org/rBd7b3e33af43fa5a42e87689b441e6aa08e544754

GL_TEXTURE_2D_ARRAY wasn't handled in GPU_texture_update

Although the problem was exposed in 9457715d9a6f, the problem was in the
original code that was copied over. To have:

```
} else { /* EXPECTED_VALUE */
```

Without an BLI_assert(value == EXPECTED_VALUE); is asking for troubles.
Yet another reason to favour switch statements with:

```
default:
    BLI_assert(!"value not implemented or supported");
```

Instead of chained if/else if/else /* expected_value */.

===================================================================

M	source/blender/gpu/intern/gpu_texture.c

===================================================================

diff --git a/source/blender/gpu/intern/gpu_texture.c b/source/blender/gpu/intern/gpu_texture.c
index 25e54633552..7d8a354074a 100644
--- a/source/blender/gpu/intern/gpu_texture.c
+++ b/source/blender/gpu/intern/gpu_texture.c
@@ -732,6 +732,7 @@ void GPU_texture_update(GPUTexture *tex, const float *pixels)
 			glTexSubImage1D(tex->target, 0, 0, tex->w, format, data_format, pixels);
 			break;
 		case GL_TEXTURE_3D:
+		case GL_TEXTURE_2D_ARRAY:
 			glTexSubImage3D(tex->target, 0, 0, 0, 0, tex->w, tex->h, tex->d, format, data_format, pixels);
 			break;
 		default:



More information about the Bf-blender-cvs mailing list