Fix some miscompilations with unused variables.

This commit is contained in:
Themaister 2013-08-10 23:35:03 +02:00
parent 1a071c4992
commit ad12cc8ab6

View File

@ -326,6 +326,7 @@ def replace_varyings(source):
translated = translate_varying(orig)
if translated != orig and translated not in attribs:
cg_attrib = line.split(':')[2].split(' ')[1]
if len(cg_attrib.strip()) > 0:
translations.append((cg_attrib, translated))
attribs.append(translated)
elif ('//var' in line) or ('#var' in line):
@ -333,6 +334,7 @@ def replace_varyings(source):
translated = translate_texture_size(orig)
if translated != orig and translated not in uniforms:
cg_uniform = line.split(':')[2].split(' ')[1]
if len(cg_uniform.strip()) > 0:
translations.append((cg_uniform, translated))
uniforms.append(translated)
@ -494,10 +496,10 @@ def hack_source_fragment(source):
translated = translate_texture_size(orig)
if translated != orig and translated not in uniforms:
cg_uniform = line.split(':')[2].split(' ')[1]
if len(cg_uniform.strip()) > 0:
translations.append((cg_uniform, translated))
uniforms.append(translated)
for sampler in added_samplers:
source.insert(ref_index, sampler)
for uniform in uniforms:
@ -508,6 +510,7 @@ def hack_source_fragment(source):
ret = []
for line in source:
for translation in translations:
log('Translation:', translation[0], '->', translation[1])
line = line.replace(translation[0], translation[1])
ret.append(line)