2 * Copyright 2016 Google Inc.
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
8 #ifndef GrVkPipelineStateDataManager_DEFINED
9 #define GrVkPipelineStateDataManager_DEFINED
11 #include "src/gpu/ganesh/GrUniformDataManager.h"
13 #include "include/gpu/vk/GrVkTypes.h"
14 #include "src/gpu/ganesh/vk/GrVkUniformHandler.h"
17 class GrVkCommandBuffer;
20 class GrVkPipelineStateDataManager : public GrUniformDataManager {
22 typedef GrVkUniformHandler::UniformInfoArray UniformInfoArray;
24 GrVkPipelineStateDataManager(const UniformInfoArray&, uint32_t uniformSize,
25 bool usePushConstants);
27 // Returns the uniform buffer that holds all the uniform data. If there are no uniforms it
28 // returns nullptr. If there was an error in creating or uploading the uniforms the value of the
29 // returned bool will be false and the buffer will be nullptr. Otherwise the bool will be true.
30 std::pair<sk_sp<GrGpuBuffer>, bool> uploadUniforms(GrVkGpu* gpu, VkPipelineLayout,
31 GrVkCommandBuffer* commandBuffer);
35 // TODO: we might need more of these once std430 size/alignment issues are worked out
36 void set1iv(UniformHandle, int arrayCount, const int32_t v[]) const override;
37 void set1fv(UniformHandle, int arrayCount, const float v[]) const override;
38 void set2iv(UniformHandle, int arrayCount, const int32_t v[]) const override;
39 void set2fv(UniformHandle, int arrayCount, const float v[]) const override;
40 void setMatrix2fv(UniformHandle, int arrayCount, const float matrices[]) const override;
43 sk_sp<GrGpuBuffer> fUniformBuffer;
44 bool fUsePushConstants;
46 using INHERITED = GrUniformDataManager;