- Start work on drawlist
- Fix issue in texloader - add ivec2 to tecloader / screen - add draw func for iron - add bufCfg in 3 variants to c3d - add poc for c3d_permutation
This commit is contained in:
3
poc/CMakeLists.txt
Normal file
3
poc/CMakeLists.txt
Normal file
@@ -0,0 +1,3 @@
|
||||
cmake_minimum_required(VERSION 3.22)
|
||||
|
||||
add_subdirectory(c3d_permutation)
|
||||
3
poc/README.md
Normal file
3
poc/README.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# Proof of concepts
|
||||
|
||||
This folder contains some proof of concept tests.
|
||||
8
poc/c3d_permutation/CMakeLists.txt
Normal file
8
poc/c3d_permutation/CMakeLists.txt
Normal file
@@ -0,0 +1,8 @@
|
||||
cmake_minimum_required(VERSION 3.22)
|
||||
|
||||
project(c3d-permutation)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED true)
|
||||
|
||||
add_executable(c3d-permutation source/main.cpp)
|
||||
10
poc/c3d_permutation/README.md
Normal file
10
poc/c3d_permutation/README.md
Normal file
@@ -0,0 +1,10 @@
|
||||
# Citro3D Shader Buf info Permutation calculation
|
||||
|
||||
```cpp
|
||||
// Why do
|
||||
BufInfo_Add(buf, data, sizeof(data[0]), 3, 0x210);
|
||||
BufInfo_Add(buf, data, sizeof(data[0]), 4, 0x3210);
|
||||
// if we can do
|
||||
BufInfo_Add(buf, data, sizeof(data[0]), 3, permutation(3));
|
||||
BufInfo_Add(buf, data, sizeof(data[0]), 3, permutation(4));
|
||||
```
|
||||
30
poc/c3d_permutation/source/main.cpp
Normal file
30
poc/c3d_permutation/source/main.cpp
Normal file
@@ -0,0 +1,30 @@
|
||||
#include <format>
|
||||
#include <iostream>
|
||||
#include <stdexcept>
|
||||
|
||||
using u64 = unsigned long long;
|
||||
|
||||
constexpr u64 permutation(int ac) {
|
||||
u64 ret = 0;
|
||||
if (ac < 1 || ac > 15) {
|
||||
throw std::runtime_error("[amy] " + std::to_string(ac) +
|
||||
" is out of range (1...15)!");
|
||||
}
|
||||
for (int i = 0; i < ac; i++) {
|
||||
ret = (ret << 4) | (ac - 1 - i);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
int v = 3;
|
||||
if (argc == 2) {
|
||||
v = std::stoi(argv[1]);
|
||||
} else {
|
||||
std::cout << "No input provided! using example..." << std::endl;
|
||||
}
|
||||
std::cout << std::format("{} -> {:#x} ({})", v, permutation(v),
|
||||
permutation(v))
|
||||
<< std::endl;
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user