Fix crash in shader generator when mixing texgen stages and non-texgen stages

This commit is contained in:
rdb 2009-09-05 05:40:40 +00:00
parent d807610d32
commit 4aef327d79

View File

@ -591,12 +591,10 @@ synthesize_shader(const RenderState *rs) {
const TextureAttrib *texture = DCAST(TextureAttrib, rs->get_attrib_def(TextureAttrib::get_class_slot()));
const TexGenAttrib *tex_gen = DCAST(TexGenAttrib, rs->get_attrib_def(TexGenAttrib::get_class_slot()));
for (int i=0; i<_num_textures; i++) {
if (!tex_gen->has_stage(texture->get_on_stage(i))) {
texcoord_vreg.push_back(alloc_vreg());
texcoord_freg.push_back(alloc_freg());
text << "\t in float4 vtx_texcoord" << i << " : " << texcoord_vreg[i] << ",\n";
text << "\t out float4 l_texcoord" << i << " : " << texcoord_freg[i] << ",\n";
}
texcoord_vreg.push_back(alloc_vreg());
texcoord_freg.push_back(alloc_freg());
text << "\t in float4 vtx_texcoord" << i << " : " << texcoord_vreg[i] << ",\n";
text << "\t out float4 l_texcoord" << i << " : " << texcoord_freg[i] << ",\n";
}
if (_vertex_colors) {
text << "\t in float4 vtx_color : COLOR,\n";