OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "GrVkPipelineStateDataManager.h" | 8 #include "GrVkPipelineStateDataManager.h" |
9 | 9 |
10 #include "GrVkGpu.h" | 10 #include "GrVkGpu.h" |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 buffer = static_cast<char*>(buffer) + uniformOffset; | 241 buffer = static_cast<char*>(buffer) + uniformOffset; |
242 memcpy(buffer, matrices, count * 16 * sizeof(float)); | 242 memcpy(buffer, matrices, count * 16 * sizeof(float)); |
243 } | 243 } |
244 }; | 244 }; |
245 | 245 |
246 bool GrVkPipelineStateDataManager::uploadUniformBuffers(const GrVkGpu* gpu, | 246 bool GrVkPipelineStateDataManager::uploadUniformBuffers(const GrVkGpu* gpu, |
247 GrVkUniformBuffer* verte
xBuffer, | 247 GrVkUniformBuffer* verte
xBuffer, |
248 GrVkUniformBuffer* fragm
entBuffer) const { | 248 GrVkUniformBuffer* fragm
entBuffer) const { |
249 bool updatedBuffer = false; | 249 bool updatedBuffer = false; |
250 if (vertexBuffer && fVertexUniformsDirty) { | 250 if (vertexBuffer && fVertexUniformsDirty) { |
251 vertexBuffer->addMemoryBarrier(gpu, | |
252 VK_ACCESS_UNIFORM_READ_BIT, | |
253 VK_ACCESS_HOST_WRITE_BIT, | |
254 VK_PIPELINE_STAGE_VERTEX_SHADER_BIT, | |
255 VK_PIPELINE_STAGE_HOST_BIT, | |
256 false); | |
257 SkAssertResult(vertexBuffer->updateData(gpu, fVertexUniformData.get(), f
VertexUniformSize, | 251 SkAssertResult(vertexBuffer->updateData(gpu, fVertexUniformData.get(), f
VertexUniformSize, |
258 &updatedBuffer)); | 252 &updatedBuffer)); |
259 fVertexUniformsDirty = false; | 253 fVertexUniformsDirty = false; |
260 } | 254 } |
261 | 255 |
262 if (fragmentBuffer && fFragmentUniformsDirty) { | 256 if (fragmentBuffer && fFragmentUniformsDirty) { |
263 fragmentBuffer->addMemoryBarrier(gpu, | |
264 VK_ACCESS_UNIFORM_READ_BIT, | |
265 VK_ACCESS_HOST_WRITE_BIT, | |
266 VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT, | |
267 VK_PIPELINE_STAGE_HOST_BIT, | |
268 false); | |
269 SkAssertResult(fragmentBuffer->updateData(gpu, fFragmentUniformData.get(
), | 257 SkAssertResult(fragmentBuffer->updateData(gpu, fFragmentUniformData.get(
), |
270 fFragmentUniformSize, &updated
Buffer)); | 258 fFragmentUniformSize, &updated
Buffer)); |
271 fFragmentUniformsDirty = false; | 259 fFragmentUniformsDirty = false; |
272 } | 260 } |
273 return updatedBuffer; | 261 return updatedBuffer; |
274 } | 262 } |
OLD | NEW |