Showing the changes to libraries/render-utils/src/GeometryCache.cpp (1 of 4 files). Show all
Unified · Split
| @@ -1925,16 +1925,19 @@ uint32_t toCompactColor(const glm::vec4& color) { · 1924 unmodified lines | ||
| 1925 | 1925 | |
| 1926 | 1926 | static const size_t INSTANCE_COLOR_BUFFER = 0; |
| 1927 | 1927 | |
| 1928 | −template <typename F> | |
| 1929 | −void renderInstances(const std::string& name, gpu::Batch& batch, const glm::vec4& color, const render::ShapePipelinePointer& pipeline, F f) { | |
| 1928 | +void renderInstances(const std::string& name, gpu::Batch& batch, const glm::vec4& color, | |
| 1929 | + const render::ShapePipelinePointer& pipeline, gpu::Batch::NamedBatchData::Function f) { | |
| 1930 | + // Add color to named buffer | |
| 1930 | 1931 | { |
| 1931 | 1932 | gpu::BufferPointer instanceColorBuffer = batch.getNamedBuffer(name, INSTANCE_COLOR_BUFFER); |
| 1932 | 1933 | auto compactColor = toCompactColor(color); |
| 1933 | 1934 | instanceColorBuffer->append(compactColor); |
| 1934 | 1935 | } |
| 1935 | − | |
| 1936 | + | |
| 1937 | + // Add call to named buffer | |
| 1936 | 1938 | batch.setupNamedCalls(name, [f, pipeline](gpu::Batch& batch, gpu::Batch::NamedBatchData& data) { |
| 1937 | − batch.setPipeline(pipeline->get(batch)); | |
| 1939 | + batch.setPipeline(pipeline->pipeline); | |
| 1940 | + pipeline->prepare(batch); | |
| 1938 | 1941 | f(batch, data); |
| 1939 | 1942 | }); |
| 1940 | 1943 | } |