summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibGPU/ImageDataLayout.h
blob: 1a3604bef79718b81219b4a9bdf4b41e4cf0d45c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/*
 * Copyright (c) 2021, Stephan Unverwerth <s.unverwerth@serenityos.org>
 * Copyright (c) 2022, Jelle Raaijmakers <jelle@gmta.nl>
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */

#pragma once

#include <LibGPU/ImageFormat.h>

namespace GPU {

// Order of bytes within a single component
enum class ComponentBytesOrder {
    Normal,
    Reversed,
};

struct PackingSpecification final {
    u32 depth_stride { 0 };
    u32 row_stride { 0 };
    u8 byte_alignment { 1 };
    ComponentBytesOrder component_bytes_order { ComponentBytesOrder::Normal };
};

// Full dimensions of the image
struct DimensionSpecification final {
    u32 width;
    u32 height;
    u32 depth;
};

// Subselection (source or target) within the image
struct ImageSelection final {
    i32 offset_x { 0 };
    i32 offset_y { 0 };
    i32 offset_z { 0 };
    u32 width;
    u32 height;
    u32 depth;
};

struct ImageDataLayout final {
    PixelType pixel_type;
    PackingSpecification packing {};
    DimensionSpecification dimensions;
    ImageSelection selection;
};

}