News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

DirectX 11 Headers

Started by Zen, October 16, 2014, 09:15:51 AM

Previous topic - Next topic

Zen

Does anybody have an interest in this ?
DirectX 11 and Direct3D 11 are installed on Windows Vista and Windows 7, and Windows 8.

In his SDK conversion, TOUTENMASM has headers for many DirectX 11 interfaces, structures, and enumeration value equivalents.
I am currently converting numerous interface definitions to compatible MASM structures, but I am using a different format than TOUTENMASM. The complexity is mind-boggling. I may have to hire a physicist to help me figure it all out,...

Direct3D 11 Graphics Overview, MSDN
Migrating to Direct3D 11, MSDN

EDIT: Here is a thread from The MASM Forum Archive 2004 to 2012 on just this topic:
DirectX 11 SDK There is an attached zip archive in the thread containing MASM inc files converted from DirectX 11 SDK headers using Japheth's h2incx utility. This is probably the best source available. I have included the ZIP here, just for convenience:

Siekmanski

I converted the Direct3D9 includes manually in 2003 and still have nightmares.....  :biggrin:
Creative coders use backward thinking techniques as a strategy.

TouEnMasm


Just ask you a question,did I need another Format ?
The one I choose is not a choice,but a need to go to end.
Fa is a musical note to play with CL

Zen

#3
...Hi,...TOUTENMASM,
No, you don't need another format. Your SDK translator outputs a very usable syntax. In fact, from examining your syntax with my syntax (in IDAPro), I'm fairly sure, they perform exactly the same way.
The reason I'm using a different syntax, is that it's almost foolproof for novice MASM programmers,...and, it's more readable,...

...And, SIEKMANSKI,...that's exactly what it is,...a nightmare,...
...Just reading through your source, I could see that you did a lot of work,...re-defining all those COM interfaces and types,...
...You should see the C-style VTABLE definition for the ID3D11DeviceContext interface,...it's that most humongous COM interface I've ever encountered,...(DAVE will go berserk over this),...

Zen

Here's an example, so you have some concept of what I'm talking about:   
This is the C-style ID3D11Device interface definition, from d3d11.h (Windows Seven SDK)   

;     typedef struct ID3D11DeviceVtbl
;     {
;         BEGIN_INTERFACE
;         
;         HRESULT ( STDMETHODCALLTYPE *QueryInterface )( 
;             ID3D11Device * This,
;             /* [in] */ REFIID riid,
;             /* [annotation][iid_is][out] */
;             __RPC__deref_out  void **ppvObject);
;         
;         ULONG ( STDMETHODCALLTYPE *AddRef )( 
;             ID3D11Device * This);
;         
;         ULONG ( STDMETHODCALLTYPE *Release )( 
;             ID3D11Device * This);
;         
;         HRESULT ( STDMETHODCALLTYPE *CreateBuffer )(
;             ID3D11Device * This,
;             /* [annotation] */
;             __in  const D3D11_BUFFER_DESC *pDesc,
;             /* [annotation] */
;             __in_opt  const D3D11_SUBRESOURCE_DATA *pInitialData,
;             /* [annotation] */
;             __out_opt  ID3D11Buffer **ppBuffer);
;         
;         HRESULT ( STDMETHODCALLTYPE *CreateTexture1D )(
;             ID3D11Device * This,
;             /* [annotation] */
;             __in  const D3D11_TEXTURE1D_DESC *pDesc,
;             /* [annotation] */
;             __in_xcount_opt(pDesc->MipLevels * pDesc->ArraySize)  const D3D11_SUBRESOURCE_DATA *pInitialData,
;             /* [annotation] */
;             __out_opt  ID3D11Texture1D **ppTexture1D);
;         
;         HRESULT ( STDMETHODCALLTYPE *CreateTexture2D )(
;             ID3D11Device * This,
;             /* [annotation] */
;             __in  const D3D11_TEXTURE2D_DESC *pDesc,
;             /* [annotation] */
;             __in_xcount_opt(pDesc->MipLevels * pDesc->ArraySize)  const D3D11_SUBRESOURCE_DATA *pInitialData,
;             /* [annotation] */
;             __out_opt  ID3D11Texture2D **ppTexture2D);
;         
;         HRESULT ( STDMETHODCALLTYPE *CreateTexture3D )(
;             ID3D11Device * This,
;             /* [annotation] */
;             __in  const D3D11_TEXTURE3D_DESC *pDesc,
;             /* [annotation] */
;             __in_xcount_opt(pDesc->MipLevels)  const D3D11_SUBRESOURCE_DATA *pInitialData,
;             /* [annotation] */
;             __out_opt  ID3D11Texture3D **ppTexture3D);
;         
;         HRESULT ( STDMETHODCALLTYPE *CreateShaderResourceView )(
;             ID3D11Device * This,
;             /* [annotation] */
;             __in  ID3D11Resource *pResource,
;             /* [annotation] */
;             __in_opt  const D3D11_SHADER_RESOURCE_VIEW_DESC *pDesc,
;             /* [annotation] */
;             __out_opt  ID3D11ShaderResourceView **ppSRView);
;         
;         HRESULT ( STDMETHODCALLTYPE *CreateUnorderedAccessView )( 
;             ID3D11Device * This,
;             /* [annotation] */
;             __in  ID3D11Resource *pResource,
;             /* [annotation] */
;             __in_opt  const D3D11_UNORDERED_ACCESS_VIEW_DESC *pDesc,
;             /* [annotation] */
;             __out_opt  ID3D11UnorderedAccessView **ppUAView);
;         
;         HRESULT ( STDMETHODCALLTYPE *CreateRenderTargetView )( 
;             ID3D11Device * This,
;             /* [annotation] */
;             __in  ID3D11Resource *pResource,
;             /* [annotation] */
;             __in_opt  const D3D11_RENDER_TARGET_VIEW_DESC *pDesc,
;             /* [annotation] */
;             __out_opt  ID3D11RenderTargetView **ppRTView);
;         
;         HRESULT ( STDMETHODCALLTYPE *CreateDepthStencilView )(
;             ID3D11Device * This,
;             /* [annotation] */
;             __in  ID3D11Resource *pResource,
;             /* [annotation] */
;             __in_opt  const D3D11_DEPTH_STENCIL_VIEW_DESC *pDesc,
;             /* [annotation] */
;             __out_opt  ID3D11DepthStencilView **ppDepthStencilView);
;         
;         HRESULT ( STDMETHODCALLTYPE *CreateInputLayout )(
;             ID3D11Device * This,
;             /* [annotation] */
;             __in_ecount(NumElements)  const D3D11_INPUT_ELEMENT_DESC *pInputElementDescs,
;             /* [annotation] */
;             __in_range( 0, D3D11_IA_VERTEX_INPUT_STRUCTURE_ELEMENT_COUNT )  UINT NumElements,
;             /* [annotation] */
;             __in  const void *pShaderBytecodeWithInputSignature,
;             /* [annotation] */
;             __in  SIZE_T BytecodeLength,
;             /* [annotation] */
;             __out_opt  ID3D11InputLayout **ppInputLayout);
;         
;         HRESULT ( STDMETHODCALLTYPE *CreateVertexShader )(
;             ID3D11Device * This,
;             /* [annotation] */
;             __in  const void *pShaderBytecode,
;             /* [annotation] */
;             __in  SIZE_T BytecodeLength,
;             /* [annotation] */
;             __in_opt  ID3D11ClassLinkage *pClassLinkage,
;             /* [annotation] */
;             __out_opt  ID3D11VertexShader **ppVertexShader);
;         
;         HRESULT ( STDMETHODCALLTYPE *CreateGeometryShader )(
;             ID3D11Device * This,
;             /* [annotation] */
;             __in  const void *pShaderBytecode,
;             /* [annotation] */
;             __in  SIZE_T BytecodeLength,
;             /* [annotation] */
;             __in_opt  ID3D11ClassLinkage *pClassLinkage,
;             /* [annotation] */
;             __out_opt  ID3D11GeometryShader **ppGeometryShader);
;         
;         HRESULT ( STDMETHODCALLTYPE *CreateGeometryShaderWithStreamOutput )(
;             ID3D11Device * This,
;             /* [annotation] */
;             __in  const void *pShaderBytecode,
;             /* [annotation] */
;             __in  SIZE_T BytecodeLength,
;             /* [annotation] */
;             __in_ecount_opt(NumEntries)  const D3D11_SO_DECLARATION_ENTRY *pSODeclaration,
;             /* [annotation] */
;             __in_range( 0, D3D11_SO_STREAM_COUNT * D3D11_SO_OUTPUT_COMPONENT_COUNT )  UINT NumEntries,
;             /* [annotation] */
;             __in_ecount_opt(NumStrides)  const UINT *pBufferStrides,
;             /* [annotation] */
;             __in_range( 0, D3D11_SO_BUFFER_SLOT_COUNT )  UINT NumStrides,
;             /* [annotation] */
;             __in  UINT RasterizedStream,
;             /* [annotation] */
;             __in_opt  ID3D11ClassLinkage *pClassLinkage,
;             /* [annotation] */
;             __out_opt  ID3D11GeometryShader **ppGeometryShader);
;         
;         HRESULT ( STDMETHODCALLTYPE *CreatePixelShader )(
;             ID3D11Device * This,
;             /* [annotation] */
;             __in  const void *pShaderBytecode,
;             /* [annotation] */
;             __in  SIZE_T BytecodeLength,
;             /* [annotation] */
;             __in_opt  ID3D11ClassLinkage *pClassLinkage,
;             /* [annotation] */
;             __out_opt  ID3D11PixelShader **ppPixelShader);
;         
;         HRESULT ( STDMETHODCALLTYPE *CreateHullShader )( 
;             ID3D11Device * This,
;             /* [annotation] */
;             __in  const void *pShaderBytecode,
;             /* [annotation] */
;             __in  SIZE_T BytecodeLength,
;             /* [annotation] */
;             __in_opt  ID3D11ClassLinkage *pClassLinkage,
;             /* [annotation] */
;             __out_opt  ID3D11HullShader **ppHullShader);
;         
;         HRESULT ( STDMETHODCALLTYPE *CreateDomainShader )( 
;             ID3D11Device * This,
;             /* [annotation] */
;             __in  const void *pShaderBytecode,
;             /* [annotation] */
;             __in  SIZE_T BytecodeLength,
;             /* [annotation] */
;             __in_opt  ID3D11ClassLinkage *pClassLinkage,
;             /* [annotation] */
;             __out_opt  ID3D11DomainShader **ppDomainShader);
;         
;         HRESULT ( STDMETHODCALLTYPE *CreateComputeShader )(
;             ID3D11Device * This,
;             /* [annotation] */
;             __in  const void *pShaderBytecode,
;             /* [annotation] */
;             __in  SIZE_T BytecodeLength,
;             /* [annotation] */
;             __in_opt  ID3D11ClassLinkage *pClassLinkage,
;             /* [annotation] */
;             __out_opt  ID3D11ComputeShader **ppComputeShader);
;         
;         HRESULT ( STDMETHODCALLTYPE *CreateClassLinkage )( 
;             ID3D11Device * This,
;             /* [annotation] */
;             __out  ID3D11ClassLinkage **ppLinkage);
;         
;         HRESULT ( STDMETHODCALLTYPE *CreateBlendState )(
;             ID3D11Device * This,
;             /* [annotation] */
;             __in  const D3D11_BLEND_DESC *pBlendStateDesc,
;             /* [annotation] */
;             __out_opt  ID3D11BlendState **ppBlendState);
;         
;         HRESULT ( STDMETHODCALLTYPE *CreateDepthStencilState )(
;             ID3D11Device * This,
;             /* [annotation] */
;             __in  const D3D11_DEPTH_STENCIL_DESC *pDepthStencilDesc,
;             /* [annotation] */
;             __out_opt  ID3D11DepthStencilState **ppDepthStencilState);
;         
;         HRESULT ( STDMETHODCALLTYPE *CreateRasterizerState )(
;             ID3D11Device * This,
;             /* [annotation] */
;             __in  const D3D11_RASTERIZER_DESC *pRasterizerDesc,
;             /* [annotation] */
;             __out_opt  ID3D11RasterizerState **ppRasterizerState);
;         
;         HRESULT ( STDMETHODCALLTYPE *CreateSamplerState )(
;             ID3D11Device * This,
;             /* [annotation] */
;             __in  const D3D11_SAMPLER_DESC *pSamplerDesc,
;             /* [annotation] */
;             __out_opt  ID3D11SamplerState **ppSamplerState);
;         
;         HRESULT ( STDMETHODCALLTYPE *CreateQuery )(
;             ID3D11Device * This,
;             /* [annotation] */
;             __in  const D3D11_QUERY_DESC *pQueryDesc,
;             /* [annotation] */
;             __out_opt  ID3D11Query **ppQuery);
;         
;         HRESULT ( STDMETHODCALLTYPE *CreatePredicate )(
;             ID3D11Device * This,
;             /* [annotation] */
;             __in  const D3D11_QUERY_DESC *pPredicateDesc,
;             /* [annotation] */
;             __out_opt  ID3D11Predicate **ppPredicate);
;         
;         HRESULT ( STDMETHODCALLTYPE *CreateCounter )(
;             ID3D11Device * This,
;             /* [annotation] */
;             __in  const D3D11_COUNTER_DESC *pCounterDesc,
;             /* [annotation] */
;             __out_opt  ID3D11Counter **ppCounter);
;         
;         HRESULT ( STDMETHODCALLTYPE *CreateDeferredContext )(
;             ID3D11Device * This,
;             UINT ContextFlags,
;             /* [annotation] */
;             __out_opt  ID3D11DeviceContext **ppDeferredContext);
;         
;         HRESULT ( STDMETHODCALLTYPE *OpenSharedResource )(
;             ID3D11Device * This,
;             /* [annotation] */
;             __in  HANDLE hResource,
;             /* [annotation] */
;             __in  REFIID ReturnedInterface,
;             /* [annotation] */
;             __out_opt  void **ppResource);
;         
;         HRESULT ( STDMETHODCALLTYPE *CheckFormatSupport )(
;             ID3D11Device * This,
;             /* [annotation] */
;             __in  DXGI_FORMAT Format,
;             /* [annotation] */
;             __out  UINT *pFormatSupport);
;         
;         HRESULT ( STDMETHODCALLTYPE *CheckMultisampleQualityLevels )(
;             ID3D11Device * This,
;             /* [annotation] */
;             __in  DXGI_FORMAT Format,
;             /* [annotation] */
;             __in  UINT SampleCount,
;             /* [annotation] */
;             __out  UINT *pNumQualityLevels);
;         
;         void ( STDMETHODCALLTYPE *CheckCounterInfo )(
;             ID3D11Device * This,
;             /* [annotation] */
;             __out  D3D11_COUNTER_INFO *pCounterInfo);
;         
;         HRESULT ( STDMETHODCALLTYPE *CheckCounter )( 
;             ID3D11Device * This,
;             /* [annotation] */
;             __in  const D3D11_COUNTER_DESC *pDesc,
;             /* [annotation] */
;             __out  D3D11_COUNTER_TYPE *pType,
;             /* [annotation] */
;             __out  UINT *pActiveCounters,
;             /* [annotation] */
;             __out_ecount_opt(*pNameLength)  LPSTR szName,
;             /* [annotation] */
;             __inout_opt  UINT *pNameLength,
;             /* [annotation] */
;             __out_ecount_opt(*pUnitsLength)  LPSTR szUnits,
;             /* [annotation] */
;             __inout_opt  UINT *pUnitsLength,
;             /* [annotation] */
;             __out_ecount_opt(*pDescriptionLength)  LPSTR szDescription,
;             /* [annotation] */
;             __inout_opt  UINT *pDescriptionLength);
;         
;         HRESULT ( STDMETHODCALLTYPE *CheckFeatureSupport )(
;             ID3D11Device * This,
;             D3D11_FEATURE Feature,
;             /* [annotation] */
;             __out_bcount(FeatureSupportDataSize)  void *pFeatureSupportData,
;             UINT FeatureSupportDataSize);
;         
;         HRESULT ( STDMETHODCALLTYPE *GetPrivateData )(
;             ID3D11Device * This,
;             /* [annotation] */
;             __in  REFGUID guid,
;             /* [annotation] */
;             __inout  UINT *pDataSize,
;             /* [annotation] */
;             __out_bcount_opt(*pDataSize)  void *pData);
;         
;         HRESULT ( STDMETHODCALLTYPE *SetPrivateData )(
;             ID3D11Device * This,
;             /* [annotation] */
;             __in  REFGUID guid,
;             /* [annotation] */
;             __in  UINT DataSize,
;             /* [annotation] */
;             __in_bcount_opt(DataSize)  const void *pData);
;         
;         HRESULT ( STDMETHODCALLTYPE *SetPrivateDataInterface )(
;             ID3D11Device * This,
;             /* [annotation] */
;             __in  REFGUID guid,
;             /* [annotation] */
;             __in_opt  const IUnknown *pData);
;         
;         D3D_FEATURE_LEVEL ( STDMETHODCALLTYPE *GetFeatureLevel )(
;             ID3D11Device * This);
;         
;         UINT ( STDMETHODCALLTYPE *GetCreationFlags )(
;             ID3D11Device * This);
;         
;         HRESULT ( STDMETHODCALLTYPE *GetDeviceRemovedReason )( 
;             ID3D11Device * This);
;         
;         void ( STDMETHODCALLTYPE *GetImmediateContext )(
;             ID3D11Device * This,
;             /* [annotation] */
;             __out  ID3D11DeviceContext **ppImmediateContext);
;         
;         HRESULT ( STDMETHODCALLTYPE *SetExceptionMode )(
;             ID3D11Device * This,
;             UINT RaiseFlags);
;         
;         UINT ( STDMETHODCALLTYPE *GetExceptionMode )(
;             ID3D11Device * This);
;         
;         END_INTERFACE
;     } ID3D11DeviceVtbl;


Zen

...And, here is the MASM structure definition that corresponds to the ID3D11Device interface:

ID3D11Device STRUCT

      METHOD(QueryInterface, _this:PVOID, riid:ptr GUID, ppvObj:ptr LPVOID)
      METHOD(AddRef, _this:PVOID)
      METHOD(Release, _this:PVOID)

;     pDesc is a pointer to D3D11_BUFFER_DESC, pInitialData is a pointer to D3D11_SUBRESOURCE_DATA,
;     ppBuffer is a pointer to a pointer to ID3D11Buffer.   
      METHOD(CreateBuffer, _this:PVOID, pDesc:DWORD, pInitialData:DWORD, ppBuffer:LPVOID)

;     pDesc is a pointer to D3D11_TEXTURE1D_DESC, pInitialData is a pointer to D3D11_SUBRESOURCE_DATA,
;     ppTexture1D is a pointer to a pointer to ID3D11Texture1D
      METHOD(CreateTexture1D, _this:PVOID, pDesc:DWORD, pInitialData:DWORD, ppTexture1D:LPVOID)

;     pDesc is a pointer to D3D11_TEXTURE2D_DESC, pInitialData is a pointer to D3D11_SUBRESOURCE_DATA,
;     ppTexture2D is a pointer to a pointer to ID3D11Texture2D
      METHOD(CreateTexture2D, _this:PVOID, pDesc:DWORD, pInitialData:DWORD, ppTexture2D:LPVOID)

;     pDesc is a pointer to D3D11_TEXTURE3D_DESC, pInitialData is a pointer to D3D11_SUBRESOURCE_DATA,
;     ppTexture3D is a pointer to a pointer to ID3D11Texture3D
      METHOD(CreateTexture3D, _this:PVOID, pDesc:DWORD, pInitialData:DWORD, ppTexture3D:LPVOID)

;     pResource is a pointer to ID3D11Resource, pDesc is a pointer to D3D11_SHADER_RESOURCE_VIEW_DESC,
;     ppSRView is a pointer to a pointer to ID3D11ShaderResourceView
      METHOD(CreateShaderResourceView, _this:PVOID, pResource:DWORD, pDesc:DWORD, ppSRView:LPVOID)

;     pResource is a pointer to ID3D11Resource, pDesc is a pointer to D3D11_UNORDERED_ACCESS_VIEW_DESC,
;     ppUAView is a pointer to a pointer to ID3D11UnorderedAccessView
      METHOD(CreateUnorderedAccessView, _this:PVOID, pResource:DWORD, pDesc:DWORD, ppUAView:LPVOID)

;     pResource is a pointer to ID3D11Resource, pDesc is a pointer to D3D11_RENDER_TARGET_VIEW_DESC,
;     ppRTView is a pointer to a pointer to ID3D11RenderTargetView
      METHOD(CreateRenderTargetView, _this:PVOID, pResource:DWORD, pDesc:DWORD, ppRTView:LPVOID)

;     pResource is a pointer to ID3D11Resource, pDesc is a pointer to D3D11_DEPTH_STENCIL_VIEW_DESC,
;     ppDepthStencilView is a pointer to a pointer to ID3D11DepthStencilView
      METHOD(CreateDepthStencilView, _this:PVOID, pResource:DWORD, pDesc:DWORD, ppDepthStencilView:LPVOID)

;     pInputElementDescs is a pointer to D3D11_INPUT_ELEMENT_DESC, pShaderBytecodeWithInputSignature is a VOID pointer,
;     ppInputLayout is a pointer to a pointer to ID3D11InputLayout
      METHOD(CreateInputLayout, _this:PVOID, pInputElementDescs:DWORD, NumElements:UINT, \   
                                                                                              pShaderBytecodeWithInputSignature:DWORD, ppInputLayout:LPVOID)

;     pShaderBytecode is a VOID pointer, BytecodeLength is a SIZE_T, pClassLinkage is a pointer to ID3D11ClassLinkage,
;     ppVertexShader is a pointer to a pointer to ID3D11VertexShader 
      METHOD(CreateVertexShader, _this:PVOID, pShaderBytecode:DWORD, BytecodeLength:DWORD, pClassLinkage:DWORD, \ 
                                                                                                                                                               ppVertexShader:LPVOID)

;     pShaderBytecode is a VOID pointer, BytecodeLength is a SIZE_T, pClassLinkage is a pointer to ID3D11ClassLinkage,
;     ppVertexShader is a pointer to a pointer to ID3D11GeometryShader 
      METHOD(CreateGeometryShader, _this:PVOID, pShaderBytecode:DWORD, BytecodeLength:DWORD, pClassLinkage:DWORD, \
                                                                                                                                                          ppGeometryShader:LPVOID)

;     pShaderBytecode is a VOID pointer, BytecodeLength is a SIZE_T, pSODeclaration is a pointer to D3D11_SO_DECLARATION_ENTRY,
;     pBufferStrides is a pointer to UINT, pClassLinkage is a pointer to ID3D11ClassLinkage,
;     ppGeometryShader  is a pointer to a pointer to ID3D11GeometryShader   
      METHOD (CreateGeometryShaderWithStreamOutput, _this:PVOID, pShaderBytecode:DWORD, BytecodeLength:DWORD, \
       pSODeclaration:DWORD, NumEntries:UINT, pBufferStrides:DWORD, NumStrides:UINT, RasterizedStream:UINT, \
                                                                                                                   pClassLinkage:DWORD, ppGeometryShader:LPVOID)

;     pShaderBytecode is a VOID pointer, BytecodeLength is a SIZE_T, pClassLinkage is a pointer to ID3D11ClassLinkage,
;     ppPixelShader is a pointer to a pointer to ID3D11PixelShader
      METHOD(CreatePixelShader, _this:PVOID, pShaderBytecode:DWORD, BytecodeLength:DWORD, \
                                                                    pClassLinkage:DWORD, ppPixelShader:LPVOID)

;     pShaderBytecode is a VOID pointer, BytecodeLength is a SIZE_T, pClassLinkage is a pointer to ID3D11ClassLinkage,
;     ppHullShader is a pointer to a pointer to ID3D11HullShader
      METHOD(CreateHullShader, _this:PVOID, pShaderBytecode:DWORD, BytecodeLength:DWORD, \
                                                                                                                       pClassLinkage:DWORD, ppHullShader:LPVOID)

;     pShaderBytecode is a VOID pointer, BytecodeLength is a SIZE_T, pClassLinkage is a pointer to ID3D11ClassLinkage,
;     ppDomainShader is a pointer to a pointer to ID3D11DomainShader
      METHOD(CreateDomainShader, _this:PVOID, pShaderBytecode:DWORD, BytecodeLength:DWORD, \
                                                                                                                        pClassLinkage:DWORD, ppDomainShader:LPVOID)

;     pShaderBytecode is a VOID pointer, BytecodeLength is a SIZE_T, pClassLinkage is a pointer to ID3D11ClassLinkage,
;     ppComputeShader is a pointer to a pointer to ID3D11ComputeShader
      METHOD(CreateComputeShader, _this:PVOID, pShaderBytecode:DWORD, BytecodeLength:DWORD, \
                                                                                                           pClassLinkage:DWORD, ppComputeShader:LPVOID)

;     ppLinkage is a pointer to a pointer to ID3D11ClassLinkage
      METHOD(CreateClassLinkage, _this:PVOID, ppLinkage:LPVOID)

;     pBlendStateDesc is a pointer to D3D11_BLEND_DESC, ppBlendState is a pointer to a pointer to ID3D11BlendState
      METHOD(CreateBlendState, _this:PVOID, pBlendStateDesc:DWORD, ppBlendState:LPVOID)

;     pDepthStencilDesc is a pointer to D3D11_DEPTH_STENCIL_DESC,
;     ppDepthStencilState is a pointer to a pointer to ID3D11DepthStencilState
      METHOD(CreateDepthStencilState, _this:PVOID, pDepthStencilDesc:DWORD, ppDepthStencilState:LPVOID)

;     pRasterizerDesc is a pointer to D3D11_RASTERIZER_DESC, ppRasterizerState is a pointer to a pointer to ID3D11RasterizerState
      METHOD(CreateRasterizerState, _this:PVOID, pRasterizerDesc:DWORD, ppRasterizerState:LPVOID)

;     pSamplerDesc is a pointer to D3D11_SAMPLER_DESC, ppSamplerState is a pointer to a pointer to ID3D11SamplerState
      METHOD(CreateSamplerState, _this:PVOID, pSamplerDesc:DWORD, ppSamplerState:LPVOID)

;     pQueryDesc is a pointer to D3D11_QUERY_DESC, ppQuery is a pointer to a pointer to ID3D11Query
      METHOD(CreateQuery, _this:PVOID, pQueryDesc:DWORD, ppQuery:LPVOID)

;     pPredicateDesc is a pointer to D3D11_QUERY_DESC, ppPredicate is a pointer to a pointer to ID3D11Predicate
      METHOD(CreatePredicate, _this:PVOID, pPredicateDesc:DWORD, ppPredicate:LPVOID)

;     pCounterDesc is a pointer to D3D11_COUNTER_DESC, ppCounter is a pointer to a pointer to ID3D11Counter
      METHOD(CreateCounter, _this:PVOID, pCounterDesc:DWORD, ppCounter:LPVOID)

;     ppDeferredContext is a pointer to a pointer to ID3D11DeviceContext   
      METHOD(CreateDeferredContext, _this:PVOID, ContextFlags:UINT, ppDeferredContext:LPVOID)

;     ppResource is a pointer to a VOID pointer   
      METHOD(OpenSharedResource, _this:PVOID, hResource:HANDLE, ReturnedInterface:REFIID, ppResource:LPVOID)

;     Format is a value from DXGI_FORMAT enumeration, pFormatSupport is a pointer to a UINT   
      METHOD(CheckFormatSupport, _this:PVOID, Format:DWORD, pFormatSupport:DWORD)

;     Format is a value from DXGI_FORMAT enumeration, pNumQualityLevels is a pointer to UINT
      METHOD(CheckMultisampleQualityLevels, _this:PVOID, Format:DWORD, SampleCount:UINT, pNumQualityLevels:DWORD)

;     pCounterInfo is a pointer to D3D11_COUNTER_INFO
      METHOD(CheckCounterInfo, _this:PVOID, pCounterInfo:DWORD)

;     pDesc is a pointer to D3D11_COUNTER_DESC, pType is a pointer to D3D11_COUNTER_TYPE, pActiveCounters is a pointer to UINT,
;     pNameLength is a pointer to UINT, pUnitsLength is a pointer to UINT, pDescriptionLength is a pointer to UINT
      METHOD(CheckCounter, _this:PVOID, pDesc:DWORD, pType:DWORD, pActiveCounters:DWORD, szName:LPSTR, \   
                                   pNameLength:DWORD, szUnits:LPSTR, pUnitsLength:DWORD, szDescription:LPSTR, pDescriptionLength:DWORD)

;     Feature is a value from D3D11_FEATURE enumeration, pFeatureSupportData is a VOID pointer
      METHOD(CheckFeatureSupport, _this:PVOID, Feature:DWORD, pFeatureSupportData:DWORD, FeatureSupportDataSize:UINT)

;     pDataSize is a pointer to UINT, pData is a VOID pointer   
      METHOD(GetPrivateData, _this:PVOID, guid:REFGUID, pDataSize:DWORD, pData:DWORD)

;     pData is a const VOID pointer   
      METHOD(SetPrivateData, _this:PVOID, guid:REFGUID, pDataSize:UINT, pData:DWORD)
 
;     pData is a const pointer to IUnknown   
      METHOD(SetPrivateDataInterface, _this:PVOID, guid:REFGUID, pData:DWORD)

      METHOD(GetFeatureLevel, _this:PVOID)

      METHOD(GetCreationFlags, _this:PVOID)

      METHOD(GetDeviceRemovedReason, _this:PVOID)

;     ppImmediateContextr is a pointer to a pointer to ID3D11DeviceContext   
      METHOD(GetImmediateContext, _this:PVOID, ppImmediateContext:LPVOID)

      METHOD(SetExceptionMode, _this:PVOID, RaiseFlags:UINT)

      METHOD(GetExceptionMode, _this:PVOID)

ID3D11Device ENDS   


Zen

#6
The reason I do it this way, is for the parameter information. All the parameter data names are the same (yes, I realize they're just placeholders), and with comments to explain what the DWORD pointers are actually pointing to (in a number of cases they are arrays of interfaces). These are fairly complicated interfaces, and, if the invocation fails (with, say, the wrong number of parameters), the application just crashes. Otherwise, if a parameter is invalid, the function fails, and, you must check the HRESULT.
Also, the compiler will check for syntax errors (not just the number of parameters pushed onto the stack).
Another advantage is that you can just copy the functions name from the include file, and paste it into the Google text box, and the official DirectX 11 documentation will come up instantaneously.

Here is the METHOD macro:
;********************************************************************************************************************************************
;    The following macro is taken from a MASM forum example written by QWORD   
;********************************************************************************************************************************************

METHOD macro name,args:VARARG
LOCAL _type1,_type2

_type1 TYPEDEF proto args
_type2 TYPEDEF ptr _type1
EXITM <name _type2 ?>
endm



I'm still not sure what the heck this macro actually does, besides use the method name as the first token in the method invocation.

TouEnMasm

Quote
and, if the invocation fails (with, say, the wrong number of parameters), the application just crashes.
The translated sdk use invoke to call the interfaces functions and in this case you just get an error at compile time,no crash.




Fa is a musical note to play with CL

satpro

#8
Hey Zen,

The interfaces are still basically COM though, so after weeding through all the fancy C++ stuff you are generally left with DD ptrs.  Which reminds me -- I liked the SDK a whole lot more when it was written in an easier to understand way (not all the fancy descriptors, etc.).

A while ago I put a bunch of includes for 10 over on the GoAsm section.  For the most part they do the trick, but over time I have had to make a few adjustments, as the h2inc converter is sometimes off the mark a bit.  Maybe they can help you some.  If nothing else at least to get some copy/paste material...   :biggrin:

The other thing I noticed about the newer SDK includes is that there are lots of C++ overloads, etc.  At the end of the day the COM structures are still just binary interfaces, so you have to first "boil" the fancy stuff out (and that ain't easy at all sometimes).

Attached is some Dx 11 stuff, 3 header files.  I use GoAsm but its syntax is generic enough.  I use these and so far they seem good.

Zen

SATPRO,
Yeah,...you're right,...that's why a number of different syntax variations work just fine. A COM interface is just a pointer (address) to a pointer (address) to an array of pointers (addresses, again). And, the names of the interface function implementations, and their parameters are basically irrelevant as far as the MASM compiler goes.

satpro

Zen,

I uploaded the headers I use (in the post above) with DirectX 11.  They could be of use to you, although I imagine they will need at least some "Masm-izing" first.  I don't know Masm syntax well enough to make it foolproof.  At least they are organized...  :biggrin:

Zen

SATPRO,
Very useful,...had you not told me they were GoAsm, I wouldn't have noticed the difference.
Thanks.