summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Lemire <paul.lemire@kdab.com>2020-07-17 16:46:00 +0200
committerPaul Lemire <paul.lemire@kdab.com>2020-07-29 10:23:39 +0200
commit6fc896c28370577f7065961391d8a8d2794b55cf (patch)
treed58922f41df6312d69bc216d9ff9783718bdaecb /src
parentad815df128fab21c64edd2cc963f7c9fbc9091ff (diff)
rhi: don't abort early when a geometry has more attributes than a shader requires
It's a valid use case to have shaders with less attributes than what a geometry provides Change-Id: I718478996eb62ffab880e25492b47a3fde1ae9b3 Reviewed-by: Mike Krus <mike.krus@kdab.com>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/renderers/rhi/renderer/renderer.cpp15
1 files changed, 6 insertions, 9 deletions
diff --git a/src/plugins/renderers/rhi/renderer/renderer.cpp b/src/plugins/renderers/rhi/renderer/renderer.cpp
index a194c94ff..8e0af1701 100644
--- a/src/plugins/renderers/rhi/renderer/renderer.cpp
+++ b/src/plugins/renderers/rhi/renderer/renderer.cpp
@@ -1543,10 +1543,11 @@ bool Renderer::prepareGeometryInputBindings(const Geometry *geometry, const RHIS
isPerInstanceAttr ? attrib->divisor() : 1U };
const int location = locationForAttribute(attrib, shader);
- if (location == -1) {
- qCWarning(Backend) << "An attribute has no location";
- return false;
- }
+ // In case the shader doesn't use the attribute, we would get no
+ // location. This is not a failure, just that we provide more attributes
+ // than required.
+ if (location == -1)
+ continue;
const auto it = std::find_if(uniqueBindings.begin(), uniqueBindings.end(),
[binding](const BufferBinding &a) {
@@ -2315,12 +2316,8 @@ bool Renderer::uploadBuffersForCommand(QRhiCommandBuffer *cb, const RenderView *
// We need to reference a binding, a buffer and an offset which is always = 0
// as Qt3D only assumes interleaved or continuous data but not
// buffer where first half of it is attribute1 and second half attribute2
- if (bindingIndex != -1) {
+ if (bindingIndex != -1)
command.vertex_input[bindingIndex] = { hbuf->rhiBuffer(), 0 };
- } else {
- qCWarning(Backend) << "Binding with an index of -1";
- return false;
- }
break;
}
case QAttribute::IndexAttribute: {