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

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: Remove unnecessary assert 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
« no previous file with comments | « src/gpu/vk/GrVkPipelineStateDataManager.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 const Uniform& uni = fUniforms[u.toIndex()];
59 SkASSERT(uni.fType == kInt_GrSLType);
60 SkASSERT(GrGLSLShaderVar::kNonArray == uni.fArrayCount);
61 void* buffer = this->getBufferPtrAndMarkDirty(uni);
62 memcpy(buffer, &i, sizeof(int32_t));
63 }
64
57 void GrVkPipelineStateDataManager::set1f(UniformHandle u, float v0) const { 65 void GrVkPipelineStateDataManager::set1f(UniformHandle u, float v0) const {
58 const Uniform& uni = fUniforms[u.toIndex()]; 66 const Uniform& uni = fUniforms[u.toIndex()];
59 SkASSERT(uni.fType == kFloat_GrSLType); 67 SkASSERT(uni.fType == kFloat_GrSLType);
60 SkASSERT(GrGLSLShaderVar::kNonArray == uni.fArrayCount); 68 SkASSERT(GrGLSLShaderVar::kNonArray == uni.fArrayCount);
61 void* buffer = this->getBufferPtrAndMarkDirty(uni); 69 void* buffer = this->getBufferPtrAndMarkDirty(uni);
62 SkASSERT(sizeof(float) == 4); 70 SkASSERT(sizeof(float) == 4);
63 memcpy(buffer, &v0, sizeof(float)); 71 memcpy(buffer, &v0, sizeof(float));
64 } 72 }
65 73
66 void GrVkPipelineStateDataManager::set1fv(UniformHandle u, 74 void GrVkPipelineStateDataManager::set1fv(UniformHandle u,
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 fVertexUniformsDirty = false; 261 fVertexUniformsDirty = false;
254 } 262 }
255 263
256 if (fragmentBuffer && fFragmentUniformsDirty) { 264 if (fragmentBuffer && fFragmentUniformsDirty) {
257 SkAssertResult(fragmentBuffer->updateData(gpu, fFragmentUniformData.get( ), 265 SkAssertResult(fragmentBuffer->updateData(gpu, fFragmentUniformData.get( ),
258 fFragmentUniformSize, &updated Buffer)); 266 fFragmentUniformSize, &updated Buffer));
259 fFragmentUniformsDirty = false; 267 fFragmentUniformsDirty = false;
260 } 268 }
261 return updatedBuffer; 269 return updatedBuffer;
262 } 270 }
OLDNEW
« no previous file with comments | « src/gpu/vk/GrVkPipelineStateDataManager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698