I hereby claim:
- I am jeremyong on github.
- I am jeremyong (https://keybase.io/jeremyong) on keybase.
- I have a public key whose fingerprint is 6B25 C16A 09DF D412 7252 7078 FAEB 4053 B50B 0549
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
#include <string> | |
#include <cassert> | |
extern "C" { | |
#include "lua.h" | |
#include "lauxlib.h" | |
#include "lualib.h" | |
int main() { | |
lua_State *l = luaL_newstate(); |
function subtract_and_hello(a, b) | |
return a - b, "hello" | |
end |
#include <string> | |
#include <cassert> | |
#include "selene.h" | |
int main() { | |
sel::State state; | |
l.Load("example.lua") | |
int difference; | |
std::string greeting; |
#pragma once | |
namespace sel { | |
class State { | |
private: | |
lua_State *_l; | |
public: | |
State() : _l(nullptr) { _l = luaL_newstate(); } | |
State(const Luab &other) = delete; | |
State &operator=(const Luab &other) = delete; |
#!/usr/bin/env bash | |
# This function takes a target executable and replicates its link dependencies to the target directory | |
# Also copies the dependencies to the bin subdirectory of the target | |
# Arg 1: executable | |
# Arg 2: output directory | |
copy_dependencies() | |
{ | |
echo "Emitting linking dependencies of $1 to $2..." |
#pragma once | |
#include <vector> | |
#include <vulkan/vulkan.hpp> | |
namespace vkf | |
{ | |
template <typename Type, typename Dispatch = vk::DispatchLoaderStatic> | |
class VkUniqueVector |
sent to the C++ SG14 working group
I actually came across an interesting idea that I would love to see in the language while working on a shader reflection library (participants here in the game engine community already have likely worked with these systems ad nauseum).
One feature graphics engineers use liberally and to good effect in shader code is "component swizzling." Suppose we have a vec4 which is a packed struct of four single-precision floats. We can perform operations such as the following
vec4 color = ... // Some color value with components rgba
color.rr; // This is a vec2 initialized with values {color.r, color.r}
color.zyz; // Equivalent to a vec3 initialized with {color.z, color.y, color.z}
Assembly generated from code implemented here
mov rax, rdi
vmovaps xmm0, xmmword ptr [rsi]
vmovaps xmm1, xmmword ptr [rsi + 16]
Obligatory disclaimer, this is all opinion and cannot possibly generalize to all problems, workflows, environments, etc. This is meant primarily as a launching point for an open-ended discussion on best practices in debugging code. This is a sketch of what may be a brief book that covers each point below with anecdotes, examples, and techniques.
The ultimate goal of a debugging session is to rule out possibilities until only one remains. All applications of best practices, techniques, and tools should be pointed at this purpose (contextualize all points below against this statement). Debugging is first and foremost a critical thinking problem, and presence of mind is your most critical asset. Establish a mental model but do not be afraid to invalidate it as the investigation unfolds.