mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-10 08:09:26 +01:00
Revert "Made several variables/parameters unsigned in the DX9, DX11 and OGL plugins. They make more sense like this (given their names)."
Turns out I was wrong in my previous commit. My bad. This reverts commit 87431666639c7036ea0f5b0d499df639cefb3d51.
This commit is contained in:
parent
8743166663
commit
0ef3bd9c77
@ -17,7 +17,7 @@ struct XFBSourceBase
|
|||||||
|
|
||||||
// TODO: only DX9 uses the width/height params
|
// TODO: only DX9 uses the width/height params
|
||||||
virtual void Draw(const MathUtil::Rectangle<float> &sourcerc,
|
virtual void Draw(const MathUtil::Rectangle<float> &sourcerc,
|
||||||
const MathUtil::Rectangle<float> &drawrc, u32 width, u32 height) const = 0;
|
const MathUtil::Rectangle<float> &drawrc, int width, int height) const = 0;
|
||||||
|
|
||||||
virtual void DecodeToTexture(u32 xfbAddr, u32 fbWidth, u32 fbHeight) = 0;
|
virtual void DecodeToTexture(u32 xfbAddr, u32 fbWidth, u32 fbHeight) = 0;
|
||||||
|
|
||||||
|
@ -60,12 +60,12 @@ std::string Renderer::s_sScreenshotName;
|
|||||||
volatile bool Renderer::s_bScreenshot;
|
volatile bool Renderer::s_bScreenshot;
|
||||||
|
|
||||||
// The framebuffer size
|
// The framebuffer size
|
||||||
unsigned int Renderer::s_target_width;
|
int Renderer::s_target_width;
|
||||||
unsigned int Renderer::s_target_height;
|
int Renderer::s_target_height;
|
||||||
|
|
||||||
// TODO: Add functionality to reinit all the render targets when the window is resized.
|
// TODO: Add functionality to reinit all the render targets when the window is resized.
|
||||||
unsigned int Renderer::s_backbuffer_width;
|
int Renderer::s_backbuffer_width;
|
||||||
unsigned int Renderer::s_backbuffer_height;
|
int Renderer::s_backbuffer_height;
|
||||||
|
|
||||||
TargetRectangle Renderer::target_rc;
|
TargetRectangle Renderer::target_rc;
|
||||||
|
|
||||||
@ -163,7 +163,7 @@ int Renderer::EFBToScaledY(int y)
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer::CalculateTargetScale(unsigned int x, unsigned int y, unsigned int &scaledX, unsigned int &scaledY)
|
void Renderer::CalculateTargetScale(int x, int y, int &scaledX, int &scaledY)
|
||||||
{
|
{
|
||||||
if (g_ActiveConfig.iEFBScale == 0 || g_ActiveConfig.iEFBScale == 1)
|
if (g_ActiveConfig.iEFBScale == 0 || g_ActiveConfig.iEFBScale == 1)
|
||||||
{
|
{
|
||||||
@ -172,15 +172,15 @@ void Renderer::CalculateTargetScale(unsigned int x, unsigned int y, unsigned int
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
scaledX = x * (efb_scale_numeratorX / efb_scale_denominatorX);
|
scaledX = x * (int)efb_scale_numeratorX / (int)efb_scale_denominatorX;
|
||||||
scaledY = y * (efb_scale_numeratorY / efb_scale_denominatorY);
|
scaledY = y * (int)efb_scale_numeratorY / (int)efb_scale_denominatorY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// return true if target size changed
|
// return true if target size changed
|
||||||
bool Renderer::CalculateTargetSize(unsigned int framebuffer_width, unsigned int framebuffer_height, unsigned int multiplier)
|
bool Renderer::CalculateTargetSize(unsigned int framebuffer_width, unsigned int framebuffer_height, int multiplier)
|
||||||
{
|
{
|
||||||
u32 newEFBWidth, newEFBHeight;
|
int newEFBWidth, newEFBHeight;
|
||||||
|
|
||||||
// TODO: Ugly. Clean up
|
// TODO: Ugly. Clean up
|
||||||
switch (s_LastEFBScale)
|
switch (s_LastEFBScale)
|
||||||
@ -374,7 +374,7 @@ void Renderer::DrawDebugText()
|
|||||||
// TODO: remove
|
// TODO: remove
|
||||||
extern bool g_aspect_wide;
|
extern bool g_aspect_wide;
|
||||||
|
|
||||||
void Renderer::UpdateDrawRectangle(u32 backbuffer_width, u32 backbuffer_height)
|
void Renderer::UpdateDrawRectangle(int backbuffer_width, int backbuffer_height)
|
||||||
{
|
{
|
||||||
float FloatGLWidth = (float)backbuffer_width;
|
float FloatGLWidth = (float)backbuffer_width;
|
||||||
float FloatGLHeight = (float)backbuffer_height;
|
float FloatGLHeight = (float)backbuffer_height;
|
||||||
@ -492,7 +492,7 @@ void Renderer::UpdateDrawRectangle(u32 backbuffer_width, u32 backbuffer_height)
|
|||||||
target_rc.bottom = YOffset + iHeight;
|
target_rc.bottom = YOffset + iHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer::SetWindowSize(u32 width, u32 height)
|
void Renderer::SetWindowSize(int width, int height)
|
||||||
{
|
{
|
||||||
if (width < 1)
|
if (width < 1)
|
||||||
width = 1;
|
width = 1;
|
||||||
|
@ -67,14 +67,14 @@ public:
|
|||||||
virtual void RestoreState() = 0;
|
virtual void RestoreState() = 0;
|
||||||
|
|
||||||
// Ideal internal resolution - determined by display resolution (automatic scaling) and/or a multiple of the native EFB resolution
|
// Ideal internal resolution - determined by display resolution (automatic scaling) and/or a multiple of the native EFB resolution
|
||||||
static u32 GetTargetWidth() { return s_target_width; }
|
static int GetTargetWidth() { return s_target_width; }
|
||||||
static u32 GetTargetHeight() { return s_target_height; }
|
static int GetTargetHeight() { return s_target_height; }
|
||||||
|
|
||||||
// Display resolution
|
// Display resolution
|
||||||
static u32 GetBackbufferWidth() { return s_backbuffer_width; }
|
static int GetBackbufferWidth() { return s_backbuffer_width; }
|
||||||
static u32 GetBackbufferHeight() { return s_backbuffer_height; }
|
static int GetBackbufferHeight() { return s_backbuffer_height; }
|
||||||
|
|
||||||
static void SetWindowSize(u32 width, u32 height);
|
static void SetWindowSize(int width, int height);
|
||||||
|
|
||||||
// EFB coordinate conversion functions
|
// EFB coordinate conversion functions
|
||||||
|
|
||||||
@ -82,7 +82,7 @@ public:
|
|||||||
virtual TargetRectangle ConvertEFBRectangle(const EFBRectangle& rc) = 0;
|
virtual TargetRectangle ConvertEFBRectangle(const EFBRectangle& rc) = 0;
|
||||||
|
|
||||||
static const TargetRectangle& GetTargetRectangle() { return target_rc; }
|
static const TargetRectangle& GetTargetRectangle() { return target_rc; }
|
||||||
static void UpdateDrawRectangle(u32 backbuffer_width, u32 backbuffer_height);
|
static void UpdateDrawRectangle(int backbuffer_width, int backbuffer_height);
|
||||||
|
|
||||||
|
|
||||||
// Use this to upscale native EFB coordinates to IDEAL internal resolution
|
// Use this to upscale native EFB coordinates to IDEAL internal resolution
|
||||||
@ -132,8 +132,8 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
static void CalculateTargetScale(unsigned int x, unsigned int y, unsigned int &scaledX, unsigned int &scaledY);
|
static void CalculateTargetScale(int x, int y, int &scaledX, int &scaledY);
|
||||||
static bool CalculateTargetSize(unsigned int framebuffer_width, unsigned int framebuffer_height, unsigned int multiplier = 1);
|
static bool CalculateTargetSize(unsigned int framebuffer_width, unsigned int framebuffer_height, int multiplier = 1);
|
||||||
|
|
||||||
static void CheckFifoRecording();
|
static void CheckFifoRecording();
|
||||||
static void RecordVideoMemory();
|
static void RecordVideoMemory();
|
||||||
@ -151,12 +151,12 @@ protected:
|
|||||||
bool bLastFrameDumped;
|
bool bLastFrameDumped;
|
||||||
|
|
||||||
// The framebuffer size
|
// The framebuffer size
|
||||||
static u32 s_target_width;
|
static int s_target_width;
|
||||||
static u32 s_target_height;
|
static int s_target_height;
|
||||||
|
|
||||||
// TODO: Add functionality to reinit all the render targets when the window is resized.
|
// TODO: Add functionality to reinit all the render targets when the window is resized.
|
||||||
static u32 s_backbuffer_width;
|
static int s_backbuffer_width;
|
||||||
static u32 s_backbuffer_height;
|
static int s_backbuffer_height;
|
||||||
|
|
||||||
static TargetRectangle target_rc;
|
static TargetRectangle target_rc;
|
||||||
|
|
||||||
|
@ -193,7 +193,7 @@ void FramebufferManager::GetTargetSize(unsigned int *width, unsigned int *height
|
|||||||
}
|
}
|
||||||
|
|
||||||
void XFBSource::Draw(const MathUtil::Rectangle<float> &sourcerc,
|
void XFBSource::Draw(const MathUtil::Rectangle<float> &sourcerc,
|
||||||
const MathUtil::Rectangle<float> &drawrc, u32 width, u32 height) const
|
const MathUtil::Rectangle<float> &drawrc, int width, int height) const
|
||||||
{
|
{
|
||||||
D3D::drawShadedTexSubQuad(tex->GetSRV(), &sourcerc,
|
D3D::drawShadedTexSubQuad(tex->GetSRV(), &sourcerc,
|
||||||
texWidth, texHeight, &drawrc, PixelShaderCache::GetColorCopyProgram(false),
|
texWidth, texHeight, &drawrc, PixelShaderCache::GetColorCopyProgram(false),
|
||||||
|
@ -64,7 +64,7 @@ struct XFBSource : public XFBSourceBase
|
|||||||
~XFBSource() { tex->Release(); }
|
~XFBSource() { tex->Release(); }
|
||||||
|
|
||||||
void Draw(const MathUtil::Rectangle<float> &sourcerc,
|
void Draw(const MathUtil::Rectangle<float> &sourcerc,
|
||||||
const MathUtil::Rectangle<float> &drawrc, u32 width, u32 height) const;
|
const MathUtil::Rectangle<float> &drawrc, int width, int height) const;
|
||||||
void DecodeToTexture(u32 xfbAddr, u32 fbWidth, u32 fbHeight);
|
void DecodeToTexture(u32 xfbAddr, u32 fbWidth, u32 fbHeight);
|
||||||
void CopyEFB(float Gamma);
|
void CopyEFB(float Gamma);
|
||||||
|
|
||||||
|
@ -691,14 +691,18 @@ void Renderer::UpdateViewport(Matrix44& vpCorrection)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// In D3D, the viewport rectangle must fit within the render target.
|
// In D3D, the viewport rectangle must fit within the render target.
|
||||||
u32 X = intendedX;
|
int X = intendedX;
|
||||||
u32 Y = intendedY;
|
if (X < 0)
|
||||||
u32 Wd = intendedWd;
|
X = 0;
|
||||||
u32 Ht = intendedHt;
|
|
||||||
|
|
||||||
|
int Y = intendedY;
|
||||||
|
if (Y < 0)
|
||||||
|
Y = 0;
|
||||||
|
|
||||||
|
int Wd = intendedWd;
|
||||||
if (X + Wd > GetTargetWidth())
|
if (X + Wd > GetTargetWidth())
|
||||||
Wd = GetTargetWidth() - X;
|
Wd = GetTargetWidth() - X;
|
||||||
|
int Ht = intendedHt;
|
||||||
if (Y + Ht > GetTargetHeight())
|
if (Y + Ht > GetTargetHeight())
|
||||||
Ht = GetTargetHeight() - Y;
|
Ht = GetTargetHeight() - Y;
|
||||||
|
|
||||||
@ -924,17 +928,20 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons
|
|||||||
// Prepare to copy the XFBs to our backbuffer
|
// Prepare to copy the XFBs to our backbuffer
|
||||||
UpdateDrawRectangle(s_backbuffer_width, s_backbuffer_height);
|
UpdateDrawRectangle(s_backbuffer_width, s_backbuffer_height);
|
||||||
|
|
||||||
u32 X = GetTargetRectangle().left;
|
int X = GetTargetRectangle().left;
|
||||||
u32 Y = GetTargetRectangle().top;
|
int Y = GetTargetRectangle().top;
|
||||||
u32 Width = GetTargetRectangle().right - GetTargetRectangle().left;
|
int Width = GetTargetRectangle().right - GetTargetRectangle().left;
|
||||||
u32 Height = GetTargetRectangle().bottom - GetTargetRectangle().top;
|
int Height = GetTargetRectangle().bottom - GetTargetRectangle().top;
|
||||||
|
|
||||||
// TODO: Redundant checks...
|
// TODO: Redundant checks...
|
||||||
|
if (X < 0) X = 0;
|
||||||
|
if (Y < 0) Y = 0;
|
||||||
if (X > s_backbuffer_width) X = s_backbuffer_width;
|
if (X > s_backbuffer_width) X = s_backbuffer_width;
|
||||||
if (Y > s_backbuffer_height) Y = s_backbuffer_height;
|
if (Y > s_backbuffer_height) Y = s_backbuffer_height;
|
||||||
|
if (Width < 0) Width = 0;
|
||||||
|
if (Height < 0) Height = 0;
|
||||||
if (Width > (s_backbuffer_width - X)) Width = s_backbuffer_width - X;
|
if (Width > (s_backbuffer_width - X)) Width = s_backbuffer_width - X;
|
||||||
if (Height > (s_backbuffer_height - Y)) Height = s_backbuffer_height - Y;
|
if (Height > (s_backbuffer_height - Y)) Height = s_backbuffer_height - Y;
|
||||||
|
|
||||||
D3D11_VIEWPORT vp = CD3D11_VIEWPORT((float)X, (float)Y, (float)Width, (float)Height);
|
D3D11_VIEWPORT vp = CD3D11_VIEWPORT((float)X, (float)Y, (float)Width, (float)Height);
|
||||||
D3D::context->RSSetViewports(1, &vp);
|
D3D::context->RSSetViewports(1, &vp);
|
||||||
D3D::context->OMSetRenderTargets(1, &D3D::GetBackBuffer()->GetRTV(), NULL);
|
D3D::context->OMSetRenderTargets(1, &D3D::GetBackBuffer()->GetRTV(), NULL);
|
||||||
|
@ -49,9 +49,9 @@ LPDIRECT3DSURFACE9 back_buffer_z;
|
|||||||
D3DCAPS9 caps;
|
D3DCAPS9 caps;
|
||||||
HWND hWnd;
|
HWND hWnd;
|
||||||
|
|
||||||
static unsigned int multisample;
|
static int multisample;
|
||||||
static unsigned int resolution;
|
static int resolution;
|
||||||
static unsigned int xres, yres;
|
static int xres, yres;
|
||||||
static bool auto_depth_stencil = false;
|
static bool auto_depth_stencil = false;
|
||||||
|
|
||||||
#define VENDOR_NVIDIA 4318
|
#define VENDOR_NVIDIA 4318
|
||||||
@ -480,25 +480,24 @@ const D3DCAPS9 &GetCaps()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// returns true if size was changed
|
// returns true if size was changed
|
||||||
bool FixTextureSize(u32& width, u32& height)
|
bool FixTextureSize(int& width, int& height)
|
||||||
{
|
{
|
||||||
u32 oldw = width;
|
int oldw = width, oldh = height;
|
||||||
u32 oldh = height;
|
|
||||||
|
|
||||||
// conditional nonpow2 support should work fine for us
|
// conditional nonpow2 support should work fine for us
|
||||||
if ((caps.TextureCaps & D3DPTEXTURECAPS_POW2) && !(caps.TextureCaps & D3DPTEXTURECAPS_NONPOW2CONDITIONAL))
|
if ((caps.TextureCaps & D3DPTEXTURECAPS_POW2) && !(caps.TextureCaps & D3DPTEXTURECAPS_NONPOW2CONDITIONAL))
|
||||||
{
|
{
|
||||||
// all texture dimensions need to be powers of two
|
// all texture dimensions need to be powers of two
|
||||||
width = MakePow2(width);
|
width = (int)MakePow2((u32)width);
|
||||||
height = MakePow2(height);
|
height = (int)MakePow2((u32)height);
|
||||||
}
|
}
|
||||||
if (caps.TextureCaps & D3DPTEXTURECAPS_SQUAREONLY)
|
if (caps.TextureCaps & D3DPTEXTURECAPS_SQUAREONLY)
|
||||||
{
|
{
|
||||||
width = height = max(width, height);
|
width = height = max(width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
width = min(width, (u32)caps.MaxTextureWidth);
|
width = min(width, (int)caps.MaxTextureWidth);
|
||||||
height = min(height, (u32)caps.MaxTextureHeight);
|
height = min(height, (int)caps.MaxTextureHeight);
|
||||||
|
|
||||||
return (width != oldw) || (height != oldh);
|
return (width != oldw) || (height != oldh);
|
||||||
}
|
}
|
||||||
@ -516,22 +515,18 @@ bool CheckDepthStencilSupport(D3DFORMAT target_format, D3DFORMAT depth_format)
|
|||||||
|
|
||||||
D3DFORMAT GetSupportedDepthTextureFormat()
|
D3DFORMAT GetSupportedDepthTextureFormat()
|
||||||
{
|
{
|
||||||
for (size_t i = 0; i < sizeof(DepthFormats)/sizeof(D3DFORMAT); ++i)
|
for (int i = 0; i < sizeof(DepthFormats)/sizeof(D3DFORMAT); ++i)
|
||||||
{
|
|
||||||
if (D3D::CheckTextureSupport(D3DUSAGE_DEPTHSTENCIL, DepthFormats[i]))
|
if (D3D::CheckTextureSupport(D3DUSAGE_DEPTHSTENCIL, DepthFormats[i]))
|
||||||
return DepthFormats[i];
|
return DepthFormats[i];
|
||||||
}
|
|
||||||
|
|
||||||
return D3DFMT_UNKNOWN;
|
return D3DFMT_UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
D3DFORMAT GetSupportedDepthSurfaceFormat(D3DFORMAT target_format)
|
D3DFORMAT GetSupportedDepthSurfaceFormat(D3DFORMAT target_format)
|
||||||
{
|
{
|
||||||
for (size_t i = 0; i < sizeof(DepthFormats)/sizeof(D3DFORMAT); ++i)
|
for (int i = 0; i < sizeof(DepthFormats)/sizeof(D3DFORMAT); ++i)
|
||||||
{
|
|
||||||
if (D3D::CheckDepthStencilSupport(target_format, DepthFormats[i]))
|
if (D3D::CheckDepthStencilSupport(target_format, DepthFormats[i]))
|
||||||
return DepthFormats[i];
|
return DepthFormats[i];
|
||||||
}
|
|
||||||
|
|
||||||
return D3DFMT_UNKNOWN;
|
return D3DFMT_UNKNOWN;
|
||||||
}
|
}
|
||||||
@ -572,7 +567,7 @@ void ShowD3DError(HRESULT err)
|
|||||||
PanicAlert("Driver Internal Error");
|
PanicAlert("Driver Internal Error");
|
||||||
break;
|
break;
|
||||||
case D3DERR_OUTOFVIDEOMEMORY:
|
case D3DERR_OUTOFVIDEOMEMORY:
|
||||||
PanicAlert("Out of video memory");
|
PanicAlert("Out of vid mem");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
// MessageBox(0,_T("Other error or success"),_T("ERROR"),0);
|
// MessageBox(0,_T("Other error or success"),_T("ERROR"),0);
|
||||||
|
@ -75,7 +75,7 @@ const char *VertexShaderVersionString();
|
|||||||
void ShowD3DError(HRESULT err);
|
void ShowD3DError(HRESULT err);
|
||||||
|
|
||||||
// returns true if size was changed
|
// returns true if size was changed
|
||||||
bool FixTextureSize(u32& width, u32& height);
|
bool FixTextureSize(int& width, int& height);
|
||||||
|
|
||||||
// returns true if format is supported
|
// returns true if format is supported
|
||||||
bool CheckTextureSupport(DWORD usage, D3DFORMAT tex_format);
|
bool CheckTextureSupport(DWORD usage, D3DFORMAT tex_format);
|
||||||
@ -115,8 +115,8 @@ void EnableAlphaToCoverage();
|
|||||||
struct Resolution
|
struct Resolution
|
||||||
{
|
{
|
||||||
char name[32];
|
char name[32];
|
||||||
unsigned int xres;
|
int xres;
|
||||||
unsigned int yres;
|
int yres;
|
||||||
std::set<D3DFORMAT> bitdepths;
|
std::set<D3DFORMAT> bitdepths;
|
||||||
std::set<int> refreshes;
|
std::set<int> refreshes;
|
||||||
};
|
};
|
||||||
|
@ -365,10 +365,10 @@ int CD3DFont::DrawTextScaled(float x, float y, float fXScale, float fYScale, flo
|
|||||||
*/
|
*/
|
||||||
void drawShadedTexQuad(IDirect3DTexture9 *texture,
|
void drawShadedTexQuad(IDirect3DTexture9 *texture,
|
||||||
const RECT *rSource,
|
const RECT *rSource,
|
||||||
u32 SourceWidth,
|
int SourceWidth,
|
||||||
u32 SourceHeight,
|
int SourceHeight,
|
||||||
u32 DestWidth,
|
int DestWidth,
|
||||||
u32 DestHeight,
|
int DestHeight,
|
||||||
IDirect3DPixelShader9 *PShader,
|
IDirect3DPixelShader9 *PShader,
|
||||||
IDirect3DVertexShader9 *Vshader,
|
IDirect3DVertexShader9 *Vshader,
|
||||||
float Gamma)
|
float Gamma)
|
||||||
@ -399,11 +399,11 @@ void drawShadedTexQuad(IDirect3DTexture9 *texture,
|
|||||||
|
|
||||||
void drawShadedTexSubQuad(IDirect3DTexture9 *texture,
|
void drawShadedTexSubQuad(IDirect3DTexture9 *texture,
|
||||||
const MathUtil::Rectangle<float> *rSource,
|
const MathUtil::Rectangle<float> *rSource,
|
||||||
u32 SourceWidth,
|
int SourceWidth,
|
||||||
u32 SourceHeight,
|
int SourceHeight,
|
||||||
const MathUtil::Rectangle<float> *rDest,
|
const MathUtil::Rectangle<float> *rDest,
|
||||||
u32 DestWidth,
|
int DestWidth,
|
||||||
u32 DestHeight,
|
int DestHeight,
|
||||||
IDirect3DPixelShader9 *PShader,
|
IDirect3DPixelShader9 *PShader,
|
||||||
IDirect3DVertexShader9 *Vshader,
|
IDirect3DVertexShader9 *Vshader,
|
||||||
float Gamma)
|
float Gamma)
|
||||||
|
@ -65,20 +65,20 @@ namespace D3D
|
|||||||
void quad2d(float x1, float y1, float x2, float y2, u32 color, float u1=0, float v1=0, float u2=1, float v2=1);
|
void quad2d(float x1, float y1, float x2, float y2, u32 color, float u1=0, float v1=0, float u2=1, float v2=1);
|
||||||
void drawShadedTexQuad(IDirect3DTexture9 *texture,
|
void drawShadedTexQuad(IDirect3DTexture9 *texture,
|
||||||
const RECT *rSource,
|
const RECT *rSource,
|
||||||
u32 SourceWidth,
|
int SourceWidth,
|
||||||
u32 SourceHeight,
|
int SourceHeight,
|
||||||
u32 DestWidth,
|
int DestWidth,
|
||||||
u32 DestHeight,
|
int DestHeight,
|
||||||
IDirect3DPixelShader9 *PShader,
|
IDirect3DPixelShader9 *PShader,
|
||||||
IDirect3DVertexShader9 *Vshader,
|
IDirect3DVertexShader9 *Vshader,
|
||||||
float Gamma = 1.0f);
|
float Gamma = 1.0f);
|
||||||
void drawShadedTexSubQuad(IDirect3DTexture9 *texture,
|
void drawShadedTexSubQuad(IDirect3DTexture9 *texture,
|
||||||
const MathUtil::Rectangle<float> *rSource,
|
const MathUtil::Rectangle<float> *rSource,
|
||||||
u32 SourceWidth,
|
int SourceWidth,
|
||||||
u32 SourceHeight,
|
int SourceHeight,
|
||||||
const MathUtil::Rectangle<float> *rDest,
|
const MathUtil::Rectangle<float> *rDest,
|
||||||
u32 DestWidth,
|
int DestWidth,
|
||||||
u32 DestHeight,
|
int DestHeight,
|
||||||
IDirect3DPixelShader9 *PShader,
|
IDirect3DPixelShader9 *PShader,
|
||||||
IDirect3DVertexShader9 *Vshader,
|
IDirect3DVertexShader9 *Vshader,
|
||||||
float Gamma = 1.0f);
|
float Gamma = 1.0f);
|
||||||
|
@ -44,8 +44,8 @@ FramebufferManager::Efb FramebufferManager::s_efb;
|
|||||||
FramebufferManager::FramebufferManager()
|
FramebufferManager::FramebufferManager()
|
||||||
{
|
{
|
||||||
bool depth_textures_supported = true;
|
bool depth_textures_supported = true;
|
||||||
u32 target_width = Renderer::GetTargetWidth();
|
int target_width = Renderer::GetTargetWidth();
|
||||||
u32 target_height = Renderer::GetTargetHeight();
|
int target_height = Renderer::GetTargetHeight();
|
||||||
s_efb.color_surface_Format = D3DFMT_A8R8G8B8;
|
s_efb.color_surface_Format = D3DFMT_A8R8G8B8;
|
||||||
|
|
||||||
// EFB color texture - primary render target
|
// EFB color texture - primary render target
|
||||||
@ -161,7 +161,7 @@ void FramebufferManager::GetTargetSize(unsigned int *width, unsigned int *height
|
|||||||
}
|
}
|
||||||
|
|
||||||
void XFBSource::Draw(const MathUtil::Rectangle<float> &sourcerc,
|
void XFBSource::Draw(const MathUtil::Rectangle<float> &sourcerc,
|
||||||
const MathUtil::Rectangle<float> &drawrc, u32 width, u32 height) const
|
const MathUtil::Rectangle<float> &drawrc, int width, int height) const
|
||||||
{
|
{
|
||||||
D3D::drawShadedTexSubQuad(texture, &sourcerc, texWidth, texHeight, &drawrc, width , height,
|
D3D::drawShadedTexSubQuad(texture, &sourcerc, texWidth, texHeight, &drawrc, width , height,
|
||||||
PixelShaderCache::GetColorCopyProgram(0), VertexShaderCache::GetSimpleVertexShader(0));
|
PixelShaderCache::GetColorCopyProgram(0), VertexShaderCache::GetSimpleVertexShader(0));
|
||||||
|
@ -58,7 +58,7 @@ struct XFBSource : public XFBSourceBase
|
|||||||
~XFBSource() { texture->Release(); }
|
~XFBSource() { texture->Release(); }
|
||||||
|
|
||||||
void Draw(const MathUtil::Rectangle<float> &sourcerc,
|
void Draw(const MathUtil::Rectangle<float> &sourcerc,
|
||||||
const MathUtil::Rectangle<float> &drawrc, u32 width, u32 height) const;
|
const MathUtil::Rectangle<float> &drawrc, int width, int height) const;
|
||||||
void DecodeToTexture(u32 xfbAddr, u32 fbWidth, u32 fbHeight);
|
void DecodeToTexture(u32 xfbAddr, u32 fbWidth, u32 fbHeight);
|
||||||
void CopyEFB(float Gamma);
|
void CopyEFB(float Gamma);
|
||||||
|
|
||||||
|
@ -288,10 +288,10 @@ Renderer::Renderer()
|
|||||||
UpdateDrawRectangle(s_backbuffer_width, s_backbuffer_height);
|
UpdateDrawRectangle(s_backbuffer_width, s_backbuffer_height);
|
||||||
|
|
||||||
s_LastAA = g_ActiveConfig.iMultisampleMode;
|
s_LastAA = g_ActiveConfig.iMultisampleMode;
|
||||||
u32 SupersampleCoefficient = (s_LastAA % 3) + 1;
|
int SupersampleCoeficient = (s_LastAA % 3) + 1;
|
||||||
|
|
||||||
s_LastEFBScale = g_ActiveConfig.iEFBScale;
|
s_LastEFBScale = g_ActiveConfig.iEFBScale;
|
||||||
CalculateTargetSize(s_backbuffer_width, s_backbuffer_height, SupersampleCoefficient);
|
CalculateTargetSize(s_backbuffer_width, s_backbuffer_height, SupersampleCoeficient);
|
||||||
|
|
||||||
// Make sure to use valid texture sizes
|
// Make sure to use valid texture sizes
|
||||||
D3D::FixTextureSize(s_target_width, s_target_height);
|
D3D::FixTextureSize(s_target_width, s_target_height);
|
||||||
@ -305,7 +305,7 @@ Renderer::Renderer()
|
|||||||
|
|
||||||
SetupDeviceObjects();
|
SetupDeviceObjects();
|
||||||
|
|
||||||
for (u32 stage = 0; stage < 8; stage++)
|
for (int stage = 0; stage < 8; stage++)
|
||||||
D3D::SetSamplerState(stage, D3DSAMP_MAXANISOTROPY, 1 << g_ActiveConfig.iMaxAnisotropy);
|
D3D::SetSamplerState(stage, D3DSAMP_MAXANISOTROPY, 1 << g_ActiveConfig.iMaxAnisotropy);
|
||||||
|
|
||||||
D3DVIEWPORT9 vp;
|
D3DVIEWPORT9 vp;
|
||||||
@ -468,10 +468,8 @@ u32 Renderer::AccessEFB(EFBAccessType type, u32 x, u32 y, u32 poke_data)
|
|||||||
|
|
||||||
// if depth textures aren't supported by the hardware, just return
|
// if depth textures aren't supported by the hardware, just return
|
||||||
if (type == PEEK_Z)
|
if (type == PEEK_Z)
|
||||||
{
|
|
||||||
if (FramebufferManager::GetEFBDepthTexture() == NULL)
|
if (FramebufferManager::GetEFBDepthTexture() == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
|
||||||
|
|
||||||
// We're using three surfaces here:
|
// We're using three surfaces here:
|
||||||
// - pEFBSurf: EFB Surface. Source surface when peeking, destination surface when poking.
|
// - pEFBSurf: EFB Surface. Source surface when peeking, destination surface when poking.
|
||||||
@ -695,14 +693,16 @@ void Renderer::UpdateViewport(Matrix44& vpCorrection)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// In D3D, the viewport rectangle must fit within the render target.
|
// In D3D, the viewport rectangle must fit within the render target.
|
||||||
u32 X = intendedX;
|
int X = intendedX;
|
||||||
u32 Y = intendedY;
|
if (X < 0)
|
||||||
u32 Wd = intendedWd;
|
X = 0;
|
||||||
u32 Ht = intendedHt;
|
int Y = intendedY;
|
||||||
|
if (Y < 0)
|
||||||
|
Y = 0;
|
||||||
|
int Wd = intendedWd;
|
||||||
if (X + Wd > GetTargetWidth())
|
if (X + Wd > GetTargetWidth())
|
||||||
Wd = GetTargetWidth() - X;
|
Wd = GetTargetWidth() - X;
|
||||||
|
int Ht = intendedHt;
|
||||||
if (Y + Ht > GetTargetHeight())
|
if (Y + Ht > GetTargetHeight())
|
||||||
Ht = GetTargetHeight() - Y;
|
Ht = GetTargetHeight() - Y;
|
||||||
|
|
||||||
@ -907,14 +907,18 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons
|
|||||||
D3D::dev->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0, 0, 0), 1.0f, 0);
|
D3D::dev->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0, 0, 0), 1.0f, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 X = GetTargetRectangle().left;
|
int X = GetTargetRectangle().left;
|
||||||
u32 Y = GetTargetRectangle().top;
|
int Y = GetTargetRectangle().top;
|
||||||
u32 Width = (GetTargetRectangle().right - GetTargetRectangle().left);
|
int Width = GetTargetRectangle().right - GetTargetRectangle().left;
|
||||||
u32 Height = (GetTargetRectangle().bottom - GetTargetRectangle().top);
|
int Height = GetTargetRectangle().bottom - GetTargetRectangle().top;
|
||||||
|
|
||||||
// Sanity check
|
// Sanity check
|
||||||
|
if (X < 0) X = 0;
|
||||||
|
if (Y < 0) Y = 0;
|
||||||
if (X > s_backbuffer_width) X = s_backbuffer_width;
|
if (X > s_backbuffer_width) X = s_backbuffer_width;
|
||||||
if (Y > s_backbuffer_height) Y = s_backbuffer_height;
|
if (Y > s_backbuffer_height) Y = s_backbuffer_height;
|
||||||
|
if (Width < 0) Width = 0;
|
||||||
|
if (Height < 0) Height = 0;
|
||||||
if (Width > (s_backbuffer_width - X)) Width = s_backbuffer_width - X;
|
if (Width > (s_backbuffer_width - X)) Width = s_backbuffer_width - X;
|
||||||
if (Height > (s_backbuffer_height - Y)) Height = s_backbuffer_height - Y;
|
if (Height > (s_backbuffer_height - Y)) Height = s_backbuffer_height - Y;
|
||||||
|
|
||||||
@ -1149,10 +1153,10 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons
|
|||||||
|
|
||||||
UpdateDrawRectangle(s_backbuffer_width, s_backbuffer_height);
|
UpdateDrawRectangle(s_backbuffer_width, s_backbuffer_height);
|
||||||
|
|
||||||
u32 SupersampleCoefficient = (s_LastAA % 3) + 1;
|
int SupersampleCoeficient = (s_LastAA % 3) + 1;
|
||||||
|
|
||||||
s_LastEFBScale = g_ActiveConfig.iEFBScale;
|
s_LastEFBScale = g_ActiveConfig.iEFBScale;
|
||||||
CalculateTargetSize(s_backbuffer_width, s_backbuffer_height, SupersampleCoefficient);
|
CalculateTargetSize(s_backbuffer_width, s_backbuffer_height, SupersampleCoeficient);
|
||||||
|
|
||||||
D3D::dev->SetRenderTarget(0, D3D::GetBackBufferSurface());
|
D3D::dev->SetRenderTarget(0, D3D::GetBackBufferSurface());
|
||||||
D3D::dev->SetDepthStencilSurface(D3D::GetBackBufferDepthSurface());
|
D3D::dev->SetDepthStencilSurface(D3D::GetBackBufferDepthSurface());
|
||||||
|
@ -299,7 +299,7 @@ GLuint FramebufferManager::ResolveAndGetDepthTarget(const EFBRectangle &source_r
|
|||||||
}
|
}
|
||||||
|
|
||||||
void XFBSource::Draw(const MathUtil::Rectangle<float> &sourcerc,
|
void XFBSource::Draw(const MathUtil::Rectangle<float> &sourcerc,
|
||||||
const MathUtil::Rectangle<float> &drawrc, u32 width, u32 height) const
|
const MathUtil::Rectangle<float> &drawrc, int width, int height) const
|
||||||
{
|
{
|
||||||
// Texture map xfbSource->texture onto the main buffer
|
// Texture map xfbSource->texture onto the main buffer
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ struct XFBSource : public XFBSourceBase
|
|||||||
void CopyEFB(float Gamma);
|
void CopyEFB(float Gamma);
|
||||||
void DecodeToTexture(u32 xfbAddr, u32 fbWidth, u32 fbHeight);
|
void DecodeToTexture(u32 xfbAddr, u32 fbWidth, u32 fbHeight);
|
||||||
void Draw(const MathUtil::Rectangle<float> &sourcerc,
|
void Draw(const MathUtil::Rectangle<float> &sourcerc,
|
||||||
const MathUtil::Rectangle<float> &drawrc, u32 width, u32 height) const;
|
const MathUtil::Rectangle<float> &drawrc, int width, int height) const;
|
||||||
|
|
||||||
const GLuint texture;
|
const GLuint texture;
|
||||||
};
|
};
|
||||||
|
@ -323,8 +323,8 @@ Renderer::Renderer()
|
|||||||
return; // TODO: fail
|
return; // TODO: fail
|
||||||
|
|
||||||
// Decide frambuffer size
|
// Decide frambuffer size
|
||||||
s_backbuffer_width = GLInterface->GetBackBufferWidth();
|
s_backbuffer_width = (int)GLInterface->GetBackBufferWidth();
|
||||||
s_backbuffer_height = GLInterface->GetBackBufferHeight();
|
s_backbuffer_height = (int)GLInterface->GetBackBufferHeight();
|
||||||
|
|
||||||
// Handle VSync on/off
|
// Handle VSync on/off
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
@ -1047,7 +1047,7 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons
|
|||||||
// Textured triangles are necessary because of post-processing shaders
|
// Textured triangles are necessary because of post-processing shaders
|
||||||
|
|
||||||
// Disable all other stages
|
// Disable all other stages
|
||||||
for (unsigned int i = 1; i < 8; ++i)
|
for (int i = 1; i < 8; ++i)
|
||||||
OGL::TextureCache::DisableStage(i);
|
OGL::TextureCache::DisableStage(i);
|
||||||
|
|
||||||
// Update GLViewPort
|
// Update GLViewPort
|
||||||
|
Loading…
x
Reference in New Issue
Block a user