Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 1 | /* |
| 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). |
egdaniel | 4ee1cda | 2016-02-26 08:18:49 -0800 | [diff] [blame] | 14 | // 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). |
Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 17 | uint32_t grsltype_to_alignment_mask(GrSLType type) { |
Brian Salomon | fa26e66 | 2016-11-14 11:27:00 -0500 | [diff] [blame] | 18 | switch(type) { |
| 19 | case kInt_GrSLType: |
| 20 | return 0x3; |
| 21 | case kUint_GrSLType: |
| 22 | return 0x3; |
| 23 | case kFloat_GrSLType: |
| 24 | return 0x3; |
| 25 | case kVec2f_GrSLType: |
| 26 | return 0x7; |
| 27 | case kVec3f_GrSLType: |
| 28 | return 0xF; |
| 29 | case kVec4f_GrSLType: |
| 30 | return 0xF; |
csmartdalton | b37cb23 | 2017-02-08 14:56:27 -0500 | [diff] [blame] | 31 | case kVec2i_GrSLType: |
| 32 | return 0x7; |
| 33 | case kVec3i_GrSLType: |
| 34 | return 0xF; |
| 35 | case kVec4i_GrSLType: |
| 36 | return 0xF; |
Brian Salomon | fa26e66 | 2016-11-14 11:27:00 -0500 | [diff] [blame] | 37 | case kMat22f_GrSLType: |
| 38 | return 0x7; |
| 39 | case kMat33f_GrSLType: |
| 40 | return 0xF; |
| 41 | case kMat44f_GrSLType: |
| 42 | return 0xF; |
| 43 | |
| 44 | // This query is only valid for certain types. |
| 45 | case kVoid_GrSLType: |
| 46 | case kBool_GrSLType: |
| 47 | case kTexture2DSampler_GrSLType: |
Brian Salomon | a8f0002 | 2016-11-16 12:55:57 -0500 | [diff] [blame] | 48 | case kITexture2DSampler_GrSLType: |
Brian Salomon | fa26e66 | 2016-11-14 11:27:00 -0500 | [diff] [blame] | 49 | case kTextureExternalSampler_GrSLType: |
| 50 | case kTexture2DRectSampler_GrSLType: |
csmartdalton | 2245803 | 2016-11-16 11:28:16 -0700 | [diff] [blame] | 51 | case kBufferSampler_GrSLType: |
Brian Salomon | fa26e66 | 2016-11-14 11:27:00 -0500 | [diff] [blame] | 52 | case kTexture2D_GrSLType: |
| 53 | case kSampler_GrSLType: |
Brian Salomon | f9f4512 | 2016-11-29 11:59:17 -0500 | [diff] [blame] | 54 | case kImageStorage2D_GrSLType: |
| 55 | case kIImageStorage2D_GrSLType: |
Brian Salomon | fa26e66 | 2016-11-14 11:27:00 -0500 | [diff] [blame] | 56 | break; |
| 57 | } |
| 58 | SkFAIL("Unexpected type"); |
| 59 | return 0; |
Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 60 | } |
| 61 | |
egdaniel | 4ee1cda | 2016-02-26 08:18:49 -0800 | [diff] [blame] | 62 | /** Returns the size in bytes taken up in vulkanbuffers for floating point GrSLTypes. |
egdaniel | 75d2bfc | 2016-07-07 08:04:08 -0700 | [diff] [blame] | 63 | For non floating point type returns 0. Currently this reflects the std140 alignment |
| 64 | so a mat22 takes up 8 floats. */ |
egdaniel | 4ee1cda | 2016-02-26 08:18:49 -0800 | [diff] [blame] | 65 | static inline uint32_t grsltype_to_vk_size(GrSLType type) { |
Brian Salomon | fa26e66 | 2016-11-14 11:27:00 -0500 | [diff] [blame] | 66 | switch(type) { |
| 67 | case kInt_GrSLType: |
csmartdalton | b37cb23 | 2017-02-08 14:56:27 -0500 | [diff] [blame] | 68 | return sizeof(int32_t); |
Brian Salomon | fa26e66 | 2016-11-14 11:27:00 -0500 | [diff] [blame] | 69 | case kUint_GrSLType: |
csmartdalton | b37cb23 | 2017-02-08 14:56:27 -0500 | [diff] [blame] | 70 | return sizeof(int32_t); |
Brian Salomon | fa26e66 | 2016-11-14 11:27:00 -0500 | [diff] [blame] | 71 | case kFloat_GrSLType: |
| 72 | return sizeof(float); |
| 73 | case kVec2f_GrSLType: |
| 74 | return 2 * sizeof(float); |
| 75 | case kVec3f_GrSLType: |
| 76 | return 3 * sizeof(float); |
| 77 | case kVec4f_GrSLType: |
| 78 | return 4 * sizeof(float); |
csmartdalton | b37cb23 | 2017-02-08 14:56:27 -0500 | [diff] [blame] | 79 | case kVec2i_GrSLType: |
| 80 | return 2 * sizeof(int32_t); |
| 81 | case kVec3i_GrSLType: |
| 82 | return 3 * sizeof(int32_t); |
| 83 | case kVec4i_GrSLType: |
| 84 | return 4 * sizeof(int32_t); |
Brian Salomon | fa26e66 | 2016-11-14 11:27:00 -0500 | [diff] [blame] | 85 | case kMat22f_GrSLType: |
| 86 | //TODO: this will be 4 * szof(float) on std430. |
| 87 | return 8 * sizeof(float); |
| 88 | case kMat33f_GrSLType: |
| 89 | return 12 * sizeof(float); |
| 90 | case kMat44f_GrSLType: |
| 91 | return 16 * sizeof(float); |
egdaniel | 4ee1cda | 2016-02-26 08:18:49 -0800 | [diff] [blame] | 92 | |
Brian Salomon | fa26e66 | 2016-11-14 11:27:00 -0500 | [diff] [blame] | 93 | // This query is only valid for certain types. |
| 94 | case kVoid_GrSLType: |
| 95 | case kBool_GrSLType: |
| 96 | case kTexture2DSampler_GrSLType: |
Brian Salomon | a8f0002 | 2016-11-16 12:55:57 -0500 | [diff] [blame] | 97 | case kITexture2DSampler_GrSLType: |
Brian Salomon | fa26e66 | 2016-11-14 11:27:00 -0500 | [diff] [blame] | 98 | case kTextureExternalSampler_GrSLType: |
| 99 | case kTexture2DRectSampler_GrSLType: |
csmartdalton | 2245803 | 2016-11-16 11:28:16 -0700 | [diff] [blame] | 100 | case kBufferSampler_GrSLType: |
Brian Salomon | fa26e66 | 2016-11-14 11:27:00 -0500 | [diff] [blame] | 101 | case kTexture2D_GrSLType: |
| 102 | case kSampler_GrSLType: |
Brian Salomon | f9f4512 | 2016-11-29 11:59:17 -0500 | [diff] [blame] | 103 | case kImageStorage2D_GrSLType: |
| 104 | case kIImageStorage2D_GrSLType: |
Brian Salomon | fa26e66 | 2016-11-14 11:27:00 -0500 | [diff] [blame] | 105 | break; |
| 106 | } |
| 107 | SkFAIL("Unexpected type"); |
| 108 | return 0; |
egdaniel | 4ee1cda | 2016-02-26 08:18:49 -0800 | [diff] [blame] | 109 | } |
| 110 | |
| 111 | |
Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 112 | // Given the current offset into the ubo, calculate the offset for the uniform we're trying to add |
| 113 | // taking into consideration all alignment requirements. The uniformOffset is set to the offset for |
| 114 | // the new uniform, and currentOffset is updated to be the offset to the end of the new uniform. |
| 115 | void get_ubo_aligned_offset(uint32_t* uniformOffset, |
| 116 | uint32_t* currentOffset, |
| 117 | GrSLType type, |
| 118 | int arrayCount) { |
| 119 | uint32_t alignmentMask = grsltype_to_alignment_mask(type); |
egdaniel | 4ee1cda | 2016-02-26 08:18:49 -0800 | [diff] [blame] | 120 | // We want to use the std140 layout here, so we must make arrays align to 16 bytes. |
egdaniel | 75d2bfc | 2016-07-07 08:04:08 -0700 | [diff] [blame] | 121 | if (arrayCount || type == kMat22f_GrSLType) { |
egdaniel | 4ee1cda | 2016-02-26 08:18:49 -0800 | [diff] [blame] | 122 | alignmentMask = 0xF; |
| 123 | } |
Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 124 | uint32_t offsetDiff = *currentOffset & alignmentMask; |
| 125 | if (offsetDiff != 0) { |
| 126 | offsetDiff = alignmentMask - offsetDiff + 1; |
| 127 | } |
| 128 | *uniformOffset = *currentOffset + offsetDiff; |
| 129 | SkASSERT(sizeof(float) == 4); |
egdaniel | 4ee1cda | 2016-02-26 08:18:49 -0800 | [diff] [blame] | 130 | if (arrayCount) { |
| 131 | uint32_t elementSize = SkTMax<uint32_t>(16, grsltype_to_vk_size(type)); |
| 132 | SkASSERT(0 == (elementSize & 0xF)); |
| 133 | *currentOffset = *uniformOffset + elementSize * arrayCount; |
| 134 | } else { |
| 135 | *currentOffset = *uniformOffset + grsltype_to_vk_size(type); |
| 136 | } |
Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 137 | } |
| 138 | |
| 139 | GrGLSLUniformHandler::UniformHandle GrVkUniformHandler::internalAddUniformArray( |
| 140 | uint32_t visibility, |
| 141 | GrSLType type, |
| 142 | GrSLPrecision precision, |
| 143 | const char* name, |
| 144 | bool mangleName, |
| 145 | int arrayCount, |
| 146 | const char** outName) { |
| 147 | SkASSERT(name && strlen(name)); |
Greg Daniel | 18f9602 | 2017-05-04 15:09:03 -0400 | [diff] [blame] | 148 | // For now asserting the the visibility is either geometry types (vertex, tesselation, geometry, |
| 149 | // etc.) or only fragment. |
| 150 | SkASSERT(kVertex_GrShaderFlag == visibility || |
| 151 | kGeometry_GrShaderFlag == visibility || |
| 152 | (kVertex_GrShaderFlag | kGeometry_GrShaderFlag) == visibility || |
| 153 | kFragment_GrShaderFlag == visibility); |
Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 154 | SkASSERT(kDefault_GrSLPrecision == precision || GrSLTypeIsFloatType(type)); |
egdaniel | 09aa1fc | 2016-04-20 07:09:46 -0700 | [diff] [blame] | 155 | GrSLTypeIsFloatType(type); |
Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 156 | |
| 157 | UniformInfo& uni = fUniforms.push_back(); |
| 158 | uni.fVariable.setType(type); |
| 159 | // TODO this is a bit hacky, lets think of a better way. Basically we need to be able to use |
| 160 | // the uniform view matrix name in the GP, and the GP is immutable so it has to tell the PB |
| 161 | // exactly what name it wants to use for the uniform view matrix. If we prefix anythings, then |
| 162 | // the names will mismatch. I think the correct solution is to have all GPs which need the |
| 163 | // uniform view matrix, they should upload the view matrix in their setData along with regular |
| 164 | // uniforms. |
| 165 | char prefix = 'u'; |
| 166 | if ('u' == name[0]) { |
| 167 | prefix = '\0'; |
| 168 | } |
| 169 | fProgramBuilder->nameVariable(uni.fVariable.accessName(), prefix, name, mangleName); |
| 170 | uni.fVariable.setArrayCount(arrayCount); |
Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 171 | uni.fVisibility = visibility; |
| 172 | uni.fVariable.setPrecision(precision); |
egdaniel | 09aa1fc | 2016-04-20 07:09:46 -0700 | [diff] [blame] | 173 | // When outputing the GLSL, only the outer uniform block will get the Uniform modifier. Thus |
| 174 | // we set the modifier to none for all uniforms declared inside the block. |
Brian Salomon | 99938a8 | 2016-11-21 13:41:08 -0500 | [diff] [blame] | 175 | uni.fVariable.setTypeModifier(GrShaderVar::kNone_TypeModifier); |
Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 176 | |
Greg Daniel | 18f9602 | 2017-05-04 15:09:03 -0400 | [diff] [blame] | 177 | uint32_t* currentOffset; |
| 178 | uint32_t geomStages = kVertex_GrShaderFlag | kGeometry_GrShaderFlag; |
| 179 | if (geomStages & visibility) { |
| 180 | currentOffset = &fCurrentGeometryUBOOffset; |
| 181 | } else { |
| 182 | SkASSERT(kFragment_GrShaderFlag == visibility); |
| 183 | currentOffset = &fCurrentFragmentUBOOffset; |
| 184 | } |
egdaniel | 09aa1fc | 2016-04-20 07:09:46 -0700 | [diff] [blame] | 185 | get_ubo_aligned_offset(&uni.fUBOffset, currentOffset, type, arrayCount); |
Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 186 | |
Greg Daniel | dbd44c7 | 2017-01-24 15:12:12 -0500 | [diff] [blame] | 187 | SkString layoutQualifier; |
| 188 | layoutQualifier.appendf("offset=%d", uni.fUBOffset); |
| 189 | uni.fVariable.addLayoutQualifier(layoutQualifier.c_str()); |
| 190 | |
egdaniel | 09aa1fc | 2016-04-20 07:09:46 -0700 | [diff] [blame] | 191 | if (outName) { |
| 192 | *outName = uni.fVariable.c_str(); |
Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 193 | } |
| 194 | |
| 195 | return GrGLSLUniformHandler::UniformHandle(fUniforms.count() - 1); |
| 196 | } |
| 197 | |
Brian Salomon | 101b844 | 2016-11-18 11:58:54 -0500 | [diff] [blame] | 198 | GrGLSLUniformHandler::SamplerHandle GrVkUniformHandler::addSampler(uint32_t visibility, |
| 199 | GrSwizzle swizzle, |
| 200 | GrSLType type, |
| 201 | GrSLPrecision precision, |
| 202 | const char* name) { |
egdaniel | 09aa1fc | 2016-04-20 07:09:46 -0700 | [diff] [blame] | 203 | SkASSERT(name && strlen(name)); |
Greg Daniel | 18f9602 | 2017-05-04 15:09:03 -0400 | [diff] [blame] | 204 | // For now asserting the the visibility is either only vertex, geometry, or fragment |
| 205 | SkASSERT(kVertex_GrShaderFlag == visibility || |
| 206 | kFragment_GrShaderFlag == visibility || |
| 207 | kGeometry_GrShaderFlag == visibility); |
egdaniel | 09aa1fc | 2016-04-20 07:09:46 -0700 | [diff] [blame] | 208 | SkString mangleName; |
| 209 | char prefix = 'u'; |
| 210 | fProgramBuilder->nameVariable(&mangleName, prefix, name, true); |
Brian Salomon | 101b844 | 2016-11-18 11:58:54 -0500 | [diff] [blame] | 211 | |
| 212 | UniformInfo& info = fSamplers.push_back(); |
| 213 | SkASSERT(GrSLTypeIsCombinedSamplerType(type)); |
| 214 | info.fVariable.setType(type); |
Brian Salomon | 99938a8 | 2016-11-21 13:41:08 -0500 | [diff] [blame] | 215 | info.fVariable.setTypeModifier(GrShaderVar::kUniform_TypeModifier); |
Brian Salomon | 101b844 | 2016-11-18 11:58:54 -0500 | [diff] [blame] | 216 | info.fVariable.setPrecision(precision); |
| 217 | info.fVariable.setName(mangleName); |
| 218 | SkString layoutQualifier; |
| 219 | layoutQualifier.appendf("set=%d, binding=%d", kSamplerDescSet, fSamplers.count() - 1); |
Brian Salomon | 6039768 | 2016-11-22 15:06:46 -0500 | [diff] [blame] | 220 | info.fVariable.addLayoutQualifier(layoutQualifier.c_str()); |
Brian Salomon | 101b844 | 2016-11-18 11:58:54 -0500 | [diff] [blame] | 221 | info.fVisibility = visibility; |
| 222 | info.fUBOffset = 0; |
| 223 | fSamplerSwizzles.push_back(swizzle); |
| 224 | SkASSERT(fSamplerSwizzles.count() == fSamplers.count()); |
egdaniel | 09aa1fc | 2016-04-20 07:09:46 -0700 | [diff] [blame] | 225 | return GrGLSLUniformHandler::SamplerHandle(fSamplers.count() - 1); |
| 226 | } |
| 227 | |
Greg Daniel | 31ec144 | 2017-05-08 10:30:59 -0400 | [diff] [blame^] | 228 | GrGLSLUniformHandler::TexelBufferHandle GrVkUniformHandler::addTexelBuffer(uint32_t visibility, |
| 229 | GrSLPrecision precision, |
| 230 | const char* name) { |
| 231 | SkASSERT(name && strlen(name)); |
| 232 | SkDEBUGCODE(static const uint32_t kVisMask = kVertex_GrShaderFlag | kFragment_GrShaderFlag); |
| 233 | SkASSERT(0 == (~kVisMask & visibility)); |
| 234 | SkASSERT(0 != visibility); |
| 235 | SkString mangleName; |
| 236 | char prefix = 'u'; |
| 237 | fProgramBuilder->nameVariable(&mangleName, prefix, name, true); |
| 238 | |
| 239 | UniformInfo& info = fTexelBuffers.push_back(); |
| 240 | info.fVariable.setType(kBufferSampler_GrSLType); |
| 241 | info.fVariable.setTypeModifier(GrShaderVar::kUniform_TypeModifier); |
| 242 | info.fVariable.setPrecision(precision); |
| 243 | info.fVariable.setName(mangleName); |
| 244 | SkString layoutQualifier; |
| 245 | layoutQualifier.appendf("set=%d, binding=%d", kTexelBufferDescSet, fTexelBuffers.count()- 1); |
| 246 | info.fVariable.addLayoutQualifier(layoutQualifier.c_str()); |
| 247 | info.fVisibility = visibility; |
| 248 | info.fUBOffset = 0; |
| 249 | return GrGLSLUniformHandler::TexelBufferHandle(fTexelBuffers.count() - 1); |
| 250 | } |
| 251 | |
Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 252 | void GrVkUniformHandler::appendUniformDecls(GrShaderFlags visibility, SkString* out) const { |
Greg Daniel | 18f9602 | 2017-05-04 15:09:03 -0400 | [diff] [blame] | 253 | SkASSERT(kVertex_GrShaderFlag == visibility || |
| 254 | kGeometry_GrShaderFlag == visibility || |
| 255 | kFragment_GrShaderFlag == visibility); |
egdaniel | 09aa1fc | 2016-04-20 07:09:46 -0700 | [diff] [blame] | 256 | |
| 257 | for (int i = 0; i < fSamplers.count(); ++i) { |
Brian Salomon | 101b844 | 2016-11-18 11:58:54 -0500 | [diff] [blame] | 258 | const UniformInfo& sampler = fSamplers[i]; |
| 259 | SkASSERT(sampler.fVariable.getType() == kTexture2DSampler_GrSLType); |
| 260 | if (visibility == sampler.fVisibility) { |
Brian Salomon | 94efbf5 | 2016-11-29 13:43:05 -0500 | [diff] [blame] | 261 | sampler.fVariable.appendDecl(fProgramBuilder->shaderCaps(), out); |
egdaniel | 09aa1fc | 2016-04-20 07:09:46 -0700 | [diff] [blame] | 262 | out->append(";\n"); |
| 263 | } |
| 264 | } |
| 265 | |
Greg Daniel | 31ec144 | 2017-05-08 10:30:59 -0400 | [diff] [blame^] | 266 | for (int i = 0; i < fTexelBuffers.count(); ++i) { |
| 267 | const UniformInfo& texelBuffer = fTexelBuffers[i]; |
| 268 | if (visibility == texelBuffer.fVisibility) { |
| 269 | texelBuffer.fVariable.appendDecl(fProgramBuilder->shaderCaps(), out); |
| 270 | out->append(";\n"); |
| 271 | } |
| 272 | } |
| 273 | |
Greg Daniel | dbd44c7 | 2017-01-24 15:12:12 -0500 | [diff] [blame] | 274 | SkDEBUGCODE(bool firstOffsetCheck = false); |
egdaniel | 09aa1fc | 2016-04-20 07:09:46 -0700 | [diff] [blame] | 275 | SkString uniformsString; |
Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 276 | for (int i = 0; i < fUniforms.count(); ++i) { |
| 277 | const UniformInfo& localUniform = fUniforms[i]; |
Greg Daniel | 18f9602 | 2017-05-04 15:09:03 -0400 | [diff] [blame] | 278 | if (visibility & localUniform.fVisibility) { |
Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 279 | if (GrSLTypeIsFloatType(localUniform.fVariable.getType())) { |
Greg Daniel | dbd44c7 | 2017-01-24 15:12:12 -0500 | [diff] [blame] | 280 | #ifdef SK_DEBUG |
| 281 | if (!firstOffsetCheck) { |
| 282 | // Check to make sure we are starting our offset at 0 so the offset qualifier we |
| 283 | // set on each variable in the uniform block is valid. |
| 284 | SkASSERT(0 == localUniform.fUBOffset); |
| 285 | firstOffsetCheck = true; |
| 286 | } |
| 287 | #endif |
Brian Salomon | 94efbf5 | 2016-11-29 13:43:05 -0500 | [diff] [blame] | 288 | localUniform.fVariable.appendDecl(fProgramBuilder->shaderCaps(), &uniformsString); |
Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 289 | uniformsString.append(";\n"); |
Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 290 | } |
| 291 | } |
| 292 | } |
| 293 | if (!uniformsString.isEmpty()) { |
Greg Daniel | 18f9602 | 2017-05-04 15:09:03 -0400 | [diff] [blame] | 294 | uint32_t uniformBinding; |
| 295 | const char* stage; |
| 296 | if (kVertex_GrShaderFlag == visibility) { |
| 297 | uniformBinding = kGeometryBinding; |
| 298 | stage = "vertex"; |
| 299 | } else if (kGeometry_GrShaderFlag == visibility) { |
| 300 | uniformBinding = kGeometryBinding; |
| 301 | stage = "geometry"; |
| 302 | } else { |
| 303 | SkASSERT(kFragment_GrShaderFlag == visibility); |
| 304 | uniformBinding = kFragBinding; |
| 305 | stage = "fragment"; |
| 306 | } |
Greg Daniel | 164a9f0 | 2016-02-22 09:56:40 -0500 | [diff] [blame] | 307 | out->appendf("layout (set=%d, binding=%d) uniform %sUniformBuffer\n{\n", |
| 308 | kUniformBufferDescSet, uniformBinding, stage); |
| 309 | out->appendf("%s\n};\n", uniformsString.c_str()); |
| 310 | } |
egdaniel | 4ee1cda | 2016-02-26 08:18:49 -0800 | [diff] [blame] | 311 | } |