Permalink
Browse files

video-gliden64: Update to commit 16f5bfa.

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 d506d6134d 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...
1 parent 2add88d commit 0f70d25b8379b5caf1f9a94fa3cc1af71c982ba8 @fzurita fzurita committed Mar 18, 2016
@@ -152,6 +152,7 @@ struct Config
#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_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;
@@ -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;
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();
}
}
@@ -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;
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();
}
}
@@ -650,7 +650,10 @@ void OGLRender::_updateStates(RENDER_STATE _renderState) const
if (gSP.changed & CHANGED_LIGHT)
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...
ShaderCombiner * pCurrentCombiner = cmbInfo.getCurrent();
if (pCurrentCombiner != NULL) {
@@ -843,7 +846,10 @@ void OGLRender::drawLine(int _v0, int _v1, float _width)
unsigned short elem[2];
elem[0] = _v0;
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);
}
@@ -1060,7 +1066,7 @@ void OGLRender::drawTexturedRect(const TexturedRectParams & _params)
#ifdef RENDERSTATE_TEST
StateChanges++;
#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_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);
@@ -1420,6 +1426,8 @@ void OGLRender::_initData()
for (u32 i = 0; i < VERTBUFF_SIZE; ++i)
triangles.vertices[i].w = 1.0f;
triangles.num = 0;
+ if ((config.generalEmulation.hacks & hack_texrectVertexFullAlpha) != 0)
+ m_texrectVertexAlpha = 1.0f;
}
void OGLRender::_destroyData()
@@ -130,7 +130,7 @@ class OGLRender
void dropRenderState() {m_renderState = rsNone;}
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 &);
friend class OGLVideo;
@@ -173,6 +173,7 @@ class OGLRender
GLVertex m_rect[4];
bool m_bImageTexture;
bool m_bFlatColors;
+ float m_texrectVertexAlpha;
};
class OGLVideo
@@ -341,6 +341,8 @@ void RSP_Init()
else if (strstr(RSP.romname, (const char *)"Perfect Dark") != NULL ||
strstr(RSP.romname, (const char *)"PERFECT DARK") != NULL)
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);
@@ -1 +1 @@
-#define PLUGIN_REVISION "0ec6d9d"
+#define PLUGIN_REVISION "16f5bfa"
@@ -625,9 +625,10 @@ void gDPLoadBlock(u32 tile, u32 uls, u32 ult, u32 lrs, u32 dxt)
u32 tmemAddr = gDP.loadTile->tmem;
if (dxt > 0) {
- u32 line = (2047 + dxt) / dxt;
- u32 bpl = line << 3;
- u32 height = bytes / bpl;
+ const u32 widthInQWords = (bytes >> 3);
+ const u32 height = (widthInQWords * dxt) / 2048;
+ const u32 line = widthInQWords / height;
+ const u32 bpl = line << 3;
for (u32 y = 0; y < height; ++y) {
UnswapCopyWrap(RDRAM, address, (u8*)TMEM, tmemAddr << 3, 0xFFF, bpl);

0 comments on commit 0f70d25

Please sign in to comment.