Skip to content

Commit

Permalink
video-gliden64: Update to commit 16f5bfa.
Browse files Browse the repository at this point in the history
gonetz/GLideN64@16f5bfa

* 16f5bfa Use correct screen scale when native resolution used.
* f6be5fd Fix bug with line calculation in gDPLoadBlock.
* 2a56af9 Always update texture for texrect.
* f59518f Correct texrectVertexFullAlpha hack description
* 54e0c53 Set texrect vertex alpha to 1 for Pokemon Stadium 2. Texrect vertex alpha was set to 1 for all games in d506d61 commit as fix for issue #721. It causes regression in Duke Nukem 64, issue #906, so I made separate hack and enable it for PS2.
* 0ec6d9d Correct alpha compare.
* 2840c89 Add optimization hacks for depth buffer read in PD and CBFD: - read depth buffer only when texturedRectDepthBufferCopy called for current frame - for Conker, read depth buffer only in texturedRectDepthBufferCopy. - for PD the buffer need to be read twice, otherwise coronas may poke through objects.
* 444aa83 Fix depth buffer copy for Perfect Dark.
* ede0a04 Fix DepthBufferToRDRAM::_prepareCopy for Native Resolution mode.
  • Loading branch information
fzurita committed Mar 18, 2016
1 parent 2add88d commit 0f70d25
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 10 deletions.
1 change: 1 addition & 0 deletions jni/mupen64plus-video-gliden64/src/Config.h
Expand Up @@ -152,6 +152,7 @@ struct Config
#define hack_rectDepthBufferCopyCBFD (1<<10) //Copy depth buffer only when game need it. Optimized for CBFD #define hack_rectDepthBufferCopyCBFD (1<<10) //Copy depth buffer only when game need it. Optimized for CBFD
#define hack_skipVIChangeCheck (1<<11) //Don't reset FBO when VI parameters changed. Zelda MM #define hack_skipVIChangeCheck (1<<11) //Don't reset FBO when VI parameters changed. Zelda MM
#define hack_ZeldaCamera (1<<12) //Special hack to detect and process Zelda MM camera. #define hack_ZeldaCamera (1<<12) //Special hack to detect and process Zelda MM camera.
#define hack_texrectVertexFullAlpha (1<<13) //Set texrect vertex alpha to 1


extern Config config; extern Config config;


Expand Down
Expand Up @@ -408,7 +408,10 @@ void ShaderCombiner::updateDitherMode(bool _bForce)


const int nDither = (gDP.otherMode.cycleType < G_CYC_COPY) && (gDP.otherMode.alphaCompare == G_AC_DITHER) ? 1 : 0; const int nDither = (gDP.otherMode.cycleType < G_CYC_COPY) && (gDP.otherMode.alphaCompare == G_AC_DITHER) ? 1 : 0;
if ((m_nInputs & (1 << NOISE)) + nDither != 0) { if ((m_nInputs & (1 << NOISE)) + nDither != 0) {
m_uniforms.uScreenScale.set(video().getScaleX(), video().getScaleY(), _bForce); if (config.frameBufferEmulation.nativeResFactor == 0)
m_uniforms.uScreenScale.set(video().getScaleX(), video().getScaleY(), _bForce);
else
m_uniforms.uScreenScale.set(float(config.frameBufferEmulation.nativeResFactor), float(config.frameBufferEmulation.nativeResFactor), _bForce);
noiseTex.update(); noiseTex.update();
} }
} }
Expand Down
Expand Up @@ -664,7 +664,10 @@ void ShaderCombiner::updateDitherMode(bool _bForce)


const int nDither = (gDP.otherMode.cycleType < G_CYC_COPY) && (gDP.otherMode.colorDither == G_CD_NOISE || gDP.otherMode.alphaDither == G_AD_NOISE || gDP.otherMode.alphaCompare == G_AC_DITHER) ? 1 : 0; const int nDither = (gDP.otherMode.cycleType < G_CYC_COPY) && (gDP.otherMode.colorDither == G_CD_NOISE || gDP.otherMode.alphaDither == G_AD_NOISE || gDP.otherMode.alphaCompare == G_AC_DITHER) ? 1 : 0;
if ((m_nInputs & (1 << NOISE)) + nDither != 0) { if ((m_nInputs & (1 << NOISE)) + nDither != 0) {
m_uniforms.uScreenScale.set(video().getScaleX(), video().getScaleY(), _bForce); if (config.frameBufferEmulation.nativeResFactor == 0)
m_uniforms.uScreenScale.set(video().getScaleX(), video().getScaleY(), _bForce);
else
m_uniforms.uScreenScale.set(float(config.frameBufferEmulation.nativeResFactor), float(config.frameBufferEmulation.nativeResFactor), _bForce);
noiseTex.update(); noiseTex.update();
} }
} }
Expand Down
14 changes: 11 additions & 3 deletions jni/mupen64plus-video-gliden64/src/OpenGL.cpp
Expand Up @@ -650,7 +650,10 @@ void OGLRender::_updateStates(RENDER_STATE _renderState) const
if (gSP.changed & CHANGED_LIGHT) if (gSP.changed & CHANGED_LIGHT)
cmbInfo.updateLightParameters(); cmbInfo.updateLightParameters();


if ((gSP.changed & CHANGED_TEXTURE) || (gDP.changed & CHANGED_TILE) || (gDP.changed & CHANGED_TMEM) || cmbInfo.isChanged()) { if ((gSP.changed & CHANGED_TEXTURE) ||
(gDP.changed & (CHANGED_TILE|CHANGED_TMEM)) ||
cmbInfo.isChanged() ||
_renderState == rsTexRect) {
//For some reason updating the texture cache on the first frame of LOZ:OOT causes a NULL Pointer exception... //For some reason updating the texture cache on the first frame of LOZ:OOT causes a NULL Pointer exception...
ShaderCombiner * pCurrentCombiner = cmbInfo.getCurrent(); ShaderCombiner * pCurrentCombiner = cmbInfo.getCurrent();
if (pCurrentCombiner != NULL) { if (pCurrentCombiner != NULL) {
Expand Down Expand Up @@ -843,7 +846,10 @@ void OGLRender::drawLine(int _v0, int _v1, float _width)
unsigned short elem[2]; unsigned short elem[2];
elem[0] = _v0; elem[0] = _v0;
elem[1] = _v1; elem[1] = _v1;
glLineWidth(_width * video().getScaleX()); if (config.frameBufferEmulation.nativeResFactor == 0)
glLineWidth(_width * video().getScaleX());
else
glLineWidth(_width * config.frameBufferEmulation.nativeResFactor);
glDrawElements(GL_LINES, 2, GL_UNSIGNED_SHORT, elem); glDrawElements(GL_LINES, 2, GL_UNSIGNED_SHORT, elem);


} }
Expand Down Expand Up @@ -1060,7 +1066,7 @@ void OGLRender::drawTexturedRect(const TexturedRectParams & _params)
#ifdef RENDERSTATE_TEST #ifdef RENDERSTATE_TEST
StateChanges++; StateChanges++;
#endif #endif
glVertexAttrib4f(SC_COLOR, 0, 0, 0, 1); glVertexAttrib4f(SC_COLOR, 0, 0, 0, m_texrectVertexAlpha);
glVertexAttribPointer(SC_POSITION, 4, GL_FLOAT, GL_FALSE, sizeof(GLVertex), &m_rect[0].x); glVertexAttribPointer(SC_POSITION, 4, GL_FLOAT, GL_FALSE, sizeof(GLVertex), &m_rect[0].x);
glVertexAttribPointer(SC_TEXCOORD0, 2, GL_FLOAT, GL_FALSE, sizeof(GLVertex), &m_rect[0].s0); glVertexAttribPointer(SC_TEXCOORD0, 2, GL_FLOAT, GL_FALSE, sizeof(GLVertex), &m_rect[0].s0);
glVertexAttribPointer(SC_TEXCOORD1, 2, GL_FLOAT, GL_FALSE, sizeof(GLVertex), &m_rect[0].s1); glVertexAttribPointer(SC_TEXCOORD1, 2, GL_FLOAT, GL_FALSE, sizeof(GLVertex), &m_rect[0].s1);
Expand Down Expand Up @@ -1420,6 +1426,8 @@ void OGLRender::_initData()
for (u32 i = 0; i < VERTBUFF_SIZE; ++i) for (u32 i = 0; i < VERTBUFF_SIZE; ++i)
triangles.vertices[i].w = 1.0f; triangles.vertices[i].w = 1.0f;
triangles.num = 0; triangles.num = 0;
if ((config.generalEmulation.hacks & hack_texrectVertexFullAlpha) != 0)
m_texrectVertexAlpha = 1.0f;
} }


void OGLRender::_destroyData() void OGLRender::_destroyData()
Expand Down
3 changes: 2 additions & 1 deletion jni/mupen64plus-video-gliden64/src/OpenGL.h
Expand Up @@ -130,7 +130,7 @@ class OGLRender
void dropRenderState() {m_renderState = rsNone;} void dropRenderState() {m_renderState = rsNone;}


private: private:
OGLRender() : m_oglRenderer(glrOther), m_bImageTexture(false), m_bFlatColors(false) {} OGLRender() : m_oglRenderer(glrOther), m_bImageTexture(false), m_bFlatColors(false), m_texrectVertexAlpha(0) {}
OGLRender(const OGLRender &); OGLRender(const OGLRender &);
friend class OGLVideo; friend class OGLVideo;


Expand Down Expand Up @@ -173,6 +173,7 @@ class OGLRender
GLVertex m_rect[4]; GLVertex m_rect[4];
bool m_bImageTexture; bool m_bImageTexture;
bool m_bFlatColors; bool m_bFlatColors;
float m_texrectVertexAlpha;
}; };


class OGLVideo class OGLVideo
Expand Down
2 changes: 2 additions & 0 deletions jni/mupen64plus-video-gliden64/src/RSP.cpp
Expand Up @@ -341,6 +341,8 @@ void RSP_Init()
else if (strstr(RSP.romname, (const char *)"Perfect Dark") != NULL || else if (strstr(RSP.romname, (const char *)"Perfect Dark") != NULL ||
strstr(RSP.romname, (const char *)"PERFECT DARK") != NULL) strstr(RSP.romname, (const char *)"PERFECT DARK") != NULL)
config.generalEmulation.hacks |= hack_rectDepthBufferCopyPD; config.generalEmulation.hacks |= hack_rectDepthBufferCopyPD;
else if (strstr(RSP.romname, (const char *)"POKEMON STADIUM 2") != NULL)
config.generalEmulation.hacks |= hack_texrectVertexFullAlpha;


api().FindPluginPath(RSP.pluginpath); api().FindPluginPath(RSP.pluginpath);


Expand Down
2 changes: 1 addition & 1 deletion jni/mupen64plus-video-gliden64/src/Revision.h
@@ -1 +1 @@
#define PLUGIN_REVISION "0ec6d9d" #define PLUGIN_REVISION "16f5bfa"
7 changes: 4 additions & 3 deletions jni/mupen64plus-video-gliden64/src/gDP.cpp
Expand Up @@ -625,9 +625,10 @@ void gDPLoadBlock(u32 tile, u32 uls, u32 ult, u32 lrs, u32 dxt)
u32 tmemAddr = gDP.loadTile->tmem; u32 tmemAddr = gDP.loadTile->tmem;


if (dxt > 0) { if (dxt > 0) {
u32 line = (2047 + dxt) / dxt; const u32 widthInQWords = (bytes >> 3);
u32 bpl = line << 3; const u32 height = (widthInQWords * dxt) / 2048;
u32 height = bytes / bpl; const u32 line = widthInQWords / height;
const u32 bpl = line << 3;


for (u32 y = 0; y < height; ++y) { for (u32 y = 0; y < height; ++y) {
UnswapCopyWrap(RDRAM, address, (u8*)TMEM, tmemAddr << 3, 0xFFF, bpl); UnswapCopyWrap(RDRAM, address, (u8*)TMEM, tmemAddr << 3, 0xFFF, bpl);
Expand Down

0 comments on commit 0f70d25

Please sign in to comment.