#include <metal_renderer.h>


Public Member Functions | |
| MetalRenderer ()=default | |
| ~MetalRenderer () override | |
| bool | Initialize (SDL_Window *window) override |
| Initializes the renderer with a given window. | |
| void | Shutdown () override |
| Shuts down the renderer and releases all associated resources. | |
| TextureHandle | CreateTexture (int width, int height) override |
| Creates a new, empty texture. | |
| TextureHandle | CreateTextureWithFormat (int width, int height, uint32_t format, int access) override |
| Creates a new texture with a specific pixel format. | |
| void | UpdateTexture (TextureHandle texture, const Bitmap &bitmap) override |
| Updates a texture with the pixel data from a Bitmap. | |
| void | DestroyTexture (TextureHandle texture) override |
| Destroys a texture and frees its associated resources. | |
| bool | LockTexture (TextureHandle texture, SDL_Rect *rect, void **pixels, int *pitch) override |
| void | UnlockTexture (TextureHandle texture) override |
| void | Clear () override |
| Clears the entire render target with the current draw color. | |
| void | Present () override |
| Presents the back buffer to the screen, making the rendered content visible. | |
| void | RenderCopy (TextureHandle texture, const SDL_Rect *srcrect, const SDL_Rect *dstrect) override |
| Copies a portion of a texture to the current render target. | |
| void | SetRenderTarget (TextureHandle texture) override |
| Sets the render target for subsequent drawing operations. | |
| void | SetDrawColor (SDL_Color color) override |
| Sets the color used for drawing operations (e.g., Clear). | |
| void * | GetBackendRenderer () override |
| Provides an escape hatch to get the underlying, concrete renderer object. | |
| void | SetMetalView (void *view) |
Public Member Functions inherited from yaze::gfx::IRenderer | |
| virtual | ~IRenderer ()=default |
Private Attributes | |
| void * | metal_view_ = nullptr |
| void * | command_queue_ = nullptr |
| TextureHandle | render_target_ = nullptr |
Definition at line 8 of file metal_renderer.h.
|
default |
|
override |
Definition at line 22 of file metal_renderer.mm.
References Shutdown().

|
overridevirtual |
Initializes the renderer with a given window.
| window | A pointer to the SDL_Window to render into. |
Implements yaze::gfx::IRenderer.
Definition at line 26 of file metal_renderer.mm.
References command_queue_, LOG_WARN, and metal_view_.
|
overridevirtual |
Shuts down the renderer and releases all associated resources.
Implements yaze::gfx::IRenderer.
Definition at line 53 of file metal_renderer.mm.
References command_queue_, and render_target_.
Referenced by ~MetalRenderer().
|
overridevirtual |
Creates a new, empty texture.
| width | The width of the texture in pixels. |
| height | The height of the texture in pixels. |
Implements yaze::gfx::IRenderer.
Definition at line 61 of file metal_renderer.mm.
References metal_view_.
Referenced by CreateTextureWithFormat().
|
overridevirtual |
Creates a new texture with a specific pixel format.
| width | The width of the texture in pixels. |
| height | The height of the texture in pixels. |
| format | The SDL pixel format (e.g., SDL_PIXELFORMAT_ARGB8888). |
| access | The texture access pattern (e.g., SDL_TEXTUREACCESS_STREAMING). |
Implements yaze::gfx::IRenderer.
Definition at line 94 of file metal_renderer.mm.
References CreateTexture().

|
overridevirtual |
Updates a texture with the pixel data from a Bitmap.
| texture | The handle of the texture to update. |
| bitmap | The Bitmap containing the new pixel data. |
Implements yaze::gfx::IRenderer.
Definition at line 102 of file metal_renderer.mm.
References yaze::platform::ConvertSurfaceFormat(), and yaze::gfx::Bitmap::surface().

|
overridevirtual |
Destroys a texture and frees its associated resources.
| texture | The handle of the texture to destroy. |
Implements yaze::gfx::IRenderer.
Definition at line 136 of file metal_renderer.mm.
References render_target_.
|
overridevirtual |
Implements yaze::gfx::IRenderer.
Definition at line 150 of file metal_renderer.mm.
|
overridevirtual |
Implements yaze::gfx::IRenderer.
Definition at line 159 of file metal_renderer.mm.
|
overridevirtual |
Clears the entire render target with the current draw color.
Implements yaze::gfx::IRenderer.
Definition at line 163 of file metal_renderer.mm.
|
overridevirtual |
Presents the back buffer to the screen, making the rendered content visible.
Implements yaze::gfx::IRenderer.
Definition at line 166 of file metal_renderer.mm.
|
overridevirtual |
Copies a portion of a texture to the current render target.
| texture | The source texture handle. |
| srcrect | A pointer to the source rectangle, or nullptr for the entire texture. |
| dstrect | A pointer to the destination rectangle, or nullptr for the entire render target. |
Implements yaze::gfx::IRenderer.
Definition at line 169 of file metal_renderer.mm.
References command_queue_, and render_target_.
|
overridevirtual |
Sets the render target for subsequent drawing operations.
| texture | The texture to set as the render target, or nullptr to set it back to the default (the window). |
Implements yaze::gfx::IRenderer.
Definition at line 226 of file metal_renderer.mm.
References render_target_.
|
overridevirtual |
Sets the color used for drawing operations (e.g., Clear).
| color | The SDL_Color to use. |
Implements yaze::gfx::IRenderer.
Definition at line 230 of file metal_renderer.mm.
|
overridevirtual |
Provides an escape hatch to get the underlying, concrete renderer object.
This is necessary for integrating with third-party libraries like ImGui that are tied to a specific rendering backend (e.g., SDL_Renderer*, ID3D11Device*).
Implements yaze::gfx::IRenderer.
Definition at line 234 of file metal_renderer.mm.
References command_queue_.
| void yaze::gfx::MetalRenderer::SetMetalView | ( | void * | view | ) |
Definition at line 238 of file metal_renderer.mm.
References metal_view_.
Referenced by yaze::platform::IOSWindowBackend::InitializeRenderer().
|
private |
Definition at line 36 of file metal_renderer.h.
Referenced by CreateTexture(), Initialize(), and SetMetalView().
|
private |
Definition at line 37 of file metal_renderer.h.
Referenced by GetBackendRenderer(), Initialize(), RenderCopy(), and Shutdown().
|
private |
Definition at line 38 of file metal_renderer.h.
Referenced by DestroyTexture(), RenderCopy(), SetRenderTarget(), and Shutdown().