Remove include of GrGLProgramBuilder.h from GrGLProgram.h and GrVkPipelineState.h
Make GrGLProgram and GrCkPipelineState cons. public and remove builder friendship.
Neither GrGLProgram nor GrVkPipelineState need to know their Desc so remove it.
Move the VK desc subclass defn. to GrVkPipelineStateBuilder since it needs it while
GrVkPipelineState does not.
Some IWYU improvements.
Move declaration of the built-in uniform struct to GrGLSLUniformHandler.h from GrGLSLProgramBuilder.h.
Change-Id: Ib46817408a83a79a0f718ba2bc19411410d9065a
Reviewed-on: https://skia-review.googlesource.com/133060
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
diff --git a/src/gpu/vk/GrVkPipelineState.h b/src/gpu/vk/GrVkPipelineState.h
index 92fa5e5..2ea01c1 100644
--- a/src/gpu/vk/GrVkPipelineState.h
+++ b/src/gpu/vk/GrVkPipelineState.h
@@ -9,16 +9,13 @@
#ifndef GrVkPipelineState_DEFINED
#define GrVkPipelineState_DEFINED
-#include "GrProgramDesc.h"
-#include "GrStencilSettings.h"
#include "GrVkDescriptorSetManager.h"
-#include "GrVkImage.h"
#include "GrVkPipelineStateDataManager.h"
#include "glsl/GrGLSLProgramBuilder.h"
-
#include "vk/GrVkDefines.h"
class GrPipeline;
+class GrStencilSettings;
class GrVkBufferView;
class GrVkCommandBuffer;
class GrVkDescriptorPool;
@@ -37,12 +34,28 @@
*/
class GrVkPipelineState : public SkRefCnt {
public:
- typedef GrGLSLProgramBuilder::BuiltinUniformHandles BuiltinUniformHandles;
+ using UniformInfoArray = GrVkPipelineStateDataManager::UniformInfoArray;
+ using UniformHandle = GrGLSLProgramDataManager::UniformHandle;
+
+ GrVkPipelineState(
+ GrVkGpu* gpu,
+ GrVkPipeline* pipeline,
+ VkPipelineLayout layout,
+ const GrVkDescriptorSetManager::Handle& samplerDSHandle,
+ const GrVkDescriptorSetManager::Handle& texelBufferDSHandle,
+ const GrGLSLBuiltinUniformHandles& builtinUniformHandles,
+ const UniformInfoArray& uniforms,
+ uint32_t geometryUniformSize,
+ uint32_t fragmentUniformSize,
+ uint32_t numSamplers,
+ uint32_t numTexelBuffers,
+ std::unique_ptr<GrGLSLPrimitiveProcessor> geometryProcessor,
+ std::unique_ptr<GrGLSLXferProcessor> xferProcessor,
+ std::unique_ptr<std::unique_ptr<GrGLSLFragmentProcessor>[]> fragmentProcessors,
+ int fFragmentProcessorCnt);
~GrVkPipelineState();
- GrVkPipeline* vkPipeline() const { return fPipeline; }
-
void setData(GrVkGpu*, const GrPrimitiveProcessor&, const GrPipeline&);
void bind(const GrVkGpu* gpu, GrVkCommandBuffer* commandBuffer);
@@ -57,55 +70,7 @@
void abandonGPUResources();
- /**
- * For Vulkan we want to cache the entire VkPipeline for reuse of draws. The Desc here holds all
- * the information needed to differentiate one pipeline from another.
- *
- * The GrProgramDesc contains all the information need to create the actual shaders for the
- * pipeline.
- *
- * For Vulkan we need to add to the GrProgramDesc to include the rest of the state on the
- * pipline. This includes stencil settings, blending information, render pass format, draw face
- * information, and primitive type. Note that some state is set dynamically on the pipeline for
- * each draw and thus is not included in this descriptor. This includes the viewport, scissor,
- * and blend constant.
- */
- class Desc : public GrProgramDesc {
- public:
- static bool Build(Desc*,
- const GrPrimitiveProcessor&,
- const GrPipeline&,
- const GrStencilSettings&,
- GrPrimitiveType primitiveType,
- const GrShaderCaps&);
- private:
- typedef GrProgramDesc INHERITED;
- };
-
- const Desc& getDesc() { return fDesc; }
-
private:
- typedef GrVkPipelineStateDataManager::UniformInfoArray UniformInfoArray;
- typedef GrGLSLProgramDataManager::UniformHandle UniformHandle;
-
- GrVkPipelineState(
- GrVkGpu* gpu,
- const GrVkPipelineState::Desc&,
- GrVkPipeline* pipeline,
- VkPipelineLayout layout,
- const GrVkDescriptorSetManager::Handle& samplerDSHandle,
- const GrVkDescriptorSetManager::Handle& texelBufferDSHandle,
- const BuiltinUniformHandles& builtinUniformHandles,
- const UniformInfoArray& uniforms,
- uint32_t geometryUniformSize,
- uint32_t fragmentUniformSize,
- uint32_t numSamplers,
- uint32_t numTexelBuffers,
- std::unique_ptr<GrGLSLPrimitiveProcessor> geometryProcessor,
- std::unique_ptr<GrGLSLXferProcessor> xferProcessor,
- std::unique_ptr<std::unique_ptr<GrGLSLFragmentProcessor>[]> fragmentProcessors,
- int fFragmentProcessorCnt);
-
void writeUniformBuffers(const GrVkGpu* gpu);
void writeSamplers(
@@ -190,7 +155,7 @@
// Tracks the current render target uniforms stored in the vertex buffer.
RenderTargetState fRenderTargetState;
- BuiltinUniformHandles fBuiltinUniformHandles;
+ GrGLSLBuiltinUniformHandles fBuiltinUniformHandles;
// Processors in the GrVkPipelineState
std::unique_ptr<GrGLSLPrimitiveProcessor> fGeometryProcessor;
@@ -198,14 +163,10 @@
std::unique_ptr<std::unique_ptr<GrGLSLFragmentProcessor>[]> fFragmentProcessors;
int fFragmentProcessorCnt;
- Desc fDesc;
-
GrVkPipelineStateDataManager fDataManager;
int fNumSamplers;
int fNumTexelBuffers;
-
- friend class GrVkPipelineStateBuilder;
};
#endif