mirror of
https://github.com/EduApps-CDG/OpenDX
synced 2024-12-30 09:45:37 +01:00
Update file paths and fix code in d3d9.cpp and idirect3ddevice9.hpp
This commit is contained in:
parent
a11825cddc
commit
9393a2b4b3
@ -3,4 +3,4 @@
|
|||||||
#define DEBUG true
|
#define DEBUG true
|
||||||
|
|
||||||
//PREPROCESSING ONLY!!!
|
//PREPROCESSING ONLY!!!
|
||||||
#define PROJECT_SOURCE_DIR "/workspaces/OpenDX/"
|
#define PROJECT_SOURCE_DIR "/home/eduardo/git/eduapps/OpenDX/"
|
||||||
|
@ -5,3 +5,8 @@ inline LONG InterlockedIncrement(LONG volatile *p)
|
|||||||
{
|
{
|
||||||
return __sync_add_and_fetch(p, 1);
|
return __sync_add_and_fetch(p, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline LONG InterlockedDecrement(LONG volatile *p)
|
||||||
|
{
|
||||||
|
return __sync_sub_and_fetch(p, 1);
|
||||||
|
}
|
||||||
|
@ -100,9 +100,16 @@ HRESULT IDirect3D9::CreateDevice(
|
|||||||
std::cout << "libd3d9.so: IDirect3D9::CreateDevice()" << std::endl;
|
std::cout << "libd3d9.so: IDirect3D9::CreateDevice()" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//get hwnd size
|
//get GtkWindow specs and put them into D3DPRESENT_PARAMETERS
|
||||||
RECT rect;
|
pPresentationParameters->hDeviceWindow = hFocusWindow;
|
||||||
GetClientRect(hFocusWindow, &rect);
|
pPresentationParameters->BackBufferWidth = gtk_widget_get_size(hFocusWindow,GTK_ORIENTATION_HORIZONTAL);
|
||||||
|
pPresentationParameters->BackBufferHeight = gtk_widget_get_size(hFocusWindow,GTK_ORIENTATION_VERTICAL);
|
||||||
|
|
||||||
|
//create the device
|
||||||
|
IDirect3DDevice9 device = IDirect3DDevice9(/*this, pPresentationParameters*/);
|
||||||
|
*ppReturnedDeviceInterface = &device;
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ULONG IDirect3D9::Release() {
|
ULONG IDirect3D9::Release() {
|
||||||
@ -138,3 +145,40 @@ IDirect3D9* Direct3DCreate9(UINT SDKVersion) {
|
|||||||
|
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IDirect3DDevice9::IDirect3DDevice9(/*IDirect3D9* d3d, D3DPRESENT_PARAMETERS* pp*/) {
|
||||||
|
#ifdef DEBUG
|
||||||
|
std::cout << "libd3d9.so: IDirect3DDevice9::IDirect3DDevice9()" << std::endl;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
refCount = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
ULONG IDirect3DDevice9::AddRef() {
|
||||||
|
DXGASSERT(((ULONG_PTR)(&refCount) & 3) == 0);
|
||||||
|
|
||||||
|
InterlockedIncrement((LONG *)&refCount);
|
||||||
|
return refCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
ULONG IDirect3DDevice9::Release() {
|
||||||
|
InterlockedDecrement((LONG *)&refCount);
|
||||||
|
return refCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
HRESULT IDirect3DDevice9::QueryInterface(REFIID riid, void** ppvObj) {
|
||||||
|
*ppvObj = this;
|
||||||
|
|
||||||
|
IDirect3DDevice9::AddRef();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
HRESULT IDirect3DDevice9::Clear(DWORD Count, const void/*D3DRECT*/ *pRects, DWORD Flags, int/*D3DCOLOR*/ Color, float Z, DWORD Stencil) {
|
||||||
|
#ifdef DEBUG
|
||||||
|
std::cout << "libd3d9.so: IDirect3DDevice9::Clear()" << std::endl;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//intel code
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
@ -2,6 +2,8 @@
|
|||||||
#include <unknwn.h>
|
#include <unknwn.h>
|
||||||
#include <d3d9.h>
|
#include <d3d9.h>
|
||||||
|
|
||||||
// struct IDirect3DDevice9:IUnknown {
|
/*IDirect3DDevice9::IDirect3DDevice9(IDirect3D9* d3d, D3DPRESENT_PARAMETERS* pp) {
|
||||||
|
#ifdef DEBUG
|
||||||
// };
|
std::cout << "libd3d9.so: IDirect3DDevice9::IDirect3DDevice9()" << std::endl;
|
||||||
|
#endif
|
||||||
|
}*/
|
@ -191,12 +191,18 @@ struct D3DPRESENT_PARAMETERS {
|
|||||||
};
|
};
|
||||||
typedef struct D3DPRESENT_PARAMETERS D3DPRESENT_PARAMETERS, *LPD3DPRESENT_PARAMETERS;
|
typedef struct D3DPRESENT_PARAMETERS D3DPRESENT_PARAMETERS, *LPD3DPRESENT_PARAMETERS;
|
||||||
|
|
||||||
struct IDirect3DDevice9 : public IUnknown {
|
struct IDirect3DDevice9 {
|
||||||
|
IDirect3DDevice9();
|
||||||
|
|
||||||
virtual HRESULT QueryInterface(REFIID riid, void** ppvObj);
|
virtual HRESULT QueryInterface(REFIID riid, void** ppvObj);
|
||||||
virtual ULONG AddRef();
|
virtual ULONG AddRef();
|
||||||
virtual ULONG Release();
|
virtual ULONG Release();
|
||||||
|
|
||||||
|
HRESULT Clear(DWORD Count, const void/*D3DRECT*/ *pRects, DWORD Flags, int/*D3DCOLOR*/ Color, float Z, DWORD Stencil);
|
||||||
|
|
||||||
// Define other methods required by IDirect3D9 interface
|
// Define other methods required by IDirect3D9 interface
|
||||||
|
|
||||||
|
private:ULONG refCount;
|
||||||
};
|
};
|
||||||
typedef struct IDirect3DDevice9 *LPDIRECT3DDEVICE9, *PDIRECT3DDEVICE9;
|
typedef struct IDirect3DDevice9 *LPDIRECT3DDEVICE9, *PDIRECT3DDEVICE9;
|
||||||
|
|
||||||
|
4
run.sh
4
run.sh
@ -1,3 +1,3 @@
|
|||||||
# Run dxdiag from build directory
|
# Run dxdiag from build directory
|
||||||
cd build
|
cd build/opendx
|
||||||
./tests/sample
|
./bin/sample
|
@ -2,7 +2,8 @@
|
|||||||
* Windows API codes were commented to focus
|
* Windows API codes were commented to focus
|
||||||
* on what's important: OpenDX.
|
* on what's important: OpenDX.
|
||||||
*
|
*
|
||||||
* Code that doesn't work is also commented.
|
* Code that doesn't work is also commented and will be gradually
|
||||||
|
* fixed. This is a work in progress.
|
||||||
*/
|
*/
|
||||||
#include <opendx.h>
|
#include <opendx.h>
|
||||||
#include <winuser.h>
|
#include <winuser.h>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user