Avoid draw calls when any push constants are not set.
Some checks failed
CMake on multiple platforms / build (Release, cl, cl, windows-latest) (push) Has been cancelled
CMake on multiple platforms / build (Release, clang, clang++, macos-latest) (push) Has been cancelled
CMake on multiple platforms / build (Release, clang, clang++, ubuntu-latest) (push) Has been cancelled
CMake on multiple platforms / build (Release, gcc, g++, ubuntu-latest) (push) Has been cancelled
Some checks failed
CMake on multiple platforms / build (Release, cl, cl, windows-latest) (push) Has been cancelled
CMake on multiple platforms / build (Release, clang, clang++, macos-latest) (push) Has been cancelled
CMake on multiple platforms / build (Release, clang, clang++, ubuntu-latest) (push) Has been cancelled
CMake on multiple platforms / build (Release, gcc, g++, ubuntu-latest) (push) Has been cancelled
This commit is contained in:
@@ -134,9 +134,9 @@ void KRAmbientZone::render(RenderInfo& ri)
|
||||
info.vertexAttributes = sphereModel->getVertexAttributes();
|
||||
|
||||
KRPipeline* pPipeline = getContext().getPipelineManager()->getPipeline(*ri.surface, info);
|
||||
pPipeline->bind(ri, sphereModelMatrix);
|
||||
|
||||
if (pPipeline->bind(ri, sphereModelMatrix)) {
|
||||
sphereModel->renderNoMaterials(ri.commandBuffer, ri.renderPass, getName(), "visualize_overlay", 1.0f);
|
||||
}
|
||||
} // sphereModel
|
||||
}
|
||||
}
|
||||
|
||||
@@ -156,9 +156,9 @@ void KRAudioSource::render(RenderInfo& ri)
|
||||
info.vertexAttributes = sphereModel->getVertexAttributes();
|
||||
|
||||
KRPipeline* pShader = getContext().getPipelineManager()->getPipeline(*ri.surface, info);
|
||||
pShader->bind(ri, sphereModelMatrix);
|
||||
|
||||
if (pShader->bind(ri, sphereModelMatrix)) {
|
||||
sphereModel->renderNoMaterials(ri.commandBuffer, ri.renderPass, getName(), "visualize_overlay", 1.0f);
|
||||
}
|
||||
} // sphereModels.size()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,9 +96,9 @@ void KRBone::render(RenderInfo& ri)
|
||||
info.vertexAttributes = sphereModel->getVertexAttributes();
|
||||
|
||||
KRPipeline* pShader = getContext().getPipelineManager()->getPipeline(*ri.surface, info);
|
||||
pShader->bind(ri, sphereModelMatrix);
|
||||
|
||||
if (pShader->bind(ri, sphereModelMatrix)) {
|
||||
sphereModel->renderNoMaterials(ri.commandBuffer, ri.renderPass, getName(), "visualize_overlay", 1.0f);
|
||||
}
|
||||
} // sphereModel
|
||||
}
|
||||
}
|
||||
|
||||
@@ -167,12 +167,13 @@ void KRCamera::render(KRNode::RenderInfo& ri)
|
||||
|
||||
KRPipeline* pPipeline = getContext().getPipelineManager()->getPipeline(*ri.surface, info);
|
||||
pPipeline->setImageBinding("diffuseTexture", m_skyBox.val.get(), getContext().getSamplerManager()->DEFAULT_CLAMPED_SAMPLER);
|
||||
pPipeline->bind(ri, Matrix4());
|
||||
if (pPipeline->bind(ri, Matrix4())) {
|
||||
|
||||
// Render a full screen quad
|
||||
m_pContext->getMeshManager()->bindVBO(ri.commandBuffer, &getContext().getMeshManager()->KRENGINE_VBO_DATA_2D_SQUARE_VERTICES, 1.0f);
|
||||
vkCmdDraw(ri.commandBuffer, 4, 1, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
GL_POP_GROUP_MARKER;
|
||||
}
|
||||
@@ -631,11 +632,12 @@ void KRCamera::renderDebug(RenderInfo& ri)
|
||||
KRPipeline* fontShader = m_pContext->getPipelineManager()->getPipeline(*ri.surface, info);
|
||||
|
||||
fontShader->setImageBinding("fontTexture", fontTexture, getContext().getSamplerManager()->DEFAULT_CLAMPED_SAMPLER);
|
||||
fontShader->bind(ri, Matrix4());
|
||||
if (fontShader->bind(ri, Matrix4())) {
|
||||
|
||||
m_debug_text_vbo_data.bind(ri.commandBuffer);
|
||||
|
||||
vkCmdDraw(ri.commandBuffer, vertex_count, 1, 0, 0);
|
||||
}
|
||||
|
||||
m_debug_text_vertices.unlock();
|
||||
}
|
||||
|
||||
@@ -222,9 +222,9 @@ void KRCollider::render(RenderInfo& ri)
|
||||
|
||||
KRPipeline* pShader = getContext().getPipelineManager()->getPipeline(*ri.surface, info);
|
||||
|
||||
pShader->bind(ri, getModelMatrix());
|
||||
|
||||
if (pShader->bind(ri, getModelMatrix())) {
|
||||
m_model.val.get()->renderNoMaterials(ri.commandBuffer, ri.renderPass, getName(), "visualize_overlay", 1.0f);
|
||||
}
|
||||
|
||||
GL_POP_GROUP_MARKER;
|
||||
}
|
||||
|
||||
@@ -160,12 +160,12 @@ void KRDirectionalLight::render(RenderInfo& ri)
|
||||
|
||||
KRPipeline* pShader = getContext().getPipelineManager()->getPipeline(*ri.surface, info);
|
||||
pShader->setPushConstant(ShaderValue::light_direction_view_space, light_direction_view_space);
|
||||
pShader->bind(ri, getModelMatrix()); // TODO: Need to pass in the light index to the shader
|
||||
|
||||
if (pShader->bind(ri, getModelMatrix())) { // TODO: Need to pass in the light index to the shader
|
||||
// Render a full screen quad
|
||||
m_pContext->getMeshManager()->bindVBO(ri.commandBuffer, &vertices, 1.0f);
|
||||
vkCmdDraw(ri.commandBuffer, 4, 1, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
ri.reflectedObjects.pop_back();
|
||||
}
|
||||
|
||||
@@ -229,7 +229,7 @@ void KRLight::render(RenderInfo& ri)
|
||||
|
||||
pParticleShader->setPushConstant(ShaderValue::dust_particle_color, m_color.val * ri.camera->settings.dust_particle_intensity * m_dust_particle_intensity * m_intensity);
|
||||
pParticleShader->setPushConstant(ShaderValue::particle_origin, Matrix4::DotWDiv(Matrix4::Invert(particleModelMatrix), Vector3::Zero()));
|
||||
pParticleShader->bind(ri, particleModelMatrix); // TODO: Pass light index to shader
|
||||
if (pParticleShader->bind(ri, particleModelMatrix)) { // TODO: Pass light index to shader
|
||||
|
||||
m_pContext->getMeshManager()->bindVBO(ri.commandBuffer, &m_pContext->getMeshManager()->KRENGINE_VBO_DATA_RANDOM_PARTICLES, 1.0f);
|
||||
|
||||
@@ -237,6 +237,7 @@ void KRLight::render(RenderInfo& ri)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (ri.renderPass->getType() == RenderPassType::RENDER_PASS_VOLUMETRIC_EFFECTS_ADDITIVE && ri.camera->settings.volumetric_environment_enable && m_light_shafts) {
|
||||
@@ -474,11 +475,11 @@ void KRLight::renderShadowBuffers(RenderInfo& ri)
|
||||
KRPipeline* shadowShader = m_pContext->getPipelineManager()->getPipeline(*ri.surface, info);
|
||||
|
||||
ri.viewport = &m_shadowViewports[iShadow];
|
||||
shadowShader->bind(ri, Matrix4());
|
||||
|
||||
if (shadowShader->bind(ri, Matrix4())) {
|
||||
getScene().render(ri);
|
||||
}
|
||||
}
|
||||
}
|
||||
ri.viewport = prevViewport;
|
||||
}
|
||||
|
||||
|
||||
@@ -102,13 +102,13 @@ void KRParticleSystemNewtonian::render(RenderInfo& ri)
|
||||
info.modelFormat = ModelFormat::KRENGINE_MODEL_FORMAT_TRIANGLES;
|
||||
|
||||
KRPipeline* pParticleShader = m_pContext->getPipelineManager()->getPipeline(*ri.surface, info);
|
||||
pParticleShader->bind(ri, getModelMatrix());
|
||||
|
||||
if (pParticleShader->bind(ri, getModelMatrix())) {
|
||||
m_pContext->getMeshManager()->bindVBO(ri.commandBuffer, &m_pContext->getMeshManager()->KRENGINE_VBO_DATA_RANDOM_PARTICLES, 1.0f);
|
||||
|
||||
vkCmdDraw(ri.commandBuffer, particle_count * 3, 1, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool KRParticleSystemNewtonian::getShaderValue(ShaderValue value, float* output) const
|
||||
|
||||
@@ -116,7 +116,7 @@ void KRPointLight::render(RenderInfo& ri)
|
||||
info.modelFormat = bInsideLight ? ModelFormat::KRENGINE_MODEL_FORMAT_STRIP : ModelFormat::KRENGINE_MODEL_FORMAT_TRIANGLES;
|
||||
|
||||
KRPipeline* pShader = getContext().getPipelineManager()->getPipeline(*ri.surface, info);
|
||||
pShader->bind(ri, sphereModelMatrix); // TODO: Pass light index to shader
|
||||
if (pShader->bind(ri, sphereModelMatrix)) { // TODO: Pass light index to shader
|
||||
|
||||
if (bInsideLight) {
|
||||
// Render a full screen quad
|
||||
@@ -130,6 +130,7 @@ void KRPointLight::render(RenderInfo& ri)
|
||||
|
||||
vkCmdDraw(ri.commandBuffer, m_cVertices, 1, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -131,10 +131,9 @@ void KRReverbZone::render(RenderInfo& ri)
|
||||
info.vertexAttributes = sphereModel->getVertexAttributes();
|
||||
|
||||
KRPipeline* pShader = getContext().getPipelineManager()->getPipeline(*ri.surface, info);
|
||||
|
||||
pShader->bind(ri, sphereModelMatrix);
|
||||
|
||||
if (pShader->bind(ri, sphereModelMatrix)) {
|
||||
sphereModel->renderNoMaterials(ri.commandBuffer, ri.renderPass, getName(), "visualize_overlay", 1.0f);
|
||||
}
|
||||
} // sphereModel
|
||||
}
|
||||
}
|
||||
|
||||
@@ -137,13 +137,13 @@ void KRSprite::render(RenderInfo& ri)
|
||||
|
||||
KRPipeline* pShader = getContext().getPipelineManager()->getPipeline(*ri.surface, info);
|
||||
pShader->setImageBinding("diffuseTexture", m_spriteTexture.val.get(), m_pContext->getSamplerManager()->DEFAULT_CLAMPED_SAMPLER);
|
||||
pShader->bind(ri, getModelMatrix());
|
||||
|
||||
if (pShader->bind(ri, getModelMatrix())) {
|
||||
m_pContext->getMeshManager()->bindVBO(ri.commandBuffer, &vertices, 1.0f);
|
||||
vkCmdDraw(ri.commandBuffer, 4, 1, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool KRSprite::getShaderValue(ShaderValue value, float* output) const
|
||||
|
||||
Reference in New Issue
Block a user