diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-01-23 06:15:43 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-01-23 06:16:03 +0300 |
commit | 2e4f1b592f7d1b63ec012528997fab64f16c0416 (patch) | |
tree | e53da8d758e3f3454afd27064d2382260653e210 /source/blender/gpu/intern/gpu_texture.c | |
parent | 14d947dcadea7c9debe6c8a078a571eba6cb828c (diff) |
Cleanup: use eGPU prefix for GPU enum types
Diffstat (limited to 'source/blender/gpu/intern/gpu_texture.c')
-rw-r--r-- | source/blender/gpu/intern/gpu_texture.c | 72 |
1 files changed, 36 insertions, 36 deletions
diff --git a/source/blender/gpu/intern/gpu_texture.c b/source/blender/gpu/intern/gpu_texture.c index 6d9f009a80c..028d1fe1a8f 100644 --- a/source/blender/gpu/intern/gpu_texture.c +++ b/source/blender/gpu/intern/gpu_texture.c @@ -57,7 +57,7 @@ static struct GPUTextureGlobal { /* Maximum number of FBOs a texture can be attached to. */ #define GPU_TEX_MAX_FBO_ATTACHED 10 -typedef enum GPUTextureFormatFlag { +typedef enum eGPUTextureFormatFlag { GPU_FORMAT_DEPTH = (1 << 0), GPU_FORMAT_STENCIL = (1 << 1), GPU_FORMAT_INTEGER = (1 << 2), @@ -68,7 +68,7 @@ typedef enum GPUTextureFormatFlag { GPU_FORMAT_3D = (1 << 12), GPU_FORMAT_CUBE = (1 << 13), GPU_FORMAT_ARRAY = (1 << 14), -} GPUTextureFormatFlag; +} eGPUTextureFormatFlag; /* GPUTexture */ struct GPUTexture { @@ -80,8 +80,8 @@ struct GPUTexture { * use it for unbinding */ GLuint bindcode; /* opengl identifier for texture */ - GPUTextureFormat format; - GPUTextureFormatFlag format_flag; + eGPUTextureFormat format; + eGPUTextureFormatFlag format_flag; uint bytesize; /* number of byte for one pixel */ int components; /* number of color/alpha channels */ @@ -178,7 +178,7 @@ static const char *gl_enum_to_str(GLenum e) return enum_strings[e]; } -static int gpu_get_component_count(GPUTextureFormat format) +static int gpu_get_component_count(eGPUTextureFormat format) { switch (format) { case GPU_RGBA8: @@ -203,7 +203,7 @@ static int gpu_get_component_count(GPUTextureFormat format) } /* Definitely not complete, edit according to the gl specification. */ -static void gpu_validate_data_format(GPUTextureFormat tex_format, GPUDataFormat data_format) +static void gpu_validate_data_format(eGPUTextureFormat tex_format, eGPUDataFormat data_format) { (void)data_format; @@ -245,7 +245,7 @@ static void gpu_validate_data_format(GPUTextureFormat tex_format, GPUDataFormat } } -static GPUDataFormat gpu_get_data_format_from_tex_format(GPUTextureFormat tex_format) +static eGPUDataFormat gpu_get_data_format_from_tex_format(eGPUTextureFormat tex_format) { if (ELEM(tex_format, GPU_DEPTH_COMPONENT24, @@ -285,7 +285,7 @@ static GPUDataFormat gpu_get_data_format_from_tex_format(GPUTextureFormat tex_fo } /* Definitely not complete, edit according to the gl specification. */ -static GLenum gpu_get_gl_dataformat(GPUTextureFormat data_type, GPUTextureFormatFlag *format_flag) +static GLenum gpu_get_gl_dataformat(eGPUTextureFormat data_type, eGPUTextureFormatFlag *format_flag) { if (ELEM(data_type, GPU_DEPTH_COMPONENT24, @@ -335,7 +335,7 @@ static GLenum gpu_get_gl_dataformat(GPUTextureFormat data_type, GPUTextureFormat return GL_RGBA; } -static uint gpu_get_bytesize(GPUTextureFormat data_type) +static uint gpu_get_bytesize(eGPUTextureFormat data_type) { switch (data_type) { case GPU_RGBA32F: @@ -379,7 +379,7 @@ static uint gpu_get_bytesize(GPUTextureFormat data_type) } } -static GLenum gpu_get_gl_internalformat(GPUTextureFormat format) +static GLenum gpu_get_gl_internalformat(eGPUTextureFormat format) { /* You can add any of the available type to this list * For available types see GPU_texture.h */ @@ -424,7 +424,7 @@ static GLenum gpu_get_gl_internalformat(GPUTextureFormat format) } } -static GLenum gpu_get_gl_datatype(GPUDataFormat format) +static GLenum gpu_get_gl_datatype(eGPUDataFormat format) { switch (format) { case GPU_DATA_FLOAT: @@ -592,7 +592,7 @@ static bool gpu_texture_try_alloc( GPUTexture *GPU_texture_create_nD( int w, int h, int d, int n, const void *pixels, - GPUTextureFormat tex_format, GPUDataFormat gpu_data_format, int samples, + eGPUTextureFormat tex_format, eGPUDataFormat gpu_data_format, int samples, const bool can_rescale, char err_out[256]) { if (samples) { @@ -765,7 +765,7 @@ static GPUTexture *GPU_texture_cube_create( int w, int d, const float *fpixels_px, const float *fpixels_py, const float *fpixels_pz, const float *fpixels_nx, const float *fpixels_ny, const float *fpixels_nz, - GPUTextureFormat tex_format, GPUDataFormat gpu_data_format, + eGPUTextureFormat tex_format, eGPUDataFormat gpu_data_format, char err_out[256]) { GPUTexture *tex = MEM_callocN(sizeof(GPUTexture), "GPUTexture"); @@ -851,7 +851,7 @@ static GPUTexture *GPU_texture_cube_create( } /* Special buffer textures. tex_format must be compatible with the buffer content. */ -GPUTexture *GPU_texture_create_buffer(GPUTextureFormat tex_format, const GLuint buffer) +GPUTexture *GPU_texture_create_buffer(eGPUTextureFormat tex_format, const GLuint buffer) { GPUTexture *tex = MEM_callocN(sizeof(GPUTexture), "GPUTexture"); tex->number = -1; @@ -992,49 +992,49 @@ GPUTexture *GPU_texture_from_preview(PreviewImage *prv, int mipmap) } GPUTexture *GPU_texture_create_1D( - int w, GPUTextureFormat tex_format, const float *pixels, char err_out[256]) + int w, eGPUTextureFormat tex_format, const float *pixels, char err_out[256]) { - GPUDataFormat data_format = gpu_get_data_format_from_tex_format(tex_format); + eGPUDataFormat data_format = gpu_get_data_format_from_tex_format(tex_format); return GPU_texture_create_nD(w, 0, 0, 1, pixels, tex_format, data_format, 0, false, err_out); } GPUTexture *GPU_texture_create_1D_array( - int w, int h, GPUTextureFormat tex_format, const float *pixels, char err_out[256]) + int w, int h, eGPUTextureFormat tex_format, const float *pixels, char err_out[256]) { - GPUDataFormat data_format = gpu_get_data_format_from_tex_format(tex_format); + eGPUDataFormat data_format = gpu_get_data_format_from_tex_format(tex_format); return GPU_texture_create_nD(w, h, 0, 1, pixels, tex_format, data_format, 0, false, err_out); } GPUTexture *GPU_texture_create_2D( - int w, int h, GPUTextureFormat tex_format, const float *pixels, char err_out[256]) + int w, int h, eGPUTextureFormat tex_format, const float *pixels, char err_out[256]) { - GPUDataFormat data_format = gpu_get_data_format_from_tex_format(tex_format); + eGPUDataFormat data_format = gpu_get_data_format_from_tex_format(tex_format); return GPU_texture_create_nD(w, h, 0, 2, pixels, tex_format, data_format, 0, false, err_out); } GPUTexture *GPU_texture_create_2D_multisample( - int w, int h, GPUTextureFormat tex_format, const float *pixels, int samples, char err_out[256]) + int w, int h, eGPUTextureFormat tex_format, const float *pixels, int samples, char err_out[256]) { - GPUDataFormat data_format = gpu_get_data_format_from_tex_format(tex_format); + eGPUDataFormat data_format = gpu_get_data_format_from_tex_format(tex_format); return GPU_texture_create_nD(w, h, 0, 2, pixels, tex_format, data_format, samples, false, err_out); } GPUTexture *GPU_texture_create_2D_array( - int w, int h, int d, GPUTextureFormat tex_format, const float *pixels, char err_out[256]) + int w, int h, int d, eGPUTextureFormat tex_format, const float *pixels, char err_out[256]) { - GPUDataFormat data_format = gpu_get_data_format_from_tex_format(tex_format); + eGPUDataFormat data_format = gpu_get_data_format_from_tex_format(tex_format); return GPU_texture_create_nD(w, h, d, 2, pixels, tex_format, data_format, 0, false, err_out); } GPUTexture *GPU_texture_create_3D( - int w, int h, int d, GPUTextureFormat tex_format, const float *pixels, char err_out[256]) + int w, int h, int d, eGPUTextureFormat tex_format, const float *pixels, char err_out[256]) { - GPUDataFormat data_format = gpu_get_data_format_from_tex_format(tex_format); + eGPUDataFormat data_format = gpu_get_data_format_from_tex_format(tex_format); return GPU_texture_create_nD(w, h, d, 3, pixels, tex_format, data_format, 0, true, err_out); } GPUTexture *GPU_texture_create_cube( - int w, GPUTextureFormat tex_format, const float *fpixels, char err_out[256]) + int w, eGPUTextureFormat tex_format, const float *fpixels, char err_out[256]) { const float *fpixels_px, *fpixels_py, *fpixels_pz, *fpixels_nx, *fpixels_ny, *fpixels_nz; const int channels = gpu_get_component_count(tex_format); @@ -1075,7 +1075,7 @@ GPUTexture *GPU_texture_create_from_vertbuf(GPUVertBuf *vert) BLI_assert(is_uint || byte_per_comp <= 2); } - GPUTextureFormat data_type; + eGPUTextureFormat data_type; switch (attr->fetch_mode) { case GPU_FETCH_FLOAT: switch (attr->comp_len) { @@ -1126,7 +1126,7 @@ GPUTexture *GPU_texture_create_from_vertbuf(GPUVertBuf *vert) } void GPU_texture_add_mipmap( - GPUTexture *tex, GPUDataFormat gpu_data_format, int miplvl, const void *pixels) + GPUTexture *tex, eGPUDataFormat gpu_data_format, int miplvl, const void *pixels) { BLI_assert((int)tex->format > -1); BLI_assert(tex->components > -1); @@ -1166,7 +1166,7 @@ void GPU_texture_add_mipmap( } void GPU_texture_update_sub( - GPUTexture *tex, GPUDataFormat gpu_data_format, const void *pixels, + GPUTexture *tex, eGPUDataFormat gpu_data_format, const void *pixels, int offset_x, int offset_y, int offset_z, int width, int height, int depth) { BLI_assert((int)tex->format > -1); @@ -1211,7 +1211,7 @@ void GPU_texture_update_sub( glBindTexture(tex->target, 0); } -void *GPU_texture_read(GPUTexture *tex, GPUDataFormat gpu_data_format, int miplvl) +void *GPU_texture_read(GPUTexture *tex, eGPUDataFormat gpu_data_format, int miplvl) { int size[3] = {0, 0, 0}; GPU_texture_get_mipmap_size(tex, miplvl, size); @@ -1265,7 +1265,7 @@ void *GPU_texture_read(GPUTexture *tex, GPUDataFormat gpu_data_format, int miplv return buf; } -void GPU_texture_update(GPUTexture *tex, GPUDataFormat data_format, const void *pixels) +void GPU_texture_update(GPUTexture *tex, eGPUDataFormat data_format, const void *pixels) { GPU_texture_update_sub(tex, data_format, pixels, 0, 0, 0, tex->w, tex->h, tex->d); } @@ -1370,7 +1370,7 @@ void GPU_texture_generate_mipmap(GPUTexture *tex) * In this case we just create a complete texture with mipmaps manually without downsampling. * You must initialize the texture levels using other methods like GPU_framebuffer_recursive_downsample(). */ int levels = 1 + floor(log2(max_ii(tex->w, tex->h))); - GPUDataFormat data_format = gpu_get_data_format_from_tex_format(tex->format); + eGPUDataFormat data_format = gpu_get_data_format_from_tex_format(tex->format); for (int i = 1; i < levels; ++i) { GPU_texture_add_mipmap(tex, data_format, i, NULL); } @@ -1441,7 +1441,7 @@ void GPU_texture_wrap_mode(GPUTexture *tex, bool use_repeat) glTexParameteri(tex->target_base, GL_TEXTURE_WRAP_R, repeat); } -static GLenum gpu_get_gl_filterfunction(GPUFilterFunction filter) +static GLenum gpu_get_gl_filterfunction(eGPUFilterFunction filter) { switch (filter) { case GPU_NEAREST: @@ -1454,7 +1454,7 @@ static GLenum gpu_get_gl_filterfunction(GPUFilterFunction filter) } } -void GPU_texture_filters(GPUTexture *tex, GPUFilterFunction min_filter, GPUFilterFunction mag_filter) +void GPU_texture_filters(GPUTexture *tex, eGPUFilterFunction min_filter, eGPUFilterFunction mag_filter) { WARN_NOT_BOUND(tex); @@ -1515,7 +1515,7 @@ int GPU_texture_layers(const GPUTexture *tex) return tex->d; } -GPUTextureFormat GPU_texture_format(const GPUTexture *tex) +eGPUTextureFormat GPU_texture_format(const GPUTexture *tex) { return tex->format; } |