PreparedGraphicsObjects

from panda3d.core import PreparedGraphicsObjects
class PreparedGraphicsObjects

Bases:

Bases: ReferenceCount

A table of objects that are saved within the graphics context for reference by handle later. Generally, this represents things like OpenGL texture objects or display lists (or their equivalent on other platforms).

This object simply records the pointers to the context objects created by the individual GSG’s; these context objects will contain enough information to reference or release the actual object stored within the graphics context.

These tables may potentially be shared between related graphics contexts, hence their storage here in a separate object rather than as a part of the GraphicsStateGuardian.

Inheritance diagram

Inheritance diagram of PreparedGraphicsObjects

dequeueGeom(geom: Geom) bool

Removes a geom from the queued list of geoms to be prepared. Normally it is not necessary to call this, unless you change your mind about preparing it at the last minute, since the geom will automatically be dequeued and prepared at the next frame.

The return value is true if the geom is successfully dequeued, false if it had not been queued.

dequeueIndexBuffer(data: GeomPrimitive) bool

Removes a buffer from the queued list of data arrays to be prepared. Normally it is not necessary to call this, unless you change your mind about preparing it at the last minute, since the data will automatically be dequeued and prepared at the next frame.

The return value is true if the buffer is successfully dequeued, false if it had not been queued.

dequeueSampler(sampler: SamplerState) bool

Removes a sampler from the queued list of samplers to be prepared. Normally it is not necessary to call this, unless you change your mind about preparing it at the last minute, since the sampler will automatically be dequeued and prepared at the next frame.

The return value is true if the sampler is successfully dequeued, false if it had not been queued.

dequeueShader(shader: Shader) bool

Removes a shader from the queued list of shaders to be prepared. Normally it is not necessary to call this, unless you change your mind about preparing it at the last minute, since the shader will automatically be dequeued and prepared at the next frame.

The return value is true if the shader is successfully dequeued, false if it had not been queued.

dequeueShaderBuffer(data: ShaderBuffer) bool

Removes a buffer from the queued list of data arrays to be prepared. Normally it is not necessary to call this, unless you change your mind about preparing it at the last minute, since the data will automatically be dequeued and prepared at the next frame.

The return value is true if the buffer is successfully dequeued, false if it had not been queued.

dequeueTexture(tex: Texture) bool

Removes a texture from the queued list of textures to be prepared. Normally it is not necessary to call this, unless you change your mind about preparing it at the last minute, since the texture will automatically be dequeued and prepared at the next frame.

The return value is true if the texture is successfully dequeued, false if it had not been queued.

dequeueVertexBuffer(data: GeomVertexArrayData) bool

Removes a buffer from the queued list of data arrays to be prepared. Normally it is not necessary to call this, unless you change your mind about preparing it at the last minute, since the data will automatically be dequeued and prepared at the next frame.

The return value is true if the buffer is successfully dequeued, false if it had not been queued.

enqueueGeom(geom: Geom)

Indicates that a geom would like to be put on the list to be prepared when the GSG is next ready to do this (presumably at the next frame).

enqueueIndexBuffer(data: GeomPrimitive)

Indicates that a buffer would like to be put on the list to be prepared when the GSG is next ready to do this (presumably at the next frame).

enqueueSampler(sampler: SamplerState)

Indicates that a sampler would like to be put on the list to be prepared when the GSG is next ready to do this (presumably at the next frame).

enqueueShader(shader: Shader)

Indicates that a shader would like to be put on the list to be prepared when the GSG is next ready to do this (presumably at the next frame).

enqueueShaderBuffer(data: ShaderBuffer)

Indicates that a buffer would like to be put on the list to be prepared when the GSG is next ready to do this (presumably at the next frame).

enqueueTexture(tex: Texture)

Indicates that a texture would like to be put on the list to be prepared when the GSG is next ready to do this (presumably at the next frame).

enqueueVertexBuffer(data: GeomVertexArrayData)

Indicates that a buffer would like to be put on the list to be prepared when the GSG is next ready to do this (presumably at the next frame).

getGraphicsMemoryLimit() int

Returns the artificial cap on graphics memory that will be imposed on this GSG. See setGraphicsMemoryLimit().

getName() str

Returns the name of the PreparedGraphicsObjects structure. This is an arbitrary name that serves mainly to uniquify the context for PStats reporting.

getNumPrepared() int

Returns the number of objects of any kind that have already been prepared on this GSG.

getNumPreparedGeoms() int

Returns the number of geoms that have already been prepared on this GSG.

getNumPreparedIndexBuffers() int

Returns the number of index buffers that have already been prepared on this GSG.

getNumPreparedSamplers() int

Returns the number of samplers that have already been prepared on this GSG.

getNumPreparedShaderBuffers() int

Returns the number of index buffers that have already been prepared on this GSG.

getNumPreparedShaders() int

Returns the number of shaders that have already been prepared on this GSG.

getNumPreparedTextures() int

Returns the number of textures that have already been prepared on this GSG.

getNumPreparedVertexBuffers() int

Returns the number of vertex buffers that have already been prepared on this GSG.

getNumQueued() int

Returns the number of objects of any kind that have been enqueued to be prepared on this GSG.

getNumQueuedGeoms() int

Returns the number of geoms that have been enqueued to be prepared on this GSG.

getNumQueuedIndexBuffers() int

Returns the number of index buffers that have been enqueued to be prepared on this GSG.

getNumQueuedSamplers() int

Returns the number of samplers that have been enqueued to be prepared on this GSG.

getNumQueuedShaderBuffers() int

Returns the number of index buffers that have been enqueued to be prepared on this GSG.

getNumQueuedShaders() int

Returns the number of shaders that have been enqueued to be prepared on this GSG.

getNumQueuedTextures() int

Returns the number of textures that have been enqueued to be prepared on this GSG.

getNumQueuedVertexBuffers() int

Returns the number of vertex buffers that have been enqueued to be prepared on this GSG.

isGeomPrepared(geom: Geom) bool

Returns true if the vertex buffer has been prepared on this GSG, false otherwise.

isGeomQueued(geom: Geom) bool

Returns true if the geom has been queued on this GSG, false otherwise.

isIndexBufferPrepared(data: GeomPrimitive) bool

Returns true if the index buffer has been prepared on this GSG, false otherwise.

isIndexBufferQueued(data: GeomPrimitive) bool

Returns true if the index buffer has been queued on this GSG, false otherwise.

isSamplerPrepared(sampler: SamplerState) bool

Returns true if the sampler has been prepared on this GSG, false otherwise.

isSamplerQueued(sampler: SamplerState) bool

Returns true if the sampler has been queued on this GSG, false otherwise.

isShaderBufferPrepared(data: ShaderBuffer) bool

Returns true if the index buffer has been prepared on this GSG, false otherwise.

isShaderBufferQueued(data: ShaderBuffer) bool

Returns true if the index buffer has been queued on this GSG, false otherwise.

isShaderPrepared(shader: Shader) bool

Returns true if the shader has been prepared on this GSG, false otherwise.

isShaderQueued(shader: Shader) bool

Returns true if the shader has been queued on this GSG, false otherwise.

isTexturePrepared(tex: Texture) bool

Returns true if the texture has been prepared on this GSG, false otherwise.

isTextureQueued(tex: Texture) bool

Returns true if the texture has been queued on this GSG, false otherwise.

isVertexBufferPrepared(data: GeomVertexArrayData) bool

Returns true if the vertex buffer has been prepared on this GSG, false otherwise.

isVertexBufferQueued(data: GeomVertexArrayData) bool

Returns true if the vertex buffer has been queued on this GSG, false otherwise.

prepareGeomNow(geom: Geom, gsg: GraphicsStateGuardianBase) GeomContext

Immediately creates a new GeomContext for the indicated geom and returns it. This assumes that the GraphicsStateGuardian is the currently active rendering context and that it is ready to accept new geoms. If this is not necessarily the case, you should use enqueueGeom() instead.

Normally, this function is not called directly. Call Geom.prepareNow() instead.

The GeomContext contains all of the pertinent information needed by the GSG to keep track of this one particular geom, and will exist as long as the geom is ready to be rendered.

When either the Geom or the PreparedGraphicsObjects object destructs, the GeomContext will be deleted.

prepareIndexBufferNow(data: GeomPrimitive, gsg: GraphicsStateGuardianBase) IndexBufferContext

Immediately creates a new IndexBufferContext for the indicated data and returns it. This assumes that the GraphicsStateGuardian is the currently active rendering context and that it is ready to accept new datas. If this is not necessarily the case, you should use enqueueIndexBuffer() instead.

Normally, this function is not called directly. Call Data::prepare_now() instead.

The IndexBufferContext contains all of the pertinent information needed by the GSG to keep track of this one particular data, and will exist as long as the data is ready to be rendered.

When either the Data or the PreparedGraphicsObjects object destructs, the IndexBufferContext will be deleted.

prepareSamplerNow(sampler: SamplerState, gsg: GraphicsStateGuardianBase) SamplerContext

Immediately creates a new SamplerContext for the indicated sampler and returns it. This assumes that the GraphicsStateGuardian is the currently active rendering context and that it is ready to accept new samplers. If this is not necessarily the case, you should use enqueueSampler() instead.

Normally, this function is not called directly. Call Sampler::prepare_now() instead.

The SamplerContext contains all of the pertinent information needed by the GSG to keep track of this one particular sampler, and will exist as long as the sampler is ready to be rendered.

When either the Sampler or the PreparedGraphicsObjects object destructs, the SamplerContext will be deleted.

prepareShaderBufferNow(data: ShaderBuffer, gsg: GraphicsStateGuardianBase) BufferContext

Immediately creates a new BufferContext for the indicated data and returns it. This assumes that the GraphicsStateGuardian is the currently active rendering context and that it is ready to accept new datas. If this is not necessarily the case, you should use enqueueShaderBuffer() instead.

Normally, this function is not called directly. Call Data::prepare_now() instead.

The BufferContext contains all of the pertinent information needed by the GSG to keep track of this one particular data, and will exist as long as the data is ready to be rendered.

When either the Data or the PreparedGraphicsObjects object destructs, the BufferContext will be deleted.

prepareShaderNow(shader: Shader, gsg: GraphicsStateGuardianBase) ShaderContext

Immediately creates a new ShaderContext for the indicated shader and returns it. This assumes that the GraphicsStateGuardian is the currently active rendering context and that it is ready to accept new shaders. If this is not necessarily the case, you should use enqueueShader() instead.

Normally, this function is not called directly. Call Shader.prepareNow() instead.

The ShaderContext contains all of the pertinent information needed by the GSG to keep track of this one particular shader, and will exist as long as the shader is ready to be rendered.

When either the Shader or the PreparedGraphicsObjects object destructs, the ShaderContext will be deleted.

prepareTextureNow(tex: Texture, view: int, gsg: GraphicsStateGuardianBase) TextureContext

Immediately creates a new TextureContext for the indicated texture and returns it. This assumes that the GraphicsStateGuardian is the currently active rendering context and that it is ready to accept new textures. If this is not necessarily the case, you should use enqueueTexture() instead.

Normally, this function is not called directly. Call Texture.prepareNow() instead.

The TextureContext contains all of the pertinent information needed by the GSG to keep track of this one particular texture, and will exist as long as the texture is ready to be rendered.

When either the Texture or the PreparedGraphicsObjects object destructs, the TextureContext will be deleted.

prepareVertexBufferNow(data: GeomVertexArrayData, gsg: GraphicsStateGuardianBase) VertexBufferContext

Immediately creates a new VertexBufferContext for the indicated data and returns it. This assumes that the GraphicsStateGuardian is the currently active rendering context and that it is ready to accept new datas. If this is not necessarily the case, you should use enqueueVertexBuffer() instead.

Normally, this function is not called directly. Call Data::prepare_now() instead.

The VertexBufferContext contains all of the pertinent information needed by the GSG to keep track of this one particular data, and will exist as long as the data is ready to be rendered.

When either the Data or the PreparedGraphicsObjects object destructs, the VertexBufferContext will be deleted.

releaseAll()

Releases all prepared objects of all kinds at once.

releaseAllGeoms() int

Releases all geoms at once. This will force them to be reloaded into geom memory for all GSG’s that share this object. Returns the number of geoms released.

releaseAllIndexBuffers() int

Releases all datas at once. This will force them to be reloaded into data memory for all GSG’s that share this object. Returns the number of datas released.

releaseAllSamplers() int

Releases all samplers at once. This will force them to be reloaded for all GSG’s that share this object. Returns the number of samplers released.

releaseAllShaderBuffers() int

Releases all datas at once. This will force them to be reloaded into data memory for all GSG’s that share this object. Returns the number of datas released.

releaseAllShaders() int

Releases all shaders at once. This will force them to be reloaded into shader memory for all GSG’s that share this object. Returns the number of shaders released.

releaseAllTextures() int

Releases all textures at once. This will force them to be reloaded into texture memory for all GSG’s that share this object. Returns the number of textures released.

releaseAllVertexBuffers() int

Releases all datas at once. This will force them to be reloaded into data memory for all GSG’s that share this object. Returns the number of datas released.

releaseGeom(gc: GeomContext)

Indicates that a geom context, created by a previous call to prepare_geom(), is no longer needed. The driver resources will not be freed until some GSG calls update(), indicating it is at a stage where it is ready to release geoms–this prevents conflicts from threading or multiple GSG’s sharing geoms (we have no way of knowing which graphics context is currently active, or what state it’s in, at the time releaseGeom() is called).

releaseIndexBuffer(ibc: IndexBufferContext)

Indicates that a data context, created by a previous call to prepare_index_buffer(), is no longer needed. The driver resources will not be freed until some GSG calls update(), indicating it is at a stage where it is ready to release datas–this prevents conflicts from threading or multiple GSG’s sharing datas (we have no way of knowing which graphics context is currently active, or what state it’s in, at the time releaseIndexBuffer() is called).

releaseSampler(sc: SamplerContext)

Indicates that a sampler context, created by a previous call to prepare_sampler(), is no longer needed. The driver resources will not be freed until some GSG calls update(), indicating it is at a stage where it is ready to release samplers.

releaseSampler(sampler: SamplerState)

Releases a sampler if it has already been prepared, or removes it from the preparation queue.

releaseShader(sc: ShaderContext)

Indicates that a shader context, created by a previous call to prepare_shader(), is no longer needed. The driver resources will not be freed until some GSG calls update(), indicating it is at a stage where it is ready to release shaders–this prevents conflicts from threading or multiple GSG’s sharing shaders (we have no way of knowing which graphics context is currently active, or what state it’s in, at the time releaseShader() is called).

releaseShaderBuffer(bc: BufferContext)

Indicates that a data context, created by a previous call to prepare_shader_buffer(), is no longer needed. The driver resources will not be freed until some GSG calls update(), indicating it is at a stage where it is ready to release datas–this prevents conflicts from threading or multiple GSG’s sharing datas (we have no way of knowing which graphics context is currently active, or what state it’s in, at the time releaseShaderBuffer() is called).

releaseTexture(tex: Texture)

Releases a texture if it has already been prepared, or removes it from the preparation queue.

releaseTexture(tc: TextureContext)

Indicates that a texture context, created by a previous call to prepare_texture(), is no longer needed. The driver resources will not be freed until some GSG calls update(), indicating it is at a stage where it is ready to release textures–this prevents conflicts from threading or multiple GSG’s sharing textures (we have no way of knowing which graphics context is currently active, or what state it’s in, at the time releaseTexture() is called).

releaseVertexBuffer(vbc: VertexBufferContext)

Indicates that a data context, created by a previous call to prepare_vertex_buffer(), is no longer needed. The driver resources will not be freed until some GSG calls update(), indicating it is at a stage where it is ready to release datas–this prevents conflicts from threading or multiple GSG’s sharing datas (we have no way of knowing which graphics context is currently active, or what state it’s in, at the time releaseVertexBuffer() is called).

setGraphicsMemoryLimit(limit: int)

Sets an artificial cap on graphics memory that will be imposed on this GSG.

This limits the total amount of graphics memory, including texture memory and vertex buffer memory, that will be consumed by the GSG, regardless of whether the hardware claims to provide more graphics memory than this. It is useful to put a ceiling on graphics memory consumed, since some drivers seem to allow the application to consume more memory than the hardware can realistically support.

showGraphicsMemoryLru(out: ostream)

Writes to the indicated ostream a report of how the various textures and vertex buffers are allocated in the LRU.

showResidencyTrackers(out: ostream)

Writes to the indicated ostream a report of how the various textures and vertex buffers are allocated in the LRU.