Skip to content

Instantly share code, notes, and snippets.

@Inori
Inori / vk.cpp
Created October 20, 2019 17:14 — forked from SaschaWillems/vk.cpp
Multiple Vulkan buffer binding points
Shader
layout (location = 0) in vec3 inPos;
layout (location = 1) in vec3 inColor;
layout (location = 2) in vec3 inPosB;
layout (location = 3) in vec3 inColorB;
...
Application
@Inori
Inori / FullScreenQuad.hlsl
Created April 18, 2020 22:42 — forked from rorydriscoll/FullScreenQuad.hlsl
A vertex shader that uses the vertex ID to generate a full-screen quad. Don't bind vertex buffer, index buffer or input layout. Just render three vertices!
struct Output
{
float4 position_cs : SV_POSITION;
float2 texcoord : TEXCOORD;
};
Output main(uint id: SV_VertexID)
{
Output output;
@Inori
Inori / defer.hpp
Created July 4, 2023 04:05 — forked from pmttavara/defer.hpp
The definitive defer implementation for C++. Syntax: defer { statements; };
#ifndef defer
struct defer_dummy {};
template <class F> struct deferrer { F f; ~deferrer() { f(); } };
template <class F> deferrer<F> operator*(defer_dummy, F f) { return {f}; }
#define DEFER_(LINE) zz_defer##LINE
#define DEFER(LINE) DEFER_(LINE)
#define defer auto DEFER(__LINE__) = defer_dummy{} *[&]()
#endif // defer