/[gzz]/gzz/gfx/libutil/nvcode.py
ViewVC logotype

Diff of /gzz/gfx/libutil/nvcode.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.12 by tjl, Tue Nov 26 10:48:41 2002 UTC revision 1.13 by jvk, Mon Jan 27 11:18:44 2003 UTC
# Line 307  def outputGeneralCombiner(stage): Line 307  def outputGeneralCombiner(stage):
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":
# Line 486  FUNC = REG '=' OUT Line 486  FUNC = REG '=' OUT
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  #  #
# Line 559  def parseCombiner(str): Line 561  def parseCombiner(str):
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:
# Line 571  def parseCombiner(str): Line 574  def parseCombiner(str):
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    
# Line 579  def parseCombiner(str): Line 583  def parseCombiner(str):
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
# Line 589  def parseCombiner(str): Line 593  def parseCombiner(str):
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                    

Legend:
Removed from v.1.12  
changed lines
  Added in v.1.13

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26