GSdx: Purge Direct3D9 Render entirely. (#2762)

And the time has come to say good bye (good riddance?), this build removes Direct3D9 entirely from GSdx. D3D9 is/was holding us back in some D3D11 fixes that we want to further implement.
The last build that supports D3D9 is v1.5.0-dev-2779-g1a61148b0 for anyone still interested.

"Press F to pay respect.
This commit is contained in:
lightningterror 2018-12-20 00:54:51 +01:00 committed by GitHub
parent e091f4233a
commit fce3918562
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
38 changed files with 20 additions and 3569 deletions

View File

@ -21,10 +21,6 @@
#define GLSL 0
#endif
#if defined(SHADER_MODEL) && (SHADER_MODEL <= 0x300)
#error GSdx FX is not compatible with the D3D9 backend. Use OpenGL or D3D10|11.
#endif
/*------------------------------------------------------------------------------
[GLOBALS|FUNCTIONS]
------------------------------------------------------------------------------*/

View File

@ -207,18 +207,13 @@ set(GSdxHeaders
if(Windows)
LIST(APPEND GSdxSources
Renderers/DX11/GSDevice11.cpp
Renderers/DX9/GSDevice9.cpp
Renderers/DXCommon/GSDeviceDX.cpp
Window/GSDialog.cpp
Renderers/DX11/GSRendererDX11.cpp
Renderers/DX9/GSRendererDX9.cpp
Renderers/DXCommon/GSRendererDX.cpp
Renderers/DX11/GSTexture11.cpp
Renderers/DX9/GSTexture9.cpp
Renderers/DX11/GSTextureCache11.cpp
Renderers/DX9/GSTextureCache9.cpp
Renderers/DX11/GSTextureFX11.cpp
Renderers/DX9/GSTextureFX9.cpp
GSVertexList.cpp
Renderers/SW/GSVertexSW.cpp
Window/GSCaptureDlg.cpp
@ -230,15 +225,11 @@ if(Windows)
LIST(APPEND GSdxHeaders
Renderers/DX11/GSDevice11.h
Renderers/DX9/GSDevice9.h
Renderers/DXCommon/GSDeviceDX.h
Renderers/DX11/GSRendererDX11.h
Renderers/DX9/GSRendererDX9.h
Renderers/DXCommon/GSRendererDX.h
Renderers/DX11/GSTexture11.h
Renderers/DX9/GSTexture9.h
Renderers/DX11/GSTextureCache11.h
Renderers/DX9/GSTextureCache9.h
Window/GSWndDX.h
Window/GSWndWGL.h
PSX/GPUSettingsDlg.h

View File

@ -32,9 +32,7 @@
#ifdef _WIN32
#include "Renderers/DX9/GSRendererDX9.h"
#include "Renderers/DX11/GSRendererDX11.h"
#include "Renderers/DX9/GSDevice9.h"
#include "Renderers/DX11/GSDevice11.h"
#include "Window/GSWndDX.h"
#include "Window/GSWndWGL.h"
@ -331,7 +329,6 @@ static int _GSopen(void** dsp, const char* title, GSRendererType renderer, int t
switch (renderer)
{
case GSRendererType::DX9_SW:
case GSRendererType::DX1011_SW:
case GSRendererType::OGL_SW:
renderer_mode = "(Software renderer)";
@ -339,7 +336,6 @@ static int _GSopen(void** dsp, const char* title, GSRendererType renderer, int t
case GSRendererType::Null:
renderer_mode = "(Null renderer)";
break;
case GSRendererType::DX9_OpenCL:
case GSRendererType::DX1011_OpenCL:
case GSRendererType::OGL_OpenCL:
renderer_mode = "(OpenCL)";
@ -353,13 +349,6 @@ static int _GSopen(void** dsp, const char* title, GSRendererType renderer, int t
{
default:
#ifdef _WIN32
case GSRendererType::DX9_HW:
case GSRendererType::DX9_SW:
case GSRendererType::DX9_OpenCL:
dev = new GSDevice9();
s_renderer_name = " D3D9";
renderer_fullname = "Direct3D 9";
break;
case GSRendererType::DX1011_HW:
case GSRendererType::DX1011_SW:
case GSRendererType::DX1011_OpenCL:
@ -395,10 +384,6 @@ static int _GSopen(void** dsp, const char* title, GSRendererType renderer, int t
{
default:
#ifdef _WIN32
case GSRendererType::DX9_HW:
s_gs = (GSRenderer*)new GSRendererDX9();
s_renderer_type = " HW";
break;
case GSRendererType::DX1011_HW:
s_gs = (GSRenderer*)new GSRendererDX11();
s_renderer_type = " HW";
@ -408,7 +393,6 @@ static int _GSopen(void** dsp, const char* title, GSRendererType renderer, int t
s_gs = (GSRenderer*)new GSRendererOGL();
s_renderer_type = " HW";
break;
case GSRendererType::DX9_SW:
case GSRendererType::DX1011_SW:
case GSRendererType::OGL_SW:
s_gs = new GSRendererSW(threads);
@ -418,7 +402,6 @@ static int _GSopen(void** dsp, const char* title, GSRendererType renderer, int t
s_gs = new GSRendererNull();
s_renderer_type = "";
break;
case GSRendererType::DX9_OpenCL:
case GSRendererType::DX1011_OpenCL:
case GSRendererType::OGL_OpenCL:
#ifdef ENABLE_OPENCL
@ -494,18 +477,13 @@ EXPORT_C_(int) GSopen2(void** dsp, uint32 flags)
if (renderer != GSRendererType::Undefined && stored_toggle_state != toggle_state)
{
#ifdef _WIN32
GSRendererType best_sw_renderer = GSUtil::CheckDirect3D11Level() >= D3D_FEATURE_LEVEL_10_0 ? GSRendererType::DX1011_SW : GSRendererType::DX9_SW;
switch (renderer) {
// Use alternative renderer (SW if currently using HW renderer, and vice versa, keeping the same API and API version)
case GSRendererType::DX9_SW: renderer = GSRendererType::DX9_HW; break;
case GSRendererType::DX9_HW: renderer = GSRendererType::DX9_SW; break;
case GSRendererType::DX1011_SW: renderer = GSRendererType::DX1011_HW; break;
case GSRendererType::DX1011_HW: renderer = GSRendererType::DX1011_SW; break;
case GSRendererType::OGL_SW: renderer = GSRendererType::OGL_HW; break;
case GSRendererType::OGL_HW: renderer = GSRendererType::OGL_SW; break;
default: renderer = best_sw_renderer; break;// If wasn't using one of the above mentioned ones, use best SW renderer.
case GSRendererType::DX1011_SW: renderer = GSRendererType::DX1011_HW; break;
case GSRendererType::DX1011_HW: renderer = GSRendererType::DX1011_SW; break;
case GSRendererType::OGL_SW: renderer = GSRendererType::OGL_HW; break;
case GSRendererType::OGL_HW: renderer = GSRendererType::OGL_SW; break;
default: renderer = GSRendererType::DX1011_SW; break; // If wasn't using one of the above mentioned ones, use best SW renderer.
}
#endif
@ -552,7 +530,7 @@ EXPORT_C_(int) GSopen(void** dsp, const char* title, int mt)
#ifdef _WIN32
renderer = GSUtil::CheckDirect3D11Level() >= D3D_FEATURE_LEVEL_10_0 ? GSRendererType::DX1011_SW : GSRendererType::DX9_SW;
renderer = GSRendererType::DX1011_SW;
#endif

View File

@ -231,8 +231,6 @@ enum class GS_MIN_FILTER : uint8_t
enum class GSRendererType : int8_t
{
Undefined = -1,
DX9_HW,
DX9_SW,
DX1011_HW = 3,
DX1011_SW,
Null = 11,

View File

@ -87,7 +87,6 @@ GSLocalMemory::GSLocalMemory()
m_use_fifo_alloc = theApp.GetConfigB("UserHacks") && theApp.GetConfigB("wrap_gs_mem");
switch (theApp.GetCurrentRendererType()) {
case GSRendererType::OGL_SW:
case GSRendererType::DX9_SW:
case GSRendererType::DX1011_SW:
m_use_fifo_alloc = true;
break;

View File

@ -426,12 +426,10 @@ GSRendererType GSUtil::GetBestRenderer()
// Check for Nvidia VendorID. Latest OpenGL features need at least DX11 level GPU
if (desc.VendorId == 0x10DE && level >= D3D_FEATURE_LEVEL_11_0)
return GSRendererType::OGL_HW;
if (level >= D3D_FEATURE_LEVEL_10_0)
return GSRendererType::DX1011_HW;
}
}
}
return GSRendererType::DX9_HW;
return GSRendererType::DX1011_HW;
}
#endif

View File

@ -346,8 +346,6 @@ void GSdxApp::Init()
m_default_configuration["Adapter"] = "default";
m_default_configuration["CaptureFileName"] = "";
m_default_configuration["CaptureVideoCodecDisplayName"] = "";
m_default_configuration["fba"] = "1";
m_default_configuration["logz"] = "0";
#else
m_default_configuration["linux_replay"] = "1";
#endif

View File

@ -99,16 +99,12 @@ IDR_TFX_FS_GLSL RCDATA "res\\glsl\\tfx_fs.glsl";
// Bitmap
//
IDB_LOGO9 BITMAP "res\\logo9.bmp"
IDB_LOGO11 BITMAP "res\\logo11.bmp"
IDB_LOGOGL BITMAP "res\\logo-ogl.bmp"
IDB_NULL BITMAP "res\\logo-null.bmp"
IDB_PSX_LOGO9 BITMAP "res\\psx-logo9.bmp"
IDB_PSX_LOGO11 BITMAP "res\\psx-logo11.bmp"
IDB_PSX_NULL BITMAP "res\\psx-logo-null.bmp"
@ -252,7 +248,6 @@ STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSM
CAPTION "Settings..."
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
CONTROL IDB_PSX_LOGO9,IDC_PSX_LOGO9,"Static",SS_BITMAP,7,7,175,42
CONTROL IDB_PSX_LOGO11,IDC_PSX_LOGO11,"Static",SS_BITMAP,7,7,175,42
CONTROL IDB_PSX_NULL,IDC_PSX_NULL,"Static",SS_BITMAP,7,7,175,42
LTEXT "Resolution:",IDC_STATIC,7,59,37,8
@ -281,7 +276,6 @@ CAPTION "GSdx Settings"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
// General Settings:
CONTROL IDB_LOGO9,IDC_LOGO9,"Static",SS_BITMAP | SS_REALSIZECONTROL,6,6,230,44
CONTROL IDB_LOGO11,IDC_LOGO11,"Static",SS_BITMAP | SS_REALSIZECONTROL,6,6,230,44
CONTROL IDB_LOGOGL,IDC_LOGOGL,"Static",SS_BITMAP | SS_REALSIZECONTROL,6,6,230,44
CONTROL IDB_NULL,IDC_NULL,"Static",SS_BITMAP | SS_REALSIZECONTROL,6,6,230,44
@ -322,9 +316,6 @@ BEGIN
COMBOBOX IDC_ACCURATE_DATE,105,253,127,118,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "Blending Unit Accuracy:",IDC_ACCURATE_BLEND_UNIT_TEXT,22,271,79,8
COMBOBOX IDC_ACCURATE_BLEND_UNIT,105,269,127,118,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
// Direct3D 9 (Hardware) Settings:
CONTROL "Alpha Correction",IDC_FBA,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,271,74,10
CONTROL "Logarithmic Z",IDC_LOGZ,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,105,271,90,10
// Software Renderer Settings:
GROUPBOX "Software Renderer Settings",IDC_STATIC,6,295,231,40,BS_CENTER
CONTROL "Edge Anti-aliasing (AA1)",IDC_AA1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,306,91,10

View File

@ -102,7 +102,6 @@
<ClCompile Include="GSCrc.cpp" />
<ClCompile Include="Renderers\Common\GSDevice.cpp" />
<ClCompile Include="Renderers\DX11\GSDevice11.cpp" />
<ClCompile Include="Renderers\DX9\GSDevice9.cpp" />
<ClCompile Include="Renderers\DXCommon\GSDeviceDX.cpp" />
<ClCompile Include="Renderers\Null\GSDeviceNull.cpp" />
<ClCompile Include="Renderers\OpenGL\GSDeviceOGL.cpp" />
@ -131,7 +130,6 @@
<ClCompile Include="Renderers\OpenCL\GSRendererCL.cpp" />
<ClCompile Include="Renderers\DXCommon\GSRendererDX.cpp" />
<ClCompile Include="Renderers\DX11\GSRendererDX11.cpp" />
<ClCompile Include="Renderers\DX9\GSRendererDX9.cpp" />
<ClCompile Include="Renderers\HW\GSRendererHW.cpp" />
<ClCompile Include="Renderers\Null\GSRendererNull.cpp" />
<ClCompile Include="Renderers\OpenGL\GSRendererOGL.cpp" />
@ -150,15 +148,12 @@
<ClCompile Include="GSTables.cpp" />
<ClCompile Include="Renderers\Common\GSTexture.cpp" />
<ClCompile Include="Renderers\DX11\GSTexture11.cpp" />
<ClCompile Include="Renderers\DX9\GSTexture9.cpp" />
<ClCompile Include="Renderers\OpenGL\GSTextureOGL.cpp" />
<ClCompile Include="Renderers\Common\GSTextureCache.cpp" />
<ClCompile Include="Renderers\DX11\GSTextureCache11.cpp" />
<ClCompile Include="Renderers\DX9\GSTextureCache9.cpp" />
<ClCompile Include="Renderers\OpenGL\GSTextureCacheOGL.cpp" />
<ClCompile Include="Renderers\SW\GSTextureCacheSW.cpp" />
<ClCompile Include="Renderers\DX11\GSTextureFX11.cpp" />
<ClCompile Include="Renderers\DX9\GSTextureFX9.cpp" />
<ClCompile Include="Renderers\Null\GSTextureNull.cpp" />
<ClCompile Include="Renderers\SW\GSTextureSW.cpp" />
<ClCompile Include="GSUtil.cpp" />
@ -196,7 +191,6 @@
<ClInclude Include="GSCrc.h" />
<ClInclude Include="Renderers\Common\GSDevice.h" />
<ClInclude Include="Renderers\DX11\GSDevice11.h" />
<ClInclude Include="Renderers\DX9\GSDevice9.h" />
<ClInclude Include="Renderers\DXCommon\GSDeviceDX.h" />
<ClInclude Include="Renderers\Null\GSDeviceNull.h" />
<ClInclude Include="Renderers\OpenGL\GSDeviceOGL.h" />
@ -220,7 +214,6 @@
<ClInclude Include="Renderers\OpenCL\GSRendererCL.h" />
<ClInclude Include="Renderers\DXCommon\GSRendererDX.h" />
<ClInclude Include="Renderers\DX11\GSRendererDX11.h" />
<ClInclude Include="Renderers\DX9\GSRendererDX9.h" />
<ClInclude Include="Renderers\HW\GSRendererHW.h" />
<ClInclude Include="Renderers\Null\GSRendererNull.h" />
<ClInclude Include="Renderers\OpenGL\GSRendererOGL.h" />
@ -234,11 +227,9 @@
<ClInclude Include="GSTables.h" />
<ClInclude Include="Renderers\Common\GSTexture.h" />
<ClInclude Include="Renderers\DX11\GSTexture11.h" />
<ClInclude Include="Renderers\DX9\GSTexture9.h" />
<ClInclude Include="Renderers\OpenGL\GSTextureOGL.h" />
<ClInclude Include="Renderers\Common\GSTextureCache.h" />
<ClInclude Include="Renderers\DX11\GSTextureCache11.h" />
<ClInclude Include="Renderers\DX9\GSTextureCache9.h" />
<ClInclude Include="Renderers\OpenGL\GSTextureCacheOGL.h" />
<ClInclude Include="Renderers\SW\GSTextureCacheSW.h" />
<ClInclude Include="Renderers\Null\GSTextureNull.h" />
@ -284,7 +275,6 @@
<ItemGroup>
<None Include="GSdx.def" />
<None Include="res\fxaa.fx" />
<None Include="res\logo9.bmp" />
<None Include="res\logo_ogl.bmp" />
<None Include="res\convert.fx" />
<None Include="res\interlace.fx" />
@ -302,7 +292,6 @@
<Image Include="res\logo11.bmp" />
<Image Include="res\psx-logo-null.bmp" />
<Image Include="res\psx-logo11.bmp" />
<Image Include="res\psx-logo9.bmp" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\3rdparty\freetype\builds\windows\freetype.vcxproj">

View File

@ -51,9 +51,6 @@
<ClCompile Include="Renderers\DX11\GSDevice11.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Renderers\DX9\GSDevice9.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Renderers\Null\GSDeviceNull.cpp">
<Filter>Source Files</Filter>
</ClCompile>
@ -105,9 +102,6 @@
<ClCompile Include="Renderers\DX11\GSRendererDX11.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Renderers\DX9\GSRendererDX9.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Renderers\HW\GSRendererHW.cpp">
<Filter>Source Files</Filter>
</ClCompile>
@ -141,9 +135,6 @@
<ClCompile Include="Renderers\DX11\GSTexture11.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Renderers\DX9\GSTexture9.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Renderers\OpenGL\GSTextureOGL.cpp">
<Filter>Source Files</Filter>
</ClCompile>
@ -153,9 +144,6 @@
<ClCompile Include="Renderers\DX11\GSTextureCache11.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Renderers\DX9\GSTextureCache9.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Renderers\OpenGL\GSTextureCacheOGL.cpp">
<Filter>Source Files</Filter>
</ClCompile>
@ -165,9 +153,6 @@
<ClCompile Include="Renderers\DX11\GSTextureFX11.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Renderers\DX9\GSTextureFX9.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Renderers\Null\GSTextureNull.cpp">
<Filter>Source Files</Filter>
</ClCompile>
@ -326,9 +311,6 @@
<ClInclude Include="Renderers\DX11\GSDevice11.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Renderers\DX9\GSDevice9.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Renderers\DXCommon\GSDeviceDX.h">
<Filter>Header Files</Filter>
</ClInclude>
@ -386,9 +368,6 @@
<ClInclude Include="Renderers\DX11\GSRendererDX11.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Renderers\DX9\GSRendererDX9.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Renderers\HW\GSRendererHW.h">
<Filter>Header Files</Filter>
</ClInclude>
@ -428,9 +407,6 @@
<ClInclude Include="Renderers\DX11\GSTexture11.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Renderers\DX9\GSTexture9.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Renderers\OpenGL\GSTextureOGL.h">
<Filter>Header Files</Filter>
</ClInclude>
@ -440,9 +416,6 @@
<ClInclude Include="Renderers\DX11\GSTextureCache11.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Renderers\DX9\GSTextureCache9.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Renderers\OpenGL\GSTextureCacheOGL.h">
<Filter>Header Files</Filter>
</ClInclude>
@ -583,9 +556,6 @@
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="res\logo9.bmp">
<Filter>Resource Files</Filter>
</None>
<None Include="res\convert.fx">
<Filter>Shaders</Filter>
</None>
@ -627,9 +597,6 @@
<Image Include="res\logo-null.bmp">
<Filter>Resource Files</Filter>
</Image>
<Image Include="res\psx-logo9.bmp">
<Filter>Resource Files</Filter>
</Image>
<Image Include="res\psx-logo11.bmp">
<Filter>Resource Files</Filter>
</Image>

View File

@ -28,7 +28,6 @@
#ifdef _WIN32
#include "GPUSettingsDlg.h"
#include "Renderers/DX9/GSDevice9.h"
#include "Renderers/DX11/GSDevice11.h"
static HRESULT s_hr = E_FAIL;
@ -141,13 +140,12 @@ EXPORT_C_(int32) GPUopen(void* hWnd)
switch(renderer)
{
#ifdef _WIN32
case GPURendererType::D3D9_SW: s_gpu = new GPURendererSW(new GSDevice9(), threads); break;
case GPURendererType::D3D11_SW: s_gpu = new GPURendererSW(new GSDevice11(), threads); break;
#endif
case GPURendererType::NULL_Renderer: s_gpu = new GPURendererSW(new GSDeviceNull(), threads); break;
default: // Fall back to D3D9/null mode if unknown value is read. No one could possibly enter here anyway.
#ifdef _WIN32
s_gpu = new GPURendererSW(new GSDevice9(), threads); break;
s_gpu = new GPURendererSW(new GSDevice11(), threads); break;
#else
s_gpu = new GPURendererSW(new GSDeviceNull(), threads); break;
#endif

View File

@ -23,7 +23,6 @@
#include "Renderers/Common/GSTextureCache.h"
#include "GSUtil.h"
bool s_IS_DIRECT3D9 = false;
bool GSTextureCache::m_disable_partial_invalidation = false;
bool GSTextureCache::m_wrap_gs_mem = false;
@ -31,8 +30,6 @@ GSTextureCache::GSTextureCache(GSRenderer* r)
: m_renderer(r)
, m_palette_map(r)
{
s_IS_DIRECT3D9 = theApp.GetCurrentRendererType() == GSRendererType::DX9_HW;
if (theApp.GetConfigB("UserHacks")) {
m_spritehack = theApp.GetConfigI("UserHacks_SpriteHack");
UserHacks_HalfPixelOffset = theApp.GetConfigI("UserHacks_HalfPixelOffset") == 1;
@ -54,7 +51,6 @@ GSTextureCache::GSTextureCache(GSRenderer* r)
}
m_paltex = theApp.GetConfigB("paltex");
m_can_convert_depth &= !s_IS_DIRECT3D9; // not supported on D3D9
m_crc_hack_level = theApp.GetConfigT<CRCHackLevel>("crc_hack_level");
if (m_crc_hack_level == CRCHackLevel::Automatic)
m_crc_hack_level = GSUtil::GetRecommendedCRCHackLevel(theApp.GetCurrentRendererType());
@ -1182,7 +1178,7 @@ GSTextureCache::Source* GSTextureCache::CreateSource(const GIFRegTEX0& TEX0, con
// TODO: clean up this mess
int shader = dst->m_type != RenderTarget ? ShaderConvert_FLOAT32_TO_RGBA8 : ShaderConvert_COPY;
bool is_8bits = TEX0.PSM == PSM_PSMT8 && !s_IS_DIRECT3D9;
bool is_8bits = TEX0.PSM == PSM_PSMT8;
if (is_8bits) {
GL_INS("Reading RT as a packed-indexed 8 bits format");

View File

@ -226,7 +226,6 @@ public:
void SetupOM(OMDepthStencilSelector dssel, OMBlendSelector bsel, uint8 afix);
bool HasStencil() { return true; }
bool HasDepth32() { return true; }
ID3D11Device* operator->() {return m_dev;}
operator ID3D11Device*() {return m_dev;}

File diff suppressed because it is too large Load Diff

View File

@ -1,257 +0,0 @@
/*
* Copyright (C) 2007-2009 Gabest
* http://www.gabest.org
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
#pragma once
#include "Renderers/DXCommon/GSDeviceDX.h"
#include "GSTexture9.h"
struct Direct3DSamplerState9
{
D3DTEXTUREFILTERTYPE FilterMin[2];
D3DTEXTUREFILTERTYPE FilterMag[2];
D3DTEXTUREFILTERTYPE FilterMip[2];
D3DTEXTUREFILTERTYPE Anisotropic[2];
D3DTEXTUREADDRESS AddressU;
D3DTEXTUREADDRESS AddressV;
D3DTEXTUREADDRESS AddressW;
DWORD MaxAnisotropy;
DWORD MaxLOD;
};
struct Direct3DDepthStencilState9
{
BOOL DepthEnable;
BOOL DepthWriteMask;
D3DCMPFUNC DepthFunc;
BOOL StencilEnable;
UINT8 StencilReadMask;
UINT8 StencilWriteMask;
D3DSTENCILOP StencilFailOp;
D3DSTENCILOP StencilDepthFailOp;
D3DSTENCILOP StencilPassOp;
D3DCMPFUNC StencilFunc;
uint32 StencilRef;
};
struct Direct3DBlendState9
{
BOOL BlendEnable;
D3DBLEND SrcBlend;
D3DBLEND DestBlend;
D3DBLENDOP BlendOp;
D3DBLEND SrcBlendAlpha;
D3DBLEND DestBlendAlpha;
D3DBLENDOP BlendOpAlpha;
UINT8 RenderTargetWriteMask;
};
struct GSVertexShader9
{
CComPtr<IDirect3DVertexShader9> vs;
CComPtr<IDirect3DVertexDeclaration9> il;
};
class GSDevice9 : public GSDeviceDX
{
GSTexture* CreateSurface(int type, int w, int h, bool msaa, int format);
void DoMerge(GSTexture* sTex[3], GSVector4* sRect, GSTexture* dTex, GSVector4* dRect, const GSRegPMODE& PMODE, const GSRegEXTBUF& EXTBUF, const GSVector4& c);
void DoInterlace(GSTexture* sTex, GSTexture* dTex, int shader, bool linear, float yoffset = 0);
void DoFXAA(GSTexture* sTex, GSTexture* dTex);
void DoShadeBoost(GSTexture* sTex, GSTexture* dTex);
void DoExternalFX(GSTexture* sTex, GSTexture* dTex);
void InitExternalFX();
void InitFXAA();
//
D3DCAPS9 m_d3dcaps;
D3DPRESENT_PARAMETERS m_pp;
CComPtr<IDirect3D9> m_d3d;
CComPtr<IDirect3DDevice9> m_dev;
CComPtr<IDirect3DSwapChain9> m_swapchain;
CComPtr<IDirect3DVertexBuffer9> m_vb;
CComPtr<IDirect3DVertexBuffer9> m_vb_old;
CComPtr<IDirect3DIndexBuffer9> m_ib;
CComPtr<IDirect3DIndexBuffer9> m_ib_old;
bool m_lost;
D3DFORMAT m_depth_format;
int m_mipmap;
struct
{
IDirect3DVertexBuffer9* vb;
size_t vb_stride;
IDirect3DIndexBuffer9* ib;
IDirect3DVertexDeclaration9* layout;
D3DPRIMITIVETYPE topology;
IDirect3DVertexShader9* vs;
float* vs_cb;
int vs_cb_len;
IDirect3DTexture9* ps_srvs[3];
IDirect3DPixelShader9* ps;
float* ps_cb;
int ps_cb_len;
Direct3DSamplerState9* ps_ss;
GSVector4i scissor;
Direct3DDepthStencilState9* dss;
Direct3DBlendState9* bs;
uint32 bf;
IDirect3DSurface9* rtv;
IDirect3DSurface9* dsv;
} m_state;
public: // TODO
bool FXAA_Compiled;
bool ExShader_Compiled;
struct
{
CComPtr<IDirect3DVertexDeclaration9> il;
CComPtr<IDirect3DVertexShader9> vs;
CComPtr<IDirect3DPixelShader9> ps[10];
Direct3DSamplerState9 ln;
Direct3DSamplerState9 pt;
Direct3DDepthStencilState9 dss;
Direct3DBlendState9 bs;
} m_convert;
struct
{
CComPtr<IDirect3DPixelShader9> ps[2];
Direct3DBlendState9 bs;
} m_merge;
struct
{
CComPtr<IDirect3DPixelShader9> ps[4];
} m_interlace;
struct
{
CComPtr<IDirect3DPixelShader9> ps;
} m_shaderfx;
struct
{
CComPtr<IDirect3DPixelShader9> ps;
} m_fxaa;
struct
{
CComPtr<IDirect3DPixelShader9> ps;
} m_shadeboost;
struct
{
Direct3DDepthStencilState9 dss;
Direct3DBlendState9 bs;
} m_date;
void SetupDATE(GSTexture* rt, GSTexture* ds, const GSVertexPT1* vertices, bool datm);
// Shaders...
std::unordered_map<uint32, GSVertexShader9> m_vs;
std::unordered_map<uint64, CComPtr<IDirect3DPixelShader9>> m_ps;
std::unordered_map<uint32, Direct3DSamplerState9*> m_ps_ss;
std::unordered_map<uint32, Direct3DDepthStencilState9*> m_om_dss;
std::unordered_map<uint32, Direct3DBlendState9*> m_om_bs;
std::unordered_map<uint32, GSTexture*> m_mskfix;
GSTexture* CreateMskFix(uint32 size, uint32 msk, uint32 fix);
public:
GSDevice9();
virtual ~GSDevice9();
bool Create(const std::shared_ptr<GSWnd> &wnd);
bool Reset(int w, int h);
bool IsLost(bool update);
void Flip();
void SetVSync(int vsync);
void BeginScene();
void DrawPrimitive();
void DrawIndexedPrimitive();
void EndScene();
void ClearRenderTarget(GSTexture* t, const GSVector4& c);
void ClearRenderTarget(GSTexture* t, uint32 c);
void ClearDepth(GSTexture* t);
void ClearStencil(GSTexture* t, uint8 c);
GSTexture* CreateRenderTarget(int w, int h, bool msaa, int format = 0);
GSTexture* CreateDepthStencil(int w, int h, bool msaa, int format = 0);
GSTexture* CreateTexture(int w, int h, int format = 0);
GSTexture* CreateOffscreen(int w, int h, int format = 0);
GSTexture* Resolve(GSTexture* t);
GSTexture* CopyOffscreen(GSTexture* src, const GSVector4& sRect, int w, int h, int format = 0, int ps_shader = 0);
void CopyRect(GSTexture* sTex, GSTexture* dTex, const GSVector4i& r);
void StretchRect(GSTexture* sTex, const GSVector4& sRect, GSTexture* dTex, const GSVector4& dRect, int shader = 0, bool linear = true);
void StretchRect(GSTexture* sTex, const GSVector4& sRect, GSTexture* dTex, const GSVector4& dRect, IDirect3DPixelShader9* ps, const float* ps_cb, int ps_cb_len, bool linear = true);
void StretchRect(GSTexture* sTex, const GSVector4& sRect, GSTexture* dTex, const GSVector4& dRect, IDirect3DPixelShader9* ps, const float* ps_cb, int ps_cb_len, Direct3DBlendState9* bs, bool linear = true);
void IASetVertexBuffer(const void* vertex, size_t stride, size_t count);
bool IAMapVertexBuffer(void** vertex, size_t stride, size_t count);
void IAUnmapVertexBuffer();
void IASetVertexBuffer(IDirect3DVertexBuffer9* vb, size_t stride);
void IASetIndexBuffer(const void* index, size_t count);
void IASetIndexBuffer(IDirect3DIndexBuffer9* ib);
void IASetInputLayout(IDirect3DVertexDeclaration9* layout);
void IASetPrimitiveTopology(D3DPRIMITIVETYPE topology);
void VSSetShader(IDirect3DVertexShader9* vs, const float* vs_cb, int vs_cb_len);
void PSSetShaderResources(GSTexture* sr0, GSTexture* sr1);
void PSSetShaderResource(int i, GSTexture* sr);
void PSSetShader(IDirect3DPixelShader9* ps, const float* ps_cb, int ps_cb_len);
void PSSetSamplerState(Direct3DSamplerState9* ss);
void OMSetDepthStencilState(Direct3DDepthStencilState9* dss);
void OMSetBlendState(Direct3DBlendState9* bs, uint32 bf);
void OMSetRenderTargets(GSTexture* rt, GSTexture* ds, const GSVector4i* scissor = NULL);
IDirect3DDevice9* operator->() {return m_dev;}
operator IDirect3DDevice9*() {return m_dev;}
void CompileShader(const char *source, size_t size, const char *filename, const std::string& entry, const D3D_SHADER_MACRO* macro, IDirect3DVertexShader9** vs, const D3DVERTEXELEMENT9* layout, int count, IDirect3DVertexDeclaration9** il);
void CompileShader(const char *source, size_t size, const char *filename, const std::string& entry, const D3D_SHADER_MACRO* macro, IDirect3DPixelShader9** ps);
void SetupVS(VSSelector sel, const VSConstantBuffer* cb);
void SetupGS(GSSelector sel, const GSConstantBuffer* cb) {}
void SetupPS(PSSelector sel, const PSConstantBuffer* cb, PSSamplerSelector ssel);
void SetupOM(OMDepthStencilSelector dssel, OMBlendSelector bsel, uint8 afix);
bool HasStencil() { return m_depth_format == D3DFMT_D24S8; }
bool HasDepth32() { return m_depth_format != D3DFMT_D24S8; }
static uint32 GetMaxDepth(uint32 msaaCount = 0, std::string adapter_id = "");
static void ForceValidMsaaConfig();
};

View File

@ -1,296 +0,0 @@
/*
* Copyright (C) 2007-2009 Gabest
* http://www.gabest.org
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
#include "stdafx.h"
#include "GSRendererDX9.h"
#include "GSCrc.h"
#include "resource.h"
GSRendererDX9::GSRendererDX9()
: GSRendererDX(new GSTextureCache9(this))
{
}
bool GSRendererDX9::CreateDevice(GSDevice* dev)
{
if(!__super::CreateDevice(dev))
return false;
//
memset(&m_fba.dss, 0, sizeof(m_fba.dss));
m_fba.dss.StencilEnable = true;
m_fba.dss.StencilReadMask = 2;
m_fba.dss.StencilWriteMask = 2;
m_fba.dss.StencilFunc = D3DCMP_EQUAL;
m_fba.dss.StencilPassOp = D3DSTENCILOP_ZERO;
m_fba.dss.StencilFailOp = D3DSTENCILOP_ZERO;
m_fba.dss.StencilDepthFailOp = D3DSTENCILOP_ZERO;
m_fba.dss.StencilRef = 2;
memset(&m_fba.bs, 0, sizeof(m_fba.bs));
m_fba.bs.RenderTargetWriteMask = D3DCOLORWRITEENABLE_ALPHA;
//
return true;
}
void GSRendererDX9::EmulateChannelShuffle(GSTexture** rt, const GSTextureCache::Source* tex)
{
// Channel shuffle will never be supported on Direct3D9 through shaders so just
// use code that skips the bad draw calls.
if (m_channel_shuffle)
{
if (m_game.title == CRC::Tekken5)
{
if (m_context->FRAME.FBW == 1)
{
// Used in stages: Secret Garden, Acid Rain, Moonlit Wilderness
// 12 pages: 2 calls by channel, 3 channels, 1 blit
// Minus current draw call
m_skip = 12 * (3 + 3 + 1) - 1;
}
else
{
// Could skip model drawing if wrongly detected
m_channel_shuffle = false;
}
}
else if ((tex->m_texture->GetType() == GSTexture::DepthStencil) && !(tex->m_32_bits_fmt))
{
// So far 2 games hit this code path. Urban Chaos and Tales of Abyss.
throw GSDXRecoverableError();
}
else if (m_index.tail <= 64 && m_context->CLAMP.WMT == 3)
{
// Blood will tell. I think it is channel effect too but again
// implemented in a different way. I don't want to add more CRC stuff. So
// let's disable channel when the signature is different.
//
// Note: Tales Of Abyss and Tekken5 could hit this path too. Those games are
// handled above.
m_channel_shuffle = false;
}
else if (m_context->CLAMP.WMS == 3 && ((m_context->CLAMP.MAXU & 0x8) == 8))
{
// Read either blue or Alpha.
// MGS3/Kill Zone
throw GSDXRecoverableError();
}
else if (m_context->CLAMP.WMS == 3 && ((m_context->CLAMP.MINU & 0x8) == 0))
{
// Read either Red or Green.
// Terminator 3
throw GSDXRecoverableError();
}
else
{
m_channel_shuffle = false;
}
}
}
void GSRendererDX9::EmulateTextureShuffleAndFbmask()
{
if (m_texture_shuffle)
{
// Texture shuffle is not supported so make sure nothing is written on all channels.
m_om_bsel.wrgba = 0;
}
else
{
m_ps_sel.dfmt = GSLocalMemory::m_psm[m_context->FRAME.PSM].fmt;
m_om_bsel.wrgba = ~GSVector4i::load((int)m_context->FRAME.FBMSK).eq8(GSVector4i::xffffffff()).mask();
}
}
void GSRendererDX9::SetupIA(const float& sx, const float& sy)
{
D3DPRIMITIVETYPE topology;
switch(m_vt.m_primclass)
{
case GS_POINT_CLASS:
topology = D3DPT_POINTLIST;
break;
case GS_LINE_CLASS:
topology = D3DPT_LINELIST;
if(PRIM->IIP == 0)
{
for(size_t i = 0, j = m_index.tail; i < j; i += 2)
{
uint32 tmp = m_index.buff[i + 0];
m_index.buff[i + 0] = m_index.buff[i + 1];
m_index.buff[i + 1] = tmp;
}
}
break;
case GS_TRIANGLE_CLASS:
topology = D3DPT_TRIANGLELIST;
if(PRIM->IIP == 0)
{
for(size_t i = 0, j = m_index.tail; i < j; i += 3)
{
uint32 tmp = m_index.buff[i + 0];
m_index.buff[i + 0] = m_index.buff[i + 2];
m_index.buff[i + 2] = tmp;
}
}
break;
case GS_SPRITE_CLASS:
topology = D3DPT_TRIANGLELIST;
// each sprite converted to quad needs twice the space
Lines2Sprites();
break;
default:
__assume(0);
}
GSDevice9* dev = (GSDevice9*)m_dev;
(*dev)->SetRenderState(D3DRS_SHADEMODE, PRIM->IIP ? D3DSHADE_GOURAUD : D3DSHADE_FLAT); // TODO
void* ptr = NULL;
if(dev->IAMapVertexBuffer(&ptr, sizeof(GSVertexHW9), m_vertex.next))
{
GSVertex* RESTRICT s = (GSVertex*)m_vertex.buff;
GSVertexHW9* RESTRICT d = (GSVertexHW9*)ptr;
for(uint32 i = 0; i < m_vertex.next; i++, s++, d++)
{
GSVector4 p = GSVector4(GSVector4i::load(s->XYZ.u32[0]).upl16());
if(PRIM->TME && !PRIM->FST)
{
p = p.xyxy(GSVector4((float)s->XYZ.Z, s->RGBAQ.Q));
}
else
{
p = p.xyxy(GSVector4::load((float)s->XYZ.Z));
}
GSVector4 t = GSVector4::zero();
if(PRIM->TME)
{
if(PRIM->FST)
{
if(UserHacks_WildHack && !isPackedUV_HackFlag)
{
t = GSVector4(GSVector4i::load(s->UV & 0x3FEF3FEF).upl16());
//printf("GSDX: %08X | D3D9(%d) %s\n", s->UV & 0x3FEF3FEF, m_vertex.next, i == 0 ? "*" : "");
}
else
{
t = GSVector4(GSVector4i::load(s->UV).upl16());
}
}
else
{
t = GSVector4::loadl(&s->ST);
}
}
t = t.xyxy(GSVector4::cast(GSVector4i(s->RGBAQ.u32[0], s->FOG)));
d->p = p;
d->t = t;
}
dev->IAUnmapVertexBuffer();
}
dev->IASetIndexBuffer(m_index.buff, m_index.tail);
dev->IASetPrimitiveTopology(topology);
}
void GSRendererDX9::UpdateFBA(GSTexture* rt)
{
if (!rt)
return;
GSDevice9* dev = (GSDevice9*)m_dev;
dev->BeginScene();
// om
dev->OMSetDepthStencilState(&m_fba.dss);
dev->OMSetBlendState(&m_fba.bs, 0);
// ia
GSVector4 s = GSVector4(rt->GetScale().x / rt->GetWidth(), rt->GetScale().y / rt->GetHeight());
GSVector4 off = GSVector4(-1.0f, 1.0f);
GSVector4 src = ((m_vt.m_min.p.xyxy(m_vt.m_max.p) + off.xxyy()) * s.xyxy()).sat(off.zzyy());
GSVector4 dst = src * 2.0f + off.xxxx();
GSVertexPT1 vertices[] =
{
{GSVector4(dst.x, -dst.y, 0.5f, 1.0f), GSVector2(0)},
{GSVector4(dst.z, -dst.y, 0.5f, 1.0f), GSVector2(0)},
{GSVector4(dst.x, -dst.w, 0.5f, 1.0f), GSVector2(0)},
{GSVector4(dst.z, -dst.w, 0.5f, 1.0f), GSVector2(0)},
};
dev->IASetVertexBuffer(vertices, sizeof(vertices[0]), countof(vertices));
dev->IASetInputLayout(dev->m_convert.il);
dev->IASetPrimitiveTopology(D3DPT_TRIANGLESTRIP);
// vs
dev->VSSetShader(dev->m_convert.vs, NULL, 0);
// ps
dev->PSSetShader(dev->m_convert.ps[4], NULL, 0);
//
dev->DrawPrimitive();
//
dev->EndScene();
}

View File

@ -1,47 +0,0 @@
/*
* Copyright (C) 2007-2009 Gabest
* http://www.gabest.org
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
#pragma once
#include "Renderers/DXCommon/GSRendererDX.h"
#include "Renderers/HW/GSVertexHW.h"
#include "GSTextureCache9.h"
class GSRendererDX9 : public GSRendererDX
{
protected:
struct
{
Direct3DDepthStencilState9 dss;
Direct3DBlendState9 bs;
} m_fba;
void EmulateTextureShuffleAndFbmask();
void EmulateChannelShuffle(GSTexture** rt, const GSTextureCache::Source* tex);
void SetupIA(const float& sx, const float& sy);
void UpdateFBA(GSTexture* rt);
public:
GSRendererDX9();
virtual ~GSRendererDX9() {}
bool CreateDevice(GSDevice* dev);
};

View File

@ -1,249 +0,0 @@
/*
* Copyright (C) 2007-2009 Gabest
* http://www.gabest.org
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
#include "stdafx.h"
#include "GSTexture9.h"
#include "GSPng.h"
GSTexture9::GSTexture9(IDirect3DSurface9* surface)
: m_surface(surface), m_layer(0), m_generate_mipmap(true)
{
surface->GetDevice(&m_dev);
surface->GetDesc(&m_desc);
m_max_layer = 1;
if(m_desc.Type != D3DRTYPE_SURFACE)
{
surface->GetContainer(__uuidof(IDirect3DTexture9), (void**)&m_texture);
ASSERT(m_texture != NULL);
m_max_layer = m_texture->GetLevelCount();
}
m_size.x = (int)m_desc.Width;
m_size.y = (int)m_desc.Height;
if(m_desc.Usage & D3DUSAGE_RENDERTARGET) m_type = RenderTarget;
else if(m_desc.Usage & D3DUSAGE_DEPTHSTENCIL) m_type = DepthStencil;
else if(m_desc.Pool == D3DPOOL_MANAGED) m_type = Texture;
else if(m_desc.Pool == D3DPOOL_SYSTEMMEM) m_type = Offscreen;
m_format = (int)m_desc.Format;
m_msaa = m_desc.MultiSampleType != D3DMULTISAMPLE_NONE;
}
GSTexture9::GSTexture9(IDirect3DTexture9* texture)
: m_texture(texture), m_layer(0), m_generate_mipmap(true)
{
texture->GetDevice(&m_dev);
texture->GetLevelDesc(0, &m_desc);
texture->GetSurfaceLevel(0, &m_surface);
ASSERT(m_surface != NULL);
m_size.x = (int)m_desc.Width;
m_size.y = (int)m_desc.Height;
if(m_desc.Usage & D3DUSAGE_RENDERTARGET) m_type = RenderTarget;
else if(m_desc.Usage & D3DUSAGE_DEPTHSTENCIL) m_type = DepthStencil;
else if(m_desc.Pool == D3DPOOL_MANAGED) m_type = Texture;
else if(m_desc.Pool == D3DPOOL_SYSTEMMEM) m_type = Offscreen;
m_format = (int)m_desc.Format;
m_msaa = m_desc.MultiSampleType > 1;
m_max_layer = m_texture->GetLevelCount();
}
GSTexture9::~GSTexture9()
{
}
bool GSTexture9::Update(const GSVector4i& r, const void* data, int pitch, int layer)
{
if(layer >= m_max_layer)
return true;
if(m_texture)
{
m_surface = nullptr;
m_texture->GetSurfaceLevel(layer, &m_surface);
}
if(m_surface)
{
D3DLOCKED_RECT lr;
if(SUCCEEDED(m_surface->LockRect(&lr, r, 0)))
{
uint8* src = (uint8*)data;
uint8* dst = (uint8*)lr.pBits;
int bytes = r.width() * sizeof(uint32);
switch(m_desc.Format)
{
case D3DFMT_A8: bytes >>= 2; break;
case D3DFMT_A1R5G5B5: bytes >>= 1; break;
default: ASSERT(m_desc.Format == D3DFMT_A8R8G8B8); break;
}
bytes = std::min(bytes, pitch);
bytes = std::min(bytes, lr.Pitch);
for(int i = 0, j = r.height(); i < j; i++, src += pitch, dst += lr.Pitch)
{
memcpy(dst, src, bytes);
}
m_surface->UnlockRect();
m_generate_mipmap = true;
return true;
}
}
return false;
}
bool GSTexture9::Map(GSMap& m, const GSVector4i* r, int layer)
{
HRESULT hr;
if(layer >= m_max_layer)
return false;
if(m_texture)
{
m_surface = nullptr;
m_texture->GetSurfaceLevel(layer, &m_surface);
}
if(m_surface)
{
D3DLOCKED_RECT lr;
if(SUCCEEDED(hr = m_surface->LockRect(&lr, (LPRECT)r, 0)))
{
m.bits = (uint8*)lr.pBits;
m.pitch = (int)lr.Pitch;
m_layer = layer;
return true;
}
}
return false;
}
void GSTexture9::Unmap()
{
if(m_surface)
{
m_surface->UnlockRect();
m_generate_mipmap = true;
}
}
bool GSTexture9::Save(const std::string& fn, bool dds)
{
bool rb_swapped = true;
CComPtr<IDirect3DSurface9> surface;
D3DSURFACE_DESC desc;
m_surface->GetDesc(&desc);
if (m_desc.Usage & D3DUSAGE_DEPTHSTENCIL && desc.Format != D3DFMT_D32F_LOCKABLE)
{
return false;
}
if (desc.Format == D3DFMT_A8 || desc.Pool == D3DPOOL_MANAGED || desc.Usage == D3DUSAGE_DEPTHSTENCIL)
{
surface = m_surface;
rb_swapped = false;
}
else
{
HRESULT hr;
hr = m_dev->CreateOffscreenPlainSurface(desc.Width, desc.Height, desc.Format, D3DPOOL_SYSTEMMEM, &surface, nullptr);
if (FAILED(hr))
{
return false;
}
hr = m_dev->GetRenderTargetData(m_surface, surface);
if (FAILED(hr))
{
return false;
}
}
GSPng::Format format;
switch (desc.Format)
{
case D3DFMT_A8:
format = GSPng::R8I_PNG;
break;
case D3DFMT_A8R8G8B8:
format = dds? GSPng::RGBA_PNG : GSPng::RGB_PNG;
break;
case D3DFMT_D32F_LOCKABLE:
format = GSPng::RGB_A_PNG;
break;
default:
fprintf(stderr, "D3DFMT %d not saved to image\n", desc.Format);
return false;
}
D3DLOCKED_RECT slr;
HRESULT hr = surface->LockRect(&slr, nullptr, 0);
if (FAILED(hr))
{
return false;
}
int compression = theApp.GetConfigI("png_compression_level");
bool success = GSPng::Save(format, fn, static_cast<uint8*>(slr.pBits), desc.Width, desc.Height, slr.Pitch, compression, rb_swapped);
surface->UnlockRect();
return success;
}
GSTexture9::operator IDirect3DSurface9*()
{
return m_surface;
}
GSTexture9::operator IDirect3DTexture9*()
{
return m_texture;
}

View File

@ -1,50 +0,0 @@
/*
* Copyright (C) 2007-2009 Gabest
* http://www.gabest.org
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
#pragma once
#include "Renderers/Common/GSTexture.h"
class GSTexture9 : public GSTexture
{
CComPtr<IDirect3DDevice9> m_dev;
CComPtr<IDirect3DSurface9> m_surface;
CComPtr<IDirect3DTexture9> m_texture;
D3DSURFACE_DESC m_desc;
bool m_generate_mipmap;
int m_layer;
int m_max_layer;
public:
explicit GSTexture9(IDirect3DSurface9* surface);
explicit GSTexture9(IDirect3DTexture9* texture);
virtual ~GSTexture9();
bool Update(const GSVector4i& r, const void* data, int pitch, int layer = 0);
bool Map(GSMap& m, const GSVector4i* r = NULL, int layer = 0);
void Unmap();
bool Save(const std::string& fn, bool dds = false);
operator IDirect3DSurface9*();
operator IDirect3DTexture9*();
};

View File

@ -1,121 +0,0 @@
/*
* Copyright (C) 2007-2009 Gabest
* http://www.gabest.org
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
#include "StdAfx.h"
#include "GSTextureCache9.h"
// GSTextureCache9
GSTextureCache9::GSTextureCache9(GSRenderer* r)
: GSTextureCache(r)
{
}
void GSTextureCache9::Read(Target* t, const GSVector4i& r)
{
if(t->m_type != RenderTarget)
{
// TODO
return;
}
const GIFRegTEX0& TEX0 = t->m_TEX0;
if(TEX0.PSM != PSM_PSMCT32
&& TEX0.PSM != PSM_PSMCT24
&& TEX0.PSM != PSM_PSMCT16
&& TEX0.PSM != PSM_PSMCT16S)
{
//ASSERT(0);
return;
}
if (!t->m_dirty.empty() || r.width() == 0 || r.height() == 0)
{
return;
}
// printf("GSRenderTarget::Read %d,%d - %d,%d (%08x)\n", r.left, r.top, r.right, r.bottom, TEX0.TBP0);
int w = r.width();
int h = r.height();
GSVector4 src = GSVector4(r) * GSVector4(t->m_texture->GetScale()).xyxy() / GSVector4(t->m_texture->GetSize()).xyxy();
if(GSTexture* offscreen = m_renderer->m_dev->CopyOffscreen(t->m_texture, src, w, h))
{
GSTexture::GSMap m;
if(offscreen->Map(m))
{
// TODO: block level write
GSOffset* off = m_renderer->m_mem.GetOffset(TEX0.TBP0, TEX0.TBW, TEX0.PSM);
switch(TEX0.PSM)
{
case PSM_PSMCT32:
m_renderer->m_mem.WritePixel32(m.bits, m.pitch, off, r);
break;
case PSM_PSMCT24:
m_renderer->m_mem.WritePixel24(m.bits, m.pitch, off, r);
break;
case PSM_PSMCT16:
case PSM_PSMCT16S:
m_renderer->m_mem.WriteFrame16(m.bits, m.pitch, off, r);
break;
default:
ASSERT(0);
}
offscreen->Unmap();
}
m_renderer->m_dev->Recycle(offscreen);
}
}
void GSTextureCache9::Read(Source* t, const GSVector4i& r)
{
// FIXME: copy was copyied from openGL. It is unlikely to work.
const GIFRegTEX0& TEX0 = t->m_TEX0;
if (GSTexture* offscreen = m_renderer->m_dev->CreateOffscreen(r.width(), r.height())) {
m_renderer->m_dev->CopyRect(t->m_texture, offscreen, r);
GSTexture::GSMap m;
GSVector4i r_offscreen(0, 0, r.width(), r.height());
if (offscreen->Map(m, &r_offscreen)) {
GSOffset* off = m_renderer->m_mem.GetOffset(TEX0.TBP0, TEX0.TBW, TEX0.PSM);
m_renderer->m_mem.WritePixel32(m.bits, m.pitch, off, r);
offscreen->Unmap();
}
// FIXME invalidate data
m_renderer->m_dev->Recycle(offscreen);
}
}

View File

@ -1,39 +0,0 @@
/*
* Copyright (C) 2007-2009 Gabest
* http://www.gabest.org
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
#pragma once
#include "Renderers/Common/GSTextureCache.h"
#include "GSDevice9.h"
class GSTextureCache9 : public GSTextureCache
{
protected:
int Get8bitFormat() {return D3DFMT_A8;}
void Read(Target* t, const GSVector4i& r);
void Read(Source* t, const GSVector4i& r);
virtual bool CanConvertDepth() { return false; }
public:
GSTextureCache9(GSRenderer* r);
};

View File

@ -1,334 +0,0 @@
/*
* Copyright (C) 2007-2009 Gabest
* http://www.gabest.org
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
#include "stdafx.h"
#include "GSDevice9.h"
#include "resource.h"
#include "GSTables.h"
GSTexture* GSDevice9::CreateMskFix(uint32 size, uint32 msk, uint32 fix)
{
GSTexture* t = NULL;
uint32 hash = (size << 20) | (msk << 10) | fix;
auto i = m_mskfix.find(hash);
if(i != m_mskfix.end())
{
t = i->second;
}
else
{
t = CreateTexture(size, 1, D3DFMT_R32F);
if(t)
{
GSTexture::GSMap m;
if(t->Map(m))
{
for(uint32 i = 0; i < size; i++)
{
((float*)m.bits)[i] = (float)((i & msk) | fix) / size;
}
t->Unmap();
}
m_mskfix[hash] = t;
}
}
return t;
}
void GSDevice9::SetupVS(VSSelector sel, const VSConstantBuffer* cb)
{
auto i = std::as_const(m_vs).find(sel);
if(i == m_vs.end())
{
std::string str[5];
str[0] = format("%d", sel.bppz);
str[1] = format("%d", sel.tme);
str[2] = format("%d", sel.fst);
str[3] = format("%d", sel.logz);
str[4] = format("%d", sel.rtcopy);
D3D_SHADER_MACRO macro[] =
{
{"VS_BPPZ", str[0].c_str()},
{"VS_TME", str[1].c_str()},
{"VS_FST", str[2].c_str()},
{"VS_LOGZ", str[3].c_str()},
{"VS_RTCOPY", str[4].c_str()},
{NULL, NULL},
};
static const D3DVERTEXELEMENT9 layout[] =
{
{0, 0, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 0},
{0, 8, D3DDECLTYPE_D3DCOLOR, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_COLOR, 0},
{0, 12, D3DDECLTYPE_D3DCOLOR, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_COLOR, 1},
{0, 16, D3DDECLTYPE_FLOAT4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0},
D3DDECL_END()
};
GSVertexShader9 vs;
std::vector<char> shader;
theApp.LoadResource(IDR_TFX_FX, shader);
CompileShader(shader.data(), shader.size(), "tfx.fx", "vs_main", macro, &vs.vs, layout, countof(layout), &vs.il);
m_vs[sel] = vs;
i = m_vs.find(sel);
}
VSSetShader(i->second.vs, (const float*)cb, sizeof(*cb) / sizeof(GSVector4));
IASetInputLayout(i->second.il);
}
void GSDevice9::SetupPS(PSSelector sel, const PSConstantBuffer* cb, PSSamplerSelector ssel)
{
if(cb->WH.z > 0 && cb->WH.w > 0 && (sel.wms == 3 || sel.wmt == 3))
{
GSVector4i size(cb->WH);
if(sel.wms == 3)
{
if(GSTexture* t = CreateMskFix(size.z, cb->MskFix.x, cb->MskFix.z))
{
m_dev->SetTexture(3, *(GSTexture9*)t);
}
}
if(sel.wmt == 3)
{
if(GSTexture* t = CreateMskFix(size.w, cb->MskFix.y, cb->MskFix.w))
{
m_dev->SetTexture(4, *(GSTexture9*)t);
}
}
}
auto i = std::as_const(m_ps).find(sel);
if(i == m_ps.end())
{
std::string str[17];
str[0] = format("%d", sel.fst);
str[1] = format("%d", sel.wms);
str[2] = format("%d", sel.wmt);
str[3] = format("%d", sel.fmt);
str[4] = format("%d", sel.aem);
str[5] = format("%d", sel.tfx);
str[6] = format("%d", sel.tcc);
str[7] = format("%d", sel.atst);
str[8] = format("%d", sel.fog);
str[9] = format("%d", sel.clr1);
str[10] = format("%d", sel.rt);
str[11] = format("%d", sel.ltf);
str[12] = format("%d", sel.colclip);
str[13] = format("%d", sel.date);
str[14] = format("%d", sel.spritehack);
str[15] = format("%d", sel.tcoffsethack);
str[16] = format("%d", sel.fmt >> 2);
D3D_SHADER_MACRO macro[] =
{
{"PS_FST", str[0].c_str()},
{"PS_WMS", str[1].c_str()},
{"PS_WMT", str[2].c_str()},
{"PS_FMT", str[3].c_str()},
{"PS_AEM", str[4].c_str()},
{"PS_TFX", str[5].c_str()},
{"PS_TCC", str[6].c_str()},
{"PS_ATST", str[7].c_str()},
{"PS_FOG", str[8].c_str()},
{"PS_CLR1", str[9].c_str()},
{"PS_RT", str[10].c_str()},
{"PS_LTF", str[11].c_str()},
{"PS_COLCLIP", str[12].c_str()},
{"PS_DATE", str[13].c_str()},
{"PS_SPRITEHACK", str[14].c_str()},
{"PS_TCOFFSETHACK", str[15].c_str()},
{"PS_PAL_FMT", str[16].c_str()},
{NULL, NULL},
};
CComPtr<IDirect3DPixelShader9> ps;
std::vector<char> shader;
theApp.LoadResource(IDR_TFX_FX, shader);
CompileShader(shader.data(), shader.size(), "tfx.fx", "ps_main", macro, &ps);
m_ps[sel] = ps;
i = m_ps.find(sel);
}
PSSetShader(i->second, (const float*)cb, sizeof(*cb) / sizeof(GSVector4));
Direct3DSamplerState9* ss = NULL;
if(sel.tfx != 4)
{
if(!(sel.fmt < 3 && sel.wms < 3 && sel.wmt < 3))
{
ssel.ltf = 0;
}
auto i = std::as_const(m_ps_ss).find(ssel);
if(i != m_ps_ss.end())
{
ss = i->second;
}
else
{
ss = new Direct3DSamplerState9();
memset(ss, 0, sizeof(*ss));
ss->Anisotropic[0] = theApp.GetConfigI("MaxAnisotropy") && !theApp.GetConfigB("paltex") ? D3DTEXF_ANISOTROPIC : D3DTEXF_LINEAR;
ss->Anisotropic[1] = theApp.GetConfigI("MaxAnisotropy") && !theApp.GetConfigB("paltex") ? D3DTEXF_ANISOTROPIC : D3DTEXF_POINT;
ss->FilterMin[0] = ssel.ltf ? ss->Anisotropic[0] : D3DTEXF_POINT;
ss->FilterMag[0] = ssel.ltf ? ss->Anisotropic[0] : D3DTEXF_POINT;
ss->FilterMip[0] = ssel.ltf ? ss->Anisotropic[0] : D3DTEXF_POINT;
ss->FilterMin[1] = ss->Anisotropic[1];
ss->FilterMag[1] = ss->Anisotropic[1];
ss->FilterMip[1] = ss->Anisotropic[1];
ss->AddressU = ssel.tau ? D3DTADDRESS_WRAP : D3DTADDRESS_CLAMP;
ss->AddressV = ssel.tav ? D3DTADDRESS_WRAP : D3DTADDRESS_CLAMP;
ss->MaxAnisotropy = theApp.GetConfigI("MaxAnisotropy");
ss->MaxLOD = ULONG_MAX;
m_ps_ss[ssel] = ss;
}
}
PSSetSamplerState(ss);
}
void GSDevice9::SetupOM(OMDepthStencilSelector dssel, OMBlendSelector bsel, uint8 afix)
{
Direct3DDepthStencilState9* dss = NULL;
auto i = std::as_const(m_om_dss).find(dssel);
if(i == m_om_dss.end())
{
dss = new Direct3DDepthStencilState9();
memset(dss, 0, sizeof(*dss));
if(dssel.date || dssel.fba)
{
dss->StencilEnable = true;
dss->StencilReadMask = 1;
dss->StencilWriteMask = dssel.date_one ? 3 : 2;
dss->StencilFunc = dssel.date ? D3DCMP_EQUAL : D3DCMP_ALWAYS;
dss->StencilPassOp = dssel.date_one ? D3DSTENCILOP_ZERO : dssel.fba ? D3DSTENCILOP_REPLACE : D3DSTENCILOP_KEEP;
dss->StencilFailOp = dssel.fba && !dssel.date_one ? D3DSTENCILOP_ZERO : D3DSTENCILOP_KEEP;
dss->StencilDepthFailOp = D3DSTENCILOP_KEEP;
dss->StencilRef = 3;
}
if(dssel.ztst != ZTST_ALWAYS || dssel.zwe)
{
static const D3DCMPFUNC ztst[] =
{
D3DCMP_NEVER,
D3DCMP_ALWAYS,
D3DCMP_GREATEREQUAL,
D3DCMP_GREATER
};
dss->DepthEnable = true;
dss->DepthWriteMask = dssel.zwe;
dss->DepthFunc = ztst[dssel.ztst];
}
m_om_dss[dssel] = dss;
i = m_om_dss.find(dssel);
}
OMSetDepthStencilState(i->second);
auto j = std::as_const(m_om_bs).find(bsel);
if(j == m_om_bs.end())
{
Direct3DBlendState9* bs = new Direct3DBlendState9();
memset(bs, 0, sizeof(*bs));
bs->BlendEnable = bsel.abe;
if(bsel.abe)
{
int i = ((bsel.a * 3 + bsel.b) * 3 + bsel.c) * 3 + bsel.d;
bs->BlendOp = (D3DBLENDOP)m_blendMapD3D9[i].op;
bs->SrcBlend = (D3DBLEND)m_blendMapD3D9[i].src;
bs->DestBlend = (D3DBLEND)m_blendMapD3D9[i].dst;
bs->BlendOpAlpha = D3DBLENDOP_ADD;
bs->SrcBlendAlpha = D3DBLEND_ONE;
bs->DestBlendAlpha = D3DBLEND_ZERO;
// Not very good but I don't wanna write another 81 row table
if(bsel.negative)
{
if(bs->BlendOp == D3DBLENDOP_ADD)
{
bs->BlendOp = D3DBLENDOP_REVSUBTRACT;
}
else if(bs->BlendOp == D3DBLENDOP_REVSUBTRACT)
{
bs->BlendOp = D3DBLENDOP_ADD;
}
else
; // god knows, best just not to mess with it for now
}
}
// this is not a typo; dx9 uses BGRA rather than the gs native RGBA, unlike dx10
if(bsel.wr) bs->RenderTargetWriteMask |= D3DCOLORWRITEENABLE_BLUE;
if(bsel.wg) bs->RenderTargetWriteMask |= D3DCOLORWRITEENABLE_GREEN;
if(bsel.wb) bs->RenderTargetWriteMask |= D3DCOLORWRITEENABLE_RED;
if(bsel.wa) bs->RenderTargetWriteMask |= D3DCOLORWRITEENABLE_ALPHA;
m_om_bs[bsel] = bs;
j = m_om_bs.find(bsel);
}
OMSetBlendState(j->second, afix >= 0x80 ? 0xffffff : 0x020202 * afix);
}

View File

@ -101,17 +101,6 @@ bool GSDeviceDX::SetFeatureLevel(D3D_FEATURE_LEVEL level, bool compat_mode)
switch(level)
{
case D3D_FEATURE_LEVEL_9_1:
case D3D_FEATURE_LEVEL_9_2:
m_shader.model = "0x200";
m_shader.vs = compat_mode ? "vs_4_0_level_9_1" : "vs_2_0";
m_shader.ps = compat_mode ? "ps_4_0_level_9_1" : "ps_2_0";
break;
case D3D_FEATURE_LEVEL_9_3:
m_shader.model = "0x300";
m_shader.vs = compat_mode ? "vs_4_0_level_9_3" : "vs_3_0";
m_shader.ps = compat_mode ? "ps_4_0_level_9_3" : "ps_3_0";
break;
case D3D_FEATURE_LEVEL_10_0:
m_shader.model = "0x400";
m_shader.vs = "vs_4_0";

View File

@ -74,16 +74,18 @@ public:
uint32 bppz:2;
uint32 tme:1;
uint32 fst:1;
uint32 logz:1;
uint32 rtcopy:1;
uint32 _free:27;
};
uint32 key;
};
operator uint32() {return key & 0xff;}
operator uint32() const {return key;}
VSSelector() : key(0) {}
VSSelector(uint32 k) : key(k) {}
};
struct alignas(32) PSConstantBuffer
@ -338,7 +340,6 @@ public:
virtual void SetupDATE(GSTexture* rt, GSTexture* ds, const GSVertexPT1* vertices, bool datm) = 0;
virtual bool HasStencil() = 0;
virtual bool HasDepth32() = 0;
static bool LoadD3DCompiler();
static void FreeD3DCompiler();

View File

@ -27,9 +27,6 @@ GSRendererDX::GSRendererDX(GSTextureCache* tc, const GSVector2& pixelcenter)
: GSRendererHW(tc)
, m_pixelcenter(pixelcenter)
{
m_logz = theApp.GetConfigB("logz");
m_fba = theApp.GetConfigB("fba");
if (theApp.GetConfigB("UserHacks"))
{
UserHacks_AlphaHack = theApp.GetConfigB("UserHacks_AlphaHack");
@ -498,16 +495,10 @@ void GSRendererDX::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sourc
EmulateZbuffer();
if (m_fba)
{
m_om_dssel.fba = m_context->FBA.FBA;
}
// vs
m_vs_sel.tme = PRIM->TME;
m_vs_sel.fst = PRIM->FST;
m_vs_sel.logz = !dev->HasDepth32() && m_logz;
m_vs_sel.rtcopy = rtcopy != nullptr;
float sx = 2.0f * rtscale.x / (rtsize.x << 4);
@ -813,6 +804,4 @@ void GSRendererDX::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sourc
dev->EndScene();
dev->Recycle(rtcopy);
if (m_om_dssel.fba) UpdateFBA(rt);
}

View File

@ -27,8 +27,6 @@
class GSRendererDX : public GSRendererHW
{
GSVector2 m_pixelcenter;
bool m_logz;
bool m_fba;
bool UserHacks_AlphaHack;
bool UserHacks_AlphaStencil;
@ -42,7 +40,6 @@ protected:
virtual void EmulateTextureShuffleAndFbmask() = 0;
virtual void EmulateChannelShuffle(GSTexture** rt, const GSTextureCache::Source* tex) = 0;
virtual void SetupIA(const float& sx, const float& sy) = 0;
virtual void UpdateFBA(GSTexture* rt) {}
int UserHacks_HPO;

View File

@ -1141,8 +1141,7 @@ GSRendererHW::Hacks::Hacks()
, m_oo(NULL)
, m_cu(NULL)
{
bool is_direct3d9 = theApp.GetCurrentRendererType() == GSRendererType::DX9_HW;
bool can_handle_depth = (!theApp.GetConfigB("UserHacks") || !theApp.GetConfigB("UserHacks_DisableDepthSupport")) && !is_direct3d9;
bool can_handle_depth = (!theApp.GetConfigB("UserHacks") || !theApp.GetConfigB("UserHacks_DisableDepthSupport"));
m_oi_list.push_back(HackEntry<OI_Ptr>(CRC::FFXII, CRC::EU, &GSRendererHW::OI_FFXII));
m_oi_list.push_back(HackEntry<OI_Ptr>(CRC::FFX, CRC::RegionCount, &GSRendererHW::OI_FFX));

View File

@ -520,7 +520,6 @@ public:
static void APIENTRY DebugOutputToFile(GLenum gl_source, GLenum gl_type, GLuint id, GLenum gl_severity, GLsizei gl_length, const GLchar *gl_message, const void* userParam);
bool HasStencil() { return true; }
bool HasDepth32() { return true; }
bool Create(const std::shared_ptr<GSWnd> &wnd);
bool Reset(int w, int h);

View File

@ -170,15 +170,6 @@ const char* dialog_message(int ID, bool* updateText) {
return "Allows advanced atomic operations to speed up Accurate Date.\n"
"Only disable this if using Accurate Date causes (GPU driver) issues.\n\n"
"Note: This option is only supported by GPUs which support at least Direct3D 11.";
#ifdef _WIN32
// DX9 only
case IDC_FBA:
return "Makes textures partially or fully transparent as required by emulation.\n"
"May cause unusual slowdowns or graphical glitches for some games.";
case IDC_LOGZ:
return "Treat depth as logarithmic instead of linear.\n"
"Recommended setting is on unless it causes graphical glitches.";
#endif
case IDC_OSD_MAX_LOG_EDIT:
case IDC_OSD_MAX_LOG:
return "Sets the maximum number of log messages on the screen or in the buffer at the same time.\n\n"

View File

@ -23,7 +23,6 @@
#include "GSdx.h"
#include "GSSettingsDlg.h"
#include "GSUtil.h"
#include "Renderers/DX9/GSDevice9.h"
#include "Renderers/DX11/GSDevice11.h"
#include "resource.h"
#include "GSSetting.h"
@ -155,8 +154,6 @@ void GSSettingsDlg::OnInit()
CheckDlgButton(m_hWnd, IDC_PALTEX, theApp.GetConfigB("paltex"));
CheckDlgButton(m_hWnd, IDC_LARGE_FB, theApp.GetConfigB("large_framebuffer"));
CheckDlgButton(m_hWnd, IDC_LOGZ, theApp.GetConfigB("logz"));
CheckDlgButton(m_hWnd, IDC_FBA, theApp.GetConfigB("fba"));
CheckDlgButton(m_hWnd, IDC_MIPMAP_SW, theApp.GetConfigB("mipmap"));
CheckDlgButton(m_hWnd, IDC_AA1, theApp.GetConfigB("aa1"));
@ -183,8 +180,6 @@ void GSSettingsDlg::OnInit()
AddTooltip(IDC_MIPMAP_SW);
AddTooltip(IDC_SWTHREADS);
AddTooltip(IDC_SWTHREADS_EDIT);
AddTooltip(IDC_FBA);
AddTooltip(IDC_LOGZ);
AddTooltip(IDC_LARGE_FB);
UpdateControls();
@ -305,8 +300,6 @@ bool GSSettingsDlg::OnCommand(HWND hWnd, UINT id, UINT code)
theApp.SetConfig("mipmap", (int)IsDlgButtonChecked(m_hWnd, IDC_MIPMAP_SW));
theApp.SetConfig("paltex", (int)IsDlgButtonChecked(m_hWnd, IDC_PALTEX));
theApp.SetConfig("large_framebuffer", (int)IsDlgButtonChecked(m_hWnd, IDC_LARGE_FB));
theApp.SetConfig("logz", (int)IsDlgButtonChecked(m_hWnd, IDC_LOGZ));
theApp.SetConfig("fba", (int)IsDlgButtonChecked(m_hWnd, IDC_FBA));
theApp.SetConfig("aa1", (int)IsDlgButtonChecked(m_hWnd, IDC_AA1));
theApp.SetConfig("UserHacks", (int)IsDlgButtonChecked(m_hWnd, IDC_HACKS_ENABLED));
@ -371,16 +364,14 @@ void GSSettingsDlg::UpdateControls()
{
GSRendererType renderer = static_cast<GSRendererType>(i);
bool dx9 = renderer == GSRendererType::DX9_HW || renderer == GSRendererType::DX9_SW || renderer == GSRendererType::DX9_OpenCL;
bool dx11 = renderer == GSRendererType::DX1011_HW || renderer == GSRendererType::DX1011_SW || renderer == GSRendererType::DX1011_OpenCL;
bool ogl = renderer == GSRendererType::OGL_HW || renderer == GSRendererType::OGL_SW || renderer == GSRendererType::OGL_OpenCL;
bool hw = renderer == GSRendererType::DX9_HW || renderer == GSRendererType::DX1011_HW || renderer == GSRendererType::OGL_HW;
bool sw = renderer == GSRendererType::DX9_SW || renderer == GSRendererType::DX1011_SW || renderer == GSRendererType::OGL_SW;
bool ocl = renderer == GSRendererType::DX9_OpenCL || renderer == GSRendererType::DX1011_OpenCL || renderer == GSRendererType::OGL_OpenCL;
bool hw = renderer == GSRendererType::DX1011_HW || renderer == GSRendererType::OGL_HW;
bool sw = renderer == GSRendererType::DX1011_SW || renderer == GSRendererType::OGL_SW;
bool ocl = renderer == GSRendererType::DX1011_OpenCL || renderer == GSRendererType::OGL_OpenCL;
bool null = renderer == GSRendererType::Null;
ShowWindow(GetDlgItem(m_hWnd, IDC_LOGO9), dx9 ? SW_SHOW : SW_HIDE);
ShowWindow(GetDlgItem(m_hWnd, IDC_LOGO11), dx11 ? SW_SHOW : SW_HIDE);
ShowWindow(GetDlgItem(m_hWnd, IDC_NULL), null ? SW_SHOW : SW_HIDE);
ShowWindow(GetDlgItem(m_hWnd, IDC_LOGOGL), ogl ? SW_SHOW : SW_HIDE);
@ -393,8 +384,6 @@ void GSSettingsDlg::UpdateControls()
EnableWindow(GetDlgItem(m_hWnd, IDC_FILTER), !null);
EnableWindow(GetDlgItem(m_hWnd, IDC_FILTER_TEXT), !null);
ShowWindow(GetDlgItem(m_hWnd, IDC_LOGZ), dx9 ? SW_SHOW: SW_HIDE);
ShowWindow(GetDlgItem(m_hWnd, IDC_FBA), dx9 ? SW_SHOW : SW_HIDE);
ShowWindow(GetDlgItem(m_hWnd, IDC_ACCURATE_BLEND_UNIT), ogl ? SW_SHOW : SW_HIDE);
ShowWindow(GetDlgItem(m_hWnd, IDC_ACCURATE_BLEND_UNIT_TEXT), ogl ? SW_SHOW : SW_HIDE);
@ -413,8 +402,6 @@ void GSSettingsDlg::UpdateControls()
EnableWindow(GetDlgItem(m_hWnd, IDC_UPSCALE_MULTIPLIER), hw);
EnableWindow(GetDlgItem(m_hWnd, IDC_UPSCALE_MULTIPLIER_TEXT), hw);
EnableWindow(GetDlgItem(m_hWnd, IDC_PALTEX), hw);
EnableWindow(GetDlgItem(m_hWnd, IDC_LOGZ), dx9 && hw);
EnableWindow(GetDlgItem(m_hWnd, IDC_FBA), dx9 && hw);
INT_PTR filter;
if (ComboBoxGetSelData(IDC_FILTER, filter))
@ -650,32 +637,13 @@ void GSHacksDlg::OnInit()
HWND hwnd_upscaling = GetDlgItem(GetParent(m_hWnd), IDC_UPSCALE_MULTIPLIER);
GSRendererType renderer = static_cast<GSRendererType>(SendMessage(hwnd_renderer, CB_GETITEMDATA, SendMessage(hwnd_renderer, CB_GETCURSEL, 0, 0), 0));
unsigned short upscaling_multiplier = static_cast<unsigned short>(SendMessage(hwnd_upscaling, CB_GETITEMDATA, SendMessage(hwnd_upscaling, CB_GETCURSEL, 0, 0), 0));
unsigned short cb = 0;
// It can only be accessed with a HW renderer, so this is sufficient.
bool dx9 = renderer == GSRendererType::DX9_HW;
bool dx11 = renderer == GSRendererType::DX1011_HW;
bool ogl = renderer == GSRendererType::OGL_HW;
bool native = upscaling_multiplier == 1;
if(dx9) for(unsigned short i = 0; i < 17; i++)
{
if( i == 1) continue;
int depth = GSDevice9::GetMaxDepth(i, m_adapter_id);
if(depth)
{
char text[32] = {0};
sprintf(text, depth == 32 ? "%dx Z-32" : "%dx Z-24", i);
SendMessage(GetDlgItem(m_hWnd, IDC_MSAACB), CB_ADDSTRING, 0, (LPARAM)text);
msaa2cb[i] = cb;
cb2msaa[cb] = i;
cb++;
}
}
else for(unsigned short j = 0; j < 5; j++) // TODO: Make the same kind of check for d3d11, eventually....
for(unsigned short j = 0; j < 5; j++) // TODO: Make the same kind of check for d3d11, eventually....
{
unsigned short i = j == 0 ? 0 : 1 << j;
@ -727,7 +695,6 @@ void GSHacksDlg::OnInit()
EnableWindow(GetDlgItem(m_hWnd, IDC_MSAA_TEXT), !ogl);
// OpenGL-only hacks:
EnableWindow(GetDlgItem(m_hWnd, IDC_TC_DEPTH), !dx9);
EnableWindow(GetDlgItem(m_hWnd, IDC_TRI_FILTER), ogl);
EnableWindow(GetDlgItem(m_hWnd, IDC_TRI_FILTER_TEXT), ogl);

View File

@ -1,5 +1,4 @@
#ifdef SHADER_MODEL // make safe to include in resource file to enforce dependency
#if SHADER_MODEL >= 0x400
#ifndef PS_SCALE_FACTOR
#define PS_SCALE_FACTOR 1
@ -36,44 +35,6 @@ struct PS_OUTPUT
float4 c : SV_Target0;
};
#elif SHADER_MODEL <= 0x300
struct VS_INPUT
{
float4 p : POSITION;
float2 t : TEXCOORD0;
};
struct VS_OUTPUT
{
float4 p : POSITION;
float2 t : TEXCOORD0;
};
struct PS_INPUT
{
#if SHADER_MODEL < 0x300
float4 p : TEXCOORD1;
#else
float4 p : VPOS;
#endif
float2 t : TEXCOORD0;
};
struct PS_OUTPUT
{
float4 c : COLOR;
};
sampler Texture : register(s0);
float4 sample_c(float2 uv)
{
return tex2D(Texture, uv);
}
#endif
VS_OUTPUT vs_main(VS_INPUT input)
{
VS_OUTPUT output;
@ -130,8 +91,6 @@ float4 ps_scanlines(PS_INPUT input, int i)
return sample_c(input.t) * saturate(mask[i] + 0.5f);
}
#if SHADER_MODEL >= 0x400
uint ps_main1(PS_INPUT input) : SV_Target0
{
float4 c = sample_c(input.t);
@ -389,106 +348,4 @@ PS_OUTPUT ps_main17(PS_INPUT input)
return output;
}
#elif SHADER_MODEL <= 0x300
PS_OUTPUT ps_main1(PS_INPUT input)
{
PS_OUTPUT output;
float4 c = sample_c(input.t);
c.a *= 128.0f / 255; // *= 0.5f is no good here, need to do this in order to get 0x80 for 1.0f (instead of 0x7f)
output.c = c;
return output;
}
PS_OUTPUT ps_main2(PS_INPUT input)
{
PS_OUTPUT output;
clip(sample_c(input.t).a - 255.0f / 255); // >= 0x80 pass
output.c = 0;
return output;
}
PS_OUTPUT ps_main3(PS_INPUT input)
{
PS_OUTPUT output;
clip(254.95f / 255 - sample_c(input.t).a); // < 0x80 pass (== 0x80 should not pass)
output.c = 0;
return output;
}
PS_OUTPUT ps_main4(PS_INPUT input)
{
PS_OUTPUT output;
output.c = 1;
return output;
}
PS_OUTPUT ps_main5(PS_INPUT input) // scanlines
{
PS_OUTPUT output;
int4 p = (int4)input.p;
output.c = ps_scanlines(input, p.y % 2);
return output;
}
PS_OUTPUT ps_main6(PS_INPUT input) // diagonal
{
PS_OUTPUT output;
int4 p = (int4)input.p;
output.c = ps_crt(input, (p.x + (p.y % 3)) % 3);
return output;
}
PS_OUTPUT ps_main8(PS_INPUT input) // triangular
{
PS_OUTPUT output;
int4 p = (int4)input.p;
// output.c = ps_crt(input, ((p.x + (p.y % 2) * 3) / 2) % 3);
output.c = ps_crt(input, ((p.x + ((p.y / 2) % 2) * 3) / 2) % 3);
return output;
}
static const float PI = 3.14159265359f;
PS_OUTPUT ps_main9(PS_INPUT input) // triangular
{
PS_OUTPUT output;
// Needs DX9 conversion
/*float2 texdim, halfpixel;
Texture.GetDimensions(texdim.x, texdim.y);
if (ddy(input.t.y) * texdim.y > 0.5)
output.c = sample_c(input.t);
else
output.c = (0.5 - 0.5 * cos(2 * PI * input.t.y * texdim.y)) * sample_c(float2(input.t.x, (floor(input.t.y * texdim.y) + 0.5) / texdim.y));
*/
// replacement shader
int4 p = (int4)input.p;
output.c = ps_crt(input, ((p.x + ((p.y / 2) % 2) * 3) / 2) % 3);
return output;
}
#endif
#endif

View File

@ -1,7 +1,5 @@
#ifdef SHADER_MODEL // make safe to include in resource file to enforce dependency
#if SHADER_MODEL >= 0x400
Texture2D Texture;
SamplerState Sampler;
@ -44,44 +42,4 @@ float4 ps_main3(PS_INPUT input) : SV_Target0
{
return Texture.Sample(Sampler, input.t);
}
#elif SHADER_MODEL <= 0x300
sampler s0 : register(s0);
float4 Params1 : register(c0);
#define ZrH (Params1.xy)
#define hH (Params1.z)
float4 ps_main0(float2 tex : TEXCOORD0) : COLOR
{
clip(frac(tex.y * hH) - 0.5);
return tex2D(s0, tex);
}
float4 ps_main1(float2 tex : TEXCOORD0) : COLOR
{
clip(0.5 - frac(tex.y * hH));
return tex2D(s0, tex);
}
float4 ps_main2(float2 tex : TEXCOORD0) : COLOR
{
float4 c0 = tex2D(s0, tex - ZrH);
float4 c1 = tex2D(s0, tex);
float4 c2 = tex2D(s0, tex + ZrH);
return (c0 + c1 * 2 + c2) / 4;
}
float4 ps_main3(float2 tex : TEXCOORD0) : COLOR
{
return tex2D(s0, tex);
}
#endif
#endif

Binary file not shown.

Before

Width:  |  Height:  |  Size: 73 KiB

View File

@ -1,5 +1,4 @@
#ifdef SHADER_MODEL // make safe to include in resource file to enforce dependency
#if SHADER_MODEL >= 0x400
Texture2D Texture;
SamplerState Sampler;
@ -28,33 +27,4 @@ float4 ps_main1(PS_INPUT input) : SV_Target0
c.a = BGColor.a;
return c;
}
#elif SHADER_MODEL <= 0x300
sampler Texture : register(s0);
float4 g_params[1];
#define BGColor (g_params[0])
struct PS_INPUT
{
float2 t : TEXCOORD0;
};
float4 ps_main0(PS_INPUT input) : COLOR
{
float4 c = tex2D(Texture, input.t);
// a = ;
return c.bgra;
}
float4 ps_main1(PS_INPUT input) : COLOR
{
float4 c = tex2D(Texture, input.t);
c.a = BGColor.a;
return c.bgra;
}
#endif
#endif

Binary file not shown.

Before

Width:  |  Height:  |  Size: 55 KiB

View File

@ -30,8 +30,6 @@ float4 ContrastSaturationBrightness(float4 color) // Ported to HLSL
return color;
}
#if SHADER_MODEL >= 0x400
Texture2D Texture;
SamplerState Sampler;
@ -52,25 +50,4 @@ float4 ps_main(PS_INPUT input) : SV_Target0
return ContrastSaturationBrightness(c);
}
#elif SHADER_MODEL <= 0x300
sampler Texture : register(s0);
float4 g_params[1];
#define BGColor (g_params[0])
struct PS_INPUT
{
float2 t : TEXCOORD0;
};
float4 ps_main(PS_INPUT input) : COLOR
{
float4 c = tex2D(Texture, input.t);
return ContrastSaturationBrightness(c);
}
#endif
#endif

View File

@ -3,8 +3,6 @@
#define FMT_24 1
#define FMT_16 2
#if SHADER_MODEL >= 0x400
#ifndef VS_BPPZ
#define VS_BPPZ 0
#define VS_TME 1
@ -232,104 +230,8 @@ float4 fetch_gXbY(int2 xy)
}
}
#elif SHADER_MODEL <= 0x300
#ifndef VS_BPPZ
#define VS_BPPZ 0
#define VS_TME 1
#define VS_FST 1
#define VS_LOGZ 1
#endif
#ifndef PS_FST
#define PS_FST 0
#define PS_WMS 0
#define PS_WMT 0
#define PS_FMT FMT_32
#define PS_AEM 0
#define PS_TFX 0
#define PS_TCC 0
#define PS_ATST 4
#define PS_FOG 0
#define PS_CLR1 0
#define PS_RT 0
#define PS_LTF 0
#define PS_COLCLIP 0
#define PS_DATE 0
#define PS_PAL_FMT 0
#endif
struct VS_INPUT
{
float4 p : POSITION0;
float2 t : TEXCOORD0;
float4 c : COLOR0;
float4 f : COLOR1;
};
struct VS_OUTPUT
{
float4 p : POSITION;
float4 t : TEXCOORD0;
#if VS_RTCOPY
float4 tp : TEXCOORD1;
#endif
float4 c : COLOR0;
};
struct PS_INPUT
{
float4 t : TEXCOORD0;
#if PS_DATE > 0
float4 tp : TEXCOORD1;
#endif
float4 c : COLOR0;
};
sampler Texture : register(s0);
sampler Palette : register(s1);
sampler RTCopy : register(s2);
sampler1D UMSKFIX : register(s3);
sampler1D VMSKFIX : register(s4);
float4 vs_params[3];
#define VertexScale vs_params[0]
#define VertexOffset vs_params[1]
#define Texture_Scale_Offset vs_params[2]
float4 ps_params[7];
#define FogColor ps_params[0].bgr
#define AREF ps_params[0].a
#define HalfTexel ps_params[1]
#define WH ps_params[2]
#define MinMax ps_params[3]
#define MinF ps_params[4].xy
#define TA ps_params[4].zw
#define TC_OffsetHack ps_params[6]
float4 sample_c(float2 uv)
{
return tex2D(Texture, uv);
}
float4 sample_p(float u)
{
return tex2D(Palette, u);
}
float4 sample_rt(float2 uv)
{
return tex2D(RTCopy, uv);
}
#endif
#define PS_AEM_FMT (PS_FMT & 3)
#if SHADER_MODEL >= 0x400
int2 clamp_wrap_uv_depth(int2 uv)
{
int4 mask = (int4)MskFix << 4;
@ -440,7 +342,6 @@ float4 sample_depth(float2 st, float2 pos)
return t;
}
#endif
float4 clamp_wrap_uv(float4 uv)
{
@ -463,19 +364,12 @@ float4 clamp_wrap_uv(float4 uv)
}
else if(PS_WMS == 3)
{
#if SHADER_MODEL >= 0x400
#if PS_FST == 0
// wrap negative uv coords to avoid an off by one error that shifted
// textures. Fixes Xenosaga's hair issue.
uv = frac(uv);
#endif
uv = (float4)(((uint4)(uv * WH.xyxy) & MskFix.xyxy) | MskFix.zwzw) / WH.xyxy;
#elif SHADER_MODEL <= 0x300
uv.x = tex1D(UMSKFIX, uv.x);
uv.y = tex1D(VMSKFIX, uv.y);
uv.z = tex1D(UMSKFIX, uv.z);
uv.w = tex1D(VMSKFIX, uv.w);
#endif
}
}
else
@ -497,15 +391,10 @@ float4 clamp_wrap_uv(float4 uv)
}
else if(PS_WMS == 3)
{
#if SHADER_MODEL >= 0x400
#if PS_FST == 0
uv.xz = frac(uv.xz);
#endif
uv.xz = (float2)(((uint2)(uv.xz * WH.xx) & MskFix.xx) | MskFix.zz) / WH.xx;
#elif SHADER_MODEL <= 0x300
uv.x = tex1D(UMSKFIX, uv.x);
uv.z = tex1D(UMSKFIX, uv.z);
#endif
}
/*
if(PS_WMT == 0)
@ -524,15 +413,10 @@ float4 clamp_wrap_uv(float4 uv)
}
else if(PS_WMT == 3)
{
#if SHADER_MODEL >= 0x400
#if PS_FST == 0
uv.yw = frac(uv.yw);
#endif
uv.yw = (float2)(((uint2)(uv.yw * WH.yy) & MskFix.yy) | MskFix.ww) / WH.yy;
#elif SHADER_MODEL <= 0x300
uv.y = tex1D(VMSKFIX, uv.y);
uv.w = tex1D(VMSKFIX, uv.w);
#endif
}
}
@ -560,13 +444,6 @@ float4 sample_4_index(float4 uv)
c.z = sample_c(uv.xw).a;
c.w = sample_c(uv.zw).a;
#if SHADER_MODEL <= 0x300
if (PS_RT) c *= 128.0f / 255;
// D3D9 doesn't support integer operations
#else
// Denormalize value
uint4 i = uint4(c * 255.0f + 0.5f);
@ -581,8 +458,6 @@ float4 sample_4_index(float4 uv)
c = float4(i >> 4u) / 255.0f;
}
#endif
// Most of texture will hit this code so keep normalized float value
// 8 bits
return c * 255./256 + 0.5/256;
@ -622,12 +497,10 @@ float4 sample_color(float2 st)
{
uv = st.xyxy + HalfTexel;
dd = frac(uv.xy * WH.zw);
#if SHADER_MODEL >= 0x400
if(PS_FST == 0)
{
dd = clamp(dd, (float2)0.0, (float2)0.9999999);
}
#endif
}
else
{
@ -646,13 +519,7 @@ float4 sample_color(float2 st)
[unroll]
for (uint i = 0; i < 4; i++)
{
if(PS_AEM_FMT == FMT_32)
{
#if SHADER_MODEL <= 0x300
if(PS_RT) c[i].a *= 128.0f / 255;
#endif
}
else if(PS_AEM_FMT == FMT_24)
if(PS_AEM_FMT == FMT_24)
{
c[i].a = !PS_AEM || any(c[i].rgb) ? TA.x : 0;
}
@ -724,11 +591,8 @@ void datst(PS_INPUT input)
{
#if PS_DATE > 0
float alpha = sample_rt(input.tp.xy).a;
#if SHADER_MODEL >= 0x400
float alpha0x80 = 128. / 255;
#else
float alpha0x80 = 1;
#endif
if (PS_DATE == 1 && alpha >= alpha0x80)
discard;
@ -851,8 +715,6 @@ float4 ps_color(PS_INPUT input)
return c;
}
#if SHADER_MODEL >= 0x400
VS_OUTPUT vs_main(VS_INPUT input)
{
if(VS_BPPZ == 1) // 24
@ -1121,74 +983,4 @@ PS_OUTPUT ps_main(PS_INPUT input)
return output;
}
#elif SHADER_MODEL <= 0x300
VS_OUTPUT vs_main(VS_INPUT input)
{
if(VS_BPPZ == 1) // 24
{
input.p.z = fmod(input.p.z, 0x1000000);
}
else if(VS_BPPZ == 2) // 16
{
input.p.z = fmod(input.p.z, 0x10000);
}
VS_OUTPUT output;
// pos -= 0.05 (1/320 pixel) helps avoiding rounding problems (integral part of pos is usually 5 digits, 0.05 is about as low as we can go)
// example: ceil(afterseveralvertextransformations(y = 133)) => 134 => line 133 stays empty
// input granularity is 1/16 pixel, anything smaller than that won't step drawing up/left by one pixel
// example: 133.0625 (133 + 1/16) should start from line 134, ceil(133.0625 - 0.05) still above 133
float4 p = input.p - float4(0.05f, 0.05f, 0, 0);
output.p = p * VertexScale - VertexOffset;
#if VS_RTCOPY
output.tp = (p * VertexScale - VertexOffset) * float4(0.5, -0.5, 0, 0) + 0.5;
#endif
if(VS_LOGZ)
{
output.p.z = log2(1.0f + input.p.z) / 32;
}
if(VS_TME)
{
float2 t = input.t - Texture_Scale_Offset.zw;
if(VS_FST)
{
output.t.xy = t * Texture_Scale_Offset.xy;
output.t.zw = t;
}
else
{
output.t.xy = t;
output.t.w = input.p.w;
}
}
else
{
output.t.xy = 0;
output.t.w = 1.0f;
}
output.c = input.c;
output.t.z = input.f.b;
return output;
}
float4 ps_main(PS_INPUT input) : COLOR
{
float4 c = ps_color(input);
c.a *= 2;
return c;
}
#endif
#endif

View File

@ -5,11 +5,9 @@
// General Dialog:
#define IDD_CONFIG 2001
#define IDB_NULL 2002
#define IDB_LOGO9 2003
#define IDB_LOGO11 2004
#define IDB_LOGOGL 2005
#define IDC_NULL 2006
#define IDC_LOGO9 2007
#define IDC_LOGO11 2008
#define IDC_LOGOGL 2009
#define IDC_ADAPTER_TEXT 2010
@ -45,8 +43,6 @@
#define IDC_ACCURATE_DATE_TEXT 2047
#define IDC_ACCURATE_BLEND_UNIT 2048
#define IDC_ACCURATE_BLEND_UNIT_TEXT 2049
#define IDC_FBA 2050
#define IDC_LOGZ 2051
// Software Renderer Settings:
#define IDC_MIPMAP_SW 2060
#define IDC_AA1 2061
@ -55,7 +51,6 @@
#define IDC_SWTHREADS_EDIT 2064
// PSX:
#define IDB_PSX_NULL 2070
#define IDB_PSX_LOGO9 2071
#define IDB_PSX_LOGO11 2072
#define IDC_PSX_NULL 2073
#define IDC_PSX_LOGO9 2074