MCPcopy Create free account
hub / github.com/RenderKit/embree / Texture2D_create

Function Texture2D_create

tutorials/common/texture/texture2d.cpp:187–203  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

185//////////////////////////////////////////////////////////////////////////////
186
187extern "C" void *Texture2D_create(Vec2i &size, void *data,
188 uint32_t type, uint32_t flags)
189{
190 Texture2D *self = (Texture2D*) alignedUSMMalloc(sizeof(Texture2D),16);
191 self->size = size;
192
193 // Due to float rounding frac(x) can be exactly 1.0f (e.g. for very small
194 // negative x), although it should be strictly smaller than 1.0f. We handle
195 // this case by having sizef slightly smaller than size, such that
196 // frac(x)*sizef is always < size.
197 self->sizef = Vec2f(nextafter((float)size.x, -1.0f), nextafter((float)size.y, -1.0f));
198 self->halfTexel = Vec2f(0.5f/size.x, 0.5f/size.y);
199 self->data = data;
200 self->get = Texture2D_get_addr(type, flags & TEXTURE_FILTER_NEAREST);
201
202 return self;
203}
204
205} // namespace embree

Callers

nothing calls this directly

Calls 3

alignedUSMMallocFunction · 0.85
nextafterFunction · 0.85
Texture2D_get_addrFunction · 0.85

Tested by

no test coverage detected