Revert "Experiment with no longer avoiding uploading same uniforms in vulkan."

This reverts commit a19ea58aa9.

Reason for revert: As expected perf slowdowns, but we have the data now

Original change's description:
> Experiment with no longer avoiding uploading same uniforms in vulkan.
> 
> The plan is to land this and see what the perf bots report. Only local
> desktop a little less than half the time we skip the upload for not being
> dirty. But we're not sure if this is saving us much. Unless there is no
> regression at all, we will revert this.
> 
> Bug: skia:10035
> Change-Id: I8a3a8862ccd10ba109b5ddc2f3473d30b3ceccaf
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/276211
> Reviewed-by: Michael Ludwig <michaelludwig@google.com>
> Commit-Queue: Greg Daniel <egdaniel@google.com>

TBR=egdaniel@google.com,jvanverth@google.com,michaelludwig@google.com

Change-Id: Iea44b13c70cd075e93bb52b3a6773cc8b5df731a
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:10035
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/276396
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
This commit is contained in:
Greg Daniel 2020-03-11 11:42:59 +00:00 committed by Skia Commit-Bot
parent 0340292972
commit 21beacccb9
2 changed files with 7 additions and 2 deletions

View File

@ -12,7 +12,8 @@
GrVkPipelineStateDataManager::GrVkPipelineStateDataManager(const UniformInfoArray& uniforms,
uint32_t uniformSize)
: fUniformSize(uniformSize) {
: fUniformSize(uniformSize)
, fUniformsDirty(false) {
fUniformData.reset(uniformSize);
int count = uniforms.count();
fUniforms.push_back_n(count);
@ -33,6 +34,7 @@ GrVkPipelineStateDataManager::GrVkPipelineStateDataManager(const UniformInfoArra
}
void* GrVkPipelineStateDataManager::getBufferPtrAndMarkDirty(const Uniform& uni) const {
fUniformsDirty = true;
return static_cast<char*>(fUniformData.get())+uni.fOffset;
}
@ -304,6 +306,7 @@ template<int N> inline void GrVkPipelineStateDataManager::setMatrices(UniformHan
(1 == arrayCount && GrShaderVar::kNonArray == uni.fArrayCount));
void* buffer = fUniformData.get();
fUniformsDirty = true;
set_uniform_matrix<N>::set(buffer, uni.fOffset, arrayCount, matrices);
}
@ -333,9 +336,10 @@ template<> struct set_uniform_matrix<4> {
bool GrVkPipelineStateDataManager::uploadUniformBuffers(GrVkGpu* gpu,
GrVkUniformBuffer* buffer) const {
bool updatedBuffer = false;
if (buffer) {
if (buffer && fUniformsDirty) {
SkAssertResult(buffer->updateData(gpu, fUniformData.get(),
fUniformSize, &updatedBuffer));
fUniformsDirty = false;
}
return updatedBuffer;

View File

@ -79,6 +79,7 @@ private:
SkTArray<Uniform, true> fUniforms;
mutable SkAutoMalloc fUniformData;
mutable bool fUniformsDirty;
};
#endif