mirror of
https://github.com/love2d/love.git
synced 2026-08-18 11:44:15 +02:00
love.graphics.newShader: add a compile options table parameter.
The only field currently read from the table is 'defines', which can contain either an array of define names, or name-value pairs.
For example: newShader(file, {defines={"MYFEATURE_ENABLED", MYSETTING=1}})
Fixes #1577
This commit is contained in:
@@ -425,9 +425,10 @@ bool Graphics::setMode(void */*context*/, int width, int height, int pixelwidth,
|
||||
if (!Shader::standardShaders[i])
|
||||
{
|
||||
std::vector<std::string> stages;
|
||||
Shader::CompileOptions opts;
|
||||
stages.push_back(Shader::getDefaultCode(stype, SHADERSTAGE_VERTEX));
|
||||
stages.push_back(Shader::getDefaultCode(stype, SHADERSTAGE_PIXEL));
|
||||
Shader::standardShaders[i] = newShader(stages);
|
||||
Shader::standardShaders[i] = newShader(stages, opts);
|
||||
}
|
||||
}
|
||||
catch (love::Exception &)
|
||||
|
||||
Reference in New Issue
Block a user