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:
Alex Szpakowski
2022-02-20 12:23:41 -04:00
parent bc1c38d361
commit 0fa00e0bdc
7 changed files with 94 additions and 28 deletions
+2 -1
View File
@@ -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 &)