Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1127)

Unified Diff: src/gpu/vk/GrVkPipeline.cpp

Issue 2098933002: Fix check for maxVertexAttributes in GrVkPipeline (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: remove old code Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests/PrimitiveProcessorTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/vk/GrVkPipeline.cpp
diff --git a/src/gpu/vk/GrVkPipeline.cpp b/src/gpu/vk/GrVkPipeline.cpp
index 8227e12cb1bda49b50844ea8857533d529c9312d..0ba111af0990c522ddafc20e10a3c326125f7cea 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);
« no previous file with comments | « no previous file | tests/PrimitiveProcessorTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698