This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstdint> | |
#include <optional> | |
// Async N-buffered timer query. | |
// Does not induce pipeline stalls. | |
// Useful for measuring performance of passes every frame without causing stalls. | |
// However, the results returned may be from multiple frames ago, | |
// and results are not guaranteed to be available. | |
// In practice, setting N to 5 should allow at least one query to be available. | |
class TimerQueryAsync |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MIT License | |
Copyright (c) 2021 Jake Ryan | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the Software is | |
furnished to do so, subject to the following conditions: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
#include <concepts> | |
#include <utility> | |
template<std::invocable Fn> | |
class Defer | |
{ | |
public: | |
constexpr Defer(Fn&& f) noexcept : f_(std::move(f)) {} | |
constexpr Defer(const Fn& f) : f_(f) {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
inline uint64_t xorshf96() | |
{ | |
static thread_local uint64_t x = 123456789, y = 362436069, z = 521288629; | |
x ^= x << 16; | |
x ^= x >> 5; | |
x ^= x << 1; | |
const uint64_t t = x; | |
x = y; | |
y = z; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#version 460 core | |
layout (location = 0) in vec2 vTexCoord; // could be calculated in FS with screen-space coords | |
layout (location = 0) uniform sampler2D u_hdrBuffer; // final HDR scene image (before tonemapping) | |
layout (location = 1) uniform sampler2D gDepth; // scene depth buffer from eye PoV | |
layout (location = 2) uniform sampler2D shadowDepth; | |
layout (location = 3) uniform mat4 u_invViewProj; | |
layout (location = 4) uniform mat4 u_lightMatrix; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
#include <span> | |
#include <cstddef> | |
#include <stdint.h> | |
#include <vector> | |
#include <zlib.h> | |
#include <memory> | |
namespace Compression | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Graphics/GraphicsIncludes.h> | |
#include <Graphics/StaticBuffer.h> | |
StaticBuffer::StaticBuffer(const void* data, GLuint size, GLbitfield glflags) | |
{ | |
glCreateBuffers(1, &rendererID_); | |
glNamedBufferStorage(rendererID_, size, data, glflags); | |
} | |
StaticBuffer::StaticBuffer(const StaticBuffer& other) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
#include <span> | |
#include <vector> | |
#include <concepts> | |
namespace Compression | |
{ | |
template<std::signed_integral T> | |
std::vector<T> EncodeDelta(std::span<T> array) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
#include <span> | |
#include <vector> | |
namespace Compression | |
{ | |
template<typename T> | |
struct RLEelement | |
{ | |
uint32_t count{}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#version 450 | |
out vec4 FragColor; | |
in vec3 vPos; | |
in vec3 vNormal; | |
in vec2 vTexCoord; | |
uniform vec3 u_viewpos; | |
uniform float u_waterRefract; // water |