mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-06-03 12:27:21 +12:00
[PICA interpreter] Implement dp4, end
This commit is contained in:
parent
ce07b7e5e0
commit
75070ca6ef
3 changed files with 49 additions and 9 deletions
|
@ -12,7 +12,9 @@ enum class ShaderType {
|
|||
|
||||
namespace ShaderOpcodes {
|
||||
enum : u32 {
|
||||
MOV = 0x13
|
||||
DP4 = 0x02,
|
||||
MOV = 0x13,
|
||||
END = 0x22
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -31,11 +33,13 @@ class PICAShader {
|
|||
std::array<vec4f, 16> tempRegisters;
|
||||
ShaderType type;
|
||||
|
||||
// Shader opcodes
|
||||
void mov(u32 instruction);
|
||||
vec4f getSource(u32 source);
|
||||
vec4f& getDest(u32 dest);
|
||||
|
||||
// Shader opcodes
|
||||
void dp4(u32 instruction);
|
||||
void mov(u32 instruction);
|
||||
|
||||
// src1, src2 and src3 have different negation & component swizzle bits in the operand descriptor
|
||||
// https://problemkaputt.github.io/gbatek.htm#3dsgpushaderinstructionsetopcodesummary in the
|
||||
// "Shader Operand Descriptors" section
|
||||
|
@ -75,6 +79,14 @@ class PICAShader {
|
|||
return ret;
|
||||
}
|
||||
|
||||
template <int sourceIndex>
|
||||
vec4f getSourceSwizzled(u32 source, u32 opDescriptor) {
|
||||
vec4f srcVector = getSource(source);
|
||||
srcVector = swizzle<sourceIndex>(srcVector, opDescriptor);
|
||||
|
||||
return srcVector;
|
||||
}
|
||||
|
||||
public:
|
||||
std::array<u32, 512> loadedShader; // Currently loaded & active shader
|
||||
std::array<u32, 512> bufferedShader; // Shader to be transferred when the SH_CODETRANSFER_END reg gets written to
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue