Skip to content

Instantly share code, notes, and snippets.

View Pikachuxxxx's full-sized avatar
😎
lol

Phani Srikar Pikachuxxxx

😎
lol
View GitHub Profile
@Pikachuxxxx
Pikachuxxxx / VulkanMemoryThoughts.txt
Last active April 24, 2025 20:39
Some thoughts about Vulkan memory allocation and drivers stuff
so usage will tell what are it's memory requirements, then we select the heap to allocate it from by comparing
the memory requirements for all available heaps in the physical device?
so vkGetBufferMemory erquirements takes in usage flags and returns which memoryType to use but not the Heap Index because that can be
implicitly inferered frmo memorytype?
so we check for compatible memortypes and return that index
vkGetBufferMemoryRequirements(VkDevice device, VkBuffer buffer, VkMemoryRequirements* pMemoryRequirements)
This call returns a VkMemoryRequirements structure, which includes:
@Pikachuxxxx
Pikachuxxxx / CStupidTrickStructVariableElements.c
Last active April 15, 2025 05:03
A stupid trick to calculate the nu of entries of a array dynamically
#include <stdio.h>
#include <stdint.h>
#include <stddef.h>
#include <assert.h>
#define TEST_STRUCT_ENTRIES(struct_type, start_member, end_member, expected_count) \
do { \
size_t start_offset = offsetof(struct_type, start_member); \
size_t end_offset = offsetof(struct_type, end_member); \
size_t num_elements = (end_offset - start_offset) / sizeof(uint32_t); \
@Pikachuxxxx
Pikachuxxxx / reflection.cpp
Created November 11, 2024 17:33
Reflection testing in C++ RTTI
#include <iostream>
#include <vector>
#include <string>
#include <typeinfo>
//----------------------------------
// Reflection System using typeid and decltype
struct MemberInfo
{
std::string name;
std::string typeName;
/**
* Dixy12 - DirectX12 learning sandbox
* Source: https://www.3dgep.com/learning-directx-12-1
*/
#include "common.h"
//----------------------------------------------------------------
constexpr uint8_t g_NumFrames = 3; // The number of swap chain back buffers. 2 Back buffers + 1 presentation image = 3
//----------------------------------------------------------------
namespace AppGlobalSettings {
@Pikachuxxxx
Pikachuxxxx / Blender_NameCleanup.py
Last active December 9, 2023 05:18
Scene clean up code to copy scene object name to mesh name in Blender
# [Source] : https://blender.stackexchange.com/questions/46795/is-there-a-quick-way-to-copy-the-object-name-to-the-mesh-data-name
import bpy
objects = bpy.data.objects
for obj in objects:
if obj.data and obj.data.users == 1:
obj.data.name = obj.name
@Pikachuxxxx
Pikachuxxxx / Git add history to already cloned repo.txt
Created October 23, 2022 03:53
Git add history to already cloned repo.txt
Grab the .git directory by cloning a bare repository
$ mkdir repo
$ git clone --bare http://github/user/repo repo
Make the .git directory and move the cloned files
$ mkdir repo/.git
$ mv repo/* repo/.git
Unzip the repository
//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:
//The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTW
@Pikachuxxxx
Pikachuxxxx / RTIAW.frag
Created March 22, 2022 16:18
Diffuse RT
#version 410 core
// Input from vertex shader
in VS_OUT {
vec3 normal;
vec2 texCoords;
} vs_in;
out vec4 outFragColor;
[https://www.shadertoy.com/view/NtfcRr] - ShaderToy Link: This gist has some unsaved edits cause shader toy login was down
---------------------------------------------------------------------------------
Common
---------------------------------------------------------------------------------
// Path Tracer Settings
// The minimunm distance a ray must travel before we consider an intersection.
// This is to prevent a ray from intersecting a surface it just bounced off of.
const float c_minimumRayHitTime = 0.01f;
// the farthest we look for ray hits