Skip to content

Commit

Permalink
[DX12] Added getConstant to DX12 wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
TothBenoit committed Nov 26, 2024
1 parent f5e5223 commit 4b2e7e8
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
11 changes: 10 additions & 1 deletion libs/directx/dx/Dx12.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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());
}
Expand Down Expand Up @@ -1657,5 +1667,4 @@ class Dx12 {
static function dxCreate( win : hl.Abstract<"dx_window">, flags : DriverInitFlags, deviceName : hl.Bytes ) : DriverInstance {
return null;
}

}
14 changes: 13 additions & 1 deletion libs/directx/dx12.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
//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);

0 comments on commit 4b2e7e8

Please sign in to comment.