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
| namespace Razix { | |
| // this remote_refence is to convert a Type value from either value/ref/&& to a &&, used for custom move semantics | |
| // It removes & or && from a type so you can get the underlying base type | |
| template <typename T> struct rz_remove_reference {using type = T;}; | |
| template <typename T> struct rz_remove_reference<T&> {using type = T;}; | |
| template <typename T> struct rz_remove_reference<T&&> {using type = T;}; | |
| // custom razix move semantics, get the underlying base type and force cast to r-value ref | |
| template <typename T> |
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 <stdio.h> | |
| #include <stdlib.h> | |
| #include <string.h> | |
| #include <unistd.h> | |
| #include <time.h> | |
| #include <arpa/inet.h> | |
| #define PORT 8080 | |
| #define MAX_MESSAGES 128 | |
| #define MAX_MSG_LEN 2048 |
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
| 1. How to convert a string to integer with SIMD acceleration (explained with NEON intrinsics) | |
| // vld1q_u8 to load 16 chars | |
| // create masks: | |
| // is_digit (0-9) using vceq_u8 | |
| // is_plus --> vaddvq_u8 --> to get quick answer --> update global state | |
| // is_minus --> vaddvq_u8 --> to get quick answer --> update global state | |
| // is_space | |
| // ignore_mask = vorrq_u8 --> combine masks (is_plus/minus/space) | |
| // convert to digits --> subtrack '0', vsubq_u8/vdupq_u8 | |
| // apply digit mask and convert them to 0, vbslq_u8 |
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
| // neon_practice.c | |
| // Practice file for learning ARM NEON intrinsics | |
| // Compile with: clang -O3 neon_practice.c -o neon_practice | |
| #include <arm_neon.h> | |
| #include <stdio.h> | |
| // --------------------------------------------------------- | |
| // Exercise 1: Vector addition | |
| // Task: Add two float32x4_t vectors element-wise |
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
| static uint64_t ftoa(double val, char* buf, uint32_t precision) | |
| { | |
| // double IEEE-745: [sign:1] [exponent:11] [mantissa:52] | |
| // bias = 1023, all exponents have bias to store as positive numbers | |
| // normalized => exponent != 0, subnormal => exponent == 0 | |
| uint64_t bytes = 0; | |
| union { double d; uint64_t u; } v = { val }; | |
| uint64_t bits = v.u; | |
| int64_t exponent = (bits >> 52) & (0x7FF); // remove 52 bits and get the trailing 11 bits |
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
| // Disney BRDF Parameter Structure | |
| struct DisneyBRDFParams | |
| { | |
| float3 baseColor; // Base color (albedo) | |
| float metallic; // Metallic parameter [0, 1] | |
| float subsurface; // Subsurface scattering amount [0, 1] | |
| float specular; // Specular amount [0, 1] | |
| float roughness; // Surface roughness [0, 1] | |
| float specularTint; // Specular tint toward base color [0, 1] | |
| float anisotropic; // Anisotropy amount [0, 1] |
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 | |
| namespace Razix { | |
| // Forward declarations | |
| template<typename T, size_t N> | |
| class FixedArray; | |
| template<typename T> | |
| class DynamicArray; |
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
| Set-PSReadlineOption -HistorySavePath "$env:USERPROFILE\Documents\PowerShell_history.txt" | |
| Set-PSReadlineOption -MaximumHistoryCount 10000 | |
| Set-PSReadlineOption -HistoryNoDuplicates | |
| Set-PSReadLineOption -PredictionSource History | |
| oh-my-posh init pwsh --config https://github.com/JanDeDobbeleer/oh-my-posh/blob/main/themes/slim.omp.json | Invoke-Expression |
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
| // Why I love C and Jumptables: | |
| #define rzRHI_DestroyDescriptorHeap g_RHI.DestroyDescriptorHeap | |
| #define rzRHI_CreateDescriptorTable g_RHI.CreateDescriptorTable | |
| #define rzRHI_DestroyDescriptorTable g_RHI.DestroyDescriptorTable | |
| #if !RZ_PROFILER_ENABLED | |
| #if defined(RAZIX_RHI_USE_RESOURCE_MANAGER_HANDLES) && defined(__cplusplus) | |
| #define rzRHI_BeginCmdBuf(cb) g_RHI.BeginCmdBuf(RZResourceManager::Get().getCommandBufferResource(cb)) |
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
| local love = require("love") | |
| -- Test case for setDepthClamp function | |
| local TestDepthClamp = {} | |
| function love.conf(t) | |
| t.renderers = {"opengl"} | |
| end | |
| function TestDepthClamp:load() |
NewerOlder