Properly use identity / identitylighting when cgen isn't explicitly specified

This commit is contained in:
smallmodel 2024-02-12 23:47:07 +01:00
parent 0b16d599d5
commit 51ba1e2951
No known key found for this signature in database
GPG key ID: A96F163ED4891440

View file

@ -1684,10 +1684,11 @@ static qboolean ParseStage(shaderStage_t* stage, char** text)
// if cgen isn't explicitly specified, use either identity or identitylighting
//
if ( stage->rgbGen == CGEN_BAD ) {
if ( (!cntBundle && !stage->bundle[0].isLightmap) ||
blendSrcBits == 0 ||
if (cntBundle || stage->bundle[0].isLightmap) {
stage->rgbGen = CGEN_IDENTITY;
} else if (blendSrcBits == 0 ||
blendSrcBits == GLS_SRCBLEND_ONE ||
blendSrcBits == GLS_SRCBLEND_SRC_ALPHA ) {
blendSrcBits == GLS_SRCBLEND_SRC_ALPHA) {
stage->rgbGen = CGEN_IDENTITY_LIGHTING;
} else {
stage->rgbGen = CGEN_IDENTITY;
@ -1709,7 +1710,7 @@ static qboolean ParseStage(shaderStage_t* stage, char** text)
}
// decide which agens we can skip
if ( stage->alphaGen == CGEN_IDENTITY ) {
if ( stage->alphaGen == AGEN_IDENTITY ) {
if ( stage->rgbGen == CGEN_IDENTITY
|| stage->rgbGen == CGEN_LIGHTING_GRID
|| stage->rgbGen == CGEN_LIGHTING_SPHERICAL ) {