Main repository of MikuMikuStudio
リビジョン | cc0807758b42fe049353e88d2a78c626b46ac27c (tree) |
---|---|
日時 | 2013-05-16 09:34:16 |
作者 | shadowisLORD <shadowisLORD@75d0...> |
コミッター | shadowisLORD |
git-svn-id: http://jmonkeyengine.googlecode.com/svn/trunk@10617 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
@@ -32,6 +32,7 @@ | ||
32 | 32 | package com.jme3.audio; |
33 | 33 | |
34 | 34 | import com.jme3.audio.AudioData.DataType; |
35 | +import com.jme3.util.BufferUtils; | |
35 | 36 | import com.jme3.util.NativeObject; |
36 | 37 | import java.nio.ByteBuffer; |
37 | 38 |
@@ -102,10 +103,13 @@ public class AudioBuffer extends AudioData { | ||
102 | 103 | setUpdateNeeded(); |
103 | 104 | } |
104 | 105 | |
105 | - public void deleteObject(AudioRenderer ar) { | |
106 | - | |
106 | + @Override | |
107 | + protected void deleteNativeBuffers() { | |
108 | + if (audioData != null) { | |
109 | + BufferUtils.destroyDirectBuffer(audioData); | |
110 | + } | |
107 | 111 | } |
108 | - | |
112 | + | |
109 | 113 | @Override |
110 | 114 | public void deleteObject(Object rendererObject) { |
111 | 115 | ((AudioRenderer)rendererObject).deleteAudioData(this); |
@@ -53,11 +53,11 @@ public abstract class AudioData extends NativeObject { | ||
53 | 53 | } |
54 | 54 | |
55 | 55 | public AudioData(){ |
56 | - super(AudioData.class); | |
56 | + super(); | |
57 | 57 | } |
58 | 58 | |
59 | 59 | protected AudioData(int id){ |
60 | - super(AudioData.class, id); | |
60 | + super(id); | |
61 | 61 | } |
62 | 62 | |
63 | 63 | /** |
@@ -40,11 +40,11 @@ import java.io.IOException; | ||
40 | 40 | public abstract class Filter extends NativeObject implements Savable { |
41 | 41 | |
42 | 42 | public Filter(){ |
43 | - super(Filter.class); | |
43 | + super(); | |
44 | 44 | } |
45 | 45 | |
46 | 46 | protected Filter(int id){ |
47 | - super(Filter.class, id); | |
47 | + super(id); | |
48 | 48 | } |
49 | 49 | |
50 | 50 | public void write(JmeExporter ex) throws IOException { |
@@ -32,6 +32,7 @@ | ||
32 | 32 | package com.jme3.renderer; |
33 | 33 | |
34 | 34 | import com.jme3.shader.Shader; |
35 | +import com.jme3.shader.Shader.ShaderSource; | |
35 | 36 | import com.jme3.texture.FrameBuffer; |
36 | 37 | import com.jme3.texture.FrameBuffer.RenderBuffer; |
37 | 38 | import com.jme3.texture.Image; |
@@ -346,29 +347,30 @@ public enum Caps { | ||
346 | 347 | * @return True if it is supported, false otherwise. |
347 | 348 | */ |
348 | 349 | public static boolean supports(Collection<Caps> caps, Shader shader){ |
349 | - String lang = shader.getLanguage(); | |
350 | - if (lang.startsWith("GLSL")){ | |
351 | - int ver = Integer.parseInt(lang.substring(4)); | |
352 | - switch (ver){ | |
353 | - case 100: | |
354 | - return caps.contains(Caps.GLSL100); | |
355 | - case 110: | |
356 | - return caps.contains(Caps.GLSL110); | |
357 | - case 120: | |
358 | - return caps.contains(Caps.GLSL120); | |
359 | - case 130: | |
360 | - return caps.contains(Caps.GLSL130); | |
361 | - case 140: | |
362 | - return caps.contains(Caps.GLSL140); | |
363 | - case 150: | |
364 | - return caps.contains(Caps.GLSL150); | |
365 | - case 330: | |
366 | - return caps.contains(Caps.GLSL330); | |
367 | - default: | |
368 | - return false; | |
350 | + for (ShaderSource source : shader.getSources()) { | |
351 | + if (source.getLanguage().startsWith("GLSL")) { | |
352 | + int ver = Integer.parseInt(source.getLanguage().substring(4)); | |
353 | + switch (ver) { | |
354 | + case 100: | |
355 | + if (!caps.contains(Caps.GLSL100)) return false; | |
356 | + case 110: | |
357 | + if (!caps.contains(Caps.GLSL110)) return false; | |
358 | + case 120: | |
359 | + if (!caps.contains(Caps.GLSL120)) return false; | |
360 | + case 130: | |
361 | + if (!caps.contains(Caps.GLSL130)) return false; | |
362 | + case 140: | |
363 | + if (!caps.contains(Caps.GLSL140)) return false; | |
364 | + case 150: | |
365 | + if (!caps.contains(Caps.GLSL150)) return false; | |
366 | + case 330: | |
367 | + if (!caps.contains(Caps.GLSL330)) return false; | |
368 | + default: | |
369 | + return false; | |
370 | + } | |
369 | 371 | } |
370 | 372 | } |
371 | - return false; | |
373 | + return true; | |
372 | 374 | } |
373 | 375 | |
374 | 376 | } |
@@ -319,7 +319,7 @@ public class VertexBuffer extends NativeObject implements Savable, Cloneable { | ||
319 | 319 | * Must call setupData() to initialize. |
320 | 320 | */ |
321 | 321 | public VertexBuffer(Type type){ |
322 | - super(VertexBuffer.class); | |
322 | + super(); | |
323 | 323 | this.bufType = type; |
324 | 324 | } |
325 | 325 |
@@ -327,13 +327,54 @@ public class VertexBuffer extends NativeObject implements Savable, Cloneable { | ||
327 | 327 | * Serialization only. Do not use. |
328 | 328 | */ |
329 | 329 | public VertexBuffer(){ |
330 | - super(VertexBuffer.class); | |
330 | + super(); | |
331 | 331 | } |
332 | 332 | |
333 | 333 | protected VertexBuffer(int id){ |
334 | - super(VertexBuffer.class, id); | |
334 | + super(id); | |
335 | 335 | } |
336 | 336 | |
337 | + public boolean invariant() { | |
338 | + // Does the VB hold any data? | |
339 | + if (data == null) { | |
340 | + throw new AssertionError(); | |
341 | + } | |
342 | + // Does offset exceed buffer limit or negative? | |
343 | + if (offset > data.limit() || offset < 0) { | |
344 | + throw new AssertionError(); | |
345 | + } | |
346 | + // Are components between 1 and 4? | |
347 | + if (components < 1 || components > 4) { | |
348 | + throw new AssertionError(); | |
349 | + } | |
350 | + | |
351 | + // Does usage comply with buffer directness? | |
352 | + //if (usage == Usage.CpuOnly && data.isDirect()) { | |
353 | + // throw new AssertionError(); | |
354 | + /*} else*/ if (usage != Usage.CpuOnly && !data.isDirect()) { | |
355 | + throw new AssertionError(); | |
356 | + } | |
357 | + | |
358 | + // Double/Char/Long buffers are not supported for VertexBuffers. | |
359 | + // For the rest, ensure they comply with the "Format" value. | |
360 | + if (data instanceof DoubleBuffer) { | |
361 | + throw new AssertionError(); | |
362 | + } else if (data instanceof CharBuffer) { | |
363 | + throw new AssertionError(); | |
364 | + } else if (data instanceof LongBuffer) { | |
365 | + throw new AssertionError(); | |
366 | + } else if (data instanceof FloatBuffer && format != Format.Float) { | |
367 | + throw new AssertionError(); | |
368 | + } else if (data instanceof IntBuffer && format != Format.Int && format != Format.UnsignedInt) { | |
369 | + throw new AssertionError(); | |
370 | + } else if (data instanceof ShortBuffer && format != Format.Short && format != Format.UnsignedShort) { | |
371 | + throw new AssertionError(); | |
372 | + } else if (data instanceof ByteBuffer && format != Format.Byte && format != Format.UnsignedByte) { | |
373 | + throw new AssertionError(); | |
374 | + } | |
375 | + return true; | |
376 | + } | |
377 | + | |
337 | 378 | /** |
338 | 379 | * @return The offset after which the data is sent to the GPU. |
339 | 380 | * |
@@ -950,7 +991,14 @@ public class VertexBuffer extends NativeObject implements Savable, Cloneable { | ||
950 | 991 | public void deleteObject(Object rendererObject) { |
951 | 992 | ((Renderer)rendererObject).deleteBuffer(this); |
952 | 993 | } |
953 | - | |
994 | + | |
995 | + @Override | |
996 | + protected void deleteNativeBuffers() { | |
997 | + if (data != null) { | |
998 | + BufferUtils.destroyDirectBuffer(data); | |
999 | + } | |
1000 | + } | |
1001 | + | |
954 | 1002 | @Override |
955 | 1003 | public NativeObject createDestructableClone(){ |
956 | 1004 | return new VertexBuffer(id); |
@@ -41,14 +41,6 @@ import java.util.ArrayList; | ||
41 | 41 | import java.util.Collection; |
42 | 42 | |
43 | 43 | public final class Shader extends NativeObject { |
44 | - | |
45 | - /** | |
46 | - * | |
47 | - * @deprecated shader language now specified per shader source. See | |
48 | - * {@link ShaderSource#setLanguage(String) | |
49 | - */ | |
50 | - @Deprecated | |
51 | - private String language; | |
52 | 44 | |
53 | 45 | /** |
54 | 46 | * A list of all shader sources currently attached. |
@@ -98,7 +90,7 @@ public final class Shader extends NativeObject { | ||
98 | 90 | String defines; |
99 | 91 | |
100 | 92 | public ShaderSource(ShaderType type){ |
101 | - super(ShaderSource.class); | |
93 | + super(); | |
102 | 94 | this.sourceType = type; |
103 | 95 | if (type == null) { |
104 | 96 | throw new IllegalArgumentException("The shader type must be specified"); |
@@ -106,13 +98,13 @@ public final class Shader extends NativeObject { | ||
106 | 98 | } |
107 | 99 | |
108 | 100 | protected ShaderSource(ShaderSource ss){ |
109 | - super(ShaderSource.class, ss.id); | |
101 | + super(ss.id); | |
110 | 102 | // No data needs to be copied. |
111 | 103 | // (This is a destructable clone) |
112 | 104 | } |
113 | 105 | |
114 | 106 | public ShaderSource(){ |
115 | - super(ShaderSource.class); | |
107 | + super(); | |
116 | 108 | } |
117 | 109 | |
118 | 110 | public void setName(String name){ |
@@ -191,17 +183,6 @@ public final class Shader extends NativeObject { | ||
191 | 183 | } |
192 | 184 | |
193 | 185 | /** |
194 | - * @deprecated Shader sources are now associated with the shader | |
195 | - * language. | |
196 | - */ | |
197 | - @Deprecated | |
198 | - public Shader(String language){ | |
199 | - super(Shader.class); | |
200 | - this.language = language; | |
201 | - initialize(); | |
202 | - } | |
203 | - | |
204 | - /** | |
205 | 186 | * Initializes the shader for use, must be called after the |
206 | 187 | * constructor without arguments is used. |
207 | 188 | */ |
@@ -216,14 +197,14 @@ public final class Shader extends NativeObject { | ||
216 | 197 | * after this constructor for the shader to be usable. |
217 | 198 | */ |
218 | 199 | public Shader(){ |
219 | - super(Shader.class); | |
200 | + super(); | |
220 | 201 | } |
221 | 202 | |
222 | 203 | /** |
223 | 204 | * Do not use this constructor. Used for destructable clones only. |
224 | 205 | */ |
225 | 206 | protected Shader(Shader s){ |
226 | - super(Shader.class, s.id); | |
207 | + super(s.id); | |
227 | 208 | |
228 | 209 | // Shader sources cannot be shared, therefore they must |
229 | 210 | // be destroyed together with the parent shader. |
@@ -234,43 +215,6 @@ public final class Shader extends NativeObject { | ||
234 | 215 | } |
235 | 216 | |
236 | 217 | /** |
237 | - * @deprecated Use the method that takes a language argument instead. | |
238 | - * {@link #addSource(com.jme3.shader.Shader.ShaderType, java.lang.String, java.lang.String, java.lang.String, java.lang.String) } | |
239 | - */ | |
240 | - @Deprecated | |
241 | - public void addSource(ShaderType type, String name, String source, String defines) { | |
242 | - addSource(type, name, source, defines, this.language); | |
243 | - } | |
244 | - | |
245 | - /** | |
246 | - * @deprecated Use the method that takes a language argument instead. | |
247 | - * {@link #addSource(com.jme3.shader.Shader.ShaderType, java.lang.String, java.lang.String, java.lang.String, java.lang.String) } | |
248 | - */ | |
249 | - @Deprecated | |
250 | - public void addSource(ShaderType type, String source, String defines){ | |
251 | - addSource(type, null, source, defines); | |
252 | - } | |
253 | - | |
254 | - /** | |
255 | - * @deprecated Use the method that takes a language argument instead. | |
256 | - * {@link #addSource(com.jme3.shader.Shader.ShaderType, java.lang.String, java.lang.String, java.lang.String, java.lang.String) } | |
257 | - */ | |
258 | - @Deprecated | |
259 | - public void addSource(ShaderType type, String source){ | |
260 | - addSource(type, source, null); | |
261 | - } | |
262 | - | |
263 | - /** | |
264 | - * @deprecated Shader sources may not be shared. | |
265 | - * {@link #addSource(com.jme3.shader.Shader.ShaderType, java.lang.String, java.lang.String, java.lang.String, java.lang.String) } | |
266 | - */ | |
267 | - @Deprecated | |
268 | - private void addSource(ShaderSource source){ | |
269 | - shaderSourceList.add(source); | |
270 | - setUpdateNeeded(); | |
271 | - } | |
272 | - | |
273 | - /** | |
274 | 218 | * Adds source code to a certain pipeline. |
275 | 219 | * |
276 | 220 | * @param type The pipeline to control |
@@ -324,15 +268,6 @@ public final class Shader extends NativeObject { | ||
324 | 268 | return shaderSourceList; |
325 | 269 | } |
326 | 270 | |
327 | - /** | |
328 | - * @deprecated Shaders no longer have a language variable, | |
329 | - * use {@link ShaderSource#getLanguage() } instead. | |
330 | - */ | |
331 | - @Deprecated | |
332 | - public String getLanguage(){ | |
333 | - return language; | |
334 | - } | |
335 | - | |
336 | 271 | @Override |
337 | 272 | public String toString() { |
338 | 273 | return getClass().getSimpleName() + |
@@ -342,33 +277,6 @@ public final class Shader extends NativeObject { | ||
342 | 277 | } |
343 | 278 | |
344 | 279 | /** |
345 | - * @deprecated This method is not needed since deleting | |
346 | - * a shader causes the sources to delete as well, thus its not required | |
347 | - * for them to be GC'd to be removed from GL. | |
348 | - */ | |
349 | - @Deprecated | |
350 | - public void resetSources(){ | |
351 | - shaderSourceList.clear(); | |
352 | - } | |
353 | - | |
354 | - /** | |
355 | - * @deprecated Unusable shaders cause the renderer to crash, | |
356 | - * therefore this field no longer serves any purpose. | |
357 | - */ | |
358 | - @Deprecated | |
359 | - public boolean isUsable(){ | |
360 | - return true; | |
361 | - } | |
362 | - | |
363 | - /** | |
364 | - * @deprecated Unusable shaders cause the renderer to crash, | |
365 | - * therefore this field no longer serves any purpose. | |
366 | - */ | |
367 | - @Deprecated | |
368 | - public void setUsable(boolean usable){ | |
369 | - } | |
370 | - | |
371 | - /** | |
372 | 280 | * Usually called when the shader itself changes or during any |
373 | 281 | * time when the variable locations need to be refreshed. |
374 | 282 | */ |
@@ -175,7 +175,7 @@ public class FrameBuffer extends NativeObject { | ||
175 | 175 | * @throws IllegalArgumentException If width or height are not positive. |
176 | 176 | */ |
177 | 177 | public FrameBuffer(int width, int height, int samples){ |
178 | - super(FrameBuffer.class); | |
178 | + super(); | |
179 | 179 | if (width <= 0 || height <= 0) |
180 | 180 | throw new IllegalArgumentException("FrameBuffer must have valid size."); |
181 | 181 |
@@ -185,7 +185,7 @@ public class FrameBuffer extends NativeObject { | ||
185 | 185 | } |
186 | 186 | |
187 | 187 | protected FrameBuffer(FrameBuffer src){ |
188 | - super(FrameBuffer.class, src.id); | |
188 | + super(src.id); | |
189 | 189 | /* |
190 | 190 | for (RenderBuffer renderBuf : src.colorBufs){ |
191 | 191 | RenderBuffer clone = renderBuf.createDestructableClone(); |
@@ -34,6 +34,7 @@ package com.jme3.texture; | ||
34 | 34 | import com.jme3.export.*; |
35 | 35 | import com.jme3.renderer.Caps; |
36 | 36 | import com.jme3.renderer.Renderer; |
37 | +import com.jme3.util.BufferUtils; | |
37 | 38 | import com.jme3.util.NativeObject; |
38 | 39 | import java.io.IOException; |
39 | 40 | import java.nio.ByteBuffer; |
@@ -376,6 +377,13 @@ public class Image extends NativeObject implements Savable /*, Cloneable*/ { | ||
376 | 377 | } |
377 | 378 | |
378 | 379 | @Override |
380 | + protected void deleteNativeBuffers() { | |
381 | + for (ByteBuffer buf : data) { | |
382 | + BufferUtils.destroyDirectBuffer(buf); | |
383 | + } | |
384 | + } | |
385 | + | |
386 | + @Override | |
379 | 387 | public void deleteObject(Object rendererObject) { |
380 | 388 | ((Renderer)rendererObject).deleteImage(this); |
381 | 389 | } |
@@ -402,12 +410,12 @@ public class Image extends NativeObject implements Savable /*, Cloneable*/ { | ||
402 | 410 | * are undefined. |
403 | 411 | */ |
404 | 412 | public Image() { |
405 | - super(Image.class); | |
413 | + super(); | |
406 | 414 | data = new ArrayList<ByteBuffer>(1); |
407 | 415 | } |
408 | 416 | |
409 | 417 | protected Image(int id){ |
410 | - super(Image.class, id); | |
418 | + super(id); | |
411 | 419 | } |
412 | 420 | |
413 | 421 | /** |
@@ -31,6 +31,8 @@ | ||
31 | 31 | */ |
32 | 32 | package com.jme3.util; |
33 | 33 | |
34 | +import java.nio.Buffer; | |
35 | + | |
34 | 36 | /** |
35 | 37 | * Describes a native object. An encapsulation of a certain object |
36 | 38 | * on the native side of the graphics or audio library. |
@@ -41,11 +43,13 @@ package com.jme3.util; | ||
41 | 43 | */ |
42 | 44 | public abstract class NativeObject implements Cloneable { |
43 | 45 | |
46 | + public static final int INVALID_ID = -1; | |
47 | + | |
44 | 48 | /** |
45 | 49 | * The ID of the object, usually depends on its type. |
46 | 50 | * Typically returned from calls like glGenTextures, glGenBuffers, etc. |
47 | 51 | */ |
48 | - protected int id = -1; | |
52 | + protected int id = INVALID_ID; | |
49 | 53 | |
50 | 54 | /** |
51 | 55 | * A reference to a "handle". By hard referencing a certain object, it's |
@@ -61,18 +65,12 @@ public abstract class NativeObject implements Cloneable { | ||
61 | 65 | protected boolean updateNeeded = true; |
62 | 66 | |
63 | 67 | /** |
64 | - * The type of the GLObject, usually specified by a subclass. | |
65 | - */ | |
66 | - protected final Class<?> type; | |
67 | - | |
68 | - /** | |
69 | 68 | * Creates a new GLObject with the given type. Should be |
70 | 69 | * called by the subclasses. |
71 | 70 | * |
72 | 71 | * @param type The type that the subclass represents. |
73 | 72 | */ |
74 | - public NativeObject(Class<?> type){ | |
75 | - this.type = type; | |
73 | + public NativeObject(){ | |
76 | 74 | this.handleRef = new Object(); |
77 | 75 | } |
78 | 76 |
@@ -80,8 +78,7 @@ public abstract class NativeObject implements Cloneable { | ||
80 | 78 | * Protected constructor that doesn't allocate handle ref. |
81 | 79 | * This is used in subclasses for the createDestructableClone(). |
82 | 80 | */ |
83 | - protected NativeObject(Class<?> type, int id){ | |
84 | - this.type = type; | |
81 | + protected NativeObject(int id){ | |
85 | 82 | this.id = id; |
86 | 83 | } |
87 | 84 |
@@ -91,9 +88,9 @@ public abstract class NativeObject implements Cloneable { | ||
91 | 88 | * @param id The ID to set |
92 | 89 | */ |
93 | 90 | public void setId(int id){ |
94 | - if (this.id != -1) | |
91 | + if (this.id != INVALID_ID) { | |
95 | 92 | throw new IllegalStateException("ID has already been set for this GL object."); |
96 | - | |
93 | + } | |
97 | 94 | this.id = id; |
98 | 95 | } |
99 | 96 |
@@ -129,7 +126,7 @@ public abstract class NativeObject implements Cloneable { | ||
129 | 126 | |
130 | 127 | @Override |
131 | 128 | public String toString(){ |
132 | - return "Native" + type.getSimpleName() + " " + id; | |
129 | + return "Native" + getClass().getSimpleName() + " " + id; | |
133 | 130 | } |
134 | 131 | |
135 | 132 | /** |
@@ -137,19 +134,41 @@ public abstract class NativeObject implements Cloneable { | ||
137 | 134 | * createDestructableClone(). |
138 | 135 | */ |
139 | 136 | @Override |
140 | - protected NativeObject clone(){ | |
141 | - try{ | |
137 | + protected NativeObject clone() { | |
138 | + try { | |
142 | 139 | NativeObject obj = (NativeObject) super.clone(); |
143 | 140 | obj.handleRef = new Object(); |
144 | - obj.id = -1; | |
141 | + obj.id = INVALID_ID; | |
145 | 142 | obj.updateNeeded = true; |
146 | 143 | return obj; |
147 | - }catch (CloneNotSupportedException ex){ | |
144 | + } catch (CloneNotSupportedException ex) { | |
148 | 145 | throw new AssertionError(); |
149 | 146 | } |
150 | 147 | } |
151 | 148 | |
152 | 149 | /** |
150 | + * Deletes any associated native {@link Buffer buffers}. | |
151 | + * This is necessary because it is unlikely that native buffers | |
152 | + * will be garbage collected naturally (due to how GC works), therefore | |
153 | + * the collection must be handled manually. | |
154 | + * | |
155 | + * Only implementations that manage native buffers need to override | |
156 | + * this method. Note that the behavior that occurs when a | |
157 | + * deleted native buffer is used is not defined, therefore this | |
158 | + * method is protected | |
159 | + */ | |
160 | + protected void deleteNativeBuffers() { | |
161 | + } | |
162 | + | |
163 | + /** | |
164 | + * Package-private version of {@link #deleteNativeBuffers() }, to be used | |
165 | + * from the {@link NativeObjectManager}. | |
166 | + */ | |
167 | + void deleteNativeBuffersInternal() { | |
168 | + deleteNativeBuffers(); | |
169 | + } | |
170 | + | |
171 | + /** | |
153 | 172 | * Called when the GL context is restarted to reset all IDs. Prevents |
154 | 173 | * "white textures" on display restart. |
155 | 174 | */ |
@@ -162,7 +181,7 @@ public abstract class NativeObject implements Cloneable { | ||
162 | 181 | * @param rendererObject The renderer to be used to delete the object |
163 | 182 | */ |
164 | 183 | public abstract void deleteObject(Object rendererObject); |
165 | - | |
184 | + | |
166 | 185 | /** |
167 | 186 | * Creates a shallow clone of this GL Object. The deleteObject method |
168 | 187 | * should be functional for this object. |
@@ -95,15 +95,14 @@ public class CgcValidator implements Validator { | ||
95 | 95 | } |
96 | 96 | |
97 | 97 | public void validate(Shader shader, StringBuilder results) { |
98 | - String language = shader.getLanguage(); | |
99 | 98 | for (ShaderSource source : shader.getSources()){ |
100 | 99 | results.append("Checking: ").append(source.getName()); |
101 | 100 | switch (source.getType()){ |
102 | 101 | case Fragment: |
103 | - executeCg(source.getSource(), language, source.getDefines(), "arbfp1", results); | |
102 | + executeCg(source.getSource(), source.getLanguage(), source.getDefines(), "arbfp1", results); | |
104 | 103 | break; |
105 | 104 | case Vertex: |
106 | - executeCg(source.getSource(), language, source.getDefines(), "arbvp1", results); | |
105 | + executeCg(source.getSource(), source.getLanguage(), source.getDefines(), "arbvp1", results); | |
107 | 106 | break; |
108 | 107 | } |
109 | 108 | } |
@@ -105,15 +105,14 @@ public class GpuAnalyzerValidator implements Validator { | ||
105 | 105 | } |
106 | 106 | |
107 | 107 | public void validate(Shader shader, StringBuilder results) { |
108 | - String language = shader.getLanguage(); | |
109 | 108 | for (ShaderSource source : shader.getSources()){ |
110 | 109 | results.append("Checking: ").append(source.getName()); |
111 | 110 | switch (source.getType()){ |
112 | 111 | case Fragment: |
113 | - executeAnalyzer(source.getSource(), language, source.getDefines(), "HD5770", results); | |
112 | + executeAnalyzer(source.getSource(), source.getLanguage(), source.getDefines(), "HD5770", results); | |
114 | 113 | break; |
115 | 114 | case Vertex: |
116 | - executeAnalyzer(source.getSource(), language, source.getDefines(), "HD5770", results); | |
115 | + executeAnalyzer(source.getSource(), source.getLanguage(), source.getDefines(), "HD5770", results); | |
117 | 116 | break; |
118 | 117 | } |
119 | 118 | } |