blob: 0f25be80f167656d849764d4a48761342ca5db6e [file] [log] [blame]
Greg Daniel164a9f02016-02-22 09:56:40 -05001/*
2* Copyright 2016 Google Inc.
3*
4* Use of this source code is governed by a BSD-style license that can be
5* found in the LICENSE file.
6*/
7
8#include "GrVkUniformHandler.h"
9#include "glsl/GrGLSLProgramBuilder.h"
10
11// To determine whether a current offset is aligned, we can just 'and' the lowest bits with the
12// alignment mask. A value of 0 means aligned, any other value is how many bytes past alignment we
13// are. This works since all alignments are powers of 2. The mask is always (alignment - 1).
egdaniel4ee1cda2016-02-26 08:18:49 -080014// This alignment mask will give correct alignments for using the std430 block layout. If you want
15// the std140 alignment, you can use this, but then make sure if you have an array type it is
16// aligned to 16 bytes (i.e. has mask of 0xF).
Chris Dalton51ebd662017-10-24 16:10:48 -060017// These are designated in the Vulkan spec, section 14.5.4 "Offset and Stride Assignment".
18// https://www.khronos.org/registry/vulkan/specs/1.0-wsi_extensions/html/vkspec.html#interfaces-resources-layout
Greg Daniel164a9f02016-02-22 09:56:40 -050019uint32_t grsltype_to_alignment_mask(GrSLType type) {
Brian Salomonfa26e662016-11-14 11:27:00 -050020 switch(type) {
Ruiqi Maob609e6d2018-07-17 10:19:38 -040021 case kByte_GrSLType: // fall through
22 case kUByte_GrSLType:
23 return 0x0;
24 case kByte2_GrSLType: // fall through
25 case kUByte2_GrSLType:
26 return 0x1;
27 case kByte3_GrSLType: // fall through
28 case kByte4_GrSLType:
29 case kUByte3_GrSLType:
30 case kUByte4_GrSLType:
31 return 0x3;
Ethan Nicholasf7b88202017-09-18 14:10:39 -040032 case kShort_GrSLType: // fall through
Chris Dalton51ebd662017-10-24 16:10:48 -060033 case kUShort_GrSLType:
34 return 0x1;
35 case kShort2_GrSLType: // fall through
36 case kUShort2_GrSLType:
Chris Dalton6dd0d8a2017-10-24 19:53:13 +000037 return 0x3;
Chris Dalton51ebd662017-10-24 16:10:48 -060038 case kShort3_GrSLType: // fall through
39 case kShort4_GrSLType:
40 case kUShort3_GrSLType:
41 case kUShort4_GrSLType:
42 return 0x7;
43 case kInt_GrSLType:
Brian Salomonfa26e662016-11-14 11:27:00 -050044 case kUint_GrSLType:
45 return 0x3;
Ethan Nicholasf7b88202017-09-18 14:10:39 -040046 case kHalf_GrSLType: // fall through
Ethan Nicholas8aa45692017-09-20 11:24:15 -040047 case kFloat_GrSLType:
Brian Salomonfa26e662016-11-14 11:27:00 -050048 return 0x3;
Ethan Nicholasf7b88202017-09-18 14:10:39 -040049 case kHalf2_GrSLType: // fall through
Ethan Nicholas8aa45692017-09-20 11:24:15 -040050 case kFloat2_GrSLType:
Brian Salomonfa26e662016-11-14 11:27:00 -050051 return 0x7;
Ethan Nicholasf7b88202017-09-18 14:10:39 -040052 case kHalf3_GrSLType: // fall through
Ethan Nicholas8aa45692017-09-20 11:24:15 -040053 case kFloat3_GrSLType:
Brian Salomonfa26e662016-11-14 11:27:00 -050054 return 0xF;
Ethan Nicholasf7b88202017-09-18 14:10:39 -040055 case kHalf4_GrSLType: // fall through
Ethan Nicholas8aa45692017-09-20 11:24:15 -040056 case kFloat4_GrSLType:
Brian Salomonfa26e662016-11-14 11:27:00 -050057 return 0xF;
Ethan Nicholasf7b88202017-09-18 14:10:39 -040058 case kUint2_GrSLType:
Chris Dalton51ebd662017-10-24 16:10:48 -060059 return 0x7;
Ethan Nicholasf7b88202017-09-18 14:10:39 -040060 case kInt2_GrSLType:
csmartdaltonb37cb232017-02-08 14:56:27 -050061 return 0x7;
Ethan Nicholasf7b88202017-09-18 14:10:39 -040062 case kInt3_GrSLType:
csmartdaltonb37cb232017-02-08 14:56:27 -050063 return 0xF;
Ethan Nicholasf7b88202017-09-18 14:10:39 -040064 case kInt4_GrSLType:
csmartdaltonb37cb232017-02-08 14:56:27 -050065 return 0xF;
Ethan Nicholasf7b88202017-09-18 14:10:39 -040066 case kHalf2x2_GrSLType: // fall through
Ethan Nicholas8aa45692017-09-20 11:24:15 -040067 case kFloat2x2_GrSLType:
Brian Salomonfa26e662016-11-14 11:27:00 -050068 return 0x7;
Ethan Nicholasf7b88202017-09-18 14:10:39 -040069 case kHalf3x3_GrSLType: // fall through
Ethan Nicholas8aa45692017-09-20 11:24:15 -040070 case kFloat3x3_GrSLType:
Brian Salomonfa26e662016-11-14 11:27:00 -050071 return 0xF;
Ethan Nicholasf7b88202017-09-18 14:10:39 -040072 case kHalf4x4_GrSLType: // fall through
Ethan Nicholas8aa45692017-09-20 11:24:15 -040073 case kFloat4x4_GrSLType:
Brian Salomonfa26e662016-11-14 11:27:00 -050074 return 0xF;
75
76 // This query is only valid for certain types.
77 case kVoid_GrSLType:
78 case kBool_GrSLType:
79 case kTexture2DSampler_GrSLType:
Brian Salomonfa26e662016-11-14 11:27:00 -050080 case kTextureExternalSampler_GrSLType:
81 case kTexture2DRectSampler_GrSLType:
Brian Salomonfa26e662016-11-14 11:27:00 -050082 break;
83 }
Ben Wagnerb4aab9a2017-08-16 10:53:04 -040084 SK_ABORT("Unexpected type");
Brian Salomonfa26e662016-11-14 11:27:00 -050085 return 0;
Greg Daniel164a9f02016-02-22 09:56:40 -050086}
87
Chris Dalton51ebd662017-10-24 16:10:48 -060088/** Returns the size in bytes taken up in vulkanbuffers for GrSLTypes. */
egdaniel4ee1cda2016-02-26 08:18:49 -080089static inline uint32_t grsltype_to_vk_size(GrSLType type) {
Brian Salomonfa26e662016-11-14 11:27:00 -050090 switch(type) {
Ruiqi Maob609e6d2018-07-17 10:19:38 -040091 case kByte_GrSLType:
92 return sizeof(int8_t);
93 case kByte2_GrSLType:
94 return 2 * sizeof(int8_t);
95 case kByte3_GrSLType:
96 return 3 * sizeof(int8_t);
97 case kByte4_GrSLType:
98 return 4 * sizeof(int8_t);
99 case kUByte_GrSLType:
100 return sizeof(uint8_t);
101 case kUByte2_GrSLType:
102 return 2 * sizeof(uint8_t);
103 case kUByte3_GrSLType:
104 return 3 * sizeof(uint8_t);
105 case kUByte4_GrSLType:
106 return 4 * sizeof(uint8_t);
Chris Dalton51ebd662017-10-24 16:10:48 -0600107 case kShort_GrSLType:
108 return sizeof(int16_t);
109 case kShort2_GrSLType:
110 return 2 * sizeof(int16_t);
111 case kShort3_GrSLType:
112 return 3 * sizeof(int16_t);
113 case kShort4_GrSLType:
114 return 4 * sizeof(int16_t);
115 case kUShort_GrSLType:
116 return sizeof(uint16_t);
117 case kUShort2_GrSLType:
118 return 2 * sizeof(uint16_t);
119 case kUShort3_GrSLType:
120 return 3 * sizeof(uint16_t);
121 case kUShort4_GrSLType:
122 return 4 * sizeof(uint16_t);
Brian Salomonfa26e662016-11-14 11:27:00 -0500123 case kInt_GrSLType:
csmartdaltonb37cb232017-02-08 14:56:27 -0500124 return sizeof(int32_t);
Brian Salomonfa26e662016-11-14 11:27:00 -0500125 case kUint_GrSLType:
csmartdaltonb37cb232017-02-08 14:56:27 -0500126 return sizeof(int32_t);
Ethan Nicholasf7b88202017-09-18 14:10:39 -0400127 case kHalf_GrSLType: // fall through
Ethan Nicholas8aa45692017-09-20 11:24:15 -0400128 case kFloat_GrSLType:
Brian Salomonfa26e662016-11-14 11:27:00 -0500129 return sizeof(float);
Ethan Nicholasf7b88202017-09-18 14:10:39 -0400130 case kHalf2_GrSLType: // fall through
Ethan Nicholas8aa45692017-09-20 11:24:15 -0400131 case kFloat2_GrSLType:
Brian Salomonfa26e662016-11-14 11:27:00 -0500132 return 2 * sizeof(float);
Ethan Nicholasf7b88202017-09-18 14:10:39 -0400133 case kHalf3_GrSLType: // fall through
Ethan Nicholas8aa45692017-09-20 11:24:15 -0400134 case kFloat3_GrSLType:
Brian Salomonfa26e662016-11-14 11:27:00 -0500135 return 3 * sizeof(float);
Ethan Nicholasf7b88202017-09-18 14:10:39 -0400136 case kHalf4_GrSLType: // fall through
Ethan Nicholas8aa45692017-09-20 11:24:15 -0400137 case kFloat4_GrSLType:
Brian Salomonfa26e662016-11-14 11:27:00 -0500138 return 4 * sizeof(float);
Ethan Nicholasf7b88202017-09-18 14:10:39 -0400139 case kUint2_GrSLType:
Chris Dalton51ebd662017-10-24 16:10:48 -0600140 return 2 * sizeof(uint32_t);
Ethan Nicholasf7b88202017-09-18 14:10:39 -0400141 case kInt2_GrSLType:
csmartdaltonb37cb232017-02-08 14:56:27 -0500142 return 2 * sizeof(int32_t);
Ethan Nicholasf7b88202017-09-18 14:10:39 -0400143 case kInt3_GrSLType:
csmartdaltonb37cb232017-02-08 14:56:27 -0500144 return 3 * sizeof(int32_t);
Ethan Nicholasf7b88202017-09-18 14:10:39 -0400145 case kInt4_GrSLType:
csmartdaltonb37cb232017-02-08 14:56:27 -0500146 return 4 * sizeof(int32_t);
Ethan Nicholasf7b88202017-09-18 14:10:39 -0400147 case kHalf2x2_GrSLType: // fall through
Ethan Nicholas8aa45692017-09-20 11:24:15 -0400148 case kFloat2x2_GrSLType:
Brian Salomonfa26e662016-11-14 11:27:00 -0500149 //TODO: this will be 4 * szof(float) on std430.
150 return 8 * sizeof(float);
Ethan Nicholasf7b88202017-09-18 14:10:39 -0400151 case kHalf3x3_GrSLType: // fall through
Ethan Nicholas8aa45692017-09-20 11:24:15 -0400152 case kFloat3x3_GrSLType:
Brian Salomonfa26e662016-11-14 11:27:00 -0500153 return 12 * sizeof(float);
Ethan Nicholasf7b88202017-09-18 14:10:39 -0400154 case kHalf4x4_GrSLType: // fall through
Ethan Nicholas8aa45692017-09-20 11:24:15 -0400155 case kFloat4x4_GrSLType:
Brian Salomonfa26e662016-11-14 11:27:00 -0500156 return 16 * sizeof(float);
egdaniel4ee1cda2016-02-26 08:18:49 -0800157
Brian Salomonfa26e662016-11-14 11:27:00 -0500158 // This query is only valid for certain types.
159 case kVoid_GrSLType:
160 case kBool_GrSLType:
161 case kTexture2DSampler_GrSLType:
Brian Salomonfa26e662016-11-14 11:27:00 -0500162 case kTextureExternalSampler_GrSLType:
163 case kTexture2DRectSampler_GrSLType:
Brian Salomonfa26e662016-11-14 11:27:00 -0500164 break;
165 }
Ben Wagnerb4aab9a2017-08-16 10:53:04 -0400166 SK_ABORT("Unexpected type");
Brian Salomonfa26e662016-11-14 11:27:00 -0500167 return 0;
egdaniel4ee1cda2016-02-26 08:18:49 -0800168}
169
170
Greg Daniel164a9f02016-02-22 09:56:40 -0500171// Given the current offset into the ubo, calculate the offset for the uniform we're trying to add
172// taking into consideration all alignment requirements. The uniformOffset is set to the offset for
173// the new uniform, and currentOffset is updated to be the offset to the end of the new uniform.
174void get_ubo_aligned_offset(uint32_t* uniformOffset,
175 uint32_t* currentOffset,
176 GrSLType type,
177 int arrayCount) {
178 uint32_t alignmentMask = grsltype_to_alignment_mask(type);
egdaniel4ee1cda2016-02-26 08:18:49 -0800179 // We want to use the std140 layout here, so we must make arrays align to 16 bytes.
Ethan Nicholas8aa45692017-09-20 11:24:15 -0400180 if (arrayCount || type == kFloat2x2_GrSLType) {
egdaniel4ee1cda2016-02-26 08:18:49 -0800181 alignmentMask = 0xF;
182 }
Greg Daniel164a9f02016-02-22 09:56:40 -0500183 uint32_t offsetDiff = *currentOffset & alignmentMask;
184 if (offsetDiff != 0) {
185 offsetDiff = alignmentMask - offsetDiff + 1;
186 }
187 *uniformOffset = *currentOffset + offsetDiff;
188 SkASSERT(sizeof(float) == 4);
egdaniel4ee1cda2016-02-26 08:18:49 -0800189 if (arrayCount) {
190 uint32_t elementSize = SkTMax<uint32_t>(16, grsltype_to_vk_size(type));
191 SkASSERT(0 == (elementSize & 0xF));
192 *currentOffset = *uniformOffset + elementSize * arrayCount;
193 } else {
194 *currentOffset = *uniformOffset + grsltype_to_vk_size(type);
195 }
Greg Daniel164a9f02016-02-22 09:56:40 -0500196}
197
198GrGLSLUniformHandler::UniformHandle GrVkUniformHandler::internalAddUniformArray(
199 uint32_t visibility,
200 GrSLType type,
201 GrSLPrecision precision,
202 const char* name,
203 bool mangleName,
204 int arrayCount,
205 const char** outName) {
206 SkASSERT(name && strlen(name));
Greg Daniel18f96022017-05-04 15:09:03 -0400207 // For now asserting the the visibility is either geometry types (vertex, tesselation, geometry,
208 // etc.) or only fragment.
209 SkASSERT(kVertex_GrShaderFlag == visibility ||
210 kGeometry_GrShaderFlag == visibility ||
211 (kVertex_GrShaderFlag | kGeometry_GrShaderFlag) == visibility ||
212 kFragment_GrShaderFlag == visibility);
Greg Daniel164a9f02016-02-22 09:56:40 -0500213 SkASSERT(kDefault_GrSLPrecision == precision || GrSLTypeIsFloatType(type));
egdaniel09aa1fc2016-04-20 07:09:46 -0700214 GrSLTypeIsFloatType(type);
Greg Daniel164a9f02016-02-22 09:56:40 -0500215
216 UniformInfo& uni = fUniforms.push_back();
217 uni.fVariable.setType(type);
218 // TODO this is a bit hacky, lets think of a better way. Basically we need to be able to use
219 // the uniform view matrix name in the GP, and the GP is immutable so it has to tell the PB
220 // exactly what name it wants to use for the uniform view matrix. If we prefix anythings, then
221 // the names will mismatch. I think the correct solution is to have all GPs which need the
222 // uniform view matrix, they should upload the view matrix in their setData along with regular
223 // uniforms.
224 char prefix = 'u';
Robert Phillipsfe8da172018-01-24 14:52:02 +0000225 if ('u' == name[0] || !strncmp(name, GR_NO_MANGLE_PREFIX, strlen(GR_NO_MANGLE_PREFIX))) {
Greg Daniel164a9f02016-02-22 09:56:40 -0500226 prefix = '\0';
227 }
228 fProgramBuilder->nameVariable(uni.fVariable.accessName(), prefix, name, mangleName);
229 uni.fVariable.setArrayCount(arrayCount);
Greg Daniel164a9f02016-02-22 09:56:40 -0500230 uni.fVisibility = visibility;
231 uni.fVariable.setPrecision(precision);
egdaniel09aa1fc2016-04-20 07:09:46 -0700232 // When outputing the GLSL, only the outer uniform block will get the Uniform modifier. Thus
233 // we set the modifier to none for all uniforms declared inside the block.
Brian Salomon99938a82016-11-21 13:41:08 -0500234 uni.fVariable.setTypeModifier(GrShaderVar::kNone_TypeModifier);
Greg Daniel164a9f02016-02-22 09:56:40 -0500235
Greg Daniel18f96022017-05-04 15:09:03 -0400236 uint32_t* currentOffset;
237 uint32_t geomStages = kVertex_GrShaderFlag | kGeometry_GrShaderFlag;
238 if (geomStages & visibility) {
239 currentOffset = &fCurrentGeometryUBOOffset;
240 } else {
241 SkASSERT(kFragment_GrShaderFlag == visibility);
242 currentOffset = &fCurrentFragmentUBOOffset;
243 }
egdaniel09aa1fc2016-04-20 07:09:46 -0700244 get_ubo_aligned_offset(&uni.fUBOffset, currentOffset, type, arrayCount);
Greg Daniel164a9f02016-02-22 09:56:40 -0500245
Greg Danieldbd44c72017-01-24 15:12:12 -0500246 SkString layoutQualifier;
247 layoutQualifier.appendf("offset=%d", uni.fUBOffset);
248 uni.fVariable.addLayoutQualifier(layoutQualifier.c_str());
249
egdaniel09aa1fc2016-04-20 07:09:46 -0700250 if (outName) {
251 *outName = uni.fVariable.c_str();
Greg Daniel164a9f02016-02-22 09:56:40 -0500252 }
253
254 return GrGLSLUniformHandler::UniformHandle(fUniforms.count() - 1);
255}
256
Greg Daniel6e2625d2018-10-05 19:48:03 +0000257GrGLSLUniformHandler::SamplerHandle GrVkUniformHandler::addSampler(uint32_t visibility,
258 GrSwizzle swizzle,
Brian Salomon60dd8c72018-07-30 10:24:13 -0400259 GrTextureType type,
Brian Salomon101b8442016-11-18 11:58:54 -0500260 GrSLPrecision precision,
261 const char* name) {
egdaniel09aa1fc2016-04-20 07:09:46 -0700262 SkASSERT(name && strlen(name));
Greg Daniel6e2625d2018-10-05 19:48:03 +0000263 // For now asserting the the visibility is either only vertex, geometry, or fragment
264 SkASSERT(kVertex_GrShaderFlag == visibility ||
265 kFragment_GrShaderFlag == visibility ||
266 kGeometry_GrShaderFlag == visibility);
egdaniel09aa1fc2016-04-20 07:09:46 -0700267 SkString mangleName;
268 char prefix = 'u';
269 fProgramBuilder->nameVariable(&mangleName, prefix, name, true);
Brian Salomon101b8442016-11-18 11:58:54 -0500270
271 UniformInfo& info = fSamplers.push_back();
Brian Salomon60dd8c72018-07-30 10:24:13 -0400272 info.fVariable.setType(GrSLCombinedSamplerTypeForTextureType(type));
Brian Salomon99938a82016-11-21 13:41:08 -0500273 info.fVariable.setTypeModifier(GrShaderVar::kUniform_TypeModifier);
Brian Salomon101b8442016-11-18 11:58:54 -0500274 info.fVariable.setPrecision(precision);
275 info.fVariable.setName(mangleName);
276 SkString layoutQualifier;
277 layoutQualifier.appendf("set=%d, binding=%d", kSamplerDescSet, fSamplers.count() - 1);
Brian Salomon60397682016-11-22 15:06:46 -0500278 info.fVariable.addLayoutQualifier(layoutQualifier.c_str());
Greg Daniel6e2625d2018-10-05 19:48:03 +0000279 info.fVisibility = visibility;
Brian Salomon101b8442016-11-18 11:58:54 -0500280 info.fUBOffset = 0;
281 fSamplerSwizzles.push_back(swizzle);
282 SkASSERT(fSamplerSwizzles.count() == fSamplers.count());
egdaniel09aa1fc2016-04-20 07:09:46 -0700283 return GrGLSLUniformHandler::SamplerHandle(fSamplers.count() - 1);
284}
285
Greg Daniel164a9f02016-02-22 09:56:40 -0500286void GrVkUniformHandler::appendUniformDecls(GrShaderFlags visibility, SkString* out) const {
Greg Daniel18f96022017-05-04 15:09:03 -0400287 SkASSERT(kVertex_GrShaderFlag == visibility ||
288 kGeometry_GrShaderFlag == visibility ||
289 kFragment_GrShaderFlag == visibility);
egdaniel09aa1fc2016-04-20 07:09:46 -0700290
291 for (int i = 0; i < fSamplers.count(); ++i) {
Brian Salomon101b8442016-11-18 11:58:54 -0500292 const UniformInfo& sampler = fSamplers[i];
293 SkASSERT(sampler.fVariable.getType() == kTexture2DSampler_GrSLType);
294 if (visibility == sampler.fVisibility) {
Brian Salomon94efbf52016-11-29 13:43:05 -0500295 sampler.fVariable.appendDecl(fProgramBuilder->shaderCaps(), out);
egdaniel09aa1fc2016-04-20 07:09:46 -0700296 out->append(";\n");
297 }
298 }
299
Greg Danielaa352de2017-07-17 09:05:16 -0400300#ifdef SK_DEBUG
301 bool firstGeomOffsetCheck = false;
302 bool firstFragOffsetCheck = false;
303 for (int i = 0; i < fUniforms.count(); ++i) {
304 const UniformInfo& localUniform = fUniforms[i];
305 if (kVertex_GrShaderFlag == localUniform.fVisibility ||
306 kGeometry_GrShaderFlag == localUniform.fVisibility ||
307 (kVertex_GrShaderFlag | kGeometry_GrShaderFlag) == localUniform.fVisibility) {
308 if (!firstGeomOffsetCheck) {
309 // Check to make sure we are starting our offset at 0 so the offset qualifier we
310 // set on each variable in the uniform block is valid.
311 SkASSERT(0 == localUniform.fUBOffset);
312 firstGeomOffsetCheck = true;
313 }
314 } else {
315 SkASSERT(kFragment_GrShaderFlag == localUniform.fVisibility);
316 if (!firstFragOffsetCheck) {
317 // Check to make sure we are starting our offset at 0 so the offset qualifier we
318 // set on each variable in the uniform block is valid.
319 SkASSERT(0 == localUniform.fUBOffset);
320 firstFragOffsetCheck = true;
321 }
322 }
323 }
324#endif
325
egdaniel09aa1fc2016-04-20 07:09:46 -0700326 SkString uniformsString;
Greg Daniel164a9f02016-02-22 09:56:40 -0500327 for (int i = 0; i < fUniforms.count(); ++i) {
328 const UniformInfo& localUniform = fUniforms[i];
Greg Daniel18f96022017-05-04 15:09:03 -0400329 if (visibility & localUniform.fVisibility) {
Greg Daniel164a9f02016-02-22 09:56:40 -0500330 if (GrSLTypeIsFloatType(localUniform.fVariable.getType())) {
Brian Salomon94efbf52016-11-29 13:43:05 -0500331 localUniform.fVariable.appendDecl(fProgramBuilder->shaderCaps(), &uniformsString);
Greg Daniel164a9f02016-02-22 09:56:40 -0500332 uniformsString.append(";\n");
Greg Daniel164a9f02016-02-22 09:56:40 -0500333 }
334 }
335 }
Greg Danielaa352de2017-07-17 09:05:16 -0400336
Greg Daniel164a9f02016-02-22 09:56:40 -0500337 if (!uniformsString.isEmpty()) {
Greg Daniel18f96022017-05-04 15:09:03 -0400338 uint32_t uniformBinding;
339 const char* stage;
340 if (kVertex_GrShaderFlag == visibility) {
341 uniformBinding = kGeometryBinding;
342 stage = "vertex";
343 } else if (kGeometry_GrShaderFlag == visibility) {
344 uniformBinding = kGeometryBinding;
345 stage = "geometry";
346 } else {
347 SkASSERT(kFragment_GrShaderFlag == visibility);
348 uniformBinding = kFragBinding;
349 stage = "fragment";
350 }
Greg Daniel164a9f02016-02-22 09:56:40 -0500351 out->appendf("layout (set=%d, binding=%d) uniform %sUniformBuffer\n{\n",
352 kUniformBufferDescSet, uniformBinding, stage);
353 out->appendf("%s\n};\n", uniformsString.c_str());
354 }
egdaniel4ee1cda2016-02-26 08:18:49 -0800355}