Use the ol.DEBUG_WEBGL flag to debug shader sources

This commit is contained in:
Tim Schaub
2017-01-16 16:47:04 -07:00
parent 6f7eb53c38
commit fcb9dafc33
10 changed files with 161 additions and 74 deletions

View File

@@ -6,6 +6,8 @@
The `ol.DEBUG`, `ol.ENABLE_TILE`, `ol.ENABLE_IMAGE`, `ol.ENABLE_VECTOR`, and `ol.ENABLE_VECTOR_TILE` build flags are no longer necessary and have been removed. If you were using these in a `define` array for a custom build, you can remove them. The `ol.DEBUG`, `ol.ENABLE_TILE`, `ol.ENABLE_IMAGE`, `ol.ENABLE_VECTOR`, and `ol.ENABLE_VECTOR_TILE` build flags are no longer necessary and have been removed. If you were using these in a `define` array for a custom build, you can remove them.
If you leave `ol.ENABLE_WEBGL` set to `true` in your build, you should set `ol.DEBUG_WEBGL` to `false` to avoid including debuggable shader sources.
#### Simplified `ol.View#fit()` API #### Simplified `ol.View#fit()` API
In most cases, it is no longer necessary to provide an `ol.Size` (previously the 2nd argument) to `ol.View#fit()`. By default, the size of the first map that uses the view will be used. If you want to specify a different size, it goes in the options now (previously the 3rd argument, now the 2nd). In most cases, it is no longer necessary to provide an `ol.Size` (previously the 2nd argument) to `ol.View#fit()`. By default, the size of the first map that uses the view will be used. If you want to specify a different size, it goes in the options now (previously the 3rd argument, now the 2nd).

View File

@@ -14,6 +14,9 @@
"externs/tilejson.js", "externs/tilejson.js",
"externs/topojson.js" "externs/topojson.js"
], ],
"define": [
"ol.DEBUG_WEBGL=false"
],
"jscomp_error": [ "jscomp_error": [
"*" "*"
], ],

View File

@@ -83,6 +83,14 @@ ol.ENABLE_RASTER_REPROJECTION = true;
ol.ENABLE_WEBGL = true; ol.ENABLE_WEBGL = true;
/**
* @define {boolean} Include debuggable shader sources. Default is `true`.
* This should be set to `false` for production builds (if `ol.ENABLE_WEBGL`
* is `true`).
*/
ol.DEBUG_WEBGL = true;
/** /**
* @define {number} The size in pixels of the first atlas image. Default is * @define {number} The size in pixels of the first atlas image. Default is
* `256`. * `256`.

View File

@@ -5,7 +5,6 @@ goog.require('ol');
goog.require('ol.webgl.Fragment'); goog.require('ol.webgl.Fragment');
goog.require('ol.webgl.Vertex'); goog.require('ol.webgl.Vertex');
if (ol.ENABLE_WEBGL) { if (ol.ENABLE_WEBGL) {
/** /**
@@ -37,7 +36,9 @@ if (ol.ENABLE_WEBGL) {
* @const * @const
* @type {string} * @type {string}
*/ */
ol.render.webgl.circlereplay.defaultshader.Fragment.SOURCE = ol.render.webgl.circlereplay.defaultshader.Fragment.OPTIMIZED_SOURCE; ol.render.webgl.circlereplay.defaultshader.Fragment.SOURCE = ol.DEBUG_WEBGL ?
ol.render.webgl.circlereplay.defaultshader.Fragment.DEBUG_SOURCE :
ol.render.webgl.circlereplay.defaultshader.Fragment.OPTIMIZED_SOURCE;
ol.render.webgl.circlereplay.defaultshader.fragment = new ol.render.webgl.circlereplay.defaultshader.Fragment(); ol.render.webgl.circlereplay.defaultshader.fragment = new ol.render.webgl.circlereplay.defaultshader.Fragment();
@@ -72,7 +73,9 @@ if (ol.ENABLE_WEBGL) {
* @const * @const
* @type {string} * @type {string}
*/ */
ol.render.webgl.circlereplay.defaultshader.Vertex.SOURCE = ol.render.webgl.circlereplay.defaultshader.Vertex.OPTIMIZED_SOURCE; ol.render.webgl.circlereplay.defaultshader.Vertex.SOURCE = ol.DEBUG_WEBGL ?
ol.render.webgl.circlereplay.defaultshader.Vertex.DEBUG_SOURCE :
ol.render.webgl.circlereplay.defaultshader.Vertex.OPTIMIZED_SOURCE;
ol.render.webgl.circlereplay.defaultshader.vertex = new ol.render.webgl.circlereplay.defaultshader.Vertex(); ol.render.webgl.circlereplay.defaultshader.vertex = new ol.render.webgl.circlereplay.defaultshader.Vertex();
@@ -89,62 +92,74 @@ if (ol.ENABLE_WEBGL) {
/** /**
* @type {WebGLUniformLocation} * @type {WebGLUniformLocation}
*/ */
this.u_fillColor = gl.getUniformLocation(program, 'n'); this.u_fillColor = gl.getUniformLocation(
program, ol.DEBUG_WEBGL ? 'u_fillColor' : 'n');
/** /**
* @type {WebGLUniformLocation} * @type {WebGLUniformLocation}
*/ */
this.u_lineWidth = gl.getUniformLocation(program, 'k'); this.u_lineWidth = gl.getUniformLocation(
program, ol.DEBUG_WEBGL ? 'u_lineWidth' : 'k');
/** /**
* @type {WebGLUniformLocation} * @type {WebGLUniformLocation}
*/ */
this.u_offsetRotateMatrix = gl.getUniformLocation(program, 'j'); this.u_offsetRotateMatrix = gl.getUniformLocation(
program, ol.DEBUG_WEBGL ? 'u_offsetRotateMatrix' : 'j');
/** /**
* @type {WebGLUniformLocation} * @type {WebGLUniformLocation}
*/ */
this.u_offsetScaleMatrix = gl.getUniformLocation(program, 'i'); this.u_offsetScaleMatrix = gl.getUniformLocation(
program, ol.DEBUG_WEBGL ? 'u_offsetScaleMatrix' : 'i');
/** /**
* @type {WebGLUniformLocation} * @type {WebGLUniformLocation}
*/ */
this.u_opacity = gl.getUniformLocation(program, 'm'); this.u_opacity = gl.getUniformLocation(
program, ol.DEBUG_WEBGL ? 'u_opacity' : 'm');
/** /**
* @type {WebGLUniformLocation} * @type {WebGLUniformLocation}
*/ */
this.u_pixelRatio = gl.getUniformLocation(program, 'l'); this.u_pixelRatio = gl.getUniformLocation(
program, ol.DEBUG_WEBGL ? 'u_pixelRatio' : 'l');
/** /**
* @type {WebGLUniformLocation} * @type {WebGLUniformLocation}
*/ */
this.u_projectionMatrix = gl.getUniformLocation(program, 'h'); this.u_projectionMatrix = gl.getUniformLocation(
program, ol.DEBUG_WEBGL ? 'u_projectionMatrix' : 'h');
/** /**
* @type {WebGLUniformLocation} * @type {WebGLUniformLocation}
*/ */
this.u_size = gl.getUniformLocation(program, 'p'); this.u_size = gl.getUniformLocation(
program, ol.DEBUG_WEBGL ? 'u_size' : 'p');
/** /**
* @type {WebGLUniformLocation} * @type {WebGLUniformLocation}
*/ */
this.u_strokeColor = gl.getUniformLocation(program, 'o'); this.u_strokeColor = gl.getUniformLocation(
program, ol.DEBUG_WEBGL ? 'u_strokeColor' : 'o');
/** /**
* @type {number} * @type {number}
*/ */
this.a_instruction = gl.getAttribLocation(program, 'f'); this.a_instruction = gl.getAttribLocation(
program, ol.DEBUG_WEBGL ? 'a_instruction' : 'f');
/** /**
* @type {number} * @type {number}
*/ */
this.a_position = gl.getAttribLocation(program, 'e'); this.a_position = gl.getAttribLocation(
program, ol.DEBUG_WEBGL ? 'a_position' : 'e');
/** /**
* @type {number} * @type {number}
*/ */
this.a_radius = gl.getAttribLocation(program, 'g'); this.a_radius = gl.getAttribLocation(
program, ol.DEBUG_WEBGL ? 'a_radius' : 'g');
}; };
} }

View File

@@ -5,7 +5,6 @@ goog.require('ol');
goog.require('ol.webgl.Fragment'); goog.require('ol.webgl.Fragment');
goog.require('ol.webgl.Vertex'); goog.require('ol.webgl.Vertex');
if (ol.ENABLE_WEBGL) { if (ol.ENABLE_WEBGL) {
/** /**
@@ -37,7 +36,9 @@ if (ol.ENABLE_WEBGL) {
* @const * @const
* @type {string} * @type {string}
*/ */
ol.render.webgl.imagereplay.defaultshader.Fragment.SOURCE = ol.render.webgl.imagereplay.defaultshader.Fragment.OPTIMIZED_SOURCE; ol.render.webgl.imagereplay.defaultshader.Fragment.SOURCE = ol.DEBUG_WEBGL ?
ol.render.webgl.imagereplay.defaultshader.Fragment.DEBUG_SOURCE :
ol.render.webgl.imagereplay.defaultshader.Fragment.OPTIMIZED_SOURCE;
ol.render.webgl.imagereplay.defaultshader.fragment = new ol.render.webgl.imagereplay.defaultshader.Fragment(); ol.render.webgl.imagereplay.defaultshader.fragment = new ol.render.webgl.imagereplay.defaultshader.Fragment();
@@ -72,7 +73,9 @@ if (ol.ENABLE_WEBGL) {
* @const * @const
* @type {string} * @type {string}
*/ */
ol.render.webgl.imagereplay.defaultshader.Vertex.SOURCE = ol.render.webgl.imagereplay.defaultshader.Vertex.OPTIMIZED_SOURCE; ol.render.webgl.imagereplay.defaultshader.Vertex.SOURCE = ol.DEBUG_WEBGL ?
ol.render.webgl.imagereplay.defaultshader.Vertex.DEBUG_SOURCE :
ol.render.webgl.imagereplay.defaultshader.Vertex.OPTIMIZED_SOURCE;
ol.render.webgl.imagereplay.defaultshader.vertex = new ol.render.webgl.imagereplay.defaultshader.Vertex(); ol.render.webgl.imagereplay.defaultshader.vertex = new ol.render.webgl.imagereplay.defaultshader.Vertex();
@@ -89,52 +92,62 @@ if (ol.ENABLE_WEBGL) {
/** /**
* @type {WebGLUniformLocation} * @type {WebGLUniformLocation}
*/ */
this.u_image = gl.getUniformLocation(program, 'l'); this.u_image = gl.getUniformLocation(
program, ol.DEBUG_WEBGL ? 'u_image' : 'l');
/** /**
* @type {WebGLUniformLocation} * @type {WebGLUniformLocation}
*/ */
this.u_offsetRotateMatrix = gl.getUniformLocation(program, 'j'); this.u_offsetRotateMatrix = gl.getUniformLocation(
program, ol.DEBUG_WEBGL ? 'u_offsetRotateMatrix' : 'j');
/** /**
* @type {WebGLUniformLocation} * @type {WebGLUniformLocation}
*/ */
this.u_offsetScaleMatrix = gl.getUniformLocation(program, 'i'); this.u_offsetScaleMatrix = gl.getUniformLocation(
program, ol.DEBUG_WEBGL ? 'u_offsetScaleMatrix' : 'i');
/** /**
* @type {WebGLUniformLocation} * @type {WebGLUniformLocation}
*/ */
this.u_opacity = gl.getUniformLocation(program, 'k'); this.u_opacity = gl.getUniformLocation(
program, ol.DEBUG_WEBGL ? 'u_opacity' : 'k');
/** /**
* @type {WebGLUniformLocation} * @type {WebGLUniformLocation}
*/ */
this.u_projectionMatrix = gl.getUniformLocation(program, 'h'); this.u_projectionMatrix = gl.getUniformLocation(
program, ol.DEBUG_WEBGL ? 'u_projectionMatrix' : 'h');
/** /**
* @type {number} * @type {number}
*/ */
this.a_offsets = gl.getAttribLocation(program, 'e'); this.a_offsets = gl.getAttribLocation(
program, ol.DEBUG_WEBGL ? 'a_offsets' : 'e');
/** /**
* @type {number} * @type {number}
*/ */
this.a_opacity = gl.getAttribLocation(program, 'f'); this.a_opacity = gl.getAttribLocation(
program, ol.DEBUG_WEBGL ? 'a_opacity' : 'f');
/** /**
* @type {number} * @type {number}
*/ */
this.a_position = gl.getAttribLocation(program, 'c'); this.a_position = gl.getAttribLocation(
program, ol.DEBUG_WEBGL ? 'a_position' : 'c');
/** /**
* @type {number} * @type {number}
*/ */
this.a_rotateWithView = gl.getAttribLocation(program, 'g'); this.a_rotateWithView = gl.getAttribLocation(
program, ol.DEBUG_WEBGL ? 'a_rotateWithView' : 'g');
/** /**
* @type {number} * @type {number}
*/ */
this.a_texCoord = gl.getAttribLocation(program, 'd'); this.a_texCoord = gl.getAttribLocation(
program, ol.DEBUG_WEBGL ? 'a_texCoord' : 'd');
}; };
} }

View File

@@ -5,7 +5,6 @@ goog.require('ol');
goog.require('ol.webgl.Fragment'); goog.require('ol.webgl.Fragment');
goog.require('ol.webgl.Vertex'); goog.require('ol.webgl.Vertex');
if (ol.ENABLE_WEBGL) { if (ol.ENABLE_WEBGL) {
/** /**
@@ -37,7 +36,9 @@ if (ol.ENABLE_WEBGL) {
* @const * @const
* @type {string} * @type {string}
*/ */
ol.render.webgl.linestringreplay.defaultshader.Fragment.SOURCE = ol.render.webgl.linestringreplay.defaultshader.Fragment.OPTIMIZED_SOURCE; ol.render.webgl.linestringreplay.defaultshader.Fragment.SOURCE = ol.DEBUG_WEBGL ?
ol.render.webgl.linestringreplay.defaultshader.Fragment.DEBUG_SOURCE :
ol.render.webgl.linestringreplay.defaultshader.Fragment.OPTIMIZED_SOURCE;
ol.render.webgl.linestringreplay.defaultshader.fragment = new ol.render.webgl.linestringreplay.defaultshader.Fragment(); ol.render.webgl.linestringreplay.defaultshader.fragment = new ol.render.webgl.linestringreplay.defaultshader.Fragment();
@@ -72,7 +73,9 @@ if (ol.ENABLE_WEBGL) {
* @const * @const
* @type {string} * @type {string}
*/ */
ol.render.webgl.linestringreplay.defaultshader.Vertex.SOURCE = ol.render.webgl.linestringreplay.defaultshader.Vertex.OPTIMIZED_SOURCE; ol.render.webgl.linestringreplay.defaultshader.Vertex.SOURCE = ol.DEBUG_WEBGL ?
ol.render.webgl.linestringreplay.defaultshader.Vertex.DEBUG_SOURCE :
ol.render.webgl.linestringreplay.defaultshader.Vertex.OPTIMIZED_SOURCE;
ol.render.webgl.linestringreplay.defaultshader.vertex = new ol.render.webgl.linestringreplay.defaultshader.Vertex(); ol.render.webgl.linestringreplay.defaultshader.vertex = new ol.render.webgl.linestringreplay.defaultshader.Vertex();
@@ -89,67 +92,80 @@ if (ol.ENABLE_WEBGL) {
/** /**
* @type {WebGLUniformLocation} * @type {WebGLUniformLocation}
*/ */
this.u_color = gl.getUniformLocation(program, 'n'); this.u_color = gl.getUniformLocation(
program, ol.DEBUG_WEBGL ? 'u_color' : 'n');
/** /**
* @type {WebGLUniformLocation} * @type {WebGLUniformLocation}
*/ */
this.u_lineWidth = gl.getUniformLocation(program, 'k'); this.u_lineWidth = gl.getUniformLocation(
program, ol.DEBUG_WEBGL ? 'u_lineWidth' : 'k');
/** /**
* @type {WebGLUniformLocation} * @type {WebGLUniformLocation}
*/ */
this.u_miterLimit = gl.getUniformLocation(program, 'l'); this.u_miterLimit = gl.getUniformLocation(
program, ol.DEBUG_WEBGL ? 'u_miterLimit' : 'l');
/** /**
* @type {WebGLUniformLocation} * @type {WebGLUniformLocation}
*/ */
this.u_offsetRotateMatrix = gl.getUniformLocation(program, 'j'); this.u_offsetRotateMatrix = gl.getUniformLocation(
program, ol.DEBUG_WEBGL ? 'u_offsetRotateMatrix' : 'j');
/** /**
* @type {WebGLUniformLocation} * @type {WebGLUniformLocation}
*/ */
this.u_offsetScaleMatrix = gl.getUniformLocation(program, 'i'); this.u_offsetScaleMatrix = gl.getUniformLocation(
program, ol.DEBUG_WEBGL ? 'u_offsetScaleMatrix' : 'i');
/** /**
* @type {WebGLUniformLocation} * @type {WebGLUniformLocation}
*/ */
this.u_opacity = gl.getUniformLocation(program, 'm'); this.u_opacity = gl.getUniformLocation(
program, ol.DEBUG_WEBGL ? 'u_opacity' : 'm');
/** /**
* @type {WebGLUniformLocation} * @type {WebGLUniformLocation}
*/ */
this.u_pixelRatio = gl.getUniformLocation(program, 'p'); this.u_pixelRatio = gl.getUniformLocation(
program, ol.DEBUG_WEBGL ? 'u_pixelRatio' : 'p');
/** /**
* @type {WebGLUniformLocation} * @type {WebGLUniformLocation}
*/ */
this.u_projectionMatrix = gl.getUniformLocation(program, 'h'); this.u_projectionMatrix = gl.getUniformLocation(
program, ol.DEBUG_WEBGL ? 'u_projectionMatrix' : 'h');
/** /**
* @type {WebGLUniformLocation} * @type {WebGLUniformLocation}
*/ */
this.u_size = gl.getUniformLocation(program, 'o'); this.u_size = gl.getUniformLocation(
program, ol.DEBUG_WEBGL ? 'u_size' : 'o');
/** /**
* @type {number} * @type {number}
*/ */
this.a_direction = gl.getAttribLocation(program, 'g'); this.a_direction = gl.getAttribLocation(
program, ol.DEBUG_WEBGL ? 'a_direction' : 'g');
/** /**
* @type {number} * @type {number}
*/ */
this.a_lastPos = gl.getAttribLocation(program, 'd'); this.a_lastPos = gl.getAttribLocation(
program, ol.DEBUG_WEBGL ? 'a_lastPos' : 'd');
/** /**
* @type {number} * @type {number}
*/ */
this.a_nextPos = gl.getAttribLocation(program, 'f'); this.a_nextPos = gl.getAttribLocation(
program, ol.DEBUG_WEBGL ? 'a_nextPos' : 'f');
/** /**
* @type {number} * @type {number}
*/ */
this.a_position = gl.getAttribLocation(program, 'e'); this.a_position = gl.getAttribLocation(
program, ol.DEBUG_WEBGL ? 'a_position' : 'e');
}; };
} }

View File

@@ -5,7 +5,6 @@ goog.require('ol');
goog.require('ol.webgl.Fragment'); goog.require('ol.webgl.Fragment');
goog.require('ol.webgl.Vertex'); goog.require('ol.webgl.Vertex');
if (ol.ENABLE_WEBGL) { if (ol.ENABLE_WEBGL) {
/** /**
@@ -37,7 +36,9 @@ if (ol.ENABLE_WEBGL) {
* @const * @const
* @type {string} * @type {string}
*/ */
ol.render.webgl.polygonreplay.defaultshader.Fragment.SOURCE = ol.render.webgl.polygonreplay.defaultshader.Fragment.OPTIMIZED_SOURCE; ol.render.webgl.polygonreplay.defaultshader.Fragment.SOURCE = ol.DEBUG_WEBGL ?
ol.render.webgl.polygonreplay.defaultshader.Fragment.DEBUG_SOURCE :
ol.render.webgl.polygonreplay.defaultshader.Fragment.OPTIMIZED_SOURCE;
ol.render.webgl.polygonreplay.defaultshader.fragment = new ol.render.webgl.polygonreplay.defaultshader.Fragment(); ol.render.webgl.polygonreplay.defaultshader.fragment = new ol.render.webgl.polygonreplay.defaultshader.Fragment();
@@ -72,7 +73,9 @@ if (ol.ENABLE_WEBGL) {
* @const * @const
* @type {string} * @type {string}
*/ */
ol.render.webgl.polygonreplay.defaultshader.Vertex.SOURCE = ol.render.webgl.polygonreplay.defaultshader.Vertex.OPTIMIZED_SOURCE; ol.render.webgl.polygonreplay.defaultshader.Vertex.SOURCE = ol.DEBUG_WEBGL ?
ol.render.webgl.polygonreplay.defaultshader.Vertex.DEBUG_SOURCE :
ol.render.webgl.polygonreplay.defaultshader.Vertex.OPTIMIZED_SOURCE;
ol.render.webgl.polygonreplay.defaultshader.vertex = new ol.render.webgl.polygonreplay.defaultshader.Vertex(); ol.render.webgl.polygonreplay.defaultshader.vertex = new ol.render.webgl.polygonreplay.defaultshader.Vertex();
@@ -89,32 +92,38 @@ if (ol.ENABLE_WEBGL) {
/** /**
* @type {WebGLUniformLocation} * @type {WebGLUniformLocation}
*/ */
this.u_color = gl.getUniformLocation(program, 'e'); this.u_color = gl.getUniformLocation(
program, ol.DEBUG_WEBGL ? 'u_color' : 'e');
/** /**
* @type {WebGLUniformLocation} * @type {WebGLUniformLocation}
*/ */
this.u_offsetRotateMatrix = gl.getUniformLocation(program, 'd'); this.u_offsetRotateMatrix = gl.getUniformLocation(
program, ol.DEBUG_WEBGL ? 'u_offsetRotateMatrix' : 'd');
/** /**
* @type {WebGLUniformLocation} * @type {WebGLUniformLocation}
*/ */
this.u_offsetScaleMatrix = gl.getUniformLocation(program, 'c'); this.u_offsetScaleMatrix = gl.getUniformLocation(
program, ol.DEBUG_WEBGL ? 'u_offsetScaleMatrix' : 'c');
/** /**
* @type {WebGLUniformLocation} * @type {WebGLUniformLocation}
*/ */
this.u_opacity = gl.getUniformLocation(program, 'f'); this.u_opacity = gl.getUniformLocation(
program, ol.DEBUG_WEBGL ? 'u_opacity' : 'f');
/** /**
* @type {WebGLUniformLocation} * @type {WebGLUniformLocation}
*/ */
this.u_projectionMatrix = gl.getUniformLocation(program, 'b'); this.u_projectionMatrix = gl.getUniformLocation(
program, ol.DEBUG_WEBGL ? 'u_projectionMatrix' : 'b');
/** /**
* @type {number} * @type {number}
*/ */
this.a_position = gl.getAttribLocation(program, 'a'); this.a_position = gl.getAttribLocation(
program, ol.DEBUG_WEBGL ? 'a_position' : 'a');
}; };
} }

View File

@@ -5,7 +5,6 @@ goog.require('ol');
goog.require('ol.webgl.Fragment'); goog.require('ol.webgl.Fragment');
goog.require('ol.webgl.Vertex'); goog.require('ol.webgl.Vertex');
if (ol.ENABLE_WEBGL) { if (ol.ENABLE_WEBGL) {
/** /**
@@ -37,7 +36,9 @@ if (ol.ENABLE_WEBGL) {
* @const * @const
* @type {string} * @type {string}
*/ */
ol.renderer.webgl.defaultmapshader.Fragment.SOURCE = ol.renderer.webgl.defaultmapshader.Fragment.OPTIMIZED_SOURCE; ol.renderer.webgl.defaultmapshader.Fragment.SOURCE = ol.DEBUG_WEBGL ?
ol.renderer.webgl.defaultmapshader.Fragment.DEBUG_SOURCE :
ol.renderer.webgl.defaultmapshader.Fragment.OPTIMIZED_SOURCE;
ol.renderer.webgl.defaultmapshader.fragment = new ol.renderer.webgl.defaultmapshader.Fragment(); ol.renderer.webgl.defaultmapshader.fragment = new ol.renderer.webgl.defaultmapshader.Fragment();
@@ -72,7 +73,9 @@ if (ol.ENABLE_WEBGL) {
* @const * @const
* @type {string} * @type {string}
*/ */
ol.renderer.webgl.defaultmapshader.Vertex.SOURCE = ol.renderer.webgl.defaultmapshader.Vertex.OPTIMIZED_SOURCE; ol.renderer.webgl.defaultmapshader.Vertex.SOURCE = ol.DEBUG_WEBGL ?
ol.renderer.webgl.defaultmapshader.Vertex.DEBUG_SOURCE :
ol.renderer.webgl.defaultmapshader.Vertex.OPTIMIZED_SOURCE;
ol.renderer.webgl.defaultmapshader.vertex = new ol.renderer.webgl.defaultmapshader.Vertex(); ol.renderer.webgl.defaultmapshader.vertex = new ol.renderer.webgl.defaultmapshader.Vertex();
@@ -89,32 +92,38 @@ if (ol.ENABLE_WEBGL) {
/** /**
* @type {WebGLUniformLocation} * @type {WebGLUniformLocation}
*/ */
this.u_opacity = gl.getUniformLocation(program, 'f'); this.u_opacity = gl.getUniformLocation(
program, ol.DEBUG_WEBGL ? 'u_opacity' : 'f');
/** /**
* @type {WebGLUniformLocation} * @type {WebGLUniformLocation}
*/ */
this.u_projectionMatrix = gl.getUniformLocation(program, 'e'); this.u_projectionMatrix = gl.getUniformLocation(
program, ol.DEBUG_WEBGL ? 'u_projectionMatrix' : 'e');
/** /**
* @type {WebGLUniformLocation} * @type {WebGLUniformLocation}
*/ */
this.u_texCoordMatrix = gl.getUniformLocation(program, 'd'); this.u_texCoordMatrix = gl.getUniformLocation(
program, ol.DEBUG_WEBGL ? 'u_texCoordMatrix' : 'd');
/** /**
* @type {WebGLUniformLocation} * @type {WebGLUniformLocation}
*/ */
this.u_texture = gl.getUniformLocation(program, 'g'); this.u_texture = gl.getUniformLocation(
program, ol.DEBUG_WEBGL ? 'u_texture' : 'g');
/** /**
* @type {number} * @type {number}
*/ */
this.a_position = gl.getAttribLocation(program, 'b'); this.a_position = gl.getAttribLocation(
program, ol.DEBUG_WEBGL ? 'a_position' : 'b');
/** /**
* @type {number} * @type {number}
*/ */
this.a_texCoord = gl.getAttribLocation(program, 'c'); this.a_texCoord = gl.getAttribLocation(
program, ol.DEBUG_WEBGL ? 'a_texCoord' : 'c');
}; };
} }

View File

@@ -5,7 +5,6 @@ goog.require('ol');
goog.require('ol.webgl.Fragment'); goog.require('ol.webgl.Fragment');
goog.require('ol.webgl.Vertex'); goog.require('ol.webgl.Vertex');
if (ol.ENABLE_WEBGL) { if (ol.ENABLE_WEBGL) {
/** /**
@@ -37,7 +36,9 @@ if (ol.ENABLE_WEBGL) {
* @const * @const
* @type {string} * @type {string}
*/ */
ol.renderer.webgl.tilelayershader.Fragment.SOURCE = ol.renderer.webgl.tilelayershader.Fragment.OPTIMIZED_SOURCE; ol.renderer.webgl.tilelayershader.Fragment.SOURCE = ol.DEBUG_WEBGL ?
ol.renderer.webgl.tilelayershader.Fragment.DEBUG_SOURCE :
ol.renderer.webgl.tilelayershader.Fragment.OPTIMIZED_SOURCE;
ol.renderer.webgl.tilelayershader.fragment = new ol.renderer.webgl.tilelayershader.Fragment(); ol.renderer.webgl.tilelayershader.fragment = new ol.renderer.webgl.tilelayershader.Fragment();
@@ -72,7 +73,9 @@ if (ol.ENABLE_WEBGL) {
* @const * @const
* @type {string} * @type {string}
*/ */
ol.renderer.webgl.tilelayershader.Vertex.SOURCE = ol.renderer.webgl.tilelayershader.Vertex.OPTIMIZED_SOURCE; ol.renderer.webgl.tilelayershader.Vertex.SOURCE = ol.DEBUG_WEBGL ?
ol.renderer.webgl.tilelayershader.Vertex.DEBUG_SOURCE :
ol.renderer.webgl.tilelayershader.Vertex.OPTIMIZED_SOURCE;
ol.renderer.webgl.tilelayershader.vertex = new ol.renderer.webgl.tilelayershader.Vertex(); ol.renderer.webgl.tilelayershader.vertex = new ol.renderer.webgl.tilelayershader.Vertex();
@@ -89,22 +92,26 @@ if (ol.ENABLE_WEBGL) {
/** /**
* @type {WebGLUniformLocation} * @type {WebGLUniformLocation}
*/ */
this.u_texture = gl.getUniformLocation(program, 'e'); this.u_texture = gl.getUniformLocation(
program, ol.DEBUG_WEBGL ? 'u_texture' : 'e');
/** /**
* @type {WebGLUniformLocation} * @type {WebGLUniformLocation}
*/ */
this.u_tileOffset = gl.getUniformLocation(program, 'd'); this.u_tileOffset = gl.getUniformLocation(
program, ol.DEBUG_WEBGL ? 'u_tileOffset' : 'd');
/** /**
* @type {number} * @type {number}
*/ */
this.a_position = gl.getAttribLocation(program, 'b'); this.a_position = gl.getAttribLocation(
program, ol.DEBUG_WEBGL ? 'a_position' : 'b');
/** /**
* @type {number} * @type {number}
*/ */
this.a_texCoord = gl.getAttribLocation(program, 'c'); this.a_texCoord = gl.getAttribLocation(
program, ol.DEBUG_WEBGL ? 'a_texCoord' : 'c');
}; };
} }

View File

@@ -5,7 +5,6 @@ goog.require('ol');
goog.require('ol.webgl.Fragment'); goog.require('ol.webgl.Fragment');
goog.require('ol.webgl.Vertex'); goog.require('ol.webgl.Vertex');
if (ol.ENABLE_WEBGL) { if (ol.ENABLE_WEBGL) {
/** /**
@@ -37,7 +36,9 @@ if (ol.ENABLE_WEBGL) {
* @const * @const
* @type {string} * @type {string}
*/ */
{{className}}.Fragment.SOURCE = {{className}}.Fragment.OPTIMIZED_SOURCE; {{className}}.Fragment.SOURCE = ol.DEBUG_WEBGL ?
{{className}}.Fragment.DEBUG_SOURCE :
{{className}}.Fragment.OPTIMIZED_SOURCE;
{{className}}.fragment = new {{className}}.Fragment(); {{className}}.fragment = new {{className}}.Fragment();
@@ -72,7 +73,9 @@ if (ol.ENABLE_WEBGL) {
* @const * @const
* @type {string} * @type {string}
*/ */
{{className}}.Vertex.SOURCE = {{className}}.Vertex.OPTIMIZED_SOURCE; {{className}}.Vertex.SOURCE = ol.DEBUG_WEBGL ?
{{className}}.Vertex.DEBUG_SOURCE :
{{className}}.Vertex.OPTIMIZED_SOURCE;
{{className}}.vertex = new {{className}}.Vertex(); {{className}}.vertex = new {{className}}.Vertex();
@@ -90,14 +93,16 @@ if (ol.ENABLE_WEBGL) {
/** /**
* @type {WebGLUniformLocation} * @type {WebGLUniformLocation}
*/ */
this.{{originalName}} = gl.getUniformLocation(program, '{{shortName}}'); this.{{originalName}} = gl.getUniformLocation(
program, ol.DEBUG_WEBGL ? '{{originalName}}' : '{{shortName}}');
{{/getUniforms}} {{/getUniforms}}
{{#getAttributes}} {{#getAttributes}}
/** /**
* @type {number} * @type {number}
*/ */
this.{{originalName}} = gl.getAttribLocation(program, '{{shortName}}'); this.{{originalName}} = gl.getAttribLocation(
program, ol.DEBUG_WEBGL ? '{{originalName}}' : '{{shortName}}');
{{/getAttributes}} {{/getAttributes}}
}; };