summaryrefslogtreecommitdiff
path: root/indra/llprimitive
diff options
context:
space:
mode:
authorCosmic Linden <cosmic@lindenlab.com>2023-02-27 15:57:45 -0800
committerCosmic Linden <cosmic@lindenlab.com>2023-02-27 15:57:45 -0800
commitb27c41578b4bb54ee87fbb8d05f29d9d9a9e2768 (patch)
tree9ddf9eed75fa11dfe1e6308647cf10b04c845f54 /indra/llprimitive
parent099fe4a70a95339c1709c3eb2a925d7a77c642cc (diff)
SL-19279: LLGLSLShader::bindXXX is not free. Pack the uniforms
Diffstat (limited to 'indra/llprimitive')
-rw-r--r--indra/llprimitive/llgltfmaterial.cpp30
-rw-r--r--indra/llprimitive/llgltfmaterial.h3
2 files changed, 11 insertions, 22 deletions
diff --git a/indra/llprimitive/llgltfmaterial.cpp b/indra/llprimitive/llgltfmaterial.cpp
index d0ecf611ff..62b693919c 100644
--- a/indra/llprimitive/llgltfmaterial.cpp
+++ b/indra/llprimitive/llgltfmaterial.cpp
@@ -43,26 +43,16 @@ const char* const GLTF_FILE_EXTENSION_TRANSFORM_ROTATION = "rotation";
// special UUID that indicates a null UUID in override data
static const LLUUID GLTF_OVERRIDE_NULL_UUID = LLUUID("ffffffff-ffff-ffff-ffff-ffffffffffff");
-// https://github.com/KhronosGroup/glTF/tree/main/extensions/3.0/Khronos/KHR_texture_transform
-LLMatrix3 LLGLTFMaterial::TextureTransform::asMatrix()
-{
- LLMatrix3 scale;
- scale.mMatrix[0][0] = mScale[0];
- scale.mMatrix[1][1] = mScale[1];
-
- LLMatrix3 rotation;
- const F32 cos_r = cos(mRotation);
- const F32 sin_r = sin(mRotation);
- rotation.mMatrix[0][0] = cos_r;
- rotation.mMatrix[0][1] = -sin_r;
- rotation.mMatrix[1][0] = sin_r;
- rotation.mMatrix[1][1] = cos_r;
-
- LLMatrix3 offset;
- offset.mMatrix[2][0] = mOffset[0];
- offset.mMatrix[2][1] = mOffset[1];
-
- return offset * rotation * scale;
+void LLGLTFMaterial::TextureTransform::getPacked(F32 (&packed)[8])
+{
+ packed[0] = mScale.mV[VX];
+ packed[1] = mScale.mV[VY];
+ packed[2] = mRotation;
+ // packed[3] = unused
+ packed[4] = mOffset.mV[VX];
+ packed[5] = mOffset.mV[VY];
+ // packed[6] = unused
+ // packed[7] = unused
}
bool LLGLTFMaterial::TextureTransform::operator==(const TextureTransform& other) const
diff --git a/indra/llprimitive/llgltfmaterial.h b/indra/llprimitive/llgltfmaterial.h
index cae7284421..e701b62fdc 100644
--- a/indra/llprimitive/llgltfmaterial.h
+++ b/indra/llprimitive/llgltfmaterial.h
@@ -28,7 +28,6 @@
#include "llrefcount.h"
#include "llmemory.h"
-#include "m3math.h"
#include "v4color.h"
#include "v3color.h"
#include "v2math.h"
@@ -60,7 +59,7 @@ public:
LLVector2 mScale = { 1.f, 1.f };
F32 mRotation = 0.f;
- LLMatrix3 asMatrix();
+ void getPacked(F32 (&packed)[8]);
bool operator==(const TextureTransform& other) const;
};