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

Side by Side Diff: src/gpu/vk/GrVkProgramDataManager.h

Issue 1816153002: Set up cache in vulkan to reuse GrVkPrograms (aka VkPipelines) (Closed) Base URL: https://skia.googlesource.com/skia.git@progSamplers
Patch Set: rebase Created 4 years, 9 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/GrVkProgramBuilder.cpp ('k') | src/gpu/vk/GrVkProgramDataManager.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright 2016 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #ifndef GrVkProgramDataManager_DEFINED
9 #define GrVkProgramDataManager_DEFINED
10
11 #include "glsl/GrGLSLProgramDataManager.h"
12
13 #include "vk/GrVkUniformHandler.h"
14
15 class GrVkGpu;
16 class GrVkUniformBuffer;
17
18 class GrVkProgramDataManager : public GrGLSLProgramDataManager {
19 public:
20 typedef GrVkUniformHandler::UniformInfoArray UniformInfoArray;
21
22 GrVkProgramDataManager(const UniformInfoArray&,
23 uint32_t vertexUniformSize,
24 uint32_t fragmentUniformSize);
25
26 void set1f(UniformHandle, float v0) const override;
27 void set1fv(UniformHandle, int arrayCount, const float v[]) const override;
28 void set2f(UniformHandle, float, float) const override;
29 void set2fv(UniformHandle, int arrayCount, const float v[]) const override;
30 void set3f(UniformHandle, float, float, float) const override;
31 void set3fv(UniformHandle, int arrayCount, const float v[]) const override;
32 void set4f(UniformHandle, float, float, float, float) const override;
33 void set4fv(UniformHandle, int arrayCount, const float v[]) const override;
34 // matrices are column-major, the first two upload a single matrix, the latt er two upload
35 // arrayCount matrices into a uniform array.
36 void setMatrix2f(UniformHandle, const float matrix[]) const override;
37 void setMatrix3f(UniformHandle, const float matrix[]) const override;
38 void setMatrix4f(UniformHandle, const float matrix[]) const override;
39 void setMatrix2fv(UniformHandle, int arrayCount, const float matrices[]) con st override;
40 void setMatrix3fv(UniformHandle, int arrayCount, const float matrices[]) con st override;
41 void setMatrix4fv(UniformHandle, int arrayCount, const float matrices[]) con st override;
42
43 // for nvpr only
44 void setPathFragmentInputTransform(VaryingHandle u, int components,
45 const SkMatrix& matrix) const override {
46 SkFAIL("Only supported in NVPR, which is not in vulkan");
47 }
48
49 void uploadUniformBuffers(const GrVkGpu* gpu,
50 GrVkUniformBuffer* vertexBuffer,
51 GrVkUniformBuffer* fragmentBuffer) const;
52 private:
53 struct Uniform {
54 uint32_t fBinding;
55 uint32_t fOffset;
56 SkDEBUGCODE(
57 GrSLType fType;
58 int fArrayCount;
59 uint32_t fSetNumber;
60 );
61 };
62
63 template<int N> inline void setMatrices(UniformHandle, int arrayCount,
64 const float matrices[]) const;
65
66 void* getBufferPtrAndMarkDirty(const Uniform& uni) const;
67
68 uint32_t fVertexUniformSize;
69 uint32_t fFragmentUniformSize;
70
71 SkTArray<Uniform, true> fUniforms;
72
73 mutable SkAutoMalloc fVertexUniformData;
74 mutable SkAutoMalloc fFragmentUniformData;
75 mutable bool fVertexUniformsDirty;
76 mutable bool fFragmentUniformsDirty;
77 };
78
79 #endif
OLDNEW
« no previous file with comments | « src/gpu/vk/GrVkProgramBuilder.cpp ('k') | src/gpu/vk/GrVkProgramDataManager.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698