public static extern InteropBool ResourceFactory_CreateBlendState( IntPtr failReason, DeviceHandle deviceHandle, InteropBool enableBlending, BlendOperation blendOperation, IntPtr outBlendStateHandle );
public static extern InteropBool ResourceFactory_CreateDSState( IntPtr failReason, DeviceHandle deviceHandle, InteropBool enableDepthTesting, DepthComparisonFunction depthComparisonFunction, IntPtr outDepthStencilStateHandle );
public InputElementDesc(string semanticName, uint semanticIndex, ResourceFormat elementFormat, uint inputSlot, bool isPerVertexData) { SemanticName = semanticName; SemanticIndex = semanticIndex; ElementFormat = elementFormat; InputSlot = inputSlot; IsPerVertexData = isPerVertexData; }
public static extern InteropBool ResourceFactory_CreateDSV( IntPtr failReason, DeviceHandle deviceHandle, Texture2DResourceHandle texture2DHandle, uint mipIndex, ResourceFormat format, InteropBool isMultisampled, IntPtr outDSVHandle // DepthStencilViewHandle* );
public static extern InteropBool ResourceFactory_CreateRTV( IntPtr failReason, DeviceHandle deviceHandle, Texture2DResourceHandle texture2DHandle, uint mipIndex, ResourceFormat format, InteropBool isMultisampled, IntPtr outRTVHandle // RenderTargetViewHandle* );
public static extern InteropBool ResourceFactory_CreateUAVToRawBuffer( IntPtr failReason, DeviceHandle deviceHandle, BufferResourceHandle bufferHandle, uint firstElement, uint numElements, InteropBool appendConsume, InteropBool includeCounter, IntPtr outUAVHandle );
public static extern InteropBool ResourceFactory_CreateRSState( IntPtr failReason, DeviceHandle deviceHandle, int fillMode, int cullMode, InteropBool flipFaces, int depthBias, float depthBiasClamp, float slopeScaledDepthBias, InteropBool enableZClipping, IntPtr outRasterizerStateHandle );
/// <summary> /// Creates a new <see cref="Buffer{TElement}"/> with the supplied builder parameters. /// </summary> /// <remarks> /// In debug mode, this method will check a large number of <see cref="Assure">assurances</see> /// on the builder parameters before creating the resource. /// </remarks> /// <returns>A new <see cref="Buffer{TElement}"/>.</returns> public unsafe override Buffer <TElement> Create() { Assure.True(Usage != ResourceUsage.Immutable || InitialData != null, "You must supply initial data to an immutable resource."); Assure.False( (Usage == ResourceUsage.Immutable || Usage == ResourceUsage.DiscardWrite) && permittedBindings == GPUBindings.None, "An immutable or discard-write resource with no permitted bindings is useless." ); Assure.False( Usage.GetUsage() == 0x3 && permittedBindings != GPUBindings.None, "Staging resources can not be bound to the pipeline." ); Assure.GreaterThan(length, 0U, "Can not create a buffer with 0 elements."); InteropBool isStructured = (BaseResource.GetFormatForType(typeof(TElement)) == ResourceFormat.Unknown); InteropBool allowRawAccess = !isStructured && (int)(permittedBindings & (GPUBindings.WritableShaderResource | GPUBindings.ReadableShaderResource)) != 0; GCHandle?pinnedArrayHandle = null; IntPtr initialDataPtr = IntPtr.Zero; try { int elementSizeBytes = UnsafeUtils.SizeOf <TElement>(); if (InitialData != null) { pinnedArrayHandle = GCHandle.Alloc(InitialData.Value.ContainingArray, GCHandleType.Pinned); initialDataPtr = pinnedArrayHandle.Value.AddrOfPinnedObject() + (elementSizeBytes * (int)InitialData.Value.Offset); } BufferResourceHandle outResourceHandle; InteropUtils.CallNative(NativeMethods.ResourceFactory_CreateBuffer, RenderingModule.Device, (uint)elementSizeBytes, length, Usage.GetUsage(), Usage.GetCPUUsage(), (PipelineBindings)permittedBindings, isStructured, allowRawAccess, initialDataPtr, (IntPtr)(&outResourceHandle) ).ThrowOnFailure(); return(new Buffer <TElement>(outResourceHandle, Usage, (uint)elementSizeBytes, length, permittedBindings, isStructured)); } finally { if (pinnedArrayHandle != null) { pinnedArrayHandle.Value.Free(); } } }
public static extern InteropBool ResourceFactory_CreateBuffer( IntPtr failReason, DeviceHandle deviceHandle, uint elementSizeBytes, uint numElements, int usage, int cpuUsage, PipelineBindings pipelineBindings, InteropBool isStructured, InteropBool allowRawAccess, IntPtr initialDataPtr, IntPtr outBufferHandle );
public static extern InteropBool PhysicsManager_CreateRigidBody( IntPtr failReason, IntPtr translationPtr, // Vector4* IntPtr rotationPtr, // Vector4* IntPtr physicsShapeOffsetPtr, // Vector4* PhysicsShapeHandle collisionShapeHandle, float bodyMass, InteropBool alwaysActive, InteropBool forceIntransigence, InteropBool collideAgainstWorldOnly, InteropBool collideAgainstDynamicsOnly, IntPtr outBodyHandle // PhysicsBodyHandle* );
public static extern InteropBool ResourceFactory_LoadTexture2D( IntPtr failReason, DeviceHandle deviceHandle, [MarshalAs(InteropUtils.INTEROP_STRING_TYPE)] string filePath, InteropBool allocateMipmaps, int usage, int cpuUsage, PipelineBindings pipelineBindings, InteropBool allowMipGeneration, InteropBool allowLODClamping, IntPtr outTexture2DHandle, // Texture2DResourceHandle* IntPtr outWidth, // uint* IntPtr outHeight, // uint* IntPtr outFormat // ResourceFormat* );
public static extern InteropBool ResourceFactory_CreateTexture1DArray( IntPtr failReason, DeviceHandle deviceHandle, uint widthTx, uint numTextures, InteropBool allocateMipmaps, ResourceFormat format, int usage, int cpuUsage, PipelineBindings pipelineBindings, InteropBool allowMipGeneration, InteropBool allowLODClamping, IntPtr initialDataArrayPtr, // InitialResourceDataDesc[] uint initialDataArrayLen, IntPtr outTexture1DHandle );
public unsafe void ShouldUseZeroForFalseOnly() { // Define variables and constants byte zero = 0; byte one = 1; byte twoFiveFive = 255; byte two = 2; // Set up context InteropBool interopZero = *((InteropBool *)&zero); InteropBool interopOne = *((InteropBool *)&one); InteropBool interopTwoFiveFive = *((InteropBool *)&twoFiveFive); InteropBool interopTwo = *((InteropBool *)&two); // Execute // Assert outcome Assert.IsFalse(interopZero); Assert.IsTrue(interopOne); Assert.IsTrue(interopTwoFiveFive); Assert.IsTrue(interopTwo); }
public void ShouldRepresentBoolConsistently() { // Define variables and constants InteropBool @true = true; InteropBool @false = false; // Set up context // Execute // Assert outcome Assert.IsTrue(@true); Assert.IsFalse(@false); Assert.IsTrue(@true == true); Assert.IsTrue(@false == false); Assert.IsFalse(@true != true); Assert.IsFalse(@false != false); Assert.IsFalse(@true == @false); Assert.IsFalse(@false == @true); Assert.IsTrue(@true != @false); Assert.IsTrue(@false != @true); }
public static extern InteropBool DeviceFactory_SetVSyncEnabled( IntPtr failReason, InteropBool vsyncEnabled );
public static extern InteropBool WindowFactory_SetCursorVisibility( IntPtr failReason, WindowHandle windowHandle, InteropBool visibilityState );