try to avoid reusing uniform buffer locations

This commit is contained in:
SamGondelman 2018-01-10 17:01:01 -08:00
parent 19106fcff9
commit e9d751fd23
3 changed files with 15 additions and 10 deletions

View file

@ -23,6 +23,8 @@ using namespace render::entities;
static uint8_t CUSTOM_PIPELINE_NUMBER = 0;
static gpu::Stream::FormatPointer _vertexFormat;
static std::weak_ptr<gpu::Pipeline> _texturedPipeline;
// FIXME: This is interfering with the uniform buffers in DeferredLightingEffect.cpp, so use 11 to avoid collisions
static int32_t PARTICLE_UNIFORM_SLOT { 11 };
static ShapePipelinePointer shapePipelineFactory(const ShapePlumber& plumber, const ShapeKey& key) {
auto texturedPipeline = _texturedPipeline.lock();
@ -38,6 +40,9 @@ static ShapePipelinePointer shapePipelineFactory(const ShapePlumber& plumber, co
auto fragShader = gpu::Shader::createPixel(std::string(textured_particle_frag));
auto program = gpu::Shader::createProgram(vertShader, fragShader);
gpu::Shader::BindingSet slotBindings;
slotBindings.insert(gpu::Shader::Binding(std::string("particleBuffer"), PARTICLE_UNIFORM_SLOT));
gpu::Shader::makeProgram(*program, slotBindings);
_texturedPipeline = texturedPipeline = gpu::Pipeline::create(program, state);
}
@ -320,7 +325,7 @@ void ParticleEffectEntityRenderer::doRender(RenderArgs* args) {
transform.setScale(vec3(1));
}
batch.setModelTransform(transform);
batch.setUniformBuffer(0, _uniformBuffer);
batch.setUniformBuffer(PARTICLE_UNIFORM_SLOT, _uniformBuffer);
batch.setInputFormat(_vertexFormat);
batch.setInputBuffer(0, _particleBuffer, 0, sizeof(GpuParticle));

View file

@ -33,8 +33,9 @@ using namespace render;
using namespace render::entities;
static uint8_t CUSTOM_PIPELINE_NUMBER { 0 };
static const int32_t PAINTSTROKE_TEXTURE_SLOT{ 0 };
static const int32_t PAINTSTROKE_UNIFORM_SLOT{ 0 };
static const int32_t PAINTSTROKE_TEXTURE_SLOT { 0 };
// FIXME: This is interfering with the uniform buffers in DeferredLightingEffect.cpp, so use 11 to avoid collisions
static const int32_t PAINTSTROKE_UNIFORM_SLOT { 11 };
static gpu::Stream::FormatPointer polylineFormat;
static gpu::PipelinePointer polylinePipeline;
#ifdef POLYLINE_ENTITY_USE_FADE_EFFECT

View file

@ -37,14 +37,13 @@ enum LightClusterGridShader_MapSlot {
};
enum LightClusterGridShader_BufferSlot {
LIGHT_CLUSTER_GRID_FRUSTUM_GRID_SLOT = 0,
DEFERRED_FRAME_TRANSFORM_BUFFER_SLOT =1,
CAMERA_CORRECTION_BUFFER_SLOT = 2,
DEFERRED_FRAME_TRANSFORM_BUFFER_SLOT = 0,
CAMERA_CORRECTION_BUFFER_SLOT = 1,
LIGHT_GPU_SLOT = render::ShapePipeline::Slot::LIGHT,
LIGHT_INDEX_GPU_SLOT = 5,
LIGHT_CLUSTER_GRID_CLUSTER_GRID_SLOT = 6,
LIGHT_CLUSTER_GRID_CLUSTER_CONTENT_SLOT = 7,
LIGHT_INDEX_GPU_SLOT = 7,
LIGHT_CLUSTER_GRID_FRUSTUM_GRID_SLOT = 8,
LIGHT_CLUSTER_GRID_CLUSTER_GRID_SLOT = 9,
LIGHT_CLUSTER_GRID_CLUSTER_CONTENT_SLOT = 10,
};
FrustumGrid::FrustumGrid(const FrustumGrid& source) :