Loading...
Searching...
No Matches
RenderTarget.h
Go to the documentation of this file.
1/**************************************************************************************************
2 * This file is a part of Ultralight. *
3 * *
4 * See <https://ultralig.ht> for licensing and more. *
5 * *
6 * (C) 2024 Ultralight, Inc. *
7 **************************************************************************************************/
8#pragma once
10#include <Ultralight/Bitmap.h>
11#include <Ultralight/Geometry.h>
12
13namespace ultralight {
14
15#pragma pack(push, 1)
16
17///
18/// Offscreen render target, used when rendering Views via the GPU renderer.
19///
20/// When a View is rendered via the GPU renderer (see View::is_accelerated), it will be rendered to
21/// an offscreen render target (View::render_target) that you can display in your application.
22///
23/// This is intended to be used with a custom GPUDriver implementation in a game or similar
24/// application.
25///
26/// ## Displaying the Render Target
27///
28/// To display the View's render target, you should:
29///
30/// 1. Retrieve the underlying texture via RenderTarget::texture_id().
31/// 2. Bind the texture using your custom GPUDriver implementation.
32/// 3. Draw a textured quad with the provided UV coordinates (RenderTarget::uv_coords()).
33///
35 ///
36 /// Whether this target is empty (null texture)
37 ///
39
40 ///
41 /// The viewport width (in device coordinates).
42 ///
43 uint32_t width;
44
45 ///
46 /// The viewport height (in device coordinates).
47 ///
48 uint32_t height;
49
50 ///
51 /// The GPUDriver-specific texture ID (you should bind the texture using your custom GPUDriver
52 /// implementation before drawing a quad).
53 ///
54 uint32_t texture_id;
55
56 ///
57 /// The texture width (in pixels). This may be padded.
58 ///
59 uint32_t texture_width;
60
61 ///
62 /// The texture height (in pixels). This may be padded.
63 ///
65
66 ///
67 /// The pixel format of the texture.
68 ///
70
71 ///
72 /// UV coordinates of the texture (this is needed because the texture may be padded).
73 ///
75
76 ///
77 /// The GPUDriver-specific render buffer ID.
78 ///
80
82};
83
84#pragma pack(pop)
85
86} // namespace ultralight
#define UExport
Definition Exports.h:25
Definition App.h:14
BitmapFormat
The various Bitmap formats.
Definition Bitmap.h:19
Float Rectangle Helper.
Definition Geometry.h:419
Offscreen render target, used when rendering Views via the GPU renderer.
Definition RenderTarget.h:34
Rect uv_coords
UV coordinates of the texture (this is needed because the texture may be padded).
Definition RenderTarget.h:74
uint32_t texture_id
The GPUDriver-specific texture ID (you should bind the texture using your custom GPUDriver implementa...
Definition RenderTarget.h:54
uint32_t width
The viewport width (in device coordinates).
Definition RenderTarget.h:43
uint32_t render_buffer_id
The GPUDriver-specific render buffer ID.
Definition RenderTarget.h:79
BitmapFormat texture_format
The pixel format of the texture.
Definition RenderTarget.h:69
uint32_t height
The viewport height (in device coordinates).
Definition RenderTarget.h:48
bool is_empty
Whether this target is empty (null texture)
Definition RenderTarget.h:38
uint32_t texture_height
The texture height (in pixels).
Definition RenderTarget.h:64
uint32_t texture_width
The texture width (in pixels).
Definition RenderTarget.h:59