Skip to content

raisin::TextureBindingCacheView ​

class · #include <rayrai/TextureBindingCache.hpp>

Internal: hot-loop handle to the calling thread's texture caches.

Captures references to the thread's binding state and texture-state cache once, so repeated binds avoid the thread-local lookups. Valid only on the constructing thread and while its GL context stays current.

Constructors & destructor ​

TextureBindingCacheView ​

cpp
TextureBindingCacheView()

Public member functions ​

objectExists ​

cpp
bool objectExists(unsigned int textureId)

Parameters

ParameterDescription
textureIdGL texture name; 0 returns false.

Returns True if textureId names an existing texture (glIsTexture; positive results are cached).

samplerStatePrepared ​

cpp
bool samplerStatePrepared(
    unsigned int textureId,
    std::uint64_t samplerKey) const

Parameters

ParameterDescription
textureIdGL texture name.
samplerKeyCaller-defined hash of the desired sampler state.

Returns True if markSamplerStatePrepared() recorded samplerKey for textureId.

markSamplerStatePrepared ​

cpp
void markSamplerStatePrepared(
    unsigned int textureId,
    std::uint64_t samplerKey)

Record that textureId's sampler state matches samplerKey (ignored for id 0).

Parameters

ParameterDescription
textureIdGL texture name.
samplerKeyCaller-defined hash of the applied sampler state.

bindTexture ​

cpp
void bindTexture(int unit, gl::GLenum target, unsigned int textureId)

Bind textureId to target on unit unless the cache says it is already bound. Units outside [0, 64) are ignored. Leaves unit as the active texture unit.

Parameters

ParameterDescription
unitTexture unit index.
targetGL texture target.
textureIdGL texture name (0 unbinds).

bindTexture2D ​

cpp
void bindTexture2D(int unit, unsigned int textureId)

bindTexture() with GL_TEXTURE_2D.

Parameters

ParameterDescription
unitTexture unit index.
textureIdGL texture name.

bindTextureCube ​

cpp
void bindTextureCube(int unit, unsigned int textureId)

bindTexture() with GL_TEXTURE_CUBE_MAP.

Parameters

ParameterDescription
unitTexture unit index.
textureIdGL texture name.

RaiSim — physics for robotics and AI.