Lines Matching refs:self
24 def __init__(self, cgen, inputVar, handlemapVarName, prefix, isHandleFunc): argument
25 self.cgen = cgen
26 self.inputVar = inputVar
27 self.prefix = prefix
28 self.handlemapVarName = handlemapVarName
31 return lambda t: self.cgen.generalAccess(t, parentVarName = varName, asPtr = asPtr)
34 return lambda t: self.cgen.generalLengthAccess(t, parentVarName = varName)
37 return lambda t: self.cgen.generalLengthAccessGuard(t, parentVarName=varName)
39 self.exprAccessor = makeAccess(self.inputVar)
40 self.exprAccessorValue = makeAccess(self.inputVar, asPtr = False)
41 self.lenAccessor = makeLengthAccess(self.inputVar)
42 self.lenAccessorGuard = makeLengthAccessGuard(self.inputVar)
44 self.checked = False
45 self.isHandleFunc = isHandleFunc
47 def needSkip(self, vulkanType): argument
50 def makeCastExpr(self, vulkanType): argument
52 self.cgen.makeCTypeDecl(vulkanType, useParamName=False))
54 def asNonConstCast(self, access, vulkanType): argument
56 …casted = "%s(%s)" % (self.makeCastExpr(vulkanType.getForAddressAccess().getForNonConstAccess()), a…
58 casted = "%s(%s)" % (self.makeCastExpr(vulkanType.getForNonConstAccess()), access)
60 …casted = "%s(%s)" % (self.makeCastExpr(vulkanType.getForAddressAccess().getForNonConstAccess()), a…
63 def onCheck(self, vulkanType): argument
66 def endCheck(self, vulkanType): argument
69 def onCompoundType(self, vulkanType): argument
71 if self.needSkip(vulkanType):
72 self.cgen.line("// TODO: Unsupported : %s" %
73 self.cgen.makeCTypeDecl(vulkanType))
75 access = self.exprAccessor(vulkanType)
76 lenAccess = self.lenAccessor(vulkanType)
77 lenAccessGuard = self.lenAccessorGuard(vulkanType)
82 self.cgen.beginIf(lenAccessGuard)
85 self.cgen.beginIf(access)
95 self.cgen.beginFor(forInit, forCond, forIncr)
97 accessCasted = self.asNonConstCast(access, vulkanType)
98 self.cgen.funcCall(None, self.prefix + vulkanType.typeName,
99 [self.handlemapVarName, accessCasted])
102 self.cgen.endFor()
105 self.cgen.endIf()
108 self.cgen.endIf()
110 def onString(self, vulkanType): argument
113 def onStringArray(self, vulkanType): argument
116 def onStaticArr(self, vulkanType): argument
117 if not self.isHandleFunc(vulkanType):
120 accessLhs = self.exprAccessor(vulkanType)
121 lenAccess = self.lenAccessor(vulkanType)
123 self.cgen.stmt("%s->mapHandles_%s(%s%s, %s)" % \
124 (self.handlemapVarName, vulkanType.typeName,
125 self.makeCastExpr(vulkanType.getForAddressAccess().getForNonConstAccess()),
128 def onStructExtension(self, vulkanType): argument
129 access = self.exprAccessor(vulkanType)
132 self.cgen.beginIf(access)
133 self.cgen.funcCall(None, self.prefix + "extension_struct",
134 [self.handlemapVarName, castedAccessExpr])
135 self.cgen.endIf()
137 def onPointer(self, vulkanType): argument
138 if self.needSkip(vulkanType):
141 if not self.isHandleFunc(vulkanType):
144 access = self.exprAccessor(vulkanType)
145 lenAccess = self.lenAccessor(vulkanType)
148 self.cgen.beginIf(access)
150 self.cgen.stmt( \
152 (self.handlemapVarName,
154 self.makeCastExpr(vulkanType.getForNonConstAccess()),
158 self.cgen.endIf()
160 def onValue(self, vulkanType): argument
161 if not self.isHandleFunc(vulkanType):
163 access = self.exprAccessor(vulkanType)
164 self.cgen.stmt(
166 (self.handlemapVarName, vulkanType.typeName,
167 self.makeCastExpr(vulkanType.getForAddressAccess().getForNonConstAccess()),
171 def __init__(self, module, typeInfo): argument
172 VulkanWrapperGenerator.__init__(self, module, typeInfo)
174 self.codegen = CodeGen()
176 self.handlemapPrefix = "handlemap_"
177 self.toMapVar = "toMap"
178 self.handlemapVarName = "handlemap"
179 self.handlemapParam = \
181 self.handlemapVarName)
182 self.voidType = makeVulkanTypeSimple(False, "void", 0)
184 self.handlemapCodegen = \
187 self.toMapVar,
188 self.handlemapVarName,
189 self.handlemapPrefix,
192 self.knownDefs = {}
194 self.extensionHandlemapPrototype = \
195 VulkanAPI(self.handlemapPrefix + "extension_struct",
196 self.voidType,
197 [self.handlemapParam, STRUCT_EXTENSION_PARAM_FOR_WRITE])
199 def onBegin(self,): argument
200 VulkanWrapperGenerator.onBegin(self)
201 self.module.appendImpl(self.codegen.makeFuncDecl(
202 self.extensionHandlemapPrototype))
204 def onGenType(self, typeXml, name, alias): argument
205 VulkanWrapperGenerator.onGenType(self, typeXml, name, alias)
207 if name in self.knownDefs:
210 category = self.typeInfo.categoryOf(name)
213 self.module.appendHeader(
214 self.codegen.makeFuncAlias(self.handlemapPrefix + name,
215 self.handlemapPrefix + alias))
219 structInfo = self.typeInfo.structs[name]
226 [self.handlemapParam] + \
227 list(map(typeFromName, [self.toMapVar]))
230 VulkanAPI(self.handlemapPrefix + name,
231 self.voidType,
235 self.handlemapCodegen.cgen = cgen
239 iterateVulkanType(self.typeInfo, member,
240 self.handlemapCodegen)
242 self.module.appendHeader(
243 self.codegen.makeFuncDecl(handlemapPrototype))
244 self.module.appendImpl(
245 self.codegen.makeFuncImpl(handlemapPrototype, funcDefGenerator))
247 def onGenCmd(self, cmdinfo, name, alias): argument
248 VulkanWrapperGenerator.onGenCmd(self, cmdinfo, name, alias)
250 def onEnd(self,): argument
251 VulkanWrapperGenerator.onEnd(self)
254 cgen.funcCall(None, self.handlemapPrefix + ext.name,
255 [self.handlemapVarName, castedAccess])
257 self.module.appendImpl(
258 self.codegen.makeFuncImpl(
259 self.extensionHandlemapPrototype,
260 lambda cgen: self.emitForEachStructExtension(
262 self.voidType,