aboutsummaryrefslogtreecommitdiff
path: root/src/webGLClient.js
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2014-06-23 15:59:45 -0700
committerAlon Zakai <alonzakai@gmail.com>2014-06-23 15:59:45 -0700
commit594d83efe2cb99915c0e9fbda685860de1cbe555 (patch)
tree688cb1c1e2911452e1fadb38b5dd46cbb059a365 /src/webGLClient.js
parent2ebcf95b0e305f777143e3ad783896c17b769324 (diff)
fix aniso checking, and proxy the aniso extension parameter properly
Diffstat (limited to 'src/webGLClient.js')
-rw-r--r--src/webGLClient.js13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/webGLClient.js b/src/webGLClient.js
index 397cfa8c..53fddb50 100644
--- a/src/webGLClient.js
+++ b/src/webGLClient.js
@@ -222,12 +222,23 @@ function WebGLClient() {
}
WebGLClient.prefetch = function() {
+ // Create a fake temporary GL context
var canvas = document.createElement('canvas');
var ctx = canvas.getContext('webgl-experimental') || canvas.getContext('webgl');
if (!ctx) return;
+ // Fetch the parameters and proxy them
var parameters = {};
['MAX_VERTEX_ATTRIBS', 'MAX_TEXTURE_IMAGE_UNITS', 'MAX_TEXTURE_SIZE', 'MAX_CUBE_MAP_TEXTURE_SIZE', 'MAX_VERTEX_UNIFORM_VECTORS', 'MAX_FRAGMENT_UNIFORM_VECTORS', 'MAX_VARYING_VECTORS', 'MAX_COMBINED_TEXTURE_IMAGE_UNITS', 'VENDOR', 'RENDERER', 'VERSION'].forEach(function(name) {
- parameters[ctx[name]] = ctx.getParameter(ctx[name]);
+ var id = ctx[name];
+ parameters[id] = ctx.getParameter(id);
+ });
+ // Try to enable some extensions, so we can access their parameters
+ [{ extName: 'EXT_texture_filter_anisotropic', paramName: 'MAX_TEXTURE_MAX_ANISOTROPY_EXT' }].forEach(function(pair) {
+ var ext = ctx.getExtension(pair.extName) || ctx.getExtension('MOZ_' + pair.extName) || 'WEBKIT_' + ctx.getExtension(pair.extName);
+ if (ext) {
+ var id = ext[pair.paramName];
+ parameters[id] = ctx.getParameter(id);
+ }
});
worker.postMessage({ target: 'gl', op: 'setPrefetched', parameters: parameters, extensions: ctx.getSupportedExtensions() });
};