Nicolas Cannasse 3 vuotta sitten
vanhempi
commit
401b731061
2 muutettua tiedostoa jossa 14 lisäystä ja 8 poistoa
  1. 5 5
      libs/directx/dx/Dx12.hx
  2. 9 3
      libs/directx/dx12.cpp

+ 5 - 5
libs/directx/dx/Dx12.hx

@@ -32,7 +32,7 @@ abstract Resource(hl.Abstract<"dx_resource">) {
 	}
 }
 
-@:hlNative("dx12","resource_")
+@:hlNative("dx12","resource_") @:forward(release)
 abstract GpuResource(Resource) {
 	@:hlNative("dx12","resource_get_gpu_virtual_address")
 	public function getGpuVirtualAddress() : Int64 { return 0; }
@@ -125,6 +125,7 @@ abstract CommandList(Resource) {
 	public function resourceBarrier( b : ResourceBarrier ) {}
 	public function setPipelineState( state : PipelineState ) {}
 	public function setGraphicsRootSignature( sign : RootSignature ) {}
+	public function setGraphicsRoot32BitConstants( index : Int, numValues : Int, data : hl.Bytes, dstOffset : Int ) {}
 	public function copyBufferRegion( dst : GpuResource, dstOffset : Int64, src : GpuResource, srcOffset : Int64, size : Int64 ) {}
 
 	public function iaSetPrimitiveTopology( top : PrimitiveTopology ) {}
@@ -386,7 +387,7 @@ enum abstract DescriptorRangeType(Int) {
 }
 
 @:struct class RootParameter {
-	var parameterType : RootParameterType;
+	public var parameterType : RootParameterType;
 	var __paddingBeforeUnion : Int;
 }
 
@@ -808,7 +809,7 @@ enum abstract LogicOp(Int) {
 	public var dstBlendAlpha : Blend;
 	public var blendOpAlpha : BlendOp;
 	public var logicOp : LogicOp;
-	public var renderTergetWriteMask : hl.UI8;
+	public var renderTargetWriteMask : hl.UI8;
 	public function new() {
 	}
 }
@@ -1168,8 +1169,7 @@ class Dx12 {
 		return null;
 	}
 
-	public static function resize( width : Int, height : Int, bufferCount : Int, format : DxgiFormat ) : Bool {
-		return false;
+	public static function resize( width : Int, height : Int, bufferCount : Int, format : DxgiFormat ) {
 	}
 
 	public static function signal( fence : Fence, value : Int64 ) {

+ 9 - 3
libs/directx/dx12.cpp

@@ -101,7 +101,7 @@ HL_PRIM dx_driver *HL_NAME(create)( HWND window, int flags ) {
 HL_PRIM void HL_NAME(resize)( int width, int height, int buffer_count, DXGI_FORMAT format ) {
 	dx_driver *drv = static_driver;
 	if( drv->swapchain ) {
-		drv->swapchain->ResizeBuffers(buffer_count, width, height, format, 0);
+		CHKERR(drv->swapchain->ResizeBuffers(buffer_count, width, height, format, 0));
 	} else {
 		DXGI_SWAP_CHAIN_DESC1 desc = {};
 		desc.Width = width;
@@ -112,8 +112,9 @@ HL_PRIM void HL_NAME(resize)( int width, int height, int buffer_count, DXGI_FORM
 		desc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_DISCARD;
 		desc.SampleDesc.Count = 1;
 
-		IDXGISwapChain1 *swapchain;
+		IDXGISwapChain1 *swapchain = NULL;
 		drv->factory->CreateSwapChainForHwnd(drv->commandQueue,drv->wnd,&desc,NULL,NULL,&swapchain);
+		if( !swapchain ) CHKERR(E_INVALIDARG);
 		swapchain->QueryInterface(IID_PPV_ARGS(&drv->swapchain));
 	}
 }
@@ -171,7 +172,7 @@ uchar *HL_NAME(get_device_name)() {
 #define _RES _ABSTRACT(dx_resource)
 
 DEFINE_PRIM(_DRIVER, create, _ABSTRACT(dx_window) _I32);
-DEFINE_PRIM(_BOOL, resize, _I32 _I32 _I32 _I32);
+DEFINE_PRIM(_VOID, resize, _I32 _I32 _I32 _I32);
 DEFINE_PRIM(_VOID, present, _BOOL);
 DEFINE_PRIM(_I32, get_current_back_buffer_index, _NO_ARG);
 DEFINE_PRIM(_VOID, signal, _RES _I64);
@@ -413,6 +414,10 @@ void HL_NAME(command_list_set_graphics_root_signature)( ID3D12GraphicsCommandLis
 	l->SetGraphicsRootSignature(sign);
 }
 
+void HL_NAME(command_list_set_graphics_root32_bit_constants)( ID3D12GraphicsCommandList *l, int index, int numValues, void *data, int destOffset ) {
+	l->SetGraphicsRoot32BitConstants(index, numValues, data, destOffset);
+}
+
 void HL_NAME(command_list_set_pipeline_state)( ID3D12GraphicsCommandList *l, ID3D12PipelineState *pipe ) {
 	l->SetPipelineState(pipe);
 }
@@ -457,6 +462,7 @@ DEFINE_PRIM(_VOID, command_list_clear_depth_stencil_view, _RES _I64 _I32 _F32 _I
 DEFINE_PRIM(_VOID, command_list_draw_instanced, _RES _I32 _I32 _I32 _I32);
 DEFINE_PRIM(_VOID, command_list_draw_indexed_instanced, _RES _I32 _I32 _I32 _I32 _I32);
 DEFINE_PRIM(_VOID, command_list_set_graphics_root_signature, _RES _RES);
+DEFINE_PRIM(_VOID, command_list_set_graphics_root32_bit_constants, _RES _I32 _I32 _BYTES _I32);
 DEFINE_PRIM(_VOID, command_list_set_pipeline_state, _RES _RES);
 DEFINE_PRIM(_VOID, command_list_ia_set_vertex_buffers, _RES _I32 _I32 _STRUCT);
 DEFINE_PRIM(_VOID, command_list_ia_set_index_buffer, _RES _STRUCT);