Fix vertex format binding;
@@ -4011,25 +4011,7 @@ static void bindPipeline(Pass* pass, Draw* draw, Shader* shader) {
}
// Vertex formats
- if (pipeline->formatHash != 1 + draw->vertex.format) {
- if (!draw->vertex.buffer) {
- pipeline->formatHash = 1 + draw->vertex.format;
- pipeline->info.vertex = state.vertexFormats[draw->vertex.format];
- pipeline->dirty = true;
-
- if (shader->hasCustomAttributes) {
- for (uint32_t i = 0; i < shader->attributeCount; i++) {
- if (shader->attributes[i].location < 10) {
- pipeline->info.vertex.attributes[pipeline->info.vertex.attributeCount++] = (gpu_attribute) {
- .buffer = 1,
- .location = shader->attributes[i].location,
- .type = GPU_TYPE_F32x4,
- .offset = shader->attributes[i].location == LOCATION_COLOR ? 16 : 0
- };
- }
- }
- }
- } else {
+ if (draw->vertex.buffer && pipeline->formatHash != draw->vertex.buffer->hash) {
pipeline->formatHash = draw->vertex.buffer->hash;
pipeline->info.vertex.bufferCount = 2;
pipeline->info.vertex.attributeCount = shader->attributeCount;
@@ -4065,6 +4047,22 @@ static void bindPipeline(Pass* pass, Draw* draw, Shader* shader) {
};
}
}
+ } else if (!draw->vertex.buffer && pipeline->formatHash != 1 + draw->vertex.format) {
+ pipeline->formatHash = 1 + draw->vertex.format;
+ pipeline->info.vertex = state.vertexFormats[draw->vertex.format];
+ pipeline->dirty = true;
+
+ if (shader->hasCustomAttributes) {
+ for (uint32_t i = 0; i < shader->attributeCount; i++) {
+ if (shader->attributes[i].location < 10) {
+ pipeline->info.vertex.attributes[pipeline->info.vertex.attributeCount++] = (gpu_attribute) {
+ .buffer = 1,
+ .location = shader->attributes[i].location,
+ .type = GPU_TYPE_F32x4,
+ .offset = shader->attributes[i].location == LOCATION_COLOR ? 16 : 0
+ };
+ }
+ }
}
}
