feat(gx): handle changes to texture wrap settings

This commit is contained in:
fallenoak 2023-03-04 12:20:15 -06:00
parent 2282b8a54a
commit 45c1978a85
No known key found for this signature in database
GPG Key ID: 7628F8E61AEA070D
3 changed files with 16 additions and 5 deletions

View File

@ -930,7 +930,17 @@ void CGxDevice::TexMarkForUpdate(CGxTex* texId, const CiRect& updateRect, int32_
}
void CGxDevice::TexSetWrap(CGxTex* texId, EGxTexWrapMode wrapU, EGxTexWrapMode wrapV) {
// TODO
if (texId->m_flags.m_wrapU == wrapU && texId->m_flags.m_wrapV == wrapV) {
return;
}
texId->m_flags.m_wrapU = wrapU;
texId->m_flags.m_wrapV = wrapV;
texId->m_needsFlagUpdate = 1;
for (int32_t rs = GxRs_Texture0; rs <= GxRs_Texture15; rs++) {
this->IRsForceUpdate(static_cast<EGxRenderState>(rs));
}
}
void CGxDevice::ValidateDraw(CGxBatch* batch, int32_t count) {

View File

@ -283,8 +283,8 @@ enum EGxTexTarget {
};
enum EGxTexWrapMode {
GxTex_WrapMode0 = 0,
GxTex_WrapMode1 = 1
GxTex_Clamp = 0,
GxTex_Wrap = 1
};
enum EGxXform {

View File

@ -516,8 +516,9 @@ void CM2SceneRender::SetupTextures() {
if (texture) {
uint16_t textureFlags = this->m_data->textures[textureIndex].flags;
EGxTexWrapMode wrapU = static_cast<EGxTexWrapMode>(textureFlags & 0x1);
EGxTexWrapMode wrapV = static_cast<EGxTexWrapMode>(textureFlags & 0x2);
EGxTexWrapMode wrapU = textureFlags & 0x1 ? GxTex_Wrap : GxTex_Clamp;
EGxTexWrapMode wrapV = textureFlags & 0x2 ? GxTex_Wrap : GxTex_Clamp;
GxTexSetWrap(texture, wrapU, wrapV);
}