Deinterleaved Vertex Buffer Update

This commit is contained in:
2026-10-09 16:30:11 -07:00
parent c320c4bb19
commit c1aa2837ca
3 changed files with 97 additions and 14 deletions

View File

@ -102,8 +102,9 @@ class ShaderContext {
constants = [];
textureUnits = [];
var instStruct: VertexStructure = null;
if (instancingType > 0) { // Instancing
var instStruct = new VertexStructure();
instStruct = new VertexStructure();
instStruct.add("ipos", VertexData.Float3);
if (instancingType == 2 || instancingType == 4) {
instStruct.add("irot", VertexData.Float3);
@ -117,11 +118,19 @@ class ShaderContext {
this.instanceStride = Std.int(instStruct.byteSize() / 4);
instStruct.instanced = true;
pipeState.inputLayout = [structure, instStruct];
}
else { // Regular
pipeState.inputLayout = [structure];
#if lnx_deinterleaved
var layouts: Array<VertexStructure> = [];
for (e in structure.elements) {
var s = new VertexStructure();
s.add(e.name, e.data);
layouts.push(s);
}
#else
var layouts = [structure];
#end
if (instStruct != null) layouts.push(instStruct);
pipeState.inputLayout = layouts;
// Depth
pipeState.depthWrite = raw.depth_write;