mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 14:19:46 -06: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 8743166663
.
This commit is contained in:
@ -49,9 +49,9 @@ LPDIRECT3DSURFACE9 back_buffer_z;
|
||||
D3DCAPS9 caps;
|
||||
HWND hWnd;
|
||||
|
||||
static unsigned int multisample;
|
||||
static unsigned int resolution;
|
||||
static unsigned int xres, yres;
|
||||
static int multisample;
|
||||
static int resolution;
|
||||
static int xres, yres;
|
||||
static bool auto_depth_stencil = false;
|
||||
|
||||
#define VENDOR_NVIDIA 4318
|
||||
@ -480,25 +480,24 @@ const D3DCAPS9 &GetCaps()
|
||||
}
|
||||
|
||||
// returns true if size was changed
|
||||
bool FixTextureSize(u32& width, u32& height)
|
||||
bool FixTextureSize(int& width, int& height)
|
||||
{
|
||||
u32 oldw = width;
|
||||
u32 oldh = height;
|
||||
int oldw = width, oldh = height;
|
||||
|
||||
// conditional nonpow2 support should work fine for us
|
||||
if ((caps.TextureCaps & D3DPTEXTURECAPS_POW2) && !(caps.TextureCaps & D3DPTEXTURECAPS_NONPOW2CONDITIONAL))
|
||||
{
|
||||
// all texture dimensions need to be powers of two
|
||||
width = MakePow2(width);
|
||||
height = MakePow2(height);
|
||||
width = (int)MakePow2((u32)width);
|
||||
height = (int)MakePow2((u32)height);
|
||||
}
|
||||
if (caps.TextureCaps & D3DPTEXTURECAPS_SQUAREONLY)
|
||||
{
|
||||
width = height = max(width, height);
|
||||
}
|
||||
|
||||
width = min(width, (u32)caps.MaxTextureWidth);
|
||||
height = min(height, (u32)caps.MaxTextureHeight);
|
||||
width = min(width, (int)caps.MaxTextureWidth);
|
||||
height = min(height, (int)caps.MaxTextureHeight);
|
||||
|
||||
return (width != oldw) || (height != oldh);
|
||||
}
|
||||
@ -516,22 +515,18 @@ bool CheckDepthStencilSupport(D3DFORMAT target_format, D3DFORMAT depth_format)
|
||||
|
||||
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]))
|
||||
return DepthFormats[i];
|
||||
}
|
||||
|
||||
return D3DFMT_UNKNOWN;
|
||||
}
|
||||
|
||||
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]))
|
||||
return DepthFormats[i];
|
||||
}
|
||||
|
||||
return D3DFMT_UNKNOWN;
|
||||
}
|
||||
@ -572,7 +567,7 @@ void ShowD3DError(HRESULT err)
|
||||
PanicAlert("Driver Internal Error");
|
||||
break;
|
||||
case D3DERR_OUTOFVIDEOMEMORY:
|
||||
PanicAlert("Out of video memory");
|
||||
PanicAlert("Out of vid mem");
|
||||
break;
|
||||
default:
|
||||
// MessageBox(0,_T("Other error or success"),_T("ERROR"),0);
|
||||
|
@ -75,7 +75,7 @@ const char *VertexShaderVersionString();
|
||||
void ShowD3DError(HRESULT err);
|
||||
|
||||
// returns true if size was changed
|
||||
bool FixTextureSize(u32& width, u32& height);
|
||||
bool FixTextureSize(int& width, int& height);
|
||||
|
||||
// returns true if format is supported
|
||||
bool CheckTextureSupport(DWORD usage, D3DFORMAT tex_format);
|
||||
@ -115,8 +115,8 @@ void EnableAlphaToCoverage();
|
||||
struct Resolution
|
||||
{
|
||||
char name[32];
|
||||
unsigned int xres;
|
||||
unsigned int yres;
|
||||
int xres;
|
||||
int yres;
|
||||
std::set<D3DFORMAT> bitdepths;
|
||||
std::set<int> refreshes;
|
||||
};
|
||||
|
@ -365,10 +365,10 @@ int CD3DFont::DrawTextScaled(float x, float y, float fXScale, float fYScale, flo
|
||||
*/
|
||||
void drawShadedTexQuad(IDirect3DTexture9 *texture,
|
||||
const RECT *rSource,
|
||||
u32 SourceWidth,
|
||||
u32 SourceHeight,
|
||||
u32 DestWidth,
|
||||
u32 DestHeight,
|
||||
int SourceWidth,
|
||||
int SourceHeight,
|
||||
int DestWidth,
|
||||
int DestHeight,
|
||||
IDirect3DPixelShader9 *PShader,
|
||||
IDirect3DVertexShader9 *Vshader,
|
||||
float Gamma)
|
||||
@ -399,11 +399,11 @@ void drawShadedTexQuad(IDirect3DTexture9 *texture,
|
||||
|
||||
void drawShadedTexSubQuad(IDirect3DTexture9 *texture,
|
||||
const MathUtil::Rectangle<float> *rSource,
|
||||
u32 SourceWidth,
|
||||
u32 SourceHeight,
|
||||
int SourceWidth,
|
||||
int SourceHeight,
|
||||
const MathUtil::Rectangle<float> *rDest,
|
||||
u32 DestWidth,
|
||||
u32 DestHeight,
|
||||
int DestWidth,
|
||||
int DestHeight,
|
||||
IDirect3DPixelShader9 *PShader,
|
||||
IDirect3DVertexShader9 *Vshader,
|
||||
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 drawShadedTexQuad(IDirect3DTexture9 *texture,
|
||||
const RECT *rSource,
|
||||
u32 SourceWidth,
|
||||
u32 SourceHeight,
|
||||
u32 DestWidth,
|
||||
u32 DestHeight,
|
||||
int SourceWidth,
|
||||
int SourceHeight,
|
||||
int DestWidth,
|
||||
int DestHeight,
|
||||
IDirect3DPixelShader9 *PShader,
|
||||
IDirect3DVertexShader9 *Vshader,
|
||||
float Gamma = 1.0f);
|
||||
void drawShadedTexSubQuad(IDirect3DTexture9 *texture,
|
||||
const MathUtil::Rectangle<float> *rSource,
|
||||
u32 SourceWidth,
|
||||
u32 SourceHeight,
|
||||
int SourceWidth,
|
||||
int SourceHeight,
|
||||
const MathUtil::Rectangle<float> *rDest,
|
||||
u32 DestWidth,
|
||||
u32 DestHeight,
|
||||
int DestWidth,
|
||||
int DestHeight,
|
||||
IDirect3DPixelShader9 *PShader,
|
||||
IDirect3DVertexShader9 *Vshader,
|
||||
float Gamma = 1.0f);
|
||||
|
@ -44,8 +44,8 @@ FramebufferManager::Efb FramebufferManager::s_efb;
|
||||
FramebufferManager::FramebufferManager()
|
||||
{
|
||||
bool depth_textures_supported = true;
|
||||
u32 target_width = Renderer::GetTargetWidth();
|
||||
u32 target_height = Renderer::GetTargetHeight();
|
||||
int target_width = Renderer::GetTargetWidth();
|
||||
int target_height = Renderer::GetTargetHeight();
|
||||
s_efb.color_surface_Format = D3DFMT_A8R8G8B8;
|
||||
|
||||
// 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,
|
||||
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,
|
||||
PixelShaderCache::GetColorCopyProgram(0), VertexShaderCache::GetSimpleVertexShader(0));
|
||||
|
@ -58,7 +58,7 @@ struct XFBSource : public XFBSourceBase
|
||||
~XFBSource() { texture->Release(); }
|
||||
|
||||
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 CopyEFB(float Gamma);
|
||||
|
||||
|
@ -288,10 +288,10 @@ Renderer::Renderer()
|
||||
UpdateDrawRectangle(s_backbuffer_width, s_backbuffer_height);
|
||||
|
||||
s_LastAA = g_ActiveConfig.iMultisampleMode;
|
||||
u32 SupersampleCoefficient = (s_LastAA % 3) + 1;
|
||||
int SupersampleCoeficient = (s_LastAA % 3) + 1;
|
||||
|
||||
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
|
||||
D3D::FixTextureSize(s_target_width, s_target_height);
|
||||
@ -305,7 +305,7 @@ Renderer::Renderer()
|
||||
|
||||
SetupDeviceObjects();
|
||||
|
||||
for (u32 stage = 0; stage < 8; stage++)
|
||||
for (int stage = 0; stage < 8; stage++)
|
||||
D3D::SetSamplerState(stage, D3DSAMP_MAXANISOTROPY, 1 << g_ActiveConfig.iMaxAnisotropy);
|
||||
|
||||
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 (type == PEEK_Z)
|
||||
{
|
||||
if (FramebufferManager::GetEFBDepthTexture() == NULL)
|
||||
return 0;
|
||||
}
|
||||
|
||||
// We're using three surfaces here:
|
||||
// - 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.
|
||||
u32 X = intendedX;
|
||||
u32 Y = intendedY;
|
||||
u32 Wd = intendedWd;
|
||||
u32 Ht = intendedHt;
|
||||
|
||||
int X = intendedX;
|
||||
if (X < 0)
|
||||
X = 0;
|
||||
int Y = intendedY;
|
||||
if (Y < 0)
|
||||
Y = 0;
|
||||
int Wd = intendedWd;
|
||||
if (X + Wd > GetTargetWidth())
|
||||
Wd = GetTargetWidth() - X;
|
||||
|
||||
int Ht = intendedHt;
|
||||
if (Y + Ht > GetTargetHeight())
|
||||
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);
|
||||
}
|
||||
|
||||
u32 X = GetTargetRectangle().left;
|
||||
u32 Y = GetTargetRectangle().top;
|
||||
u32 Width = (GetTargetRectangle().right - GetTargetRectangle().left);
|
||||
u32 Height = (GetTargetRectangle().bottom - GetTargetRectangle().top);
|
||||
int X = GetTargetRectangle().left;
|
||||
int Y = GetTargetRectangle().top;
|
||||
int Width = GetTargetRectangle().right - GetTargetRectangle().left;
|
||||
int Height = GetTargetRectangle().bottom - GetTargetRectangle().top;
|
||||
|
||||
// Sanity check
|
||||
if (X < 0) X = 0;
|
||||
if (Y < 0) Y = 0;
|
||||
if (X > s_backbuffer_width) X = s_backbuffer_width;
|
||||
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 (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);
|
||||
|
||||
u32 SupersampleCoefficient = (s_LastAA % 3) + 1;
|
||||
int SupersampleCoeficient = (s_LastAA % 3) + 1;
|
||||
|
||||
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->SetDepthStencilSurface(D3D::GetBackBufferDepthSurface());
|
||||
|
Reference in New Issue
Block a user