From 4b2e7e87d3fbc0a35aff6ade95377baee3efa813 Mon Sep 17 00:00:00 2001 From: TothBenoit Date: Tue, 26 Nov 2024 10:26:39 +0100 Subject: [PATCH] [DX12] Added getConstant to DX12 wrapper --- libs/directx/dx/Dx12.hx | 11 ++++++++++- libs/directx/dx12.cpp | 14 +++++++++++++- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/libs/directx/dx/Dx12.hx b/libs/directx/dx/Dx12.hx index 16015b9bf..aed03bc8a 100644 --- a/libs/directx/dx/Dx12.hx +++ b/libs/directx/dx/Dx12.hx @@ -8,6 +8,12 @@ enum DriverInitFlag { DEBUG; } +enum abstract Constant(Int) to Int { + public var TEXTURE_DATA_PITCH_ALIGNMENT; + public var TEXTURE_DATA_PLACEMENT_ALIGNMENT; + public var DESCRIPTOR_RANGE_OFFSET_APPEND; +} + enum abstract CommandListType(Int) { public var DIRECT = 0; public var BUNDLE = 1; @@ -1624,6 +1630,10 @@ class Dx12 { public static function resume() { } + public static function getConstant( index : Int ) : Int { + return 0; + } + public static function getDeviceName() { return @:privateAccess String.fromUCS2(dxGetDeviceName()); } @@ -1657,5 +1667,4 @@ class Dx12 { static function dxCreate( win : hl.Abstract<"dx_window">, flags : DriverInitFlags, deviceName : hl.Bytes ) : DriverInstance { return null; } - } \ No newline at end of file diff --git a/libs/directx/dx12.cpp b/libs/directx/dx12.cpp index 64450dcfe..95d0a4e56 100644 --- a/libs/directx/dx12.cpp +++ b/libs/directx/dx12.cpp @@ -28,6 +28,12 @@ #define DXERR(cmd) { HRESULT __ret = cmd; if( __ret == E_OUTOFMEMORY ) return NULL; if( __ret != S_OK ) ReportDxError(__ret,__LINE__); } #define CHKERR(cmd) { HRESULT __ret = cmd; if( FAILED(__ret) ) ReportDxError(__ret,__LINE__); } +static int gs_constants[] = { + D3D12_TEXTURE_DATA_PITCH_ALIGNMENT, + D3D12_TEXTURE_DATA_PLACEMENT_ALIGNMENT, + D3D12_DESCRIPTOR_RANGE_OFFSET_APPEND +}; + typedef struct { HWND wnd; ID3D12CommandQueue *commandQueue; @@ -1003,4 +1009,10 @@ DEFINE_PRIM(_VOID, command_list_set_compute_root_unordered_access_view, _RES _I3 DEFINE_PRIM(_VOID, command_list_dispatch, _RES _I32 _I32 _I32); //command_list_clear_unordered_access_view_float, -//command_list_clear_unordered_access_view_uint, \ No newline at end of file +//command_list_clear_unordered_access_view_uint, + +HL_PRIM int HL_NAME(get_constant)(int index) { + return gs_constants[index]; +} + +DEFINE_PRIM(_I32, get_constant, _I32); \ No newline at end of file