mirror of
https://github.com/thunderbrewhq/thunderbrew
synced 2025-04-16 10:04:42 +03:00
fix(gx): only change vertex array FFP state for used attrib slots
This commit is contained in:
parent
eddc6f7f4a
commit
eb70607750
@ -217,12 +217,25 @@ void GLVertexArray::ApplyVertexFormat(GLDevice* device) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (int32_t s = 0; s < 16; s++) {
|
for (int32_t s = 0; s < 16; s++) {
|
||||||
bool* prevAttribEnable;
|
// Shader
|
||||||
GLenum glArray;
|
|
||||||
|
|
||||||
if (useVertexShader) {
|
if (useVertexShader) {
|
||||||
prevAttribEnable = &this->m_GLStates.vertexAttribs[s].enable;
|
auto prevAttribEnable = &this->m_GLStates.vertexAttribs[s].enable;
|
||||||
|
|
||||||
|
if (*prevAttribEnable != attribEnable[s]) {
|
||||||
|
if (attribEnable[s]) {
|
||||||
|
glEnableVertexAttribArrayARB(s);
|
||||||
} else {
|
} else {
|
||||||
|
glDisableVertexAttribArrayARB(s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
*prevAttribEnable = attribEnable[s];
|
||||||
|
|
||||||
|
// FFP
|
||||||
|
} else {
|
||||||
|
bool* prevAttribEnable = nullptr;
|
||||||
|
GLenum glArray = GL_NONE;
|
||||||
|
|
||||||
switch (s) {
|
switch (s) {
|
||||||
case 0: {
|
case 0: {
|
||||||
prevAttribEnable = &this->m_GLStates.position.enable;
|
prevAttribEnable = &this->m_GLStates.position.enable;
|
||||||
@ -262,6 +275,7 @@ void GLVertexArray::ApplyVertexFormat(GLDevice* device) {
|
|||||||
case 13: {
|
case 13: {
|
||||||
auto tmu = s - 6;
|
auto tmu = s - 6;
|
||||||
auto texCoordIndex = device->m_States.fixedFunc.texCoordIndex[tmu];
|
auto texCoordIndex = device->m_States.fixedFunc.texCoordIndex[tmu];
|
||||||
|
|
||||||
prevAttribEnable = &this->m_GLStates.texCoord[texCoordIndex].enable;
|
prevAttribEnable = &this->m_GLStates.texCoord[texCoordIndex].enable;
|
||||||
glArray = GL_TEXTURE_COORD_ARRAY;
|
glArray = GL_TEXTURE_COORD_ARRAY;
|
||||||
|
|
||||||
@ -269,19 +283,15 @@ void GLVertexArray::ApplyVertexFormat(GLDevice* device) {
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (prevAttribEnable) {
|
||||||
if (*prevAttribEnable != attribEnable[s]) {
|
if (*prevAttribEnable != attribEnable[s]) {
|
||||||
if (attribEnable[s]) {
|
if (attribEnable[s]) {
|
||||||
if (useVertexShader) {
|
|
||||||
glEnableVertexAttribArrayARB(s);
|
|
||||||
} else {
|
|
||||||
glEnableClientState(glArray);
|
glEnableClientState(glArray);
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (useVertexShader) {
|
|
||||||
glDisableVertexAttribArrayARB(s);
|
|
||||||
} else {
|
} else {
|
||||||
glDisableClientState(glArray);
|
glDisableClientState(glArray);
|
||||||
}
|
}
|
||||||
@ -290,6 +300,7 @@ void GLVertexArray::ApplyVertexFormat(GLDevice* device) {
|
|||||||
*prevAttribEnable = attribEnable[s];
|
*prevAttribEnable = attribEnable[s];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!useVertexShader) {
|
if (!useVertexShader) {
|
||||||
// TODO device->SetColorMaterial(this->m_GLStates.color0.enable);
|
// TODO device->SetColorMaterial(this->m_GLStates.color0.enable);
|
||||||
|
Loading…
Reference in New Issue
Block a user