MCPcopy Create free account
hub / github.com/NVIDIAGameWorks/Falcor / addField

Method addField

Source/Falcor/Scene/Material/RGLFile.cpp:50–71  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48 }
49
50 void RGLFile::addField(const std::string& name, FieldType type, const std::vector<uint32_t>& shape, const void* data)
51 {
52 Field field;
53 field.name = name;
54 field.type = type;
55 field.dim = uint32_t(shape.size());
56 field.shape.reset(new uint64_t[field.dim]);
57 field.numElems = 1;
58 for (uint32_t i = 0; i < field.dim; ++i)
59 {
60 field.shape[i] = shape[i];
61 field.numElems *= shape[i];
62 }
63 size_t N = fieldSize(type);
64 if (N == 0) FALCOR_THROW("RGLFile::fieldSize: Invalid field type");
65
66 field.data.reset(new uint8_t[N * field.numElems]);
67 std::memcpy(field.data.get(), data, N * field.numElems);
68
69 mFieldMap[name] = int(mFields.size());
70 mFields.emplace_back(std::move(field));
71 }
72
73 void RGLFile::validate()
74 {

Callers 5

toRGLFileMethod · 0.80
CreateMethod · 0.80
CreateMethod · 0.80
CreateMethod · 0.80

Calls 3

sizeMethod · 0.45
resetMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected