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

Unified Diff: src/gpu/vk/GrVkPipelineStateDataManager.cpp

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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/vk/GrVkPipelineStateDataManager.h ('k') | src/gpu/vk/GrVkProgram.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/vk/GrVkPipelineStateDataManager.cpp
diff --git a/src/gpu/vk/GrVkProgramDataManager.cpp b/src/gpu/vk/GrVkPipelineStateDataManager.cpp
similarity index 75%
rename from src/gpu/vk/GrVkProgramDataManager.cpp
rename to src/gpu/vk/GrVkPipelineStateDataManager.cpp
index e798cd7460ddb039d3ab0f72c1ca46b33d61a689..76ad4834057f8118e6577fa7fee031776012086a 100644
--- a/src/gpu/vk/GrVkProgramDataManager.cpp
+++ b/src/gpu/vk/GrVkPipelineStateDataManager.cpp
@@ -5,14 +5,14 @@
* found in the LICENSE file.
*/
-#include "GrVkProgramDataManager.h"
+#include "GrVkPipelineStateDataManager.h"
#include "GrVkGpu.h"
#include "GrVkUniformBuffer.h"
-GrVkProgramDataManager::GrVkProgramDataManager(const UniformInfoArray& uniforms,
- uint32_t vertexUniformSize,
- uint32_t fragmentUniformSize)
+GrVkPipelineStateDataManager::GrVkPipelineStateDataManager(const UniformInfoArray& uniforms,
+ uint32_t vertexUniformSize,
+ uint32_t fragmentUniformSize)
: fVertexUniformSize(vertexUniformSize)
, fFragmentUniformSize(fragmentUniformSize)
, fVertexUniformsDirty(false)
@@ -40,7 +40,7 @@ GrVkProgramDataManager::GrVkProgramDataManager(const UniformInfoArray& uniforms,
}
}
-void* GrVkProgramDataManager::getBufferPtrAndMarkDirty(const Uniform& uni) const {
+void* GrVkPipelineStateDataManager::getBufferPtrAndMarkDirty(const Uniform& uni) const {
void* buffer;
if (GrVkUniformHandler::kVertexBinding == uni.fBinding) {
buffer = fVertexUniformData.get();
@@ -55,7 +55,7 @@ void* GrVkProgramDataManager::getBufferPtrAndMarkDirty(const Uniform& uni) const
return buffer;
}
-void GrVkProgramDataManager::set1f(UniformHandle u, float v0) const {
+void GrVkPipelineStateDataManager::set1f(UniformHandle u, float v0) const {
const Uniform& uni = fUniforms[u.toIndex()];
SkASSERT(uni.fType == kFloat_GrSLType);
SkASSERT(GrGLSLShaderVar::kNonArray == uni.fArrayCount);
@@ -65,9 +65,9 @@ void GrVkProgramDataManager::set1f(UniformHandle u, float v0) const {
memcpy(buffer, &v0, sizeof(float));
}
-void GrVkProgramDataManager::set1fv(UniformHandle u,
- int arrayCount,
- const float v[]) const {
+void GrVkPipelineStateDataManager::set1fv(UniformHandle u,
+ int arrayCount,
+ const float v[]) const {
const Uniform& uni = fUniforms[u.toIndex()];
SkASSERT(uni.fType == kFloat_GrSLType);
SkASSERT(arrayCount > 0);
@@ -84,7 +84,7 @@ void GrVkProgramDataManager::set1fv(UniformHandle u,
}
}
-void GrVkProgramDataManager::set2f(UniformHandle u, float v0, float v1) const {
+void GrVkPipelineStateDataManager::set2f(UniformHandle u, float v0, float v1) const {
const Uniform& uni = fUniforms[u.toIndex()];
SkASSERT(uni.fType == kVec2f_GrSLType);
SkASSERT(GrGLSLShaderVar::kNonArray == uni.fArrayCount);
@@ -95,9 +95,9 @@ void GrVkProgramDataManager::set2f(UniformHandle u, float v0, float v1) const {
memcpy(buffer, v, 2 * sizeof(float));
}
-void GrVkProgramDataManager::set2fv(UniformHandle u,
- int arrayCount,
- const float v[]) const {
+void GrVkPipelineStateDataManager::set2fv(UniformHandle u,
+ int arrayCount,
+ const float v[]) const {
const Uniform& uni = fUniforms[u.toIndex()];
SkASSERT(uni.fType == kVec2f_GrSLType);
SkASSERT(arrayCount > 0);
@@ -114,7 +114,7 @@ void GrVkProgramDataManager::set2fv(UniformHandle u,
}
}
-void GrVkProgramDataManager::set3f(UniformHandle u, float v0, float v1, float v2) const {
+void GrVkPipelineStateDataManager::set3f(UniformHandle u, float v0, float v1, float v2) const {
const Uniform& uni = fUniforms[u.toIndex()];
SkASSERT(uni.fType == kVec3f_GrSLType);
SkASSERT(GrGLSLShaderVar::kNonArray == uni.fArrayCount);
@@ -125,9 +125,9 @@ void GrVkProgramDataManager::set3f(UniformHandle u, float v0, float v1, float v2
memcpy(buffer, v, 3 * sizeof(float));
}
-void GrVkProgramDataManager::set3fv(UniformHandle u,
- int arrayCount,
- const float v[]) const {
+void GrVkPipelineStateDataManager::set3fv(UniformHandle u,
+ int arrayCount,
+ const float v[]) const {
const Uniform& uni = fUniforms[u.toIndex()];
SkASSERT(uni.fType == kVec3f_GrSLType);
SkASSERT(arrayCount > 0);
@@ -144,7 +144,11 @@ void GrVkProgramDataManager::set3fv(UniformHandle u,
}
}
-void GrVkProgramDataManager::set4f(UniformHandle u, float v0, float v1, float v2, float v3) const {
+void GrVkPipelineStateDataManager::set4f(UniformHandle u,
+ float v0,
+ float v1,
+ float v2,
+ float v3) const {
const Uniform& uni = fUniforms[u.toIndex()];
SkASSERT(uni.fType == kVec4f_GrSLType);
SkASSERT(GrGLSLShaderVar::kNonArray == uni.fArrayCount);
@@ -155,9 +159,9 @@ void GrVkProgramDataManager::set4f(UniformHandle u, float v0, float v1, float v2
memcpy(buffer, v, 4 * sizeof(float));
}
-void GrVkProgramDataManager::set4fv(UniformHandle u,
- int arrayCount,
- const float v[]) const {
+void GrVkPipelineStateDataManager::set4fv(UniformHandle u,
+ int arrayCount,
+ const float v[]) const {
const Uniform& uni = fUniforms[u.toIndex()];
SkASSERT(uni.fType == kVec4f_GrSLType);
SkASSERT(arrayCount > 0);
@@ -170,35 +174,41 @@ void GrVkProgramDataManager::set4fv(UniformHandle u,
memcpy(buffer, v, arrayCount * 4 * sizeof(float));
}
-void GrVkProgramDataManager::setMatrix2f(UniformHandle u, const float matrix[]) const {
+void GrVkPipelineStateDataManager::setMatrix2f(UniformHandle u, const float matrix[]) const {
this->setMatrices<2>(u, 1, matrix);
}
-void GrVkProgramDataManager::setMatrix2fv(UniformHandle u, int arrayCount, const float m[]) const {
+void GrVkPipelineStateDataManager::setMatrix2fv(UniformHandle u,
+ int arrayCount,
+ const float m[]) const {
this->setMatrices<2>(u, arrayCount, m);
}
-void GrVkProgramDataManager::setMatrix3f(UniformHandle u, const float matrix[]) const {
+void GrVkPipelineStateDataManager::setMatrix3f(UniformHandle u, const float matrix[]) const {
this->setMatrices<3>(u, 1, matrix);
}
-void GrVkProgramDataManager::setMatrix3fv(UniformHandle u, int arrayCount, const float m[]) const {
+void GrVkPipelineStateDataManager::setMatrix3fv(UniformHandle u,
+ int arrayCount,
+ const float m[]) const {
this->setMatrices<3>(u, arrayCount, m);
}
-void GrVkProgramDataManager::setMatrix4f(UniformHandle u, const float matrix[]) const {
+void GrVkPipelineStateDataManager::setMatrix4f(UniformHandle u, const float matrix[]) const {
this->setMatrices<4>(u, 1, matrix);
}
-void GrVkProgramDataManager::setMatrix4fv(UniformHandle u, int arrayCount, const float m[]) const {
+void GrVkPipelineStateDataManager::setMatrix4fv(UniformHandle u,
+ int arrayCount,
+ const float m[]) const {
this->setMatrices<4>(u, arrayCount, m);
}
template<int N> struct set_uniform_matrix;
-template<int N> inline void GrVkProgramDataManager::setMatrices(UniformHandle u,
- int arrayCount,
- const float matrices[]) const {
+template<int N> inline void GrVkPipelineStateDataManager::setMatrices(UniformHandle u,
+ int arrayCount,
+ const float matrices[]) const {
const Uniform& uni = fUniforms[u.toIndex()];
SkASSERT(uni.fType == kMat22f_GrSLType + (N - 2));
SkASSERT(arrayCount > 0);
@@ -243,9 +253,9 @@ template<> struct set_uniform_matrix<4> {
}
};
-void GrVkProgramDataManager::uploadUniformBuffers(const GrVkGpu* gpu,
- GrVkUniformBuffer* vertexBuffer,
- GrVkUniformBuffer* fragmentBuffer) const {
+void GrVkPipelineStateDataManager::uploadUniformBuffers(const GrVkGpu* gpu,
+ GrVkUniformBuffer* vertexBuffer,
+ GrVkUniformBuffer* fragmentBuffer) const {
if (vertexBuffer && fVertexUniformsDirty) {
vertexBuffer->addMemoryBarrier(gpu,
VK_ACCESS_UNIFORM_READ_BIT,
« no previous file with comments | « src/gpu/vk/GrVkPipelineStateDataManager.h ('k') | src/gpu/vk/GrVkProgram.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698