private GpuResource AllocateCommitted(GpuResourceDesc desc, D3D12_RESOURCE_ALLOCATION_INFO allocInfo) { using var device = _device.Copy(); var heapProperties = GetHeapProperties(desc); var clearVal = desc.ClearValue.GetValueOrDefault(); using ComPtr <ID3D12Resource> resource = default; Guard.ThrowIfFailed(device.Get()->CreateCommittedResource( &heapProperties, desc.HeapFlags, &desc.ResourceFormat.D3D12ResourceDesc, desc.InitialState, desc.ClearValue is null ? null : &clearVal, resource.Guid, ComPtr.GetVoidAddressOf(&resource) )); return(new GpuResource( resource.Move(), desc, allocInfo.SizeInBytes, 0,
/// <summary> /// Creates a new <see cref="WICHelper"/> instance. /// </summary> private WICHelper() { using ComPtr <IWICImagingFactory2> wicImagingFactory2 = default; Windows.CoCreateInstance( (Guid *)Unsafe.AsPointer(ref Unsafe.AsRef(in CLSID.CLSID_WICImagingFactory2)), null, (uint)CLSCTX.CLSCTX_INPROC_SERVER, Windows.__uuidof <IWICImagingFactory2>(), wicImagingFactory2.GetVoidAddressOf()).Assert(); this.wicImagingFactory2 = wicImagingFactory2.Move(); }
protected override ComPtr <ID3D12CommandAllocator> Create(ExecutionContext state) { using ComPtr <ID3D12CommandAllocator> allocator = default; Guard.ThrowIfFailed(_device.Get()->CreateCommandAllocator( (D3D12_COMMAND_LIST_TYPE)state, allocator.Guid, ComPtr.GetVoidAddressOf(&allocator) )); DirectXHelpers.SetObjectName(allocator.Get(), $"Pooled allocator #{_allocatorCount++}"); return(allocator.Move()); }
public static int Initialize(PixelShaderEffect * @this, ID2D1EffectContext *effectContext, ID2D1TransformGraph *transformGraph) { int hresult = effectContext->LoadPixelShader( shaderId: &@this->shaderId, shaderBuffer: @this->bytecode, shaderBufferCount: (uint)@this->bytecodeSize); // If E_INVALIDARG was returned, try to check whether double precision support was requested when not available. This // is only done to provide a more helpful error message to callers. If no error was returned, the behavior is the same. if (hresult == E.E_INVALIDARG) { D2D1_FEATURE_DATA_DOUBLES d2D1FeatureDataDoubles = default; // If the call failed, just do nothing and return the previous result if (!Windows.SUCCEEDED(effectContext->CheckFeatureSupport(D2D1_FEATURE.D2D1_FEATURE_DOUBLES, &d2D1FeatureDataDoubles, (uint)sizeof(D2D1_FEATURE_DATA_DOUBLES)))) { return(E.E_INVALIDARG); } // If the context does not support double precision values, check whether the shader requested them if (d2D1FeatureDataDoubles.doublePrecisionFloatShaderOps == 0) { using ComPtr <ID3D11ShaderReflection> d3D11ShaderReflection = default; // Create the reflection instance, and in case of error just return the previous error like above if (!Windows.SUCCEEDED(DirectX.D3DReflect( pSrcData: @this->bytecode, SrcDataSize: (uint)@this->bytecodeSize, pInterface: Windows.__uuidof <ID3D11ShaderReflection>(), ppReflector: d3D11ShaderReflection.GetVoidAddressOf()))) { return(E.E_INVALIDARG); } // If the shader requires double precision support, return a more descriptive error if ((d3D11ShaderReflection.Get()->GetRequiresFlags() & (D3D.D3D_SHADER_REQUIRES_DOUBLES | D3D.D3D_SHADER_REQUIRES_11_1_DOUBLE_EXTENSIONS)) != 0) { return(D2DERR.D2DERR_INSUFFICIENT_DEVICE_CAPABILITIES); } } } if (Windows.SUCCEEDED(hresult)) { hresult = transformGraph->SetSingleTransformNode((ID2D1TransformNode *)&@this->lpVtblForID2D1DrawTransform); } return(hresult); }
/// <summary> /// Creates a new <see cref="RootSignature"/> /// </summary> /// <param name="device">The <see cref="ID3D12Device"/> used to create the root signature</param> /// <param name="rootParameters">The <see cref="RootParameter"/>s in the signature</param> /// <param name="staticSamplers">The <see cref="StaticSampler"/>s in the signature</param> /// <returns>A new <see cref="RootSignature"/></returns> public static RootSignature Create(ID3D12Device *device, ReadOnlyMemory <RootParameter> rootParameters, ReadOnlyMemory <StaticSampler> staticSamplers) { using var rootParams = RentedArray <D3D12_ROOT_PARAMETER> .Create(rootParameters.Length); using var samplers = RentedArray <D3D12_STATIC_SAMPLER_DESC> .Create(staticSamplers.Length); TranslateStaticSamplers(staticSamplers, samplers.Value); fixed(D3D12_ROOT_PARAMETER *pRootParams = rootParams.Value) fixed(D3D12_STATIC_SAMPLER_DESC * pSamplerDesc = samplers.Value) { var desc = new D3D12_ROOT_SIGNATURE_DESC { NumParameters = (uint)rootParams.Value.Length, pParameters = pRootParams, NumStaticSamplers = (uint)samplers.Value.Length, pStaticSamplers = pSamplerDesc, Flags = D3D12_ROOT_SIGNATURE_FLAGS.D3D12_ROOT_SIGNATURE_FLAG_ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT // TODO provide finer grained control }; ID3DBlob *pBlob = default; ID3DBlob *pError = default; int hr = Windows.D3D12SerializeRootSignature( &desc, D3D_ROOT_SIGNATURE_VERSION.D3D_ROOT_SIGNATURE_VERSION_1, &pBlob, &pError ); if (Windows.FAILED(hr)) { ThrowHelper.ErrorWithBlob(hr, pError); } using ComPtr <ID3D12RootSignature> rootSig = default; Guard.ThrowIfFailed(device->CreateRootSignature( 0 /* TODO: MULTI-GPU */, pBlob->GetBufferPointer(), pBlob->GetBufferSize(), rootSig.Guid, ComPtr.GetVoidAddressOf(&rootSig) )); return(new RootSignature(rootSig.Move(), rootParameters, staticSamplers)); } }
protected override ComPtr <ID3D12GraphicsCommandList> Create(ListCreationParams state) { using ComPtr <ID3D12GraphicsCommandList> list = default; Guard.ThrowIfFailed(_device.Get()->CreateCommandList( 0, // TODO: MULTI-GPU state.Type, state.Allocator, state.Pso, list.Guid, ComPtr.GetVoidAddressOf(&list) )); DirectXHelpers.SetObjectName(list.Get(), $"Pooled list #{_listCount++}"); // 'ManageRent' expects closed list Guard.ThrowIfFailed(list.Get()->Close()); return(list.Move()); }
private AllocatorHeap CreateNewHeap(GpuMemoryType type) { D3D12_HEAP_PROPERTIES props = new((D3D12_HEAP_TYPE)type); D3D12_HEAP_DESC desc = new(InitialHeapSize, props); ComPtr <ID3D12Heap> heap = default; _device.Get()->CreateHeap(&desc, heap.Guid, ComPtr.GetVoidAddressOf(&heap)); var allocatorHeap = new AllocatorHeap { Heap = heap.Move(), FreeBlocks = new() }; allocatorHeap.FreeBlocks.Add(new HeapBlock { Offset = 0, Size = desc.SizeInBytes }); _heaps[type].Add(allocatorHeap); return(allocatorHeap); }
/// <summary> /// Creates a new <see cref="ID3D12InfoQueue"/> for a given device. /// </summary> /// <param name="d3D12Device">The target <see cref="ID3D12Device"/> to use to create the info queue.</param> /// <returns>A pointer to the newly created <see cref="ID3D12InfoQueue"/> instance.</returns> /// <exception cref="Exception">Thrown when the creation of the info queue fails.</exception> public static ComPtr <ID3D12InfoQueue> CreateInfoQueue(this ref ID3D12Device d3D12Device) { ComPtr <ID3D12InfoQueue> d3D12InfoQueue = default; d3D12Device.QueryInterface(FX.__uuidof <ID3D12InfoQueue>(), d3D12InfoQueue.GetVoidAddressOf()).Assert(); D3D12_MESSAGE_ID *d3D12MessageIds = stackalloc D3D12_MESSAGE_ID[3] { D3D12_MESSAGE_ID_CREATEDEVICE_DEBUG_LAYER_STARTUP_OPTIONS, D3D12_MESSAGE_ID_MAP_INVALID_NULLRANGE, D3D12_MESSAGE_ID_UNMAP_INVALID_NULLRANGE }; D3D12_INFO_QUEUE_FILTER d3D12InfoQueueFilter = default; d3D12InfoQueueFilter.DenyList.NumIDs = 3; d3D12InfoQueueFilter.DenyList.pIDList = d3D12MessageIds; d3D12InfoQueue.Get()->PushRetrievalFilter(&d3D12InfoQueueFilter).Assert(); return(d3D12InfoQueue.Move()); }
/// <summary> /// Creates a new <see cref="ShaderCompiler"/> instance. /// </summary> private ShaderCompiler() { using ComPtr <IDxcCompiler> dxcCompiler = default; using ComPtr <IDxcLibrary> dxcLibrary = default; using ComPtr <IDxcIncludeHandler> dxcIncludeHandler = default; DirectX.DxcCreateInstance( (Guid *)Unsafe.AsPointer(ref Unsafe.AsRef(in CLSID.CLSID_DxcCompiler)), Windows.__uuidof <IDxcCompiler>(), dxcCompiler.GetVoidAddressOf()).Assert(); DirectX.DxcCreateInstance( (Guid *)Unsafe.AsPointer(ref Unsafe.AsRef(in CLSID.CLSID_DxcLibrary)), Windows.__uuidof <IDxcLibrary>(), dxcLibrary.GetVoidAddressOf()).Assert(); dxcLibrary.Get()->CreateIncludeHandler(dxcIncludeHandler.GetAddressOf()).Assert(); DxcCompiler = dxcCompiler.Move(); DxcLibrary = dxcLibrary.Move(); DxcIncludeHandler = dxcIncludeHandler.Move(); }
/// <summary> /// Creates a new <see cref="ShaderCompiler"/> instance. /// </summary> private ShaderCompiler() { lock (this) { InitializeDxcLibrariesLoading(); } using ComPtr <IDxcCompiler> dxcCompiler = default; using ComPtr <IDxcLibrary> dxcLibrary = default; using ComPtr <IDxcIncludeHandler> dxcIncludeHandler = default; Guid dxcCompilerCLGuid = FX.CLSID_DxcCompiler; Guid dxcLibraryCLGuid = FX.CLSID_DxcLibrary; FX.DxcCreateInstance(&dxcCompilerCLGuid, FX.__uuidof <IDxcCompiler>(), dxcCompiler.GetVoidAddressOf()).Assert(); FX.DxcCreateInstance(&dxcLibraryCLGuid, FX.__uuidof <IDxcLibrary>(), dxcLibrary.GetVoidAddressOf()).Assert(); dxcLibrary.Get()->CreateIncludeHandler(dxcIncludeHandler.GetAddressOf()).Assert(); DxcCompiler = dxcCompiler.Move(); DxcLibrary = dxcLibrary.Move(); DxcIncludeHandler = dxcIncludeHandler.Move(); }
/// <summary> /// Tries to check or create a warp <see cref="ID3D12Device"/> object. /// </summary> /// <param name="d3D12Device">A pointer to the <see cref="ID3D12Device"/> object to create, or <see langword="null"/>.</param> /// <param name="dxgiAdapter">A pointer to the <see cref="IDXGIAdapter"/> object used to create <paramref name="d3D12Device"/>, or <see langword="null"/>.</param> /// <param name="dxgiDescription1">A pointer to the <see cref="DXGI_ADAPTER_DESC1"/> value for the device found.</param> /// <returns>Whether a warp device was created successfully.</returns> private static unsafe bool TryGetWarpDevice(ID3D12Device **d3D12Device, IDXGIAdapter **dxgiAdapter, DXGI_ADAPTER_DESC1 *dxgiDescription1) { using ComPtr <IDXGIFactory4> dxgiFactory4 = default; EnableDebugMode(); FX.CreateDXGIFactory2(IDXGIFactoryCreationFlags, FX.__uuidof <IDXGIFactory4>(), dxgiFactory4.GetVoidAddressOf()).Assert(); using ComPtr <IDXGIAdapter1> dxgiAdapter1 = default; dxgiFactory4.Get()->EnumWarpAdapter(FX.__uuidof <IDXGIAdapter1>(), dxgiAdapter1.GetVoidAddressOf()).Assert(); dxgiAdapter1.Get()->GetDesc1(dxgiDescription1).Assert(); HRESULT createDeviceResult = FX.D3D12CreateDevice( dxgiAdapter1.AsIUnknown().Get(), D3D_FEATURE_LEVEL_11_0, FX.__uuidof <ID3D12Device>(), (void **)d3D12Device); dxgiAdapter1.CopyTo(dxgiAdapter); return(FX.SUCCEEDED(createDeviceResult)); }
/// <inheritdoc/> public bool MoveNext() { if (!this.isInitialized) { this.isInitialized = true; fixed(IDXGIFactory6 **dxgiFactory6 = this.dxgiFactory6) { CreateDXGIFactory6(dxgiFactory6); } } if (this.isCompleted) { return(false); } while (true) { using ComPtr <IDXGIAdapter1> dxgiAdapter1 = default; HRESULT enumAdapters1Result = this.dxgiFactory6.Get()->EnumAdapterByGpuPreference( this.index, DXGI_GPU_PREFERENCE_HIGH_PERFORMANCE, Windows.__uuidof <IDXGIAdapter1>(), dxgiAdapter1.GetVoidAddressOf()); if (enumAdapters1Result == DXGI.DXGI_ERROR_NOT_FOUND) { this.dxgiFactory6.Get()->EnumWarpAdapter(Windows.__uuidof <IDXGIAdapter1>(), dxgiAdapter1.GetVoidAddressOf()).Assert(); DXGI_ADAPTER_DESC1 dxgiDescription1; dxgiAdapter1.Get()->GetDesc1(&dxgiDescription1).Assert(); HRESULT createDeviceResult = DirectX.D3D12CreateDevice( dxgiAdapter1.AsIUnknown().Get(), D3D_FEATURE_LEVEL_11_0, Windows.__uuidof <ID3D12Device>(), null); if (Windows.SUCCEEDED(createDeviceResult) && this.predicate?.Invoke(new GraphicsDeviceInfo(&dxgiDescription1)) != false) { using ComPtr <ID3D12Device> d3D12Device = default; DirectX.D3D12CreateDevice( dxgiAdapter1.AsIUnknown().Get(), D3D_FEATURE_LEVEL_11_0, Windows.__uuidof <ID3D12Device>(), d3D12Device.GetVoidAddressOf()).Assert(); this.graphicsDevice = GetOrCreateDevice(d3D12Device.Get(), (IDXGIAdapter *)dxgiAdapter1.Get(), &dxgiDescription1); this.isCompleted = true; return(true); } return(false); } else { enumAdapters1Result.Assert(); this.index++; DXGI_ADAPTER_DESC1 dxgiDescription1; dxgiAdapter1.Get()->GetDesc1(&dxgiDescription1).Assert(); if (dxgiDescription1.VendorId == MicrosoftVendorId && dxgiDescription1.DeviceId == WarpDeviceId) { continue; } HRESULT createDeviceResult = DirectX.D3D12CreateDevice( dxgiAdapter1.AsIUnknown().Get(), D3D_FEATURE_LEVEL_11_0, Windows.__uuidof <ID3D12Device>(), null); if (Windows.SUCCEEDED(createDeviceResult) && this.predicate?.Invoke(new GraphicsDeviceInfo(&dxgiDescription1)) != false) { using ComPtr <ID3D12Device> d3D12Device = default; DirectX.D3D12CreateDevice( dxgiAdapter1.AsIUnknown().Get(), D3D_FEATURE_LEVEL_11_0, Windows.__uuidof <ID3D12Device>(), d3D12Device.GetVoidAddressOf()).Assert(); if (d3D12Device.Get()->IsShaderModelSupported(D3D_SHADER_MODEL_6_0)) { this.graphicsDevice = GetOrCreateDevice(d3D12Device.Get(), (IDXGIAdapter *)dxgiAdapter1.Get(), &dxgiDescription1); return(true); } } } } }
/// <summary> /// Tries to check or create a default <see cref="ID3D12Device"/> object. /// </summary> /// <param name="d3D12Device">A pointer to the <see cref="ID3D12Device"/> object to create, or <see langword="null"/>.</param> /// <param name="dxgiAdapter">A pointer to the <see cref="IDXGIAdapter"/> object used to create <paramref name="d3D12Device"/>, or <see langword="null"/>.</param> /// <param name="dxgiDescription1">A pointer to the <see cref="DXGI_ADAPTER_DESC1"/> value for the device found.</param> /// <returns>Whether a default device was found with the requested feature level.</returns> private static unsafe bool TryGetDefaultDevice(ID3D12Device **d3D12Device, IDXGIAdapter **dxgiAdapter, DXGI_ADAPTER_DESC1 *dxgiDescription1) { using ComPtr <IDXGIFactory4> dxgiFactory4 = default; EnableDebugMode(); FX.CreateDXGIFactory2(IDXGIFactoryCreationFlags, FX.__uuidof <IDXGIFactory4>(), dxgiFactory4.GetVoidAddressOf()).Assert(); uint i = 0; while (true) { using ComPtr <IDXGIAdapter1> dxgiAdapter1 = default; HRESULT enumAdapters1Result = dxgiFactory4.Get()->EnumAdapters1(i++, dxgiAdapter1.GetAddressOf()); if (enumAdapters1Result == FX.DXGI_ERROR_NOT_FOUND) { return(false); } enumAdapters1Result.Assert(); dxgiAdapter1.Get()->GetDesc1(dxgiDescription1).Assert(); if (dxgiDescription1->VendorId == MicrosoftVendorId && dxgiDescription1->DeviceId == WarpDeviceId) { continue; } // Explicit paths for when a device is being retrieved or not, with special handling // for the additional check that is required for the SM6 level. This can't be checked // without creating a device first, so the path for when the target device pointer is // null is useful to do an initial filtering using D3D12CreateDevice to avoid creating // a device for adapters that would've failed at the FL11 check already. if (d3D12Device == null) { HRESULT createDeviceResult = FX.D3D12CreateDevice( dxgiAdapter1.AsIUnknown().Get(), D3D_FEATURE_LEVEL_11_0, FX.__uuidof <ID3D12Device>(), null); if (FX.SUCCEEDED(createDeviceResult)) { using ComPtr <ID3D12Device> d3D12DeviceCandidate = default; createDeviceResult = FX.D3D12CreateDevice( dxgiAdapter1.AsIUnknown().Get(), D3D_FEATURE_LEVEL_11_0, FX.__uuidof <ID3D12Device>(), d3D12DeviceCandidate.GetVoidAddressOf()); if (FX.SUCCEEDED(createDeviceResult) && d3D12DeviceCandidate.Get()->IsShaderModelSupported(D3D_SHADER_MODEL_6_0)) { return(true); } } } else { using ComPtr <ID3D12Device> d3D12DeviceCandidate = default; HRESULT createDeviceResult = FX.D3D12CreateDevice( dxgiAdapter1.AsIUnknown().Get(), D3D_FEATURE_LEVEL_11_0, FX.__uuidof <ID3D12Device>(), d3D12DeviceCandidate.GetVoidAddressOf()); if (FX.SUCCEEDED(createDeviceResult) && d3D12DeviceCandidate.Get()->IsShaderModelSupported(D3D_SHADER_MODEL_6_0)) { d3D12DeviceCandidate.CopyTo(d3D12Device); dxgiAdapter1.CopyTo(dxgiAdapter); return(true); } } } }
/// <inheritdoc/> public bool MoveNext() { if (!this.isInitialized) { this.isInitialized = true; fixed(IDXGIFactory4 **dxgiFactory4 = this.dxgiFactory4) { EnableDebugMode(); FX.CreateDXGIFactory2(IDXGIFactoryCreationFlags, FX.__uuidof <IDXGIFactory4>(), (void **)dxgiFactory4).Assert(); } } if (this.isCompleted) { return(false); } while (true) { using ComPtr <IDXGIAdapter1> dxgiAdapter1 = default; HRESULT enumAdapters1Result = this.dxgiFactory4.Get()->EnumAdapters1(this.index, dxgiAdapter1.GetAddressOf()); if (enumAdapters1Result == FX.DXGI_ERROR_NOT_FOUND) { this.dxgiFactory4.Get()->EnumWarpAdapter(FX.__uuidof <IDXGIAdapter1>(), dxgiAdapter1.GetVoidAddressOf()).Assert(); DXGI_ADAPTER_DESC1 dxgiDescription1; dxgiAdapter1.Get()->GetDesc1(&dxgiDescription1).Assert(); HRESULT createDeviceResult = FX.D3D12CreateDevice( dxgiAdapter1.AsIUnknown().Get(), D3D_FEATURE_LEVEL_11_0, FX.__uuidof <ID3D12Device>(), null); if (FX.SUCCEEDED(createDeviceResult) && this.predicate(new GraphicsDeviceInfo(&dxgiDescription1))) { using ComPtr <ID3D12Device> d3D12Device = default; FX.D3D12CreateDevice( dxgiAdapter1.AsIUnknown().Get(), D3D_FEATURE_LEVEL_11_0, FX.__uuidof <ID3D12Device>(), d3D12Device.GetVoidAddressOf()).Assert(); this.graphicsDevice = GetOrCreateDevice(d3D12Device.Get(), (IDXGIAdapter *)dxgiAdapter1.Get(), &dxgiDescription1); this.isCompleted = true; return(true); } return(false); } else { enumAdapters1Result.Assert(); this.index++; DXGI_ADAPTER_DESC1 dxgiDescription1; dxgiAdapter1.Get()->GetDesc1(&dxgiDescription1).Assert(); if (dxgiDescription1.VendorId == MicrosoftVendorId && dxgiDescription1.DeviceId == WarpDeviceId) { continue; } HRESULT createDeviceResult = FX.D3D12CreateDevice( dxgiAdapter1.AsIUnknown().Get(), D3D_FEATURE_LEVEL_11_0, FX.__uuidof <ID3D12Device>(), null); if (FX.SUCCEEDED(createDeviceResult) && this.predicate(new GraphicsDeviceInfo(&dxgiDescription1))) { using ComPtr <ID3D12Device> d3D12Device = default; FX.D3D12CreateDevice( dxgiAdapter1.AsIUnknown().Get(), D3D_FEATURE_LEVEL_11_0, FX.__uuidof <ID3D12Device>(), d3D12Device.GetVoidAddressOf()).Assert(); if (d3D12Device.Get()->IsShaderModelSupported(D3D_SHADER_MODEL_6_0)) { this.graphicsDevice = GetOrCreateDevice(d3D12Device.Get(), (IDXGIAdapter *)dxgiAdapter1.Get(), &dxgiDescription1); return(true); } } } } }
/// <summary> /// Gets the shader info associated with a given D2D1 shader. /// </summary> /// <typeparam name="T">The type of D2D1 shader to retrieve info for.</typeparam> /// <returns>The resulting <see cref="D2D1ShaderInfo"/> instance.</returns> public static unsafe D2D1ShaderInfo GetShaderInfo <T>() where T : struct, ID2D1PixelShader { Unsafe.SkipInit(out T shader); shader.BuildHlslSource(out string hlslSource); D2D1ShaderBytecodeLoader bytecodeLoader = default; shader.LoadBytecode(ref bytecodeLoader, D2D1ShaderProfile.PixelShader50); using ComPtr <ID3DBlob> dynamicBytecode = bytecodeLoader.GetResultingShaderBytecode(out ReadOnlySpan <byte> precompiledBytecode); byte *bytecodePtr; int bytecodeSize; if (!precompiledBytecode.IsEmpty) { bytecodePtr = (byte *)Unsafe.AsPointer(ref MemoryMarshal.GetReference(precompiledBytecode)); bytecodeSize = precompiledBytecode.Length; } else { bytecodePtr = (byte *)dynamicBytecode.Get()->GetBufferPointer(); bytecodeSize = (int)dynamicBytecode.Get()->GetBufferSize(); } using ComPtr <ID3D11ShaderReflection> d3D11ShaderReflection = default; DirectX.D3DReflect( pSrcData: bytecodePtr, SrcDataSize: (nuint)bytecodeSize, pInterface: Windows.__uuidof <ID3D11ShaderReflection>(), ppReflector: d3D11ShaderReflection.GetVoidAddressOf()).Assert(); D3D11_SHADER_DESC d3D11ShaderDescription; d3D11ShaderReflection.Get()->GetDesc(&d3D11ShaderDescription).Assert(); return(new( CompilerVersion : new string(d3D11ShaderDescription.Creator), HlslSource : hlslSource, ConstantBufferCount : d3D11ShaderDescription.ConstantBuffers, BoundResourceCount : d3D11ShaderDescription.BoundResources, InstructionCount : d3D11ShaderDescription.InstructionCount, TemporaryRegisterCount : d3D11ShaderDescription.TempRegisterCount, TemporaryArrayCount : d3D11ShaderDescription.TempArrayCount, ConstantDefineCount : d3D11ShaderDescription.DefCount, DeclarationCount : d3D11ShaderDescription.DclCount, TextureNormalInstructions : d3D11ShaderDescription.TextureNormalInstructions, TextureLoadInstructionCount : d3D11ShaderDescription.TextureLoadInstructions, TextureStoreInstructionCount : d3D11ShaderDescription.cTextureStoreInstructions, FloatInstructionCount : d3D11ShaderDescription.FloatInstructionCount, IntInstructionCount : d3D11ShaderDescription.IntInstructionCount, UIntInstructionCount : d3D11ShaderDescription.UintInstructionCount, StaticFlowControlInstructionCount : d3D11ShaderDescription.StaticFlowControlCount, DynamicFlowControlInstructionCount : d3D11ShaderDescription.DynamicFlowControlCount, EmitInstructionCount : d3D11ShaderDescription.EmitInstructionCount, BarrierInstructionCount : d3D11ShaderDescription.cBarrierInstructions, InterlockedInstructionCount : d3D11ShaderDescription.cInterlockedInstructions, BitwiseInstructionCount : d3D11ShaderReflection.Get()->GetBitwiseInstructionCount(), MovcInstructionCount : d3D11ShaderReflection.Get()->GetMovcInstructionCount(), MovInstructionCount : d3D11ShaderReflection.Get()->GetMovInstructionCount(), InterfaceSlotCount : d3D11ShaderReflection.Get()->GetNumInterfaceSlots(), RequiresDoublePrecisionSupport : (d3D11ShaderReflection.Get()->GetRequiresFlags() & (D3D.D3D_SHADER_REQUIRES_DOUBLES | D3D.D3D_SHADER_REQUIRES_11_1_DOUBLE_EXTENSIONS)) != 0)); }