diff options
Diffstat (limited to 'source/blender/gpu/intern')
-rw-r--r-- | source/blender/gpu/intern/gpu_batch.c | 4 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_batch_presets.c | 2 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_buffers.c | 12 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_framebuffer.c | 4 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_immediate_util.c | 2 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_material.c | 28 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_texture.c | 12 |
7 files changed, 32 insertions, 32 deletions
diff --git a/source/blender/gpu/intern/gpu_batch.c b/source/blender/gpu/intern/gpu_batch.c index 59d88e81822..6194e720156 100644 --- a/source/blender/gpu/intern/gpu_batch.c +++ b/source/blender/gpu/intern/gpu_batch.c @@ -126,7 +126,7 @@ Gwn_Batch *GPU_batch_tris_from_poly_2d_encoded( /* We have vertices and tris, make a batch from this. */ static Gwn_VertFormat format = {0}; static struct { uint pos; } attr_id; - if (format.attrib_ct == 0) { + if (format.attr_len == 0) { attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); } @@ -230,7 +230,7 @@ Gwn_Batch *GPU_batch_wire_from_poly_2d_encoded( /* We have vertices and tris, make a batch from this. */ static Gwn_VertFormat format = {0}; static struct { uint pos; } attr_id; - if (format.attrib_ct == 0) { + if (format.attr_len == 0) { attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); } diff --git a/source/blender/gpu/intern/gpu_batch_presets.c b/source/blender/gpu/intern/gpu_batch_presets.c index 10cbd16490b..eaf0a6821ff 100644 --- a/source/blender/gpu/intern/gpu_batch_presets.c +++ b/source/blender/gpu/intern/gpu_batch_presets.c @@ -65,7 +65,7 @@ static ListBase presets_list = {NULL, NULL}; static Gwn_VertFormat *preset_3D_format(void) { - if (g_presets_3d.format.attrib_ct == 0) { + if (g_presets_3d.format.attr_len == 0) { Gwn_VertFormat *format = &g_presets_3d.format; g_presets_3d.attr_id.pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); g_presets_3d.attr_id.nor = GWN_vertformat_attr_add(format, "nor", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); diff --git a/source/blender/gpu/intern/gpu_buffers.c b/source/blender/gpu/intern/gpu_buffers.c index 688386810ea..1a4750652cc 100644 --- a/source/blender/gpu/intern/gpu_buffers.c +++ b/source/blender/gpu/intern/gpu_buffers.c @@ -126,29 +126,29 @@ static void gpu_material_diffuse_get(int UNUSED(nr), float diff[4]) /* Allocates a non-initialized buffer to be sent to GPU. * Return is false it indicates that the memory map failed. */ -static bool gpu_pbvh_vert_buf_data_set(GPU_PBVH_Buffers *buffers, unsigned int vert_ct) +static bool gpu_pbvh_vert_buf_data_set(GPU_PBVH_Buffers *buffers, unsigned int vert_len) { if (buffers->vert_buf == NULL) { /* Initialize vertex buffer */ /* match 'VertexBufferFormat' */ static Gwn_VertFormat format = {0}; - if (format.attrib_ct == 0) { + if (format.attr_len == 0) { g_vbo_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); g_vbo_id.nor = GWN_vertformat_attr_add(&format, "nor", GWN_COMP_I16, 3, GWN_FETCH_INT_TO_FLOAT_UNIT); g_vbo_id.col = GWN_vertformat_attr_add(&format, "color", GWN_COMP_U8, 3, GWN_FETCH_INT_TO_FLOAT_UNIT); } #if 0 buffers->vert_buf = GWN_vertbuf_create_with_format_ex(&format, GWN_USAGE_DYNAMIC); - GWN_vertbuf_data_alloc(buffers->vert_buf, vert_ct); + GWN_vertbuf_data_alloc(buffers->vert_buf, vert_len); } - else if (vert_ct != buffers->vert_buf->vertex_ct) { - GWN_vertbuf_data_resize(buffers->vert_buf, vert_ct); + else if (vert_len != buffers->vert_buf->vertex_len) { + GWN_vertbuf_data_resize(buffers->vert_buf, vert_len); } #else buffers->vert_buf = GWN_vertbuf_create_with_format_ex(&format, GWN_USAGE_STATIC); } - GWN_vertbuf_data_alloc(buffers->vert_buf, vert_ct); + GWN_vertbuf_data_alloc(buffers->vert_buf, vert_len); #endif return buffers->vert_buf->data != NULL; } diff --git a/source/blender/gpu/intern/gpu_framebuffer.c b/source/blender/gpu/intern/gpu_framebuffer.c index eabd501f1d5..ffc72718e42 100644 --- a/source/blender/gpu/intern/gpu_framebuffer.c +++ b/source/blender/gpu/intern/gpu_framebuffer.c @@ -300,7 +300,7 @@ void GPU_framebuffer_texture_detach(GPUFrameBuffer *fb, GPUTexture *tex) * Setting GPUAttachment.mip to -1 will leave the texture in this slot. * Setting GPUAttachment.tex to NULL will detach the texture in this slot. **/ -void GPU_framebuffer_config_array(GPUFrameBuffer *fb, const GPUAttachment *config, int config_ct) +void GPU_framebuffer_config_array(GPUFrameBuffer *fb, const GPUAttachment *config, int config_len) { if (config[0].tex) { BLI_assert(GPU_texture_depth(config[0].tex)); @@ -317,7 +317,7 @@ void GPU_framebuffer_config_array(GPUFrameBuffer *fb, const GPUAttachment *confi } int slot = 0; - for (int i = 1; i < config_ct; ++i, ++slot) { + for (int i = 1; i < config_len; ++i, ++slot) { if (config[i].tex != NULL) { BLI_assert(GPU_texture_depth(config[i].tex) == false); gpu_framebuffer_texture_attach_ex(fb, config[i].tex, slot, config[i].layer, config[i].mip); diff --git a/source/blender/gpu/intern/gpu_immediate_util.c b/source/blender/gpu/intern/gpu_immediate_util.c index bad878ef4bf..30672af9c02 100644 --- a/source/blender/gpu/intern/gpu_immediate_util.c +++ b/source/blender/gpu/intern/gpu_immediate_util.c @@ -235,7 +235,7 @@ void imm_draw_box_wire_3d(unsigned pos, float x1, float y1, float x2, float y2) */ void imm_draw_box_checker_2d(float x1, float y1, float x2, float y2) { - unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + uint pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_CHECKER); immUniform4f("color1", 0.15f, 0.15f, 0.15f, 1.0f); diff --git a/source/blender/gpu/intern/gpu_material.c b/source/blender/gpu/intern/gpu_material.c index c224e3e0e32..bd0e35f5ab6 100644 --- a/source/blender/gpu/intern/gpu_material.c +++ b/source/blender/gpu/intern/gpu_material.c @@ -354,7 +354,7 @@ static float eval_integral(float x0, float x1, short falloff_type, float sharpne #undef INTEGRAL_RESOLUTION static void compute_sss_kernel( - GPUSssKernelData *kd, float radii[3], int sample_ct, int falloff_type, float sharpness) + GPUSssKernelData *kd, float radii[3], int sample_len, int falloff_type, float sharpness) { float rad[3]; /* Minimum radius */ @@ -390,13 +390,13 @@ static void compute_sss_kernel( } /* Compute samples locations on the 1d kernel [-1..1] */ - sss_calculate_offsets(kd, sample_ct, SSS_EXPONENT); + sss_calculate_offsets(kd, sample_len, SSS_EXPONENT); /* Weights sum for normalization */ float sum[3] = {0.0f, 0.0f, 0.0f}; /* Compute integral of each sample footprint */ - for (int i = 0; i < sample_ct; i++) { + for (int i = 0; i < sample_len; i++) { float x0, x1; if (i == 0) { @@ -406,8 +406,8 @@ static void compute_sss_kernel( x0 = (kd->kernel[i - 1][3] + kd->kernel[i][3]) / 2.0f; } - if (i == sample_ct - 1) { - x1 = kd->kernel[sample_ct - 1][3] + fabsf(kd->kernel[sample_ct - 2][3] - kd->kernel[sample_ct - 1][3]) / 2.0f; + if (i == sample_len - 1) { + x1 = kd->kernel[sample_len - 1][3] + fabsf(kd->kernel[sample_len - 2][3] - kd->kernel[sample_len - 1][3]) / 2.0f; } else { x1 = (kd->kernel[i][3] + kd->kernel[i + 1][3]) / 2.0f; @@ -428,25 +428,25 @@ static void compute_sss_kernel( for (int i = 0; i < 3; ++i) { if (sum[i] > 0.0f) { /* Normalize */ - for (int j = 0; j < sample_ct; j++) { + for (int j = 0; j < sample_len; j++) { kd->kernel[j][i] /= sum[i]; } } else { /* Avoid 0 kernel sum. */ - kd->kernel[sample_ct / 2][i] = 1.0f; + kd->kernel[sample_len / 2][i] = 1.0f; } } /* Put center sample at the start of the array (to sample first) */ float tmpv[4]; - copy_v4_v4(tmpv, kd->kernel[sample_ct / 2]); - for (int i = sample_ct / 2; i > 0; i--) { + copy_v4_v4(tmpv, kd->kernel[sample_len / 2]); + for (int i = sample_len / 2; i > 0; i--) { copy_v4_v4(kd->kernel[i], kd->kernel[i - 1]); } copy_v4_v4(kd->kernel[0], tmpv); - kd->samples = sample_ct; + kd->samples = sample_len; } #define INTEGRAL_RESOLUTION 512 @@ -523,12 +523,12 @@ void GPU_material_sss_profile_create(GPUMaterial *material, float radii[3], shor } } -struct GPUUniformBuffer *GPU_material_sss_profile_get(GPUMaterial *material, int sample_ct, GPUTexture **tex_profile) +struct GPUUniformBuffer *GPU_material_sss_profile_get(GPUMaterial *material, int sample_len, GPUTexture **tex_profile) { if (!material->sss_enabled) return NULL; - if (material->sss_dirty || (material->sss_samples != sample_ct)) { + if (material->sss_dirty || (material->sss_samples != sample_len)) { GPUSssKernelData kd; float sharpness = material->sss_sharpness; @@ -536,7 +536,7 @@ struct GPUUniformBuffer *GPU_material_sss_profile_get(GPUMaterial *material, int /* XXX Black magic but it seems to fit. Maybe because we integrate -1..1 */ sharpness *= 0.5f; - compute_sss_kernel(&kd, material->sss_radii, sample_ct, material->sss_falloff, sharpness); + compute_sss_kernel(&kd, material->sss_radii, sample_len, material->sss_falloff, sharpness); /* Update / Create UBO */ GPU_uniformbuffer_update(material->sss_profile, &kd); @@ -553,7 +553,7 @@ struct GPUUniformBuffer *GPU_material_sss_profile_get(GPUMaterial *material, int MEM_freeN(translucence_profile); - material->sss_samples = sample_ct; + material->sss_samples = sample_len; material->sss_dirty = false; } diff --git a/source/blender/gpu/intern/gpu_texture.c b/source/blender/gpu/intern/gpu_texture.c index a85a9a9bac3..d9248e06dfb 100644 --- a/source/blender/gpu/intern/gpu_texture.c +++ b/source/blender/gpu/intern/gpu_texture.c @@ -917,12 +917,12 @@ GPUTexture *GPU_texture_create_from_vertbuf(Gwn_VertBuf *vert) Gwn_VertAttr *attr = &format->attribs[0]; /* Detect incompatible cases (not supported by texture buffers) */ - BLI_assert(format->attrib_ct == 1 && vert->vbo_id != 0); - BLI_assert(attr->comp_ct != 3); /* Not until OGL 4.0 */ + BLI_assert(format->attr_len == 1 && vert->vbo_id != 0); + BLI_assert(attr->comp_len != 3); /* Not until OGL 4.0 */ BLI_assert(attr->comp_type != GWN_COMP_I10); BLI_assert(attr->fetch_mode != GWN_FETCH_INT_TO_FLOAT); - unsigned int byte_per_comp = attr->sz / attr->comp_ct; + unsigned int byte_per_comp = attr->sz / attr->comp_len; bool is_uint = ELEM(attr->comp_type, GWN_COMP_U8, GWN_COMP_U16, GWN_COMP_U32); /* Cannot fetch signed int or 32bit ints as normalized float. */ @@ -933,7 +933,7 @@ GPUTexture *GPU_texture_create_from_vertbuf(Gwn_VertBuf *vert) GPUTextureFormat data_type; switch (attr->fetch_mode) { case GWN_FETCH_FLOAT: - switch (attr->comp_ct) { + switch (attr->comp_len) { case 1: data_type = GPU_R32F; break; case 2: data_type = GPU_RG32F; break; // case 3: data_type = GPU_RGB32F; break; /* Not supported */ @@ -941,7 +941,7 @@ GPUTexture *GPU_texture_create_from_vertbuf(Gwn_VertBuf *vert) } break; case GWN_FETCH_INT: - switch (attr->comp_ct) { + switch (attr->comp_len) { case 1: switch (byte_per_comp) { case 1: data_type = (is_uint) ? GPU_R8UI : GPU_R8I; break; @@ -966,7 +966,7 @@ GPUTexture *GPU_texture_create_from_vertbuf(Gwn_VertBuf *vert) } break; case GWN_FETCH_INT_TO_FLOAT_UNIT: - switch (attr->comp_ct) { + switch (attr->comp_len) { case 1: data_type = (byte_per_comp == 1) ? GPU_R8 : GPU_R16; break; case 2: data_type = (byte_per_comp == 1) ? GPU_RG8 : GPU_RG16; break; default: data_type = (byte_per_comp == 1) ? GPU_RGBA8 : GPU_RGBA16; break; |