void GrVkPipelineState::BuildStateKey(const GrPipeline& pipeline, GrPrimitiveType primitiveType, SkTArray<uint8_t, true>* key) { // Save room for the key length and key header key->reset(); key->push_back_n(kData_StateKeyOffset); GrProcessorKeyBuilder b(key); GrVkRenderTarget* vkRT = (GrVkRenderTarget*)pipeline.getRenderTarget(); vkRT->simpleRenderPass()->genKey(&b); pipeline.getStencil().genKey(&b); SkASSERT(sizeof(GrPipelineBuilder::DrawFace) <= sizeof(uint32_t)); b.add32(pipeline.getDrawFace()); b.add32(get_blend_info_key(pipeline)); b.add32(primitiveType); // Set key length int keyLength = key->count(); SkASSERT(0 == (keyLength % 4)); *reinterpret_cast<uint32_t*>(key->begin()) = SkToU32(keyLength); }
void setup_raster_state(const GrVkGpu* gpu, const GrPipeline& pipeline, VkPipelineRasterizationStateCreateInfo* rasterInfo) { memset(rasterInfo, 0, sizeof(VkPipelineRasterizationStateCreateInfo)); rasterInfo->sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO; rasterInfo->pNext = nullptr; rasterInfo->flags = 0; rasterInfo->depthClampEnable = VK_FALSE; rasterInfo->rasterizerDiscardEnable = VK_FALSE; rasterInfo->polygonMode = VK_POLYGON_MODE_FILL; rasterInfo->cullMode = draw_face_to_vk_cull_mode(pipeline.getDrawFace()); rasterInfo->frontFace = VK_FRONT_FACE_COUNTER_CLOCKWISE; rasterInfo->depthBiasEnable = VK_FALSE; rasterInfo->depthBiasConstantFactor = 0.0f; rasterInfo->depthBiasClamp = 0.0f; rasterInfo->depthBiasSlopeFactor = 0.0f; rasterInfo->lineWidth = 1.0f; }