Direct3D + Cg progress, the plugin is still not working due to some missing features.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2494 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
XTra.KrazzY
2009-03-01 01:09:32 +00:00
parent e004800e68
commit 3234bca193
13 changed files with 719 additions and 26 deletions

View File

@ -38,6 +38,13 @@
#include "Utils.h"
#include "EmuWindow.h"
#include <Cg/cg.h>
#include <Cg/cgD3D9.h>
CGcontext g_cgcontext;
CGprofile g_cgvProf;
CGprofile g_cgfProf;
float Renderer::m_x;
float Renderer::m_y;
float Renderer::m_width;
@ -64,6 +71,15 @@ struct Message
static std::list<Message> s_listMsgs;
void HandleCgError(CGcontext ctx, CGerror err, void* appdata)
{
PanicAlert("Cg error: %s\n", cgGetErrorString(err));
const char* listing = cgGetLastListing(g_cgcontext);
if (listing != NULL) {
PanicAlert("last listing: %s\n", listing);
}
}
void Renderer::Init(SVideoInitialize &_VideoInitialize)
{
EmuWindow::SetSize(g_Res[g_Config.iWindowedRes][0], g_Res[g_Config.iWindowedRes][1]);
@ -73,6 +89,15 @@ void Renderer::Init(SVideoInitialize &_VideoInitialize)
D3DVIEWPORT9 vp;
D3D::dev->GetViewport(&vp);
g_cgcontext = cgCreateContext();
cgGetError();
cgSetErrorHandler(HandleCgError, NULL);
cgD3D9SetDevice(D3D::dev);
g_cgvProf = cgD3D9GetLatestVertexProfile();
g_cgfProf = cgD3D9GetLatestPixelProfile();
m_x = 0;
m_y = 0;
m_width = (float)vp.Width;
@ -104,6 +129,10 @@ void Renderer::Init(SVideoInitialize &_VideoInitialize)
void Renderer::Shutdown()
{
cgD3D9SetDevice(NULL);
cgDestroyContext(g_cgcontext);
g_cgcontext = NULL;
D3D::font.Shutdown();
D3D::EndFrame();
D3D::Close();