/// <summary> /// Embeds the bytecode for an exported shader as private data into another shader bytecode. /// </summary> /// <param name="shaderBlob">The bytecode produced by <see cref="CompileD2DFullShader(ReadOnlySpan{char}, D2D1ShaderProfile)"/>.</param> /// <param name="exportBlob">The bytecode produced by <see cref="CompileD2DFunction(ReadOnlySpan{char}, D2D1ShaderProfile)"/>.</param> /// <returns>An <see cref="ID3DBlob"/> instance with the combined data of <paramref name="shaderBlob"/> and <paramref name="exportBlob"/>.</returns> private static ComPtr <ID3DBlob> EmbedD2DFunctionPrivateData(ID3DBlob *shaderBlob, ID3DBlob *exportBlob) { void *shaderPtr = shaderBlob->GetBufferPointer(); nuint shaderSize = shaderBlob->GetBufferSize(); void *exportPtr = exportBlob->GetBufferPointer(); nuint exportSize = exportBlob->GetBufferSize(); using ComPtr <ID3DBlob> resultBlob = default; DirectX.D3DSetBlobPart( pSrcData: shaderPtr, SrcDataSize: shaderSize, Part: D3D_BLOB_PART.D3D_BLOB_PRIVATE_DATA, Flags: 0, pPart: exportPtr, PartSize: exportSize, ppNewShader: resultBlob.GetAddressOf()).Assert(); return(resultBlob.Move()); }