mirror of
https://github.com/blawar/GLideN64.git
synced 2024-07-02 09:03:37 +00:00
GraphicsDrawer::drawTexturedRect fixes:
* remove old hack for clamp/wrap tex coords. It seems that the hack is not necessary anymore. necessary anymore. * minor optimization for accurate texture path.
This commit is contained in:
parent
4e0a4f700c
commit
21fe9d5f92
|
@ -90,7 +90,6 @@ public:
|
||||||
m_part =
|
m_part =
|
||||||
"IN highp vec4 aRectPosition; \n"
|
"IN highp vec4 aRectPosition; \n"
|
||||||
"IN highp vec2 aTexCoord0; \n"
|
"IN highp vec2 aTexCoord0; \n"
|
||||||
"IN highp vec2 aTexCoord1; \n"
|
|
||||||
"IN highp vec2 aBaryCoords; \n"
|
"IN highp vec2 aBaryCoords; \n"
|
||||||
" \n"
|
" \n"
|
||||||
"OUT highp vec2 vTexCoord; \n"
|
"OUT highp vec2 vTexCoord; \n"
|
||||||
|
|
|
@ -1275,10 +1275,16 @@ void GraphicsDrawer::drawTexturedRect(const TexturedRectParams & _params)
|
||||||
offsetY = (_params.lry - _params.uly) * _params.dtdy;
|
offsetY = (_params.lry - _params.uly) * _params.dtdy;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (u32 t = 0; t < 2; ++t) {
|
if (config.generalEmulation.enableInaccurateTextureCoordinates == 0u) {
|
||||||
if (pCurrentCombiner->usesTile(t) && cache.current[t] && gSP.textureTile[t]) {
|
// Accurate texture path
|
||||||
|
texST[0].s0 = _FIXED2FLOAT(_params.s, 5);
|
||||||
if (config.generalEmulation.enableInaccurateTextureCoordinates) {
|
texST[0].s1 = texST[0].s0 + offsetX;
|
||||||
|
texST[0].t0 = _FIXED2FLOAT(_params.t, 5);
|
||||||
|
texST[0].t1 = texST[0].t0 + offsetY;
|
||||||
|
} else {
|
||||||
|
// Fast texture path
|
||||||
|
for (u32 t = 0; t < 2; ++t) {
|
||||||
|
if (pCurrentCombiner->usesTile(t) && cache.current[t] && gSP.textureTile[t]) {
|
||||||
f32 shiftScaleS = 1.0f;
|
f32 shiftScaleS = 1.0f;
|
||||||
f32 shiftScaleT = 1.0f;
|
f32 shiftScaleT = 1.0f;
|
||||||
|
|
||||||
|
@ -1303,43 +1309,7 @@ void GraphicsDrawer::drawTexturedRect(const TexturedRectParams & _params)
|
||||||
texST[t].s1 = cache.current[t]->offsetS + texST[t].s1;
|
texST[t].s1 = cache.current[t]->offsetS + texST[t].s1;
|
||||||
texST[t].t1 = cache.current[t]->offsetT + texST[t].t1;
|
texST[t].t1 = cache.current[t]->offsetT + texST[t].t1;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
const f32 uls = _FIXED2FLOAT(_params.s, 5);
|
|
||||||
const f32 lrs = uls + offsetX;
|
|
||||||
const f32 ult = _FIXED2FLOAT(_params.t, 5);
|
|
||||||
const f32 lrt = ult + offsetY;
|
|
||||||
|
|
||||||
texST[t].s0 = uls;
|
|
||||||
texST[t].s1 = lrs;
|
|
||||||
texST[t].t0 = ult;
|
|
||||||
texST[t].t1 = lrt;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cache.current[t]->frameBufferTexture != CachedTexture::fbMultiSample) {
|
|
||||||
Context::TexParameters texParams;
|
|
||||||
|
|
||||||
if ((cache.current[t]->mirrorS == 0 && cache.current[t]->maskS == 0 &&
|
|
||||||
(texST[t].s0 < texST[t].s1 ?
|
|
||||||
texST[t].s0 >= 0.0f && texST[t].s1 <= static_cast<f32>(cache.current[t]->width) :
|
|
||||||
texST[t].s1 >= 0.0f && texST[t].s0 <= static_cast<f32>(cache.current[t]->width)))
|
|
||||||
|| (cache.current[t]->maskS == 0 && (texST[t].s0 < -1024.0f || texST[t].s1 > 1023.99f)))
|
|
||||||
texParams.wrapS = textureParameters::WRAP_CLAMP_TO_EDGE;
|
|
||||||
|
|
||||||
if (cache.current[t]->mirrorT == 0 &&
|
|
||||||
(texST[t].t0 < texST[t].t1 ?
|
|
||||||
texST[t].t0 >= 0.0f && texST[t].t1 <= static_cast<f32>(cache.current[t]->height) :
|
|
||||||
texST[t].t1 >= 0.0f && texST[t].t0 <= static_cast<f32>(cache.current[t]->height)))
|
|
||||||
texParams.wrapT = textureParameters::WRAP_CLAMP_TO_EDGE;
|
|
||||||
|
|
||||||
if (texParams.wrapS.isValid() || texParams.wrapT.isValid()) {
|
|
||||||
texParams.handle = cache.current[t]->name;
|
|
||||||
texParams.target = textureTarget::TEXTURE_2D;
|
|
||||||
texParams.textureUnitIndex = textureIndices::Tex[t];
|
|
||||||
gfxContext.setTextureParameters(texParams);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (config.generalEmulation.enableInaccurateTextureCoordinates) {
|
|
||||||
texST[t].s0 *= cache.current[t]->scaleS;
|
texST[t].s0 *= cache.current[t]->scaleS;
|
||||||
texST[t].t0 *= cache.current[t]->scaleT;
|
texST[t].t0 *= cache.current[t]->scaleT;
|
||||||
texST[t].s1 *= cache.current[t]->scaleS;
|
texST[t].s1 *= cache.current[t]->scaleS;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user