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

Side by Side Diff: src/gpu/vk/GrVkPipelineState.cpp

Issue 2318143002: Merge building of program desc in Vulkan into one step (Closed)
Patch Set: more cleanup Created 4 years, 3 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 unified diff | Download patch
« no previous file with comments | « src/gpu/vk/GrVkPipelineState.h ('k') | src/gpu/vk/GrVkPipelineStateBuilder.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2016 Google Inc. 2 * Copyright 2016 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "GrVkPipelineState.h" 8 #include "GrVkPipelineState.h"
9 9
10 #include "GrPipeline.h" 10 #include "GrPipeline.h"
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 GR_STATIC_ASSERT(kFirstAdvancedGrBlendEquation - 1 < 4); 476 GR_STATIC_ASSERT(kFirstAdvancedGrBlendEquation - 1 < 4);
477 477
478 uint32_t key = blendInfo.fWriteColor; 478 uint32_t key = blendInfo.fWriteColor;
479 key |= (blendInfo.fSrcBlend << kBlendWriteShift); 479 key |= (blendInfo.fSrcBlend << kBlendWriteShift);
480 key |= (blendInfo.fDstBlend << (kBlendWriteShift + kBlendCoeffShift)); 480 key |= (blendInfo.fDstBlend << (kBlendWriteShift + kBlendCoeffShift));
481 key |= (blendInfo.fEquation << (kBlendWriteShift + 2 * kBlendCoeffShift)); 481 key |= (blendInfo.fEquation << (kBlendWriteShift + 2 * kBlendCoeffShift));
482 482
483 return key; 483 return key;
484 } 484 }
485 485
486 void GrVkPipelineState::BuildStateKey(const GrPipeline& pipeline, GrPrimitiveTyp e primitiveType, 486 bool GrVkPipelineState::Desc::Build(Desc* desc,
487 SkTArray<uint8_t, true>* key) { 487 const GrPrimitiveProcessor& primProc,
488 // Save room for the key length and key header 488 const GrPipeline& pipeline,
489 key->reset(); 489 GrPrimitiveType primitiveType,
490 key->push_back_n(kData_StateKeyOffset); 490 const GrGLSLCaps& caps) {
491 if (!INHERITED::Build(desc, primProc, pipeline, caps)) {
492 return false;
493 }
491 494
492 GrProcessorKeyBuilder b(key); 495 GrProcessorKeyBuilder b(&desc->key());
493
494 GrVkRenderTarget* vkRT = (GrVkRenderTarget*)pipeline.getRenderTarget(); 496 GrVkRenderTarget* vkRT = (GrVkRenderTarget*)pipeline.getRenderTarget();
495 vkRT->simpleRenderPass()->genKey(&b); 497 vkRT->simpleRenderPass()->genKey(&b);
496 498
497 pipeline.getStencil().genKey(&b); 499 pipeline.getStencil().genKey(&b);
498 500
499 SkASSERT(sizeof(GrDrawFace) <= sizeof(uint32_t)); 501 SkASSERT(sizeof(GrDrawFace) <= sizeof(uint32_t));
500 b.add32((int32_t)pipeline.getDrawFace()); 502 b.add32((int32_t)pipeline.getDrawFace());
501 503
502 b.add32(get_blend_info_key(pipeline)); 504 b.add32(get_blend_info_key(pipeline));
503 505
504 b.add32(primitiveType); 506 b.add32(primitiveType);
505 507
506 // Set key length 508 return true;
507 int keyLength = key->count();
508 SkASSERT(0 == (keyLength % 4));
509 *reinterpret_cast<uint32_t*>(key->begin()) = SkToU32(keyLength);
510 } 509 }
OLDNEW
« no previous file with comments | « src/gpu/vk/GrVkPipelineState.h ('k') | src/gpu/vk/GrVkPipelineStateBuilder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698