[Bf-blender-cvs] [68cab3aff63] master: Cleanup: replace attrib w/ attr
Campbell Barton
noreply at git.blender.org
Mon Jan 28 22:33:19 CET 2019
Commit: 68cab3aff63aea95830aa082a160200768d0e826
Author: Campbell Barton
Date: Tue Jan 29 07:46:25 2019 +1100
Branches: master
https://developer.blender.org/rB68cab3aff63aea95830aa082a160200768d0e826
Cleanup: replace attrib w/ attr
Also rename GPUVertexAttribs to GPUVertAttrLayers,
avoids confusion with GPUVertAttr which isn't closely related.
===================================================================
M source/blender/draw/engines/eevee/eevee_lightprobes.c
M source/blender/draw/engines/eevee/eevee_render.c
M source/blender/draw/engines/eevee/shaders/background_vert.glsl
M source/blender/draw/engines/eevee/shaders/lightprobe_geom.glsl
M source/blender/draw/engines/eevee/shaders/lit_surface_vert.glsl
M source/blender/draw/engines/eevee/shaders/shadow_vert.glsl
M source/blender/draw/engines/eevee/shaders/volumetric_geom.glsl
M source/blender/draw/intern/DRW_render.h
M source/blender/draw/intern/draw_cache_impl_curve.c
M source/blender/draw/intern/draw_cache_impl_mesh.c
M source/blender/draw/intern/draw_cache_impl_particles.c
M source/blender/draw/intern/draw_common.c
M source/blender/draw/intern/draw_instance_data.c
M source/blender/draw/intern/draw_instance_data.h
M source/blender/draw/intern/draw_manager.c
M source/blender/draw/intern/draw_manager.h
M source/blender/draw/intern/draw_manager_data.c
M source/blender/draw/modes/object_mode.c
M source/blender/draw/modes/shaders/armature_axes_vert.glsl
M source/blender/draw/modes/shaders/armature_dof_vert.glsl
M source/blender/draw/modes/shaders/armature_envelope_outline_vert.glsl
M source/blender/draw/modes/shaders/armature_envelope_solid_vert.glsl
M source/blender/draw/modes/shaders/armature_shape_outline_vert.glsl
M source/blender/draw/modes/shaders/armature_shape_solid_vert.glsl
M source/blender/draw/modes/shaders/armature_sphere_outline_vert.glsl
M source/blender/draw/modes/shaders/armature_sphere_solid_vert.glsl
M source/blender/draw/modes/shaders/armature_stick_vert.glsl
M source/blender/draw/modes/shaders/common_hair_lib.glsl
M source/blender/draw/modes/shaders/common_hair_refine_vert.glsl
M source/blender/draw/modes/shaders/edit_mesh_overlay_geom_tri.glsl
M source/blender/draw/modes/shaders/object_empty_axes_vert.glsl
M source/blender/draw/modes/shaders/object_mball_handles_vert.glsl
M source/blender/draw/modes/shaders/paint_vertex_frag.glsl
M source/blender/draw/modes/shaders/paint_vertex_vert.glsl
M source/blender/editors/interface/interface_draw.c
M source/blender/editors/object/object_transform.c
M source/blender/editors/sculpt_paint/paint_cursor.c
M source/blender/gpu/GPU_attr_binding.h
M source/blender/gpu/GPU_batch.h
M source/blender/gpu/GPU_draw.h
M source/blender/gpu/GPU_immediate.h
M source/blender/gpu/GPU_material.h
M source/blender/gpu/GPU_shader.h
M source/blender/gpu/GPU_shader_interface.h
M source/blender/gpu/GPU_vertex_buffer.h
M source/blender/gpu/GPU_vertex_format.h
M source/blender/gpu/intern/gpu_attr_binding.c
M source/blender/gpu/intern/gpu_attr_binding_private.h
M source/blender/gpu/intern/gpu_batch.c
M source/blender/gpu/intern/gpu_codegen.c
M source/blender/gpu/intern/gpu_codegen.h
M source/blender/gpu/intern/gpu_draw.c
M source/blender/gpu/intern/gpu_framebuffer.c
M source/blender/gpu/intern/gpu_immediate.c
M source/blender/gpu/intern/gpu_immediate_util.c
M source/blender/gpu/intern/gpu_material.c
M source/blender/gpu/intern/gpu_select_pick.c
M source/blender/gpu/intern/gpu_select_sample_query.c
M source/blender/gpu/intern/gpu_shader.c
M source/blender/gpu/intern/gpu_shader_interface.c
M source/blender/gpu/intern/gpu_shader_private.h
M source/blender/gpu/intern/gpu_texture.c
M source/blender/gpu/intern/gpu_vertex_buffer.c
M source/blender/gpu/intern/gpu_vertex_format.c
M source/blender/gpu/shaders/gpu_shader_2D_nodelink_vert.glsl
M source/blender/gpu/shaders/gpu_shader_instance_camera_vert.glsl
M source/blender/gpu/shaders/gpu_shader_instance_distance_line_vert.glsl
M source/blender/gpu/shaders/gpu_shader_instance_edges_variying_color_vert.glsl
M source/blender/gpu/shaders/gpu_shader_instance_objectspace_variying_color_vert.glsl
M source/blender/gpu/shaders/gpu_shader_instance_screen_aligned_vert.glsl
M source/blender/gpu/shaders/gpu_shader_instance_screenspace_variying_color_vert.glsl
M source/blender/gpu/shaders/gpu_shader_instance_variying_size_variying_color_vert.glsl
M source/blender/gpu/shaders/gpu_shader_instance_variying_size_variying_id_vert.glsl
M source/blender/gpu/shaders/gpu_shader_instance_vert.glsl
M source/blender/gpu/shaders/gpu_shader_material.glsl
M source/blender/python/gpu/gpu_py_vertex_buffer.c
===================================================================
diff --git a/source/blender/draw/engines/eevee/eevee_lightprobes.c b/source/blender/draw/engines/eevee/eevee_lightprobes.c
index 7232db41ee6..4c987391281 100644
--- a/source/blender/draw/engines/eevee/eevee_lightprobes.c
+++ b/source/blender/draw/engines/eevee/eevee_lightprobes.c
@@ -408,8 +408,8 @@ void EEVEE_lightprobes_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedat
/* Planar Display */
DRW_shgroup_instance_format(e_data.format_probe_display_planar, {
- {"probe_id", DRW_ATTRIB_INT, 1},
- {"probe_mat", DRW_ATTRIB_FLOAT, 16},
+ {"probe_id", DRW_ATTR_INT, 1},
+ {"probe_mat", DRW_ATTR_FLOAT, 16},
});
DRWShadingGroup *grp = DRW_shgroup_instance_create(
diff --git a/source/blender/draw/engines/eevee/eevee_render.c b/source/blender/draw/engines/eevee/eevee_render.c
index ac6f0720d7d..34eaa0f46bc 100644
--- a/source/blender/draw/engines/eevee/eevee_render.c
+++ b/source/blender/draw/engines/eevee/eevee_render.c
@@ -478,7 +478,7 @@ void EEVEE_render_draw(EEVEE_Data *vedata, RenderEngine *engine, RenderLayer *rl
/* Sort transparents before the loop. */
DRW_pass_sort_shgroup_z(psl->transparent_pass);
- /* Push instances attribs to the GPU. */
+ /* Push instances attributes to the GPU. */
DRW_render_instance_buffer_finish();
/* Need to be called after DRW_render_instance_buffer_finish() */
diff --git a/source/blender/draw/engines/eevee/shaders/background_vert.glsl b/source/blender/draw/engines/eevee/shaders/background_vert.glsl
index 380d6d96491..8b4bc3382f4 100644
--- a/source/blender/draw/engines/eevee/shaders/background_vert.glsl
+++ b/source/blender/draw/engines/eevee/shaders/background_vert.glsl
@@ -21,7 +21,7 @@ void main()
worldNormal = viewNormal = normalize(-viewPosition);
#endif
-#ifdef ATTRIB
- pass_attrib(viewPosition);
+#ifdef USE_ATTR
+ pass_attr(viewPosition);
#endif
}
diff --git a/source/blender/draw/engines/eevee/shaders/lightprobe_geom.glsl b/source/blender/draw/engines/eevee/shaders/lightprobe_geom.glsl
index 2ce37d867b7..996b507239d 100644
--- a/source/blender/draw/engines/eevee/shaders/lightprobe_geom.glsl
+++ b/source/blender/draw/engines/eevee/shaders/lightprobe_geom.glsl
@@ -24,8 +24,8 @@ void main() {
for (int v = 0; v < 3; ++v) {
gl_Position = vPos[v];
worldPosition = x_axis[fFace] * vPos[v].x + y_axis[fFace] * vPos[v].y + maj_axes[fFace];
-#ifdef ATTRIB
- pass_attrib(v);
+#ifdef USE_ATTR
+ pass_attr(v);
#endif
EmitVertex();
}
diff --git a/source/blender/draw/engines/eevee/shaders/lit_surface_vert.glsl b/source/blender/draw/engines/eevee/shaders/lit_surface_vert.glsl
index a6e6f1fac42..ef7213cd21e 100644
--- a/source/blender/draw/engines/eevee/shaders/lit_surface_vert.glsl
+++ b/source/blender/draw/engines/eevee/shaders/lit_surface_vert.glsl
@@ -2,7 +2,7 @@
uniform mat4 ModelViewProjectionMatrix;
uniform mat4 ModelViewMatrix;
uniform mat3 WorldNormalMatrix;
-#ifndef ATTRIB
+#ifndef USE_ATTR
uniform mat4 ModelMatrix;
uniform mat3 NormalMatrix;
uniform mat4 ModelMatrixInverse;
@@ -73,7 +73,7 @@ void main()
/* Used for planar reflections */
gl_ClipDistance[0] = dot(vec4(worldPosition, 1.0), ClipPlanes[0]);
-#ifdef ATTRIB
- pass_attrib(pos);
+#ifdef USE_ATTR
+ pass_attr(pos);
#endif
}
diff --git a/source/blender/draw/engines/eevee/shaders/shadow_vert.glsl b/source/blender/draw/engines/eevee/shaders/shadow_vert.glsl
index cfd24ae8d65..2583c7c8765 100644
--- a/source/blender/draw/engines/eevee/shaders/shadow_vert.glsl
+++ b/source/blender/draw/engines/eevee/shaders/shadow_vert.glsl
@@ -3,7 +3,7 @@ uniform mat4 ModelViewProjectionMatrix;
#ifdef MESH_SHADER
uniform mat4 ModelViewMatrix;
uniform mat3 WorldNormalMatrix;
-# ifndef ATTRIB
+# ifndef USE_ATTR
uniform mat4 ModelMatrix;
uniform mat3 NormalMatrix;
# endif
@@ -26,8 +26,8 @@ void main() {
worldPosition = (ModelMatrix * vec4(pos, 1.0)).xyz;
viewNormal = normalize(NormalMatrix * nor);
worldNormal = normalize(WorldNormalMatrix * nor);
-#ifdef ATTRIB
- pass_attrib(pos);
+#ifdef USE_ATTR
+ pass_attr(pos);
#endif
#endif
}
diff --git a/source/blender/draw/engines/eevee/shaders/volumetric_geom.glsl b/source/blender/draw/engines/eevee/shaders/volumetric_geom.glsl
index d435bda4f60..72545302fd3 100644
--- a/source/blender/draw/engines/eevee/shaders/volumetric_geom.glsl
+++ b/source/blender/draw/engines/eevee/shaders/volumetric_geom.glsl
@@ -17,20 +17,20 @@ flat out int slice;
void main() {
gl_Layer = slice = int(vPos[0].z);
-#ifdef ATTRIB
- pass_attrib(0);
+#ifdef USE_ATTR
+ pass_attr(0);
#endif
gl_Position = vPos[0].xyww;
EmitVertex();
-#ifdef ATTRIB
- pass_attrib(1);
+#ifdef USE_ATTR
+ pass_attr(1);
#endif
gl_Position = vPos[1].xyww;
EmitVertex();
-#ifdef ATTRIB
- pass_attrib(2);
+#ifdef USE_ATTR
+ pass_attr(2);
#endif
gl_Position = vPos[2].xyww;
EmitVertex();
@@ -46,20 +46,20 @@ void main() {
void main() {
gl_Layer = slice = int(vPos[0].z);
-#ifdef ATTRIB
- pass_attrib(0);
+#ifdef USE_ATTR
+ pass_attr(0);
#endif
gl_Position = vPos[0].xyww;
EmitVertex();
-#ifdef ATTRIB
- pass_attrib(1);
+#ifdef USE_ATTR
+ pass_attr(1);
#endif
gl_Position = vPos[1].xyww;
EmitVertex();
-#ifdef ATTRIB
- pass_attrib(2);
+#ifdef USE_ATTR
+ pass_attr(2);
#endif
gl_Position = vPos[2].xyww;
EmitVertex();
diff --git a/source/blender/draw/intern/DRW_render.h b/source/blender/draw/intern/DRW_render.h
index 5bda5bc58b4..1c55d0f6347 100644
--- a/source/blender/draw/intern/DRW_render.h
+++ b/source/blender/draw/intern/DRW_render.h
@@ -319,21 +319,21 @@ typedef enum {
#define DRW_STATE_DEFAULT (DRW_STATE_WRITE_DEPTH | DRW_STATE_WRITE_COLOR | DRW_STATE_DEPTH_LESS_EQUAL)
typedef enum {
- DRW_ATTRIB_INT,
- DRW_ATTRIB_FLOAT,
-} DRWAttribType;
+ DRW_ATTR_INT,
+ DRW_ATTR_FLOAT,
+} eDRWAttrType;
-typedef struct DRWInstanceAttribFormat {
+typedef struct DRWInstanceAttrFormat {
char name[32];
- DRWAttribType type;
+ eDRWAttrType type;
int components;
-} DRWInstanceAttribFormat;
+} DRWInstanceAttrFormat;
-struct GPUVertFormat *DRW_shgroup_instance_format_array(const DRWInstanceAttribFormat attribs[], int arraysize);
+struct GPUVertFormat *DRW_shgroup_instance_format_array(const DRWInstanceAttrFormat attrs[], int arraysize);
#define DRW_shgroup_instance_format(format, ...) do { \
if (format == NULL) { \
- DRWInstanceAttribFormat drw_format[] = __VA_ARGS__;\
- format = DRW_shgroup_instance_format_array(drw_format, (sizeof(drw_format) / sizeof(DRWInstanceAttribFormat))); \
+ DRWInstanceAttrFormat drw_format[] = __VA_ARGS__;\
+ format = DRW_shgroup_instance_format_array(drw_format, (sizeof(drw_format) / sizeof(DRWInstanceAttrFormat))); \
} \
} while (0)
@@ -383,7 +383,7 @@ void DRW_shgroup_call_object_add_ex(
void DRW_shgroup_call_object_add_with_callback(
DRWShadingGroup *shgroup, struct GPUBatch *geom, struct Object *ob, struct Material *ma,
DRWCallVisibilityFn *callback, void *user_data);
-/* Used for drawing a batch with instancing without instance attribs. */
+/* Used for drawing a batch with instancing without instance attributes. */
void DRW_shgroup_call_instances_add(
DRWShadingGroup *shgroup, struct GPUBatch *geom, float (*obmat)[4], uint *count);
void DRW_shgroup_call_object_instances_add(
diff --git a/source/blender/draw/intern/draw_cache_impl_curve.c b/source/blender/draw/intern/draw_cache_impl_curve.c
index b18168a6816..742ca20ba83 100644
--- a/source/blender/draw/intern/draw_cache_impl_curve.c
+++ b/source/blender/draw/intern/draw_cache_impl_curve.c
@@ -304,16 +304,16 @@ static int curve_render_data_normal_len_get(const CurveRenderData *rdata)
static void curve_cd_calc_used_gpu_layers(int *cd_layers, struct GPUMaterial **gpumat_array, int gpumat_array_len)
{
- GPUVertexAttribs gattribs = {{{0}}};
+ GPUVertAttrLayers gpu_attrs = {{{0}}};
for (int i = 0; i < gpumat_array_len; i++) {
struct GPUMaterial *gpumat = gpumat_array[i];
if (gpumat == NULL) {
continue;
}
- GPU_material_vertex_attributes(gpumat, &gattribs);
- for (int j = 0; j < gattribs.totlayer; j++) {
- const char *name = gattribs.layer[j].name;
- int type = gattribs.layer[j].type;
+ GPU_material_vertex_attrs(gpumat, &gpu_attrs);
+ for (int j = 0; j < gpu_attrs.totlayer; j++) {
+ const char *name = gpu_attrs.layer[j].name;
+ int type = gpu_attrs.layer[j].type;
/* Curves cannot have named layers.
* Note: We could relax this assumption later. */
@@ -662,7 +662,7 @@ static void curve_create_edit_curves_nor(CurveRenderData *rdata, GPUVertBuf *vbo
GPUPackedNormal pnor = GPU_normal_convert_i10_v3(nor);
GPUPackedNormal ptan = GPU_normal_convert_i10_v3(bevp->dir);
- /* Only set attribs for one vertex. */
+ /* Only set attributes for one vertex. */
GPU_vertbuf_attr_set(vbo_curves_nor, attr_id.pos, vbo_len_used, bevp->vec);
GPU_vertbuf_attr_set(vbo_curves_nor, attr_id.rad, vbo_len_used, &bevp->radius);
GPU_vertbuf_attr_set(vbo_curves_nor, attr_id.nor, vbo_len_used, &pnor);
@@ -897,7 +897,7 @@ void DRW_curve_batch_cache_create_requested(Object *ob)
Curve *cu = ob->data;
CurveBatchCache *cache = curve_batch_cache_get(cu);
- /* Verify that all surface batches have needed attrib layers. */
+ /* Verify that all surface batches have needed attribute layers. */
/* TODO(fclem): We could be a bit smarter here and only do it per material. */
for (int i = 0; i < cache->mat_len; ++i) {
if ((cache->cd_used & cache->cd_needed) != cache->cd_needed) {
diff --git a/source/blender/draw/intern/draw_cache_impl_mesh.c b/source/blender/draw/intern/draw_cache_impl_mesh.c
index 75ec4fa980f..94d5407983f 100644
--- a/source/blender/draw/intern/draw_cache_impl_mesh.c
+++ b/source/blender/draw/intern/draw_cache_impl_mesh.c
@@ -376,15 +376,15 @@ static void mesh_cd_calc_used_gpu_layers(
const CustomData *cd_ldata = (me->edit_btmesh) ? &me->edit_btmesh->bm->ldata : &me->ldata;
/* See: DM_vertex_attributes_from_gpu for similar logic */
- GPUVertexAttribs gattribs = {{{0}}};
+ GPUVertAttrLayers gpu_attrs = {{{0}}};
for (int i = 0; i < gpumat_array_len; i++) {
GPUMaterial *gpumat = gpumat_array[i];
if (gpumat) {
- GPU_material_vertex_attributes(gpumat, &gattribs);
- for (int j = 0; j < gattribs
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list