- Per zeromus’ suggestion, remove GetNativeFramebuffer() and GetCustomFramebuffer() from the GPUSubsystem class. Users must parse the NDSDisplayInfo struct returned from GetDisplayInfo() instead.
- Per zeromus’ suggestion, rename Get/SetWillAutoBlitNativeToCustomBuffer() to Get/SetWillAutoResolveToCustomBuffer().
- Add some more notes to the NDSDisplayInfo struct to help clarify the meaning of each field.
This commit is contained in:
rogerman 2015-09-15 01:13:48 +00:00
parent c389bc7301
commit 444c4fcc0c
9 changed files with 113 additions and 130 deletions

View File

@ -161,13 +161,14 @@ FORCEINLINE void rot_BMP_map(GPUEngineBase *gpu, const s32 auxX, const s32 auxY,
void gpu_savestate(EMUFILE* os)
{
const NDSDisplayInfo &dispInfo = GPU->GetDisplayInfo();
const GPUEngineA *mainEngine = GPU->GetEngineMain();
const GPUEngineB *subEngine = GPU->GetEngineSub();
//version
write32le(1,os);
os->fwrite((u8 *)GPU->GetCustomFramebuffer(), GPU_FRAMEBUFFER_NATIVE_WIDTH * GPU_FRAMEBUFFER_NATIVE_HEIGHT * sizeof(u16) * 2);
os->fwrite((u8 *)dispInfo.masterCustomBuffer, GPU_FRAMEBUFFER_NATIVE_WIDTH * GPU_FRAMEBUFFER_NATIVE_HEIGHT * sizeof(u16) * 2);
write32le(mainEngine->savedBG2X.value, os);
write32le(mainEngine->savedBG2Y.value, os);
@ -181,6 +182,7 @@ void gpu_savestate(EMUFILE* os)
bool gpu_loadstate(EMUFILE* is, int size)
{
const NDSDisplayInfo &dispInfo = GPU->GetDisplayInfo();
GPUEngineA *mainEngine = GPU->GetEngineMain();
GPUEngineB *subEngine = GPU->GetEngineSub();
@ -204,7 +206,7 @@ bool gpu_loadstate(EMUFILE* is, int size)
if (version > 1) return false;
is->fread((u8 *)GPU->GetCustomFramebuffer(), GPU_FRAMEBUFFER_NATIVE_WIDTH * GPU_FRAMEBUFFER_NATIVE_HEIGHT * sizeof(u16) * 2);
is->fread((u8 *)dispInfo.masterCustomBuffer, GPU_FRAMEBUFFER_NATIVE_WIDTH * GPU_FRAMEBUFFER_NATIVE_HEIGHT * sizeof(u16) * 2);
if (version == 1)
{
@ -2497,9 +2499,10 @@ NDSDisplayID GPUEngineBase::GetDisplayByID() const
void GPUEngineBase::SetDisplayByID(const NDSDisplayID theDisplayID)
{
const NDSDisplayInfo &dispInfo = GPU->GetDisplayInfo();
this->_targetDisplayID = theDisplayID;
this->nativeBuffer = GPU->GetNativeFramebuffer(theDisplayID);
this->customBuffer = GPU->GetCustomFramebuffer(theDisplayID);
this->nativeBuffer = dispInfo.nativeBuffer[theDisplayID];
this->customBuffer = dispInfo.customBuffer[theDisplayID];
}
GPUEngineID GPUEngineBase::GetEngineID() const
@ -2516,13 +2519,13 @@ void GPUEngineBase::SetCustomFramebufferSize(size_t w, size_t h)
this->_workingDstColorBuffer = newWorkingScanline;
this->_dstLayerID = newBGPixels;
this->customBuffer = GPU->GetCustomFramebuffer(this->_targetDisplayID);
this->customBuffer = GPU->GetDisplayInfo().customBuffer[this->_targetDisplayID];
free_aligned(oldWorkingScanline);
free_aligned(oldBGPixels);
}
void GPUEngineBase::BlitNativeToCustomFramebuffer()
void GPUEngineBase::ResolveToCustomFramebuffer()
{
const NDSDisplayInfo &dispInfo = GPU->GetDisplayInfo();
@ -2533,28 +2536,36 @@ void GPUEngineBase::BlitNativeToCustomFramebuffer()
u16 *src = this->nativeBuffer;
u16 *dst = this->customBuffer;
u16 *dstColorLine = this->customBuffer;
for (size_t y = 0; y < GPU_FRAMEBUFFER_NATIVE_HEIGHT; y++)
if (dispInfo.isCustomSizeRequested)
{
for (size_t x = 0; x < GPU_FRAMEBUFFER_NATIVE_WIDTH; x++)
u16 *dstColorLine = this->customBuffer;
for (size_t y = 0; y < GPU_FRAMEBUFFER_NATIVE_HEIGHT; y++)
{
for (size_t p = 0; p < _gpuDstPitchCount[x]; p++)
for (size_t x = 0; x < GPU_FRAMEBUFFER_NATIVE_WIDTH; x++)
{
dst[_gpuDstPitchIndex[x] + p] = src[x];
for (size_t p = 0; p < _gpuDstPitchCount[x]; p++)
{
dst[_gpuDstPitchIndex[x] + p] = src[x];
}
}
dstColorLine = dst + dispInfo.customWidth;
for (size_t line = 1; line < _gpuDstLineCount[y]; line++)
{
memcpy(dstColorLine, dst, dispInfo.customWidth * sizeof(u16));
dstColorLine += dispInfo.customWidth;
}
src += GPU_FRAMEBUFFER_NATIVE_WIDTH;
dst = dstColorLine;
}
dstColorLine = dst + dispInfo.customWidth;
for (size_t line = 1; line < _gpuDstLineCount[y]; line++)
{
memcpy(dstColorLine, dst, dispInfo.customWidth * sizeof(u16));
dstColorLine += dispInfo.customWidth;
}
src += GPU_FRAMEBUFFER_NATIVE_WIDTH;
dst = dstColorLine;
}
else
{
memcpy(this->customBuffer, this->nativeBuffer, GPU_FRAMEBUFFER_NATIVE_WIDTH * GPU_FRAMEBUFFER_NATIVE_HEIGHT * sizeof(u16));
}
GPU->SetDisplayDidCustomRender(this->_targetDisplayID, true);
@ -2610,6 +2621,7 @@ void GPUEngineBase::ParseAllRegisters()
GPUEngineA::GPUEngineA()
{
_engineID = GPUEngineID_Main;
_targetDisplayID = NDSDisplayID_Main;
_IORegisterMap = (GPU_IOREG *)MMU.ARM9_REG;
_paletteBG = (u16 *)MMU.ARM9_VMEM;
_paletteOBJ = (u16 *)(MMU.ARM9_VMEM + ADDRESS_STEP_512B);
@ -3777,6 +3789,7 @@ void GPUEngineA::_HandleDisplayModeMainMemory(u16 *dstColorLine, const size_t l,
GPUEngineB::GPUEngineB()
{
_engineID = GPUEngineID_Sub;
_targetDisplayID = NDSDisplayID_Touch;
_IORegisterMap = (GPU_IOREG *)(&MMU.ARM9_REG[REG_DISPB]);
_paletteBG = (u16 *)(MMU.ARM9_VMEM + ADDRESS_STEP_1KB);
_paletteOBJ = (u16 *)(MMU.ARM9_VMEM + ADDRESS_STEP_1KB + ADDRESS_STEP_512B);
@ -4146,7 +4159,7 @@ GPUSubsystem::GPUSubsystem()
_displayTouch = new NDSDisplay(NDSDisplayID_Touch);
_displayTouch->SetEngine(_engineSub);
_willAutoBlitNativeToCustomBuffer = true;
_willAutoResolveToCustomBuffer = true;
OSDCLASS *previousOSD = osd;
osd = new OSDCLASS(-1);
@ -4161,19 +4174,19 @@ GPUSubsystem::GPUSubsystem()
_displayInfo.customHeight = GPU_FRAMEBUFFER_NATIVE_HEIGHT;
_displayInfo.masterCustomBuffer = _customFramebuffer;
_displayInfo.masterNativeBuffer = _nativeFramebuffer;
_displayInfo.nativeBuffer[0] = _nativeFramebuffer;
_displayInfo.nativeBuffer[1] = _nativeFramebuffer + (GPU_FRAMEBUFFER_NATIVE_WIDTH * GPU_FRAMEBUFFER_NATIVE_HEIGHT);
_displayInfo.customBuffer[0] = _customFramebuffer;
_displayInfo.customBuffer[1] = _customFramebuffer + (GPU_FRAMEBUFFER_NATIVE_WIDTH * GPU_FRAMEBUFFER_NATIVE_HEIGHT);
_displayInfo.nativeBuffer[NDSDisplayID_Main] = _nativeFramebuffer;
_displayInfo.nativeBuffer[NDSDisplayID_Touch] = _nativeFramebuffer + (GPU_FRAMEBUFFER_NATIVE_WIDTH * GPU_FRAMEBUFFER_NATIVE_HEIGHT);
_displayInfo.customBuffer[NDSDisplayID_Main] = _customFramebuffer;
_displayInfo.customBuffer[NDSDisplayID_Touch] = _customFramebuffer + (GPU_FRAMEBUFFER_NATIVE_WIDTH * GPU_FRAMEBUFFER_NATIVE_HEIGHT);
_displayInfo.didPerformCustomRender[0] = false;
_displayInfo.didPerformCustomRender[1] = false;
_displayInfo.renderedWidth[0] = GPU_FRAMEBUFFER_NATIVE_WIDTH;
_displayInfo.renderedWidth[1] = GPU_FRAMEBUFFER_NATIVE_WIDTH;
_displayInfo.renderedHeight[0] = GPU_FRAMEBUFFER_NATIVE_HEIGHT;
_displayInfo.renderedHeight[1] = GPU_FRAMEBUFFER_NATIVE_HEIGHT;
_displayInfo.renderedBuffer[0] = _displayInfo.nativeBuffer[0];
_displayInfo.renderedBuffer[1] = _displayInfo.nativeBuffer[1];
_displayInfo.didPerformCustomRender[NDSDisplayID_Main] = false;
_displayInfo.didPerformCustomRender[NDSDisplayID_Touch] = false;
_displayInfo.renderedWidth[NDSDisplayID_Main] = GPU_FRAMEBUFFER_NATIVE_WIDTH;
_displayInfo.renderedWidth[NDSDisplayID_Touch] = GPU_FRAMEBUFFER_NATIVE_WIDTH;
_displayInfo.renderedHeight[NDSDisplayID_Main] = GPU_FRAMEBUFFER_NATIVE_HEIGHT;
_displayInfo.renderedHeight[NDSDisplayID_Touch] = GPU_FRAMEBUFFER_NATIVE_HEIGHT;
_displayInfo.renderedBuffer[NDSDisplayID_Main] = _displayInfo.nativeBuffer[NDSDisplayID_Main];
_displayInfo.renderedBuffer[NDSDisplayID_Touch] = _displayInfo.nativeBuffer[NDSDisplayID_Touch];
ClearWithColor(0x8000);
}
@ -4371,26 +4384,6 @@ NDSDisplay* GPUSubsystem::GetDisplayTouch()
return this->_displayTouch;
}
u16* GPUSubsystem::GetNativeFramebuffer()
{
return this->_nativeFramebuffer;
}
u16* GPUSubsystem::GetNativeFramebuffer(const NDSDisplayID theDisplayID)
{
return (theDisplayID == NDSDisplayID_Main) ? this->_nativeFramebuffer : this->_nativeFramebuffer + (GPU_FRAMEBUFFER_NATIVE_WIDTH * GPU_FRAMEBUFFER_NATIVE_HEIGHT);
}
u16* GPUSubsystem::GetCustomFramebuffer()
{
return this->_customFramebuffer;
}
u16* GPUSubsystem::GetCustomFramebuffer(const NDSDisplayID theDisplayID)
{
return (theDisplayID == NDSDisplayID_Main) ? this->_customFramebuffer : this->_customFramebuffer + (this->_displayInfo.customWidth * this->_displayInfo.customHeight);
}
size_t GPUSubsystem::GetCustomFramebufferWidth() const
{
return this->_displayInfo.customWidth;
@ -4476,8 +4469,8 @@ void GPUSubsystem::SetCustomFramebufferSize(size_t w, size_t h)
this->_displayInfo.masterCustomBuffer = this->_customFramebuffer;
this->_displayInfo.customWidth = w;
this->_displayInfo.customHeight = h;
this->_displayInfo.customBuffer[NDSDisplayID_Main] = this->_displayMain->GetEngine()->customBuffer;
this->_displayInfo.customBuffer[NDSDisplayID_Touch] = this->_displayTouch->GetEngine()->customBuffer;
this->_displayInfo.customBuffer[NDSDisplayID_Main] = (this->_displayMain->GetEngine()->GetDisplayByID() == NDSDisplayID_Main) ? this->_customFramebuffer : this->_customFramebuffer + (w * h);
this->_displayInfo.customBuffer[NDSDisplayID_Touch] = (this->_displayTouch->GetEngine()->GetDisplayByID() == NDSDisplayID_Main) ? this->_customFramebuffer : this->_customFramebuffer + (w * h);
this->_engineMain->SetCustomFramebufferSize(w, h);
this->_engineSub->SetCustomFramebufferSize(w, h);
@ -4517,14 +4510,14 @@ VRAM3DUsageProperties& GPUSubsystem::GetVRAM3DUsageProperties()
return this->_VRAM3DUsage;
}
bool GPUSubsystem::GetWillAutoBlitNativeToCustomBuffer() const
bool GPUSubsystem::GetWillAutoResolveToCustomBuffer() const
{
return this->_willAutoBlitNativeToCustomBuffer;
return this->_willAutoResolveToCustomBuffer;
}
void GPUSubsystem::SetWillAutoBlitNativeToCustomBuffer(const bool willAutoBlit)
void GPUSubsystem::SetWillAutoResolveToCustomBuffer(const bool willAutoResolve)
{
this->_willAutoBlitNativeToCustomBuffer = willAutoBlit;
this->_willAutoResolveToCustomBuffer = willAutoResolve;
}
void GPUSubsystem::RenderLine(const u16 l, bool skip)

View File

@ -1012,19 +1012,33 @@ typedef struct
typedef struct
{
bool isCustomSizeRequested; // true - The user requested a custom size; false - The user requested the native size
size_t customWidth; // The custom buffer width, measured in pixels
size_t customHeight; // The custom buffer height, measured in pixels
u16 *masterCustomBuffer; // Pointer to the head of the master custom buffer.
// User-requested settings. These fields will always remain constant, and can only be changed if
// the user calls GPUSubsystem::SetFramebufferSize().
bool isCustomSizeRequested; // Reports that the call to GPUSubsystem::SetFramebufferSize() resulted in a custom rendering size.
// true - The user requested a custom size.
// false - The user requested the native size.
size_t customWidth; // The requested custom width, measured in pixels.
size_t customHeight; // The requested custom height, measured in pixels.
u16 *masterNativeBuffer; // Pointer to the head of the master native buffer.
u16 *masterCustomBuffer; // Pointer to the head of the master custom buffer.
// If GPUSubsystem::GetWillAutoResolveToCustomBuffer() would return true, or if
// GPUEngineBase::ResolveToCustomFramebuffer() is called, then this buffer is used as the target
// buffer for resolving any native-sized renders.
u16 *customBuffer[2]; // Pointer to a display's custom size framebuffer
u16 *nativeBuffer[2]; // Pointer to a display's native size framebuffer
bool didPerformCustomRender[2]; // true - The display performed a custom-sized render; false - The display performed a native-sized render
size_t renderedWidth[2]; // The display rendered at this width, measured in pixels
size_t renderedHeight[2]; // The display rendered at this height, measured in pixels
u16 *renderedBuffer[2]; // The display rendered to this buffer
// Frame information. These fields will change per frame, depending on how each display was rendered.
u16 *nativeBuffer[2]; // Pointer to the display's native size framebuffer.
u16 *customBuffer[2]; // Pointer to the display's custom size framebuffer.
bool didPerformCustomRender[2]; // Reports that the display actually rendered at a custom size for this frame.
// true - The display performed a custom-sized render.
// false - The display performed a native-sized render.
size_t renderedWidth[2]; // The display rendered at this width, measured in pixels.
size_t renderedHeight[2]; // The display rendered at this height, measured in pixels.
u16 *renderedBuffer[2]; // The display rendered to this buffer.
} NDSDisplayInfo;
#define VRAM_NO_3D_USAGE 0xFF
@ -1270,7 +1284,7 @@ public:
GPUEngineID GetEngineID() const;
virtual void SetCustomFramebufferSize(size_t w, size_t h);
void BlitNativeToCustomFramebuffer();
void ResolveToCustomFramebuffer();
void REG_DISPx_pack_test();
};
@ -1375,7 +1389,7 @@ private:
NDSDisplay *_displayMain;
NDSDisplay *_displayTouch;
bool _willAutoBlitNativeToCustomBuffer;
bool _willAutoResolveToCustomBuffer;
VRAM3DUsageProperties _VRAM3DUsage;
u16 *_customVRAM;
u16 *_customVRAMBlank;
@ -1399,11 +1413,6 @@ public:
NDSDisplay* GetDisplayMain();
NDSDisplay* GetDisplayTouch();
u16* GetNativeFramebuffer();
u16* GetNativeFramebuffer(const NDSDisplayID theDisplayID);
u16* GetCustomFramebuffer();
u16* GetCustomFramebuffer(const NDSDisplayID theDisplayID);
u16* GetCustomVRAMBuffer();
u16* GetCustomVRAMBlankBuffer();
@ -1413,21 +1422,21 @@ public:
void UpdateVRAM3DUsageProperties();
// Normally, the GPUs will automatically blit their native buffers to the master
// framebuffer at the end of V-blank so that all rendered graphics are contained
// Normally, the GPUs will automatically resolve their native buffers to the master
// custom framebuffer at the end of V-blank so that all rendered graphics are contained
// within a single common buffer. This is necessary for when someone wants to read
// the NDS framebuffers, but the reader can only read a single buffer at a time.
// Certain functions, such as taking screenshots, as well as many frontends running
// the NDS video displays, require that they read from only a single buffer.
//
// However, if SetWillAutoBlitNativeToCustomBuffer() is passed "false", then the
// However, if SetWillAutoResolveToCustomBuffer() is passed "false", then the
// frontend becomes responsible for calling GetDisplayInfo() and reading the native
// and custom buffers properly for each display. If a single buffer is still needed
// for certain cases, then the frontend must manually call
// GPUEngineBase::BlitNativeToCustomFramebuffer() for each engine before reading the
// master framebuffer.
bool GetWillAutoBlitNativeToCustomBuffer() const;
void SetWillAutoBlitNativeToCustomBuffer(const bool willAutoBlit);
// GPUEngineBase::ResolveToCustomFramebuffer() for each engine before reading the
// master custom framebuffer.
bool GetWillAutoResolveToCustomBuffer() const;
void SetWillAutoResolveToCustomBuffer(const bool willAutoResolve);
void RenderLine(const u16 l, bool skip = false);
void ClearWithColor(const u16 colorBGRA5551);

View File

@ -1327,10 +1327,10 @@ static void execHardware_hstart_vblankEnd()
//some emulation housekeeping
frameSkipper.Advance();
if (GPU->GetWillAutoBlitNativeToCustomBuffer())
if (GPU->GetWillAutoResolveToCustomBuffer())
{
GPU->GetEngineMain()->BlitNativeToCustomFramebuffer();
GPU->GetEngineSub()->BlitNativeToCustomFramebuffer();
GPU->GetEngineMain()->ResolveToCustomFramebuffer();
GPU->GetEngineSub()->ResolveToCustomFramebuffer();
}
}

View File

@ -371,7 +371,7 @@ resizeWindow( u16 width, u16 height, GLuint *screen_texture) {
static void
opengl_Draw( GLuint *texture, int software_convert) {
GLenum errCode;
u16 *gpuFramebuffer = GPU->GetNativeFramebuffer();
u16 *gpuFramebuffer = GPU->GetDisplayInfo().masterNativeBuffer;
/* Clear The Screen And The Depth Buffer */
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
@ -446,7 +446,7 @@ static void
Draw( void) {
SDL_Surface *rawImage;
rawImage = SDL_CreateRGBSurfaceFrom((void*)GPU->GetNativeFramebuffer(), 256, 384, 16, 512, 0x001F, 0x03E0, 0x7C00, 0);
rawImage = SDL_CreateRGBSurfaceFrom((void*)GPU->GetDisplayInfo().masterNativeBuffer, 256, 384, 16, 512, 0x001F, 0x03E0, 0x7C00, 0);
if(rawImage == NULL) return;
SDL_BlitSurface(rawImage, 0, surface, 0);
@ -489,7 +489,7 @@ static void desmume_cycle(struct ctrls_event_config * cfg)
}
#ifdef HAVE_LIBAGG
T_AGG_RGB555 agg_targetScreen_cli((u8 *)GPU->GetNativeFramebuffer(), 256, 384, 512);
T_AGG_RGB555 agg_targetScreen_cli((u8 *)GPU->GetDisplayInfo().masterNativeBuffer, 256, 384, 512);
#endif
int main(int argc, char ** argv) {

View File

@ -67,15 +67,15 @@ static GtkSpinButton * wSpin;
static u16 mem[0x100];
static COLOR c;
static COLOR32 c32;
//static COLOR c;
//static COLOR32 c32;
static GdkGC * gdkGC;
static inline void paint_col(int x, int y, u16 col) {
c.val = col;
COLOR_16_32(c,c32)
gdk_rgb_gc_set_foreground(gdkGC, c32.val);
gdk_draw_rectangle(wPaint->window, gdkGC, TRUE, x, y, 15, 15);
//c.val = col;
//COLOR_16_32(c,c32)
//gdk_rgb_gc_set_foreground(gdkGC, c32.val);
//gdk_draw_rectangle(wPaint->window, gdkGC, TRUE, x, y, 15, 15);
}
static inline void paint_cross(int x, int y) {
gdk_rgb_gc_set_foreground(gdkGC, 0x808080);

View File

@ -237,7 +237,7 @@ static void my_gl_Texture2D() {
static void
my_gl_ScreenTex( int software_convert) {
u16 *gpuFramebuffer = GPU->GetNativeFramebuffer();
u16 *gpuFramebuffer = GPU->GetDisplayInfo().masterNativeBuffer;
if ( software_convert) {
u8 converted[256 * 384 * 3];
@ -280,8 +280,6 @@ static void my_gl_ScreenTexApply(int screen) {
gboolean screen (GtkWidget * widget, int viewportscreen) {
int screen;
GPUEngineBase * gpu;
float bright_color = 0.0f; // blend with black
float bright_alpha = 0.0f; // don't blend
// we take care to draw the right thing the right place
// we need to rearrange widgets not to use this trick
@ -293,29 +291,16 @@ gboolean screen (GtkWidget * widget, int viewportscreen) {
glLoadIdentity();
// clear screen
glClearColor(0.0f,0.0f,0.0f,0.0f);
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
glClearColor(0.0f,0.0f,0.0f,1.0f);
glClear(GL_COLOR_BUFFER_BIT);
glEnable(GL_TEXTURE_2D);
glDisable(GL_BLEND);
glDisable(GL_DEPTH_TEST);
glDisable(GL_DITHER);
glDisable(GL_STENCIL_TEST);
if (desmume_running()) {
// master bright
gpu = (screen) ? (GPUEngineBase *)GPU->GetEngineSub() : (GPUEngineBase *)GPU->GetEngineMain();
switch (gpu->MasterBrightMode)
{
case 1: // Bright up : blend with white
bright_color = 1.0f;
// no break;
case 2: // Bright down : blend with black
bright_alpha = 1.0f; // blending max
bright_alpha = gpu->MasterBrightFactor / 16.0;
break;
// Disabled 0, Reserved 3
default: break;
}
// rotate
glRotatef(ScreenRotate, 0.0, 0.0, 1.0);
// create the texture for both display
@ -323,12 +308,8 @@ gboolean screen (GtkWidget * widget, int viewportscreen) {
if (viewportscreen==0) {
my_gl_ScreenTex( gtk_glade_use_software_colour_convert);
}
} else {
// pause
// fake master bright up 50%
bright_color = 0.0f;
bright_alpha = 0.5f;
}
// make sure current color is ok
glColor4ub(255,255,255,255);
// apply part of the texture
@ -338,7 +319,6 @@ gboolean screen (GtkWidget * widget, int viewportscreen) {
// master bright (bis)
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
glColor4f(bright_color,bright_color,bright_color,bright_alpha);
glBegin(GL_QUADS);
glVertex2d(-1.0, 1.0);
glVertex2d( 1.0, 1.0);

View File

@ -1547,7 +1547,7 @@ static inline void RGB555ToBGRA8888Buffer(const uint16_t *__restrict__ srcBuffer
static inline void gpu_screen_to_rgb(u32* dst)
{
RGB555ToRGBA8888Buffer(GPU->GetNativeFramebuffer(), dst, 256 * 384);
RGB555ToRGBA8888Buffer(GPU->GetDisplayInfo().masterNativeBuffer, dst, 256 * 384);
}
static inline void drawScreen(cairo_t* cr, u32* buf, gint w, gint h) {
@ -1672,7 +1672,7 @@ static gboolean ExposeDrawingArea (GtkWidget *widget, GdkEventExpose *event, gpo
}
static void RedrawScreen() {
RGB555ToBGRA8888Buffer(GPU->GetNativeFramebuffer(), video->GetSrcBufferPtr(), 256 * 384);
RGB555ToBGRA8888Buffer(GPU->GetDisplayInfo().masterNativeBuffer, video->GetSrcBufferPtr(), 256 * 384);
#ifdef HAVE_LIBAGG
aggDraw.hud->attach((u8*)video->GetSrcBufferPtr(), 256, 384, 1024);
osd->update();
@ -2456,7 +2456,7 @@ gboolean EmuLoop(gpointer data)
desmume_cycle(); /* Emule ! */
_updateDTools();
avout_x264.updateVideo(GPU->GetNativeFramebuffer());
avout_x264.updateVideo(GPU->GetDisplayInfo().masterNativeBuffer);
RedrawScreen();
if (!config.fpslimiter || keys_latch & KEYMASK_(KEY_BOOST - 1)) {

View File

@ -2225,10 +2225,11 @@ public:
failbit = true;
else
{
const NDSDisplayInfo &dispInfo = GPU->GetDisplayInfo();
char temp [256];
sprintf(temp, " " /*"mismatch at "*/ "byte %d(0x%X at 0x%X): %d(0x%X) != %d(0x%X)\n", i, i, dst, *src,*src, *dst,*dst);
if(ptr == GPU->GetNativeFramebuffer() || ptr == GPU->GetCustomFramebuffer() || ptr == GPU->GetEngineMain()->Get3DFramebufferRGBA6665()) // ignore screen-only differences since frame skipping can cause them and it's probably ok
if(ptr == dispInfo.masterNativeBuffer || ptr == dispInfo.masterCustomBuffer || ptr == GPU->GetEngineMain()->Get3DFramebufferRGBA6665()) // ignore screen-only differences since frame skipping can cause them and it's probably ok
break;
differences.push_back(temp); // <-- probably the best place for a breakpoint

View File

@ -106,7 +106,7 @@ bool Video::setFilter(VideoFilterTypeID filterID) {
}
unsigned int* Video::runFilter() {
RGB555ToRGBA8888Buffer(GPU->GetNativeFramebuffer(), this->mFilter.GetSrcBufferPtr(), 256 * 384);
RGB555ToRGBA8888Buffer(GPU->GetDisplayInfo().masterNativeBuffer, this->mFilter.GetSrcBufferPtr(), 256 * 384);
unsigned int* buf = this->mFilter.RunFilter();
this->screenBufferUpdated(buf, this->getDstSize(), this->getDstScale());
return buf;