Browse Source

Upload to git

master
Тим 10 months ago
commit
1c6e57f0d9
3 changed files with 213 additions and 0 deletions
  1. 132
    0
      IDirect3DDevice9.d
  2. 20
    0
      Makefile
  3. 61
    0
      dx9types.d

+ 132
- 0
IDirect3DDevice9.d View File

@@ -0,0 +1,132 @@

import core.sys.windows.windows, core.sys.windows.com;
public import dx9types;

extern (C++) interface IDirect3DDevice9 : IUnknown {
HRESULT TestCooperativeLevel();
UINT GetAvailableTextureMem();
HRESULT EvictManagedResources();
HRESULT GetDirect3D(void** ppD3D9);
HRESULT GetDeviceCaps(void* pCaps);
HRESULT GetDisplayMode(UINT iSwapChain,void* pMode);
HRESULT GetCreationParameters(void* pParameters);
HRESULT SetCursorProperties(UINT XHotSpot,UINT YHotSpot,void* pCursorBitmap);
void SetCursorPosition(int X,int Y,DWORD Flags);
BOOL ShowCursor(BOOL bShow);
HRESULT CreateAdditionalSwapChain(D3DPRESENT_PARAMETERS* pPresentationParameters,void** ppSwapChain);
HRESULT GetSwapChain(UINT iSwapChain,void** ppSwapChain);
UINT GetNumberOfSwapChains();
HRESULT Reset(D3DPRESENT_PARAMETERS* pPresentationParameters);
HRESULT Present(const(RECT)* pSourceRect,const(RECT)* pDestRect,HWND hDestWindowOverride,const(RGNDATA)* pDirtyRegion);
HRESULT GetBackBuffer(UINT iSwapChain,UINT iBackBuffer,uint Type,void** ppBackBuffer);
HRESULT GetRasterStatus(UINT iSwapChain,D3DRASTER_STATUS* pRasterStatus);
HRESULT SetDialogBoxMode(BOOL bEnableDialogs);
void SetGammaRamp(UINT iSwapChain,DWORD Flags,const(D3DGAMMARAMP)* pRamp);
void GetGammaRamp(UINT iSwapChain,D3DGAMMARAMP* pRamp);
HRESULT CreateTexture(UINT Width,UINT Height,UINT Levels,DWORD Usage,uint Format,uint Pool,void** ppTexture,HANDLE* pSharedHandle);
HRESULT CreateVolumeTexture(UINT Width,UINT Height,UINT Depth,UINT Levels,DWORD Usage,uint Format,uint Pool,void** ppVolumeTexture,HANDLE* pSharedHandle);
HRESULT CreateCubeTexture(UINT EdgeLength,UINT Levels,DWORD Usage,uint Format,uint Pool,void** ppCubeTexture,HANDLE* pSharedHandle);
HRESULT CreateVertexBuffer(UINT Length,DWORD Usage,DWORD FVF,uint Pool,void** ppVertexBuffer,HANDLE* pSharedHandle);
HRESULT CreateIndexBuffer(UINT Length,DWORD Usage,uint Format,uint Pool,void** ppIndexBuffer,HANDLE* pSharedHandle);
HRESULT CreateRenderTarget(UINT Width,UINT Height,uint Format,uint MultiSample,DWORD MultisampleQuality,BOOL Lockable,void** ppSurface,HANDLE* pSharedHandle);
HRESULT CreateDepthStencilSurface(UINT Width,UINT Height,uint Format,uint MultiSample,DWORD MultisampleQuality,BOOL Discard,void** ppSurface,HANDLE* pSharedHandle);
HRESULT UpdateSurface(void* pSourceSurface,const(RECT)* pSourceRect,void* pDestinationSurface,const(POINT)* pDestPoint);
HRESULT UpdateTexture(void* pSourceTexture,void* pDestinationTexture);
HRESULT GetRenderTargetData(void* pRenderTarget,void* pDestSurface);
HRESULT GetFrontBufferData(UINT iSwapChain,void* pDestSurface);
HRESULT StretchRect(void* pSourceSurface,const(RECT)* pSourceRect,void* pDestSurface,const(RECT)* pDestRect,uint Filter);
HRESULT ColorFill(void* pSurface,const(RECT)* pRect,uint color);
HRESULT CreateOffscreenPlainSurface(UINT Width,UINT Height,uint Format,uint Pool,void** ppSurface,HANDLE* pSharedHandle);
HRESULT SetRenderTarget(DWORD RenderTargetIndex,void* pRenderTarget);
HRESULT GetRenderTarget(DWORD RenderTargetIndex,void** ppRenderTarget);
HRESULT SetDepthStencilSurface(void* pNewZStencil);
HRESULT GetDepthStencilSurface(void** ppZStencilSurface);
HRESULT BeginScene();
HRESULT EndScene();
HRESULT Clear(DWORD Count,const(LONG[4])* pRects,DWORD Flags,uint Color,float Z,DWORD Stencil);
HRESULT SetTransform(uint State,const(float[4][4])* pMatrix);
HRESULT GetTransform(uint State,float[4][4]* pMatrix);
HRESULT MultiplyTransform(uint,const(float[4][4])*);
HRESULT SetViewport(const(void)* pViewport);
HRESULT GetViewport(void* pViewport);
HRESULT SetMaterial(const(void)* pMaterial);
HRESULT GetMaterial(void* pMaterial);
HRESULT SetLight(DWORD Index,const(void)*);
HRESULT GetLight(DWORD Index,void*);
HRESULT LightEnable(DWORD Index,BOOL Enable);
HRESULT GetLightEnable(DWORD Index,BOOL* pEnable);
HRESULT SetClipPlane(DWORD Index,const(float)* pPlane);
HRESULT GetClipPlane(DWORD Index,float* pPlane);
HRESULT SetRenderState(uint State,DWORD Value);
HRESULT GetRenderState(uint State,DWORD* pValue);
HRESULT CreateStateBlock(uint Type,void** ppSB);
HRESULT BeginStateBlock();
HRESULT EndStateBlock(void** ppSB);
HRESULT SetClipStatus(const(D3DCLIPSTATUS9)* pClipStatus);
HRESULT GetClipStatus(D3DCLIPSTATUS9* pClipStatus);
HRESULT GetTexture(DWORD Stage,void** ppTexture);
HRESULT SetTexture(DWORD Stage,void* pTexture);
HRESULT GetTextureStageState(DWORD Stage,uint Type,DWORD* pValue);
HRESULT SetTextureStageState(DWORD Stage,uint Type,DWORD Value);
HRESULT GetSamplerState(DWORD Sampler,uint Type,DWORD* pValue);
HRESULT SetSamplerState(DWORD Sampler,uint Type,DWORD Value);
HRESULT ValidateDevice(DWORD* pNumPasses);
HRESULT SetPaletteEntries(UINT PaletteNumber,const(PALETTEENTRY)* pEntries);
HRESULT GetPaletteEntries(UINT PaletteNumber,PALETTEENTRY* pEntries);
HRESULT SetCurrentTexturePalette(UINT PaletteNumber);
HRESULT GetCurrentTexturePalette(UINT *PaletteNumber);
HRESULT SetScissorRect(const(RECT)* pRect);
HRESULT GetScissorRect(RECT* pRect);
HRESULT SetSoftwareVertexProcessing(BOOL bSoftware);
BOOL GetSoftwareVertexProcessing();
HRESULT SetNPatchMode(float nSegments);
float GetNPatchMode();
HRESULT DrawPrimitive(uint PrimitiveType,UINT StartVertex,UINT PrimitiveCount);
HRESULT DrawIndexedPrimitive(uint,INT BaseVertexIndex,UINT MinVertexIndex,UINT NumVertices,UINT startIndex,UINT primCount);
HRESULT DrawPrimitiveUP(uint PrimitiveType,UINT PrimitiveCount,const(void)* pVertexStreamZeroData,UINT VertexStreamZeroStride);
HRESULT DrawIndexedPrimitiveUP(uint PrimitiveType,UINT MinVertexIndex,UINT NumVertices,UINT PrimitiveCount,const(void)* pIndexData,uint IndexDataFormat,const(void)* pVertexStreamZeroData,UINT VertexStreamZeroStride);
HRESULT ProcessVertices(UINT SrcStartIndex,UINT DestIndex,UINT VertexCount,void* pDestBuffer,void* pVertexDecl,DWORD Flags);
HRESULT CreateVertexDeclaration(const(D3DVERTEXELEMENT9)* pVertexElements,void** ppDecl);
HRESULT SetVertexDeclaration(void* pDecl);
HRESULT GetVertexDeclaration(void** ppDecl);
HRESULT SetFVF(DWORD FVF);
HRESULT GetFVF(DWORD* pFVF);
HRESULT CreateVertexShader(const(DWORD)* pFunction,void** ppShader);
HRESULT SetVertexShader(void* pShader);
HRESULT GetVertexShader(void** ppShader);
HRESULT SetVertexShaderConstantF(UINT StartRegister,const(float)* pConstantData,UINT Vector4fCount);
HRESULT GetVertexShaderConstantF(UINT StartRegister,float* pConstantData,UINT Vector4fCount);
HRESULT SetVertexShaderConstantI(UINT StartRegister,const(int)* pConstantData,UINT Vector4iCount);
HRESULT GetVertexShaderConstantI(UINT StartRegister,int* pConstantData,UINT Vector4iCount);
HRESULT SetVertexShaderConstantB(UINT StartRegister,const(BOOL)* pConstantData,UINT BoolCount);
HRESULT GetVertexShaderConstantB(UINT StartRegister,BOOL* pConstantData,UINT BoolCount);
HRESULT SetStreamSource(UINT StreamNumber,void* pStreamData,UINT OffsetInBytes,UINT Stride);
HRESULT GetStreamSource(UINT StreamNumber,void** ppStreamData,UINT* pOffsetInBytes,UINT* pStride);
HRESULT SetStreamSourceFreq(UINT StreamNumber,UINT Setting);
HRESULT GetStreamSourceFreq(UINT StreamNumber,UINT* pSetting);
HRESULT SetIndices(void* pIndexData);
HRESULT GetIndices(void** ppIndexData);
HRESULT CreatePixelShader(const(DWORD)* pFunction,void** ppShader);
HRESULT SetPixelShader(void* pShader);
HRESULT GetPixelShader(void** ppShader);
HRESULT SetPixelShaderConstantF(UINT StartRegister,const(float)* pConstantData,UINT Vector4fCount);
HRESULT GetPixelShaderConstantF(UINT StartRegister,float* pConstantData,UINT Vector4fCount);
HRESULT SetPixelShaderConstantI(UINT StartRegister,const(int)* pConstantData,UINT Vector4iCount);
HRESULT GetPixelShaderConstantI(UINT StartRegister,int* pConstantData,UINT Vector4iCount);
HRESULT SetPixelShaderConstantB(UINT StartRegister,const(BOOL)* pConstantData,UINT BoolCount);
HRESULT GetPixelShaderConstantB(UINT StartRegister,BOOL* pConstantData,UINT BoolCount);
HRESULT DrawRectPatch(UINT Handle,const(float)* pNumSegs,const(D3DRECTPATCH_INFO)* pRectPatchInfo);
HRESULT DrawTriPatch(UINT Handle,const(float)* pNumSegs,const(D3DTRIPATCH_INFO)* pTriPatchInfo);
HRESULT DeletePatch(UINT Handle);
HRESULT CreateQuery(uint Type,void** ppQuery);
HRESULT SetConvolutionMonoKernel(UINT width,UINT height,float* rows,float* columns);
HRESULT ComposeRects(void* pSrc,void* pDst,void* pSrcRectDescs,UINT NumRects,void* pDstRectDescs,uint Operation,int Xoffset,int Yoffset);
HRESULT PresentEx(const(RECT)* pSourceRect,const(RECT)* pDestRect,HWND hDestWindowOverride,const(RGNDATA)* pDirtyRegion,DWORD dwFlags);
HRESULT GetGPUThreadPriority(INT* pPriority);
HRESULT SetGPUThreadPriority(INT Priority);
HRESULT WaitForVBlank(UINT iSwapChain);
HRESULT CheckResourceResidency(void** pResourceArray,UINT32 NumResources);
HRESULT SetMaximumFrameLatency(UINT MaxLatency);
HRESULT GetMaximumFrameLatency(UINT* pMaxLatency);
HRESULT CheckDeviceState(HWND hDestinationWindow);
}

+ 20
- 0
Makefile View File

@@ -0,0 +1,20 @@
D=ldc2
PROJECT=dx9interface
EXT=dll
SOURCES=*.d

all: build
rm -rf $(PROJECT).lib

build:
$(D) $(SOURCES) -shared -O3 -of=$(PROJECT).$(EXT)

clean:
rm -rf *.obj $(PROJECT).lib

full-clean: clean
rm $(PROJECT).$(EXT)
help:
@echo "Change variable D, to select compiler."
@echo "For example compile with dmd: \`make D=dmd\`"

+ 61
- 0
dx9types.d View File

@@ -0,0 +1,61 @@

import core.sys.windows.windows;

struct D3DPRESENT_PARAMETERS {
UINT BackBufferWidth;
UINT BackBufferHeight;
uint BackBufferFormat;
UINT BackBufferCount;
uint MultiSampleType;
DWORD MultiSampleQuality;
uint SwapEffect;
HWND hDeviceWindow;
BOOL Windowed;
BOOL EnableAutoDepthStencil;
uint AutoDepthStencilFormat;
DWORD Flags;
UINT FullScreen_RefreshRateInHz;
UINT PresentationInterval;
};

struct D3DRASTER_STATUS {
BOOL InVBlank;
UINT ScanLine;
};

struct D3DGAMMARAMP {
WORD[256] red;
WORD[256] green;
WORD[256] blue;
};

struct D3DCLIPSTATUS9 {
DWORD ClipUnion;
DWORD ClipIntersection;
};

struct D3DVERTEXELEMENT9 {
WORD Stream;
WORD Offset;
BYTE Type;
BYTE Method;
BYTE Usage;
BYTE UsageIndex;
};

struct D3DRECTPATCH_INFO {
UINT StartVertexOffsetWidth;
UINT StartVertexOffsetHeight;
UINT Width;
UINT Height;
UINT Stride;
uint Basis;
uint Degree;
};

struct D3DTRIPATCH_INFO {
UINT StartVertexOffset;
UINT NumVertices;
uint Basis;
uint Degree;
};

Loading…
Cancel
Save