aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/vk
diff options
context:
space:
mode:
authorGravatar egdaniel <egdaniel@google.com>2016-06-27 07:15:20 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-06-27 07:15:20 -0700
commitb05df0ff261d7819da55509df03fb4525af49b40 (patch)
tree4895a0e9368bd9888fe2dd351b56f1ee631eddef /src/gpu/vk
parent81700f69b0021025c6b966aae11c76bb1b08e3b2 (diff)
Fix check for maxVertexAttributes in GrVkPipeline
Diffstat (limited to 'src/gpu/vk')
-rw-r--r--src/gpu/vk/GrVkPipeline.cpp13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/gpu/vk/GrVkPipeline.cpp b/src/gpu/vk/GrVkPipeline.cpp
index 8227e12cb1..0ba111af09 100644
--- a/src/gpu/vk/GrVkPipeline.cpp
+++ b/src/gpu/vk/GrVkPipeline.cpp
@@ -41,8 +41,7 @@ static void setup_vertex_input_state(const GrPrimitiveProcessor& primProc,
VkPipelineVertexInputStateCreateInfo* vertexInputInfo,
VkVertexInputBindingDescription* bindingDesc,
int maxBindingDescCount,
- VkVertexInputAttributeDescription* attributeDesc,
- int maxAttributeDescCount) {
+ VkVertexInputAttributeDescription* attributeDesc) {
// for now we have only one vertex buffer and one binding
memset(bindingDesc, 0, sizeof(VkVertexInputBindingDescription));
bindingDesc->binding = 0;
@@ -51,7 +50,6 @@ static void setup_vertex_input_state(const GrPrimitiveProcessor& primProc,
// setup attribute descriptions
int vaCount = primProc.numAttribs();
- SkASSERT(vaCount < maxAttributeDescCount);
if (vaCount > 0) {
size_t offset = 0;
for (int attribIndex = 0; attribIndex < vaCount; attribIndex++) {
@@ -417,11 +415,10 @@ GrVkPipeline* GrVkPipeline::Create(GrVkGpu* gpu, const GrPipeline& pipeline,
VkPipelineCache cache) {
VkPipelineVertexInputStateCreateInfo vertexInputInfo;
VkVertexInputBindingDescription bindingDesc;
- // TODO: allocate this based on VkPhysicalDeviceLimits::maxVertexInputAttributes
- static const int kMaxVertexAttributes = 16;
- static VkVertexInputAttributeDescription attributeDesc[kMaxVertexAttributes];
- setup_vertex_input_state(primProc, &vertexInputInfo, &bindingDesc, 1,
- attributeDesc, kMaxVertexAttributes);
+ SkSTArray<16, VkVertexInputAttributeDescription> attributeDesc;
+ SkASSERT(primProc.numAttribs() <= gpu->vkCaps().maxVertexAttributes());
+ VkVertexInputAttributeDescription* pAttribs = attributeDesc.push_back_n(primProc.numAttribs());
+ setup_vertex_input_state(primProc, &vertexInputInfo, &bindingDesc, 1, pAttribs);
VkPipelineInputAssemblyStateCreateInfo inputAssemblyInfo;
setup_input_assembly_state(primitiveType, &inputAssemblyInfo);