Einzelnen Beitrag anzeigen

TiGü

Registriert seit: 6. Apr 2011
Ort: Berlin
3.060 Beiträge
 
Delphi 10.4 Sydney
 
#6

AW: DirectX 12 Header

  Alt 9. Jun 2015, 08:39
Hm, merkwürdig...ich habe nur eine Kleinigkeit an den Headern geändert, bspw. den out-Parameter in IWICImagingFactory2.CreateImageEncoder hinzugefügt und schon gibt es eine sehr lange Liste an Fehlermeldungen, dass einige Typen nicht gefunden werden, obwohl die Deklarationsauflösung funktioniert.
Hängt vielleicht mit irgendwelchen IFDEFs zusammen?! Werde ich nicht schlau draus...
Code:
[dcc32 Error] D3D11.pas(737): E2003 Undeclared identifier: 'TDXGI_FORMAT'
[dcc32 Error] D3D11.pas(1027): E2007 Constant or type identifier expected
[dcc32 Error] D3D11.pas(1032): E2005 'TDXGI_FORMAT' is not a type identifier
[dcc32 Error] D3D11.pas(1053): E2007 Constant or type identifier expected
[dcc32 Error] D3D11.pas(1054): E2003 Undeclared identifier: 'TDXGI_SAMPLE_DESC'
[dcc32 Error] D3D11.pas(1059): E2005 'TDXGI_FORMAT' is not a type identifier
[dcc32 Error] D3D11.pas(1080): E2007 Constant or type identifier expected
...
usw.

Zitat:
Eigentlich nicht,
ich hab versucht die Headers 1:1 zu übersetzen.
Die meisten C++-Header sind mit den _In_-Parameter versehen (https://msdn.microsoft.com/en-us/lib...vs.110%29.aspx).
In Delphi würde das meiner Meinung nach am besten mit den const-Parameter übersetzt werden.
Zumindest hat dies Emba auch bei den bisherigen DirectX-Headern so gehalten.
Zum Beispiel hier aus d2d1.h:
Code:
interface DX_DECLARE_INTERFACE("a2296057-ea42-4099-983b-539fb6505426") ID2D1Bitmap : public ID2D1Image
{
   
   
    //
    // Returns the size of the bitmap in resolution independent units.
    //
    STDMETHOD_(D2D1_SIZE_F, GetSize)(
        ) CONST PURE;
   
   
    //
    // Returns the size of the bitmap in resolution dependent units, (pixels).
    //
    STDMETHOD_(D2D1_SIZE_U, GetPixelSize)(
        ) CONST PURE;
   
   
    //
    // Retrieve the format of the bitmap.
    //
    STDMETHOD_(D2D1_PIXEL_FORMAT, GetPixelFormat)(
        ) CONST PURE;
   
   
    //
    // Return the DPI of the bitmap.
    //
    STDMETHOD_(void, GetDpi)(
        _Out_ FLOAT *dpiX,
        _Out_ FLOAT *dpiY
        ) CONST PURE;
   
    STDMETHOD(CopyFromBitmap)(
        _In_opt_ CONST D2D1_POINT_2U *destPoint,
        _In_ ID2D1Bitmap *bitmap,
        _In_opt_ CONST D2D1_RECT_U *srcRect
        ) PURE;
   
    STDMETHOD(CopyFromRenderTarget)(
        _In_opt_ CONST D2D1_POINT_2U *destPoint,
        _In_ ID2D1RenderTarget *renderTarget,
        _In_opt_ CONST D2D1_RECT_U *srcRect
        ) PURE;
   
    STDMETHOD(CopyFromMemory)(
        _In_opt_ CONST D2D1_RECT_U *dstRect,
        _In_ CONST void *srcData,
        UINT32 pitch
        ) PURE;
}; // interface ID2D1Bitmap
Dazu das Delphi Gegenstück aus Winapi.D2D1:
Delphi-Quellcode:
// +-----------------------------------------------------------------------------
//
// Interface:
// ID2D1Bitmap
//
// Synopsis:
// Root bitmap resource, linearly scaled on a draw call.
//
// ------------------------------------------------------------------------------
  {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(ID2D1Bitmap);'}
  ID2D1Bitmap = interface(ID2D1Resource)
    [SID_ID2D1Bitmap]
    // Returns the size of the bitmap in resolution independent units.
    procedure GetSize(out size: TD2D1SizeF); stdcall;

    // Returns the size of the bitmap in resolution dependent units, (pixels).
    procedure GetPixelSize(out pixelSize: TD2D1SizeU); stdcall;

    // Retrieve the format of the bitmap.
    procedure GetPixelFormat(out pixelFormat: TD2D1PixelFormat); stdcall;

    // Return the DPI of the bitmap.
    procedure GetDpi(out dpiX, dpiY: Single); stdcall;

    function CopyFromBitmap(var destPoint: D2D1_POINT_2U; const bitmap: ID2D1Bitmap;
      var srcRect: D2D1_RECT_U): HResult; stdcall;

    function CopyFromRenderTarget(var destPoint: D2D1_POINT_2U;
      const renderTarget: ID2D1RenderTarget; var srcRect: D2D1_RECT_U): HResult; stdcall;

    function CopyFromMemory(var dstRect: D2D1_RECT_U; srcData: Pointer;
      pitch: Cardinal): HResult; stdcall;
  end;
  {$EXTERNALSYM ID2D1Bitmap}
  Mit Zitat antworten Zitat