Skip to content

Instantly share code, notes, and snippets.

View jdryg's full-sized avatar

Jim Drygiannakis jdryg

View GitHub Profile
@jdryg
jdryg / logic3.h
Last active April 21, 2019 09:07
3-valued logic functions
// 3-valued logic functions based on the encoding described in
// "Boolean Analysis of MOS Circuits"
// http://www.cs.cmu.edu/~bryant/pubdir/tcad87b.pdf
//
// Each of the 3 states, 0, 1 and X is encoded using 2 bits
// 0 => 01
// 1 => 10
// X => 11
//
// with 00 indicating an invalid state (used for uninitialized signals).
@jdryg
jdryg / testbench.lua
Created January 12, 2019 17:54
Graphics on a character LCD
local COLS = 20;
local ROWS = 4;
local CHAR_WIDTH = 5;
local CHAR_HEIGHT = 8;
local WAIT_ANIM = 0;
function wait(n)
for i=1,n do
simulate();
@jdryg
jdryg / cullrects_benchmark.cpp
Created April 20, 2018 16:55
cullRects SIMD benchmark
#define TEST_SIMD 3
struct Rect
{
float minx, miny;
float maxx, maxy;
};
struct RectSoA
{
@jdryg
jdryg / benchmark.cpp
Last active April 2, 2018 07:25
strokerConvexFillAA (benchmark)
#include <stdint.h>
#include <inttypes.h>
#include <math.h>
#include <malloc.h>
#include <memory.h>
#include <Windows.h>
#include <stdio.h>
#include <xmmintrin.h>
#include <immintrin.h>
@jdryg
jdryg / color_circle.cpp
Created February 24, 2018 16:55
Color circle
static float colorCirclePos[512];
static vg::Color colorCircleColor[256];
static uint16_t colorCircleIndices[765];
static bool colorCircleReady = false;
if (!colorCircleReady) {
// Center of the circle
colorCirclePos[0] = 0.0f;
colorCirclePos[1] = 0.0f;
colorCircleColor[0] = vg::ColorRGBA::White;
@jdryg
jdryg / imgui_keyboard_input.inl
Last active August 19, 2017 14:00
ImGui KeyboardInput() widget
namespace ImGui
{
bool KeyboardInput(const char* label, char* buf, unsigned int buf_size, const ImVec2& size_arg, bool is_editable)
{
ImGuiWindow* window = GetCurrentWindow();
if (window->SkipItems) {
return false;
}
ImGuiContext& g = *GImGui;
@jdryg
jdryg / link.lds
Created August 17, 2017 12:17
Linker script problem
@jdryg
jdryg / instructions.md
Last active April 2, 2024 09:25
Cross-compile RISC-V toolchain on Ubuntu with MinGW
@jdryg
jdryg / bios.asm
Created January 31, 2017 18:12
Tiny BIOS for an i8080 system
.ORG 0x0000
LF EQU 0x0A
CR EQU 0x0D
EOS EQU 0x24; '$'
STACK EQU 0x80FF
TERMINAL EQU 0xF000
CARET_ADDR EQU 0xEFFE
JMP boot ;
NOP ;
@jdryg
jdryg / _instructions.md
Last active August 14, 2018 17:15
bgfx shader custom MSBuild rule for VS2013

Installation

  1. Download all 3 files and place them at the same folder as your VS solution
  2. Build shaderc and move the executable to the same folder. If you get the original executable from the build directory, remember to rename it to shaderc.exe instead of shadercRelease.exe
  3. Open your solution into VS, right click on the project and select Build Dependencies > Build Customizations...
  4. Click Find existing... and select the bgfxshader.targets file you just created
  5. Add .sc files to your project and they should be treated as bgfx shaders

To verify that the new target works correctly you can right click on an .sc file and select Properties. Item Type property should read "bgfx Shader"