Ejemplo n.º 1
0
        public static Result D3D11CreateDevice(IntPtr adapterPtr, DriverType driverType, DeviceCreationFlags flags, FeatureLevel[] featureLevels,
                                               out ID3D11Device device, out FeatureLevel featureLevel, out ID3D11DeviceContext immediateContext)
        {
            Result result = D3D11CreateDevice(adapterPtr, driverType, IntPtr.Zero,
                                              (int)flags,
                                              featureLevels,
                                              (featureLevels != null) ? featureLevels.Length : 0,
                                              SdkVersion,
                                              out device,
                                              out featureLevel,
                                              out immediateContext);

            if (result.Failure)
            {
                return(result);
            }

            if (immediateContext != null)
            {
                device.AddRef();
                device.ImmediateContext__ = immediateContext;
                immediateContext.Device__ = device;
            }

            return(result);
        }
Ejemplo n.º 2
0
        public static unsafe Result D3D11On12CreateDevice(
            IUnknown d3d12Device,
            DeviceCreationFlags flags,
            FeatureLevel[] featureLevels,
            IUnknown[] commandQueues,
            int nodeMask,
            out ID3D11Device device,
            out ID3D11DeviceContext immediateContext,
            out FeatureLevel chosenFeatureLevel)
        {
            Result result = D3D11On12CreateDevice(d3d12Device,
                                                  flags,
                                                  featureLevels, featureLevels.Length,
                                                  commandQueues, commandQueues.Length,
                                                  nodeMask,
                                                  out device, out immediateContext, out chosenFeatureLevel);

            if (result.Failure)
            {
                return(result);
            }

            if (immediateContext != null)
            {
                device.AddRef();
                device.ImmediateContext__ = immediateContext;
                immediateContext.Device__ = device;
            }

            return(result);
        }