Vertex attribute by index instead of map (#2116)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
Alex Cristici
2024-02-16 20:29:53 +02:00
committed by GitHub
parent d6db72e8ba
commit 7387bb8c02
77 changed files with 781 additions and 575 deletions

View File

@@ -246,11 +246,6 @@ void RenderRasterLayer::layerIndexChanged(int32_t newLayerIndex, UniqueChangeReq
changeLayerIndex(imageLayerGroup, newLayerIndex, changes);
}
static const StringIdentity idPosAttribName = stringIndexer().get("a_pos");
static const StringIdentity idTexturePosAttribName = stringIndexer().get("a_texture_pos");
static const StringIdentity idTexImage0Name = stringIndexer().get("u_image0");
static const StringIdentity idTexImage1Name = stringIndexer().get("u_image1");
void RenderRasterLayer::update(gfx::ShaderRegistry& shaders,
gfx::Context& context,
const TransformState& /*state*/,
@@ -305,7 +300,6 @@ void RenderRasterLayer::update(gfx::ShaderRegistry& shaders,
builder->setDepthType(gfx::DepthMaskType::ReadOnly);
builder->setColorMode(gfx::ColorMode::alphaBlended());
builder->setCullFaceMode(gfx::CullFaceMode::disabled());
builder->setVertexAttrNameId(idPosAttribName);
return builder;
};
@@ -358,7 +352,7 @@ void RenderRasterLayer::update(gfx::ShaderRegistry& shaders,
if (!vertexAttrs) {
vertexAttrs = context.createVertexAttributeArray();
if (auto& attr = vertexAttrs->add(idPosAttribName)) {
if (auto& attr = vertexAttrs->set(idRasterPosVertexAttribute)) {
attr->setSharedRawData(vertices,
offsetof(RasterLayoutVertex, a1),
/*vertexOffset=*/0,
@@ -366,7 +360,7 @@ void RenderRasterLayer::update(gfx::ShaderRegistry& shaders,
gfx::AttributeDataType::Short2);
}
if (auto& attr = vertexAttrs->add(idTexturePosAttribName)) {
if (auto& attr = vertexAttrs->set(idRasterTexturePosVertexAttribute)) {
attr->setSharedRawData(vertices,
offsetof(RasterLayoutVertex, a2),
/*vertexOffset=*/0,