IDL C#: Static counts.

This commit is contained in:
Бранимир Караџић 2019-07-09 22:43:50 -07:00
parent 1416c5981d
commit f0caf7bfb7
2 changed files with 35 additions and 8 deletions

View File

@ -1,3 +1,14 @@
/*
* Copyright 2011-2019 Branimir Karadzic. All rights reserved.
* License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE
*/
/*
*
* AUTO GENERATED! DO NOT EDIT!
*
*/
using System;
using System.Runtime.InteropServices;
using System.Security;
@ -667,7 +678,7 @@ public static partial class bgfx
public byte numGPUs;
public fixed uint gpu[4];
public Limits limits;
public fixed ushort formats[(int)TextureFormat.Count];
public fixed ushort formats[85];
}
public unsafe struct InternalData
@ -829,7 +840,7 @@ public static partial class bgfx
public long rtMemoryUsed;
public int transientVbUsed;
public int transientIbUsed;
public fixed uint numPrims[(int)Topology.Count];
public fixed uint numPrims[5];
public long gpuMemoryMax;
public long gpuMemoryUsed;
public ushort width;
@ -846,8 +857,8 @@ public static partial class bgfx
{
public uint hash;
public ushort stride;
public fixed ushort offset[(int)Attrib.Count];
public fixed ushort attributes[(int)Attrib.Count];
public fixed ushort offset[18];
public fixed ushort attributes[18];
}
public unsafe struct Encoder

View File

@ -2,6 +2,17 @@ local codegen = require "codegen"
local idl = codegen.idl "bgfx.idl"
local csharp_template = [[
/*
* Copyright 2011-2019 Branimir Karadzic. All rights reserved.
* License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE
*/
/*
*
* AUTO GENERATED! DO NOT EDIT!
*
*/
using System;
using System.Runtime.InteropServices;
using System.Security;
@ -191,9 +202,11 @@ local function lastCombinedFlagBlock()
end
end
local enum = {}
local function convert_array(member)
if string.find(member.array, "::") then
return member.array:gsub("::", "."):gsub("%[","[(int)")
if string.find(member.array, "::") then
return string.format("[%d]", enum[member.array])
else
return member.array
end
@ -204,7 +217,7 @@ local function convert_struct_member(member)
return "fixed " .. convert_type(member) .. " " .. member.name .. convert_array(member)
else
return convert_type(member) .. " " .. member.name
end
end
end
local namespace = ""
@ -225,6 +238,9 @@ function converter.types(typ)
yield("");
yield("\tCount")
yield("}")
enum["[" .. typ.typename .. "::Count]"] = #typ.enum
elseif typ.bits ~= nil then
local prefix, name = typ.name:match "(%u%l+)(.*)"
if prefix ~= lastCombinedFlag then
@ -296,7 +312,7 @@ function converter.types(typ)
end
for _, member in ipairs(typ.struct) do
yield(
yield(
indent .. "\tpublic " .. convert_struct_member(member) .. ";"
)
end