ImageDataLayout.h 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /*
  2. * Copyright (c) 2021, Stephan Unverwerth <s.unverwerth@serenityos.org>
  3. * Copyright (c) 2022, Jelle Raaijmakers <jelle@gmta.nl>
  4. *
  5. * SPDX-License-Identifier: BSD-2-Clause
  6. */
  7. #pragma once
  8. #include <LibGPU/ImageFormat.h>
  9. namespace GPU {
  10. // Order of bytes within a single component
  11. enum class ComponentBytesOrder {
  12. Normal,
  13. Reversed,
  14. };
  15. struct PackingSpecification final {
  16. u32 depth_stride { 0 };
  17. u32 row_stride { 0 };
  18. u8 byte_alignment { 1 };
  19. ComponentBytesOrder component_bytes_order { ComponentBytesOrder::Normal };
  20. };
  21. // Full dimensions of the image
  22. struct DimensionSpecification final {
  23. u32 width;
  24. u32 height;
  25. u32 depth;
  26. };
  27. // Subselection (source or target) within the image
  28. struct ImageSelection final {
  29. i32 offset_x { 0 };
  30. i32 offset_y { 0 };
  31. i32 offset_z { 0 };
  32. u32 width;
  33. u32 height;
  34. u32 depth;
  35. };
  36. struct ImageDataLayout final {
  37. PixelType pixel_type;
  38. PackingSpecification packing {};
  39. DimensionSpecification dimensions;
  40. ImageSelection selection;
  41. };
  42. }