Skip to content

ShaderState

Steven Johnson edited this page Feb 13, 2019 · 3 revisions

(This is not exactly an ideal name for this object, but I don't know what might be better.)

Certain choices suggested in the kernel extensions imply a need to interact with the resulting shader(s). These suggest a master object that could be retrieved like so:

local state = graphics.getShaderState("filter.custom.my_shader")

and return nil or simply be useless if the shader in question specified no relevant settings.

For uniform arrays, some options might be:

state:SetUniform(index, { --[[ blah, blah ]] }) -- perhaps vector and matrix variants

and maybe some range- and byte-based variants.

Something like local n = state:GetUniformsCount() makes sense too.

The isReleasable flag naturally suggests a state:Release(). This would only prevent new accesses to the shader and state, leaving in place any current uses.