-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Begin to implement new TextureFormat design
- Loading branch information
1 parent
9977120
commit 275683c
Showing
16 changed files
with
82 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#pragma once | ||
|
||
namespace osc | ||
{ | ||
// describes the encoding method used to read/write values to a single channel (R/G/B/A) of a texture | ||
enum class TextureChannelEncoding { | ||
Linear, | ||
sRGB, | ||
NUM_OPTIONS | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,54 @@ | ||
#pragma once | ||
|
||
#include <oscar/Graphics/TextureChannelEncoding.h> | ||
#include <oscar/Graphics/TextureChannelFormat.h> | ||
|
||
#include <cstddef> | ||
#include <optional> | ||
|
||
namespace osc | ||
{ | ||
// the underlying format used by a texture | ||
// | ||
// note: the naming convention and docuemntation for each format is designed | ||
// to be the same as Vulkan's: | ||
// | ||
// https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkFormat.html | ||
enum class TextureFormat { | ||
R8, | ||
RG16, | ||
RGB24, | ||
RGBA32, | ||
// a one-component, 8-bit unsigned normalized format that has a single 8-bit R component | ||
R8_UNORM, | ||
|
||
// a two-component, 16-bit unsigned normalized format that has an 8-bit R component in byte | ||
// 0, and an 8-bit G component in byte 1. | ||
R8G8_UNORM, | ||
|
||
// a three-component, 24-bit unsigned normalized format that has an 8-bit R component in | ||
// byte 0, an 8-bit G component in byte 1, and an 8-bit B component in byte 2. | ||
R8G8B8_UNORM, | ||
|
||
// a four-component, 32-bit unsigned normalized format that has an 8-bit R component in byte 0, | ||
// an 8-bit G component in byte 1, an 8-bit B component in byte 2, and an 8-bit A component in | ||
// byte 3. | ||
R8G8B8A8_UNORM, | ||
|
||
// a four-component, 32-bit unsigned normalized format that has an 8-bit R component stored with | ||
// sRGB nonlinear encoding in byte 0, an 8-bit G component stored with sRGB nonlinear encoding in | ||
// byte 1, an 8-bit B component stored with sRGB nonlinear encoding in byte 2, and an 8-bit A | ||
// component in byte 3. | ||
R8G8B8A8_SRGB, | ||
|
||
RGFloat, | ||
RGBFloat, | ||
RGBAFloat, | ||
|
||
NUM_OPTIONS, | ||
|
||
Default = R8G8B8A8_SRGB, | ||
}; | ||
|
||
size_t num_channels_in(TextureFormat); | ||
TextureChannelFormat channel_format_of(TextureFormat); | ||
TextureChannelFormat channel_format_of(TextureFormat, size_t channel); | ||
TextureChannelEncoding channel_encoding_of(TextureFormat, size_t channel); | ||
size_t num_bytes_per_pixel_in(TextureFormat); | ||
std::optional<TextureFormat> to_texture_format(size_t num_channels, TextureChannelFormat); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters