Added Vulkan versions of KRVBOData::bind and KRPipeline::bind
This commit is contained in:
@@ -809,6 +809,13 @@ void KRMeshManager::KRVBOData::bind()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void KRMeshManager::KRVBOData::bind(VkCommandBuffer& commandBuffer)
|
||||||
|
{
|
||||||
|
VkBuffer vertexBuffers[] = { getVertexBuffer() };
|
||||||
|
VkDeviceSize offsets[] = { 0 };
|
||||||
|
vkCmdBindVertexBuffers(commandBuffer, 0, 1, vertexBuffers, offsets);
|
||||||
|
}
|
||||||
|
|
||||||
void KRMeshManager::KRVBOData::resetPoolExpiry(float lodCoverage)
|
void KRMeshManager::KRVBOData::resetPoolExpiry(float lodCoverage)
|
||||||
{
|
{
|
||||||
long current_frame = m_manager->getContext().getCurrentFrame();
|
long current_frame = m_manager->getContext().getCurrentFrame();
|
||||||
|
|||||||
@@ -96,6 +96,7 @@ public:
|
|||||||
void load();
|
void load();
|
||||||
void unload();
|
void unload();
|
||||||
void bind();
|
void bind();
|
||||||
|
void bind(VkCommandBuffer& commandBuffer);
|
||||||
|
|
||||||
// Disable copy constructors
|
// Disable copy constructors
|
||||||
KRVBOData(const KRVBOData& o) = delete;
|
KRVBOData(const KRVBOData& o) = delete;
|
||||||
|
|||||||
@@ -548,6 +548,11 @@ void KRPipeline::setUniform(int location, const Matrix4 &value)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void KRPipeline::bind(VkCommandBuffer& commandBuffer)
|
||||||
|
{
|
||||||
|
vkCmdBindPipeline(commandBuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, m_graphicsPipeline);
|
||||||
|
}
|
||||||
|
|
||||||
bool KRPipeline::bind(KRCamera &camera, const KRViewport &viewport, const Matrix4 &matModel, const std::vector<KRPointLight *> &point_lights, const std::vector<KRDirectionalLight *> &directional_lights, const std::vector<KRSpotLight *>&spot_lights, const KRNode::RenderPass &renderPass, const Vector3 &rim_color, float rim_power, const Vector4 &fade_color) {
|
bool KRPipeline::bind(KRCamera &camera, const KRViewport &viewport, const Matrix4 &matModel, const std::vector<KRPointLight *> &point_lights, const std::vector<KRDirectionalLight *> &directional_lights, const std::vector<KRSpotLight *>&spot_lights, const KRNode::RenderPass &renderPass, const Vector3 &rim_color, float rim_power, const Vector4 &fade_color) {
|
||||||
if(m_iProgram == 0) {
|
if(m_iProgram == 0) {
|
||||||
return false;
|
return false;
|
||||||
@@ -795,4 +800,4 @@ const char *KRPipeline::getKey() const {
|
|||||||
VkPipeline& KRPipeline::getPipeline()
|
VkPipeline& KRPipeline::getPipeline()
|
||||||
{
|
{
|
||||||
return m_graphicsPipeline;
|
return m_graphicsPipeline;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,7 +51,8 @@ public:
|
|||||||
const char *getKey() const;
|
const char *getKey() const;
|
||||||
|
|
||||||
bool bind(KRCamera &camera, const KRViewport &viewport, const Matrix4 &matModel, const std::vector<KRPointLight *> &point_lights, const std::vector<KRDirectionalLight *> &directional_lights, const std::vector<KRSpotLight *>&spot_lights, const KRNode::RenderPass &renderPass, const Vector3 &rim_color, float rim_power, const Vector4 &fade_color);
|
bool bind(KRCamera &camera, const KRViewport &viewport, const Matrix4 &matModel, const std::vector<KRPointLight *> &point_lights, const std::vector<KRDirectionalLight *> &directional_lights, const std::vector<KRSpotLight *>&spot_lights, const KRNode::RenderPass &renderPass, const Vector3 &rim_color, float rim_power, const Vector4 &fade_color);
|
||||||
|
void bind(VkCommandBuffer& commandBuffer);
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
KRENGINE_UNIFORM_MATERIAL_AMBIENT = 0,
|
KRENGINE_UNIFORM_MATERIAL_AMBIENT = 0,
|
||||||
KRENGINE_UNIFORM_MATERIAL_DIFFUSE,
|
KRENGINE_UNIFORM_MATERIAL_DIFFUSE,
|
||||||
|
|||||||
@@ -168,11 +168,8 @@ void KRPresentationThread::renderFrame()
|
|||||||
|
|
||||||
if (haveMesh) {
|
if (haveMesh) {
|
||||||
KRPipeline* testPipeline = m_pContext->getPipelineManager()->getPipeline(surface, "vulkan_test", testVertices.getVertexAttributes());
|
KRPipeline* testPipeline = m_pContext->getPipelineManager()->getPipeline(surface, "vulkan_test", testVertices.getVertexAttributes());
|
||||||
vkCmdBindPipeline(commandBuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, testPipeline->getPipeline());
|
testPipeline->bind(commandBuffer);
|
||||||
|
testVertices.bind(commandBuffer);
|
||||||
VkBuffer vertexBuffers[] = { testVertices.getVertexBuffer() };
|
|
||||||
VkDeviceSize offsets[] = { 0 };
|
|
||||||
vkCmdBindVertexBuffers(commandBuffer, 0, 1, vertexBuffers, offsets);
|
|
||||||
vkCmdDraw(commandBuffer, 3, 1, 0, 0);
|
vkCmdDraw(commandBuffer, 3, 1, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user