Permalink
Browse files

video-gliden64: Update to commit fbbbe14.

gonetz/GLideN64@fbbbe14

* fbbbe14 Correct hack for texrect textures. Fixed texture coordinates for backgrounds in Dark Rift, issue #648
* 67cab52 Fix tile width calculation in LOADTYPE_TILE mode.
* 143a68b Increase only y coordinate of rect in COPY or FILL mode.
* 024c482 Fix frame buffer texture detection when load tile is not 7.
* 29b0b8c Fix mipmaped texture load when gSP.texture.tile is not 0. Example: Tetrisphere.
* 77b5b73 Update texture parameters only if combiner uses textures.
* 7479845 Do not use flat shading when lighting is enabled.
* d50d9cc Update french language
* d9d6d45 FrameBuffer::init - clear buffer texture after allocation.
* 095df6e Code refactor: OGLRender::clearColorBuffer use black (zero) if color is not specified.
* 235530c Fix out of range read/write in _copyPixelsFromRdram when address in input array is outside of current frame buffer.
* 8f95292 Use 32bit texture formats for G_TT_IA16 mode.
* e58ce1e Code cleanup: make struct TextureLoadParameters more readable.
* 53203c0 Fix IA88_RGBA4444 convertor on non-windows platforms.
* 3382487 Updating Spanish translation
* 5e5c3fa Fix flat shading.
* bcdc6bc Correct mipmap shader.
* 3215a8a Correct main bufer height calculation.
* 1c0a1c2 correct CMakeLists.txt
* 9814c72 Add 'custom windowed resolution' option to GUI.
* 676e00f Add "Render at constant factor of native resolution" option to GUI.
* 54d4863 Add "UseNativeResolutionFactor" option.
* 162d24d Remove if (!_canDraw()) from OGLRender::clearColorBuffer
* f06b2d8 Code rafactor to fix compilation errors with mupen64plus build.
* c4b0e99 Fix copy from RDRAM in widescreen mode.
* 2a01d47 Fix copy to RDRAM in widescreen mode.
* 8b3d53f Pass destination frame buffer to OGLRender::drawTexturedRect.
* e8d76d2 Minor code cleanup: add RDRAMtoFrameBuffer::Reset()
* 806f884 Add FBInfo controls to GUI.
* 91f7608 Add FBInfo options to mupen64plus config.
* ac8a9a9 Add FBInfo config options.
* dca4261 Add FBInfo::isSupported() to know that emulator provides FBInfo support. Correct frame buffer write detection hack (idea by purplemarshmallow).
* ce7526e Rewrite RDRAMtoFrameBuffer::CopyFromRDRAM: copy from RDRAM only those pixels, which were provided with FBWrite.
* dcf32d0 Fix issues with FrameBufferToRDRAM::copyToRDRAM
* cd0cd82 Code refactor: convert FrameBuffer* functions to methods of FBInfo class.
* e62ce06 Fix FrameBufferToRDRAM::copyToRDRAM : pass correct end_address to _copy
* 52dac34 Fix _cutHeight.
* 8202638 Correct FrameBufferList::fillBufferInfo - do not add depth buffer.
* 1ec14d0 Rename ShaderCombiner::updateFBInfo to ShaderCombiner::updateFrameBufferInfo
* 32dd944 Ignore FBRead notification if there were FBWrite notifications to that buffer.
* 857ae8a FBWrite draft implementation.
* 646a881 Fixing FBInfo build on gcc (5.2.1)
* 148349a Fix FrameBufferToRDRAM::_prepareCopy
* 0b12d3b Correct height calculation on buffer copy.
* dde54b2 Fix mistakes in buffer copy.
* 53e638b Increase _numPixels if chunkStart is not even.
* 1e376d6 Fix usage of FrameBufferToRDRAM::m_frameCount
* 05d6972 Fix mupen64plus build.
* 955e344 Implement FrameBufferRead
* 6bc16d0 Rewrite RSP_ThreadProc.
* b9ee15b FrameBufferInfo API extension. Initial dummy implementation.
* 5d8ea5d Implement partial buffer copy.
* ab54f78 Update gliden64_fr.ts
* 232800a Fix TMEM address mask for tlut_en case. Thanks angrylion for the hint.
* 1d1f4bd Alpha compare should happen after the 1st cycle of a two-cycle combiner
*   8425a84 Merge pull request #853 from purplemarshmallow/26
|\
| * c1ea88a detect Vivid Dolls ucode
* | 170a072 Remove gamma correction code from gDPFillRectangle. Forgot to remove it when gamma correction was moved to post-processor. Fixed green background in Superman.
|/
* c34e00b Update translation files with current UI texts.
* a8a5935 Add Japanese translation file to GLideNUI config.
* fdaebc8 Add Japanese translation
* cd760d1 corrected "experimental" typo.
*   b3556d5 Merge pull request #833 from baptiste0602/baptiste0602-patch-1
|\
| * 2cbf2b5 Fix ISS64 shadows
* b6b5cde Merge pull request #832 from nicklauslittle/android-fix
* d202788 Fix Android build for x86_64
  • Loading branch information...
fzurita committed Mar 5, 2016
1 parent ad1e39b commit b1117a7a1f22ba7ca916a81f6622dc75e483e68d
@@ -293,6 +293,8 @@ void FrameBuffer::init(u32 _address, u32 _endAddress, u16 _format, u16 _size, u1
} else
#endif // GL_MULTISAMPLING_SUPPORT
_setAndAttachTexture(_size, m_pTexture);
+
+ ogl.getRender().clearColorBuffer(nullptr);
}
void FrameBuffer::reinit(u16 _height)
@@ -321,25 +321,27 @@ void OGLRender::addTriangle(int _v0, int _v1, int _v2)
triangles.elements[triangles.num++] = _v1;
triangles.elements[triangles.num++] = _v2;
- if ((gSP.geometryMode & G_SHADE) == 0) {
- // Prim shading
- for (u32 i = firstIndex; i < triangles.num; ++i) {
- SPVertex & vtx = triangles.vertices[triangles.elements[i]];
- vtx.flat_r = gDP.primColor.r;
- vtx.flat_g = gDP.primColor.g;
- vtx.flat_b = gDP.primColor.b;
- vtx.flat_a = gDP.primColor.a;
- }
- } else if ((gSP.geometryMode & G_SHADING_SMOOTH) == 0) {
- // Flat shading
- SPVertex & vtx0 = triangles.vertices[firstIndex + ((RSP.w1 >> 24) & 3)];
- for (u32 i = firstIndex; i < triangles.num; ++i) {
- SPVertex & vtx = triangles.vertices[triangles.elements[i]];
- vtx.r = vtx.flat_r = vtx0.r;
- vtx.g = vtx.flat_g = vtx0.g;
- vtx.b = vtx.flat_b = vtx0.b;
- vtx.a = vtx.flat_a = vtx0.a;
- vtx.a = vtx0.a;
+ if ((gSP.geometryMode & G_LIGHTING) == 0) {
+ if ((gSP.geometryMode & G_SHADE) == 0) {
+ // Prim shading
+ for (u32 i = firstIndex; i < triangles.num; ++i) {
+ SPVertex & vtx = triangles.vertices[triangles.elements[i]];
+ vtx.flat_r = gDP.primColor.r;
+ vtx.flat_g = gDP.primColor.g;
+ vtx.flat_b = gDP.primColor.b;
+ vtx.flat_a = gDP.primColor.a;
+ }
+ } else if ((gSP.geometryMode & G_SHADING_SMOOTH) == 0) {
+ // Flat shading
+ SPVertex & vtx0 = triangles.vertices[firstIndex + ((RSP.w1 >> 24) & 3)];
+ for (u32 i = firstIndex; i < triangles.num; ++i) {
+ SPVertex & vtx = triangles.vertices[triangles.elements[i]];
+ vtx.r = vtx.flat_r = vtx0.r;
+ vtx.g = vtx.flat_g = vtx0.g;
+ vtx.b = vtx.flat_b = vtx0.b;
+ vtx.a = vtx.flat_a = vtx0.a;
+ vtx.a = vtx0.a;
+ }
}
}
@@ -660,7 +662,7 @@ void OGLRender::_updateStates(RENDER_STATE _renderState) const
}
pCurrentCombiner->updateFrameBufferInfo();
}
- if (_renderState == rsTriangle || _renderState == rsLine)
+ if (pCurrentCombiner->usesTexture() && (_renderState == rsTriangle || _renderState == rsLine))
cmbInfo.updateTextureParameters();
gDP.changed &= ~(CHANGED_TILE | CHANGED_TMEM);
gSP.changed &= ~(CHANGED_TEXTURE);
@@ -721,9 +723,14 @@ void OGLRender::_prepareDrawTriangle(bool _dma)
}
currentCombiner()->updateRenderState();
- const bool updateColorArrays = m_bFlatColors != (!RSP.bLLE && (gSP.geometryMode & G_SHADING_SMOOTH) == 0);
- if (updateColorArrays)
- m_bFlatColors = !m_bFlatColors;
+ bool bFlatColors = false;
+ if (!RSP.bLLE && (gSP.geometryMode & G_LIGHTING) == 0) {
+ bFlatColors = (gSP.geometryMode & G_SHADE) == 0;
+ bFlatColors |= (gSP.geometryMode & G_SHADING_SMOOTH) == 0;
+ }
+
+ const bool updateColorArrays = m_bFlatColors != bFlatColors;
+ m_bFlatColors = bFlatColors;
if (updateArrays) {
SPVertex * pVtx = _dma ? triangles.dmaVertices.data() : &triangles.vertices[0];
@@ -1222,7 +1229,10 @@ void OGLRender::clearColorBuffer(float *_pColor )
{
glDisable(GL_SCISSOR_TEST);
- glClearColor( _pColor[0], _pColor[1], _pColor[2], _pColor[3] );
+ if (_pColor != nullptr)
+ glClearColor( _pColor[0], _pColor[1], _pColor[2], _pColor[3] );
+ else
+ glClearColor( 0.0f, 0.0f, 0.0f, 0.0f );
glClear( GL_COLOR_BUFFER_BIT );
glEnable( GL_SCISSOR_TEST );
@@ -1503,8 +1513,7 @@ void displayLoadProgress(const wchar_t *format, ...)
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
OGLRender & render = video().getRender();
- float black[4] = {0, 0, 0, 0};
- render.clearColorBuffer(black);
+ render.clearColorBuffer(nullptr);
render.drawText(buf, -0.9f, 0);
video().swapBuffers();
@@ -1 +1 @@
-#define PLUGIN_REVISION "235530c"
+#define PLUGIN_REVISION "fbbbe14"
@@ -604,7 +604,7 @@ void _calcTileSizes(u32 _t, TileSizes & _sizes, gDPTile * _pLoadTile)
if (pTile->masks && ((maskWidth * maskHeight) <= maxTexels))
width = maskWidth; // Use mask width if set and valid
else {
- width = min(info.width, info.texWidth);
+ width = info.width;
if (info.size > pTile->size)
width <<= info.size - pTile->size;
}
@@ -666,7 +666,7 @@ void _calcTileSizes(u32 _t, TileSizes & _sizes, gDPTile * _pLoadTile)
else
_sizes.realHeight = _sizes.height;
- if (gSP.texture.level > gSP.texture.tile) {
+ if (gSP.texture.level > 0) {
_sizes.realWidth = pow2(_sizes.realWidth);
_sizes.realHeight = pow2(_sizes.realHeight);
}
@@ -1032,8 +1032,8 @@ void TextureCache::_load(u32 _tile, CachedTexture *_pTexture)
GLint mipLevel = 0, maxLevel = 0;
#ifndef GLES2
- if (config.generalEmulation.enableLOD != 0 && gSP.texture.level > gSP.texture.tile + 1)
- maxLevel = _tile == 0 ? 0 : gSP.texture.level - gSP.texture.tile - 1;
+ if (config.generalEmulation.enableLOD != 0 && gSP.texture.level > 1)
+ maxLevel = _tile == 0 ? 0 : gSP.texture.level - 1;
#endif
_pTexture->max_level = maxLevel;
@@ -1384,7 +1384,7 @@ void TextureCache::update(u32 _t)
return;
}
- if (gDP.otherMode.textureLOD == G_TL_LOD && gSP.texture.level == gSP.texture.tile && _t == 1) {
+ if (gDP.otherMode.textureLOD == G_TL_LOD && gSP.texture.level == 0 && _t == 1) {
current[1] = current[0];
activateTexture(_t, current[_t]);
return;
@@ -1509,7 +1509,7 @@ void getTextureShiftScale(u32 t, const TextureCache & cache, f32 & shiftScaleS,
return;
}
- if (gDP.otherMode.textureLOD == G_TL_LOD && gSP.texture.level == gSP.texture.tile)
+ if (gDP.otherMode.textureLOD == G_TL_LOD && gSP.texture.level == 0)
t = 0;
if (gSP.textureTile[t]->shifts > 10)
@@ -310,7 +310,7 @@ void gDPSetTile( u32 format, u32 size, u32 line, u32 tmem, u32 tile, u32 palette
if (!gDP.tiles[tile].maskt) gDP.tiles[tile].clampt = 1;
if (tile == gSP.texture.tile || tile == gSP.texture.tile + 1) {
- u32 nTile = 7;
+ u32 nTile = gDP.loadTileIdx;
while(gDP.tiles[nTile].tmem != tmem && nTile > gSP.texture.tile + 1)
--nTile;
if (nTile > gSP.texture.tile + 1) {
@@ -469,6 +469,7 @@ void gDPLoadTile32b(u32 uls, u32 ult, u32 lrs, u32 lrt)
void gDPLoadTile(u32 tile, u32 uls, u32 ult, u32 lrs, u32 lrt)
{
gDPSetTileSize( tile, uls, ult, lrs, lrt );
+ gDP.loadTileIdx = tile;
gDP.loadTile = &gDP.tiles[tile];
gDP.loadTile->loadType = LOADTYPE_TILE;
gDP.loadTile->imageAddress = gDP.textureImage.address;
@@ -577,6 +578,7 @@ void gDPLoadBlock32(u32 uls,u32 lrs, u32 dxt)
void gDPLoadBlock(u32 tile, u32 uls, u32 ult, u32 lrs, u32 dxt)
{
gDPSetTileSize( tile, uls, ult, lrs, dxt );
+ gDP.loadTileIdx = tile;
gDP.loadTile = &gDP.tiles[tile];
gDP.loadTile->loadType = LOADTYPE_BLOCK;
@@ -738,10 +740,7 @@ void gDPFillRDRAM(u32 address, s32 ulx, s32 uly, s32 lrx, s32 lry, u32 width, u3
void gDPFillRectangle( s32 ulx, s32 uly, s32 lrx, s32 lry )
{
OGLRender & render = video().getRender();
- if (gDP.otherMode.cycleType == G_CYC_FILL) {
- ++lrx;
- ++lry;
- } else if (lry == uly)
+ if (gDP.otherMode.cycleType == G_CYC_FILL || lry == uly)
++lry;
if (gDP.depthImageAddress == gDP.colorImage.address) {
@@ -824,7 +823,6 @@ void gDPTextureRectangle( f32 ulx, f32 uly, f32 lrx, f32 lry, s32 tile, f32 s, f
{
if (gDP.otherMode.cycleType == G_CYC_COPY) {
dsdx = 1.0f;
- lrx += 1.0f;
lry += 1.0f;
}
lry = max(lry, uly + 1.0f);
@@ -836,7 +834,7 @@ void gDPTextureRectangle( f32 ulx, f32 uly, f32 lrx, f32 lry, s32 tile, f32 s, f
gSP.textureTile[1] = &gDP.tiles[(tile + 1) & 7];
// HACK ALERT!
- if ((int(s) == 512) && (gDP.colorImage.width < 512))
+ if ((int(s) == 512) && (gDP.colorImage.width + gSP.textureTile[0]->uls < 512))
s = 0.0f;
f32 lrs, lrt;
@@ -180,6 +180,7 @@ struct gDPInfo
gDPCombine combine;
gDPTile tiles[8], *loadTile;
+ u32 loadTileIdx;
struct Color
{
Oops, something went wrong.

0 comments on commit b1117a7

Please sign in to comment.