Hopefully fix the Manhunt red/green swap

This commit is contained in:
Henrik Rydgard 2014-05-27 22:22:56 +02:00
parent 29a9ff369e
commit 44d9af9222
4 changed files with 22 additions and 19 deletions

View File

@ -295,11 +295,20 @@ GLuint DepalShaderCache::GetClutTexture(const u32 clutID, u32 *rawClut) {
GLuint dstFmt = getClutDestFormat(palFormat);
int texturePixels = palFormat == GE_CMODE_32BIT_ABGR8888 ? 256 : 512;
bool useBGRA = UseBGRA8888() && dstFmt == GL_UNSIGNED_BYTE;
DepalTexture *tex = new DepalTexture();
glGenTextures(1, &tex->texture);
glBindTexture(GL_TEXTURE_2D, tex->texture);
GLuint components = dstFmt == GL_UNSIGNED_SHORT_5_6_5 ? GL_RGB : GL_RGBA;
glTexImage2D(GL_TEXTURE_2D, 0, components, texturePixels, 1, 0, components, dstFmt, (void *)rawClut);
GLuint components2 = components;
#if defined(MAY_HAVE_GLES3)
if (useBGRA) {
components2 = GL_BGRA_EXT;
}
#endif
glTexImage2D(GL_TEXTURE_2D, 0, components, texturePixels, 1, 0, components2, dstFmt, (void *)rawClut);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);

View File

@ -1405,14 +1405,6 @@ void FramebufferManager::BlitFramebuffer_(VirtualFramebuffer *dst, int dstX, int
fbo_unbind();
}
static inline bool UseBGRA8888() {
// TODO: Other platforms? May depend on vendor which is faster?
#ifdef _WIN32
return gl_extensions.EXT_bgra;
#endif
return false;
}
// TODO: SSE/NEON
// Could also make C fake-simd for 64-bit, two 8888 pixels fit in a register :)
void ConvertFromRGBA8888(u8 *dst, const u8 *src, u32 stride, u32 height, GEBufferFormat format) {

View File

@ -58,14 +58,6 @@
extern int g_iNumVideos;
static inline bool UseBGRA8888() {
// TODO: Other platforms? May depend on vendor which is faster?
#ifdef _WIN32
return gl_extensions.EXT_bgra;
#endif
return false;
}
TextureCache::TextureCache() : clearCacheNextFrame_(false), lowMemoryMode_(false), clutBuf_(NULL) {
lastBoundTexture = -1;
decimationCounter_ = TEXCACHE_DECIMATION_INTERVAL;

View File

@ -17,11 +17,13 @@
#pragma once
#include "../Globals.h"
#include "gfx_es2/fbo.h"
#include "gfx_es2/gpu_features.h"
#include "Globals.h"
#include "GPU/GPUInterface.h"
#include "GPU/GPUState.h"
#include "TextureScaler.h"
#include "GPU/GLES/TextureScaler.h"
struct VirtualFramebuffer;
class FramebufferManager;
@ -40,6 +42,14 @@ enum FramebufferNotification {
NOTIFY_FB_DESTROYED,
};
inline bool UseBGRA8888() {
// TODO: Other platforms? May depend on vendor which is faster?
#ifdef _WIN32
return gl_extensions.EXT_bgra;
#endif
return false;
}
class TextureCache {
public:
TextureCache();