mirror of https://github.com/PCSX2/pcsx2.git
GSdx: looking for an opengl guru...
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1360 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
parent
1c3a537d5c
commit
5736bbd449
|
@ -69,7 +69,7 @@ void GPUDrawScanline::BeginDraw(const GSRasterizerData* data, Functions* f)
|
|||
|
||||
//
|
||||
|
||||
f->ssl = m_ds.Lookup(m_env.sel);
|
||||
f->ssl = m_ds[m_env.sel];
|
||||
|
||||
f->sr = NULL; // TODO
|
||||
|
||||
|
@ -84,7 +84,7 @@ void GPUDrawScanline::BeginDraw(const GSRasterizerData* data, Functions* f)
|
|||
sel.twin = m_env.sel.twin;
|
||||
sel.sprite = m_env.sel.sprite;
|
||||
|
||||
f->ssp = m_sp.Lookup(sel);
|
||||
f->ssp = m_sp[sel];
|
||||
}
|
||||
|
||||
void GPUDrawScanline::EndDraw(const GSRasterizerStats& stats)
|
||||
|
|
|
@ -33,15 +33,6 @@ GSSetting GPUSettingsDlg::g_renderers[] =
|
|||
// {3, "Null (Null)", NULL},
|
||||
};
|
||||
|
||||
GSSetting GPUSettingsDlg::g_psversion[] =
|
||||
{
|
||||
{D3DPS_VERSION(3, 0), "Pixel Shader 3.0", NULL},
|
||||
{D3DPS_VERSION(2, 0), "Pixel Shader 2.0", NULL},
|
||||
//{D3DPS_VERSION(1, 4), "Pixel Shader 1.4", NULL},
|
||||
//{D3DPS_VERSION(1, 1), "Pixel Shader 1.1", NULL},
|
||||
//{D3DPS_VERSION(0, 0), "Fixed Pipeline (bogus)", NULL},
|
||||
};
|
||||
|
||||
GSSetting GPUSettingsDlg::g_filter[] =
|
||||
{
|
||||
{0, "Nearest", NULL},
|
||||
|
@ -82,10 +73,6 @@ void GPUSettingsDlg::OnInit()
|
|||
{
|
||||
__super::OnInit();
|
||||
|
||||
D3DCAPS9 caps;
|
||||
memset(&caps, 0, sizeof(caps));
|
||||
caps.PixelShaderVersion = D3DPS_VERSION(0, 0);
|
||||
|
||||
m_modes.clear();
|
||||
|
||||
{
|
||||
|
@ -116,8 +103,6 @@ void GPUSettingsDlg::OnInit()
|
|||
ComboBoxAppend(hWnd, str.c_str(), (LPARAM)&m_modes.back(), w == mode.Width && h == mode.Height && hz == mode.RefreshRate);
|
||||
}
|
||||
}
|
||||
|
||||
d3d->GetDeviceCaps(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, &caps);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -133,7 +118,6 @@ void GPUSettingsDlg::OnInit()
|
|||
}
|
||||
|
||||
ComboBoxInit(GetDlgItem(m_hWnd, IDC_RENDERER), &renderers[0], renderers.size(), theApp.GetConfig("Renderer", 0));
|
||||
ComboBoxInit(GetDlgItem(m_hWnd, IDC_SHADER), g_psversion, countof(g_psversion), theApp.GetConfig("PixelShaderVersion2", D3DPS_VERSION(2, 0)), caps.PixelShaderVersion);
|
||||
ComboBoxInit(GetDlgItem(m_hWnd, IDC_FILTER), g_filter, countof(g_filter), theApp.GetConfig("filter", 0));
|
||||
ComboBoxInit(GetDlgItem(m_hWnd, IDC_DITHERING), g_dithering, countof(g_dithering), theApp.GetConfig("dithering", 1));
|
||||
ComboBoxInit(GetDlgItem(m_hWnd, IDC_ASPECTRATIO), g_aspectratio, countof(g_aspectratio), theApp.GetConfig("AspectRatio", 1));
|
||||
|
@ -169,11 +153,6 @@ bool GPUSettingsDlg::OnCommand(HWND hWnd, UINT id, UINT code)
|
|||
theApp.SetConfig("Renderer", (int)data);
|
||||
}
|
||||
|
||||
if(ComboBoxGetSelData(GetDlgItem(m_hWnd, IDC_SHADER), data))
|
||||
{
|
||||
theApp.SetConfig("PixelShaderVersion2", (int)data);
|
||||
}
|
||||
|
||||
if(ComboBoxGetSelData(GetDlgItem(m_hWnd, IDC_FILTER), data))
|
||||
{
|
||||
theApp.SetConfig("filter", (int)data);
|
||||
|
@ -214,7 +193,6 @@ void GPUSettingsDlg::UpdateControls()
|
|||
ShowWindow(GetDlgItem(m_hWnd, IDC_LOGO9), dx9 ? SW_SHOW : SW_HIDE);
|
||||
ShowWindow(GetDlgItem(m_hWnd, IDC_LOGO10), dx10 ? SW_SHOW : SW_HIDE);
|
||||
|
||||
EnableWindow(GetDlgItem(m_hWnd, IDC_SHADER), dx9);
|
||||
EnableWindow(GetDlgItem(m_hWnd, IDC_SCALE), sw);
|
||||
EnableWindow(GetDlgItem(m_hWnd, IDC_SWTHREADS_EDIT), sw);
|
||||
EnableWindow(GetDlgItem(m_hWnd, IDC_SWTHREADS), sw);
|
||||
|
|
|
@ -38,7 +38,6 @@ public:
|
|||
GPUSettingsDlg();
|
||||
|
||||
static GSSetting g_renderers[];
|
||||
static GSSetting g_psversion[];
|
||||
static GSSetting g_filter[];
|
||||
static GSSetting g_dithering[];
|
||||
static GSSetting g_aspectratio[];
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include "GSUtil.h"
|
||||
#include "GSRendererHW9.h"
|
||||
#include "GSRendererHW10.h"
|
||||
#include "GSRendererOGL.h"
|
||||
#include "GSRendererSW.h"
|
||||
#include "GSRendererNull.h"
|
||||
#include "GSSettingsDlg.h"
|
||||
|
@ -125,8 +126,11 @@ static INT32 GSopen(void* dsp, char* title, int mt, int renderer)
|
|||
case 3: s_gs = new GSRendererHW10(s_basemem, !!mt, s_irq); break;
|
||||
case 4: s_gs = new GSRendererSW(s_basemem, !!mt, s_irq, new GSDevice10()); break;
|
||||
case 5: s_gs = new GSRendererNull(s_basemem, !!mt, s_irq, new GSDevice10()); break;
|
||||
case 6: s_gs = new GSRendererSW(s_basemem, !!mt, s_irq, new GSDeviceNull()); break;
|
||||
case 7: s_gs = new GSRendererNull(s_basemem, !!mt, s_irq, new GSDeviceNull()); break;
|
||||
case 6: s_gs = new GSRendererOGL(s_basemem, !!mt, s_irq); break;
|
||||
case 7: s_gs = new GSRendererSW(s_basemem, !!mt, s_irq, new GSDeviceOGL()); break;
|
||||
case 8: s_gs = new GSRendererNull(s_basemem, !!mt, s_irq, new GSDeviceOGL()); break;
|
||||
case 9: s_gs = new GSRendererSW(s_basemem, !!mt, s_irq, new GSDeviceNull()); break;
|
||||
case 10: s_gs = new GSRendererNull(s_basemem, !!mt, s_irq, new GSDeviceNull()); break;
|
||||
}
|
||||
|
||||
if(!s_gs->Create(title))
|
||||
|
|
|
@ -103,7 +103,4 @@ public:
|
|||
|
||||
void Merge(GSTexture* st[2], GSVector4* sr, GSVector4* dr, const GSVector2i& fs, bool slbg, bool mmod, const GSVector4& c);
|
||||
void Interlace(const GSVector2i& ds, int field, int mode, float yoffset);
|
||||
|
||||
virtual void PSSetShaderResources(GSTexture* sr0, GSTexture* sr1) {}
|
||||
virtual void OMSetRenderTargets(GSTexture* rt, GSTexture* ds) {}
|
||||
};
|
||||
|
|
|
@ -114,23 +114,17 @@ bool GSDevice9::Create(GSWnd* wnd, bool vsync)
|
|||
|
||||
// shaders
|
||||
|
||||
uint32 psver = (uint32)theApp.GetConfig("PixelShaderVersion2", D3DPS_VERSION(2, 0));
|
||||
|
||||
if(psver > m_d3dcaps.PixelShaderVersion)
|
||||
if(m_d3dcaps.PixelShaderVersion < D3DPS_VERSION(2, 0))
|
||||
{
|
||||
string s = format(
|
||||
"Supported pixel shader version is too low!\n\nSupported: %d.%d\nSelected: %d.%d",
|
||||
D3DSHADER_VERSION_MAJOR(m_d3dcaps.PixelShaderVersion), D3DSHADER_VERSION_MINOR(m_d3dcaps.PixelShaderVersion),
|
||||
D3DSHADER_VERSION_MAJOR(psver), D3DSHADER_VERSION_MINOR(psver));
|
||||
"Supported pixel shader version is too low!\n\nSupported: %d.%d\nNeeded: 2.0 or higher",
|
||||
D3DSHADER_VERSION_MAJOR(m_d3dcaps.PixelShaderVersion), D3DSHADER_VERSION_MINOR(m_d3dcaps.PixelShaderVersion));
|
||||
|
||||
MessageBox(NULL, s.c_str(), "GSdx", MB_OK);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
m_d3dcaps.PixelShaderVersion = min(psver, m_d3dcaps.PixelShaderVersion);
|
||||
m_d3dcaps.VertexShaderVersion = m_d3dcaps.PixelShaderVersion & ~0x10000;
|
||||
|
||||
// convert
|
||||
|
||||
static const D3DVERTEXELEMENT9 il_convert[] =
|
||||
|
@ -224,8 +218,6 @@ bool GSDevice9::Reset(int w, int h, bool fs)
|
|||
|
||||
m_swapchain = NULL;
|
||||
|
||||
if(m_font) {m_font->OnLostDevice(); m_font = NULL;}
|
||||
|
||||
if(m_vs_cb) _aligned_free(m_vs_cb);
|
||||
if(m_ps_cb) _aligned_free(m_ps_cb);
|
||||
|
||||
|
@ -326,12 +318,6 @@ bool GSDevice9::Reset(int w, int h, bool fs)
|
|||
|
||||
m_backbuffer = new GSTexture9(backbuffer);
|
||||
|
||||
D3DXFONT_DESC fd;
|
||||
memset(&fd, 0, sizeof(fd));
|
||||
_tcscpy(fd.FaceName, _T("Arial"));
|
||||
fd.Height = 20;
|
||||
D3DXCreateFontIndirect(m_dev, &fd, &m_font);
|
||||
|
||||
m_dev->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
|
||||
m_dev->SetRenderState(D3DRS_LIGHTING, FALSE);
|
||||
m_dev->SetRenderState(D3DRS_ALPHATESTENABLE, FALSE);
|
||||
|
|
|
@ -104,7 +104,6 @@ private:
|
|||
|
||||
public: // TODO
|
||||
D3DPRESENT_PARAMETERS m_pp;
|
||||
CComPtr<ID3DXFont> m_font;
|
||||
|
||||
struct
|
||||
{
|
||||
|
|
|
@ -0,0 +1,211 @@
|
|||
/*
|
||||
* 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, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* http://www.gnu.org/copyleft/gpl.html
|
||||
*
|
||||
*/
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "GSdx.h"
|
||||
#include "GSDeviceOGL.h"
|
||||
#include "resource.h"
|
||||
|
||||
GSDeviceOGL::GSDeviceOGL()
|
||||
: m_hDC(NULL)
|
||||
, m_hGLRC(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
GSDeviceOGL::~GSDeviceOGL()
|
||||
{
|
||||
#ifdef _WINDOWS
|
||||
|
||||
if(m_hGLRC) {wglMakeCurrent(NULL, NULL); wglDeleteContext(m_hGLRC);}
|
||||
if(m_hDC) ReleaseDC((HWND)m_wnd->GetHandle(), m_hDC);
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
void GSDeviceOGL::OnCgError(CGcontext ctx, CGerror err)
|
||||
{
|
||||
printf("%s\n", cgGetErrorString(err));
|
||||
printf("%s\n", cgGetLastListing(ctx)); // ?
|
||||
}
|
||||
|
||||
bool GSDeviceOGL::Create(GSWnd* wnd, bool vsync)
|
||||
{
|
||||
if(!__super::Create(wnd, vsync))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
cgSetErrorHandler(OnStaticCgError, this);
|
||||
|
||||
#ifdef _WINDOWS
|
||||
|
||||
PIXELFORMATDESCRIPTOR pfd;
|
||||
|
||||
memset(&pfd, 0, sizeof(pfd));
|
||||
|
||||
pfd.nSize = sizeof(pfd);
|
||||
pfd.nVersion = 1;
|
||||
pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER;
|
||||
pfd.iPixelType = PFD_TYPE_RGBA;
|
||||
pfd.cColorBits = 32;
|
||||
pfd.cDepthBits = 32; // 24?
|
||||
pfd.cStencilBits = 8;
|
||||
pfd.iLayerType = PFD_MAIN_PLANE;
|
||||
|
||||
m_hDC = GetDC((HWND)m_wnd->GetHandle());
|
||||
|
||||
if(!m_hDC) return false;
|
||||
|
||||
if(!SetPixelFormat(m_hDC, ChoosePixelFormat(m_hDC, &pfd), &pfd))
|
||||
return false;
|
||||
|
||||
m_hGLRC = wglCreateContext(m_hDC);
|
||||
|
||||
if(!m_hGLRC) return false;
|
||||
|
||||
if(!wglMakeCurrent(m_hDC, m_hGLRC))
|
||||
return false;
|
||||
|
||||
#endif
|
||||
|
||||
// const char* exts = (const char*)glGetString(GL_EXTENSIONS);
|
||||
|
||||
// TODO
|
||||
|
||||
Reset(1, 1, true);
|
||||
|
||||
//
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GSDeviceOGL::Reset(int w, int h, bool fs)
|
||||
{
|
||||
if(!__super::Reset(w, h, fs))
|
||||
return false;
|
||||
|
||||
m_backbuffer = new GSTextureOGL(0); // ???
|
||||
|
||||
glCullFace(GL_FRONT_AND_BACK);
|
||||
glDisable(GL_LIGHTING);
|
||||
glDisable(GL_ALPHA_TEST);
|
||||
glDisable(GL_SCISSOR_TEST);
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
|
||||
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
|
||||
|
||||
// glViewport(0, 0, ?, ?);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void GSDeviceOGL::Flip()
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
void GSDeviceOGL::BeginScene()
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
void GSDeviceOGL::DrawPrimitive()
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
void GSDeviceOGL::EndScene()
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
void GSDeviceOGL::ClearRenderTarget(GSTexture* t, const GSVector4& c)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
void GSDeviceOGL::ClearRenderTarget(GSTexture* t, uint32 c)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
void GSDeviceOGL::ClearDepth(GSTexture* t, float c)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
void GSDeviceOGL::ClearStencil(GSTexture* t, uint8 c)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
GSTexture* GSDeviceOGL::Create(int type, int w, int h, int format)
|
||||
{
|
||||
// TODO
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
GSTexture* GSDeviceOGL::CreateRenderTarget(int w, int h, int format)
|
||||
{
|
||||
return __super::CreateRenderTarget(w, h, format ? format : 0); // TODO
|
||||
}
|
||||
|
||||
GSTexture* GSDeviceOGL::CreateDepthStencil(int w, int h, int format)
|
||||
{
|
||||
return __super::CreateDepthStencil(w, h, format ? format : 0); // TODO
|
||||
}
|
||||
|
||||
GSTexture* GSDeviceOGL::CreateTexture(int w, int h, int format)
|
||||
{
|
||||
return __super::CreateTexture(w, h, format ? format : 0); // TODO
|
||||
}
|
||||
|
||||
GSTexture* GSDeviceOGL::CreateOffscreen(int w, int h, int format)
|
||||
{
|
||||
return __super::CreateOffscreen(w, h, format ? format : 0); // TODO
|
||||
}
|
||||
|
||||
GSTexture* GSDeviceOGL::CopyOffscreen(GSTexture* src, const GSVector4& sr, int w, int h, int format)
|
||||
{
|
||||
// TODO
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void GSDeviceOGL::StretchRect(GSTexture* st, const GSVector4& sr, GSTexture* dt, const GSVector4& dr, int shader, bool linear)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
void GSDeviceOGL::DoMerge(GSTexture* st[2], GSVector4* sr, GSVector4* dr, GSTexture* dt, bool slbg, bool mmod, const GSVector4& c)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
void GSDeviceOGL::DoInterlace(GSTexture* st, GSTexture* dt, int shader, bool linear, float yoffset)
|
||||
{
|
||||
// TODO
|
||||
}
|
|
@ -0,0 +1,70 @@
|
|||
/*
|
||||
* 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, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* http://www.gnu.org/copyleft/gpl.html
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "GSDevice.h"
|
||||
#include "GSTextureOGL.h"
|
||||
|
||||
class GSDeviceOGL : public GSDevice
|
||||
{
|
||||
#ifdef _WINDOWS
|
||||
|
||||
HDC m_hDC;
|
||||
HGLRC m_hGLRC;
|
||||
|
||||
#endif
|
||||
|
||||
static void OnStaticCgError(CGcontext ctx, CGerror err, void* p) {((GSDeviceOGL*)p)->OnCgError(ctx, err);}
|
||||
void OnCgError(CGcontext ctx, CGerror err);
|
||||
|
||||
GSTexture* Create(int type, int w, int h, int format);
|
||||
|
||||
void DoMerge(GSTexture* st[2], GSVector4* sr, GSVector4* dr, GSTexture* dt, bool slbg, bool mmod, const GSVector4& c);
|
||||
void DoInterlace(GSTexture* st, GSTexture* dt, int shader, bool linear, float yoffset = 0);
|
||||
|
||||
public:
|
||||
GSDeviceOGL();
|
||||
virtual ~GSDeviceOGL();
|
||||
|
||||
bool Create(GSWnd* wnd, bool vsync);
|
||||
bool Reset(int w, int h, bool fs);
|
||||
|
||||
void Flip();
|
||||
|
||||
void BeginScene();
|
||||
void DrawPrimitive();
|
||||
void EndScene();
|
||||
|
||||
void ClearRenderTarget(GSTexture* t, const GSVector4& c);
|
||||
void ClearRenderTarget(GSTexture* t, uint32 c);
|
||||
void ClearDepth(GSTexture* t, float c);
|
||||
void ClearStencil(GSTexture* t, uint8 c);
|
||||
|
||||
GSTexture* CreateRenderTarget(int w, int h, int format = 0);
|
||||
GSTexture* CreateDepthStencil(int w, int h, int format = 0);
|
||||
GSTexture* CreateTexture(int w, int h, int format = 0);
|
||||
GSTexture* CreateOffscreen(int w, int h, int format = 0);
|
||||
|
||||
GSTexture* CopyOffscreen(GSTexture* src, const GSVector4& sr, int w, int h, int format = 0);
|
||||
|
||||
void StretchRect(GSTexture* st, const GSVector4& sr, GSTexture* dt, const GSVector4& dr, int shader = 0, bool linear = true);
|
||||
};
|
|
@ -163,7 +163,7 @@ void GSDrawScanline::BeginDraw(const GSRasterizerData* data, Functions* f)
|
|||
|
||||
//
|
||||
|
||||
f->ssl = m_ds.Lookup(m_sel);
|
||||
f->ssl = m_ds[m_sel];
|
||||
|
||||
if(m_sel.aa1)// && (m_state->m_perfmon.GetFrame() & 0x40))
|
||||
{
|
||||
|
@ -173,7 +173,7 @@ void GSDrawScanline::BeginDraw(const GSRasterizerData* data, Functions* f)
|
|||
sel.zwrite = 0;
|
||||
sel.edge = 1;
|
||||
|
||||
f->ssle = m_ds.Lookup(sel);
|
||||
f->ssle = m_ds[sel];
|
||||
}
|
||||
|
||||
if(m_sel.IsSolidRect())
|
||||
|
@ -197,7 +197,7 @@ void GSDrawScanline::BeginDraw(const GSRasterizerData* data, Functions* f)
|
|||
sel.zb = m_sel.zb;
|
||||
sel.zoverflow = m_sel.zoverflow;
|
||||
|
||||
f->ssp = m_sp.Lookup(sel);
|
||||
f->ssp = m_sp[sel];
|
||||
}
|
||||
|
||||
void GSDrawScanline::EndDraw(const GSRasterizerStats& stats)
|
||||
|
|
|
@ -72,7 +72,7 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
VALUE Lookup(KEY key)
|
||||
VALUE operator [] (KEY key)
|
||||
{
|
||||
m_active = NULL;
|
||||
|
||||
|
|
|
@ -360,12 +360,11 @@ void GSRenderer::VSync(int field)
|
|||
|
||||
if(GSTexture* offscreen = m_dev->CopyOffscreen(current, GSVector4(0, 0, 1, 1), size.x, size.y))
|
||||
{
|
||||
uint8* bits = NULL;
|
||||
int pitch = 0;
|
||||
GSTexture::GSMap m;
|
||||
|
||||
if(offscreen->Map(&bits, pitch))
|
||||
if(offscreen->Map(m))
|
||||
{
|
||||
m_capture.DeliverFrame(bits, pitch, m_dev->IsCurrentRGBA());
|
||||
m_capture.DeliverFrame(m.bits, m.pitch, m_dev->IsCurrentRGBA());
|
||||
|
||||
offscreen->Unmap();
|
||||
}
|
||||
|
|
|
@ -0,0 +1,80 @@
|
|||
/*
|
||||
* 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, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* http://www.gnu.org/copyleft/gpl.html
|
||||
*
|
||||
*/
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "GSRendererOGL.h"
|
||||
#include "GSCrc.h"
|
||||
#include "resource.h"
|
||||
|
||||
GSRendererOGL::GSRendererOGL(uint8* base, bool mt, void (*irq)())
|
||||
: GSRendererHW<GSVertexOGL>(base, mt, irq, new GSDeviceOGL(), new GSTextureCacheOGL(this))
|
||||
{
|
||||
InitVertexKick<GSRendererOGL>();
|
||||
}
|
||||
|
||||
bool GSRendererOGL::Create(const string& title)
|
||||
{
|
||||
if(!__super::Create(title))
|
||||
return false;
|
||||
|
||||
// TODO
|
||||
|
||||
/*
|
||||
|
||||
if(!m_tfx.Create((GSDeviceOGL*)m_dev))
|
||||
return false;
|
||||
|
||||
*/
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template<uint32 prim, uint32 tme, uint32 fst>
|
||||
void GSRendererOGL::VertexKick(bool skip)
|
||||
{
|
||||
GSVertexOGL& dst = m_vl.AddTail();
|
||||
|
||||
// TODO
|
||||
|
||||
int count = 0;
|
||||
|
||||
if(GSVertexOGL* v = DrawingKick<prim>(skip, count))
|
||||
{
|
||||
// TODO
|
||||
|
||||
m_count += count;
|
||||
}
|
||||
}
|
||||
|
||||
void GSRendererOGL::Draw(int prim, GSTexture* rt, GSTexture* ds, GSTextureCache::GSCachedTexture* tex)
|
||||
{
|
||||
GSDrawingEnvironment& env = m_env;
|
||||
GSDrawingContext* context = m_context;
|
||||
|
||||
// m_perfmon.Put(GSPerfMon::Prim, prims);
|
||||
m_perfmon.Put(GSPerfMon::Draw, 1);
|
||||
|
||||
m_dev->BeginScene();
|
||||
|
||||
// TODO
|
||||
|
||||
m_dev->EndScene();
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
* 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, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* http://www.gnu.org/copyleft/gpl.html
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "GSRendererHW.h"
|
||||
#include "GSVertexHW.h"
|
||||
#include "GSTextureCacheOGL.h"
|
||||
// TODO: #include "GSTextureFXOGL.h"
|
||||
|
||||
class GSRendererOGL : public GSRendererHW<GSVertexOGL>
|
||||
{
|
||||
protected:
|
||||
void Draw(int prim, GSTexture* rt, GSTexture* ds, GSTextureCache::GSCachedTexture* tex);
|
||||
|
||||
public:
|
||||
GSRendererOGL(uint8* base, bool mt, void (*irq)());
|
||||
|
||||
bool Create(const string& title);
|
||||
|
||||
template<uint32 prim, uint32 tme, uint32 fst> void VertexKick(bool skip);
|
||||
};
|
|
@ -33,17 +33,11 @@ GSSetting GSSettingsDlg::g_renderers[] =
|
|||
{3, "Direct3D10 (Hardware)", NULL},
|
||||
{4, "Direct3D10 (Software)", NULL},
|
||||
{5, "Direct3D10 (Null)", NULL},
|
||||
{6, "Null (Software)", NULL},
|
||||
{7, "Null (Null)", NULL},
|
||||
};
|
||||
|
||||
GSSetting GSSettingsDlg::g_psversion[] =
|
||||
{
|
||||
{D3DPS_VERSION(3, 0), "Pixel Shader 3.0", NULL},
|
||||
{D3DPS_VERSION(2, 0), "Pixel Shader 2.0", NULL},
|
||||
//{D3DPS_VERSION(1, 4), "Pixel Shader 1.4", NULL},
|
||||
//{D3DPS_VERSION(1, 1), "Pixel Shader 1.1", NULL},
|
||||
//{D3DPS_VERSION(0, 0), "Fixed Pipeline (bogus)", NULL},
|
||||
{6, "OpenGL (Hardware)", NULL},
|
||||
{7, "OpenGL (Software)", NULL},
|
||||
{8, "OpenGL (Null)", NULL},
|
||||
{9, "Null (Software)", NULL},
|
||||
{10, "Null (Null)", NULL},
|
||||
};
|
||||
|
||||
GSSetting GSSettingsDlg::g_interlace[] =
|
||||
|
@ -73,10 +67,6 @@ void GSSettingsDlg::OnInit()
|
|||
{
|
||||
__super::OnInit();
|
||||
|
||||
D3DCAPS9 caps;
|
||||
memset(&caps, 0, sizeof(caps));
|
||||
caps.PixelShaderVersion = D3DPS_VERSION(0, 0);
|
||||
|
||||
m_modes.clear();
|
||||
|
||||
{
|
||||
|
@ -107,8 +97,6 @@ void GSSettingsDlg::OnInit()
|
|||
ComboBoxAppend(hWnd, str.c_str(), (LPARAM)&m_modes.back(), w == mode.Width && h == mode.Height && hz == mode.RefreshRate);
|
||||
}
|
||||
}
|
||||
|
||||
d3d->GetDeviceCaps(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, &caps);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -124,7 +112,6 @@ void GSSettingsDlg::OnInit()
|
|||
}
|
||||
|
||||
ComboBoxInit(GetDlgItem(m_hWnd, IDC_RENDERER), &renderers[0], renderers.size(), theApp.GetConfig("Renderer", 0));
|
||||
ComboBoxInit(GetDlgItem(m_hWnd, IDC_SHADER), g_psversion, countof(g_psversion), theApp.GetConfig("PixelShaderVersion2", D3DPS_VERSION(2, 0)), caps.PixelShaderVersion);
|
||||
ComboBoxInit(GetDlgItem(m_hWnd, IDC_INTERLACE), g_interlace, countof(g_interlace), theApp.GetConfig("Interlace", 0));
|
||||
ComboBoxInit(GetDlgItem(m_hWnd, IDC_ASPECTRATIO), g_aspectratio, countof(g_aspectratio), theApp.GetConfig("AspectRatio", 1));
|
||||
|
||||
|
@ -176,11 +163,6 @@ bool GSSettingsDlg::OnCommand(HWND hWnd, UINT id, UINT code)
|
|||
theApp.SetConfig("Renderer", (int)data);
|
||||
}
|
||||
|
||||
if(ComboBoxGetSelData(GetDlgItem(m_hWnd, IDC_SHADER), data))
|
||||
{
|
||||
theApp.SetConfig("PixelShaderVersion2", (int)data);
|
||||
}
|
||||
|
||||
if(ComboBoxGetSelData(GetDlgItem(m_hWnd, IDC_INTERLACE), data))
|
||||
{
|
||||
theApp.SetConfig("Interlace", (int)data);
|
||||
|
@ -215,15 +197,15 @@ void GSSettingsDlg::UpdateControls()
|
|||
{
|
||||
bool dx9 = i >= 0 && i <= 2;
|
||||
bool dx10 = i >= 3 && i <= 5;
|
||||
bool hw = i == 0 || i == 3;
|
||||
bool sw = i == 1 || i == 4 || i == 6;
|
||||
bool ogl = i >= 6 && i <= 8;
|
||||
bool hw = i == 0 || i == 3 || i == 6;
|
||||
bool sw = i == 1 || i == 4 || i == 7;
|
||||
bool native = !!IsDlgButtonChecked(m_hWnd, IDC_NATIVERES);
|
||||
|
||||
ShowWindow(GetDlgItem(m_hWnd, IDC_LOGO9), dx9 ? SW_SHOW : SW_HIDE);
|
||||
ShowWindow(GetDlgItem(m_hWnd, IDC_LOGO10), dx10 ? SW_SHOW : SW_HIDE);
|
||||
|
||||
EnableWindow(GetDlgItem(m_hWnd, IDC_RESOLUTION), dx9);
|
||||
EnableWindow(GetDlgItem(m_hWnd, IDC_SHADER), dx9);
|
||||
EnableWindow(GetDlgItem(m_hWnd, IDC_RESX), hw && !native);
|
||||
EnableWindow(GetDlgItem(m_hWnd, IDC_RESX_EDIT), hw && !native);
|
||||
EnableWindow(GetDlgItem(m_hWnd, IDC_RESY), hw && !native);
|
||||
|
|
|
@ -38,7 +38,6 @@ public:
|
|||
GSSettingsDlg();
|
||||
|
||||
static GSSetting g_renderers[];
|
||||
static GSSetting g_psversion[];
|
||||
static GSSetting g_interlace[];
|
||||
static GSSetting g_aspectratio[];
|
||||
};
|
|
@ -28,13 +28,15 @@ class GSTexture
|
|||
public:
|
||||
GSVector2 m_scale;
|
||||
|
||||
struct GSMap {uint8* bits; int pitch;};
|
||||
|
||||
enum {None, RenderTarget, DepthStencil, Texture, Offscreen};
|
||||
|
||||
public:
|
||||
GSTexture() : m_scale(1, 1) {}
|
||||
virtual ~GSTexture() {}
|
||||
|
||||
enum {None, RenderTarget, DepthStencil, Texture, Offscreen};
|
||||
|
||||
virtual operator bool() = 0;
|
||||
virtual operator bool() {ASSERT(0); return false;}
|
||||
|
||||
virtual int GetType() const = 0;
|
||||
virtual int GetWidth() const = 0;
|
||||
|
@ -42,7 +44,7 @@ public:
|
|||
virtual int GetFormat() const = 0;
|
||||
|
||||
virtual bool Update(const GSVector4i& r, const void* data, int pitch) = 0;
|
||||
virtual bool Map(uint8** bits, int& pitch, const GSVector4i* r = NULL) = 0;
|
||||
virtual bool Map(GSMap& m, const GSVector4i* r = NULL) = 0;
|
||||
virtual void Unmap() = 0;
|
||||
virtual bool Save(const string& fn, bool dds = false) = 0;
|
||||
|
||||
|
|
|
@ -31,11 +31,6 @@ GSTexture10::GSTexture10(ID3D10Texture2D* texture)
|
|||
m_texture->GetDesc(&m_desc);
|
||||
}
|
||||
|
||||
GSTexture10::operator bool()
|
||||
{
|
||||
return !!m_texture;
|
||||
}
|
||||
|
||||
int GSTexture10::GetType() const
|
||||
{
|
||||
if(m_desc.BindFlags & D3D10_BIND_RENDER_TARGET) return GSTexture::RenderTarget;
|
||||
|
@ -74,7 +69,7 @@ bool GSTexture10::Update(const GSVector4i& r, const void* data, int pitch)
|
|||
return false;
|
||||
}
|
||||
|
||||
bool GSTexture10::Map(uint8** bits, int& pitch, const GSVector4i* r)
|
||||
bool GSTexture10::Map(GSMap& m, const GSVector4i* r)
|
||||
{
|
||||
if(r != NULL)
|
||||
{
|
||||
|
@ -89,8 +84,8 @@ bool GSTexture10::Map(uint8** bits, int& pitch, const GSVector4i* r)
|
|||
|
||||
if(SUCCEEDED(m_texture->Map(0, D3D10_MAP_READ_WRITE, 0, &map)))
|
||||
{
|
||||
*bits = (uint8*)map.pData;
|
||||
pitch = (int)map.RowPitch;
|
||||
m.bits = (uint8*)map.pData;
|
||||
m.pitch = (int)map.RowPitch;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -35,15 +35,13 @@ class GSTexture10 : public GSTexture
|
|||
public:
|
||||
explicit GSTexture10(ID3D10Texture2D* texture);
|
||||
|
||||
operator bool();
|
||||
|
||||
int GetType() const;
|
||||
int GetWidth() const;
|
||||
int GetHeight() const;
|
||||
int GetFormat() const;
|
||||
|
||||
bool Update(const GSVector4i& r, const void* data, int pitch);
|
||||
bool Map(uint8** bits, int& pitch, const GSVector4i* r);
|
||||
bool Map(GSMap& m, const GSVector4i* r);
|
||||
void Unmap();
|
||||
bool Save(const string& fn, bool dds = false);
|
||||
|
||||
|
|
|
@ -45,11 +45,6 @@ GSTexture7::GSTexture7(int type, IDirectDrawSurface7* system, IDirectDrawSurface
|
|||
video->GetSurfaceDesc(&m_desc);
|
||||
}
|
||||
|
||||
GSTexture7::operator bool()
|
||||
{
|
||||
return !!m_system;
|
||||
}
|
||||
|
||||
int GSTexture7::GetType() const
|
||||
{
|
||||
return m_type;
|
||||
|
@ -123,7 +118,7 @@ bool GSTexture7::Update(const GSVector4i& r, const void* data, int pitch)
|
|||
return false;
|
||||
}
|
||||
|
||||
bool GSTexture7::Map(uint8** bits, int& pitch, const GSVector4i* r)
|
||||
bool GSTexture7::Map(GSMap& m, const GSVector4i* r)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
|
@ -138,8 +133,8 @@ bool GSTexture7::Map(uint8** bits, int& pitch, const GSVector4i* r)
|
|||
|
||||
if(SUCCEEDED(hr = m_system->Lock(NULL, &desc, DDLOCK_WAIT | DDLOCK_SURFACEMEMORYPTR, NULL)))
|
||||
{
|
||||
*bits = (uint8*)desc.lpSurface;
|
||||
pitch = (int)desc.lPitch;
|
||||
m.bits = (uint8*)desc.lpSurface;
|
||||
m.pitch = (int)desc.lPitch;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -35,15 +35,13 @@ public:
|
|||
GSTexture7(int type, IDirectDrawSurface7* system);
|
||||
GSTexture7(int type, IDirectDrawSurface7* system, IDirectDrawSurface7* video);
|
||||
|
||||
operator bool();
|
||||
|
||||
int GetType() const;
|
||||
int GetWidth() const;
|
||||
int GetHeight() const;
|
||||
int GetFormat() const;
|
||||
|
||||
bool Update(const GSVector4i& r, const void* data, int pitch);
|
||||
bool Map(uint8** bits, int& pitch, const GSVector4i* r);
|
||||
bool Map(GSMap& m, const GSVector4i* r);
|
||||
void Unmap();
|
||||
bool Save(const string& fn, bool dds = false);
|
||||
|
||||
|
|
|
@ -52,11 +52,6 @@ GSTexture9::~GSTexture9()
|
|||
{
|
||||
}
|
||||
|
||||
GSTexture9::operator bool()
|
||||
{
|
||||
return !!m_surface;
|
||||
}
|
||||
|
||||
int GSTexture9::GetType() const
|
||||
{
|
||||
if(m_desc.Usage & D3DUSAGE_RENDERTARGET) return GSTexture::RenderTarget;
|
||||
|
@ -111,7 +106,7 @@ bool GSTexture9::Update(const GSVector4i& r, const void* data, int pitch)
|
|||
return false;
|
||||
}
|
||||
|
||||
bool GSTexture9::Map(uint8** bits, int& pitch, const GSVector4i* r)
|
||||
bool GSTexture9::Map(GSMap& m, const GSVector4i* r)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
|
@ -121,8 +116,8 @@ bool GSTexture9::Map(uint8** bits, int& pitch, const GSVector4i* r)
|
|||
|
||||
if(SUCCEEDED(hr = m_surface->LockRect(&lr, (LPRECT)r, 0)))
|
||||
{
|
||||
*bits = (uint8*)lr.pBits;
|
||||
pitch = (int)lr.Pitch;
|
||||
m.bits = (uint8*)lr.pBits;
|
||||
m.pitch = (int)lr.Pitch;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -35,15 +35,13 @@ public:
|
|||
explicit GSTexture9(IDirect3DTexture9* texture);
|
||||
virtual ~GSTexture9();
|
||||
|
||||
operator bool();
|
||||
|
||||
int GetType() const;
|
||||
int GetWidth() const;
|
||||
int GetHeight() const;
|
||||
int GetFormat() const;
|
||||
|
||||
bool Update(const GSVector4i& r, const void* data, int pitch);
|
||||
bool Map(uint8** bits, int& pitch, const GSVector4i* r);
|
||||
bool Map(GSMap& m, const GSVector4i* r);
|
||||
void Unmap();
|
||||
bool Save(const string& fn, bool dds = false);
|
||||
|
||||
|
|
|
@ -128,7 +128,12 @@ GSTextureCache::GSRenderTarget* GSTextureCache::GetRenderTarget(const GIFRegTEX0
|
|||
{
|
||||
hh *= 2;
|
||||
}
|
||||
|
||||
/*
|
||||
if(hh < 512)
|
||||
{
|
||||
hh = 512;
|
||||
}
|
||||
*/
|
||||
if(ww > 0 && hh > 0)
|
||||
{
|
||||
rt->m_texture->m_scale.x = (float)w / ww;
|
||||
|
@ -647,6 +652,54 @@ bool GSTextureCache::GSRenderTarget::Create(int w, int h)
|
|||
return m_texture != NULL;
|
||||
}
|
||||
|
||||
void GSTextureCache::GSRenderTarget::Update()
|
||||
{
|
||||
__super::Update();
|
||||
|
||||
// FIXME: the union of the rects may also update wrong parts of the render target (but a lot faster :)
|
||||
|
||||
GSVector4i r = m_dirty.GetDirtyRectAndClear(m_TEX0, m_texture->GetSize());
|
||||
|
||||
if(r.rempty()) return;
|
||||
|
||||
int w = r.width();
|
||||
int h = r.height();
|
||||
|
||||
if(GSTexture* t = m_renderer->m_dev->CreateTexture(w, h))
|
||||
{
|
||||
GIFRegTEXA TEXA;
|
||||
|
||||
TEXA.AEM = 1;
|
||||
TEXA.TA0 = 0;
|
||||
TEXA.TA1 = 0x80;
|
||||
|
||||
GSTexture::GSMap m;
|
||||
|
||||
if(t->Map(m))
|
||||
{
|
||||
m_renderer->m_mem.ReadTexture(r, m.bits, m.pitch, m_TEX0, TEXA);
|
||||
|
||||
t->Unmap();
|
||||
}
|
||||
else
|
||||
{
|
||||
static uint8* buff = (uint8*)::_aligned_malloc(1024 * 1024 * 4, 16);
|
||||
|
||||
int pitch = ((w + 3) & ~3) * 4;
|
||||
|
||||
m_renderer->m_mem.ReadTexture(r, buff, pitch, m_TEX0, TEXA);
|
||||
|
||||
t->Update(r.rsize(), buff, pitch);
|
||||
}
|
||||
|
||||
// m_renderer->m_perfmon.Put(GSPerfMon::Unswizzle, w * h * 4);
|
||||
|
||||
m_renderer->m_dev->StretchRect(t, m_texture, GSVector4(r) * GSVector4(m_texture->m_scale).xyxy());
|
||||
|
||||
m_renderer->m_dev->Recycle(t);
|
||||
}
|
||||
}
|
||||
|
||||
// GSTextureCache::GSDepthStencil
|
||||
|
||||
GSTextureCache::GSDepthStencil::GSDepthStencil(GSRenderer* r)
|
||||
|
@ -664,6 +717,13 @@ bool GSTextureCache::GSDepthStencil::Create(int w, int h)
|
|||
return m_texture != NULL;
|
||||
}
|
||||
|
||||
void GSTextureCache::GSDepthStencil::Update()
|
||||
{
|
||||
__super::Update();
|
||||
|
||||
// TODO
|
||||
}
|
||||
|
||||
// GSTextureCache::GSCachedTexture
|
||||
|
||||
GSTextureCache::GSCachedTexture::GSCachedTexture(GSRenderer* r)
|
||||
|
@ -701,14 +761,13 @@ void GSTextureCache::GSCachedTexture::Update()
|
|||
|
||||
m_valid = m_valid.runion(r);
|
||||
|
||||
uint8* bits = NULL;
|
||||
int pitch = 0;
|
||||
GSTexture::GSMap m;
|
||||
|
||||
if(m_texture->Map(&bits, pitch, &r))
|
||||
if(m_texture->Map(m, &r))
|
||||
{
|
||||
// in dx9 managed textures can be written directly, less copying is faster, but still not as fast as dx10's UpdateResource
|
||||
|
||||
m_renderer->m_mem.ReadTextureNP(r, bits, pitch, m_renderer->m_context->TEX0, m_renderer->m_env.TEXA);
|
||||
m_renderer->m_mem.ReadTextureNP(r, m.bits, m.pitch, m_renderer->m_context->TEX0, m_renderer->m_env.TEXA);
|
||||
|
||||
m_texture->Unmap();
|
||||
}
|
||||
|
@ -716,7 +775,7 @@ void GSTextureCache::GSCachedTexture::Update()
|
|||
{
|
||||
static uint8* buff = (uint8*)::_aligned_malloc(1024 * 1024 * 4, 16);
|
||||
|
||||
pitch = ((r.width() + 3) & ~3) * 4;
|
||||
int pitch = ((r.width() + 3) & ~3) * 4;
|
||||
|
||||
m_renderer->m_mem.ReadTextureNP(r, buff, pitch, m_renderer->m_context->TEX0, m_renderer->m_env.TEXA);
|
||||
|
||||
|
|
|
@ -52,6 +52,8 @@ public:
|
|||
|
||||
explicit GSRenderTarget(GSRenderer* r);
|
||||
|
||||
void Update();
|
||||
|
||||
virtual bool Create(int w, int h);
|
||||
virtual void Read(const GSVector4i& r) = 0;
|
||||
};
|
||||
|
@ -63,6 +65,8 @@ public:
|
|||
|
||||
explicit GSDepthStencil(GSRenderer* renderer);
|
||||
|
||||
void Update();
|
||||
|
||||
virtual bool Create(int w, int h);
|
||||
};
|
||||
|
||||
|
|
|
@ -31,44 +31,6 @@ GSTextureCache10::GSTextureCache10(GSRenderer* r)
|
|||
|
||||
// GSRenderTargetHW10
|
||||
|
||||
void GSTextureCache10::GSRenderTargetHW10::Update()
|
||||
{
|
||||
__super::Update();
|
||||
|
||||
// FIXME: the union of the rects may also update wrong parts of the render target (but a lot faster :)
|
||||
|
||||
GSVector4i r = m_dirty.GetDirtyRectAndClear(m_TEX0, m_texture->GetSize());
|
||||
|
||||
if(r.rempty()) return;
|
||||
|
||||
int w = r.width();
|
||||
int h = r.height();
|
||||
|
||||
if(GSTexture* t = m_renderer->m_dev->CreateTexture(w, h))
|
||||
{
|
||||
static uint8* buff = (uint8*)_aligned_malloc(1024 * 1024 * 4, 16);
|
||||
static int pitch = 1024 * 4;
|
||||
|
||||
GIFRegTEXA TEXA;
|
||||
|
||||
TEXA.AEM = 1;
|
||||
TEXA.TA0 = 0;
|
||||
TEXA.TA1 = 0x80;
|
||||
|
||||
m_renderer->m_mem.ReadTexture(r, buff, pitch, m_TEX0, TEXA);
|
||||
|
||||
// s->m_perfmon.Put(GSPerfMon::Unswizzle, w * h * 4);
|
||||
|
||||
t->Update(GSVector4i(0, 0, w, h), buff, pitch);
|
||||
|
||||
GSVector4 dr = GSVector4(r) * GSVector4(m_texture->m_scale).xyxy();
|
||||
|
||||
m_renderer->m_dev->StretchRect(t, m_texture, dr);
|
||||
|
||||
m_renderer->m_dev->Recycle(t);
|
||||
}
|
||||
}
|
||||
|
||||
void GSTextureCache10::GSRenderTargetHW10::Read(const GSVector4i& r)
|
||||
{
|
||||
if(m_TEX0.PSM != PSM_PSMCT32
|
||||
|
@ -98,10 +60,9 @@ void GSTextureCache10::GSRenderTargetHW10::Read(const GSVector4i& r)
|
|||
|
||||
if(GSTexture* offscreen = m_renderer->m_dev->CopyOffscreen(m_texture, src, w, h, format))
|
||||
{
|
||||
uint8* bits;
|
||||
int pitch;
|
||||
GSTexture::GSMap m;
|
||||
|
||||
if(offscreen->Map(&bits, pitch))
|
||||
if(offscreen->Map(m))
|
||||
{
|
||||
// TODO: block level write
|
||||
|
||||
|
@ -112,40 +73,40 @@ void GSTextureCache10::GSRenderTargetHW10::Read(const GSVector4i& r)
|
|||
|
||||
if(m_TEX0.PSM == PSM_PSMCT32)
|
||||
{
|
||||
for(int y = r.top; y < r.bottom; y++, bits += pitch)
|
||||
for(int y = r.top; y < r.bottom; y++, m.bits += m.pitch)
|
||||
{
|
||||
uint32 addr = pa(0, y, bp, bw);
|
||||
int* offset = GSLocalMemory::m_psm[m_TEX0.PSM].rowOffset[y & 7];
|
||||
|
||||
for(int x = r.left, i = 0; x < r.right; x++, i++)
|
||||
{
|
||||
m_renderer->m_mem.WritePixel32(addr + offset[x], ((uint32*)bits)[i]);
|
||||
m_renderer->m_mem.WritePixel32(addr + offset[x], ((uint32*)m.bits)[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(m_TEX0.PSM == PSM_PSMCT24)
|
||||
{
|
||||
for(int y = r.top; y < r.bottom; y++, bits += pitch)
|
||||
for(int y = r.top; y < r.bottom; y++, m.bits += m.pitch)
|
||||
{
|
||||
uint32 addr = pa(0, y, bp, bw);
|
||||
int* offset = GSLocalMemory::m_psm[m_TEX0.PSM].rowOffset[y & 7];
|
||||
|
||||
for(int x = r.left, i = 0; x < r.right; x++, i++)
|
||||
{
|
||||
m_renderer->m_mem.WritePixel24(addr + offset[x], ((uint32*)bits)[i]);
|
||||
m_renderer->m_mem.WritePixel24(addr + offset[x], ((uint32*)m.bits)[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(m_TEX0.PSM == PSM_PSMCT16 || m_TEX0.PSM == PSM_PSMCT16S)
|
||||
{
|
||||
for(int y = r.top; y < r.bottom; y++, bits += pitch)
|
||||
for(int y = r.top; y < r.bottom; y++, m.bits += m.pitch)
|
||||
{
|
||||
uint32 addr = pa(0, y, bp, bw);
|
||||
int* offset = GSLocalMemory::m_psm[m_TEX0.PSM].rowOffset[y & 7];
|
||||
|
||||
for(int x = r.left, i = 0; x < r.right; x++, i++)
|
||||
{
|
||||
m_renderer->m_mem.WritePixel16(addr + offset[x], ((uint16*)bits)[i]);
|
||||
m_renderer->m_mem.WritePixel16(addr + offset[x], ((uint16*)m.bits)[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -161,15 +122,6 @@ void GSTextureCache10::GSRenderTargetHW10::Read(const GSVector4i& r)
|
|||
}
|
||||
}
|
||||
|
||||
// GSDepthStencilHW10
|
||||
|
||||
void GSTextureCache10::GSDepthStencilHW10::Update()
|
||||
{
|
||||
__super::Update();
|
||||
|
||||
// TODO
|
||||
}
|
||||
|
||||
// GSTextureHW10
|
||||
|
||||
bool GSTextureCache10::GSCachedTextureHW10::Create()
|
||||
|
|
|
@ -31,7 +31,6 @@ class GSTextureCache10 : public GSTextureCache
|
|||
public:
|
||||
explicit GSRenderTargetHW10(GSRenderer* r) : GSRenderTarget(r) {}
|
||||
|
||||
void Update();
|
||||
void Read(const GSVector4i& r);
|
||||
};
|
||||
|
||||
|
@ -39,8 +38,6 @@ class GSTextureCache10 : public GSTextureCache
|
|||
{
|
||||
public:
|
||||
explicit GSDepthStencilHW10(GSRenderer* r) : GSDepthStencil(r) {}
|
||||
|
||||
void Update();
|
||||
};
|
||||
|
||||
class GSCachedTextureHW10 : public GSCachedTexture
|
||||
|
|
|
@ -31,45 +31,6 @@ GSTextureCache9::GSTextureCache9(GSRenderer* r)
|
|||
|
||||
// GSRenderTarget9
|
||||
|
||||
void GSTextureCache9::GSRenderTarget9::Update()
|
||||
{
|
||||
__super::Update();
|
||||
|
||||
// FIXME: the union of the rects may also update wrong parts of the render target (but a lot faster :)
|
||||
|
||||
GSVector4i r = m_dirty.GetDirtyRectAndClear(m_TEX0, m_texture->GetSize());
|
||||
|
||||
if(r.rempty()) return;
|
||||
|
||||
int w = r.width();
|
||||
int h = r.height();
|
||||
|
||||
if(GSTexture* t = m_renderer->m_dev->CreateTexture(w, h))
|
||||
{
|
||||
uint8* bits;
|
||||
int pitch;
|
||||
|
||||
if(t->Map(&bits, pitch))
|
||||
{
|
||||
GIFRegTEXA TEXA;
|
||||
|
||||
TEXA.AEM = 1;
|
||||
TEXA.TA0 = 0;
|
||||
TEXA.TA1 = 0x80;
|
||||
|
||||
m_renderer->m_mem.ReadTexture(r, bits, pitch, m_TEX0, TEXA);
|
||||
|
||||
t->Unmap();
|
||||
|
||||
// m_renderer->m_perfmon.Put(GSPerfMon::Unswizzle, r.Width() * r.Height() * 4);
|
||||
|
||||
m_renderer->m_dev->StretchRect(t, m_texture, GSVector4(r) * GSVector4(m_texture->m_scale).xyxy());
|
||||
}
|
||||
|
||||
m_renderer->m_dev->Recycle(t);
|
||||
}
|
||||
}
|
||||
|
||||
void GSTextureCache9::GSRenderTarget9::Read(const GSVector4i& r)
|
||||
{
|
||||
if(m_TEX0.PSM != PSM_PSMCT32
|
||||
|
@ -97,10 +58,9 @@ void GSTextureCache9::GSRenderTarget9::Read(const GSVector4i& r)
|
|||
|
||||
if(GSTexture* offscreen = m_renderer->m_dev->CopyOffscreen(m_texture, src, w, h))
|
||||
{
|
||||
uint8* bits;
|
||||
int pitch;
|
||||
GSTexture::GSMap m;
|
||||
|
||||
if(offscreen->Map(&bits, pitch))
|
||||
if(offscreen->Map(m))
|
||||
{
|
||||
// TODO: block level write
|
||||
|
||||
|
@ -111,40 +71,40 @@ void GSTextureCache9::GSRenderTarget9::Read(const GSVector4i& r)
|
|||
|
||||
if(m_TEX0.PSM == PSM_PSMCT32)
|
||||
{
|
||||
for(int y = r.top; y < r.bottom; y++, bits += pitch)
|
||||
for(int y = r.top; y < r.bottom; y++, m.bits += m.pitch)
|
||||
{
|
||||
uint32 addr = pa(0, y, bp, bw);
|
||||
int* offset = GSLocalMemory::m_psm[m_TEX0.PSM].rowOffset[y & 7];
|
||||
|
||||
for(int x = r.left, i = 0; x < r.right; x++, i++)
|
||||
{
|
||||
m_renderer->m_mem.WritePixel32(addr + offset[x], ((uint32*)bits)[i]);
|
||||
m_renderer->m_mem.WritePixel32(addr + offset[x], ((uint32*)m.bits)[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(m_TEX0.PSM == PSM_PSMCT24)
|
||||
{
|
||||
for(int y = r.top; y < r.bottom; y++, bits += pitch)
|
||||
for(int y = r.top; y < r.bottom; y++, m.bits += m.pitch)
|
||||
{
|
||||
uint32 addr = pa(0, y, bp, bw);
|
||||
int* offset = GSLocalMemory::m_psm[m_TEX0.PSM].rowOffset[y & 7];
|
||||
|
||||
for(int x = r.left, i = 0; x < r.right; x++, i++)
|
||||
{
|
||||
m_renderer->m_mem.WritePixel24(addr + offset[x], ((uint32*)bits)[i]);
|
||||
m_renderer->m_mem.WritePixel24(addr + offset[x], ((uint32*)m.bits)[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(m_TEX0.PSM == PSM_PSMCT16 || m_TEX0.PSM == PSM_PSMCT16S)
|
||||
{
|
||||
for(int y = r.top; y < r.bottom; y++, bits += pitch)
|
||||
for(int y = r.top; y < r.bottom; y++, m.bits += m.pitch)
|
||||
{
|
||||
uint32 addr = pa(0, y, bp, bw);
|
||||
int* offset = GSLocalMemory::m_psm[m_TEX0.PSM].rowOffset[y & 7];
|
||||
|
||||
for(int x = r.left, i = 0; x < r.right; x++, i++)
|
||||
{
|
||||
m_renderer->m_mem.WriteFrame16(addr + offset[x], ((uint32*)bits)[i]);
|
||||
m_renderer->m_mem.WriteFrame16(addr + offset[x], ((uint32*)m.bits)[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -160,15 +120,6 @@ void GSTextureCache9::GSRenderTarget9::Read(const GSVector4i& r)
|
|||
}
|
||||
}
|
||||
|
||||
// GSDepthStencil9
|
||||
|
||||
void GSTextureCache9::GSDepthStencil9::Update()
|
||||
{
|
||||
__super::Update();
|
||||
|
||||
// TODO
|
||||
}
|
||||
|
||||
// GSTexture9
|
||||
|
||||
bool GSTextureCache9::GSCachedTexture9::Create()
|
||||
|
|
|
@ -31,7 +31,6 @@ class GSTextureCache9 : public GSTextureCache
|
|||
public:
|
||||
explicit GSRenderTarget9(GSRenderer* r) : GSRenderTarget(r) {}
|
||||
|
||||
void Update();
|
||||
void Read(const GSVector4i& r);
|
||||
};
|
||||
|
||||
|
@ -39,8 +38,6 @@ class GSTextureCache9 : public GSTextureCache
|
|||
{
|
||||
public:
|
||||
explicit GSDepthStencil9(GSRenderer* r) : GSDepthStencil(r) {}
|
||||
|
||||
void Update();
|
||||
};
|
||||
|
||||
class GSCachedTexture9 : public GSCachedTexture
|
||||
|
|
|
@ -0,0 +1,62 @@
|
|||
/*
|
||||
* 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, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* http://www.gnu.org/copyleft/gpl.html
|
||||
*
|
||||
*/
|
||||
|
||||
#include "StdAfx.h"
|
||||
#include "GSTextureCacheOGL.h"
|
||||
|
||||
// GSTextureCacheOGL
|
||||
|
||||
GSTextureCacheOGL::GSTextureCacheOGL(GSRenderer* r)
|
||||
: GSTextureCache(r)
|
||||
{
|
||||
}
|
||||
|
||||
// GSRenderTargetOGL
|
||||
|
||||
void GSTextureCacheOGL::GSRenderTargetOGL::Read(const GSVector4i& r)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
// GSTextureOGL
|
||||
|
||||
bool GSTextureCacheOGL::GSCachedTextureOGL::Create()
|
||||
{
|
||||
// TODO
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GSTextureCacheOGL::GSCachedTextureOGL::Create(GSRenderTarget* rt)
|
||||
{
|
||||
// TODO
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GSTextureCacheOGL::GSCachedTextureOGL::Create(GSDepthStencil* ds)
|
||||
{
|
||||
m_rendered = true;
|
||||
|
||||
// TODO
|
||||
|
||||
return false;
|
||||
}
|
|
@ -0,0 +1,60 @@
|
|||
/*
|
||||
* 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, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* http://www.gnu.org/copyleft/gpl.html
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "GSTextureCache.h"
|
||||
#include "GSDeviceOGL.h"
|
||||
|
||||
class GSTextureCacheOGL : public GSTextureCache
|
||||
{
|
||||
class GSRenderTargetOGL : public GSRenderTarget
|
||||
{
|
||||
public:
|
||||
explicit GSRenderTargetOGL(GSRenderer* r) : GSRenderTarget(r) {}
|
||||
|
||||
void Read(const GSVector4i& r);
|
||||
};
|
||||
|
||||
class GSDepthStencilOGL : public GSDepthStencil
|
||||
{
|
||||
public:
|
||||
explicit GSDepthStencilOGL(GSRenderer* r) : GSDepthStencil(r) {}
|
||||
};
|
||||
|
||||
class GSCachedTextureOGL : public GSCachedTexture
|
||||
{
|
||||
public:
|
||||
explicit GSCachedTextureOGL(GSRenderer* r) : GSCachedTexture(r) {}
|
||||
|
||||
bool Create();
|
||||
bool Create(GSRenderTarget* rt);
|
||||
bool Create(GSDepthStencil* ds);
|
||||
};
|
||||
|
||||
protected:
|
||||
GSRenderTarget* CreateRenderTarget() {return new GSRenderTargetOGL(m_renderer);}
|
||||
GSDepthStencil* CreateDepthStencil() {return new GSDepthStencilOGL(m_renderer);}
|
||||
GSCachedTexture* CreateTexture() {return new GSCachedTextureOGL(m_renderer);}
|
||||
|
||||
public:
|
||||
GSTextureCacheOGL(GSRenderer* r);
|
||||
};
|
|
@ -64,14 +64,13 @@ GSTexture* GSTextureFX9::CreateMskFix(uint32 size, uint32 msk, uint32 fix)
|
|||
|
||||
if(t)
|
||||
{
|
||||
uint8* bits;
|
||||
int pitch;
|
||||
GSTexture::GSMap m;
|
||||
|
||||
if(t->Map(&bits, pitch))
|
||||
if(t->Map(m))
|
||||
{
|
||||
for(uint32 i = 0; i < size; i++)
|
||||
{
|
||||
((float*)bits)[i] = (float)((i & msk) | fix) / size;
|
||||
((float*)m.bits)[i] = (float)((i & msk) | fix) / size;
|
||||
}
|
||||
|
||||
t->Unmap();
|
||||
|
|
|
@ -31,14 +31,12 @@ public:
|
|||
GSTextureNull();
|
||||
GSTextureNull(int type, int w, int h, int format);
|
||||
|
||||
operator bool() {return m_desc.type != 0;}
|
||||
|
||||
int GetType() const {return m_desc.type;}
|
||||
int GetWidth() const {return m_desc.w;}
|
||||
int GetHeight() const {return m_desc.h;}
|
||||
int GetFormat() const {return m_desc.format;}
|
||||
bool Update(const GSVector4i& r, const void* data, int pitch) {return true;}
|
||||
bool Map(uint8** bits, int& pitch, const GSVector4i* r) {return false;}
|
||||
bool Map(GSMap& m, const GSVector4i* r) {return false;}
|
||||
void Unmap() {}
|
||||
bool Save(const string& fn, bool dds = false) {return false;}
|
||||
};
|
||||
|
|
|
@ -0,0 +1,84 @@
|
|||
/*
|
||||
* 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, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* http://www.gnu.org/copyleft/gpl.html
|
||||
*
|
||||
*/
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "GSTextureOGL.h"
|
||||
|
||||
GSTextureOGL::GSTextureOGL(GLuint texture)
|
||||
: m_texture(texture)
|
||||
, m_type(None)
|
||||
, m_width(0)
|
||||
, m_height(0)
|
||||
, m_format(0)
|
||||
{
|
||||
// TODO: m_type, m_format, fb/ds?
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, texture);
|
||||
|
||||
glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &m_width);
|
||||
glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_HEIGHT, &m_height);
|
||||
}
|
||||
|
||||
int GSTextureOGL::GetType() const
|
||||
{
|
||||
return m_type;
|
||||
}
|
||||
|
||||
int GSTextureOGL::GetWidth() const
|
||||
{
|
||||
return m_width;
|
||||
}
|
||||
|
||||
int GSTextureOGL::GetHeight() const
|
||||
{
|
||||
return m_height;
|
||||
}
|
||||
|
||||
int GSTextureOGL::GetFormat() const
|
||||
{
|
||||
return m_format;
|
||||
}
|
||||
|
||||
bool GSTextureOGL::Update(const GSVector4i& r, const void* data, int pitch)
|
||||
{
|
||||
// TODO
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool GSTextureOGL::Map(GSMap& m, const GSVector4i* r)
|
||||
{
|
||||
// TODO
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void GSTextureOGL::Unmap()
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
bool GSTextureOGL::Save(const string& fn, bool dds)
|
||||
{
|
||||
// TODO
|
||||
|
||||
return false;
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
* 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, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* http://www.gnu.org/copyleft/gpl.html
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "GSTexture.h"
|
||||
|
||||
class GSTextureOGL : public GSTexture
|
||||
{
|
||||
GLuint m_texture;
|
||||
|
||||
int m_type;
|
||||
int m_width;
|
||||
int m_height;
|
||||
int m_format;
|
||||
|
||||
public:
|
||||
explicit GSTextureOGL(GLuint texture);
|
||||
|
||||
int GetType() const;
|
||||
int GetWidth() const;
|
||||
int GetHeight() const;
|
||||
int GetFormat() const;
|
||||
|
||||
bool Update(const GSVector4i& r, const void* data, int pitch);
|
||||
bool Map(GSMap& m, const GSVector4i* r);
|
||||
void Unmap();
|
||||
bool Save(const string& fn, bool dds = false);
|
||||
};
|
|
@ -80,4 +80,6 @@ __declspec(align(16)) union GSVertexHW10
|
|||
float GetQ() {return q;}
|
||||
};
|
||||
|
||||
typedef GSVertexHW9 GSVertexOGL; // TODO
|
||||
|
||||
#pragma pack(pop)
|
||||
|
|
|
@ -255,7 +255,7 @@ public:
|
|||
key |= 1 << 4;
|
||||
}
|
||||
|
||||
m_map.Lookup(key)(v, count, m_min, m_max);
|
||||
m_map[key](v, count, m_min, m_max);
|
||||
|
||||
m_eq.value = (m_min.p == m_max.p).mask() | ((m_min.t == m_max.t).mask() << 4) | ((m_min.c == m_max.c).mask() << 8);
|
||||
|
||||
|
|
|
@ -82,7 +82,7 @@ IDB_LOGO10 BITMAP "res\\logo10.bmp"
|
|||
// Dialog
|
||||
//
|
||||
|
||||
IDD_CONFIG DIALOGEX 0, 0, 189, 248
|
||||
IDD_CONFIG DIALOGEX 0, 0, 189, 233
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Settings..."
|
||||
FONT 8, "MS Shell Dlg", 400, 0, 0x1
|
||||
|
@ -93,30 +93,27 @@ BEGIN
|
|||
COMBOBOX IDC_RESOLUTION,71,57,111,125,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||
LTEXT "Renderer:",IDC_STATIC,7,74,34,8
|
||||
COMBOBOX IDC_RENDERER,71,72,111,118,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||
LTEXT "Shader:",IDC_STATIC,7,89,26,8
|
||||
COMBOBOX IDC_SHADER,71,87,111,98,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||
LTEXT "Interlacing (F5):",IDC_STATIC,7,105,53,8
|
||||
COMBOBOX IDC_INTERLACE,71,102,111,98,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||
LTEXT "Aspect Ratio (F6):",IDC_STATIC,7,120,60,8
|
||||
COMBOBOX IDC_ASPECTRATIO,71,117,111,98,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||
LTEXT "D3D internal res:",IDC_STATIC,7,135,55,8
|
||||
EDITTEXT IDC_RESX_EDIT,71,132,35,13,ES_AUTOHSCROLL | ES_NUMBER
|
||||
CONTROL "",IDC_RESX,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,99,135,11,14
|
||||
EDITTEXT IDC_RESY_EDIT,109,132,35,13,ES_AUTOHSCROLL | ES_NUMBER
|
||||
CONTROL "",IDC_RESY,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,133,135,11,14
|
||||
CONTROL "Native",IDC_NATIVERES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,149,134,33,10
|
||||
LTEXT "SW rend. threads:",IDC_STATIC,7,149,60,8
|
||||
EDITTEXT IDC_SWTHREADS_EDIT,71,147,35,13,ES_AUTOHSCROLL | ES_NUMBER
|
||||
CONTROL "",IDC_SWTHREADS,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,99,150,11,14
|
||||
CONTROL "Texture filtering",IDC_FILTER,"Button",BS_AUTO3STATE | WS_TABSTOP,7,167,67,10
|
||||
CONTROL "Logarithmic Z",IDC_LOGZ,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,80,168,58,10
|
||||
CONTROL "Wait vsync",IDC_VSYNC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,180,51,10
|
||||
CONTROL "Alpha correction (FBA)",IDC_FBA,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,80,181,102,10
|
||||
CONTROL "Edge anti-aliasing (AA1, sw-mode only)",IDC_AA1,
|
||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,194,141,10
|
||||
CONTROL "Enable output merger blur effect",IDC_BLUR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,208,121,10
|
||||
DEFPUSHBUTTON "OK",IDOK,43,227,50,14
|
||||
PUSHBUTTON "Cancel",IDCANCEL,96,227,50,14
|
||||
LTEXT "Interlacing (F5):",IDC_STATIC,7,90,53,8
|
||||
COMBOBOX IDC_INTERLACE,71,87,111,98,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||
LTEXT "Aspect Ratio (F6):",IDC_STATIC,7,105,60,8
|
||||
COMBOBOX IDC_ASPECTRATIO,71,102,111,98,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||
LTEXT "D3D internal res:",IDC_STATIC,7,120,55,8
|
||||
EDITTEXT IDC_RESX_EDIT,71,117,35,13,ES_AUTOHSCROLL | ES_NUMBER
|
||||
CONTROL "",IDC_RESX,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,99,120,11,14
|
||||
EDITTEXT IDC_RESY_EDIT,109,117,35,13,ES_AUTOHSCROLL | ES_NUMBER
|
||||
CONTROL "",IDC_RESY,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,133,120,11,14
|
||||
CONTROL "Native",IDC_NATIVERES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,149,119,33,10
|
||||
LTEXT "SW rend. threads:",IDC_STATIC,7,134,60,8
|
||||
EDITTEXT IDC_SWTHREADS_EDIT,71,132,35,13,ES_AUTOHSCROLL | ES_NUMBER
|
||||
CONTROL "",IDC_SWTHREADS,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,99,135,11,14
|
||||
CONTROL "Texture filtering",IDC_FILTER,"Button",BS_AUTO3STATE | WS_TABSTOP,7,152,67,10
|
||||
CONTROL "Logarithmic Z",IDC_LOGZ,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,80,153,58,10
|
||||
CONTROL "Wait vsync",IDC_VSYNC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,165,51,10
|
||||
CONTROL "Alpha correction (FBA)",IDC_FBA,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,80,166,102,10
|
||||
CONTROL "Edge anti-aliasing (AA1, sw-mode only)",IDC_AA1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,179,141,10
|
||||
CONTROL "Enable output merger blur effect",IDC_BLUR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,193,121,10
|
||||
DEFPUSHBUTTON "OK",IDOK,43,212,50,14
|
||||
PUSHBUTTON "Cancel",IDCANCEL,96,212,50,14
|
||||
END
|
||||
|
||||
IDD_CAPTURE DIALOGEX 0, 0, 279, 71
|
||||
|
@ -135,7 +132,7 @@ BEGIN
|
|||
DEFPUSHBUTTON "OK",IDOK,221,47,50,14
|
||||
END
|
||||
|
||||
IDD_GPUCONFIG DIALOGEX 0, 0, 189, 235
|
||||
IDD_GPUCONFIG DIALOGEX 0, 0, 189, 199
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Settings..."
|
||||
FONT 8, "MS Shell Dlg", 400, 0, 0x1
|
||||
|
@ -145,22 +142,20 @@ BEGIN
|
|||
COMBOBOX IDC_RESOLUTION,78,57,104,125,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||
LTEXT "Renderer:",IDC_STATIC,7,74,34,8
|
||||
COMBOBOX IDC_RENDERER,78,72,104,118,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||
LTEXT "Shader:",IDC_STATIC,7,89,26,8
|
||||
COMBOBOX IDC_SHADER,78,87,104,98,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||
LTEXT "Texture Filter (Del):",IDC_STATIC,7,105,64,8
|
||||
COMBOBOX IDC_FILTER,78,102,104,98,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||
LTEXT "Dithering (End):",IDC_STATIC,7,120,52,8
|
||||
COMBOBOX IDC_DITHERING,78,117,104,98,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||
LTEXT "Aspect Ratio (PgDn):",IDC_STATIC,7,135,68,8
|
||||
COMBOBOX IDC_ASPECTRATIO,78,132,104,98,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||
LTEXT "Rendering Threads:",IDC_STATIC,7,165,64,8
|
||||
EDITTEXT IDC_SWTHREADS_EDIT,78,163,35,13,ES_AUTOHSCROLL | ES_NUMBER
|
||||
CONTROL "",IDC_SWTHREADS,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,99,169,11,14
|
||||
DEFPUSHBUTTON "OK",IDOK,43,214,50,14
|
||||
PUSHBUTTON "Cancel",IDCANCEL,96,214,50,14
|
||||
CONTROL 2022,IDC_LOGO10,"Static",SS_BITMAP,7,7,175,44
|
||||
LTEXT "Internal Resolution:",IDC_STATIC,7,150,64,8
|
||||
COMBOBOX IDC_SCALE,78,147,104,98,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||
LTEXT "Texture Filter (Del):",IDC_STATIC,7,90,64,8
|
||||
COMBOBOX IDC_FILTER,78,87,104,98,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||
LTEXT "Dithering (End):",IDC_STATIC,7,105,52,8
|
||||
COMBOBOX IDC_DITHERING,78,102,104,98,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||
LTEXT "Aspect Ratio (PgDn):",IDC_STATIC,7,120,68,8
|
||||
COMBOBOX IDC_ASPECTRATIO,78,117,104,98,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||
LTEXT "Rendering Threads:",IDC_STATIC,7,150,64,8
|
||||
EDITTEXT IDC_SWTHREADS_EDIT,78,148,35,13,ES_AUTOHSCROLL | ES_NUMBER
|
||||
CONTROL "",IDC_SWTHREADS,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,99,154,11,14
|
||||
DEFPUSHBUTTON "OK",IDOK,43,178,50,14
|
||||
PUSHBUTTON "Cancel",IDCANCEL,96,178,50,14
|
||||
CONTROL 2022,IDC_LOGO10,"Static",SS_BITMAP,7,7,173,42
|
||||
LTEXT "Internal Resolution:",IDC_STATIC,7,135,64,8
|
||||
COMBOBOX IDC_SCALE,78,132,104,98,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||
END
|
||||
|
||||
|
||||
|
@ -180,7 +175,7 @@ BEGIN
|
|||
VERTGUIDE, 80
|
||||
VERTGUIDE, 182
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 241
|
||||
BOTTOMMARGIN, 226
|
||||
END
|
||||
|
||||
IDD_CAPTURE, DIALOG
|
||||
|
@ -198,7 +193,7 @@ BEGIN
|
|||
VERTGUIDE, 78
|
||||
VERTGUIDE, 182
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 228
|
||||
BOTTOMMARGIN, 192
|
||||
END
|
||||
END
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
|
|
@ -1155,6 +1155,10 @@
|
|||
RelativePath=".\GSDeviceNull.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\GSDeviceOGL.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\GSDialog.cpp"
|
||||
>
|
||||
|
@ -1331,6 +1335,10 @@
|
|||
RelativePath=".\GSRendererNull.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\GSRendererOGL.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\GSRendererSW.cpp"
|
||||
>
|
||||
|
@ -1415,6 +1423,10 @@
|
|||
RelativePath=".\GSTextureCache9.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\GSTextureCacheOGL.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\GSTextureCacheSW.cpp"
|
||||
>
|
||||
|
@ -1447,6 +1459,10 @@
|
|||
RelativePath=".\GSTextureNull.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\GSTextureOGL.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\GSThread.cpp"
|
||||
>
|
||||
|
@ -1717,6 +1733,10 @@
|
|||
RelativePath=".\GSDeviceNull.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\GSDeviceOGL.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\GSDialog.h"
|
||||
>
|
||||
|
@ -1785,6 +1805,10 @@
|
|||
RelativePath=".\GSRendererNull.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\GSRendererOGL.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\GSRendererSW.h"
|
||||
>
|
||||
|
@ -1841,6 +1865,10 @@
|
|||
RelativePath=".\GSTextureCache9.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\GSTextureCacheOGL.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\GSTextureCacheSW.h"
|
||||
>
|
||||
|
@ -1857,6 +1885,10 @@
|
|||
RelativePath=".\GSTextureNull.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\GSTextureOGL.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\GSThread.h"
|
||||
>
|
||||
|
|
|
@ -209,6 +209,8 @@ float4 Extract16(uint i)
|
|||
|
||||
int4 wrapuv(int4 uv)
|
||||
{
|
||||
// TODO: bitwise ops don't work with render target textures that were not rendered at the native resolution.
|
||||
|
||||
if(WMS == WMT)
|
||||
{
|
||||
switch(WMS)
|
||||
|
|
|
@ -99,6 +99,8 @@ typedef signed long long int64;
|
|||
#define _M_AMD64
|
||||
#endif
|
||||
|
||||
#ifdef _WINDOWS
|
||||
|
||||
// directx
|
||||
|
||||
#include <ddraw.h>
|
||||
|
@ -109,6 +111,14 @@ typedef signed long long int64;
|
|||
|
||||
#define D3DCOLORWRITEENABLE_RGBA (D3DCOLORWRITEENABLE_RED | D3DCOLORWRITEENABLE_GREEN | D3DCOLORWRITEENABLE_BLUE | D3DCOLORWRITEENABLE_ALPHA)
|
||||
|
||||
#endif
|
||||
|
||||
// opengl
|
||||
|
||||
#include <GL/glut.h>
|
||||
#include <CG/cg.h>
|
||||
#include <CG/cgGL.h>
|
||||
|
||||
// sse
|
||||
|
||||
#if !defined(_M_SSE) && (defined(_M_AMD64) || defined(_M_IX86_FP) && _M_IX86_FP >= 2)
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="JITProfiling.lib d3d10.lib d3dx10.lib d3d9.lib d3dx9.lib ddraw.lib dxguid.lib winmm.lib strmiids.lib xinput.lib"
|
||||
AdditionalDependencies="JITProfiling.lib d3d10.lib d3dx10.lib d3d9.lib d3dx9.lib ddraw.lib dxguid.lib winmm.lib strmiids.lib xinput.lib cg.lib cgGL.lib glut32.lib"
|
||||
AdditionalLibraryDirectories="./vtune"
|
||||
DelayLoadDLLs="d3d9.dll;d3dx9_41.dll;d3d10.dll;d3dx10_41.dll"
|
||||
GenerateDebugInformation="true"
|
||||
|
|
Loading…
Reference in New Issue