Browse Source

added copySubresourceRegion

Nicolas Cannasse 8 years ago
parent
commit
d89a09417e
2 changed files with 12 additions and 0 deletions
  1. 5 0
      libs/directx/directx.cpp
  2. 7 0
      libs/directx/dx/Resource.hx

+ 5 - 0
libs/directx/directx.cpp

@@ -184,6 +184,10 @@ HL_PRIM void HL_NAME(update_subresource)( dx_resource *r, int index, dx_struct<D
 	driver->context->UpdateSubresource(r, index, box ? &box->value : NULL, data, srcRowPitch, srcDstPitch);
 }
 
+HL_PRIM void HL_NAME(copy_subresource_region)( dx_resource *r, int index, int dx, int dy, int dz, dx_resource *src, int sindex, dx_struct<D3D11_BOX> *box ) {
+	driver->context->CopySubresourceRegion(r, index, dx, dy, dz, src, sindex, box ? &box->value : NULL);
+}
+
 HL_PRIM void *HL_NAME(map)( dx_resource *r, int subRes, int type, bool waitGpu, int *pitch ) {
 	D3D11_MAPPED_SUBRESOURCE map;
 	if( driver->context->Map(r,subRes,(D3D11_MAP)type,waitGpu?0:D3D11_MAP_FLAG_DO_NOT_WAIT,&map) != S_OK )
@@ -444,3 +448,4 @@ DEFINE_PRIM(_VOID, generate_mips, _POINTER);
 DEFINE_PRIM(_BOOL, set_fullscreen_state, _BOOL);
 DEFINE_PRIM(_BOOL, get_fullscreen_state, _NO_ARG);
 DEFINE_PRIM(_VOID, debug_print, _BYTES);
+DEFINE_PRIM(_VOID, copy_subresource_region, _RESOURCE _I32 _I32 _I32 _I32 _RESOURCE _I32 _DYN);

+ 7 - 0
libs/directx/dx/Resource.hx

@@ -33,6 +33,10 @@ abstract Resource(hl.Abstract<"dx_resource">) {
 		dxUpdateSubresource(subResource, box, data, srcRowPitch, srcDepthPitch);
 	}
 
+	public inline function copySubresourceRegion( subResource : Int, dstX : Int, dstY : Int, dstZ : Int, src : Resource, srcSubResource : Int, srcBox : Null<ResourceBox> ) : Void {
+		dxCopySubresourceRegion(subResource, dstX, dstY, dstZ, src, srcSubResource, srcBox);
+	}
+
 	@:hlNative("directx", "copy_resource")
 	public function copyResource( from : Resource ) {
 	}
@@ -41,6 +45,9 @@ abstract Resource(hl.Abstract<"dx_resource">) {
 	function dxUpdateSubresource( subResource : Int, box : Dynamic, data : hl.Bytes, srcRowPitch : Int, srcDepthPitch : Int ) : Void {
 	}
 
+	@:hlNative("directx", "copy_subresource_region")
+	function dxCopySubresourceRegion( subResource : Int, dstX : Int, dstY : Int, dstZ : Int, src : Resource, srcSubResource : Int, srcBox : Dynamic ) : Void {
+	}
 
 	@:hlNative("directx", "unmap")
 	public function unmap( subResource : Int ) : Void {