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 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 }; | 244 }; |
245 | 245 |
246 template<> struct set_uniform_matrix<4> { | 246 template<> struct set_uniform_matrix<4> { |
247 inline static void set(void* buffer, int uniformOffset, int count, const flo
at matrices[]) { | 247 inline static void set(void* buffer, int uniformOffset, int count, const flo
at matrices[]) { |
248 GR_STATIC_ASSERT(sizeof(float) == 4); | 248 GR_STATIC_ASSERT(sizeof(float) == 4); |
249 buffer = static_cast<char*>(buffer) + uniformOffset; | 249 buffer = static_cast<char*>(buffer) + uniformOffset; |
250 memcpy(buffer, matrices, count * 16 * sizeof(float)); | 250 memcpy(buffer, matrices, count * 16 * sizeof(float)); |
251 } | 251 } |
252 }; | 252 }; |
253 | 253 |
254 bool GrVkPipelineStateDataManager::uploadUniformBuffers(const GrVkGpu* gpu, | 254 bool GrVkPipelineStateDataManager::uploadUniformBuffers(GrVkGpu* gpu, |
255 GrVkUniformBuffer* verte
xBuffer, | 255 GrVkUniformBuffer* verte
xBuffer, |
256 GrVkUniformBuffer* fragm
entBuffer) const { | 256 GrVkUniformBuffer* fragm
entBuffer) const { |
257 bool updatedBuffer = false; | 257 bool updatedBuffer = false; |
258 if (vertexBuffer && fVertexUniformsDirty) { | 258 if (vertexBuffer && fVertexUniformsDirty) { |
259 SkAssertResult(vertexBuffer->updateData(gpu, fVertexUniformData.get(), f
VertexUniformSize, | 259 SkAssertResult(vertexBuffer->updateData(gpu, fVertexUniformData.get(), f
VertexUniformSize, |
260 &updatedBuffer)); | 260 &updatedBuffer)); |
261 fVertexUniformsDirty = false; | 261 fVertexUniformsDirty = false; |
262 } | 262 } |
263 | 263 |
264 if (fragmentBuffer && fFragmentUniformsDirty) { | 264 if (fragmentBuffer && fFragmentUniformsDirty) { |
265 SkAssertResult(fragmentBuffer->updateData(gpu, fFragmentUniformData.get(
), | 265 SkAssertResult(fragmentBuffer->updateData(gpu, fFragmentUniformData.get(
), |
266 fFragmentUniformSize, &updated
Buffer)); | 266 fFragmentUniformSize, &updated
Buffer)); |
267 fFragmentUniformsDirty = false; | 267 fFragmentUniformsDirty = false; |
268 } | 268 } |
269 return updatedBuffer; | 269 return updatedBuffer; |
270 } | 270 } |
OLD | NEW |