Skip to content

Instantly share code, notes, and snippets.

View mellinoe's full-sized avatar

Eric Mellino mellinoe

View GitHub Profile
@mellinoe
mellinoe / complete-imgui-example.cs
Created May 12, 2019 18:40
A complete example using Veldrid.ImGui
using ImGuiNET;
using Veldrid;
using Veldrid.StartupUtilities;
class Program
{
static void Main(string[] args)
{
VeldridStartup.CreateWindowAndGraphicsDevice(
new WindowCreateInfo(100, 100, 1280, 720, Veldrid.WindowState.Normal, "ImGui Example"),
@mellinoe
mellinoe / VeldridComponent.cs
Last active December 2, 2022 20:34
Example code for embedding a Veldrid Swapchain into WPF
using System;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Windows;
using System.Windows.Media;
namespace Veldrid.WPF
{
// This extends from the "Win32HwndControl" from the SharpDX example code.
public class VeldridComponent : Win32HwndControl
using System;
using System.Collections.Generic;
class Program
{
private static readonly Dictionary<int, Func<int, int>> _funcs = new Dictionary<int, Func<int, int>>();
static void Main(string[] args)
{
for (int iter = 0; iter < 1000000; iter++)
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2013/01/nuspec.xsd">
<metadata minClientVersion="2.12">
<id>Microsoft.NETFramework.Compatibility</id>
<version>2.1.0-preview1-25713-0</version>
<title>Microsoft.NETFramework.Compatibility</title>
<authors>Microsoft</authors>
<owners>microsoft,dotnetframework</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<licenseUrl>https://github.com/dotnet/corefx/blob/master/LICENSE.TXT</licenseUrl>
@mellinoe
mellinoe / clrstacks
Created June 22, 2017 21:46
clrstack -f on all managed threads of the System.Net.HttpListener test hang.
(lldb) clrstack -f
OS Thread Id: 0xa9068 (1)
Child SP IP Call Site
00007FFF5D4ADAA8 00007FFF90D4CC86 libsystem_kernel.dylib!__psynch_cvwait + 10
00007FFF5D4ADAB0 00007FFF90E3696A libsystem_pthread.dylib!_pthread_cond_wait + 712
00007FFF5D4ADB50 0000000102A1BB62 libcoreclr.dylib!CorUnix::CPalSynchronizationManager::ThreadNativeWait(CorUnix::_ThreadNativeWaitData*, unsigned int, CorUnix::ThreadWakeupReason*, unsigned int*) + 338
00007FFF5D4ADBB0 0000000102A1B788 libcoreclr.dylib!CorUnix::CPalSynchronizationManager::BlockThread(CorUnix::CPalThread*, unsigned int, bool, bool, CorUnix::ThreadWakeupReason*, unsigned int*) + 440
00007FFF5D4ADC10 0000000102A206A9 libcoreclr.dylib!CorUnix::InternalWaitForMultipleObjectsEx(CorUnix::CPalThread*, unsigned int, void* const*, int, unsigned int, int) + 1833
00007FFF5D4ADDA0 0000000102BA2B05 libcoreclr.dylib!Thread::DoAppropriateWaitWorker(int, void**, int, unsigned int, WaitMode) + 1957
00007FFF5D4ADE80 0000000102B9D680 libcoreclr.dylib!Thread::DoAppro
using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using ImGuiNET;
@mellinoe
mellinoe / AcosTests.cs
Created March 7, 2017 01:38
Simple test program showing differences in actual and expected behavior in the .NET implementation of Complex.Acos.
using System;
using System.Numerics;
using static System.Numerics.Complex;
namespace ConsoleApp
{
public class Program
{
// This is the largest x for which 2 x^2 will not overflow. It is used for branching inside Asin and Acos.
private static readonly double s_asinOverflowThreshold = Math.Sqrt(double.MaxValue) / 2.0;
public override void DrawIndexedPrimitives(int count, int startingIndex, int startingVertex)
{
_deviceContext.DrawIndexed(count, startingIndex, startingVertex);
}
public override void DrawIndexedPrimitives(int count, int startingIndex)
{
PreDrawCommand();
DrawElementsType elementsType = ((OpenGLIndexBuffer)IndexBuffer).ElementsType;
int indexSize = OpenGLFormats.GetIndexFormatSize(elementsType);
GL.DrawElements(_primitiveType, count, elementsType, new IntPtr(startingIndex * indexSize));
}
rc.DrawIndexedPrimitives(Cube.Indices.Length); // Draw the cube.