Disable vertex arrays before depal as well.

This commit is contained in:
Unknown W. Brackets 2014-05-31 18:55:00 -07:00
parent e109a547ae
commit 580143e5e2
5 changed files with 19 additions and 13 deletions

View file

@ -411,6 +411,7 @@ GLES_GPU::GLES_GPU()
framebufferManager_.SetShaderManager(shaderManager_);
textureCache_.SetFramebufferManager(&framebufferManager_);
textureCache_.SetDepalShaderCache(&depalShaderCache_);
textureCache_.SetShaderManager(shaderManager_);
// Sanity check gstate
if ((int *)&gstate.transferstart - (int *)&gstate != 0xEA) {

View file

@ -684,11 +684,10 @@ Shader *ShaderManager::ApplyVertexShader(int prim, u32 vertType) {
LinkedShader *ShaderManager::ApplyFragmentShader(Shader *vs, int prim, u32 vertType) {
FragmentShaderID FSID;
ComputeFragmentShaderID(&FSID);
if (lastVShaderSame_ && FSID == lastFSID_ && !gstate_c.shaderChanged) {
if (lastVShaderSame_ && FSID == lastFSID_) {
lastShader_->UpdateUniforms(vertType);
return lastShader_;
}
gstate_c.shaderChanged = false;
lastFSID_ = FSID;

View file

@ -28,6 +28,7 @@
#include "GPU/GLES/Framebuffer.h"
#include "GPU/GLES/FragmentShaderGenerator.h"
#include "GPU/GLES/DepalettizeShader.h"
#include "GPU/GLES/ShaderManager.h"
#include "GPU/Common/TextureDecoder.h"
#include "Core/Config.h"
#include "Core/Host.h"
@ -916,13 +917,17 @@ void TextureCache::SetTextureFramebuffer(TexCacheEntry *entry) {
};
static const GLubyte indices[4] = { 0, 1, 3, 2 };
shaderManager_->DirtyLastShader();
glUseProgram(program);
gstate_c.shaderChanged = true;
GLint a_position = glGetAttribLocation(program, "a_position");
GLint a_texcoord0 = glGetAttribLocation(program, "a_texcoord0");
glBindBuffer(GL_ARRAY_BUFFER, 0);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
glEnableVertexAttribArray(0);
glEnableVertexAttribArray(1);
glEnableVertexAttribArray(a_position);
glEnableVertexAttribArray(a_texcoord0);
glActiveTexture(GL_TEXTURE1);
glBindTexture(GL_TEXTURE_2D, clutTexture);
@ -944,14 +949,12 @@ void TextureCache::SetTextureFramebuffer(TexCacheEntry *entry) {
#endif
glViewport(0, 0, entry->framebuffer->renderWidth, entry->framebuffer->renderHeight);
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 12, pos);
glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 8, uv);
glVertexAttribPointer(a_position, 3, GL_FLOAT, GL_FALSE, 12, pos);
glVertexAttribPointer(a_texcoord0, 2, GL_FLOAT, GL_FALSE, 8, uv);
glDrawElements(GL_TRIANGLE_STRIP, 4, GL_UNSIGNED_BYTE, indices);
glDisableVertexAttribArray(a_position);
glDisableVertexAttribArray(a_texcoord0);
/*
glDisableVertexAttribArray(0);
glDisableVertexAttribArray(1);
*/
fbo_bind_color_as_texture(entry->depalFBO, 0);
glstate.Restore();
framebufferManager_->RebindFramebuffer();

View file

@ -28,6 +28,7 @@
struct VirtualFramebuffer;
class FramebufferManager;
class DepalShaderCache;
class ShaderManager;
enum TextureFiltering {
AUTO = 1,
@ -74,6 +75,9 @@ public:
void SetDepalShaderCache(DepalShaderCache *dpCache) {
depalShaderCache_ = dpCache;
}
void SetShaderManager(ShaderManager *sm) {
shaderManager_ = sm;
}
size_t NumLoadedTextures() const {
return cache.size();
@ -203,6 +207,7 @@ private:
int decimationCounter_;
FramebufferManager *framebufferManager_;
DepalShaderCache *depalShaderCache_;
ShaderManager *shaderManager_;
};
GLenum getClutDestFormat(GEPaletteFormat format);

View file

@ -453,8 +453,6 @@ struct GPUStateCache
bool textureSimpleAlpha;
bool vertexFullAlpha;
bool framebufChanged;
// Doesn't need savestating.
bool shaderChanged;
int skipDrawReason;