|
|
@@ -228,9 +228,7 @@ parse_and_set_short_hand_shader_vars(Shader::ShaderArgId &arg_id, GLenum param_t
|
|
|
bind._part[1] = Shader::SMO_apiclip_to_view;
|
|
|
}
|
|
|
|
|
|
- objShader->cp_optimize_mat_spec(bind);
|
|
|
- objShader->_mat_spec.push_back(bind);
|
|
|
- objShader->_mat_deps |= bind._dep[0] | bind._dep[1];
|
|
|
+ objShader->cp_add_mat_spec(bind);
|
|
|
|
|
|
if (param_size > 1) {
|
|
|
// We support arrays of rows and arrays of columns, so we can run the
|
|
|
@@ -243,7 +241,7 @@ parse_and_set_short_hand_shader_vars(Shader::ShaderArgId &arg_id, GLenum param_t
|
|
|
for (int i = 1; i < param_size; ++i) {
|
|
|
bind._id._seqno += 1;
|
|
|
bind._piece = (Shader::ShaderMatPiece)((int)bind._piece + 1);
|
|
|
- objShader->_mat_spec.push_back(bind);
|
|
|
+ objShader->cp_add_mat_spec(bind);
|
|
|
}
|
|
|
} else {
|
|
|
GLCAT.warning() << basename << "[" << param_size << "] should not be an array, only the first element will be defined\n";
|
|
|
@@ -380,6 +378,8 @@ CLP(ShaderContext)(CLP(GraphicsStateGuardian) *glgsg, Shader *s) : ShaderContext
|
|
|
} else {
|
|
|
_glgsg->_current_shader_context->bind();
|
|
|
}
|
|
|
+
|
|
|
+ _mat_part_cache = new LMatrix4[_shader->cp_get_mat_cache_size()];
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -885,15 +885,12 @@ reflect_uniform(int i, char *name_buffer, GLsizei name_buflen) {
|
|
|
bind._part[0] = inverse ? Shader::SMO_inv_texmat_i
|
|
|
: Shader::SMO_texmat_i;
|
|
|
bind._part[1] = Shader::SMO_identity;
|
|
|
- bind._dep[0] = Shader::SSD_general | Shader::SSD_tex_matrix;
|
|
|
- bind._dep[1] = 0;
|
|
|
|
|
|
// Add it once for each index.
|
|
|
for (bind._index = 0; bind._index < param_size; ++bind._index) {
|
|
|
bind._id._seqno = p + bind._index;
|
|
|
- _shader->_mat_spec.push_back(bind);
|
|
|
+ _shader->cp_add_mat_spec(bind);
|
|
|
}
|
|
|
- _shader->_mat_deps |= bind._dep[0];
|
|
|
return;
|
|
|
|
|
|
} else if (matrix_name.size() > 15 &&
|
|
|
@@ -938,9 +935,7 @@ reflect_uniform(int i, char *name_buffer, GLsizei name_buflen) {
|
|
|
GLCAT.error() << "Unrecognized uniform matrix name '" << matrix_name << "'!\n";
|
|
|
return;
|
|
|
}
|
|
|
- _shader->cp_optimize_mat_spec(bind);
|
|
|
- _shader->_mat_spec.push_back(bind);
|
|
|
- _shader->_mat_deps |= bind._dep[0] | bind._dep[1];
|
|
|
+ _shader->cp_add_mat_spec(bind);
|
|
|
return;
|
|
|
}
|
|
|
if (size > 7 && noprefix.substr(0, 7) == "Texture") {
|
|
|
@@ -973,10 +968,8 @@ reflect_uniform(int i, char *name_buffer, GLsizei name_buflen) {
|
|
|
bind._func = Shader::SMF_first;
|
|
|
bind._part[0] = Shader::SMO_attr_material;
|
|
|
bind._arg[0] = nullptr;
|
|
|
- bind._dep[0] = Shader::SSD_general | Shader::SSD_material | Shader::SSD_frame;
|
|
|
bind._part[1] = Shader::SMO_identity;
|
|
|
bind._arg[1] = nullptr;
|
|
|
- bind._dep[1] = Shader::SSD_NONE;
|
|
|
|
|
|
if (noprefix == "Material.baseColor") {
|
|
|
if (param_type != GL_FLOAT_VEC4) {
|
|
|
@@ -985,9 +978,7 @@ reflect_uniform(int i, char *name_buffer, GLsizei name_buflen) {
|
|
|
}
|
|
|
bind._part[0] = Shader::SMO_attr_material2;
|
|
|
bind._piece = Shader::SMP_row0;
|
|
|
- bind._dep[0] |= Shader::SSD_color;
|
|
|
- _shader->_mat_spec.push_back(bind);
|
|
|
- _shader->_mat_deps |= bind._dep[0];
|
|
|
+ _shader->cp_add_mat_spec(bind);
|
|
|
return;
|
|
|
|
|
|
} else if (noprefix == "Material.ambient") {
|
|
|
@@ -996,8 +987,7 @@ reflect_uniform(int i, char *name_buffer, GLsizei name_buflen) {
|
|
|
<< "p3d_Material.ambient should be vec4\n";
|
|
|
}
|
|
|
bind._piece = Shader::SMP_row0;
|
|
|
- _shader->_mat_spec.push_back(bind);
|
|
|
- _shader->_mat_deps |= bind._dep[0];
|
|
|
+ _shader->cp_add_mat_spec(bind);
|
|
|
return;
|
|
|
|
|
|
} else if (noprefix == "Material.diffuse") {
|
|
|
@@ -1006,8 +996,7 @@ reflect_uniform(int i, char *name_buffer, GLsizei name_buflen) {
|
|
|
<< "p3d_Material.diffuse should be vec4\n";
|
|
|
}
|
|
|
bind._piece = Shader::SMP_row1;
|
|
|
- _shader->_mat_spec.push_back(bind);
|
|
|
- _shader->_mat_deps |= bind._dep[0];
|
|
|
+ _shader->cp_add_mat_spec(bind);
|
|
|
return;
|
|
|
|
|
|
} else if (noprefix == "Material.emission") {
|
|
|
@@ -1016,8 +1005,7 @@ reflect_uniform(int i, char *name_buffer, GLsizei name_buflen) {
|
|
|
<< "p3d_Material.emission should be vec4\n";
|
|
|
}
|
|
|
bind._piece = Shader::SMP_row2;
|
|
|
- _shader->_mat_spec.push_back(bind);
|
|
|
- _shader->_mat_deps |= bind._dep[0];
|
|
|
+ _shader->cp_add_mat_spec(bind);
|
|
|
return;
|
|
|
|
|
|
} else if (noprefix == "Material.specular") {
|
|
|
@@ -1026,8 +1014,7 @@ reflect_uniform(int i, char *name_buffer, GLsizei name_buflen) {
|
|
|
<< "p3d_Material.specular should be vec3\n";
|
|
|
}
|
|
|
bind._piece = Shader::SMP_row3x3;
|
|
|
- _shader->_mat_spec.push_back(bind);
|
|
|
- _shader->_mat_deps |= bind._dep[0];
|
|
|
+ _shader->cp_add_mat_spec(bind);
|
|
|
return;
|
|
|
|
|
|
} else if (noprefix == "Material.shininess") {
|
|
|
@@ -1036,8 +1023,7 @@ reflect_uniform(int i, char *name_buffer, GLsizei name_buflen) {
|
|
|
<< "p3d_Material.shininess should be float\n";
|
|
|
}
|
|
|
bind._piece = Shader::SMP_cell15;
|
|
|
- _shader->_mat_spec.push_back(bind);
|
|
|
- _shader->_mat_deps |= bind._dep[0];
|
|
|
+ _shader->cp_add_mat_spec(bind);
|
|
|
return;
|
|
|
|
|
|
} else if (noprefix == "Material.roughness") {
|
|
|
@@ -1047,8 +1033,7 @@ reflect_uniform(int i, char *name_buffer, GLsizei name_buflen) {
|
|
|
}
|
|
|
bind._part[0] = Shader::SMO_attr_material2;
|
|
|
bind._piece = Shader::SMP_cell15;
|
|
|
- _shader->_mat_spec.push_back(bind);
|
|
|
- _shader->_mat_deps |= bind._dep[0];
|
|
|
+ _shader->cp_add_mat_spec(bind);
|
|
|
return;
|
|
|
|
|
|
} else if (noprefix == "Material.metallic") {
|
|
|
@@ -1058,8 +1043,7 @@ reflect_uniform(int i, char *name_buffer, GLsizei name_buflen) {
|
|
|
}
|
|
|
bind._part[0] = Shader::SMO_attr_material2;
|
|
|
bind._piece = Shader::SMP_row3x1;
|
|
|
- _shader->_mat_spec.push_back(bind);
|
|
|
- _shader->_mat_deps |= bind._dep[0];
|
|
|
+ _shader->cp_add_mat_spec(bind);
|
|
|
return;
|
|
|
|
|
|
} else if (noprefix == "Material.refractiveIndex") {
|
|
|
@@ -1069,8 +1053,7 @@ reflect_uniform(int i, char *name_buffer, GLsizei name_buflen) {
|
|
|
}
|
|
|
bind._part[0] = Shader::SMO_attr_material2;
|
|
|
bind._piece = Shader::SMP_cell13;
|
|
|
- _shader->_mat_spec.push_back(bind);
|
|
|
- _shader->_mat_deps |= bind._dep[0];
|
|
|
+ _shader->cp_add_mat_spec(bind);
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
@@ -1080,10 +1063,8 @@ reflect_uniform(int i, char *name_buffer, GLsizei name_buflen) {
|
|
|
bind._func = Shader::SMF_first;
|
|
|
bind._part[0] = Shader::SMO_attr_colorscale;
|
|
|
bind._arg[0] = nullptr;
|
|
|
- bind._dep[0] = Shader::SSD_general | Shader::SSD_colorscale;
|
|
|
bind._part[1] = Shader::SMO_identity;
|
|
|
bind._arg[1] = nullptr;
|
|
|
- bind._dep[1] = Shader::SSD_NONE;
|
|
|
|
|
|
if (param_type == GL_FLOAT_VEC3) {
|
|
|
bind._piece = Shader::SMP_row3x3;
|
|
|
@@ -1094,8 +1075,7 @@ reflect_uniform(int i, char *name_buffer, GLsizei name_buflen) {
|
|
|
<< "p3d_ColorScale should be vec3 or vec4\n";
|
|
|
return;
|
|
|
}
|
|
|
- _shader->_mat_spec.push_back(bind);
|
|
|
- _shader->_mat_deps |= bind._dep[0];
|
|
|
+ _shader->cp_add_mat_spec(bind);
|
|
|
return;
|
|
|
}
|
|
|
if (noprefix == "Color") {
|
|
|
@@ -1104,10 +1084,8 @@ reflect_uniform(int i, char *name_buffer, GLsizei name_buflen) {
|
|
|
bind._func = Shader::SMF_first;
|
|
|
bind._part[0] = Shader::SMO_attr_color;
|
|
|
bind._arg[0] = nullptr;
|
|
|
- bind._dep[0] = Shader::SSD_general | Shader::SSD_color;
|
|
|
bind._part[1] = Shader::SMO_identity;
|
|
|
bind._arg[1] = nullptr;
|
|
|
- bind._dep[1] = Shader::SSD_NONE;
|
|
|
|
|
|
if (param_type == GL_FLOAT_VEC3) {
|
|
|
bind._piece = Shader::SMP_row3x3;
|
|
|
@@ -1118,8 +1096,7 @@ reflect_uniform(int i, char *name_buffer, GLsizei name_buflen) {
|
|
|
<< "p3d_Color should be vec3 or vec4\n";
|
|
|
return;
|
|
|
}
|
|
|
- _shader->_mat_spec.push_back(bind);
|
|
|
- _shader->_mat_deps |= bind._dep[0];
|
|
|
+ _shader->cp_add_mat_spec(bind);
|
|
|
return;
|
|
|
}
|
|
|
if (noprefix == "ClipPlane") {
|
|
|
@@ -1137,12 +1114,9 @@ reflect_uniform(int i, char *name_buffer, GLsizei name_buflen) {
|
|
|
bind._index = i;
|
|
|
bind._part[0] = Shader::SMO_apiview_clipplane_i;
|
|
|
bind._arg[0] = nullptr;
|
|
|
- bind._dep[0] = Shader::SSD_general | Shader::SSD_clip_planes;
|
|
|
bind._part[1] = Shader::SMO_identity;
|
|
|
bind._arg[1] = nullptr;
|
|
|
- bind._dep[1] = Shader::SSD_NONE;
|
|
|
- _shader->_mat_spec.push_back(bind);
|
|
|
- _shader->_mat_deps |= bind._dep[0];
|
|
|
+ _shader->cp_add_mat_spec(bind);
|
|
|
}
|
|
|
return;
|
|
|
}
|
|
|
@@ -1151,10 +1125,8 @@ reflect_uniform(int i, char *name_buffer, GLsizei name_buflen) {
|
|
|
bind._id = arg_id;
|
|
|
bind._func = Shader::SMF_first;
|
|
|
bind._arg[0] = nullptr;
|
|
|
- bind._dep[0] = Shader::SSD_general | Shader::SSD_fog;
|
|
|
bind._part[1] = Shader::SMO_identity;
|
|
|
bind._arg[1] = nullptr;
|
|
|
- bind._dep[1] = Shader::SSD_NONE;
|
|
|
|
|
|
if (noprefix == "Fog.color") {
|
|
|
bind._part[0] = Shader::SMO_attr_fogcolor;
|
|
|
@@ -1214,8 +1186,7 @@ reflect_uniform(int i, char *name_buffer, GLsizei name_buflen) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- _shader->_mat_spec.push_back(bind);
|
|
|
- _shader->_mat_deps |= bind._dep[0];
|
|
|
+ _shader->cp_add_mat_spec(bind);
|
|
|
return;
|
|
|
}
|
|
|
if (noprefix == "LightModel.ambient") {
|
|
|
@@ -1224,10 +1195,8 @@ reflect_uniform(int i, char *name_buffer, GLsizei name_buflen) {
|
|
|
bind._func = Shader::SMF_first;
|
|
|
bind._part[0] = Shader::SMO_light_ambient;
|
|
|
bind._arg[0] = nullptr;
|
|
|
- bind._dep[0] = Shader::SSD_general | Shader::SSD_light;
|
|
|
bind._part[1] = Shader::SMO_identity;
|
|
|
bind._arg[1] = nullptr;
|
|
|
- bind._dep[1] = Shader::SSD_NONE;
|
|
|
|
|
|
if (param_type == GL_FLOAT_VEC3) {
|
|
|
bind._piece = Shader::SMP_row3x3;
|
|
|
@@ -1238,8 +1207,7 @@ reflect_uniform(int i, char *name_buffer, GLsizei name_buflen) {
|
|
|
<< "p3d_LightModel.ambient should be vec3 or vec4\n";
|
|
|
return;
|
|
|
}
|
|
|
- _shader->_mat_spec.push_back(bind);
|
|
|
- _shader->_mat_deps |= bind._dep[0];
|
|
|
+ _shader->cp_add_mat_spec(bind);
|
|
|
return;
|
|
|
}
|
|
|
if (size > 15 && noprefix.substr(0, 12) == "LightSource[") {
|
|
|
@@ -1279,15 +1247,8 @@ reflect_uniform(int i, char *name_buffer, GLsizei name_buflen) {
|
|
|
bind._index = index;
|
|
|
bind._part[0] = Shader::SMO_light_source_i_attrib;
|
|
|
bind._arg[0] = InternalName::make(member_name);
|
|
|
- bind._dep[0] = Shader::SSD_general | Shader::SSD_light | Shader::SSD_frame;
|
|
|
bind._part[1] = Shader::SMO_identity;
|
|
|
bind._arg[1] = nullptr;
|
|
|
- bind._dep[1] = Shader::SSD_NONE;
|
|
|
-
|
|
|
- if (member_name == "position" || member_name == "halfVector" ||
|
|
|
- member_name == "spotDirection") {
|
|
|
- bind._dep[0] |= Shader::SSD_view_transform;
|
|
|
- }
|
|
|
|
|
|
switch (param_type) {
|
|
|
case GL_FLOAT:
|
|
|
@@ -1311,8 +1272,7 @@ reflect_uniform(int i, char *name_buffer, GLsizei name_buflen) {
|
|
|
<< "p3d_LightSource[]." << member_name << " should be float or vec\n";
|
|
|
return;
|
|
|
}
|
|
|
- _shader->_mat_spec.push_back(bind);
|
|
|
- _shader->_mat_deps |= bind._dep[0] | bind._dep[1];
|
|
|
+ _shader->cp_add_mat_spec(bind);
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
@@ -1344,13 +1304,10 @@ reflect_uniform(int i, char *name_buffer, GLsizei name_buflen) {
|
|
|
bind._index = 0;
|
|
|
bind._part[0] = Shader::SMO_tex_is_alpha_i;
|
|
|
bind._arg[0] = nullptr;
|
|
|
- bind._dep[0] = Shader::SSD_general | Shader::SSD_texture | Shader::SSD_frame;
|
|
|
bind._part[1] = Shader::SMO_identity;
|
|
|
bind._arg[1] = nullptr;
|
|
|
- bind._dep[1] = Shader::SSD_NONE;
|
|
|
bind._piece = Shader::SMP_row3;
|
|
|
- _shader->_mat_spec.push_back(bind);
|
|
|
- _shader->_mat_deps |= bind._dep[0] | bind._dep[1];
|
|
|
+ _shader->cp_add_mat_spec(bind);
|
|
|
return;
|
|
|
}
|
|
|
GLCAT.error() << "Unrecognized uniform name '" << param_name << "'!\n";
|
|
|
@@ -1371,10 +1328,7 @@ reflect_uniform(int i, char *name_buffer, GLsizei name_buflen) {
|
|
|
bind._func = Shader::SMF_compose;
|
|
|
bind._part[0] = Shader::SMO_world_to_view;
|
|
|
bind._part[1] = Shader::SMO_view_to_apiview;
|
|
|
- bind._dep[0] = Shader::SSD_general | Shader::SSD_view_transform;
|
|
|
- bind._dep[1] = Shader::SSD_general;
|
|
|
- _shader->_mat_spec.push_back(bind);
|
|
|
- _shader->_mat_deps |= bind._dep[0] | bind._dep[1];
|
|
|
+ _shader->cp_add_mat_spec(bind);
|
|
|
return;
|
|
|
|
|
|
} else if (noprefix == "InverseViewMatrix" || noprefix == "ViewMatrixInverse") {
|
|
|
@@ -1382,10 +1336,7 @@ reflect_uniform(int i, char *name_buffer, GLsizei name_buflen) {
|
|
|
bind._func = Shader::SMF_compose;
|
|
|
bind._part[0] = Shader::SMO_apiview_to_view;
|
|
|
bind._part[1] = Shader::SMO_view_to_world;
|
|
|
- bind._dep[0] = Shader::SSD_general;
|
|
|
- bind._dep[1] = Shader::SSD_general | Shader::SSD_view_transform;
|
|
|
- _shader->_mat_spec.push_back(bind);
|
|
|
- _shader->_mat_deps |= bind._dep[0] | bind._dep[1];
|
|
|
+ _shader->cp_add_mat_spec(bind);
|
|
|
return;
|
|
|
|
|
|
} else if (noprefix == "FrameTime") {
|
|
|
@@ -1393,10 +1344,7 @@ reflect_uniform(int i, char *name_buffer, GLsizei name_buflen) {
|
|
|
bind._func = Shader::SMF_first;
|
|
|
bind._part[0] = Shader::SMO_frame_time;
|
|
|
bind._part[1] = Shader::SMO_identity;
|
|
|
- bind._dep[0] = Shader::SSD_general | Shader::SSD_frame;
|
|
|
- bind._dep[1] = Shader::SSD_NONE;
|
|
|
- _shader->_mat_spec.push_back(bind);
|
|
|
- _shader->_mat_deps |= bind._dep[0] | bind._dep[1];
|
|
|
+ _shader->cp_add_mat_spec(bind);
|
|
|
return;
|
|
|
|
|
|
} else if (noprefix == "DeltaFrameTime") {
|
|
|
@@ -1404,10 +1352,7 @@ reflect_uniform(int i, char *name_buffer, GLsizei name_buflen) {
|
|
|
bind._func = Shader::SMF_first;
|
|
|
bind._part[0] = Shader::SMO_frame_delta;
|
|
|
bind._part[1] = Shader::SMO_identity;
|
|
|
- bind._dep[0] = Shader::SSD_general | Shader::SSD_frame;
|
|
|
- bind._dep[1] = Shader::SSD_NONE;
|
|
|
- _shader->_mat_spec.push_back(bind);
|
|
|
- _shader->_mat_deps |= bind._dep[0] | bind._dep[1];
|
|
|
+ _shader->cp_add_mat_spec(bind);
|
|
|
return;
|
|
|
|
|
|
} else if (noprefix == "FrameNumber") {
|
|
|
@@ -1491,12 +1436,9 @@ reflect_uniform(int i, char *name_buffer, GLsizei name_buflen) {
|
|
|
bind._func = Shader::SMF_first;
|
|
|
bind._part[0] = Shader::SMO_mat_constant_x;
|
|
|
bind._arg[0] = InternalName::make(param_name);
|
|
|
- bind._dep[0] = Shader::SSD_general | Shader::SSD_shaderinputs | Shader::SSD_frame;
|
|
|
bind._part[1] = Shader::SMO_identity;
|
|
|
bind._arg[1] = nullptr;
|
|
|
- bind._dep[1] = Shader::SSD_NONE;
|
|
|
- _shader->_mat_spec.push_back(bind);
|
|
|
- _shader->_mat_deps |= bind._dep[0];
|
|
|
+ _shader->cp_add_mat_spec(bind);
|
|
|
return;
|
|
|
}
|
|
|
case GL_FLOAT_MAT4: {
|
|
|
@@ -1506,7 +1448,6 @@ reflect_uniform(int i, char *name_buffer, GLsizei name_buflen) {
|
|
|
bind._func = Shader::SMF_first;
|
|
|
bind._part[1] = Shader::SMO_identity;
|
|
|
bind._arg[1] = nullptr;
|
|
|
- bind._dep[1] = Shader::SSD_NONE;
|
|
|
PT(InternalName) iname = InternalName::make(param_name);
|
|
|
if (iname->get_parent() != InternalName::get_root()) {
|
|
|
// It might be something like an attribute of a shader input, like a
|
|
|
@@ -1527,22 +1468,17 @@ reflect_uniform(int i, char *name_buffer, GLsizei name_buflen) {
|
|
|
bind._func = Shader::SMF_compose;
|
|
|
bind._part[0] = Shader::SMO_model_to_apiview;
|
|
|
bind._arg[0] = nullptr;
|
|
|
- bind._dep[0] = Shader::SSD_general | Shader::SSD_transform;
|
|
|
bind._part[1] = Shader::SMO_mat_constant_x_attrib;
|
|
|
bind._arg[1] = iname->get_parent()->append("shadowViewMatrix");
|
|
|
- bind._dep[1] = Shader::SSD_general | Shader::SSD_shaderinputs | Shader::SSD_frame | Shader::SSD_view_transform;
|
|
|
} else {
|
|
|
bind._part[0] = Shader::SMO_mat_constant_x_attrib;
|
|
|
bind._arg[0] = InternalName::make(param_name);
|
|
|
- bind._dep[0] = Shader::SSD_general | Shader::SSD_shaderinputs | Shader::SSD_frame | Shader::SSD_view_transform;
|
|
|
}
|
|
|
} else {
|
|
|
bind._part[0] = Shader::SMO_mat_constant_x;
|
|
|
bind._arg[0] = InternalName::make(param_name);
|
|
|
- bind._dep[0] = Shader::SSD_general | Shader::SSD_shaderinputs | Shader::SSD_frame;
|
|
|
}
|
|
|
- _shader->_mat_spec.push_back(bind);
|
|
|
- _shader->_mat_deps |= bind._dep[0];
|
|
|
+ _shader->cp_add_mat_spec(bind);
|
|
|
return;
|
|
|
}
|
|
|
case GL_FLOAT:
|
|
|
@@ -1572,14 +1508,9 @@ reflect_uniform(int i, char *name_buffer, GLsizei name_buflen) {
|
|
|
bind._func = Shader::SMF_first;
|
|
|
bind._part[0] = Shader::SMO_vec_constant_x_attrib;
|
|
|
bind._arg[0] = iname;
|
|
|
- // We need SSD_view_transform since some attributes (eg. light
|
|
|
- // position) have to be transformed to view space.
|
|
|
- bind._dep[0] = Shader::SSD_general | Shader::SSD_shaderinputs | Shader::SSD_frame | Shader::SSD_view_transform;
|
|
|
bind._part[1] = Shader::SMO_identity;
|
|
|
bind._arg[1] = nullptr;
|
|
|
- bind._dep[1] = Shader::SSD_NONE;
|
|
|
- _shader->_mat_spec.push_back(bind);
|
|
|
- _shader->_mat_deps |= bind._dep[0];
|
|
|
+ _shader->cp_add_mat_spec(bind);
|
|
|
return;
|
|
|
} // else fall through
|
|
|
}
|
|
|
@@ -1913,6 +1844,7 @@ get_sampler_texture_type(int &out, GLenum param_type) {
|
|
|
CLP(ShaderContext)::
|
|
|
~CLP(ShaderContext)() {
|
|
|
// Don't call release_resources; we may not have an active context.
|
|
|
+ delete[] _mat_part_cache;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -2230,14 +2162,14 @@ issue_parameters(int altered) {
|
|
|
}
|
|
|
|
|
|
if (altered & _shader->_mat_deps) {
|
|
|
- for (int i = 0; i < (int)_shader->_mat_spec.size(); ++i) {
|
|
|
- Shader::ShaderMatSpec &spec = _shader->_mat_spec[i];
|
|
|
+ _glgsg->update_shader_matrix_cache(_shader, _mat_part_cache, altered);
|
|
|
|
|
|
- if ((altered & (spec._dep[0] | spec._dep[1])) == 0) {
|
|
|
+ for (Shader::ShaderMatSpec &spec : _shader->_mat_spec) {
|
|
|
+ if ((altered & spec._dep) == 0) {
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
- const LMatrix4 *val = _glgsg->fetch_specified_value(spec, altered);
|
|
|
+ const LMatrix4 *val = _glgsg->fetch_specified_value(spec, _mat_part_cache, altered);
|
|
|
if (!val) continue;
|
|
|
#ifndef STDFLOAT_DOUBLE
|
|
|
// In this case, the data is already single-precision.
|