Graphics shader requires fragment stage for now;

The vertex-only shader requires too much juggling of shader stage flags
and pipeline layout compatibility when e.g. binding push constants and
descriptor sets.
This commit is contained in:
bjorn 2024-02-21 10:37:59 -08:00
parent 6a669bd967
commit b63ec6e137
2 changed files with 2 additions and 4 deletions

View File

@ -1027,7 +1027,7 @@ static int l_lovrGraphicsNewShader(lua_State* L) {
info.type = SHADER_GRAPHICS;
source[0] = luax_checkshadersource(L, 1, STAGE_VERTEX, &shouldFree[0]);
source[1] = luax_checkshadersource(L, 2, STAGE_FRAGMENT, &shouldFree[1]);
info.stageCount = source[1].code ? 2 : 1;
info.stageCount = 2;
index = 3;
}

View File

@ -2845,9 +2845,7 @@ Shader* lovrShaderCreate(const ShaderInfo* info) {
}
if (info->type == SHADER_GRAPHICS) {
uint32_t mask = FLAG_VERTEX | FLAG_FRAGMENT;
lovrCheck(shader->stageMask & FLAG_VERTEX, "Graphics shaders must have a vertex stage");
lovrCheck((shader->stageMask & mask) == mask, "Graphics shaders can only have vertex and pixel stages");
lovrCheck(shader->stageMask == (FLAG_VERTEX | FLAG_FRAGMENT), "Graphics shaders must have a vertex and a pixel stage");
} else if (info->type == SHADER_COMPUTE) {
lovrCheck(shader->stageMask == FLAG_COMPUTE, "Compute shaders can only have a compute stage");
}