/[gzz]/gzz/gfx/demo/opengl/texperf.py
ViewVC logotype

Diff of /gzz/gfx/demo/opengl/texperf.py

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

revision 1.4 by tjl, Mon Sep 23 11:15:42 2002 UTC revision 1.5 by tjl, Mon Sep 23 12:45:25 2002 UTC
# Line 13  Line 13 
13  #  - BASE_LEVEL *does* have an effect - I falsely concluded earlier that it didn't.  #  - BASE_LEVEL *does* have an effect - I falsely concluded earlier that it didn't.
14  #    Therefore, we'll be using that for quite a lot of things...  #    Therefore, we'll be using that for quite a lot of things...
15    
16  form = "R3_G3_B2"  forms = ("R3_G3_B2",)
17  size = 1024  # sizes = (512,1024,)
18  baselevel=0  baselevels =(0,1,2,3,4,5)
19    
20    sizes = (512,)
21    size = sizes[0]
22    
23    form = forms[0]
24    
25  img = GL.createImage("doc/gl/irreg0.png")  img = GL.createImage("doc/gl/irreg0.png")
26    
# Line 58  class TPScene: Line 63  class TPScene:
63      def __init__(self):      def __init__(self):
64          self.ntex = 2          self.ntex = 2
65      def time(self):      def time(self):
66          if not globals().has_key("tex"):          if not globals().has_key("texes"):
67              maketex()              maketex()
68          times = []          for s in sizes:
69          for nt in range(0,len(texes)):            for baselevel in baselevels:
70              vs = w.createVobScene()              times = []
71              putnoc(vs, background((0.1, 0.2, 0.5)))              for nt in range(0,len(texes)):
72              putnoc(vs, getDListNocoords("""                  vs = w.createVobScene()
73                  Enable TEXTURE_2D                  putnoc(vs, background((0.1, 0.2, 0.5)))
             """))  
             for i in range(0, nt):  
                 texid = texes[i].getTexId()  
                 if 0:  
                     print "Id ",texid  
                     print "Resid", GL.getGLTexParameterFloat("TEXTURE_2D", texes[i].getTexId(), "TEXTURE_RESIDENT")  
                     print "Prio", GL.getGLTexParameterFloat("TEXTURE_2D", texes[i].getTexId(), "TEXTURE_PRIORITY")  
                     printTex(texid)  
74                  putnoc(vs, getDListNocoords("""                  putnoc(vs, getDListNocoords("""
75                      BindTexture TEXTURE_2D %s                      Enable TEXTURE_2D
76                      TexParameter TEXTURE_2D TEXTURE_MAG_FILTER LINEAR                  """))
77                      TexParameter TEXTURE_2D TEXTURE_MIN_FILTER LINEAR_MIPMAP_LINEAR                  for i in range(0, nt):
78                      TexParameter TEXTURE_2D TEXTURE_BASE_LEVEL 2                      texid = texes[i].getTexId()
79                  """ % texes[i].getTexId()))                      if 0:
80                  vs.put(quad(), "T"+str(i), 50-i, 100+2*i, 100+2*i, 100, 100)                          print "Id ",texid
81              niters = 10                          print "Resid", GL.getGLTexParameterFloat("TEXTURE_2D", texes[i].getTexId(), "TEXTURE_RESIDENT")
82              t = w.timeRender(vs, niters) / niters                          print "Prio", GL.getGLTexParameterFloat("TEXTURE_2D", texes[i].getTexId(), "TEXTURE_PRIORITY")
83              print "Time: ", nt, t                          printTex(texid)
84              times.append(t)                      putnoc(vs, getDListNocoords("""
85              if t > 0.3:                          BindTexture TEXTURE_2D %s
86                  break                          TexParameter TEXTURE_2D TEXTURE_MAG_FILTER LINEAR
87          print times                          TexParameter TEXTURE_2D TEXTURE_MIN_FILTER LINEAR_MIPMAP_LINEAR
88                            TexParameter TEXTURE_2D TEXTURE_BASE_LEVEL %s
89                        """ % (texes[i].getTexId(), baselevel)))
90                        vs.put(quad(), "T"+str(i), 50-i, 100+2*i, 100+2*i, 100, 100)
91                    niters = 30
92                    t = w.timeRender(vs, niters) / niters
93                    print "Time: ", nt, t
94                    times.append("%s %s\n" % (nt, t))
95                    if t > 0.3:
96                        break
97                print times
98                f = open("tmp/t_%s_%s_%s" % (form, size, baselevel), "w")
99                for t in times:
100                    f.write(t)
101                f.write("\n")
102                f.close()
103    
104      def key(self, key):      def key(self, key):
105          if key == 't':          if key == 't':

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.5

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