[Webkit-unassigned] [Bug 52190] getUniform does not support SAMPLER_2D or SAMPLER_CUBE
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Mon Jan 10 19:47:22 PST 2011
https://bugs.webkit.org/show_bug.cgi?id=52190
--- Comment #1 from Ben Vanik <ben.vanik at gmail.com> 2011-01-10 19:47:22 PST ---
Here's the current workaround I'm using until this is fixed, in case anyone else needs it - just call installUniformHack after getting the gl context.
function installUniformHack(gl) {
var uniqueUniformId = 0;
var original_getUniformLocation = gl.getUniformLocation;
gl.getUniformLocation = function (program, name) {
var result = original_getUniformLocation.apply(this, arguments);
if (result) {
if (!result.hasOwnProperty("__uniqueId")) {
result.__uniqueId = String(uniqueUniformId++);
}
}
return result;
};
var original_uniform1i = gl.uniform1i;
gl.uniform1i = function (loc, value) {
var program = this.getParameter(this.CURRENT_PROGRAM);
var lookaside = program.__uniformLookaside;
if (!lookaside) {
lookaside = program.__uniformLookaside = {};
}
lookaside[loc.__uniqueId] = value;
original_uniform1i.apply(this, arguments);
};
var original_uniform1iv = gl.uniform1iv;
gl.uniform1iv = function (loc, value) {
var program = this.getParameter(this.CURRENT_PROGRAM);
var lookaside = program.__uniformLookaside;
if (!lookaside) {
lookaside = program.__uniformLookaside = {};
}
lookaside[loc.__uniqueId] = value[0];
original_uniform1iv.apply(this, arguments);
};
var original_getUniform = gl.getUniform;
gl.getUniform = function (program, loc) {
var lookaside = program.__uniformLookaside;
if (lookaside) {
if (lookaside.hasOwnProperty(loc.__uniqueId)) {
return lookaside[loc.__uniqueId];
}
}
return original_getUniform.apply(this, arguments);
};
};
--
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
More information about the webkit-unassigned
mailing list