pub struct GraphicsResource { /* private fields */ }Expand description
A CUDA-side handle to a graphics-API resource. Drops unregister the
resource via cuGraphicsUnregisterResource.
Implementations§
Source§impl GraphicsResource
impl GraphicsResource
Sourcepub unsafe fn from_raw(context: &Context, handle: CUgraphicsResource) -> Self
pub unsafe fn from_raw(context: &Context, handle: CUgraphicsResource) -> Self
Wrap a raw CUgraphicsResource. The resource is assumed to be
registered already (e.g. from cu<API>Register*).
§Safety
handle must be a live, registered resource. baracuda unregisters
it when this wrapper (and all clones) drop.
pub fn as_raw(&self) -> CUgraphicsResource
Sourcepub fn set_map_flags(&self, flags: u32) -> Result<()>
pub fn set_map_flags(&self, flags: u32) -> Result<()>
Change the map flags before mapping (e.g. READ_ONLY for shader sampling, WRITE_DISCARD for compute output).
Sourcepub fn map(&self, stream: &Stream) -> Result<()>
pub fn map(&self, stream: &Stream) -> Result<()>
Map the resource on stream so CUDA can access it. Pair with
Self::unmap.
Sourcepub fn unmap(&self, stream: &Stream) -> Result<()>
pub fn unmap(&self, stream: &Stream) -> Result<()>
Unmap the resource on stream, releasing it back to the graphics API.
Sourcepub fn mapped_pointer(&self) -> Result<(CUdeviceptr, usize)>
pub fn mapped_pointer(&self) -> Result<(CUdeviceptr, usize)>
Retrieve the device pointer + size for a mapped buffer-type resource (typical of GL buffer objects, D3D buffers).
Sourcepub fn mapped_array(&self, array_index: u32, mip_level: u32) -> Result<CUarray>
pub fn mapped_array(&self, array_index: u32, mip_level: u32) -> Result<CUarray>
Retrieve the subresource CUDA array for a mapped image / texture resource (GL textures, D3D textures, VDPAU surfaces).
Sourcepub fn mapped_mipmapped_array(&self) -> Result<CUmipmappedArray>
pub fn mapped_mipmapped_array(&self) -> Result<CUmipmappedArray>
Retrieve the mipmapped-array handle for a mapped mipmapped texture.
Trait Implementations§
Source§impl Clone for GraphicsResource
impl Clone for GraphicsResource
Source§fn clone(&self) -> GraphicsResource
fn clone(&self) -> GraphicsResource
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more