The WebGLRenderer instance that owns this wrapper.
The vertex shader source code as a string.
The fragment shader source code as a string.
ReadonlycompileThe time taken to compile this program, in milliseconds.
ReadonlycompilingWhether this program is currently being compiled.
This will always be false, unless parallel shader compilation
is enabled via config.render.skipUnreadyShaders.
The fragment shader source code as a string.
The buffer which this program is using for its attributes.
Map of attribute names to their indexes in glAttributes.
The attribute state of this program.
These represent the actual state in WebGL, and are only updated when the program is used to draw.
The WebGL state necessary to bind this program.
This is used internally to accelerate state changes.
The uniform state of this program.
These represent the actual state in WebGL, and are only updated when the program is used to draw.
The WebGLRenderer instance that owns this wrapper.
Requests to update the uniform state. Set a request by name to a new value. These are only processed when the program is used to draw.
The vertex shader source code as a string.
The WebGLProgram being wrapped by this class.
This property could change at any time. Therefore, you should never store a reference to this value. It should only be passed directly to the WebGL API for drawing.
Set this program as the active program in the WebGL context, then
process all pending uniform update requests that were queued via
setUniform. Each request is applied to the GPU and the queue is
cleared, so only values that have actually changed are sent to WebGL.
Poll shader compilation status, and complete the program if it is ready.
This is only called if skipUnreadyShaders is enabled
and the KHR_parallel_shader_compile extension is available.
Creates a WebGLProgram from the given vertex and fragment shaders.
This is called automatically by the constructor. It may also be called again if the WebGLProgram needs re-creating.
Destroys this WebGLProgramWrapper and releases all associated WebGL resources.
If the context is not lost, this deletes the vertex shader, fragment shader, and the linked WebGLProgram from the GPU, and disables all vertex attribute arrays used by this program. The uniform map, attribute map, and any pending uniform requests are also cleared. All internal references are then nulled so this wrapper can be safely garbage-collected.
Set a uniform value for this WebGLProgram.
This method doesn't set the WebGL value directly.
Instead, it adds a request to the uniformRequests map.
These requests are processed when the program is used to draw.
The name of the uniform.
The value to set.
Wraps a WebGL shader program, which is the GPU-side program compiled from a vertex shader and a fragment shader. Together, these shaders define how geometry is transformed and how each pixel within that geometry is colored. Every pipeline in Phaser's WebGL renderer is backed by a WebGLProgramWrapper.
Beyond holding the compiled program, this wrapper manages the full lifecycle of the associated WebGL resources: it tracks vertex attribute locations and layout, stores uniform values, and queues uniform update requests that are applied lazily when the program is bound for drawing.
The raw WebGLProgram object should never be used or stored directly outside of the WebGLRenderer. By routing all access through this wrapper, the renderer can transparently handle WebGL context loss and restoration — recreating the underlying program and re-applying all state — without any other system needing to be aware of it. Always use WebGLProgramWrapper instead of holding a direct WebGLProgram reference.