| Index: src/gpu/vk/GrVkPipeline.cpp
|
| diff --git a/src/gpu/vk/GrVkPipeline.cpp b/src/gpu/vk/GrVkPipeline.cpp
|
| index c7e99d2ee4f4018e64f80890dcbdb8aab33142c7..910398183b1911f54cc2410ef347de500afe13ac 100644
|
| --- a/src/gpu/vk/GrVkPipeline.cpp
|
| +++ b/src/gpu/vk/GrVkPipeline.cpp
|
| @@ -95,7 +95,7 @@ static void setup_input_assembly_state(GrPrimitiveType primitiveType,
|
| }
|
|
|
|
|
| -VkStencilOp stencil_op_to_vk_stencil_op(GrStencilOp op) {
|
| +static VkStencilOp stencil_op_to_vk_stencil_op(GrStencilOp op) {
|
| static const VkStencilOp gTable[] = {
|
| VK_STENCIL_OP_KEEP, // kKeep
|
| VK_STENCIL_OP_ZERO, // kZero
|
| @@ -119,7 +119,7 @@ VkStencilOp stencil_op_to_vk_stencil_op(GrStencilOp op) {
|
| return gTable[(int)op];
|
| }
|
|
|
| -VkCompareOp stencil_func_to_vk_compare_op(GrStencilTest test) {
|
| +static VkCompareOp stencil_func_to_vk_compare_op(GrStencilTest test) {
|
| static const VkCompareOp gTable[] = {
|
| VK_COMPARE_OP_ALWAYS, // kAlways
|
| VK_COMPARE_OP_NEVER, // kNever
|
| @@ -144,9 +144,8 @@ VkCompareOp stencil_func_to_vk_compare_op(GrStencilTest test) {
|
| return gTable[(int)test];
|
| }
|
|
|
| -void setup_depth_stencil_state(const GrVkGpu* gpu,
|
| - const GrStencilSettings& stencilSettings,
|
| - VkPipelineDepthStencilStateCreateInfo* stencilInfo) {
|
| +static void setup_depth_stencil_state(const GrStencilSettings& stencilSettings,
|
| + VkPipelineDepthStencilStateCreateInfo* stencilInfo) {
|
| memset(stencilInfo, 0, sizeof(VkPipelineDepthStencilStateCreateInfo));
|
| stencilInfo->sType = VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO;
|
| stencilInfo->pNext = nullptr;
|
| @@ -186,10 +185,7 @@ void setup_depth_stencil_state(const GrVkGpu* gpu,
|
| stencilInfo->maxDepthBounds = 1.0f;
|
| }
|
|
|
| -void setup_viewport_scissor_state(const GrVkGpu* gpu,
|
| - const GrPipeline& pipeline,
|
| - const GrVkRenderTarget* vkRT,
|
| - VkPipelineViewportStateCreateInfo* viewportInfo) {
|
| +static void setup_viewport_scissor_state(VkPipelineViewportStateCreateInfo* viewportInfo) {
|
| memset(viewportInfo, 0, sizeof(VkPipelineViewportStateCreateInfo));
|
| viewportInfo->sType = VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO;
|
| viewportInfo->pNext = nullptr;
|
| @@ -204,10 +200,10 @@ void setup_viewport_scissor_state(const GrVkGpu* gpu,
|
| SkASSERT(viewportInfo->viewportCount == viewportInfo->scissorCount);
|
| }
|
|
|
| -void setup_multisample_state(const GrPipeline& pipeline,
|
| - const GrPrimitiveProcessor& primProc,
|
| - const GrCaps* caps,
|
| - VkPipelineMultisampleStateCreateInfo* multisampleInfo) {
|
| +static void setup_multisample_state(const GrPipeline& pipeline,
|
| + const GrPrimitiveProcessor& primProc,
|
| + const GrCaps* caps,
|
| + VkPipelineMultisampleStateCreateInfo* multisampleInfo) {
|
| memset(multisampleInfo, 0, sizeof(VkPipelineMultisampleStateCreateInfo));
|
| multisampleInfo->sType = VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO;
|
| multisampleInfo->pNext = nullptr;
|
| @@ -286,7 +282,7 @@ static VkBlendOp blend_equation_to_vk_blend_op(GrBlendEquation equation) {
|
| return gTable[equation];
|
| }
|
|
|
| -bool blend_coeff_refs_constant(GrBlendCoeff coeff) {
|
| +static bool blend_coeff_refs_constant(GrBlendCoeff coeff) {
|
| static const bool gCoeffReferencesBlendConst[] = {
|
| false,
|
| false,
|
| @@ -314,10 +310,9 @@ bool blend_coeff_refs_constant(GrBlendCoeff coeff) {
|
| // Individual enum asserts already made in blend_coeff_to_vk_blend
|
| }
|
|
|
| -void setup_color_blend_state(const GrVkGpu* gpu,
|
| - const GrPipeline& pipeline,
|
| - VkPipelineColorBlendStateCreateInfo* colorBlendInfo,
|
| - VkPipelineColorBlendAttachmentState* attachmentState) {
|
| +static void setup_color_blend_state(const GrPipeline& pipeline,
|
| + VkPipelineColorBlendStateCreateInfo* colorBlendInfo,
|
| + VkPipelineColorBlendAttachmentState* attachmentState) {
|
| GrXferProcessor::BlendInfo blendInfo;
|
| pipeline.getXferProcessor().getBlendInfo(&blendInfo);
|
|
|
| @@ -355,7 +350,7 @@ void setup_color_blend_state(const GrVkGpu* gpu,
|
| // colorBlendInfo->blendConstants is set dynamically
|
| }
|
|
|
| -VkCullModeFlags draw_face_to_vk_cull_mode(GrDrawFace drawFace) {
|
| +static VkCullModeFlags draw_face_to_vk_cull_mode(GrDrawFace drawFace) {
|
| // Assumes that we've set the front face to be ccw
|
| static const VkCullModeFlags gTable[] = {
|
| VK_CULL_MODE_NONE, // kBoth_DrawFace
|
| @@ -370,9 +365,8 @@ VkCullModeFlags draw_face_to_vk_cull_mode(GrDrawFace drawFace) {
|
| return gTable[(int)drawFace];
|
| }
|
|
|
| -void setup_raster_state(const GrVkGpu* gpu,
|
| - const GrPipeline& pipeline,
|
| - VkPipelineRasterizationStateCreateInfo* rasterInfo) {
|
| +static void setup_raster_state(const GrPipeline& pipeline,
|
| + VkPipelineRasterizationStateCreateInfo* rasterInfo) {
|
| memset(rasterInfo, 0, sizeof(VkPipelineRasterizationStateCreateInfo));
|
| rasterInfo->sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO;
|
| rasterInfo->pNext = nullptr;
|
| @@ -389,10 +383,8 @@ void setup_raster_state(const GrVkGpu* gpu,
|
| rasterInfo->lineWidth = 1.0f;
|
| }
|
|
|
| -void setup_dynamic_state(const GrVkGpu* gpu,
|
| - const GrPipeline& pipeline,
|
| - VkPipelineDynamicStateCreateInfo* dynamicInfo,
|
| - VkDynamicState* dynamicStates) {
|
| +static void setup_dynamic_state(VkPipelineDynamicStateCreateInfo* dynamicInfo,
|
| + VkDynamicState* dynamicStates) {
|
| memset(dynamicInfo, 0, sizeof(VkPipelineDynamicStateCreateInfo));
|
| dynamicInfo->sType = VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO;
|
| dynamicInfo->pNext = VK_NULL_HANDLE;
|
| @@ -423,12 +415,10 @@ GrVkPipeline* GrVkPipeline::Create(GrVkGpu* gpu, const GrPipeline& pipeline,
|
| setup_input_assembly_state(primitiveType, &inputAssemblyInfo);
|
|
|
| VkPipelineDepthStencilStateCreateInfo depthStencilInfo;
|
| - setup_depth_stencil_state(gpu, pipeline.getStencil(), &depthStencilInfo);
|
| + setup_depth_stencil_state(pipeline.getStencil(), &depthStencilInfo);
|
|
|
| - GrRenderTarget* rt = pipeline.getRenderTarget();
|
| - GrVkRenderTarget* vkRT = static_cast<GrVkRenderTarget*>(rt);
|
| VkPipelineViewportStateCreateInfo viewportInfo;
|
| - setup_viewport_scissor_state(gpu, pipeline, vkRT, &viewportInfo);
|
| + setup_viewport_scissor_state(&viewportInfo);
|
|
|
| VkPipelineMultisampleStateCreateInfo multisampleInfo;
|
| setup_multisample_state(pipeline, primProc, gpu->caps(), &multisampleInfo);
|
| @@ -436,14 +426,14 @@ GrVkPipeline* GrVkPipeline::Create(GrVkGpu* gpu, const GrPipeline& pipeline,
|
| // We will only have one color attachment per pipeline.
|
| VkPipelineColorBlendAttachmentState attachmentStates[1];
|
| VkPipelineColorBlendStateCreateInfo colorBlendInfo;
|
| - setup_color_blend_state(gpu, pipeline, &colorBlendInfo, attachmentStates);
|
| + setup_color_blend_state(pipeline, &colorBlendInfo, attachmentStates);
|
|
|
| VkPipelineRasterizationStateCreateInfo rasterInfo;
|
| - setup_raster_state(gpu, pipeline, &rasterInfo);
|
| + setup_raster_state(pipeline, &rasterInfo);
|
|
|
| VkDynamicState dynamicStates[3];
|
| VkPipelineDynamicStateCreateInfo dynamicInfo;
|
| - setup_dynamic_state(gpu, pipeline, &dynamicInfo, dynamicStates);
|
| + setup_dynamic_state(&dynamicInfo, dynamicStates);
|
|
|
| VkGraphicsPipelineCreateInfo pipelineCreateInfo;
|
| memset(&pipelineCreateInfo, 0, sizeof(VkGraphicsPipelineCreateInfo));
|
| @@ -483,10 +473,10 @@ void GrVkPipeline::freeGPUData(const GrVkGpu* gpu) const {
|
| GR_VK_CALL(gpu->vkInterface(), DestroyPipeline(gpu->device(), fPipeline, nullptr));
|
| }
|
|
|
| -void set_dynamic_scissor_state(GrVkGpu* gpu,
|
| - GrVkCommandBuffer* cmdBuffer,
|
| - const GrPipeline& pipeline,
|
| - const GrRenderTarget& target) {
|
| +static void set_dynamic_scissor_state(GrVkGpu* gpu,
|
| + GrVkCommandBuffer* cmdBuffer,
|
| + const GrPipeline& pipeline,
|
| + const GrRenderTarget& target) {
|
| // We always use one scissor and if it is disabled we just make it the size of the RT
|
| const GrScissorState& scissorState = pipeline.getScissorState();
|
| VkRect2D scissor;
|
| @@ -516,9 +506,9 @@ void set_dynamic_scissor_state(GrVkGpu* gpu,
|
| cmdBuffer->setScissor(gpu, 0, 1, &scissor);
|
| }
|
|
|
| -void set_dynamic_viewport_state(GrVkGpu* gpu,
|
| - GrVkCommandBuffer* cmdBuffer,
|
| - const GrRenderTarget& target) {
|
| +static void set_dynamic_viewport_state(GrVkGpu* gpu,
|
| + GrVkCommandBuffer* cmdBuffer,
|
| + const GrRenderTarget& target) {
|
| // We always use one viewport the size of the RT
|
| VkViewport viewport;
|
| viewport.x = 0.0f;
|
| @@ -530,9 +520,9 @@ void set_dynamic_viewport_state(GrVkGpu* gpu,
|
| cmdBuffer->setViewport(gpu, 0, 1, &viewport);
|
| }
|
|
|
| -void set_dynamic_blend_constant_state(GrVkGpu* gpu,
|
| - GrVkCommandBuffer* cmdBuffer,
|
| - const GrPipeline& pipeline) {
|
| +static void set_dynamic_blend_constant_state(GrVkGpu* gpu,
|
| + GrVkCommandBuffer* cmdBuffer,
|
| + const GrPipeline& pipeline) {
|
| GrXferProcessor::BlendInfo blendInfo;
|
| pipeline.getXferProcessor().getBlendInfo(&blendInfo);
|
| GrBlendCoeff srcCoeff = blendInfo.fSrcBlend;
|
|
|