Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/intern
diff options
context:
space:
mode:
Diffstat (limited to 'intern')
-rw-r--r--intern/cycles/blender/addon/properties.py24
-rw-r--r--intern/cycles/blender/addon/ui.py96
-rw-r--r--intern/cycles/blender/addon/version_update.py79
-rw-r--r--intern/cycles/blender/blender_camera.cpp2
-rw-r--r--intern/cycles/blender/blender_object.cpp66
-rw-r--r--intern/cycles/blender/blender_shader.cpp26
-rw-r--r--intern/cycles/blender/blender_sync.cpp8
-rw-r--r--intern/cycles/blender/blender_sync.h2
-rw-r--r--intern/gawain/gawain/gwn_batch.h6
-rw-r--r--intern/gawain/gawain/gwn_element.h10
-rw-r--r--intern/gawain/gawain/gwn_immediate.h8
-rw-r--r--intern/gawain/gawain/gwn_shader_interface.h2
-rw-r--r--intern/gawain/gawain/gwn_vertex_buffer.h12
-rw-r--r--intern/gawain/gawain/gwn_vertex_format.h10
-rw-r--r--intern/gawain/gawain/gwn_vertex_format_private.h2
-rw-r--r--intern/gawain/src/gwn_attr_binding.c4
-rw-r--r--intern/gawain/src/gwn_batch.c32
-rw-r--r--intern/gawain/src/gwn_buffer_id.cpp6
-rw-r--r--intern/gawain/src/gwn_element.c48
-rw-r--r--intern/gawain/src/gwn_immediate.c146
-rw-r--r--intern/gawain/src/gwn_shader_interface.c32
-rw-r--r--intern/gawain/src/gwn_vertex_array_id.cpp4
-rw-r--r--intern/gawain/src/gwn_vertex_buffer.c42
-rw-r--r--intern/gawain/src/gwn_vertex_format.c50
24 files changed, 339 insertions, 378 deletions
diff --git a/intern/cycles/blender/addon/properties.py b/intern/cycles/blender/addon/properties.py
index df6949f2095..85947b4bd28 100644
--- a/intern/cycles/blender/addon/properties.py
+++ b/intern/cycles/blender/addon/properties.py
@@ -887,17 +887,17 @@ class CyclesMaterialSettings(bpy.types.PropertyGroup):
del bpy.types.Material.cycles
-class CyclesLampSettings(bpy.types.PropertyGroup):
+class CyclesLightSettings(bpy.types.PropertyGroup):
@classmethod
def register(cls):
- bpy.types.Lamp.cycles = PointerProperty(
- name="Cycles Lamp Settings",
- description="Cycles lamp settings",
+ bpy.types.Light.cycles = PointerProperty(
+ name="Cycles Light Settings",
+ description="Cycles light settings",
type=cls,
)
cls.cast_shadow = BoolProperty(
name="Cast Shadow",
- description="Lamp casts shadows",
+ description="Light casts shadows",
default=True,
)
cls.samples = IntProperty(
@@ -914,20 +914,20 @@ class CyclesLampSettings(bpy.types.PropertyGroup):
)
cls.use_multiple_importance_sampling = BoolProperty(
name="Multiple Importance Sample",
- description="Use multiple importance sampling for the lamp, "
- "reduces noise for area lamps and sharp glossy materials",
+ description="Use multiple importance sampling for the light, "
+ "reduces noise for area lights and sharp glossy materials",
default=True,
)
cls.is_portal = BoolProperty(
name="Is Portal",
- description="Use this area lamp to guide sampling of the background, "
- "note that this will make the lamp invisible",
+ description="Use this area light to guide sampling of the background, "
+ "note that this will make the light invisible",
default=False,
)
@classmethod
def unregister(cls):
- del bpy.types.Lamp.cycles
+ del bpy.types.Light.cycles
class CyclesWorldSettings(bpy.types.PropertyGroup):
@@ -1460,7 +1460,7 @@ def register():
bpy.utils.register_class(CyclesRenderSettings)
bpy.utils.register_class(CyclesCameraSettings)
bpy.utils.register_class(CyclesMaterialSettings)
- bpy.utils.register_class(CyclesLampSettings)
+ bpy.utils.register_class(CyclesLightSettings)
bpy.utils.register_class(CyclesWorldSettings)
bpy.utils.register_class(CyclesVisibilitySettings)
bpy.utils.register_class(CyclesMeshSettings)
@@ -1475,7 +1475,7 @@ def unregister():
bpy.utils.unregister_class(CyclesRenderSettings)
bpy.utils.unregister_class(CyclesCameraSettings)
bpy.utils.unregister_class(CyclesMaterialSettings)
- bpy.utils.unregister_class(CyclesLampSettings)
+ bpy.utils.unregister_class(CyclesLightSettings)
bpy.utils.unregister_class(CyclesWorldSettings)
bpy.utils.unregister_class(CyclesMeshSettings)
bpy.utils.unregister_class(CyclesObjectSettings)
diff --git a/intern/cycles/blender/addon/ui.py b/intern/cycles/blender/addon/ui.py
index 7a4ed4fbdaf..6688874de49 100644
--- a/intern/cycles/blender/addon/ui.py
+++ b/intern/cycles/blender/addon/ui.py
@@ -1008,7 +1008,7 @@ class CYCLES_OBJECT_PT_cycles_settings(CyclesButtonsPanel, Panel):
def poll(cls, context):
ob = context.object
return (CyclesButtonsPanel.poll(context) and
- ob and ((ob.type in {'MESH', 'CURVE', 'SURFACE', 'FONT', 'META', 'LAMP'}) or
+ ob and ((ob.type in {'MESH', 'CURVE', 'SURFACE', 'FONT', 'META', 'LIGHT'}) or
(ob.dupli_type == 'COLLECTION' and ob.dupli_group)))
def draw(self, context):
@@ -1029,7 +1029,7 @@ class CYCLES_OBJECT_PT_cycles_settings(CyclesButtonsPanel, Panel):
flow.prop(visibility, "transmission")
flow.prop(visibility, "scatter")
- if ob.type != 'LAMP':
+ if ob.type != 'LIGHT':
flow.prop(visibility, "shadow")
row = layout.row()
@@ -1049,7 +1049,7 @@ class CYCLES_OBJECT_PT_cycles_settings(CyclesButtonsPanel, Panel):
class CYCLES_OT_use_shading_nodes(Operator):
- """Enable nodes on a material, world or lamp"""
+ """Enable nodes on a material, world or light"""
bl_idname = "cycles.use_shading_nodes"
bl_label = "Use Nodes"
@@ -1063,8 +1063,8 @@ class CYCLES_OT_use_shading_nodes(Operator):
context.material.use_nodes = True
elif context.world:
context.world.use_nodes = True
- elif context.lamp:
- context.lamp.use_nodes = True
+ elif context.light:
+ context.light.use_nodes = True
return {'FINISHED'}
@@ -1089,7 +1089,7 @@ def panel_node_draw(layout, id_data, output_type, input_name):
return True
-class CYCLES_LAMP_PT_preview(CyclesButtonsPanel, Panel):
+class CYCLES_LIGHT_PT_preview(CyclesButtonsPanel, Panel):
bl_label = "Preview"
bl_context = "data"
bl_options = {'DEFAULT_CLOSED'}
@@ -1097,52 +1097,52 @@ class CYCLES_LAMP_PT_preview(CyclesButtonsPanel, Panel):
@classmethod
def poll(cls, context):
return (
- context.lamp and
+ context.light and
not (
- context.lamp.type == 'AREA' and
- context.lamp.cycles.is_portal
+ context.light.type == 'AREA' and
+ context.light.cycles.is_portal
) and
CyclesButtonsPanel.poll(context)
)
def draw(self, context):
- self.layout.template_preview(context.lamp)
+ self.layout.template_preview(context.light)
-class CYCLES_LAMP_PT_lamp(CyclesButtonsPanel, Panel):
- bl_label = "Lamp"
+class CYCLES_LIGHT_PT_light(CyclesButtonsPanel, Panel):
+ bl_label = "Light"
bl_context = "data"
@classmethod
def poll(cls, context):
- return context.lamp and CyclesButtonsPanel.poll(context)
+ return context.light and CyclesButtonsPanel.poll(context)
def draw(self, context):
layout = self.layout
- lamp = context.lamp
- clamp = lamp.cycles
+ light = context.light
+ clamp = light.cycles
# cscene = context.scene.cycles
- layout.prop(lamp, "type", expand=True)
+ layout.prop(light, "type", expand=True)
layout.use_property_split = True
col = layout.column()
- if lamp.type in {'POINT', 'SUN', 'SPOT'}:
- col.prop(lamp, "shadow_soft_size", text="Size")
- elif lamp.type == 'AREA':
- col.prop(lamp, "shape", text="Shape")
+ if light.type in {'POINT', 'SUN', 'SPOT'}:
+ col.prop(light, "shadow_soft_size", text="Size")
+ elif light.type == 'AREA':
+ col.prop(light, "shape", text="Shape")
sub = col.column(align=True)
- if lamp.shape in {'SQUARE', 'DISK'}:
- sub.prop(lamp, "size")
- elif lamp.shape in {'RECTANGLE', 'ELLIPSE'}:
- sub.prop(lamp, "size", text="Size X")
- sub.prop(lamp, "size_y", text="Y")
+ if light.shape in {'SQUARE', 'DISK'}:
+ sub.prop(light, "size")
+ elif light.shape in {'RECTANGLE', 'ELLIPSE'}:
+ sub.prop(light, "size", text="Size X")
+ sub.prop(light, "size_y", text="Y")
- if not (lamp.type == 'AREA' and clamp.is_portal):
+ if not (light.type == 'AREA' and clamp.is_portal):
sub = col.column()
if use_branched_path(context):
subsub = sub.row(align=True)
@@ -1151,53 +1151,53 @@ class CYCLES_LAMP_PT_lamp(CyclesButtonsPanel, Panel):
sub.prop(clamp, "max_bounces")
sub = col.column(align=True)
- sub.active = not (lamp.type == 'AREA' and clamp.is_portal)
+ sub.active = not (light.type == 'AREA' and clamp.is_portal)
sub.prop(clamp, "cast_shadow")
sub.prop(clamp, "use_multiple_importance_sampling", text="Multiple Importance")
- if lamp.type == 'AREA':
+ if light.type == 'AREA':
col.prop(clamp, "is_portal", text="Portal")
- if lamp.type == 'HEMI':
- layout.label(text="Not supported, interpreted as sun lamp")
+ if light.type == 'HEMI':
+ layout.label(text="Not supported, interpreted as sun light")
-class CYCLES_LAMP_PT_nodes(CyclesButtonsPanel, Panel):
+class CYCLES_LIGHT_PT_nodes(CyclesButtonsPanel, Panel):
bl_label = "Nodes"
bl_context = "data"
@classmethod
def poll(cls, context):
- return context.lamp and not (context.lamp.type == 'AREA' and
- context.lamp.cycles.is_portal) and \
+ return context.light and not (context.light.type == 'AREA' and
+ context.light.cycles.is_portal) and \
CyclesButtonsPanel.poll(context)
def draw(self, context):
layout = self.layout
- lamp = context.lamp
- if not panel_node_draw(layout, lamp, 'OUTPUT_LAMP', 'Surface'):
- layout.prop(lamp, "color")
+ light = context.light
+ if not panel_node_draw(layout, light, 'OUTPUT_LIGHT', 'Surface'):
+ layout.prop(light, "color")
-class CYCLES_LAMP_PT_spot(CyclesButtonsPanel, Panel):
+class CYCLES_LIGHT_PT_spot(CyclesButtonsPanel, Panel):
bl_label = "Spot Shape"
bl_context = "data"
@classmethod
def poll(cls, context):
- lamp = context.lamp
- return (lamp and lamp.type == 'SPOT') and CyclesButtonsPanel.poll(context)
+ light = context.light
+ return (light and light.type == 'SPOT') and CyclesButtonsPanel.poll(context)
def draw(self, context):
layout = self.layout
- lamp = context.lamp
+ light = context.light
layout.use_property_split = True
col = layout.column()
- col.prop(lamp, "spot_size", text="Size")
- col.prop(lamp, "spot_blend", text="Blend", slider=True)
- col.prop(lamp, "show_cone")
+ col.prop(light, "spot_size", text="Size")
+ col.prop(light, "spot_blend", text="Blend", slider=True)
+ col.prop(light, "show_cone")
class CYCLES_WORLD_PT_preview(CyclesButtonsPanel, Panel):
@@ -1789,7 +1789,7 @@ def get_panels():
'DATA_PT_area',
'DATA_PT_camera_dof',
'DATA_PT_falloff_curve',
- 'DATA_PT_lamp',
+ 'DATA_PT_light',
'DATA_PT_preview',
'DATA_PT_spot',
'MATERIAL_PT_context_material',
@@ -1843,10 +1843,10 @@ classes = (
CYCLES_OBJECT_PT_motion_blur,
CYCLES_OBJECT_PT_cycles_settings,
CYCLES_OT_use_shading_nodes,
- CYCLES_LAMP_PT_preview,
- CYCLES_LAMP_PT_lamp,
- CYCLES_LAMP_PT_nodes,
- CYCLES_LAMP_PT_spot,
+ CYCLES_LIGHT_PT_preview,
+ CYCLES_LIGHT_PT_light,
+ CYCLES_LIGHT_PT_nodes,
+ CYCLES_LIGHT_PT_spot,
CYCLES_WORLD_PT_preview,
CYCLES_WORLD_PT_surface,
CYCLES_WORLD_PT_volume,
diff --git a/intern/cycles/blender/addon/version_update.py b/intern/cycles/blender/addon/version_update.py
index 3334ccd65fd..679c3e6a437 100644
--- a/intern/cycles/blender/addon/version_update.py
+++ b/intern/cycles/blender/addon/version_update.py
@@ -22,45 +22,6 @@ import math
from bpy.app.handlers import persistent
-def check_is_new_shading_ntree(node_tree):
- for node in node_tree.nodes:
- # If material has any node with ONLY new shading system
- # compatibility then it's considered a Cycles material
- # and versioning code would need to perform on it.
- #
- # We can not check for whether NEW_SHADING in compatibility
- # because some nodes could have compatibility with both old
- # and new shading system and they can't be used for any
- # decision here.
- if node.shading_compatibility == {'NEW_SHADING'}:
- return True
-
- # If node is only compatible with old shading system
- # then material can not be Cycles material and we
- # can stopiterating nodes now.
- if node.shading_compatibility == {'OLD_SHADING'}:
- return False
- return False
-
-
-def check_is_new_shading_material(material):
- if not material.node_tree:
- return False
- return check_is_new_shading_ntree(material.node_tree)
-
-
-def check_is_new_shading_world(world):
- if not world.node_tree:
- return False
- return check_is_new_shading_ntree(world.node_tree)
-
-
-def check_is_new_shading_lamp(lamp):
- if not lamp.node_tree:
- return False
- return check_is_new_shading_ntree(lamp.node_tree)
-
-
def foreach_notree_node(nodetree, callback, traversed):
if nodetree in traversed:
return
@@ -74,20 +35,20 @@ def foreach_notree_node(nodetree, callback, traversed):
def foreach_cycles_node(callback):
traversed = set()
for material in bpy.data.materials:
- if check_is_new_shading_material(material):
- foreach_notree_node(material.node_tree,
- callback,
- traversed)
+ if material.node_tree:
+ foreach_notree_node(material.node_tree,
+ callback,
+ traversed)
for world in bpy.data.worlds:
- if check_is_new_shading_world(world):
- foreach_notree_node(world.node_tree,
- callback,
- traversed)
- for lamp in bpy.data.lamps:
- if check_is_new_shading_world(lamp):
- foreach_notree_node(lamp.node_tree,
- callback,
- traversed)
+ if world.node_tree:
+ foreach_notree_node(world.node_tree,
+ callback,
+ traversed)
+ for light in bpy.data.lights:
+ if light.node_tree:
+ foreach_notree_node(light.node_tree,
+ callback,
+ traversed)
def displacement_node_insert(material, nodetree, traversed):
@@ -128,7 +89,7 @@ def displacement_node_insert(material, nodetree, traversed):
def displacement_nodes_insert():
traversed = set()
for material in bpy.data.materials:
- if check_is_new_shading_material(material):
+ if material.node_tree:
displacement_node_insert(material, material.node_tree, traversed)
def displacement_principled_nodes(node):
@@ -186,7 +147,7 @@ def square_roughness_node_insert(material, nodetree, traversed):
def square_roughness_nodes_insert():
traversed = set()
for material in bpy.data.materials:
- if check_is_new_shading_material(material):
+ if material.node_tree:
square_roughness_node_insert(material, material.node_tree, traversed)
@@ -301,7 +262,7 @@ def ambient_occlusion_node_relink(material, nodetree, traversed):
def ambient_occlusion_nodes_relink():
traversed = set()
for material in bpy.data.materials:
- if check_is_new_shading_material(material):
+ if material.node_tree:
ambient_occlusion_node_relink(material, material.node_tree, traversed)
@@ -393,12 +354,12 @@ def do_versions(self):
if not cscene.is_property_set("tile_order"):
cscene.tile_order = 'CENTER'
- for lamp in bpy.data.lamps:
- clamp = lamp.cycles
+ for light in bpy.data.lights:
+ clight = light.cycles
# MIS
- if not clamp.is_property_set("use_multiple_importance_sampling"):
- clamp.use_multiple_importance_sampling = False
+ if not clight.is_property_set("use_multiple_importance_sampling"):
+ clight.use_multiple_importance_sampling = False
for mat in bpy.data.materials:
cmat = mat.cycles
diff --git a/intern/cycles/blender/blender_camera.cpp b/intern/cycles/blender/blender_camera.cpp
index 228f0645f94..fc86094949f 100644
--- a/intern/cycles/blender/blender_camera.cpp
+++ b/intern/cycles/blender/blender_camera.cpp
@@ -232,7 +232,7 @@ static void blender_camera_from_object(BlenderCamera *bcam,
bcam->motion_steps = object_motion_steps(b_ob, b_ob);
}
else {
- /* from lamp not implemented yet */
+ /* from light not implemented yet */
}
}
diff --git a/intern/cycles/blender/blender_object.cpp b/intern/cycles/blender/blender_object.cpp
index 70d6092622a..ed01d728931 100644
--- a/intern/cycles/blender/blender_object.cpp
+++ b/intern/cycles/blender/blender_object.cpp
@@ -89,7 +89,7 @@ bool BlenderSync::object_is_light(BL::Object& b_ob)
{
BL::ID b_ob_data = b_ob.data();
- return (b_ob_data && b_ob_data.is_a(&RNA_Lamp));
+ return (b_ob_data && b_ob_data.is_a(&RNA_Light));
}
static uint object_ray_visibility(BL::Object& b_ob)
@@ -127,56 +127,56 @@ void BlenderSync::sync_light(BL::Object& b_parent,
return;
}
- BL::Lamp b_lamp(b_ob.data());
+ BL::Light b_light(b_ob.data());
/* type */
- switch(b_lamp.type()) {
- case BL::Lamp::type_POINT: {
- BL::PointLamp b_point_lamp(b_lamp);
- light->size = b_point_lamp.shadow_soft_size();
+ switch(b_light.type()) {
+ case BL::Light::type_POINT: {
+ BL::PointLight b_point_light(b_light);
+ light->size = b_point_light.shadow_soft_size();
light->type = LIGHT_POINT;
break;
}
- case BL::Lamp::type_SPOT: {
- BL::SpotLamp b_spot_lamp(b_lamp);
- light->size = b_spot_lamp.shadow_soft_size();
+ case BL::Light::type_SPOT: {
+ BL::SpotLight b_spot_light(b_light);
+ light->size = b_spot_light.shadow_soft_size();
light->type = LIGHT_SPOT;
- light->spot_angle = b_spot_lamp.spot_size();
- light->spot_smooth = b_spot_lamp.spot_blend();
+ light->spot_angle = b_spot_light.spot_size();
+ light->spot_smooth = b_spot_light.spot_blend();
break;
}
- case BL::Lamp::type_HEMI: {
+ case BL::Light::type_HEMI: {
light->type = LIGHT_DISTANT;
light->size = 0.0f;
break;
}
- case BL::Lamp::type_SUN: {
- BL::SunLamp b_sun_lamp(b_lamp);
- light->size = b_sun_lamp.shadow_soft_size();
+ case BL::Light::type_SUN: {
+ BL::SunLight b_sun_light(b_light);
+ light->size = b_sun_light.shadow_soft_size();
light->type = LIGHT_DISTANT;
break;
}
- case BL::Lamp::type_AREA: {
- BL::AreaLamp b_area_lamp(b_lamp);
+ case BL::Light::type_AREA: {
+ BL::AreaLight b_area_light(b_light);
light->size = 1.0f;
light->axisu = transform_get_column(&tfm, 0);
light->axisv = transform_get_column(&tfm, 1);
- light->sizeu = b_area_lamp.size();
- switch(b_area_lamp.shape()) {
- case BL::AreaLamp::shape_SQUARE:
+ light->sizeu = b_area_light.size();
+ switch(b_area_light.shape()) {
+ case BL::AreaLight::shape_SQUARE:
light->sizev = light->sizeu;
light->round = false;
break;
- case BL::AreaLamp::shape_RECTANGLE:
- light->sizev = b_area_lamp.size_y();
+ case BL::AreaLight::shape_RECTANGLE:
+ light->sizev = b_area_light.size_y();
light->round = false;
break;
- case BL::AreaLamp::shape_DISK:
+ case BL::AreaLight::shape_DISK:
light->sizev = light->sizeu;
light->round = true;
break;
- case BL::AreaLamp::shape_ELLIPSE:
- light->sizev = b_area_lamp.size_y();
+ case BL::AreaLight::shape_ELLIPSE:
+ light->sizev = b_area_light.size_y();
light->round = true;
break;
}
@@ -192,22 +192,22 @@ void BlenderSync::sync_light(BL::Object& b_parent,
/* shader */
vector<Shader*> used_shaders;
- find_shader(b_lamp, used_shaders, scene->default_light);
+ find_shader(b_light, used_shaders, scene->default_light);
light->shader = used_shaders[0];
/* shadow */
PointerRNA cscene = RNA_pointer_get(&b_scene.ptr, "cycles");
- PointerRNA clamp = RNA_pointer_get(&b_lamp.ptr, "cycles");
- light->cast_shadow = get_boolean(clamp, "cast_shadow");
- light->use_mis = get_boolean(clamp, "use_multiple_importance_sampling");
+ PointerRNA clight = RNA_pointer_get(&b_light.ptr, "cycles");
+ light->cast_shadow = get_boolean(clight, "cast_shadow");
+ light->use_mis = get_boolean(clight, "use_multiple_importance_sampling");
- int samples = get_int(clamp, "samples");
+ int samples = get_int(clight, "samples");
if(get_boolean(cscene, "use_square_samples"))
light->samples = samples * samples;
else
light->samples = samples;
- light->max_bounces = get_int(clamp, "max_bounces");
+ light->max_bounces = get_int(clight, "max_bounces");
if(b_ob != b_ob_instance) {
light->random_id = random_id;
@@ -217,7 +217,7 @@ void BlenderSync::sync_light(BL::Object& b_parent,
}
if(light->type == LIGHT_AREA)
- light->is_portal = get_boolean(clamp, "is_portal");
+ light->is_portal = get_boolean(clight, "is_portal");
else
light->is_portal = false;
@@ -315,7 +315,7 @@ Object *BlenderSync::sync_object(BL::Depsgraph& b_depsgraph,
/* light is handled separately */
if(object_is_light(b_ob)) {
- /* don't use lamps for excluded layers used as mask layer */
+ /* don't use lights for excluded layers used as mask layer */
if(!motion && !((layer_flag & view_layer.holdout_layer) &&
(layer_flag & view_layer.exclude_layer)))
{
diff --git a/intern/cycles/blender/blender_shader.cpp b/intern/cycles/blender/blender_shader.cpp
index e2463200001..e254ee6f68d 100644
--- a/intern/cycles/blender/blender_shader.cpp
+++ b/intern/cycles/blender/blender_shader.cpp
@@ -1393,45 +1393,45 @@ void BlenderSync::sync_world(BL::Depsgraph& b_depsgraph, bool update_all)
background->tag_update(scene);
}
-/* Sync Lamps */
+/* Sync Lights */
-void BlenderSync::sync_lamps(BL::Depsgraph& b_depsgraph, bool update_all)
+void BlenderSync::sync_lights(BL::Depsgraph& b_depsgraph, bool update_all)
{
shader_map.set_default(scene->default_light);
BL::Depsgraph::ids_iterator b_id;
for(b_depsgraph.ids.begin(b_id); b_id != b_depsgraph.ids.end(); ++b_id) {
- if (!b_id->is_a(&RNA_Lamp)) {
+ if (!b_id->is_a(&RNA_Light)) {
continue;
}
- BL::Lamp b_lamp(*b_id);
+ BL::Light b_light(*b_id);
Shader *shader;
/* test if we need to sync */
- if(shader_map.sync(&shader, b_lamp) || update_all) {
+ if(shader_map.sync(&shader, b_light) || update_all) {
ShaderGraph *graph = new ShaderGraph();
/* create nodes */
- if(b_lamp.use_nodes() && b_lamp.node_tree()) {
- shader->name = b_lamp.name().c_str();
+ if(b_light.use_nodes() && b_light.node_tree()) {
+ shader->name = b_light.name().c_str();
- BL::ShaderNodeTree b_ntree(b_lamp.node_tree());
+ BL::ShaderNodeTree b_ntree(b_light.node_tree());
add_nodes(scene, b_engine, b_data, b_depsgraph, b_scene, graph, b_ntree);
}
else {
float strength = 1.0f;
- if(b_lamp.type() == BL::Lamp::type_POINT ||
- b_lamp.type() == BL::Lamp::type_SPOT ||
- b_lamp.type() == BL::Lamp::type_AREA)
+ if(b_light.type() == BL::Light::type_POINT ||
+ b_light.type() == BL::Light::type_SPOT ||
+ b_light.type() == BL::Light::type_AREA)
{
strength = 100.0f;
}
EmissionNode *emission = new EmissionNode();
- emission->color = get_float3(b_lamp.color());
+ emission->color = get_float3(b_light.color());
emission->strength = strength;
graph->add(emission);
@@ -1459,7 +1459,7 @@ void BlenderSync::sync_shaders(BL::Depsgraph& b_depsgraph)
shader_map.pre_sync();
sync_world(b_depsgraph, auto_refresh_update);
- sync_lamps(b_depsgraph, auto_refresh_update);
+ sync_lights(b_depsgraph, auto_refresh_update);
sync_materials(b_depsgraph, auto_refresh_update);
/* false = don't delete unused shaders, not supported */
diff --git a/intern/cycles/blender/blender_sync.cpp b/intern/cycles/blender/blender_sync.cpp
index f9e04bdef7c..cbca623ece7 100644
--- a/intern/cycles/blender/blender_sync.cpp
+++ b/intern/cycles/blender/blender_sync.cpp
@@ -113,10 +113,10 @@ void BlenderSync::sync_recalc(BL::Depsgraph& b_depsgraph)
BL::Material b_mat(b_id);
shader_map.set_recalc(b_mat);
}
- /* Lamp */
- else if (b_id.is_a(&RNA_Lamp)) {
- BL::Lamp b_lamp(b_id);
- shader_map.set_recalc(b_lamp);
+ /* Light */
+ else if (b_id.is_a(&RNA_Light)) {
+ BL::Light b_light(b_id);
+ shader_map.set_recalc(b_light);
}
/* Object */
else if (b_id.is_a(&RNA_Object)) {
diff --git a/intern/cycles/blender/blender_sync.h b/intern/cycles/blender/blender_sync.h
index 1dce7ec99ef..cd1a37d3f13 100644
--- a/intern/cycles/blender/blender_sync.h
+++ b/intern/cycles/blender/blender_sync.h
@@ -100,7 +100,7 @@ public:
private:
/* sync */
- void sync_lamps(BL::Depsgraph& b_depsgraph, bool update_all);
+ void sync_lights(BL::Depsgraph& b_depsgraph, bool update_all);
void sync_materials(BL::Depsgraph& b_depsgraph, bool update_all);
void sync_objects(BL::Depsgraph& b_depsgraph, float motion_time = 0.0f);
void sync_motion(BL::RenderSettings& b_render,
diff --git a/intern/gawain/gawain/gwn_batch.h b/intern/gawain/gawain/gwn_batch.h
index e0cf66637f6..cf7b0c9f1b5 100644
--- a/intern/gawain/gawain/gwn_batch.h
+++ b/intern/gawain/gawain/gwn_batch.h
@@ -149,9 +149,9 @@ typedef struct BatchWithOwnVertexBufferAndElementList {
Gwn_VertBuf verts; // link batch.verts to this
} BatchWithOwnVertexBufferAndElementList;
-Gwn_Batch* create_BatchWithOwnVertexBuffer(Gwn_PrimType, Gwn_VertFormat*, unsigned v_ct, Gwn_IndexBuf*);
-Gwn_Batch* create_BatchWithOwnElementList(Gwn_PrimType, Gwn_VertBuf*, unsigned prim_ct);
-Gwn_Batch* create_BatchWithOwnVertexBufferAndElementList(Gwn_PrimType, Gwn_VertFormat*, unsigned v_ct, unsigned prim_ct);
+Gwn_Batch* create_BatchWithOwnVertexBuffer(Gwn_PrimType, Gwn_VertFormat*, unsigned v_len, Gwn_IndexBuf*);
+Gwn_Batch* create_BatchWithOwnElementList(Gwn_PrimType, Gwn_VertBuf*, unsigned prim_len);
+Gwn_Batch* create_BatchWithOwnVertexBufferAndElementList(Gwn_PrimType, Gwn_VertFormat*, unsigned v_len, unsigned prim_len);
// verts: shared, own
// elem: none, shared, own
Gwn_Batch* create_BatchInGeneral(Gwn_PrimType, VertexBufferStuff, ElementListStuff);
diff --git a/intern/gawain/gawain/gwn_element.h b/intern/gawain/gawain/gwn_element.h
index 4bd0c34675a..53a54cdfd76 100644
--- a/intern/gawain/gawain/gwn_element.h
+++ b/intern/gawain/gawain/gwn_element.h
@@ -24,7 +24,7 @@ typedef enum {
} Gwn_IndexBufType;
typedef struct Gwn_IndexBuf {
- unsigned index_ct;
+ unsigned index_len;
#if GWN_TRACK_INDEX_RANGE
Gwn_IndexBufType index_type;
uint32_t gl_index_type;
@@ -41,8 +41,8 @@ unsigned GWN_indexbuf_size_get(const Gwn_IndexBuf*);
typedef struct Gwn_IndexBufBuilder {
unsigned max_allowed_index;
- unsigned max_index_ct;
- unsigned index_ct;
+ unsigned max_index_len;
+ unsigned index_len;
Gwn_PrimType prim_type;
unsigned* data;
bool use_prim_restart;
@@ -50,10 +50,10 @@ typedef struct Gwn_IndexBufBuilder {
// supports all primitive types.
-void GWN_indexbuf_init_ex(Gwn_IndexBufBuilder*, Gwn_PrimType, unsigned index_ct, unsigned vertex_ct, bool use_prim_restart);
+void GWN_indexbuf_init_ex(Gwn_IndexBufBuilder*, Gwn_PrimType, unsigned index_len, unsigned vertex_len, bool use_prim_restart);
// supports only GWN_PRIM_POINTS, GWN_PRIM_LINES and GWN_PRIM_TRIS.
-void GWN_indexbuf_init(Gwn_IndexBufBuilder*, Gwn_PrimType, unsigned prim_ct, unsigned vertex_ct);
+void GWN_indexbuf_init(Gwn_IndexBufBuilder*, Gwn_PrimType, unsigned prim_len, unsigned vertex_len);
void GWN_indexbuf_add_generic_vert(Gwn_IndexBufBuilder*, unsigned v);
void GWN_indexbuf_add_primitive_restart(Gwn_IndexBufBuilder*);
diff --git a/intern/gawain/gawain/gwn_immediate.h b/intern/gawain/gawain/gwn_immediate.h
index 35f9c9d9e2c..c3ea2b911a0 100644
--- a/intern/gawain/gawain/gwn_immediate.h
+++ b/intern/gawain/gawain/gwn_immediate.h
@@ -23,8 +23,8 @@ Gwn_VertFormat* immVertexFormat(void); // returns a cleared vertex format, ready
void immBindProgram(uint32_t program, const Gwn_ShaderInterface*); // every immBegin must have a program bound first
void immUnbindProgram(void); // call after your last immEnd, or before binding another program
-void immBegin(Gwn_PrimType, unsigned vertex_ct); // must supply exactly vertex_ct vertices
-void immBeginAtMost(Gwn_PrimType, unsigned max_vertex_ct); // can supply fewer vertices
+void immBegin(Gwn_PrimType, unsigned vertex_len); // must supply exactly vertex_len vertices
+void immBeginAtMost(Gwn_PrimType, unsigned max_vertex_len); // can supply fewer vertices
void immEnd(void); // finishes and draws
#if IMM_BATCH_COMBO
@@ -32,8 +32,8 @@ void immEnd(void); // finishes and draws
// immBegin a batch, then use standard immFunctions as usual.
// immEnd will finalize the batch instead of drawing.
// Then you can draw it as many times as you like! Partially replaces the need for display lists.
-Gwn_Batch* immBeginBatch(Gwn_PrimType, unsigned vertex_ct);
-Gwn_Batch* immBeginBatchAtMost(Gwn_PrimType, unsigned vertex_ct);
+Gwn_Batch* immBeginBatch(Gwn_PrimType, unsigned vertex_len);
+Gwn_Batch* immBeginBatchAtMost(Gwn_PrimType, unsigned vertex_len);
#endif
diff --git a/intern/gawain/gawain/gwn_shader_interface.h b/intern/gawain/gawain/gwn_shader_interface.h
index ee3d51fb3cc..b27b12c18d8 100644
--- a/intern/gawain/gawain/gwn_shader_interface.h
+++ b/intern/gawain/gawain/gwn_shader_interface.h
@@ -65,7 +65,7 @@ typedef struct Gwn_ShaderInterface {
Gwn_ShaderInput* builtin_uniforms[GWN_NUM_UNIFORMS];
char* name_buffer;
struct Gwn_Batch** batches; // references to batches using this interface
- unsigned batches_ct;
+ unsigned batches_len;
} Gwn_ShaderInterface;
Gwn_ShaderInterface* GWN_shaderinterface_create(int32_t program_id);
diff --git a/intern/gawain/gawain/gwn_vertex_buffer.h b/intern/gawain/gawain/gwn_vertex_buffer.h
index b92e4a87698..0eac4838e65 100644
--- a/intern/gawain/gawain/gwn_vertex_buffer.h
+++ b/intern/gawain/gawain/gwn_vertex_buffer.h
@@ -17,7 +17,7 @@
// How to create a Gwn_VertBuf:
// 1) verts = GWN_vertbuf_create() or GWN_vertbuf_init(verts)
// 2) GWN_vertformat_attr_add(verts->format, ...)
-// 3) GWN_vertbuf_data_alloc(verts, vertex_ct) <-- finalizes/packs vertex format
+// 3) GWN_vertbuf_data_alloc(verts, vertex_len) <-- finalizes/packs vertex format
// 4) GWN_vertbuf_attr_fill(verts, pos, application_pos_buffer)
// Is Gwn_VertBuf always used as part of a Gwn_Batch?
@@ -31,8 +31,8 @@ typedef enum {
typedef struct Gwn_VertBuf {
Gwn_VertFormat format;
- unsigned vertex_ct; // number of verts we want to draw
- unsigned vertex_alloc; // number of verts data
+ unsigned vertex_len; /* number of verts we want to draw */
+ unsigned vertex_alloc; /* number of verts data */
bool dirty;
unsigned char* data; // NULL indicates data in VRAM (unmapped)
uint32_t vbo_id; // 0 indicates not yet allocated
@@ -54,9 +54,9 @@ void GWN_vertbuf_init_with_format_ex(Gwn_VertBuf*, const Gwn_VertFormat*, Gwn_Us
GWN_vertbuf_init_with_format_ex(verts, format, GWN_USAGE_STATIC)
unsigned GWN_vertbuf_size_get(const Gwn_VertBuf*);
-void GWN_vertbuf_data_alloc(Gwn_VertBuf*, unsigned v_ct);
-void GWN_vertbuf_data_resize(Gwn_VertBuf*, unsigned v_ct);
-void GWN_vertbuf_vertex_count_set(Gwn_VertBuf*, unsigned v_ct);
+void GWN_vertbuf_data_alloc(Gwn_VertBuf*, unsigned v_len);
+void GWN_vertbuf_data_resize(Gwn_VertBuf*, unsigned v_len);
+void GWN_vertbuf_vertex_count_set(Gwn_VertBuf*, unsigned v_len);
// The most important set_attrib variant is the untyped one. Get it right first.
// It takes a void* so the app developer is responsible for matching their app data types
diff --git a/intern/gawain/gawain/gwn_vertex_format.h b/intern/gawain/gawain/gwn_vertex_format.h
index 503c2d03c42..a4593e4615b 100644
--- a/intern/gawain/gawain/gwn_vertex_format.h
+++ b/intern/gawain/gawain/gwn_vertex_format.h
@@ -42,16 +42,16 @@ typedef struct Gwn_VertAttr {
Gwn_VertFetchMode fetch_mode;
Gwn_VertCompType comp_type;
unsigned gl_comp_type;
- unsigned comp_ct; // 1 to 4 or 8 or 12 or 16
+ unsigned comp_len; // 1 to 4 or 8 or 12 or 16
unsigned sz; // size in bytes, 1 to 64
unsigned offset; // from beginning of vertex, in bytes
- unsigned name_ct; // up to GWN_VERT_ATTR_MAX_NAMES
+ unsigned name_len; // up to GWN_VERT_ATTR_MAX_NAMES
const char* name[GWN_VERT_ATTR_MAX_NAMES];
} Gwn_VertAttr;
typedef struct Gwn_VertFormat {
- unsigned attrib_ct; // 0 to 16 (GWN_VERT_ATTR_MAX_LEN)
- unsigned name_ct; // total count of active vertex attrib
+ unsigned attr_len; // 0 to 16 (GWN_VERT_ATTR_MAX_LEN)
+ unsigned name_len; // total count of active vertex attrib
unsigned stride; // stride in bytes, 1 to 256
unsigned name_offset;
bool packed;
@@ -62,7 +62,7 @@ typedef struct Gwn_VertFormat {
void GWN_vertformat_clear(Gwn_VertFormat*);
void GWN_vertformat_copy(Gwn_VertFormat* dest, const Gwn_VertFormat* src);
-unsigned GWN_vertformat_attr_add(Gwn_VertFormat*, const char* name, Gwn_VertCompType, unsigned comp_ct, Gwn_VertFetchMode);
+unsigned GWN_vertformat_attr_add(Gwn_VertFormat*, const char* name, Gwn_VertCompType, unsigned comp_len, Gwn_VertFetchMode);
void GWN_vertformat_alias_add(Gwn_VertFormat*, const char* alias);
// format conversion
diff --git a/intern/gawain/gawain/gwn_vertex_format_private.h b/intern/gawain/gawain/gwn_vertex_format_private.h
index c1a0f734eda..90cd8412e53 100644
--- a/intern/gawain/gawain/gwn_vertex_format_private.h
+++ b/intern/gawain/gawain/gwn_vertex_format_private.h
@@ -13,4 +13,4 @@
void VertexFormat_pack(Gwn_VertFormat*);
unsigned padding(unsigned offset, unsigned alignment);
-unsigned vertex_buffer_size(const Gwn_VertFormat*, unsigned vertex_ct);
+unsigned vertex_buffer_size(const Gwn_VertFormat*, unsigned vertex_len);
diff --git a/intern/gawain/src/gwn_attr_binding.c b/intern/gawain/src/gwn_attr_binding.c
index 7647a927b1e..c702a0ae99d 100644
--- a/intern/gawain/src/gwn_attr_binding.c
+++ b/intern/gawain/src/gwn_attr_binding.c
@@ -52,10 +52,10 @@ void get_attrib_locations(const Gwn_VertFormat* format, Gwn_AttrBinding* binding
{
AttribBinding_clear(binding);
- for (unsigned a_idx = 0; a_idx < format->attrib_ct; ++a_idx)
+ for (unsigned a_idx = 0; a_idx < format->attr_len; ++a_idx)
{
const Gwn_VertAttr* a = format->attribs + a_idx;
- for (unsigned n_idx = 0; n_idx < a->name_ct; ++n_idx)
+ for (unsigned n_idx = 0; n_idx < a->name_len; ++n_idx)
{
const Gwn_ShaderInput* input = GWN_shaderinterface_attr(shaderface, a->name[n_idx]);
diff --git a/intern/gawain/src/gwn_batch.c b/intern/gawain/src/gwn_batch.c
index adc72e171c0..62342cfc42f 100644
--- a/intern/gawain/src/gwn_batch.c
+++ b/intern/gawain/src/gwn_batch.c
@@ -168,9 +168,9 @@ int GWN_batch_vertbuf_add_ex(
if (batch->verts[v] == NULL)
{
#if TRUST_NO_ONE
- // for now all VertexBuffers must have same vertex_ct
- assert(verts->vertex_ct == batch->verts[0]->vertex_ct);
- // in the near future we will enable instanced attribs which have their own vertex_ct
+ // for now all VertexBuffers must have same vertex_len
+ assert(verts->vertex_len == batch->verts[0]->vertex_len);
+ // in the near future we will enable instanced attribs which have their own vertex_len
#endif
batch->verts[v] = verts;
// TODO: mark dirty so we can keep attrib bindings up-to-date
@@ -336,30 +336,30 @@ static void create_bindings(Gwn_VertBuf* verts, const Gwn_ShaderInterface* inter
{
const Gwn_VertFormat* format = &verts->format;
- const unsigned attrib_ct = format->attrib_ct;
+ const unsigned attr_len = format->attr_len;
const unsigned stride = format->stride;
GWN_vertbuf_use(verts);
- for (unsigned a_idx = 0; a_idx < attrib_ct; ++a_idx)
+ for (unsigned a_idx = 0; a_idx < attr_len; ++a_idx)
{
const Gwn_VertAttr* a = format->attribs + a_idx;
const GLvoid* pointer = (const GLubyte*)0 + a->offset + v_first * stride;
- for (unsigned n_idx = 0; n_idx < a->name_ct; ++n_idx)
+ for (unsigned n_idx = 0; n_idx < a->name_len; ++n_idx)
{
const Gwn_ShaderInput* input = GWN_shaderinterface_attr(interface, a->name[n_idx]);
if (input == NULL) continue;
- if (a->comp_ct == 16 || a->comp_ct == 12 || a->comp_ct == 8)
+ if (a->comp_len == 16 || a->comp_len == 12 || a->comp_len == 8)
{
#if TRUST_NO_ONE
assert(a->fetch_mode == GWN_FETCH_FLOAT);
assert(a->gl_comp_type == GL_FLOAT);
#endif
- for (int i = 0; i < a->comp_ct / 4; ++i)
+ for (int i = 0; i < a->comp_len / 4; ++i)
{
glEnableVertexAttribArray(input->location + i);
glVertexAttribDivisor(input->location + i, (use_instancing) ? 1 : 0);
@@ -376,13 +376,13 @@ static void create_bindings(Gwn_VertBuf* verts, const Gwn_ShaderInterface* inter
{
case GWN_FETCH_FLOAT:
case GWN_FETCH_INT_TO_FLOAT:
- glVertexAttribPointer(input->location, a->comp_ct, a->gl_comp_type, GL_FALSE, stride, pointer);
+ glVertexAttribPointer(input->location, a->comp_len, a->gl_comp_type, GL_FALSE, stride, pointer);
break;
case GWN_FETCH_INT_TO_FLOAT_UNIT:
- glVertexAttribPointer(input->location, a->comp_ct, a->gl_comp_type, GL_TRUE, stride, pointer);
+ glVertexAttribPointer(input->location, a->comp_len, a->gl_comp_type, GL_TRUE, stride, pointer);
break;
case GWN_FETCH_INT:
- glVertexAttribIPointer(input->location, a->comp_ct, a->gl_comp_type, stride, pointer);
+ glVertexAttribIPointer(input->location, a->comp_len, a->gl_comp_type, stride, pointer);
}
}
}
@@ -564,7 +564,7 @@ void GWN_batch_draw_range_ex(Gwn_Batch* batch, int v_first, int v_count, bool fo
{
// Infer length if vertex count is not given
if (v_count == 0)
- v_count = batch->inst->vertex_ct;
+ v_count = batch->inst->vertex_len;
if (batch->elem)
{
@@ -574,21 +574,21 @@ void GWN_batch_draw_range_ex(Gwn_Batch* batch, int v_first, int v_count, bool fo
primitive_restart_enable(el);
#if GWN_TRACK_INDEX_RANGE
- glDrawElementsInstancedBaseVertex(batch->gl_prim_type, el->index_ct, el->gl_index_type, 0, v_count, el->base_index);
+ glDrawElementsInstancedBaseVertex(batch->gl_prim_type, el->index_len, el->gl_index_type, 0, v_count, el->base_index);
#else
- glDrawElementsInstanced(batch->gl_prim_type, el->index_ct, GL_UNSIGNED_INT, 0, v_count);
+ glDrawElementsInstanced(batch->gl_prim_type, el->index_len, GL_UNSIGNED_INT, 0, v_count);
#endif
if (el->use_prim_restart)
primitive_restart_disable();
}
else
- glDrawArraysInstanced(batch->gl_prim_type, 0, batch->verts[0]->vertex_ct, v_count);
+ glDrawArraysInstanced(batch->gl_prim_type, 0, batch->verts[0]->vertex_len, v_count);
}
else
{
// Infer length if vertex count is not given
if (v_count == 0)
- v_count = (batch->elem) ? batch->elem->index_ct : batch->verts[0]->vertex_ct;
+ v_count = (batch->elem) ? batch->elem->index_len : batch->verts[0]->vertex_len;
if (batch->elem)
{
diff --git a/intern/gawain/src/gwn_buffer_id.cpp b/intern/gawain/src/gwn_buffer_id.cpp
index 64bad855ca7..13473f1f28d 100644
--- a/intern/gawain/src/gwn_buffer_id.cpp
+++ b/intern/gawain/src/gwn_buffer_id.cpp
@@ -39,11 +39,11 @@ GLuint GWN_buf_id_alloc()
orphan_mutex.lock();
if (!orphaned_buffer_ids.empty())
{
- const auto orphaned_buffer_ct = (unsigned)orphaned_buffer_ids.size();
+ const auto orphaned_buffer_len = (unsigned)orphaned_buffer_ids.size();
#if ORPHAN_DEBUG
- printf("deleting %u orphaned VBO%s\n", orphaned_buffer_ct, orphaned_buffer_ct == 1 ? "" : "s");
+ printf("deleting %u orphaned VBO%s\n", orphaned_buffer_len, orphaned_buffer_len == 1 ? "" : "s");
#endif
- glDeleteBuffers(orphaned_buffer_ct, orphaned_buffer_ids.data());
+ glDeleteBuffers(orphaned_buffer_len, orphaned_buffer_ids.data());
orphaned_buffer_ids.clear();
}
orphan_mutex.unlock();
diff --git a/intern/gawain/src/gwn_element.c b/intern/gawain/src/gwn_element.c
index e2fbb657c78..257338fe089 100644
--- a/intern/gawain/src/gwn_element.c
+++ b/intern/gawain/src/gwn_element.c
@@ -33,23 +33,23 @@ unsigned GWN_indexbuf_size_get(const Gwn_IndexBuf* elem)
[GWN_INDEX_U16] = sizeof(GLushort),
[GWN_INDEX_U32] = sizeof(GLuint)
};
- return elem->index_ct * table[elem->index_type];
+ return elem->index_len * table[elem->index_type];
#else
- return elem->index_ct * sizeof(GLuint);
+ return elem->index_len * sizeof(GLuint);
#endif
}
-void GWN_indexbuf_init_ex(Gwn_IndexBufBuilder* builder, Gwn_PrimType prim_type, unsigned index_ct, unsigned vertex_ct, bool use_prim_restart)
+void GWN_indexbuf_init_ex(Gwn_IndexBufBuilder* builder, Gwn_PrimType prim_type, unsigned index_len, unsigned vertex_len, bool use_prim_restart)
{
builder->use_prim_restart = use_prim_restart;
- builder->max_allowed_index = vertex_ct - 1;
- builder->max_index_ct = index_ct;
- builder->index_ct = 0; // start empty
+ builder->max_allowed_index = vertex_len - 1;
+ builder->max_index_len = index_len;
+ builder->index_len = 0; // start empty
builder->prim_type = prim_type;
- builder->data = calloc(builder->max_index_ct, sizeof(unsigned));
+ builder->data = calloc(builder->max_index_len, sizeof(unsigned));
}
-void GWN_indexbuf_init(Gwn_IndexBufBuilder* builder, Gwn_PrimType prim_type, unsigned prim_ct, unsigned vertex_ct)
+void GWN_indexbuf_init(Gwn_IndexBufBuilder* builder, Gwn_PrimType prim_type, unsigned prim_len, unsigned vertex_len)
{
unsigned verts_per_prim = 0;
switch (prim_type)
@@ -73,29 +73,29 @@ void GWN_indexbuf_init(Gwn_IndexBufBuilder* builder, Gwn_PrimType prim_type, uns
return;
}
- GWN_indexbuf_init_ex(builder, prim_type, prim_ct * verts_per_prim, vertex_ct, false);
+ GWN_indexbuf_init_ex(builder, prim_type, prim_len * verts_per_prim, vertex_len, false);
}
void GWN_indexbuf_add_generic_vert(Gwn_IndexBufBuilder* builder, unsigned v)
{
#if TRUST_NO_ONE
assert(builder->data != NULL);
- assert(builder->index_ct < builder->max_index_ct);
+ assert(builder->index_len < builder->max_index_len);
assert(v <= builder->max_allowed_index);
#endif
- builder->data[builder->index_ct++] = v;
+ builder->data[builder->index_len++] = v;
}
void GWN_indexbuf_add_primitive_restart(Gwn_IndexBufBuilder* builder)
{
#if TRUST_NO_ONE
assert(builder->data != NULL);
- assert(builder->index_ct < builder->max_index_ct);
+ assert(builder->index_len < builder->max_index_len);
assert(builder->use_prim_restart);
#endif
- builder->data[builder->index_ct++] = GWN_PRIM_RESTART;
+ builder->data[builder->index_len++] = GWN_PRIM_RESTART;
}
void GWN_indexbuf_add_point_vert(Gwn_IndexBufBuilder* builder, unsigned v)
@@ -147,9 +147,9 @@ void GWN_indexbuf_add_line_adj_verts(Gwn_IndexBufBuilder* builder, unsigned v1,
// Everything remains 32 bit while building to keep things simple.
// Find min/max after, then convert to smallest index type possible.
-static unsigned index_range(const unsigned values[], unsigned value_ct, unsigned* min_out, unsigned* max_out)
+static unsigned index_range(const unsigned values[], unsigned value_len, unsigned* min_out, unsigned* max_out)
{
- if (value_ct == 0)
+ if (value_len == 0)
{
*min_out = 0;
*max_out = 0;
@@ -157,7 +157,7 @@ static unsigned index_range(const unsigned values[], unsigned value_ct, unsigned
}
unsigned min_value = values[0];
unsigned max_value = values[0];
- for (unsigned i = 1; i < value_ct; ++i)
+ for (unsigned i = 1; i < value_len; ++i)
{
const unsigned value = values[i];
if (value == GWN_PRIM_RESTART)
@@ -175,7 +175,7 @@ static unsigned index_range(const unsigned values[], unsigned value_ct, unsigned
static void squeeze_indices_byte(Gwn_IndexBufBuilder *builder, Gwn_IndexBuf* elem)
{
const unsigned *values = builder->data;
- const unsigned index_ct = elem->index_ct;
+ const unsigned index_len = elem->index_len;
// data will never be *larger* than builder->data...
// converting in place to avoid extra allocation
@@ -189,14 +189,14 @@ static void squeeze_indices_byte(Gwn_IndexBufBuilder *builder, Gwn_IndexBuf* ele
elem->min_index = 0;
elem->max_index -= base;
- for (unsigned i = 0; i < index_ct; ++i)
+ for (unsigned i = 0; i < index_len; ++i)
data[i] = (values[i] == GWN_PRIM_RESTART) ? 0xFF : (GLubyte)(values[i] - base);
}
else
{
elem->base_index = 0;
- for (unsigned i = 0; i < index_ct; ++i)
+ for (unsigned i = 0; i < index_len; ++i)
data[i] = (GLubyte)(values[i]);
}
}
@@ -204,7 +204,7 @@ static void squeeze_indices_byte(Gwn_IndexBufBuilder *builder, Gwn_IndexBuf* ele
static void squeeze_indices_short(Gwn_IndexBufBuilder *builder, Gwn_IndexBuf* elem)
{
const unsigned *values = builder->data;
- const unsigned index_ct = elem->index_ct;
+ const unsigned index_len = elem->index_len;
// data will never be *larger* than builder->data...
// converting in place to avoid extra allocation
@@ -218,14 +218,14 @@ static void squeeze_indices_short(Gwn_IndexBufBuilder *builder, Gwn_IndexBuf* el
elem->min_index = 0;
elem->max_index -= base;
- for (unsigned i = 0; i < index_ct; ++i)
+ for (unsigned i = 0; i < index_len; ++i)
data[i] = (values[i] == GWN_PRIM_RESTART) ? 0xFFFF : (GLushort)(values[i] - base);
}
else
{
elem->base_index = 0;
- for (unsigned i = 0; i < index_ct; ++i)
+ for (unsigned i = 0; i < index_len; ++i)
data[i] = (GLushort)(values[i]);
}
}
@@ -245,11 +245,11 @@ void GWN_indexbuf_build_in_place(Gwn_IndexBufBuilder* builder, Gwn_IndexBuf* ele
assert(builder->data != NULL);
#endif
- elem->index_ct = builder->index_ct;
+ elem->index_len = builder->index_len;
elem->use_prim_restart = builder->use_prim_restart;
#if GWN_TRACK_INDEX_RANGE
- unsigned range = index_range(builder->data, builder->index_ct, &elem->min_index, &elem->max_index);
+ unsigned range = index_range(builder->data, builder->index_len, &elem->min_index, &elem->max_index);
// count the primitive restart index.
if (elem->use_prim_restart)
diff --git a/intern/gawain/src/gwn_immediate.c b/intern/gawain/src/gwn_immediate.c
index b0b587d1b8c..c57564fce06 100644
--- a/intern/gawain/src/gwn_immediate.c
+++ b/intern/gawain/src/gwn_immediate.c
@@ -34,8 +34,8 @@ typedef struct {
GLubyte* buffer_data;
unsigned buffer_offset;
unsigned buffer_bytes_mapped;
- unsigned vertex_ct;
- bool strict_vertex_ct;
+ unsigned vertex_len;
+ bool strict_vertex_len;
Gwn_PrimType prim_type;
Gwn_VertFormat vertex_format;
@@ -73,7 +73,7 @@ void immInit(void)
glBufferData(GL_ARRAY_BUFFER, IMM_BUFFER_SIZE, NULL, GL_DYNAMIC_DRAW);
imm.prim_type = GWN_PRIM_NONE;
- imm.strict_vertex_ct = true;
+ imm.strict_vertex_len = true;
glBindBuffer(GL_ARRAY_BUFFER, 0);
initialized = true;
@@ -147,10 +147,10 @@ void immUnbindProgram(void)
}
#if TRUST_NO_ONE
-static bool vertex_count_makes_sense_for_primitive(unsigned vertex_ct, Gwn_PrimType prim_type)
+static bool vertex_count_makes_sense_for_primitive(unsigned vertex_len, Gwn_PrimType prim_type)
{
- // does vertex_ct make sense for this primitive type?
- if (vertex_ct == 0)
+ // does vertex_len make sense for this primitive type?
+ if (vertex_len == 0)
return false;
switch (prim_type)
@@ -158,38 +158,38 @@ static bool vertex_count_makes_sense_for_primitive(unsigned vertex_ct, Gwn_PrimT
case GWN_PRIM_POINTS:
return true;
case GWN_PRIM_LINES:
- return vertex_ct % 2 == 0;
+ return vertex_len % 2 == 0;
case GWN_PRIM_LINE_STRIP:
case GWN_PRIM_LINE_LOOP:
- return vertex_ct >= 2;
+ return vertex_len >= 2;
case GWN_PRIM_LINE_STRIP_ADJ:
- return vertex_ct >= 4;
+ return vertex_len >= 4;
case GWN_PRIM_TRIS:
- return vertex_ct % 3 == 0;
+ return vertex_len % 3 == 0;
case GWN_PRIM_TRI_STRIP:
case GWN_PRIM_TRI_FAN:
- return vertex_ct >= 3;
+ return vertex_len >= 3;
default:
return false;
}
}
#endif
-void immBegin(Gwn_PrimType prim_type, unsigned vertex_ct)
+void immBegin(Gwn_PrimType prim_type, unsigned vertex_len)
{
#if TRUST_NO_ONE
assert(initialized);
assert(imm.prim_type == GWN_PRIM_NONE); // make sure we haven't already begun
- assert(vertex_count_makes_sense_for_primitive(vertex_ct, prim_type));
+ assert(vertex_count_makes_sense_for_primitive(vertex_len, prim_type));
#endif
imm.prim_type = prim_type;
- imm.vertex_ct = vertex_ct;
+ imm.vertex_len = vertex_len;
imm.vertex_idx = 0;
imm.unassigned_attrib_bits = imm.attrib_binding.enabled_bits;
// how many bytes do we need for this draw call?
- const unsigned bytes_needed = vertex_buffer_size(&imm.vertex_format, vertex_ct);
+ const unsigned bytes_needed = vertex_buffer_size(&imm.vertex_format, vertex_len);
#if TRUST_NO_ONE
assert(bytes_needed <= IMM_BUFFER_SIZE);
@@ -234,7 +234,7 @@ void immBegin(Gwn_PrimType prim_type, unsigned vertex_ct)
// printf("mapping %u to %u\n", imm.buffer_offset, imm.buffer_offset + bytes_needed - 1);
imm.buffer_data = glMapBufferRange(GL_ARRAY_BUFFER, imm.buffer_offset, bytes_needed,
- GL_MAP_WRITE_BIT | GL_MAP_UNSYNCHRONIZED_BIT | (imm.strict_vertex_ct ? 0 : GL_MAP_FLUSH_EXPLICIT_BIT));
+ GL_MAP_WRITE_BIT | GL_MAP_UNSYNCHRONIZED_BIT | (imm.strict_vertex_len ? 0 : GL_MAP_FLUSH_EXPLICIT_BIT));
#if TRUST_NO_ONE
assert(imm.buffer_data != NULL);
@@ -244,33 +244,33 @@ void immBegin(Gwn_PrimType prim_type, unsigned vertex_ct)
imm.vertex_data = imm.buffer_data;
}
-void immBeginAtMost(Gwn_PrimType prim_type, unsigned vertex_ct)
+void immBeginAtMost(Gwn_PrimType prim_type, unsigned vertex_len)
{
#if TRUST_NO_ONE
- assert(vertex_ct > 0);
+ assert(vertex_len > 0);
#endif
- imm.strict_vertex_ct = false;
- immBegin(prim_type, vertex_ct);
+ imm.strict_vertex_len = false;
+ immBegin(prim_type, vertex_len);
}
#if IMM_BATCH_COMBO
-Gwn_Batch* immBeginBatch(Gwn_PrimType prim_type, unsigned vertex_ct)
+Gwn_Batch* immBeginBatch(Gwn_PrimType prim_type, unsigned vertex_len)
{
#if TRUST_NO_ONE
assert(initialized);
assert(imm.prim_type == GWN_PRIM_NONE); // make sure we haven't already begun
- assert(vertex_count_makes_sense_for_primitive(vertex_ct, prim_type));
+ assert(vertex_count_makes_sense_for_primitive(vertex_len, prim_type));
#endif
imm.prim_type = prim_type;
- imm.vertex_ct = vertex_ct;
+ imm.vertex_len = vertex_len;
imm.vertex_idx = 0;
imm.unassigned_attrib_bits = imm.attrib_binding.enabled_bits;
Gwn_VertBuf* verts = GWN_vertbuf_create_with_format(&imm.vertex_format);
- GWN_vertbuf_data_alloc(verts, vertex_ct);
+ GWN_vertbuf_data_alloc(verts, vertex_len);
imm.buffer_bytes_mapped = GWN_vertbuf_size_get(verts);
imm.vertex_data = verts->data;
@@ -281,10 +281,10 @@ Gwn_Batch* immBeginBatch(Gwn_PrimType prim_type, unsigned vertex_ct)
return imm.batch;
}
-Gwn_Batch* immBeginBatchAtMost(Gwn_PrimType prim_type, unsigned vertex_ct)
+Gwn_Batch* immBeginBatchAtMost(Gwn_PrimType prim_type, unsigned vertex_len)
{
- imm.strict_vertex_ct = false;
- return immBeginBatch(prim_type, vertex_ct);
+ imm.strict_vertex_len = false;
+ return immBeginBatch(prim_type, vertex_len);
}
#endif // IMM_BATCH_COMBO
@@ -319,7 +319,7 @@ static void immDrawSetup(void)
const unsigned stride = imm.vertex_format.stride;
- for (unsigned a_idx = 0; a_idx < imm.vertex_format.attrib_ct; ++a_idx)
+ for (unsigned a_idx = 0; a_idx < imm.vertex_format.attr_len; ++a_idx)
{
const Gwn_VertAttr* a = imm.vertex_format.attribs + a_idx;
@@ -334,13 +334,13 @@ static void immDrawSetup(void)
{
case GWN_FETCH_FLOAT:
case GWN_FETCH_INT_TO_FLOAT:
- glVertexAttribPointer(loc, a->comp_ct, a->gl_comp_type, GL_FALSE, stride, pointer);
+ glVertexAttribPointer(loc, a->comp_len, a->gl_comp_type, GL_FALSE, stride, pointer);
break;
case GWN_FETCH_INT_TO_FLOAT_UNIT:
- glVertexAttribPointer(loc, a->comp_ct, a->gl_comp_type, GL_TRUE, stride, pointer);
+ glVertexAttribPointer(loc, a->comp_len, a->gl_comp_type, GL_TRUE, stride, pointer);
break;
case GWN_FETCH_INT:
- glVertexAttribIPointer(loc, a->comp_ct, a->gl_comp_type, stride, pointer);
+ glVertexAttribIPointer(loc, a->comp_len, a->gl_comp_type, stride, pointer);
}
}
@@ -355,20 +355,20 @@ void immEnd(void)
#endif
unsigned buffer_bytes_used;
- if (imm.strict_vertex_ct)
+ if (imm.strict_vertex_len)
{
#if TRUST_NO_ONE
- assert(imm.vertex_idx == imm.vertex_ct); // with all vertices defined
+ assert(imm.vertex_idx == imm.vertex_len); // with all vertices defined
#endif
buffer_bytes_used = imm.buffer_bytes_mapped;
}
else
{
#if TRUST_NO_ONE
- assert(imm.vertex_idx <= imm.vertex_ct);
+ assert(imm.vertex_idx <= imm.vertex_len);
#endif
- // printf("used %u of %u verts,", imm.vertex_idx, imm.vertex_ct);
- if (imm.vertex_idx == imm.vertex_ct)
+ // printf("used %u of %u verts,", imm.vertex_idx, imm.vertex_len);
+ if (imm.vertex_idx == imm.vertex_len)
{
buffer_bytes_used = imm.buffer_bytes_mapped;
}
@@ -377,8 +377,8 @@ void immEnd(void)
#if TRUST_NO_ONE
assert(imm.vertex_idx == 0 || vertex_count_makes_sense_for_primitive(imm.vertex_idx, imm.prim_type));
#endif
- imm.vertex_ct = imm.vertex_idx;
- buffer_bytes_used = vertex_buffer_size(&imm.vertex_format, imm.vertex_ct);
+ imm.vertex_len = imm.vertex_idx;
+ buffer_bytes_used = vertex_buffer_size(&imm.vertex_format, imm.vertex_len);
// unused buffer bytes are available to the next immBegin
// printf(" %u of %u bytes\n", buffer_bytes_used, imm.buffer_bytes_mapped);
}
@@ -393,7 +393,7 @@ void immEnd(void)
{
if (buffer_bytes_used != imm.buffer_bytes_mapped)
{
- GWN_vertbuf_data_resize(imm.batch->verts[0], imm.vertex_ct);
+ GWN_vertbuf_data_resize(imm.batch->verts[0], imm.vertex_len);
// TODO: resize only if vertex count is much smaller
}
@@ -406,10 +406,10 @@ void immEnd(void)
{
glUnmapBuffer(GL_ARRAY_BUFFER);
- if (imm.vertex_ct > 0)
+ if (imm.vertex_len > 0)
{
immDrawSetup();
- glDrawArrays(convert_prim_type_to_gl(imm.prim_type), 0, imm.vertex_ct);
+ glDrawArrays(convert_prim_type_to_gl(imm.prim_type), 0, imm.vertex_len);
}
glBindBuffer(GL_ARRAY_BUFFER, 0);
@@ -421,7 +421,7 @@ void immEnd(void)
// prep for next immBegin
imm.prim_type = GWN_PRIM_NONE;
- imm.strict_vertex_ct = true;
+ imm.strict_vertex_len = true;
}
static void setAttribValueBit(unsigned attrib_id)
@@ -443,10 +443,10 @@ void immAttrib1f(unsigned attrib_id, float x)
Gwn_VertAttr* attrib = imm.vertex_format.attribs + attrib_id;
#if TRUST_NO_ONE
- assert(attrib_id < imm.vertex_format.attrib_ct);
+ assert(attrib_id < imm.vertex_format.attr_len);
assert(attrib->comp_type == GWN_COMP_F32);
- assert(attrib->comp_ct == 1);
- assert(imm.vertex_idx < imm.vertex_ct);
+ assert(attrib->comp_len == 1);
+ assert(imm.vertex_idx < imm.vertex_len);
assert(imm.prim_type != GWN_PRIM_NONE); // make sure we're between a Begin/End pair
#endif
@@ -463,10 +463,10 @@ void immAttrib2f(unsigned attrib_id, float x, float y)
Gwn_VertAttr* attrib = imm.vertex_format.attribs + attrib_id;
#if TRUST_NO_ONE
- assert(attrib_id < imm.vertex_format.attrib_ct);
+ assert(attrib_id < imm.vertex_format.attr_len);
assert(attrib->comp_type == GWN_COMP_F32);
- assert(attrib->comp_ct == 2);
- assert(imm.vertex_idx < imm.vertex_ct);
+ assert(attrib->comp_len == 2);
+ assert(imm.vertex_idx < imm.vertex_len);
assert(imm.prim_type != GWN_PRIM_NONE); // make sure we're between a Begin/End pair
#endif
@@ -484,10 +484,10 @@ void immAttrib3f(unsigned attrib_id, float x, float y, float z)
Gwn_VertAttr* attrib = imm.vertex_format.attribs + attrib_id;
#if TRUST_NO_ONE
- assert(attrib_id < imm.vertex_format.attrib_ct);
+ assert(attrib_id < imm.vertex_format.attr_len);
assert(attrib->comp_type == GWN_COMP_F32);
- assert(attrib->comp_ct == 3);
- assert(imm.vertex_idx < imm.vertex_ct);
+ assert(attrib->comp_len == 3);
+ assert(imm.vertex_idx < imm.vertex_len);
assert(imm.prim_type != GWN_PRIM_NONE); // make sure we're between a Begin/End pair
#endif
@@ -506,10 +506,10 @@ void immAttrib4f(unsigned attrib_id, float x, float y, float z, float w)
Gwn_VertAttr* attrib = imm.vertex_format.attribs + attrib_id;
#if TRUST_NO_ONE
- assert(attrib_id < imm.vertex_format.attrib_ct);
+ assert(attrib_id < imm.vertex_format.attr_len);
assert(attrib->comp_type == GWN_COMP_F32);
- assert(attrib->comp_ct == 4);
- assert(imm.vertex_idx < imm.vertex_ct);
+ assert(attrib->comp_len == 4);
+ assert(imm.vertex_idx < imm.vertex_len);
assert(imm.prim_type != GWN_PRIM_NONE); // make sure we're between a Begin/End pair
#endif
@@ -529,10 +529,10 @@ void immAttrib1u(unsigned attrib_id, unsigned x)
Gwn_VertAttr* attrib = imm.vertex_format.attribs + attrib_id;
#if TRUST_NO_ONE
- assert(attrib_id < imm.vertex_format.attrib_ct);
+ assert(attrib_id < imm.vertex_format.attr_len);
assert(attrib->comp_type == GWN_COMP_U32);
- assert(attrib->comp_ct == 1);
- assert(imm.vertex_idx < imm.vertex_ct);
+ assert(attrib->comp_len == 1);
+ assert(imm.vertex_idx < imm.vertex_len);
assert(imm.prim_type != GWN_PRIM_NONE); // make sure we're between a Begin/End pair
#endif
@@ -548,10 +548,10 @@ void immAttrib2i(unsigned attrib_id, int x, int y)
Gwn_VertAttr* attrib = imm.vertex_format.attribs + attrib_id;
#if TRUST_NO_ONE
- assert(attrib_id < imm.vertex_format.attrib_ct);
+ assert(attrib_id < imm.vertex_format.attr_len);
assert(attrib->comp_type == GWN_COMP_I32);
- assert(attrib->comp_ct == 2);
- assert(imm.vertex_idx < imm.vertex_ct);
+ assert(attrib->comp_len == 2);
+ assert(imm.vertex_idx < imm.vertex_len);
assert(imm.prim_type != GWN_PRIM_NONE); // make sure we're between a Begin/End pair
#endif
@@ -568,10 +568,10 @@ void immAttrib2s(unsigned attrib_id, short x, short y)
Gwn_VertAttr* attrib = imm.vertex_format.attribs + attrib_id;
#if TRUST_NO_ONE
- assert(attrib_id < imm.vertex_format.attrib_ct);
+ assert(attrib_id < imm.vertex_format.attr_len);
assert(attrib->comp_type == GWN_COMP_I16);
- assert(attrib->comp_ct == 2);
- assert(imm.vertex_idx < imm.vertex_ct);
+ assert(attrib->comp_len == 2);
+ assert(imm.vertex_idx < imm.vertex_len);
assert(imm.prim_type != GWN_PRIM_NONE); // make sure we're between a Begin/End pair
#endif
@@ -603,10 +603,10 @@ void immAttrib3ub(unsigned attrib_id, unsigned char r, unsigned char g, unsigned
Gwn_VertAttr* attrib = imm.vertex_format.attribs + attrib_id;
#if TRUST_NO_ONE
- assert(attrib_id < imm.vertex_format.attrib_ct);
+ assert(attrib_id < imm.vertex_format.attr_len);
assert(attrib->comp_type == GWN_COMP_U8);
- assert(attrib->comp_ct == 3);
- assert(imm.vertex_idx < imm.vertex_ct);
+ assert(attrib->comp_len == 3);
+ assert(imm.vertex_idx < imm.vertex_len);
assert(imm.prim_type != GWN_PRIM_NONE); // make sure we're between a Begin/End pair
#endif
@@ -625,10 +625,10 @@ void immAttrib4ub(unsigned attrib_id, unsigned char r, unsigned char g, unsigned
Gwn_VertAttr* attrib = imm.vertex_format.attribs + attrib_id;
#if TRUST_NO_ONE
- assert(attrib_id < imm.vertex_format.attrib_ct);
+ assert(attrib_id < imm.vertex_format.attr_len);
assert(attrib->comp_type == GWN_COMP_U8);
- assert(attrib->comp_ct == 4);
- assert(imm.vertex_idx < imm.vertex_ct);
+ assert(attrib->comp_len == 4);
+ assert(imm.vertex_idx < imm.vertex_len);
assert(imm.prim_type != GWN_PRIM_NONE); // make sure we're between a Begin/End pair
#endif
@@ -656,8 +656,8 @@ void immAttrib4ubv(unsigned attrib_id, const unsigned char data[4])
void immSkipAttrib(unsigned attrib_id)
{
#if TRUST_NO_ONE
- assert(attrib_id < imm.vertex_format.attrib_ct);
- assert(imm.vertex_idx < imm.vertex_ct);
+ assert(attrib_id < imm.vertex_format.attr_len);
+ assert(imm.vertex_idx < imm.vertex_len);
assert(imm.prim_type != GWN_PRIM_NONE); // make sure we're between a Begin/End pair
#endif
@@ -668,7 +668,7 @@ static void immEndVertex(void) // and move on to the next vertex
{
#if TRUST_NO_ONE
assert(imm.prim_type != GWN_PRIM_NONE); // make sure we're between a Begin/End pair
- assert(imm.vertex_idx < imm.vertex_ct);
+ assert(imm.vertex_idx < imm.vertex_len);
#endif
// have all attribs been assigned values?
@@ -679,7 +679,7 @@ static void immEndVertex(void) // and move on to the next vertex
assert(imm.vertex_idx > 0); // first vertex must have all attribs specified
#endif
- for (unsigned a_idx = 0; a_idx < imm.vertex_format.attrib_ct; ++a_idx)
+ for (unsigned a_idx = 0; a_idx < imm.vertex_format.attr_len; ++a_idx)
{
if ((imm.unassigned_attrib_bits >> a_idx) & 1)
{
diff --git a/intern/gawain/src/gwn_shader_interface.c b/intern/gawain/src/gwn_shader_interface.c
index 16451573bba..d18af234fb0 100644
--- a/intern/gawain/src/gwn_shader_interface.c
+++ b/intern/gawain/src/gwn_shader_interface.c
@@ -203,19 +203,19 @@ Gwn_ShaderInterface* GWN_shaderinterface_create(int32_t program)
printf("Gwn_ShaderInterface %p, program %d\n", shaderface, program);
#endif
- GLint max_attrib_name_len, attrib_ct;
+ GLint max_attrib_name_len, attr_len;
glGetProgramiv(program, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &max_attrib_name_len);
- glGetProgramiv(program, GL_ACTIVE_ATTRIBUTES, &attrib_ct);
+ glGetProgramiv(program, GL_ACTIVE_ATTRIBUTES, &attr_len);
- GLint max_ubo_name_len, ubo_ct;
+ GLint max_ubo_name_len, ubo_len;
glGetProgramiv(program, GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH, &max_ubo_name_len);
- glGetProgramiv(program, GL_ACTIVE_UNIFORM_BLOCKS, &ubo_ct);
+ glGetProgramiv(program, GL_ACTIVE_UNIFORM_BLOCKS, &ubo_len);
- const uint32_t name_buffer_len = attrib_ct * max_attrib_name_len + ubo_ct * max_ubo_name_len;
+ const uint32_t name_buffer_len = attr_len * max_attrib_name_len + ubo_len * max_ubo_name_len;
shaderface->name_buffer = malloc(name_buffer_len);
// Attributes
- for (uint32_t i = 0; i < attrib_ct; ++i)
+ for (uint32_t i = 0; i < attr_len; ++i)
{
Gwn_ShaderInput* input = malloc(sizeof(Gwn_ShaderInput));
GLsizei remaining_buffer = name_buffer_len - shaderface->name_buffer_offset;
@@ -245,7 +245,7 @@ Gwn_ShaderInterface* GWN_shaderinterface_create(int32_t program)
}
// Uniform Blocks
- for (uint32_t i = 0; i < ubo_ct; ++i)
+ for (uint32_t i = 0; i < ubo_len; ++i)
{
Gwn_ShaderInput* input = malloc(sizeof(Gwn_ShaderInput));
GLsizei remaining_buffer = name_buffer_len - shaderface->name_buffer_offset;
@@ -274,8 +274,8 @@ Gwn_ShaderInterface* GWN_shaderinterface_create(int32_t program)
}
// Batches ref buffer
- shaderface->batches_ct = GWN_SHADERINTERFACE_REF_ALLOC_COUNT;
- shaderface->batches = calloc(shaderface->batches_ct, sizeof(Gwn_Batch*));
+ shaderface->batches_len = GWN_SHADERINTERFACE_REF_ALLOC_COUNT;
+ shaderface->batches = calloc(shaderface->batches_len, sizeof(Gwn_Batch*));
return shaderface;
}
@@ -289,7 +289,7 @@ void GWN_shaderinterface_discard(Gwn_ShaderInterface* shaderface)
// Free memory used by name_buffer.
free(shaderface->name_buffer);
// Remove this interface from all linked Batches vao cache.
- for (int i = 0; i < shaderface->batches_ct; ++i)
+ for (int i = 0; i < shaderface->batches_len; ++i)
if (shaderface->batches[i] != NULL)
gwn_batch_remove_interface_ref(shaderface->batches[i], shaderface);
@@ -333,16 +333,16 @@ const Gwn_ShaderInput* GWN_shaderinterface_attr(const Gwn_ShaderInterface* shade
void GWN_shaderinterface_add_batch_ref(Gwn_ShaderInterface* shaderface, Gwn_Batch* batch)
{
int i; // find first unused slot
- for (i = 0; i < shaderface->batches_ct; ++i)
+ for (i = 0; i < shaderface->batches_len; ++i)
if (shaderface->batches[i] == NULL)
break;
- if (i == shaderface->batches_ct)
+ if (i == shaderface->batches_len)
{
// Not enough place, realloc the array.
- i = shaderface->batches_ct;
- shaderface->batches_ct += GWN_SHADERINTERFACE_REF_ALLOC_COUNT;
- shaderface->batches = realloc(shaderface->batches, sizeof(Gwn_Batch*) * shaderface->batches_ct);
+ i = shaderface->batches_len;
+ shaderface->batches_len += GWN_SHADERINTERFACE_REF_ALLOC_COUNT;
+ shaderface->batches = realloc(shaderface->batches, sizeof(Gwn_Batch*) * shaderface->batches_len);
memset(shaderface->batches + i, 0, sizeof(Gwn_Batch*) * GWN_SHADERINTERFACE_REF_ALLOC_COUNT);
}
@@ -351,7 +351,7 @@ void GWN_shaderinterface_add_batch_ref(Gwn_ShaderInterface* shaderface, Gwn_Batc
void GWN_shaderinterface_remove_batch_ref(Gwn_ShaderInterface* shaderface, Gwn_Batch* batch)
{
- for (int i = 0; i < shaderface->batches_ct; ++i)
+ for (int i = 0; i < shaderface->batches_len; ++i)
{
if (shaderface->batches[i] == batch)
{
diff --git a/intern/gawain/src/gwn_vertex_array_id.cpp b/intern/gawain/src/gwn_vertex_array_id.cpp
index d4b89a0f62b..70294565e6a 100644
--- a/intern/gawain/src/gwn_vertex_array_id.cpp
+++ b/intern/gawain/src/gwn_vertex_array_id.cpp
@@ -60,8 +60,8 @@ static void clear_orphans(Gwn_Context* ctx)
ctx->orphans_mutex.lock();
if (!ctx->orphaned_vertarray_ids.empty())
{
- unsigned orphan_ct = (unsigned)ctx->orphaned_vertarray_ids.size();
- glDeleteVertexArrays(orphan_ct, ctx->orphaned_vertarray_ids.data());
+ unsigned orphan_len = (unsigned)ctx->orphaned_vertarray_ids.size();
+ glDeleteVertexArrays(orphan_len, ctx->orphaned_vertarray_ids.data());
ctx->orphaned_vertarray_ids.clear();
}
ctx->orphans_mutex.unlock();
diff --git a/intern/gawain/src/gwn_vertex_buffer.c b/intern/gawain/src/gwn_vertex_buffer.c
index f621b4c01b9..a372c62bd0a 100644
--- a/intern/gawain/src/gwn_vertex_buffer.c
+++ b/intern/gawain/src/gwn_vertex_buffer.c
@@ -81,11 +81,11 @@ void GWN_vertbuf_discard(Gwn_VertBuf* verts)
unsigned GWN_vertbuf_size_get(const Gwn_VertBuf* verts)
{
- return vertex_buffer_size(&verts->format, verts->vertex_ct);
+ return vertex_buffer_size(&verts->format, verts->vertex_len);
}
// create a new allocation, discarding any existing data
-void GWN_vertbuf_data_alloc(Gwn_VertBuf* verts, unsigned v_ct)
+void GWN_vertbuf_data_alloc(Gwn_VertBuf* verts, unsigned v_len)
{
Gwn_VertFormat* format = &verts->format;
if (!format->packed)
@@ -93,7 +93,7 @@ void GWN_vertbuf_data_alloc(Gwn_VertBuf* verts, unsigned v_ct)
#if TRUST_NO_ONE
// catch any unnecessary use
- assert(verts->vertex_alloc != v_ct || verts->data == NULL);
+ assert(verts->vertex_alloc != v_len || verts->data == NULL);
#endif
// only create the buffer the 1st time
@@ -105,49 +105,49 @@ void GWN_vertbuf_data_alloc(Gwn_VertBuf* verts, unsigned v_ct)
free(verts->data);
#if VRAM_USAGE
- unsigned new_size = vertex_buffer_size(&verts->format, v_ct);
+ unsigned new_size = vertex_buffer_size(&verts->format, v_len);
vbo_memory_usage += new_size - GWN_vertbuf_size_get(verts);
#endif
verts->dirty = true;
- verts->vertex_ct = verts->vertex_alloc = v_ct;
+ verts->vertex_len = verts->vertex_alloc = v_len;
verts->data = malloc(sizeof(GLubyte) * GWN_vertbuf_size_get(verts));
}
// resize buffer keeping existing data
-void GWN_vertbuf_data_resize(Gwn_VertBuf* verts, unsigned v_ct)
+void GWN_vertbuf_data_resize(Gwn_VertBuf* verts, unsigned v_len)
{
#if TRUST_NO_ONE
assert(verts->data != NULL);
- assert(verts->vertex_alloc != v_ct);
+ assert(verts->vertex_alloc != v_len);
#endif
#if VRAM_USAGE
- unsigned new_size = vertex_buffer_size(&verts->format, v_ct);
+ unsigned new_size = vertex_buffer_size(&verts->format, v_len);
vbo_memory_usage += new_size - GWN_vertbuf_size_get(verts);
#endif
verts->dirty = true;
- verts->vertex_ct = verts->vertex_alloc = v_ct;
+ verts->vertex_len = verts->vertex_alloc = v_len;
verts->data = realloc(verts->data, sizeof(GLubyte) * GWN_vertbuf_size_get(verts));
}
// set vertex count but does not change allocation
// only this many verts will be uploaded to the GPU and rendered
// this is usefull for streaming data
-void GWN_vertbuf_vertex_count_set(Gwn_VertBuf* verts, unsigned v_ct)
+void GWN_vertbuf_vertex_count_set(Gwn_VertBuf* verts, unsigned v_len)
{
#if TRUST_NO_ONE
assert(verts->data != NULL); // only for dynamic data
- assert(v_ct <= verts->vertex_alloc);
+ assert(v_len <= verts->vertex_alloc);
#endif
#if VRAM_USAGE
- unsigned new_size = vertex_buffer_size(&verts->format, v_ct);
+ unsigned new_size = vertex_buffer_size(&verts->format, v_len);
vbo_memory_usage += new_size - GWN_vertbuf_size_get(verts);
#endif
- verts->vertex_ct = v_ct;
+ verts->vertex_len = v_len;
}
void GWN_vertbuf_attr_set(Gwn_VertBuf* verts, unsigned a_idx, unsigned v_idx, const void* data)
@@ -156,7 +156,7 @@ void GWN_vertbuf_attr_set(Gwn_VertBuf* verts, unsigned a_idx, unsigned v_idx, co
const Gwn_VertAttr* a = format->attribs + a_idx;
#if TRUST_NO_ONE
- assert(a_idx < format->attrib_ct);
+ assert(a_idx < format->attr_len);
assert(v_idx < verts->vertex_alloc);
assert(verts->data != NULL);
#endif
@@ -171,7 +171,7 @@ void GWN_vertbuf_attr_fill(Gwn_VertBuf* verts, unsigned a_idx, const void* data)
const Gwn_VertAttr* a = format->attribs + a_idx;
#if TRUST_NO_ONE
- assert(a_idx < format->attrib_ct);
+ assert(a_idx < format->attr_len);
#endif
const unsigned stride = a->sz; // tightly packed input data
@@ -185,22 +185,22 @@ void GWN_vertbuf_attr_fill_stride(Gwn_VertBuf* verts, unsigned a_idx, unsigned s
const Gwn_VertAttr* a = format->attribs + a_idx;
#if TRUST_NO_ONE
- assert(a_idx < format->attrib_ct);
+ assert(a_idx < format->attr_len);
assert(verts->data != NULL);
#endif
verts->dirty = true;
- const unsigned vertex_ct = verts->vertex_ct;
+ const unsigned vertex_len = verts->vertex_len;
- if (format->attrib_ct == 1 && stride == format->stride)
+ if (format->attr_len == 1 && stride == format->stride)
{
// we can copy it all at once
- memcpy(verts->data, data, vertex_ct * a->sz);
+ memcpy(verts->data, data, vertex_len * a->sz);
}
else
{
// we must copy it per vertex
- for (unsigned v = 0; v < vertex_ct; ++v)
+ for (unsigned v = 0; v < vertex_len; ++v)
memcpy((GLubyte*)verts->data + a->offset + v * format->stride, (const GLubyte*)data + v * stride, a->sz);
}
}
@@ -211,7 +211,7 @@ void GWN_vertbuf_attr_get_raw_data(Gwn_VertBuf* verts, unsigned a_idx, Gwn_VertB
const Gwn_VertAttr* a = format->attribs + a_idx;
#if TRUST_NO_ONE
- assert(a_idx < format->attrib_ct);
+ assert(a_idx < format->attr_len);
assert(verts->data != NULL);
#endif
diff --git a/intern/gawain/src/gwn_vertex_format.c b/intern/gawain/src/gwn_vertex_format.c
index c180c304d28..122de12ec6e 100644
--- a/intern/gawain/src/gwn_vertex_format.c
+++ b/intern/gawain/src/gwn_vertex_format.c
@@ -25,13 +25,13 @@ void GWN_vertformat_clear(Gwn_VertFormat* format)
#if TRUST_NO_ONE
memset(format, 0, sizeof(Gwn_VertFormat));
#else
- format->attrib_ct = 0;
+ format->attr_len = 0;
format->packed = false;
format->name_offset = 0;
- format->name_ct = 0;
+ format->name_len = 0;
for (unsigned i = 0; i < GWN_VERT_ATTR_MAX_LEN; i++)
- format->attribs[i].name_ct = 0;
+ format->attribs[i].name_len = 0;
#endif
}
@@ -40,8 +40,8 @@ void GWN_vertformat_copy(Gwn_VertFormat* dest, const Gwn_VertFormat* src)
// copy regular struct fields
memcpy(dest, src, sizeof(Gwn_VertFormat));
- for (unsigned i = 0; i < dest->attrib_ct; i++)
- for (unsigned j = 0; j < dest->attribs[i].name_ct; j++)
+ for (unsigned i = 0; i < dest->attr_len; i++)
+ for (unsigned j = 0; j < dest->attribs[i].name_len; j++)
dest->attribs[i].name[j] = (char *)dest + (src->attribs[i].name[j] - ((char *)src));
}
@@ -77,7 +77,7 @@ static unsigned attrib_sz(const Gwn_VertAttr *a)
if (a->comp_type == GWN_COMP_I10)
return 4; // always packed as 10_10_10_2
- return a->comp_ct * comp_sz(a->comp_type);
+ return a->comp_len * comp_sz(a->comp_type);
}
static unsigned attrib_align(const Gwn_VertAttr *a)
@@ -86,19 +86,19 @@ static unsigned attrib_align(const Gwn_VertAttr *a)
return 4; // always packed as 10_10_10_2
unsigned c = comp_sz(a->comp_type);
- if (a->comp_ct == 3 && c <= 2)
+ if (a->comp_len == 3 && c <= 2)
return 4 * c; // AMD HW can't fetch these well, so pad it out (other vendors too?)
else
return c; // most fetches are ok if components are naturally aligned
}
-unsigned vertex_buffer_size(const Gwn_VertFormat* format, unsigned vertex_ct)
+unsigned vertex_buffer_size(const Gwn_VertFormat* format, unsigned vertex_len)
{
#if TRUST_NO_ONE
assert(format->packed && format->stride > 0);
#endif
- return format->stride * vertex_ct;
+ return format->stride * vertex_len;
}
static const char* copy_attrib_name(Gwn_VertFormat* format, const char* name)
@@ -130,13 +130,13 @@ static const char* copy_attrib_name(Gwn_VertFormat* format, const char* name)
return name_copy;
}
-unsigned GWN_vertformat_attr_add(Gwn_VertFormat* format, const char* name, Gwn_VertCompType comp_type, unsigned comp_ct, Gwn_VertFetchMode fetch_mode)
+unsigned GWN_vertformat_attr_add(Gwn_VertFormat* format, const char* name, Gwn_VertCompType comp_type, unsigned comp_len, Gwn_VertFetchMode fetch_mode)
{
#if TRUST_NO_ONE
- assert(format->name_ct < GWN_VERT_ATTR_MAX_LEN); // there's room for more
- assert(format->attrib_ct < GWN_VERT_ATTR_MAX_LEN); // there's room for more
+ assert(format->name_len < GWN_VERT_ATTR_MAX_LEN); // there's room for more
+ assert(format->attr_len < GWN_VERT_ATTR_MAX_LEN); // there's room for more
assert(!format->packed); // packed means frozen/locked
- assert((comp_ct >= 1 && comp_ct <= 4) || comp_ct == 8 || comp_ct == 12 || comp_ct == 16);
+ assert((comp_len >= 1 && comp_len <= 4) || comp_len == 8 || comp_len == 12 || comp_len == 16);
switch (comp_type)
{
case GWN_COMP_F32:
@@ -146,25 +146,25 @@ unsigned GWN_vertformat_attr_add(Gwn_VertFormat* format, const char* name, Gwn_V
case GWN_COMP_I10:
// 10_10_10 format intended for normals (xyz) or colors (rgb)
// extra component packed.w can be manually set to { -2, -1, 0, 1 }
- assert(comp_ct == 3 || comp_ct == 4);
+ assert(comp_len == 3 || comp_len == 4);
assert(fetch_mode == GWN_FETCH_INT_TO_FLOAT_UNIT); // not strictly required, may relax later
break;
default:
// integer types can be kept as int or converted/normalized to float
assert(fetch_mode != GWN_FETCH_FLOAT);
// only support float matrices (see Batch_update_program_bindings)
- assert(comp_ct != 8 && comp_ct != 12 && comp_ct != 16);
+ assert(comp_len != 8 && comp_len != 12 && comp_len != 16);
}
#endif
- format->name_ct++; // multiname support
+ format->name_len++; // multiname support
- const unsigned attrib_id = format->attrib_ct++;
+ const unsigned attrib_id = format->attr_len++;
Gwn_VertAttr* attrib = format->attribs + attrib_id;
- attrib->name[attrib->name_ct++] = copy_attrib_name(format, name);
+ attrib->name[attrib->name_len++] = copy_attrib_name(format, name);
attrib->comp_type = comp_type;
attrib->gl_comp_type = convert_comp_type_to_gl(comp_type);
- attrib->comp_ct = (comp_type == GWN_COMP_I10) ? 4 : comp_ct; // system needs 10_10_10_2 to be 4 or BGRA
+ attrib->comp_len = (comp_type == GWN_COMP_I10) ? 4 : comp_len; // system needs 10_10_10_2 to be 4 or BGRA
attrib->sz = attrib_sz(attrib);
attrib->offset = 0; // offsets & stride are calculated later (during pack)
attrib->fetch_mode = fetch_mode;
@@ -174,13 +174,13 @@ unsigned GWN_vertformat_attr_add(Gwn_VertFormat* format, const char* name, Gwn_V
void GWN_vertformat_alias_add(Gwn_VertFormat* format, const char* alias)
{
- Gwn_VertAttr* attrib = format->attribs + (format->attrib_ct - 1);
+ Gwn_VertAttr* attrib = format->attribs + (format->attr_len - 1);
#if TRUST_NO_ONE
- assert(format->name_ct < GWN_VERT_ATTR_MAX_LEN); // there's room for more
- assert(attrib->name_ct < GWN_VERT_ATTR_MAX_NAMES);
+ assert(format->name_len < GWN_VERT_ATTR_MAX_LEN); // there's room for more
+ assert(attrib->name_len < GWN_VERT_ATTR_MAX_NAMES);
#endif
- format->name_ct++; // multiname support
- attrib->name[attrib->name_ct++] = copy_attrib_name(format, alias);
+ format->name_len++; // multiname support
+ attrib->name[attrib->name_len++] = copy_attrib_name(format, alias);
}
unsigned padding(unsigned offset, unsigned alignment)
@@ -220,7 +220,7 @@ void VertexFormat_pack(Gwn_VertFormat* format)
show_pack(0, a0->sz, 0);
#endif
- for (unsigned a_idx = 1; a_idx < format->attrib_ct; ++a_idx)
+ for (unsigned a_idx = 1; a_idx < format->attr_len; ++a_idx)
{
Gwn_VertAttr* a = format->attribs + a_idx;
unsigned mid_padding = padding(offset, attrib_align(a));