1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-06-26 10:29:31 +00:00

Guarantees alignof(4) on all GPU-bound structures.

Taken as given: Metal's requirement here is reasonable enough that it'll either be the same as other frameworks, or at least possibly help them down a fast path.
This commit is contained in:
Thomas Harte 2020-08-07 21:18:08 -04:00
parent 219923bd63
commit 4c9418f59a
2 changed files with 8 additions and 5 deletions

View File

@ -210,9 +210,11 @@ struct ScanTarget {
/*!
Defines a scan in terms of its two endpoints.
Is guaranteed to be a multiple of four bytes in size.
*/
struct Scan {
struct EndPoint {
struct alignas(4) Scan {
struct alignas(4) EndPoint {
/// Provide the coordinate of this endpoint. These are fixed point, purely fractional
/// numbers, relative to the scale provided in the Modals.
uint16_t x, y;

View File

@ -51,7 +51,7 @@ class BufferingScanTarget: public Outputs::Display::ScanTarget {
// Extends the definition of a Scan to include two extra fields,
// completing this scan's source data and destination locations.
struct Scan {
struct alignas(4) Scan {
Outputs::Display::ScanTarget::Scan scan;
/// Stores the y coordinate for this scan's data within the write area texture.
@ -66,12 +66,13 @@ class BufferingScanTarget: public Outputs::Display::ScanTarget {
/// Defines the boundaries of a complete line of video — a 2d start and end location,
/// composite phase and amplitude (if relevant), the source line in the intermediate buffer
/// plus the start and end offsets of the area that is visible from the intermediate buffer.
struct Line {
struct EndPoint {
struct alignas(4) Line {
struct alignas(4) EndPoint {
uint16_t x, y;
uint16_t cycles_since_end_of_horizontal_retrace;
int16_t composite_angle;
} end_points[2];
uint16_t line;
uint8_t composite_amplitude;
};