Closed
Bug 1082213
Opened 11 years ago
Closed 6 years ago
Improvement: track a WebGL context's bound textures in a single associative array
Categories
(Core :: Graphics: CanvasWebGL, task, P5)
Tracking
()
RESOLVED
WONTFIX
People
(Reporter: bjacob, Unassigned)
Details
WebGLContext tracks which WebGLTexture's are bound (by bindTexture()) on which target (e.g. TEXTURE_2D) and which units (as in activeTexture()).
It used to do so using two nsTArrays, mBound2DTextures and mBoundCubeMapTextures. With the addition of 3D textures for WebGL 2, a third nsTArray is added: mBound3DTextures.
Then we have logic to determine, for each 'GLenum target' value, which array to use.
That clearly doesn't scale very well with the number of targets, and more new targets are going to be added soon, such as TEXTURE_2D_ARRAY.
We should just have a single associative array where keys are (target, unit) pairs and values are pointers to WebGLTexture's.
(Side note: the extra unfortunate aspect of our current separate-plain-arrays approach is that the arrays are statically sized on context creation, which increases the memory overhead of each WebGLContext by several dozen times the size of a pointer).
Comment 1•11 years ago
|
||
To be fair, I don't think the memory aspect is really relevant. We might manage to get better cache behavior by having a more tightly packed map, though.
I tried to clean this up when I looked at it, but, yeah, it sure sucks that you can bind a texture to each target on a unit, creating a 2D matrix of binding points. How many units do most GPUs have? Not many. 8-16? Conceivably, we could just create a 2D array, textureBindings[UNIT_COUNT][TEX_TARGET_COUNT]. I doubt TEX_TARGET_COUNT is going to go much over 4.
Updated•6 years ago
|
Type: defect → task
Priority: -- → P5
Comment 3•6 years ago
|
||
FWIW this is sort of half way there now:
https://searchfox.org/mozilla-central/rev/3811b11b5773c1dccfe8228bfc7143b10a9a2a99/dom/canvas/ClientWebGLContext.h#168
I don't think making this a map to eliminate empty slots is very helpful to us.
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → WONTFIX
You need to log in
before you can comment on or make changes to this bug.
Description
•