Skip to content

Instantly share code, notes, and snippets.

@fromasmtodisasm
fromasmtodisasm / gfxpipe.h
Created November 21, 2020 19:14 — forked from onatto/gfxpipe.h
C99 DSL for filling in VkGraphicsPipelineCreateInfo
//--- usage ------------------------------------------------//
void usage() {
VertexBindings(vbindings) = {
{ .binding = 0, .stride = 12, PerVertex },
{ .binding = 1, .stride = 12, PerVertex },
{ .binding = 2, .stride = 8 , PerVertex },
{ .binding = 3, .stride = 16, PerInstance },
};
@fromasmtodisasm
fromasmtodisasm / cpp
Created November 11, 2020 06:10
Universal Factory design pattern for C++
//clang 3.8.0
// File: factory-universal1.cpp1
// Author: Caio Rodrigues
// Brief: Universal Object Factory which can instantiate objects of any type.
// Note: The benefit of this implementation is that object doesn't need to have
// the same base class and the factory has no knowledge about any base class.
//----------------------------------------------------------------------------------------------
#include <iostream>
--[[
* Copyright (c) 2011-2016 - Ashita Development Team
*
* Ashita is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Ashita is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
@fromasmtodisasm
fromasmtodisasm / gdb_in_vim.md
Created February 20, 2020 13:07 — forked from RobinCPC/gdb_in_vim.md
How to use GDB in Vim

How to use ConqueGDB in Vim

Install ConqueGDB in Vim

Debug C/C++:

@fromasmtodisasm
fromasmtodisasm / DX 12 vs Vulkan
Created February 19, 2020 16:24 — forked from CHEF-KOCH/DX 12 vs Vulkan
DX 12 vs Vulkan
3-6 million lines of code dealing with the hardware abstraction layers, plus another million per API supported. The backing function for Clear in D3D 9 was close to a thousand lines of just logic dealing with how exactly to respond to the command. It'd then call out to the correct function to actually modify the buffer in question. The level of complexity internally is enormous and winding, and even inside the driver code it can be tricky to work out how exactly you get to the fast-path behaviors. Additionally the APIs don't do a great job of matching the hardware, which means that even in the best cases the driver is covering up for a LOT of things you don't know about. There are many, many shadow operations and shadow copies of things down there.
The only advantage that DX12 has are the same one from any DirectX vs OpenGL, for developers:
-> You can fully debug DirectX. OpenGL you can't. You only have absolute pain in the ass, and super primitive debug tools on OpenGL, making development slow and tedious (
#pragma once
#include "IconsFontAwesome.h" // from https://github.com/juliettef/IconFontCppHeaders
namespace ImGui
{
inline void SetupImGuiStyle( bool bStyleDark_, float alpha_ )
{
@fromasmtodisasm
fromasmtodisasm / c99.l
Created June 6, 2018 14:54 — forked from codebrainz/c99.l
C99 Lex/Flex & YACC/Bison Grammars
D [0-9]
L [a-zA-Z_]
H [a-fA-F0-9]
E ([Ee][+-]?{D}+)
P ([Pp][+-]?{D}+)
FS (f|F|l|L)
IS ((u|U)|(u|U)?(l|L|ll|LL)|(l|L|ll|LL)(u|U))
%{
#include <stdio.h>
@fromasmtodisasm
fromasmtodisasm / _README.md
Created May 25, 2018 19:07 — forked from shaunlebron/_README.md
Direct3D9 Wrapper DLL

In response to a StackOverflow question:

This is code to build a Direct3D wrapper DLL, intercepting all calls to Direct3D interface functions so that you can draw your own objects to display over the game. Just plop the DLL into the same folder as the game's executable, and it should load it as if it were the real d3d9.dll file. It still forwards all calls to the real one in system32, just allows stuff to happen in between. original stackoverflow answer

@fromasmtodisasm
fromasmtodisasm / socket.c
Created February 13, 2018 09:13 — forked from nolim1t/socket.c
HTTP Request in C using low level write to socket functionality
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <netinet/tcp.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>