If you add #define SHADER_NAME to the start of your shader then it will be picked up as the WebGLShader name during the setShadersFromConfig process within WebGLPipeline.

This commit is contained in:
Richard Davey 2023-02-15 01:15:01 +00:00
parent b40cc9b584
commit e1391445fe

View file

@ -728,6 +728,17 @@ var WebGLPipeline = new Class({
var fragShader = Utils.parseFragmentShaderMaxTextures(GetFastValue(shaderEntry, fName, defaultFragShader), renderer.maxTextures);
var attributes = GetFastValue(shaderEntry, aName, defaultAttribs);
if (name === 'default')
{
var lines = fragShader.split('\n');
var test = lines[0].trim();
if (test.indexOf('#define SHADER_NAME') > -1)
{
name = test.substring(20);
}
}
if (vertShader && fragShader)
{
newShaders.push(new WebGLShader(this, name, vertShader, fragShader, DeepCopy(attributes)));