Shadergen: Upload light uniforms

This commit is contained in:
wheremyfoodat 2024-07-18 03:37:11 +03:00
parent ccf9693877
commit 7e480e35ec
4 changed files with 56 additions and 2 deletions

View file

@ -17,11 +17,12 @@ namespace PICA {
alignas(16) vec3 position;
alignas(16) vec3 spotlightDirection;
float distAttenuationBias;
float distanceAttenuationBias;
float distanceAttenuationScale;
};
struct FragmentUniforms {
using vec3 = std::array<float, 3>;
using vec4 = std::array<float, 4>;
static constexpr usize tevStageCount = 6;
@ -33,6 +34,8 @@ namespace PICA {
alignas(16) vec4 tevBufferColor;
alignas(16) vec4 clipCoords;
// Note: We upload this as a u32 and decode on GPU
u32 globalAmbientLight;
// NOTE: THIS MUST BE LAST so that if lighting is disabled we can potentially omit uploading it
LightUniform lightUniforms[8];
};

View file

@ -67,9 +67,20 @@ namespace PICA {
ColourBufferLoc = 0x11D,
FramebufferSize = 0x11E,
// Lighting registers
LightingEnable = 0x8F,
Light0Specular0 = 0x140,
Light0Specular1 = 0x141,
Light0Diffuse = 0x142,
Light0Ambient = 0x143,
Light0XY = 0x144,
Light0Z = 0x145,
Light0SpotlightXY = 0x146,
Light0SpotlightZ = 0x147,
Light0AttenuationBias = 0x14A,
Light0AttenuationScale = 0x14B,
LightGlobalAmbient = 0x1C0,
LightNumber = 0x1C2,
LightConfig0 = 0x1C3,
LightConfig1 = 0x1C4,