diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-09-12 05:18:35 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-09-12 05:19:46 +0300 |
commit | 7eecc9407415e18eaab2ded2fcc883edbf58c633 (patch) | |
tree | 0ca4e707c50ea1d6c86ce61cf0f3498f4a7b3373 /source/blender/gpu/intern/gpu_texture.c | |
parent | baca8344d997e0a7c6f5f1833cd5b734b5e680da (diff) |
Cleanup: use uint/uchar types in GPU
Diffstat (limited to 'source/blender/gpu/intern/gpu_texture.c')
-rw-r--r-- | source/blender/gpu/intern/gpu_texture.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/source/blender/gpu/intern/gpu_texture.c b/source/blender/gpu/intern/gpu_texture.c index 98362abfbfd..3e4a57c8f64 100644 --- a/source/blender/gpu/intern/gpu_texture.c +++ b/source/blender/gpu/intern/gpu_texture.c @@ -83,7 +83,7 @@ struct GPUTexture { GPUTextureFormat format; GPUTextureFormatFlag format_flag; - unsigned int bytesize; /* number of byte for one pixel */ + uint bytesize; /* number of byte for one pixel */ int components; /* number of color/alpha channels */ int samples; /* number of samples for multisamples textures. 0 if not multisample target */ @@ -94,9 +94,9 @@ struct GPUTexture { /* ------ Memory Management ------- */ /* Records every texture allocation / free * to estimate the Texture Pool Memory consumption */ -static unsigned int memory_usage; +static uint memory_usage; -static unsigned int gpu_texture_memory_footprint_compute(GPUTexture *tex) +static uint gpu_texture_memory_footprint_compute(GPUTexture *tex) { int samp = max_ii(tex->samples, 1); switch (tex->target) { @@ -127,7 +127,7 @@ static void gpu_texture_memory_footprint_remove(GPUTexture *tex) memory_usage -= gpu_texture_memory_footprint_compute(tex); } -unsigned int GPU_texture_memory_usage_get(void) +uint GPU_texture_memory_usage_get(void) { return memory_usage; } @@ -281,7 +281,7 @@ static GLenum gpu_get_gl_dataformat(GPUTextureFormat data_type, GPUTextureFormat return GL_RGBA; } -static unsigned int gpu_get_bytesize(GPUTextureFormat data_type) +static uint gpu_get_bytesize(GPUTextureFormat data_type) { switch (data_type) { case GPU_RGBA32F: @@ -384,22 +384,22 @@ static GLenum gpu_get_gl_datatype(GPUDataFormat format) static float *GPU_texture_3D_rescale(GPUTexture *tex, int w, int h, int d, int channels, const float *fpixels) { - const unsigned int xf = w / tex->w, yf = h / tex->h, zf = d / tex->d; + const uint xf = w / tex->w, yf = h / tex->h, zf = d / tex->d; float *nfpixels = MEM_mallocN(channels * sizeof(float) * tex->w * tex->h * tex->d, "GPUTexture Rescaled 3Dtex"); if (nfpixels) { GPU_print_error_debug("You need to scale a 3D texture, feel the pain!"); - for (unsigned k = 0; k < tex->d; k++) { - for (unsigned j = 0; j < tex->h; j++) { - for (unsigned i = 0; i < tex->w; i++) { + for (uint k = 0; k < tex->d; k++) { + for (uint j = 0; j < tex->h; j++) { + for (uint i = 0; i < tex->w; i++) { /* obviously doing nearest filtering here, * it's going to be slow in any case, let's not make it worse */ float xb = i * xf; float yb = j * yf; float zb = k * zf; - unsigned int offset = k * (tex->w * tex->h) + i * tex->h + j; - unsigned int offset_orig = (zb) * (w * h) + (xb) * h + (yb); + uint offset = k * (tex->w * tex->h) + i * tex->h + j; + uint offset_orig = (zb) * (w * h) + (xb) * h + (yb); if (channels == 4) { nfpixels[offset * 4] = fpixels[offset_orig * 4]; @@ -939,7 +939,7 @@ GPUTexture *GPU_texture_create_from_vertbuf(GPUVertBuf *vert) BLI_assert(attr->comp_type != GPU_COMP_I10); BLI_assert(attr->fetch_mode != GPU_FETCH_INT_TO_FLOAT); - unsigned int byte_per_comp = attr->sz / attr->comp_len; + uint byte_per_comp = attr->sz / attr->comp_len; bool is_uint = ELEM(attr->comp_type, GPU_COMP_U8, GPU_COMP_U16, GPU_COMP_U32); /* Cannot fetch signed int or 32bit ints as normalized float. */ |