mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-04-08 07:05:40 +12:00
Optimize float uniform setting
This commit is contained in:
parent
70f733ffb8
commit
81932421cf
1 changed files with 6 additions and 6 deletions
|
@ -256,16 +256,16 @@ class PICAShader {
|
||||||
|
|
||||||
void uploadFloatUniform(u32 word) {
|
void uploadFloatUniform(u32 word) {
|
||||||
floatUniformBuffer[floatUniformWordCount++] = word;
|
floatUniformBuffer[floatUniformWordCount++] = word;
|
||||||
// Check if the program tries to upload to a non-existent uniform, and empty the queue without writing in that case
|
|
||||||
if (floatUniformIndex >= 96) [[unlikely]] {
|
|
||||||
floatUniformWordCount = 0;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((f32UniformTransfer && floatUniformWordCount >= 4) || (!f32UniformTransfer && floatUniformWordCount >= 3)) {
|
if ((f32UniformTransfer && floatUniformWordCount >= 4) || (!f32UniformTransfer && floatUniformWordCount >= 3)) {
|
||||||
vec4f& uniform = floatUniforms[floatUniformIndex++];
|
|
||||||
floatUniformWordCount = 0;
|
floatUniformWordCount = 0;
|
||||||
|
|
||||||
|
// Check if the program tries to upload to a non-existent uniform, and empty the queue without writing in that case
|
||||||
|
if (floatUniformIndex >= 96) [[unlikely]] {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
vec4f& uniform = floatUniforms[floatUniformIndex++];
|
||||||
|
|
||||||
if (f32UniformTransfer) {
|
if (f32UniformTransfer) {
|
||||||
uniform[0] = f24::fromFloat32(*(float*)&floatUniformBuffer[3]);
|
uniform[0] = f24::fromFloat32(*(float*)&floatUniformBuffer[3]);
|
||||||
uniform[1] = f24::fromFloat32(*(float*)&floatUniformBuffer[2]);
|
uniform[1] = f24::fromFloat32(*(float*)&floatUniformBuffer[2]);
|
||||||
|
|
Loading…
Add table
Reference in a new issue