GPU/DRW: Add GPU_R16UI format.

This commit is contained in:
Clément Foucault 2018-04-16 19:33:09 +02:00
parent dccda1fe43
commit c2d4ba2ff5
4 changed files with 13 additions and 3 deletions

View File

@ -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,

View File

@ -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;

View File

@ -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,

View File

@ -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 */