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

Side by Side Diff: src/gpu/vk/GrVkPipelineStateDataManager.cpp

Issue 2076143003: Integers can now be passed as uniforms (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix namespace/parameter name bug Created 4 years, 6 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
OLDNEW
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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 } 47 }
48 else { 48 else {
49 SkASSERT(GrVkUniformHandler::kFragBinding == uni.fBinding); 49 SkASSERT(GrVkUniformHandler::kFragBinding == uni.fBinding);
50 buffer = fFragmentUniformData.get(); 50 buffer = fFragmentUniformData.get();
51 fFragmentUniformsDirty = true; 51 fFragmentUniformsDirty = true;
52 } 52 }
53 buffer = static_cast<char*>(buffer)+uni.fOffset; 53 buffer = static_cast<char*>(buffer)+uni.fOffset;
54 return buffer; 54 return buffer;
55 } 55 }
56 56
57 void GrVkPipelineStateDataManager::set1i(UniformHandle u, int32_t i) const {
58 // TODO (fmenozzi): Until we know for sure
59 SkASSERT(false);
tomhudson 2016/06/20 15:22:17 Not happy.
egdaniel 2016/06/20 16:21:49 oh sorry wire's got crossed. Since I've mentioned
60
61 const Uniform& uni = fUniforms[u.toIndex()];
62 SkASSERT(uni.fType == kInt_GrSLType);
63 SkASSERT(GrGLSLShaderVar::kNonArray == uni.fArrayCount);
64 void* buffer = this->getBufferPtrAndMarkDirty(uni);
65 SkASSERT(sizeof(int32_t) == 4);
66 memcpy(buffer, &i, sizeof(int32_t));
67 }
68
57 void GrVkPipelineStateDataManager::set1f(UniformHandle u, float v0) const { 69 void GrVkPipelineStateDataManager::set1f(UniformHandle u, float v0) const {
58 const Uniform& uni = fUniforms[u.toIndex()]; 70 const Uniform& uni = fUniforms[u.toIndex()];
59 SkASSERT(uni.fType == kFloat_GrSLType); 71 SkASSERT(uni.fType == kFloat_GrSLType);
60 SkASSERT(GrGLSLShaderVar::kNonArray == uni.fArrayCount); 72 SkASSERT(GrGLSLShaderVar::kNonArray == uni.fArrayCount);
61 void* buffer = this->getBufferPtrAndMarkDirty(uni); 73 void* buffer = this->getBufferPtrAndMarkDirty(uni);
62 SkASSERT(sizeof(float) == 4); 74 SkASSERT(sizeof(float) == 4);
63 memcpy(buffer, &v0, sizeof(float)); 75 memcpy(buffer, &v0, sizeof(float));
64 } 76 }
65 77
66 void GrVkPipelineStateDataManager::set1fv(UniformHandle u, 78 void GrVkPipelineStateDataManager::set1fv(UniformHandle u,
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 fVertexUniformsDirty = false; 265 fVertexUniformsDirty = false;
254 } 266 }
255 267
256 if (fragmentBuffer && fFragmentUniformsDirty) { 268 if (fragmentBuffer && fFragmentUniformsDirty) {
257 SkAssertResult(fragmentBuffer->updateData(gpu, fFragmentUniformData.get( ), 269 SkAssertResult(fragmentBuffer->updateData(gpu, fFragmentUniformData.get( ),
258 fFragmentUniformSize, &updated Buffer)); 270 fFragmentUniformSize, &updated Buffer));
259 fFragmentUniformsDirty = false; 271 fFragmentUniformsDirty = false;
260 } 272 }
261 return updatedBuffer; 273 return updatedBuffer;
262 } 274 }
OLDNEW
« src/gpu/vk/GrVkPipelineStateDataManager.h ('K') | « src/gpu/vk/GrVkPipelineStateDataManager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698