From 2194cef2a8be4f76266b177d07cd8ab63bff5b88 Mon Sep 17 00:00:00 2001 From: HuYingzhuo Date: Tue, 16 Apr 2019 14:17:39 +0800 Subject: [PATCH] =?UTF-8?q?VertexInput::Add=E5=A2=9E=E5=8A=A0instance?= =?UTF-8?q?=E8=BE=93=E5=85=A5=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- example/Vulkan/VKVertexInput.cpp | 6 +++--- example/Vulkan/VKVertexInput.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/example/Vulkan/VKVertexInput.cpp b/example/Vulkan/VKVertexInput.cpp index 442b53af..775d6a1a 100644 --- a/example/Vulkan/VKVertexInput.cpp +++ b/example/Vulkan/VKVertexInput.cpp @@ -11,19 +11,19 @@ VK_NAMESPACE_BEGIN // Buffer *buf; //}; -bool VertexInput::Add(VertexBuffer *buf) +bool VertexInput::Add(VertexBuffer *buf,bool instance) { if(!buf) return(false); - const int binding_index=vib_list.GetCount(); //参考opengl vab,binding_index必须从0开始,紧密排列,但是否必须这样,待以后测试 + const int binding_index=vib_list.GetCount(); //参考opengl vab,binding_index必须从0开始,紧密排列。对应在vkCmdBindVertexBuffer中的缓冲区索引 VkVertexInputBindingDescription binding; VkVertexInputAttributeDescription attrib; binding.binding=binding_index; binding.stride=buf->GetStride(); - binding.inputRate=VK_VERTEX_INPUT_RATE_VERTEX; //还有一种是INSTANCE,暂时未知 + binding.inputRate=instance?VK_VERTEX_INPUT_RATE_INSTANCE:VK_VERTEX_INPUT_RATE_VERTEX; attrib.binding=binding_index; attrib.location=0; diff --git a/example/Vulkan/VKVertexInput.h b/example/Vulkan/VKVertexInput.h index b1471195..4bc94b80 100644 --- a/example/Vulkan/VKVertexInput.h +++ b/example/Vulkan/VKVertexInput.h @@ -33,7 +33,7 @@ class VertexInput public: - bool Add(VertexBuffer *); + bool Add(VertexBuffer *,bool instance=false); public: