mirror of
https://github.com/blawar/GLideN64.git
synced 2024-07-04 10:03:36 +00:00
[Debugger] Fix textures display.
This commit is contained in:
parent
3f9911ab9d
commit
b505d29838
|
@ -463,6 +463,7 @@ void Debugger::_drawTriangleFrame()
|
|||
void Debugger::_drawTextureCache()
|
||||
{
|
||||
DisplayWindow & wnd = dwnd();
|
||||
TextureCache & cache = textureCache();
|
||||
|
||||
const s32 hOffset = (wnd.getScreenWidth() - wnd.getWidth()) / 2;
|
||||
const s32 vOffset = (wnd.getScreenHeight() - wnd.getHeight()) / 2 + wnd.getHeightOffset();
|
||||
|
@ -570,12 +571,12 @@ void Debugger::_drawTextureCache()
|
|||
|
||||
rect[0].s0 = 0;
|
||||
rect[0].t0 = 0;
|
||||
rect[1].s0 = 1;
|
||||
rect[1].s0 = (*infoIter)->texture->width;
|
||||
rect[1].t0 = 0;
|
||||
rect[2].s0 = 0;
|
||||
rect[2].t0 = 1;
|
||||
rect[3].s0 = 1;
|
||||
rect[3].t0 = 1;
|
||||
rect[2].t0 = (*infoIter)->texture->height;
|
||||
rect[3].s0 = rect[1].s0;
|
||||
rect[3].t0 = rect[2].t0;
|
||||
|
||||
if (r == m_selectedTexPos[m_tmu].row && c == m_selectedTexPos[m_tmu].col) {
|
||||
memcpy(rectSelected, rect, sizeof(rect));
|
||||
|
@ -587,13 +588,17 @@ void Debugger::_drawTextureCache()
|
|||
texParams.textureUnitIndex = textureIndices::Tex[0];
|
||||
texParams.minFilter = textureParameters::FILTER_NEAREST;
|
||||
texParams.magFilter = textureParameters::FILTER_NEAREST;
|
||||
texParams.wrapS = textureParameters::WRAP_CLAMP_TO_EDGE;
|
||||
texParams.wrapT = textureParameters::WRAP_CLAMP_TO_EDGE;
|
||||
gfxContext.setTextureParameters(texParams);
|
||||
|
||||
cache.current[0] = const_cast<CachedTexture*>((*infoIter)->texture);
|
||||
Context::DrawRectParameters rectParams;
|
||||
rectParams.mode = drawmode::TRIANGLE_STRIP;
|
||||
rectParams.verticesCount = 4;
|
||||
rectParams.vertices = rect;
|
||||
rectParams.combiner = currentCombiner();
|
||||
currentCombiner()->update(false);
|
||||
gfxContext.drawRects(rectParams);
|
||||
|
||||
X += rectWidth;
|
||||
|
@ -1028,7 +1033,8 @@ void Debugger::_drawTexture(f32 _ulx, f32 _uly, f32 _lrx, f32 _lry, f32 _yShift)
|
|||
OUTPUT0("TEXTURE (page 0)");
|
||||
if (m_pCurTexInfo == nullptr)
|
||||
return;
|
||||
const CachedTexture * texture = m_pCurTexInfo->texture;
|
||||
const CachedTexture * pTexture = m_pCurTexInfo->texture;
|
||||
textureCache().current[0] = const_cast<CachedTexture *>(pTexture);
|
||||
const gDPLoadTileInfo & texLoadInfo = m_pCurTexInfo->texLoadInfo;
|
||||
|
||||
COL_TEXT();
|
||||
|
@ -1036,17 +1042,17 @@ void Debugger::_drawTexture(f32 _ulx, f32 _uly, f32 _lrx, f32 _lry, f32 _yShift)
|
|||
OUTPUT1("scale_s: %f", m_pCurTexInfo->scales);
|
||||
OUTPUT1("scale_t: %f", m_pCurTexInfo->scalet);
|
||||
OUTPUT1("load: %s", LoadType[texLoadInfo.loadType&1]);
|
||||
OUTPUT1("t_mem: %04x", texture->tMem);
|
||||
OUTPUT1("t_mem: %04x", pTexture->tMem);
|
||||
OUTPUT1("framebuffer: %s", FrameBufferType[(u32)pTexture->frameBufferTexture]);
|
||||
OUTPUT1("crc: %llx", pTexture->crc);
|
||||
// OUTPUT1("texrecting: %d", cache[_debugger.tex_sel].texrecting);
|
||||
OUTPUT1("tex_size: %s", ImageSizeText[texture->size]);
|
||||
OUTPUT1("tex_format: %s", ImageFormatText[texture->format]);
|
||||
OUTPUT1("width: %d", texture->width);
|
||||
OUTPUT1("height: %d", texture->height);
|
||||
OUTPUT1("palette: %d", texture->palette);
|
||||
OUTPUT1("line: %d", texture->line);
|
||||
OUTPUT1("lod: %d", texture->max_level);
|
||||
OUTPUT1("framebuffer: %s", FrameBufferType[(u32)texture->frameBufferTexture]);
|
||||
OUTPUT1("crc: %llx", texture->crc);
|
||||
OUTPUT1("tex_size: %s", ImageSizeText[pTexture->size]);
|
||||
OUTPUT1("tex_format: %s", ImageFormatText[pTexture->format]);
|
||||
OUTPUT1("width: %d", pTexture->width);
|
||||
OUTPUT1("height: %d", pTexture->height);
|
||||
OUTPUT1("palette: %d", pTexture->palette);
|
||||
OUTPUT1("line: %d", pTexture->line);
|
||||
OUTPUT1("lod: %d", pTexture->max_level);
|
||||
|
||||
const f32 Z = 0.0f;
|
||||
const f32 W = 1.0f;
|
||||
|
@ -1073,14 +1079,14 @@ void Debugger::_drawTexture(f32 _ulx, f32 _uly, f32 _lrx, f32 _lry, f32 _yShift)
|
|||
height = fabsf(_lry - uly);
|
||||
}
|
||||
|
||||
if (texture->width <= texture->height) {
|
||||
f32 tex_aspect = f32(texture->width) / f32(texture->height);
|
||||
if (pTexture->width <= pTexture->height) {
|
||||
f32 tex_aspect = f32(pTexture->width) / f32(pTexture->height);
|
||||
f32 scale = tex_aspect / winAspect;
|
||||
f32 diff = 0.5f * width * (1.0f - scale);
|
||||
ulx += diff;
|
||||
_lrx -= diff;
|
||||
} else {
|
||||
f32 tex_aspect = f32(texture->height) / f32(texture->width);
|
||||
f32 tex_aspect = f32(pTexture->height) / f32(pTexture->width);
|
||||
f32 scale = tex_aspect / winAspect;
|
||||
f32 diff = 0.5f * height * (1.0f - scale);
|
||||
uly -= diff;
|
||||
|
@ -1105,16 +1111,16 @@ void Debugger::_drawTexture(f32 _ulx, f32 _uly, f32 _lrx, f32 _lry, f32 _yShift)
|
|||
rect[3].z = Z;
|
||||
rect[3].w = W;
|
||||
|
||||
f32 s0 = 0, t0 = 0, s1 = 1, t1 = 1;
|
||||
f32 s0 = 0, t0 = 0, s1 = f32(pTexture->width), t1 = f32(pTexture->height);
|
||||
|
||||
rect[0].s0 = s0;
|
||||
rect[0].t0 = t0;
|
||||
rect[0].t0 = t1;
|
||||
rect[1].s0 = s1;
|
||||
rect[1].t0 = t0;
|
||||
rect[1].t0 = t1;
|
||||
rect[2].s0 = s0;
|
||||
rect[2].t0 = t1;
|
||||
rect[2].t0 = t0;
|
||||
rect[3].s0 = s1;
|
||||
rect[3].t0 = t1;
|
||||
rect[3].t0 = t0;
|
||||
|
||||
_setTextureCombiner();
|
||||
Context::TexParameters texParams;
|
||||
|
@ -1123,6 +1129,9 @@ void Debugger::_drawTexture(f32 _ulx, f32 _uly, f32 _lrx, f32 _lry, f32 _yShift)
|
|||
texParams.textureUnitIndex = textureIndices::Tex[0];
|
||||
texParams.minFilter = textureParameters::FILTER_NEAREST;
|
||||
texParams.magFilter = textureParameters::FILTER_NEAREST;
|
||||
texParams.wrapS = textureParameters::WRAP_CLAMP_TO_EDGE;
|
||||
texParams.wrapT = textureParameters::WRAP_CLAMP_TO_EDGE;
|
||||
|
||||
gfxContext.setTextureParameters(texParams);
|
||||
|
||||
Context::DrawRectParameters rectParams;
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include <NoiseTexture.h>
|
||||
#include <FrameBuffer.h>
|
||||
#include <DisplayWindow.h>
|
||||
#include <Debugger.h>
|
||||
#include <GBI.h>
|
||||
#include <RSP.h>
|
||||
#include <gSP.h>
|
||||
|
@ -974,7 +975,7 @@ public:
|
|||
continue;
|
||||
|
||||
/* Not sure if special treatment of framebuffer textures is correct */
|
||||
if (pTexture->frameBufferTexture != CachedTexture::fbNone)
|
||||
if (pTexture->frameBufferTexture != CachedTexture::fbNone || g_debugger.isDebugMode())
|
||||
{
|
||||
aTexWrap[t][0] = 1.0;
|
||||
aTexWrap[t][1] = 1.0;
|
||||
|
|
Loading…
Reference in New Issue
Block a user