summaryrefslogtreecommitdiff
path: root/indra/llrender
diff options
context:
space:
mode:
authorDave Parks <davep@lindenlab.com>2024-06-11 17:10:13 -0500
committerGitHub <noreply@github.com>2024-06-11 17:10:13 -0500
commitf40fbdf4ad27a547e30781cd44cd6847d68d3300 (patch)
treeb26dd135413752a90037bd48ad2217c4dea027ef /indra/llrender
parent429c92ad75fd3b3f7b9dfc52ed034b25004a3b9c (diff)
#1718 Add GLTF support for multiple texcoords (#1720)
* Fix for GLTF MeshPrimitiveModes test
Diffstat (limited to 'indra/llrender')
-rw-r--r--indra/llrender/llglslshader.h4
-rw-r--r--indra/llrender/llrender.cpp2
-rw-r--r--indra/llrender/llshadermgr.cpp5
-rw-r--r--indra/llrender/llshadermgr.h5
-rw-r--r--indra/llrender/llvertexbuffer.cpp10
-rw-r--r--indra/llrender/llvertexbuffer.h3
6 files changed, 25 insertions, 4 deletions
diff --git a/indra/llrender/llglslshader.h b/indra/llrender/llglslshader.h
index f2b5c4881c..d42df28809 100644
--- a/indra/llrender/llglslshader.h
+++ b/indra/llrender/llglslshader.h
@@ -328,14 +328,16 @@ public:
// bit 0 = alpha mode blend (1) or opaque (0)
// bit 1 = rigged (1) or static (0)
// bit 2 = unlit (1) or lit (0)
+ // bit 3 = single (0) or multi (1) uv coordinates
struct GLTFVariant
{
constexpr static U8 ALPHA_BLEND = 1;
constexpr static U8 RIGGED = 2;
constexpr static U8 UNLIT = 4;
+ constexpr static U8 MULTI_UV = 8;
};
- constexpr static U8 NUM_GLTF_VARIANTS = 8;
+ constexpr static U8 NUM_GLTF_VARIANTS = 16;
std::vector<LLGLSLShader> mGLTFVariants;
diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp
index 51028e5667..cfefde3acc 100644
--- a/indra/llrender/llrender.cpp
+++ b/indra/llrender/llrender.cpp
@@ -1686,7 +1686,7 @@ void LLRender::flush()
if (attribute_mask & LLVertexBuffer::MAP_TEXCOORD0)
{
- vb->setTexCoordData(mTexcoordsp.get());
+ vb->setTexCoord0Data(mTexcoordsp.get());
}
if (attribute_mask & LLVertexBuffer::MAP_COLOR)
diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp
index 5f30fc3879..6f4454f07a 100644
--- a/indra/llrender/llshadermgr.cpp
+++ b/indra/llrender/llshadermgr.cpp
@@ -1180,6 +1180,11 @@ void LLShaderMgr::initAttribsAndUniforms()
mReservedUniforms.push_back("texture_metallic_roughness_transform"); // (GLTF)
mReservedUniforms.push_back("texture_occlusion_transform"); // (GLTF)
mReservedUniforms.push_back("texture_emissive_transform"); // (GLTF)
+ mReservedUniforms.push_back("base_color_texcoord"); // (GLTF)
+ mReservedUniforms.push_back("emissive_texcoord"); // (GLTF)
+ mReservedUniforms.push_back("normal_texcoord"); // (GLTF)
+ mReservedUniforms.push_back("metallic_roughness_texcoord"); // (GLTF)
+ mReservedUniforms.push_back("occlusion_texcoord"); // (GLTF)
mReservedUniforms.push_back("terrain_texture_transforms"); // (GLTF)
diff --git a/indra/llrender/llshadermgr.h b/indra/llrender/llshadermgr.h
index 244fc41de6..c00aff3a9a 100644
--- a/indra/llrender/llshadermgr.h
+++ b/indra/llrender/llshadermgr.h
@@ -58,6 +58,11 @@ public:
TEXTURE_METALLIC_ROUGHNESS_TRANSFORM, // "texture_metallic_roughness_transform" (GLTF)
TEXTURE_OCCLUSION_TRANSFORM, // "texture_occlusion_transform" (GLTF)
TEXTURE_EMISSIVE_TRANSFORM, // "texture_emissive_transform" (GLTF)
+ BASE_COLOR_TEXCOORD, // "base_color_texcoord" (GLTF)
+ EMISSIVE_TEXCOORD, // "emissive_texcoord" (GLTF)
+ NORMAL_TEXCOORD, // "normal_texcoord" (GLTF)
+ METALLIC_ROUGHNESS_TEXCOORD, // "metallic_roughness_texcoord" (GLTF)
+ OCCLUSION_TEXCOORD, // "occlusion_texcoord" (GLTF)
TERRAIN_TEXTURE_TRANSFORMS, // "terrain_texture_transforms" (GLTF)
diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp
index a4d33c91df..33f7a6527f 100644
--- a/indra/llrender/llvertexbuffer.cpp
+++ b/indra/llrender/llvertexbuffer.cpp
@@ -1635,7 +1635,7 @@ void LLVertexBuffer::setPositionData(const LLVector4a* data)
flush_vbo(GL_ARRAY_BUFFER, 0, sizeof(LLVector4a) * getNumVerts()-1, (U8*) data, mMappedData);
}
-void LLVertexBuffer::setTexCoordData(const LLVector2* data)
+void LLVertexBuffer::setTexCoord0Data(const LLVector2* data)
{
#if !LL_DARWIN
llassert(sGLRenderBuffer == mGLBuffer);
@@ -1643,6 +1643,14 @@ void LLVertexBuffer::setTexCoordData(const LLVector2* data)
flush_vbo(GL_ARRAY_BUFFER, mOffsets[TYPE_TEXCOORD0], mOffsets[TYPE_TEXCOORD0] + sTypeSize[TYPE_TEXCOORD0] * getNumVerts() - 1, (U8*)data, mMappedData);
}
+void LLVertexBuffer::setTexCoord1Data(const LLVector2* data)
+{
+#if !LL_DARWIN
+ llassert(sGLRenderBuffer == mGLBuffer);
+#endif
+ flush_vbo(GL_ARRAY_BUFFER, mOffsets[TYPE_TEXCOORD1], mOffsets[TYPE_TEXCOORD1] + sTypeSize[TYPE_TEXCOORD1] * getNumVerts() - 1, (U8*)data, mMappedData);
+}
+
void LLVertexBuffer::setColorData(const LLColor4U* data)
{
#if !LL_DARWIN
diff --git a/indra/llrender/llvertexbuffer.h b/indra/llrender/llvertexbuffer.h
index 94339191a4..66a7f2bf26 100644
--- a/indra/llrender/llvertexbuffer.h
+++ b/indra/llrender/llvertexbuffer.h
@@ -196,7 +196,8 @@ public:
void setTangentData(const LLVector4a* data);
void setWeight4Data(const LLVector4a* data);
void setJointData(const U64* data);
- void setTexCoordData(const LLVector2* data);
+ void setTexCoord0Data(const LLVector2* data);
+ void setTexCoord1Data(const LLVector2* data);
void setColorData(const LLColor4U* data);
void setIndexData(const U16* data);
void setIndexData(const U32* data);