Commit: c2d4ba2ff54b47a8053c8dd19411186d2a050115
Author: Clément Foucault
Date:   Mon Apr 16 19:33:09 2018 +0200
Branches: blender2.8
https://developer.blender.org/rBc2d4ba2ff54b47a8053c8dd19411186d2a050115

GPU/DRW: Add GPU_R16UI format.

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

M       source/blender/draw/intern/DRW_render.h
M       source/blender/draw/intern/draw_manager_texture.c
M       source/blender/gpu/GPU_texture.h
M       source/blender/gpu/intern/gpu_texture.c

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

diff --git a/source/blender/draw/intern/DRW_render.h 
b/source/blender/draw/intern/DRW_render.h
index 66ca8971a46..5e00005edb6 100644
--- a/source/blender/draw/intern/DRW_render.h
+++ b/source/blender/draw/intern/DRW_render.h
@@ -187,6 +187,7 @@ typedef enum {
        DRW_TEX_R_8,
        DRW_TEX_R_16,
        DRW_TEX_R_16I,
+       DRW_TEX_R_16U,
        DRW_TEX_R_32,
        DRW_TEX_DEPTH_16,
        DRW_TEX_DEPTH_24,
diff --git a/source/blender/draw/intern/draw_manager_texture.c 
b/source/blender/draw/intern/draw_manager_texture.c
index 65856a6bf5c..f083e399ac2 100644
--- a/source/blender/draw/intern/draw_manager_texture.c
+++ b/source/blender/draw/intern/draw_manager_texture.c
@@ -36,6 +36,7 @@ void drw_texture_get_format(
                         * Generally they are multiple of 16bit. */
                        case DRW_TEX_R_16:
                        case DRW_TEX_R_16I:
+                       case DRW_TEX_R_16U:
                        case DRW_TEX_R_32:
                        case DRW_TEX_RG_8:
                        case DRW_TEX_RG_16:
@@ -72,6 +73,7 @@ void drw_texture_get_format(
                case DRW_TEX_R_8: *r_data_type = GPU_R8; break;
                case DRW_TEX_R_16: *r_data_type = GPU_R16F; break;
                case DRW_TEX_R_16I: *r_data_type = GPU_R16I; break;
+               case DRW_TEX_R_16U: *r_data_type = GPU_R16UI; break;
                case DRW_TEX_R_32: *r_data_type = GPU_R32F; break;
 #if 0
                case DRW_TEX_RGB_8: *r_data_type = GPU_RGB8; break;
diff --git a/source/blender/gpu/GPU_texture.h b/source/blender/gpu/GPU_texture.h
index 57185d2f39e..92dc512e27d 100644
--- a/source/blender/gpu/GPU_texture.h
+++ b/source/blender/gpu/GPU_texture.h
@@ -71,6 +71,7 @@ typedef enum GPUTextureFormat {
        GPU_R32F,
        GPU_R16F,
        GPU_R16I,
+       GPU_R16UI,
        GPU_RG8,
        GPU_R8,
 #if 0
@@ -89,7 +90,6 @@ typedef enum GPUTextureFormat {
        GPU_RG8UI,
        GPU_R32I,
        GPU_R32UI,
-       GPU_R16UI,
        GPU_R16,
        GPU_R8I,
        GPU_R8UI,
diff --git a/source/blender/gpu/intern/gpu_texture.c 
b/source/blender/gpu/intern/gpu_texture.c
index 75830f60f03..cfc229166ed 100644
--- a/source/blender/gpu/intern/gpu_texture.c
+++ b/source/blender/gpu/intern/gpu_texture.c
@@ -147,8 +147,14 @@ static GLenum gpu_texture_get_format(
        }
        else {
                /* Integer formats */
-               if (ELEM(data_type, GPU_RG16I, GPU_R16I)) {
-                       *data_format = GL_INT;
+               if (ELEM(data_type, GPU_RG16I, GPU_R16I, GPU_R16UI)) {
+                       if (ELEM(data_type, GPU_R16UI)) {
+                               *data_format = GL_UNSIGNED_INT;
+                       }
+                       else {
+                               *data_format = GL_INT;
+                       }
+
                        *format_flag |= GPU_FORMAT_INTEGER;
 
                        switch (components) {
@@ -224,6 +230,7 @@ static GLenum gpu_texture_get_format(
                case GPU_R32F: return GL_R32F;
                case GPU_R16F: return GL_R16F;
                case GPU_R16I: return GL_R16I;
+               case GPU_R16UI: return GL_R16UI;
                case GPU_RG8: return GL_RG8;
                case GPU_R8: return GL_R8;
                /* Special formats texture & renderbuffer */

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to