307 |
if stage.has_key(c): |
if stage.has_key(c): |
308 |
code += ("CombinerStageParameterNV COMBINER%s_NV %s %s\n" |
code += ("CombinerStageParameterNV COMBINER%s_NV %s %s\n" |
309 |
% (stage["num"], c, stage[c])) |
% (stage["num"], c, stage[c])) |
310 |
stage["perStageConst"] = stage["num"] |
stage["perStageConst"] = 1 |
311 |
del stage[c] |
del stage[c] |
312 |
|
|
313 |
for comp in "RGB", "ALPHA": |
for comp in "RGB", "ALPHA": |
486 |
# - A new combiner stage is started (unless empty) for all lines except for |
# - A new combiner stage is started (unless empty) for all lines except for |
487 |
# those adjacent "REG = OUT" assignments that can fit in the current stage. |
# those adjacent "REG = OUT" assignments that can fit in the current stage. |
488 |
# To force a new stage, just insert a blank line. |
# To force a new stage, just insert a blank line. |
489 |
# - Per stage constants are enabled unless all constant assignments are |
# - Per stage constants are enabled if any general combiner |
490 |
# either before or after all general combiner register assignments |
# block (separated by empty lines) contains constant assignements. |
491 |
|
# Put global constants into a separate block or into the final |
492 |
|
# combiner block. |
493 |
# - Only syntax is verified; Semantic errors may not be detected until |
# - Only syntax is verified; Semantic errors may not be detected until |
494 |
# the code is executed |
# the code is executed |
495 |
# |
# |
561 |
outcomp = left[0][2] |
outcomp = left[0][2] |
562 |
|
|
563 |
if outreg.startswith("CONST"): |
if outreg.startswith("CONST"): |
564 |
if stage["RGB"] or stage["ALPHA"]: |
if stage.has_key(outreg): |
565 |
|
print "WARING: a new stage implied by repeated", outreg |
566 |
code += outputGeneralCombiner(stage) |
code += outputGeneralCombiner(stage) |
567 |
stage[outreg] = line[pos+1:] |
stage[outreg] = line[pos+1:] |
568 |
else: |
else: |
574 |
return "" |
return "" |
575 |
|
|
576 |
if not addStageComp(stage[outcomp], out): |
if not addStageComp(stage[outcomp], out): |
577 |
|
print "WARNING: block split to multiple stages at", line |
578 |
code += outputGeneralCombiner(stage) |
code += outputGeneralCombiner(stage) |
579 |
stage[outcomp] = out |
stage[outcomp] = out |
580 |
|
|
583 |
print "ERROR: left side must be register:", line |
print "ERROR: left side must be register:", line |
584 |
return "" |
return "" |
585 |
|
|
586 |
if stage["num"] == 0: |
if stage["num"] == 0 and not (stage["RGB"] or stage["ALPHA"]): |
587 |
# Number of general combiners cannot be zero; |
# Number of general combiners cannot be zero; |
588 |
# add dummy state to force output |
# add dummy state to force output |
589 |
stage["RGB"]["foobar"] = 1 |
stage["RGB"]["foobar"] = 1 |
593 |
|
|
594 |
init = "" |
init = "" |
595 |
if stage.has_key("perStageConst"): |
if stage.has_key("perStageConst"): |
596 |
if stage["perStageConst"] > 0 or stage.has_key("globalConst"): |
init += "Enable PER_STAGE_CONSTANTS_NV\n" |
|
init += "Enable PER_STAGE_CONSTANTS_NV\n" |
|
|
else: |
|
|
code = code.replace("CombinerStageParameterNV COMBINER0_NV", |
|
|
"CombinerParameterNV") |
|
597 |
|
|
598 |
init += "CombinerParameterNV NUM_GENERAL_COMBINERS_NV %s\n" % stage["num"] |
init += "CombinerParameterNV NUM_GENERAL_COMBINERS_NV %s\n" % stage["num"] |
599 |
|
|