• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Keine Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Main repository of MikuMikuStudio


Commit MetaInfo

Revisionedcba9dc8add6287a25a00d32407c9bf3de4237f (tree)
Zeit2013-06-18 11:54:47
Autoriwgeric <iwgeric@75d0...>
Commiteriwgeric

Log Message

Improve error message when shader uniform is not set

git-svn-id: http://jmonkeyengine.googlecode.com/svn/trunk@10650 75d07b2b-3a1a-0410-a2c5-0572b91ccdca

Ändern Zusammenfassung

Diff

--- a/engine/src/android/com/jme3/renderer/android/OGLESShaderRenderer.java
+++ b/engine/src/android/com/jme3/renderer/android/OGLESShaderRenderer.java
@@ -323,7 +323,7 @@ public class OGLESShaderRenderer implements Renderer {
323323 // Allocate buffer for compressed formats.
324324 IntBuffer compressedFormats = BufferUtils.createIntBuffer(numCompressedFormats);
325325 GLES20.glGetIntegerv(GLES20.GL_COMPRESSED_TEXTURE_FORMATS, compressedFormats);
326-
326+
327327 // Check for errors after all glGet calls.
328328 RendererUtil.checkGLError();
329329
@@ -333,7 +333,7 @@ public class OGLESShaderRenderer implements Renderer {
333333 }
334334
335335 TextureUtil.loadTextureFeatures(extensions);
336-
336+
337337 applyRenderState(RenderState.DEFAULT);
338338 GLES20.glDisable(GLES20.GL_DITHER);
339339 RendererUtil.checkGLError();
@@ -459,7 +459,7 @@ public class OGLESShaderRenderer implements Renderer {
459459 GLES20.glPolygonOffset(state.getPolyOffsetFactor(),
460460 state.getPolyOffsetUnits());
461461 RendererUtil.checkGLError();
462-
462+
463463 context.polyOffsetEnabled = true;
464464 context.polyOffsetFactor = state.getPolyOffsetFactor();
465465 context.polyOffsetUnits = state.getPolyOffsetUnits();
@@ -469,7 +469,7 @@ public class OGLESShaderRenderer implements Renderer {
469469 GLES20.glPolygonOffset(state.getPolyOffsetFactor(),
470470 state.getPolyOffsetUnits());
471471 RendererUtil.checkGLError();
472-
472+
473473 context.polyOffsetFactor = state.getPolyOffsetFactor();
474474 context.polyOffsetUnits = state.getPolyOffsetUnits();
475475 }
@@ -478,7 +478,7 @@ public class OGLESShaderRenderer implements Renderer {
478478 if (context.polyOffsetEnabled) {
479479 GLES20.glDisable(GLES20.GL_POLYGON_OFFSET_FILL);
480480 RendererUtil.checkGLError();
481-
481+
482482 context.polyOffsetEnabled = false;
483483 context.polyOffsetFactor = 0;
484484 context.polyOffsetUnits = 0;
@@ -563,7 +563,7 @@ public class OGLESShaderRenderer implements Renderer {
563563 if (x != vpX || vpY != y || vpW != w || vpH != h) {
564564 GLES20.glViewport(x, y, w, h);
565565 RendererUtil.checkGLError();
566-
566+
567567 vpX = x;
568568 vpY = y;
569569 vpW = w;
@@ -621,7 +621,7 @@ public class OGLESShaderRenderer implements Renderer {
621621 updateNameBuffer();
622622 int loc = GLES20.glGetUniformLocation(shader.getId(), uniform.getName());
623623 RendererUtil.checkGLError();
624-
624+
625625 if (loc < 0) {
626626 uniform.setLocation(-1);
627627 // uniform is not declared in shader
@@ -635,7 +635,7 @@ public class OGLESShaderRenderer implements Renderer {
635635 if (context.boundShaderProgram != shaderId) {
636636 GLES20.glUseProgram(shaderId);
637637 RendererUtil.checkGLError();
638-
638+
639639 statistics.onShaderUse(shader, true);
640640 boundShader = shader;
641641 context.boundShaderProgram = shaderId;
@@ -653,7 +653,7 @@ public class OGLESShaderRenderer implements Renderer {
653653 if (context.boundShaderProgram != shaderId) {
654654 GLES20.glUseProgram(shaderId);
655655 RendererUtil.checkGLError();
656-
656+
657657 statistics.onShaderUse(shader, true);
658658 boundShader = shader;
659659 context.boundShaderProgram = shaderId;
@@ -678,7 +678,8 @@ public class OGLESShaderRenderer implements Renderer {
678678 }
679679
680680 if (uniform.getVarType() == null) {
681- logger.warning("value is not set yet.");
681+ logger.log(Level.WARNING, "Uniform value is not set yet. Shader: {0}, Uniform: {1}",
682+ new Object[]{shader.toString(), uniform.toString()});
682683 return; // value not set yet..
683684 }
684685
@@ -805,7 +806,7 @@ public class OGLESShaderRenderer implements Renderer {
805806 // Create id
806807 id = GLES20.glCreateShader(convertShaderType(source.getType()));
807808 RendererUtil.checkGLError();
808-
809+
809810 if (id <= 0) {
810811 throw new RendererException("Invalid ID received when trying to create shader.");
811812 }
@@ -853,7 +854,7 @@ public class OGLESShaderRenderer implements Renderer {
853854
854855 GLES20.glCompileShader(id);
855856 RendererUtil.checkGLError();
856-
857+
857858 GLES20.glGetShaderiv(id, GLES20.GL_COMPILE_STATUS, intBuf1);
858859 RendererUtil.checkGLError();
859860
@@ -906,7 +907,7 @@ public class OGLESShaderRenderer implements Renderer {
906907 if (source.isUpdateNeeded()) {
907908 updateShaderSourceData(source);
908909 }
909-
910+
910911 GLES20.glAttachShader(id, source.getId());
911912 RendererUtil.checkGLError();
912913 }
@@ -914,7 +915,7 @@ public class OGLESShaderRenderer implements Renderer {
914915 // link shaders to program
915916 GLES20.glLinkProgram(id);
916917 RendererUtil.checkGLError();
917-
918+
918919 GLES20.glGetProgramiv(id, GLES20.GL_LINK_STATUS, intBuf1);
919920 RendererUtil.checkGLError();
920921
@@ -982,10 +983,10 @@ public class OGLESShaderRenderer implements Renderer {
982983 }
983984
984985 source.clearUpdateNeeded();
985-
986+
986987 GLES20.glDeleteShader(source.getId());
987988 RendererUtil.checkGLError();
988-
989+
989990 source.resetObject();
990991 }
991992
@@ -999,14 +1000,14 @@ public class OGLESShaderRenderer implements Renderer {
9991000 if (source.getId() != -1) {
10001001 GLES20.glDetachShader(shader.getId(), source.getId());
10011002 RendererUtil.checkGLError();
1002-
1003+
10031004 deleteShaderSource(source);
10041005 }
10051006 }
10061007
10071008 GLES20.glDeleteProgram(shader.getId());
10081009 RendererUtil.checkGLError();
1009-
1010+
10101011 statistics.onDeleteShader();
10111012 shader.resetObject();
10121013 }
@@ -1211,7 +1212,7 @@ public class OGLESShaderRenderer implements Renderer {
12111212 if (id == -1) {
12121213 GLES20.glGenRenderbuffers(1, intBuf1);
12131214 RendererUtil.checkGLError();
1214-
1215+
12151216 id = intBuf1.get(0);
12161217 rb.setId(id);
12171218 }
@@ -1219,7 +1220,7 @@ public class OGLESShaderRenderer implements Renderer {
12191220 if (context.boundRB != id) {
12201221 GLES20.glBindRenderbuffer(GLES20.GL_RENDERBUFFER, id);
12211222 RendererUtil.checkGLError();
1222-
1223+
12231224 context.boundRB = id;
12241225 }
12251226
@@ -1251,7 +1252,7 @@ public class OGLESShaderRenderer implements Renderer {
12511252 imageFormat.renderBufferStorageFormat,
12521253 fb.getWidth(),
12531254 fb.getHeight());
1254-
1255+
12551256 RendererUtil.checkGLError();
12561257 }
12571258 }
@@ -1284,7 +1285,7 @@ public class OGLESShaderRenderer implements Renderer {
12841285 convertTextureType(tex.getType()),
12851286 image.getId(),
12861287 0);
1287-
1288+
12881289 RendererUtil.checkGLError();
12891290 }
12901291
@@ -1303,7 +1304,7 @@ public class OGLESShaderRenderer implements Renderer {
13031304 convertAttachmentSlot(rb.getSlot()),
13041305 GLES20.GL_RENDERBUFFER,
13051306 rb.getId());
1306-
1307+
13071308 RendererUtil.checkGLError();
13081309 }
13091310 }
@@ -1315,7 +1316,7 @@ public class OGLESShaderRenderer implements Renderer {
13151316 // create FBO
13161317 GLES20.glGenFramebuffers(1, intBuf1);
13171318 RendererUtil.checkGLError();
1318-
1319+
13191320 id = intBuf1.get(0);
13201321 fb.setId(id);
13211322 objManager.registerObject(fb);
@@ -1326,7 +1327,7 @@ public class OGLESShaderRenderer implements Renderer {
13261327 if (context.boundFBO != id) {
13271328 GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, id);
13281329 RendererUtil.checkGLError();
1329-
1330+
13301331 // binding an FBO automatically sets draw buf to GL_COLOR_ATTACHMENT0
13311332 context.boundDrawBuf = 0;
13321333 context.boundFBO = id;
@@ -1382,7 +1383,7 @@ public class OGLESShaderRenderer implements Renderer {
13821383 if (context.boundFBO != 0) {
13831384 GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, 0);
13841385 RendererUtil.checkGLError();
1385-
1386+
13861387 statistics.onFrameBufferUse(null, true);
13871388
13881389 context.boundFBO = 0;
@@ -1414,7 +1415,7 @@ public class OGLESShaderRenderer implements Renderer {
14141415 if (context.boundFBO != fb.getId()) {
14151416 GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, fb.getId());
14161417 RendererUtil.checkGLError();
1417-
1418+
14181419 statistics.onFrameBufferUse(fb, true);
14191420
14201421 // update viewport to reflect framebuffer's resolution
@@ -1464,7 +1465,7 @@ public class OGLESShaderRenderer implements Renderer {
14641465 if (context.boundDrawBuf != rb.getSlot()) {
14651466 GLES20.glActiveTexture(convertAttachmentSlot(rb.getSlot()));
14661467 RendererUtil.checkGLError();
1467-
1468+
14681469 context.boundDrawBuf = rb.getSlot();
14691470 }
14701471 }
@@ -1514,7 +1515,7 @@ public class OGLESShaderRenderer implements Renderer {
15141515 if (context.boundFBO == fb.getId()) {
15151516 GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, 0);
15161517 RendererUtil.checkGLError();
1517-
1518+
15181519 context.boundFBO = 0;
15191520 }
15201521
@@ -1528,7 +1529,7 @@ public class OGLESShaderRenderer implements Renderer {
15281529 intBuf1.put(0, fb.getId());
15291530 GLES20.glDeleteFramebuffers(1, intBuf1);
15301531 RendererUtil.checkGLError();
1531-
1532+
15321533 fb.resetObject();
15331534
15341535 statistics.onDeleteFrameBuffer();
@@ -1638,7 +1639,7 @@ public class OGLESShaderRenderer implements Renderer {
16381639 // fall down here is intentional..
16391640 // case OneDimensional:
16401641 GLES20.glTexParameteri(target, GLES20.GL_TEXTURE_WRAP_S, convertWrapMode(tex.getWrap(WrapAxis.S)));
1641-
1642+
16421643 RendererUtil.checkGLError();
16431644 break;
16441645 default:
@@ -1670,7 +1671,7 @@ public class OGLESShaderRenderer implements Renderer {
16701671 // create texture
16711672 GLES20.glGenTextures(1, intBuf1);
16721673 RendererUtil.checkGLError();
1673-
1674+
16741675 texId = intBuf1.get(0);
16751676 img.setId(texId);
16761677 objManager.registerObject(img);
@@ -1684,13 +1685,13 @@ public class OGLESShaderRenderer implements Renderer {
16841685 if (context.boundTextureUnit != 0) {
16851686 GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
16861687 RendererUtil.checkGLError();
1687-
1688+
16881689 context.boundTextureUnit = 0;
16891690 }
16901691
16911692 GLES20.glBindTexture(target, texId);
16921693 RendererUtil.checkGLError();
1693-
1694+
16941695 context.boundTextures[0] = img;
16951696 }
16961697
@@ -1779,7 +1780,7 @@ public class OGLESShaderRenderer implements Renderer {
17791780
17801781 GLES20.glBindTexture(type, texId);
17811782 RendererUtil.checkGLError();
1782-
1783+
17831784 textures[unit] = image;
17841785
17851786 statistics.onTextureUse(tex.getImage(), true);
@@ -1818,7 +1819,7 @@ public class OGLESShaderRenderer implements Renderer {
18181819
18191820 GLES20.glDeleteTextures(1, intBuf1);
18201821 RendererUtil.checkGLError();
1821-
1822+
18221823 image.resetObject();
18231824
18241825 statistics.onDeleteTexture();
@@ -1877,7 +1878,7 @@ public class OGLESShaderRenderer implements Renderer {
18771878 // create buffer
18781879 GLES20.glGenBuffers(1, intBuf1);
18791880 RendererUtil.checkGLError();
1880-
1881+
18811882 bufId = intBuf1.get(0);
18821883 vb.setId(bufId);
18831884 objManager.registerObject(vb);
@@ -1892,7 +1893,7 @@ public class OGLESShaderRenderer implements Renderer {
18921893 if (context.boundElementArrayVBO != bufId) {
18931894 GLES20.glBindBuffer(target, bufId);
18941895 RendererUtil.checkGLError();
1895-
1896+
18961897 context.boundElementArrayVBO = bufId;
18971898 }
18981899 } else {
@@ -1900,7 +1901,7 @@ public class OGLESShaderRenderer implements Renderer {
19001901 if (context.boundArrayVBO != bufId) {
19011902 GLES20.glBindBuffer(target, bufId);
19021903 RendererUtil.checkGLError();
1903-
1904+
19041905 context.boundArrayVBO = bufId;
19051906 }
19061907 }
@@ -1974,7 +1975,7 @@ public class OGLESShaderRenderer implements Renderer {
19741975
19751976 GLES20.glDeleteBuffers(1, intBuf1);
19761977 RendererUtil.checkGLError();
1977-
1978+
19781979 vb.resetObject();
19791980 }
19801981 }
@@ -1986,7 +1987,7 @@ public class OGLESShaderRenderer implements Renderer {
19861987
19871988 GLES20.glDisableVertexAttribArray(idx);
19881989 RendererUtil.checkGLError();
1989-
1990+
19901991 context.boundAttribs[idx] = null;
19911992 }
19921993 context.attribIndexList.copyNewToOld();
@@ -2046,7 +2047,7 @@ public class OGLESShaderRenderer implements Renderer {
20462047 if (context.boundArrayVBO != bufId) {
20472048 GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, bufId);
20482049 RendererUtil.checkGLError();
2049-
2050+
20502051 context.boundArrayVBO = bufId;
20512052 }
20522053
@@ -2058,7 +2059,7 @@ public class OGLESShaderRenderer implements Renderer {
20582059 vb.isNormalized(),
20592060 vb.getStride(),
20602061 0);
2061-
2062+
20622063 RendererUtil.checkGLError();
20632064
20642065 attribs[loc] = vb;
@@ -2102,7 +2103,7 @@ public class OGLESShaderRenderer implements Renderer {
21022103 if (context.boundElementArrayVBO != bufId) {
21032104 GLES20.glBindBuffer(GLES20.GL_ELEMENT_ARRAY_BUFFER, bufId);
21042105 RendererUtil.checkGLError();
2105-
2106+
21062107 context.boundElementArrayVBO = bufId;
21072108 }
21082109
@@ -2333,7 +2334,7 @@ public class OGLESShaderRenderer implements Renderer {
23332334 GLES10.glPointSize(mesh.getPointSize());
23342335 context.pointSize = mesh.getPointSize();
23352336 }
2336- */
2337+ */
23372338 if (context.lineWidth != mesh.getLineWidth()) {
23382339 GLES20.glLineWidth(mesh.getLineWidth());
23392340 RendererUtil.checkGLError();
@@ -2432,7 +2433,7 @@ public class OGLESShaderRenderer implements Renderer {
24322433
24332434 loc = GLES20.glGetAttribLocation(programId, attributeName);
24342435 RendererUtil.checkGLError();
2435-
2436+
24362437 if (loc < 0) {
24372438 attrib.setLocation(-1);
24382439 return; // not available in shader.
@@ -2455,7 +2456,7 @@ public class OGLESShaderRenderer implements Renderer {
24552456 vb.isNormalized(),
24562457 vb.getStride(),
24572458 avb.getData());
2458-
2459+
24592460 RendererUtil.checkGLError();
24602461
24612462 GLES20.glEnableVertexAttribArray(loc);