Support apply_matrix on Vertex type

This commit is contained in:
2024-04-03 17:30:37 -05:00
parent 1bf91b2d75
commit 605162a55d
6 changed files with 57 additions and 39 deletions

View File

@@ -29,7 +29,12 @@ namespace JabyEngine {
__asm__ volatile("or $12, $12, $13" :: "r"(&vector) : "$12", "$13");
__asm__ volatile("mtc2 $12, $0" :: "r"(&vector) : "$12", "$13");
__asm__ volatile("lwc2 $1, 8(%0)" :: "r"(&vector) : "$12", "$13");
}
// Loads a GPU VERTEX type
static __always_inline void ldgv0(const GPU::Vertex& vertex) {
__asm__ volatile("lwc2 $0, 0(%0)" :: "r"(&vertex));
__asm__ volatile("lwc2 $1, 0" :: "r"(&vertex));
}
// Load column vector of MATRIX to universal register
@@ -77,6 +82,14 @@ namespace JabyEngine {
__asm__ volatile("sh $14, 4(%0)" :: "r"(&out_vector) : "$12", "$13", "$14", "memory");
}
// Stores result into a GPU Vertex type
static __always_inline void stgv(GPU::Vertex& out_vertex) {
__asm__ volatile("mfc2 $12, $9" :: "r"(&out_vertex) : "$12", "$13", "$14", "memory");
__asm__ volatile("mfc2 $13, $10" :: "r"(&out_vertex) : "$12", "$13", "$14", "memory");
__asm__ volatile("sh $12, 0(%0)" :: "r"(&out_vertex) : "$12", "$13", "$14", "memory");
__asm__ volatile("sh $13, 2(%0)" :: "r"(&out_vertex) : "$12", "$13", "$14", "memory");
}
/*
Kernel of RotTrans
(Transfer vector)+(Rotation Matrix)*(vertex register 0)