Jordan Woyak 194493cc04 Some work on merging the video plugins: Added a new plugin to the solution(shouldn't build by default) which combines the DX9, DX11, and OGL plugins with their common code merged (and some things temporarily removed). In it's current state the plugin is hardly usable. Perhaps someone with knowledge of the video plugins will be able to fix the things I have broken more easily than me(or point me in the right direction). I will continue to work on it as well.
Main Issues:
DX11 is functional with a ~2MB/s mem leak.
OpenGL/DirectX9 have a black display while game runs. (DirectX 9 flashes good display on emulation stop)
Too many virtual function calls. (once everything is working, I will work on removing them)
Won't build on non-Windows in its current state. (mainly EmuWindow will need changes for Linux/OS X)
Probably other stuff.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6219 8ced0084-cf51-0410-be5f-012b33b47a6e
2010-09-20 21:45:47 +00:00

100 lines
3.0 KiB
C++

#ifndef _RENDER_H_
#define _RENDER_H_
#include "VideoCommon.h"
#include "CommonTypes.h"
#include "FramebufferManager.h"
class RendererBase
{
public:
RendererBase();
virtual ~RendererBase() {}
static void FramebufferSize(int w, int h);
static void RenderToXFB(u32 xfbAddr, u32 fbWidth, u32 fbHeight, const EFBRectangle& sourceRc);
virtual u32 AccessEFB(EFBAccessType type, int x, int y) = 0;
static void Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,const EFBRectangle& rc);
// virtual funcs used in Swap()
virtual void PrepareXFBCopy(const TargetRectangle &dst_rect) = 0;
virtual void Draw(const XFBSourceBase* xfbSource, const TargetRectangle& sourceRc,
const MathUtil::Rectangle<float>& drawRc, const EFBRectangle& rc) = 0;
virtual void EndFrame() = 0;
virtual void Present() = 0;
virtual bool CheckForResize() = 0;
virtual void GetBackBufferSize(int* w, int* h) = 0;
virtual void RecreateFramebufferManger() = 0;
virtual void BeginFrame() = 0;
// hmm
virtual bool SetScissorRect() = 0;
static bool SetScissorRect(EFBRectangle &rc);
static TargetRectangle ConvertEFBRectangle(const EFBRectangle& rc);
virtual void UpdateViewport() = 0;
virtual void ClearScreen(const EFBRectangle& rc, bool colorEnable, bool alphaEnable, bool zEnable, u32 color, u32 z) = 0;
virtual void ResetAPIState() = 0;
virtual void RestoreAPIState() = 0;
static int GetTargetWidth() { return s_target_width; }
static int GetTargetHeight() { return s_target_height; }
static int GetFullTargetWidth() { return s_Fulltarget_width; }
static int GetFullTargetHeight() { return s_Fulltarget_height; }
static float GetTargetScaleX() { return EFBxScale; }
static float GetTargetScaleY() { return EFByScale; }
static int GetFrameBufferWidth() { return s_backbuffer_width; }
static int GetFrameBufferHeight() { return s_backbuffer_height; }
static float GetXFBScaleX() { return xScale; }
static float GetXFBScaleY() { return yScale; }
virtual void SetColorMask() {}
virtual void SetBlendMode(bool forceUpdate) {}
virtual void SetSamplerState(int stage, int texindex) {}
virtual void SetDitherMode() {}
virtual void SetLineWidth() {}
virtual void SetInterlacingMode() {}
virtual void SetGenerationMode() = 0;
virtual void SetDepthMode() = 0;
virtual void SetLogicOpMode() = 0;
protected:
// TODO: are all of these needed?
static int s_target_width;
static int s_target_height;
static int s_Fulltarget_width;
static int s_Fulltarget_height;
static int s_backbuffer_width;
static int s_backbuffer_height;
//
static int s_fps;
static u32 s_blendMode;
static bool XFBWrited;
// these go with the settings in the GUI 1x,2x,3x,etc
static float EFBxScale;
static float EFByScale;
// these seem be the fractional value
// TODO: are these ones needed?
static float xScale;
static float yScale;
static int s_XFB_width;
static int s_XFB_height;
static volatile u32 s_swapRequested;
};
#endif