3 Commits

Author SHA1 Message Date
9a5918f3f7 Experimental clangd support for PoolBox 2025-08-12 22:15:08 +02:00
18ebf33e2c Add clangd support to 'Support' 2025-08-12 21:57:16 +02:00
d8065f6266 Add clangd support 2025-08-12 21:50:46 +02:00
8 changed files with 10 additions and 110 deletions

3
.clangd Normal file
View File

@@ -0,0 +1,3 @@
CompileFlags:
Remove: [-fmodules-ts, -mno-shared, -mno-llsc, -march=r2000, -mtune=r2000, implied_comparison_category_type_not_found]
Compiler: mipsel-linux-gnu-g++

2
.gitignore vendored
View File

@@ -9,6 +9,8 @@
**/config
.lfsconfig
.cache
compile_commands.json
*.d
*.a

View File

@@ -11,7 +11,7 @@
{
"label": "build",
"type": "shell",
"command": "${env:JABY_ENGINE_PATH}/scripts/podman_jaby_engine.sh ${workspaceFolder}:. make ${input:project}_${input:target} BUILD_PROFILE=${input:build profile} REGION=${input:region} CUSTOM_CONFIG=${input:custom config}",
"command": "${env:JABY_ENGINE_PATH}/scripts/podman_jaby_engine.sh ${workspaceFolder}:. bear -- make ${input:project}_${input:target} BUILD_PROFILE=${input:build profile} REGION=${input:region} CUSTOM_CONFIG=${input:custom config}",
"group": {
"kind": "build",
"isDefault": true

View File

@@ -109,20 +109,6 @@ namespace GTETest {
GTE::set_geom_screen(256);
}
static void check_values() {
static constexpr int32_t Value = 256;
GTE::set_geom_screen(Value);
printf("set_geom_screen: %i == %i\n", GTE::get_geom_screen(), Value);
int32_t x = 256;
int32_t y = 512;
GTE::set_geom_offset(x, y);
GTE::get_geom_offset(x, y);
printf("%i == 256 && %i == 512\n", x, y);
}
static bool update_or_exit() {
Periphery::query_controller();
if(Shared::back_menu.update(Make::PositionI16(0, GPU::Display::Height - 32))) {
@@ -168,7 +154,6 @@ namespace GTETest {
void main() {
setup();
check_values();
while(true) {
if(update_or_exit()) {

View File

@@ -224,7 +224,7 @@ namespace JabyEngine {
return Size::create(static_cast<T>(size.width), static_cast<T>(size.height));
}
auto operator<=>(const Size<T>&) const = default;
bool operator<=>(const Size<T>&) const = default;
};
using SizeI8 = Size<int8_t>;
using SizeU8 = Size<uint8_t>;

View File

@@ -1,47 +1,6 @@
#pragma once
#include "gte_instruction.hpp"
// GTE Overview
// GTE Data Register Summary (cop2r0-31)
//
// `mtc2` (Move To Coprocessor 2): Sets a Data Register (031).
// `mfc2` (Move From Coprocessor 2): Gets a Data Register (031).
//
// | cop2r0-1 | 3xS16 | VXY0,VZ0 | Vector 0 (X,Y,Z) |
// | cop2r2-3 | 3xS16 | VXY1,VZ1 | Vector 1 (X,Y,Z) |
// | cop2r4-5 | 3xS16 | VXY2,VZ2 | Vector 2 (X,Y,Z) |
// | cop2r6 | 4xU8 | RGBC | Color/code value |
// | cop2r7 | 1xU16 | OTZ | Average Z value (for Ordering Table) |
// | cop2r8 | 1xS16 | IR0 | 16bit Accumulator (Interpolate) |
// | cop2r9-11 | 3xS16 | IR1,IR2,IR3 | 16bit Accumulator (Vector) |
// | cop2r12-15 | 6xS16 | SXY0,SXY1,SXY2,SXYP | Screen XY-coordinate FIFO (3 stages) |
// | cop2r16-19 | 4xU16 | SZ0,SZ1,SZ2,SZ3 | Screen Z-coordinate FIFO (4 stages) |
// | cop2r20-22 | 12xU8 | RGB0,RGB1,RGB2 | Color CRGB-code/color FIFO (3 stages) |
// | cop2r23 | 4xU8 | (RES1) | Prohibited |
// | cop2r24 | 1xS32 | MAC0 | 32bit Maths Accumulators (Value) |
// | cop2r25-27 | 3xS32 | MAC1,MAC2,MAC3 | 32bit Maths Accumulators (Vector) |
// | cop2r28-29 | 1xU15 | IRGB,ORGB | Convert RGB Color (48bit vs 15bit) |
// | cop2r30-31 | 2xS32 | LZCS,LZCR | Count Leading-Zeroes/Ones (sign bits) |
//
// GTE Control Register Summary (cop2r32-63)
// ctc2 (Copy To Control Coprocessor 2): Sets a Control Register (cnt031).
// cfc2 (Copy From Control Coprocessor 2): Gets a Control Register (cnt031).
//
// | cop2r32-36 9xS16 RT11RT12,..,RT33 | Rotation matrix (3x3) | cnt0-4 |
// | cop2r37-39 3x 32 TRX,TRY,TRZ | Translation vector (X,Y,Z) | cnt5-7 |
// | cop2r40-44 9xS16 L11L12,..,L33 | Light source matrix (3x3) | cnt8-12 |
// | cop2r45-47 3x 32 RBK,GBK,BBK | Background color (R,G,B) | cnt13-15 |
// | cop2r48-52 9xS16 LR1LR2,..,LB3 | Light color matrix source (3x3) | cnt16-20 |
// | cop2r53-55 3x 32 RFC,GFC,BFC | Far color (R,G,B) | cnt21-23 |
// | cop2r56-57 2x 32 OFX,OFY | Screen offset (X,Y) | cnt24-25 | (1bit sign, 15bit integer, 16bit fraction)
// | cop2r58 BuggyU16 H | Projection plane distance. | cnt26 | (0bit sign, 16bit integer, 0bit fraction)
// | cop2r59 S16 DQA | Depth queing parameter A (coeff) | cnt27 |
// | cop2r60 32 DQB | Depth queing parameter B (offset) | cnt28 |
// | cop2r61-62 2xS16 ZSF3,ZSF4 | Average Z scale factors | cnt29-30 |
// | cop2r63 U20 FLAG | Returns any calculation errors | cnt31 |
namespace JabyEngine {
namespace GTE {
static constexpr auto StackSize = 16;
@@ -254,19 +213,6 @@ namespace JabyEngine {
__asm__ volatile("ctc2 $13, $25" :: "r"(off_x), "r"(off_y) : "$12", "$13");
}
static void get_geom_offset(int32_t &off_x, int32_t &off_y) {
int32_t raw_x, raw_y;
__asm__ volatile (
"cfc2 %0, $24\n"
"cfc2 %1, $25"
: "=r" (raw_x), "=r" (raw_y)
);
off_x = raw_x >> 16;
off_y = raw_y >> 16;
}
/*
SetGeomScreen(h)
@@ -276,18 +222,6 @@ namespace JabyEngine {
__asm__ volatile("ctc2 %0, $26" :: "r"(h));
}
/*
GetGeomScreen() (???)
Get distance from viewpoint to screen.
*/
static int32_t get_geom_screen() {
int32_t h;
__asm__ volatile("cfc2 %0, $26" : "=r"(h));
return h;
}
// Implementations for the MATRIX struct
inline MATRIX& MATRIX :: comp(const MATRIX& matrix) {
return comp_matrix(matrix, *this, *this);

View File

@@ -19,13 +19,13 @@
{
"label": "make",
"type": "shell",
"command": "../../scripts/podman_jaby_engine.sh ../../:src/Library make ${input:target} BUILD_PROFILE=${input:build cfg} PSX_TV_FORMAT=${input:tv format} CUSTOM_CONFIG=${input:config options}",
"command": "../../scripts/podman_jaby_engine.sh ../../:src/Library bear --output ${workspaceFolder}/../../compile_commands.json -- make ${input:target} BUILD_PROFILE=${input:build cfg} PSX_TV_FORMAT=${input:tv format} CUSTOM_CONFIG=${input:config options}",
"group": "build"
},
{
"label": "make_all",
"type": "shell",
"command": "../../scripts/podman_jaby_engine.sh ../../:src/Library make -f MakeAll.mk ${input:target prefix}_${input:target} BUILD_PROFILE=${input:build cfg} CUSTOM_CONFIG=${input:config options}",
"command": "../../scripts/podman_jaby_engine.sh ../../:src/Library bear --output ${workspaceFolder}/../../compile_commands.json -- make -f MakeAll.mk ${input:target prefix}_${input:target} BUILD_PROFILE=${input:build cfg} CUSTOM_CONFIG=${input:config options}",
"group": "build"
}
],
@@ -75,29 +75,5 @@
},
"settings": {
"cmake.configureOnOpen": false,
"C_Cpp.default.includePath": [
"include",
"../../include"
],
"C_Cpp.default.compilerPath": "",
"C_Cpp.default.cStandard": "c17",
"C_Cpp.default.cppStandard": "c++20",
"C_Cpp.default.intelliSenseMode": "linux-gcc-x86",
"C_Cpp.default.compilerArgs": [
],
"C_Cpp.default.defines": [
"JABYENGINE_PAL",
"__DEBUG_SPU_MMU__",
"__friends=public"
],
"files.exclude": {
"**/*.o": true,
"**/*.dep": true
},
"files.associations": {
"stdio.h": "c",
"TUTO0.C": "cpp",
"MAIN.C": "cpp"
}
}
}

View File

@@ -19,7 +19,7 @@
{
"label": "make",
"type": "shell",
"command": "../../scripts/podman_jaby_engine.sh ${workspaceFolder}/..:src/FontWriter make ${input:target} BUILD_PROFILE=${input:build cfg}",
"command": "../../scripts/podman_jaby_engine.sh ${workspaceFolder}/..:src/FontWriter bear --output ${workspaceFolder}/../compile_commands.json -- make ${input:target} BUILD_PROFILE=${input:build cfg}",
"group": "build"
}
],