![]() |
Rendering Engine 0.2.0
Modular Graphics Rendering Engine | v0.2.0
|
Combines CPU-side and GPU-side texture representations, managing both lifetimes and transitions. More...
#include <image_data_gpu.hpp>
Public Member Functions | |
| ImageDataGpu (std::string path, IRenderer *renderer) | |
| Constructs an ImageDataGpu object from an image file path. | |
| ImageDataGpu (std::vector< uint8_t > const &fileBytes, IRenderer *renderer) | |
| Constructs an ImageDataGpu object from raw image file bytes. | |
| ~ImageDataGpu () | |
| Destructor. Frees GPU memory if allocated. | |
| void | UploadToGPU () |
| Uploads the texture data to GPU if not already uploaded. | |
| void | ReleaseFromGPU () |
| Releases the GPU resources (image, sampler, view). | |
| bool | IsOnGPU () const |
| Checks whether the texture is currently loaded in GPU memory. | |
| size_t | GetSizeInRAM () const |
| Gets the size of the texture in RAM (in bytes). | |
| size_t | GetSizeInGPU () const |
| Gets the size of the texture in GPU memory (in bytes). | |
| ImageData const & | GetCpuImageData () const |
| Returns a const reference to the CPU-side image data. | |
| ImageData & | GetCpuImageData () |
| Returns a modifiable reference to the CPU-side image data. | |
| ITextureRenderResources * | GetTextureRenderResources () const |
| Returns a pointer to the GPU texture resource interface. | |
Combines CPU-side and GPU-side texture representations, managing both lifetimes and transitions.
This class owns the image data in RAM (via ImageData) and optionally uploads/releases the corresponding GPU-side representation. It provides accessors for both and tracks memory usage.
Definition at line 25 of file image_data_gpu.hpp.
| ImageDataGpu::ImageDataGpu | ( | std::string | path, |
| IRenderer * | renderer ) |
Constructs an ImageDataGpu object from an image file path.
| path | Path to the image file (must be supported format such as .png or .jpg). |
| renderer | Pointer to the rendering engine interface (IRenderer). |
Definition at line 10 of file image_data_gpu.cpp.
| ImageDataGpu::ImageDataGpu | ( | std::vector< uint8_t > const & | fileBytes, |
| IRenderer * | renderer ) |
Constructs an ImageDataGpu object from raw image file bytes.
This constructor allows loading GPU-ready image data directly from a memory buffer rather than from disk. The input is interpreted as an encoded image (PNG or JPEG). After decoding via ImageData, the pixel data is uploaded to GPU memory through the provided IRenderer interface.
| fileBytes | Raw binary contents of an image file (PNG or JPEG). |
| renderer | Pointer to the rendering engine interface responsible for uploading the texture to GPU memory. |
Definition at line 20 of file image_data_gpu.cpp.
| rendering_engine::ImageDataGpu::~ImageDataGpu | ( | ) |
Destructor. Frees GPU memory if allocated.
Definition at line 30 of file image_data_gpu.cpp.
| ImageData & ImageDataGpu::GetCpuImageData | ( | ) |
Returns a modifiable reference to the CPU-side image data.
Definition at line 106 of file image_data_gpu.cpp.
| ImageData const & ImageDataGpu::GetCpuImageData | ( | ) | const |
Returns a const reference to the CPU-side image data.
Definition at line 101 of file image_data_gpu.cpp.
| size_t rendering_engine::ImageDataGpu::GetSizeInGPU | ( | ) | const |
Gets the size of the texture in GPU memory (in bytes).
Definition at line 91 of file image_data_gpu.cpp.
| size_t rendering_engine::ImageDataGpu::GetSizeInRAM | ( | ) | const |
Gets the size of the texture in RAM (in bytes).
Definition at line 81 of file image_data_gpu.cpp.
| ITextureRenderResources * ImageDataGpu::GetTextureRenderResources | ( | ) | const |
Returns a pointer to the GPU texture resource interface.
Definition at line 111 of file image_data_gpu.cpp.
| bool ImageDataGpu::IsOnGPU | ( | ) | const |
Checks whether the texture is currently loaded in GPU memory.
Definition at line 72 of file image_data_gpu.cpp.
| void ImageDataGpu::ReleaseFromGPU | ( | ) |
Releases the GPU resources (image, sampler, view).
After this call, the texture will be stored in RAM only.
Definition at line 56 of file image_data_gpu.cpp.
| void ImageDataGpu::UploadToGPU | ( | ) |
Uploads the texture data to GPU if not already uploaded.
This function instantiates GPU resource handlers and invokes texture uploading routines.
Definition at line 34 of file image_data_gpu.cpp.