Consistently use a proper type for GE fb format.

This commit is contained in:
Unknown W. Brackets 2013-07-29 23:05:59 -07:00
parent 4dde7276c6
commit 89349eae7e
7 changed files with 32 additions and 33 deletions

View file

@ -289,7 +289,7 @@ void GLES_GPU::BeginFrame() {
framebufferManager_.BeginFrame();
}
void GLES_GPU::SetDisplayFramebuffer(u32 framebuf, u32 stride, int format) {
void GLES_GPU::SetDisplayFramebuffer(u32 framebuf, u32 stride, GEBufferFormat format) {
framebufferManager_.SetDisplayFramebuffer(framebuf, stride, format);
}
@ -1055,7 +1055,7 @@ void GLES_GPU::DoBlockTransfer() {
if (((backBuffer != 0 && dstBasePtr == backBuffer) ||
(displayBuffer != 0 && dstBasePtr == displayBuffer)) &&
dstStride == 512 && height == 272) {
framebufferManager_.DrawPixels(Memory::GetPointer(dstBasePtr), 3, 512);
framebufferManager_.DrawPixels(Memory::GetPointer(dstBasePtr), GE_FORMAT_8888, 512);
}
}

View file

@ -40,7 +40,7 @@ public:
virtual void ExecuteOp(u32 op, u32 diff);
virtual u32 DrawSync(int mode);
virtual void SetDisplayFramebuffer(u32 framebuf, u32 stride, int format);
virtual void SetDisplayFramebuffer(u32 framebuf, u32 stride, GEBufferFormat format);
virtual void CopyDisplayToOutput();
virtual void BeginFrame();
virtual void UpdateStats();

View file

@ -91,7 +91,7 @@ inline u16 RGBA8888toRGBA5551(u32 px) {
return ((px >> 3) & 0x001F) | ((px >> 6) & 0x03E0) | ((px >> 9) & 0x7C00) | ((px >> 16) & 0x8000);
}
void ConvertFromRGBA8888(u8 *dst, u8 *src, u32 stride, u32 height, int format);
void ConvertFromRGBA8888(u8 *dst, u8 *src, u32 stride, u32 height, GEBufferFormat format);
void CenterRect(float *x, float *y, float *w, float *h,
float origW, float origH, float frameW, float frameH)
@ -147,14 +147,14 @@ FramebufferManager::FramebufferManager() :
ramDisplayFramebufPtr_(0),
displayFramebufPtr_(0),
displayStride_(0),
displayFormat_(0),
displayFormat_(GE_FORMAT_565),
displayFramebuf_(0),
prevDisplayFramebuf_(0),
prevPrevDisplayFramebuf_(0),
frameLastFramebufUsed(0),
currentRenderVfb_(0),
drawPixelsTex_(0),
drawPixelsTexFormat_(-1),
drawPixelsTexFormat_(GE_FORMAT_INVALID),
convBuf(0),
draw2dprogram(0)
#ifndef USING_GLES2
@ -218,7 +218,7 @@ FramebufferManager::~FramebufferManager() {
delete [] convBuf;
}
void FramebufferManager::DrawPixels(const u8 *framebuf, int pixelFormat, int linesize) {
void FramebufferManager::DrawPixels(const u8 *framebuf, GEBufferFormat pixelFormat, int linesize) {
if (drawPixelsTex_ && drawPixelsTexFormat_ != pixelFormat) {
glDeleteTextures(1, &drawPixelsTex_);
drawPixelsTex_ = 0;
@ -235,11 +235,6 @@ void FramebufferManager::DrawPixels(const u8 *framebuf, int pixelFormat, int lin
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
switch (pixelFormat) {
case GE_FORMAT_8888:
break;
}
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 512, 272, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
glBindTexture(GL_TEXTURE_2D, 0);
drawPixelsTexFormat_ = pixelFormat;
@ -453,7 +448,7 @@ void FramebufferManager::SetRenderFrameBuffer() {
// As there are no clear "framebuffer width" and "framebuffer height" registers,
// we need to infer the size of the current framebuffer somehow. Let's try the viewport.
int fmt = gstate.framebufpixformat & 3;
GEBufferFormat fmt = static_cast<GEBufferFormat>(gstate.framebufpixformat & 3);
int drawing_width, drawing_height;
GuessDrawingSize(drawing_width, drawing_height);
@ -504,20 +499,20 @@ void FramebufferManager::SetRenderFrameBuffer() {
vfb->colorDepth = FBO_8888;
} else {
switch (fmt) {
case GE_FORMAT_4444:
vfb->colorDepth = FBO_4444;
case GE_FORMAT_4444:
vfb->colorDepth = FBO_4444;
break;
case GE_FORMAT_5551:
vfb->colorDepth = FBO_5551;
case GE_FORMAT_5551:
vfb->colorDepth = FBO_5551;
break;
case GE_FORMAT_565:
vfb->colorDepth = FBO_565;
case GE_FORMAT_565:
vfb->colorDepth = FBO_565;
break;
case GE_FORMAT_8888:
vfb->colorDepth = FBO_8888;
case GE_FORMAT_8888:
vfb->colorDepth = FBO_8888;
break;
default:
vfb->colorDepth = FBO_8888;
default:
vfb->colorDepth = FBO_8888;
break;
}
}
@ -840,7 +835,7 @@ void FramebufferManager::BlitFramebuffer_(VirtualFramebuffer *src, VirtualFrameb
}
// TODO: SSE/NEON
void ConvertFromRGBA8888(u8 *dst, u8 *src, u32 stride, u32 height, int format) {
void ConvertFromRGBA8888(u8 *dst, u8 *src, u32 stride, u32 height, GEBufferFormat format) {
if(format == GE_FORMAT_8888) {
if(src == dst) {
return;
@ -868,6 +863,9 @@ void ConvertFromRGBA8888(u8 *dst, u8 *src, u32 stride, u32 height, int format) {
dst16[i] = RGBA8888toRGBA4444(src32[i]);
}
break;
case GE_FORMAT_8888:
// Not possible.
break;
default:
break;
}
@ -1101,7 +1099,7 @@ void FramebufferManager::BeginFrame() {
useBufferedRendering_ = g_Config.iRenderingMode != FB_NON_BUFFERED_MODE ? 1 : 0;
}
void FramebufferManager::SetDisplayFramebuffer(u32 framebuf, u32 stride, int format) {
void FramebufferManager::SetDisplayFramebuffer(u32 framebuf, u32 stride, GEBufferFormat format) {
if ((framebuf & 0x04000000) == 0) {
DEBUG_LOG(HLE, "Non-VRAM display framebuffer address set: %08x", framebuf);

View file

@ -82,7 +82,7 @@ struct VirtualFramebuffer {
u16 usageFlags;
int format; // virtual, right now they are all RGBA8888
GEBufferFormat format; // virtual, right now they are all RGBA8888
FBOColorDepth colorDepth;
FBO *fbo;
@ -102,7 +102,7 @@ struct AsyncPBO {
u32 stride;
u32 height;
u32 size;
int format;
GEBufferFormat format;
bool reading;
};
@ -122,7 +122,7 @@ public:
shaderManager_ = sm;
}
void DrawPixels(const u8 *framebuf, int pixelFormat, int linesize);
void DrawPixels(const u8 *framebuf, GEBufferFormat pixelFormat, int linesize);
void DrawActiveTexture(float x, float y, float w, float h, bool flip = false, float uscale = 1.0f, float vscale = 1.0f, GLSLProgram *program = 0);
void DestroyAllFBOs();
@ -140,7 +140,7 @@ public:
// TODO: Break out into some form of FBO manager
VirtualFramebuffer *GetDisplayFBO();
void SetDisplayFramebuffer(u32 framebuf, u32 stride, int format);
void SetDisplayFramebuffer(u32 framebuf, u32 stride, GEBufferFormat format);
size_t NumVFBs() const { return vfbs_.size(); }
std::vector<FramebufferInfo> GetFramebufferList();
@ -165,7 +165,7 @@ private:
u32 ramDisplayFramebufPtr_; // workaround for MotoGP insanity
u32 displayFramebufPtr_;
u32 displayStride_;
int displayFormat_;
GEBufferFormat displayFormat_;
VirtualFramebuffer *displayFramebuf_;
VirtualFramebuffer *prevDisplayFramebuf_;
@ -192,7 +192,7 @@ private:
// Used by DrawPixels
unsigned int drawPixelsTex_;
int drawPixelsTexFormat_;
GEBufferFormat drawPixelsTexFormat_;
u8 *convBuf;
GLSLProgram *draw2dprogram;

View file

@ -171,7 +171,7 @@ public:
virtual bool InterpretList(DisplayList& list) = 0;
// Framebuffer management
virtual void SetDisplayFramebuffer(u32 framebuf, u32 stride, int format) = 0;
virtual void SetDisplayFramebuffer(u32 framebuf, u32 stride, GEBufferFormat format) = 0;
virtual void BeginFrame() = 0; // Can be a good place to draw the "memory" framebuffer for accelerated plugins
virtual void CopyDisplayToOutput() = 0;

View file

@ -31,7 +31,7 @@ public:
virtual u32 DrawSync(int mode);
virtual void BeginFrame() {}
virtual void SetDisplayFramebuffer(u32 framebuf, u32 stride, int format) {}
virtual void SetDisplayFramebuffer(u32 framebuf, u32 stride, GEBufferFormat format) {}
virtual void CopyDisplayToOutput() {}
virtual void UpdateStats();
virtual void InvalidateCache(u32 addr, int size, GPUInvalidationType type);

View file

@ -251,6 +251,7 @@ enum GEBufferFormat
GE_FORMAT_5551=1,
GE_FORMAT_4444=2,
GE_FORMAT_8888=3,
GE_FORMAT_INVALID=0xFF,
};
#define GE_VTYPE_TRANSFORM (0<<23)