MCPcopy Create free account
hub / github.com/defold/defold / GetUniformBufferLayout

Function GetUniformBufferLayout

engine/graphics/src/graphics.cpp:1876–1889  ·  view source on GitHub ↗

This function expects that the offsets are already calculated! I.e, if the types are created manually you can use the UpdateShaderTypesOffsets function (graphics_private.h) first.

Source from the content-addressed store, hash-verified

1874 // This function expects that the offsets are already calculated! I.e, if the types are created manually
1875 // you can use the UpdateShaderTypesOffsets function (graphics_private.h) first.
1876 void GetUniformBufferLayout(uint32_t root_type_index, const ShaderResourceTypeInfo* types, uint32_t num_types, UniformBufferLayout* layout_desc)
1877 {
1878 HashState32 hash_state;
1879 dmHashInit32(&hash_state, false);
1880 assert(root_type_index < num_types);
1881
1882 bool* visited = (bool*)dmAlloca(sizeof(bool) * num_types);
1883 memset(visited, 0, sizeof(bool) * num_types);
1884
1885 HashTypeRecursive(root_type_index, types, num_types, &hash_state, visited);
1886
1887 layout_desc->m_Hash = dmHashFinal32(&hash_state);
1888 layout_desc->m_Size = CalculateShaderTypesSize(root_type_index, types, num_types);
1889 }
1890 void GetGraphicsContextLimits(HContext context, GraphicsContextLimits& limits)
1891 {
1892 GraphicsContext* gc = (GraphicsContext*) context;

Callers 4

GenerateUniformBufferFunction · 0.85
TEST_FFunction · 0.85
AddUniformBufferLayoutFunction · 0.85
InitializeMethod · 0.85

Calls 5

dmHashInit32Function · 0.85
HashTypeRecursiveFunction · 0.85
dmHashFinal32Function · 0.85
CalculateShaderTypesSizeFunction · 0.85
assertFunction · 0.50

Tested by 2

TEST_FFunction · 0.68
InitializeMethod · 0.68