Commit 5163cd0c by Mohan Maiya Committed by Commit Bot

Add isYUV to angle::Format

In preparation for adding support for more YUV formats add an 'isYUV' field that tracks whether a format is a YUV format. For now it is set if the format string contains the substring 'PLANE'. This is not the case for all known YUV formats but the condition can be expanded when required. Bug: angleproject:5773 Change-Id: Icb574037dc8105584931835dab0b60e8bafa3262 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2774762Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarShahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Mohan Maiya <m.maiya@samsung.com>
parent da437f26
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
"src/libANGLE/renderer/FormatID_autogen.h": "src/libANGLE/renderer/FormatID_autogen.h":
"6f4f189645a02e35e5f0c07c65d8124f", "6f4f189645a02e35e5f0c07c65d8124f",
"src/libANGLE/renderer/Format_table_autogen.cpp": "src/libANGLE/renderer/Format_table_autogen.cpp":
"22666d912bb7ce0a6f25b1da1d7fed8b", "fe2b6b0f7a76fdb3d3113b5bbdc4dad3",
"src/libANGLE/renderer/angle_format.py": "src/libANGLE/renderer/angle_format.py":
"32ba71942c0fd00e6807104f1bb80a3c", "32ba71942c0fd00e6807104f1bb80a3c",
"src/libANGLE/renderer/angle_format_data.json": "src/libANGLE/renderer/angle_format_data.json":
...@@ -10,5 +10,5 @@ ...@@ -10,5 +10,5 @@
"src/libANGLE/renderer/angle_format_map.json": "src/libANGLE/renderer/angle_format_map.json":
"ae32dfce450f7b7ffc62d746d6fddf83", "ae32dfce450f7b7ffc62d746d6fddf83",
"src/libANGLE/renderer/gen_angle_format_table.py": "src/libANGLE/renderer/gen_angle_format_table.py":
"27be642dae863060e942ca8be5f293e5" "428255701f3a3a9630593ab110ca98c1"
} }
\ No newline at end of file
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"src/libANGLE/renderer/angle_format_map.json": "src/libANGLE/renderer/angle_format_map.json":
"ae32dfce450f7b7ffc62d746d6fddf83", "ae32dfce450f7b7ffc62d746d6fddf83",
"src/libANGLE/renderer/gen_angle_format_table.py": "src/libANGLE/renderer/gen_angle_format_table.py":
"27be642dae863060e942ca8be5f293e5", "428255701f3a3a9630593ab110ca98c1",
"src/libANGLE/renderer/metal/shaders/blit.metal": "src/libANGLE/renderer/metal/shaders/blit.metal":
"2f6286729703039d41d0f6a109a23ac2", "2f6286729703039d41d0f6a109a23ac2",
"src/libANGLE/renderer/metal/shaders/clear.metal": "src/libANGLE/renderer/metal/shaders/clear.metal":
......
...@@ -44,6 +44,7 @@ struct Format final : private angle::NonCopyable ...@@ -44,6 +44,7 @@ struct Format final : private angle::NonCopyable
bool isFixed, bool isFixed,
bool isScaled, bool isScaled,
bool isSRGB, bool isSRGB,
bool isYUV,
gl::VertexAttribType vertexAttribType); gl::VertexAttribType vertexAttribType);
static const Format &Get(FormatID id) { return gFormatInfoTable[static_cast<int>(id)]; } static const Format &Get(FormatID id) { return gFormatInfoTable[static_cast<int>(id)]; }
...@@ -107,6 +108,7 @@ struct Format final : private angle::NonCopyable ...@@ -107,6 +108,7 @@ struct Format final : private angle::NonCopyable
bool isFixed; bool isFixed;
bool isScaled; bool isScaled;
bool isSRGB; bool isSRGB;
bool isYUV;
// For vertex formats only. Returns the "type" value for glVertexAttribPointer etc. // For vertex formats only. Returns the "type" value for glVertexAttribPointer etc.
gl::VertexAttribType vertexAttribType; gl::VertexAttribType vertexAttribType;
...@@ -146,6 +148,7 @@ constexpr Format::Format(FormatID id, ...@@ -146,6 +148,7 @@ constexpr Format::Format(FormatID id,
bool isFixed, bool isFixed,
bool isScaled, bool isScaled,
bool isSRGB, bool isSRGB,
bool isYUV,
gl::VertexAttribType vertexAttribType) gl::VertexAttribType vertexAttribType)
: id(id), : id(id),
glInternalFormat(glFormat), glInternalFormat(glFormat),
...@@ -175,6 +178,7 @@ constexpr Format::Format(FormatID id, ...@@ -175,6 +178,7 @@ constexpr Format::Format(FormatID id,
isFixed(isFixed), isFixed(isFixed),
isScaled(isScaled), isScaled(isScaled),
isSRGB(isSRGB), isSRGB(isSRGB),
isYUV(isYUV),
vertexAttribType(vertexAttribType) vertexAttribType(vertexAttribType)
{} {}
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -70,7 +70,7 @@ static constexpr rx::FastCopyFunctionMap NoCopyFunctions; ...@@ -70,7 +70,7 @@ static constexpr rx::FastCopyFunctionMap NoCopyFunctions;
const Format gFormatInfoTable[] = {{ const Format gFormatInfoTable[] = {{
// clang-format off // clang-format off
{{ FormatID::NONE, GL_NONE, GL_NONE, nullptr, NoCopyFunctions, nullptr, nullptr, GL_NONE, 0, 0, 0, 0, 0, 0, 0, 0, 0, false, false, false, false, gl::VertexAttribType::InvalidEnum }}, {{ FormatID::NONE, GL_NONE, GL_NONE, nullptr, NoCopyFunctions, nullptr, nullptr, GL_NONE, 0, 0, 0, 0, 0, 0, 0, 0, 0, false, false, false, false, false, gl::VertexAttribType::InvalidEnum }},
{angle_format_info_cases} // clang-format on {angle_format_info_cases} // clang-format on
}}; }};
...@@ -193,7 +193,7 @@ def get_color_write_function(angle_format): ...@@ -193,7 +193,7 @@ def get_color_write_function(angle_format):
return 'WriteColor<' + channel_struct + ', ' + write_component_type + '>' return 'WriteColor<' + channel_struct + ', ' + write_component_type + '>'
format_entry_template = """ {{ FormatID::{id}, {glInternalFormat}, {fboImplementationInternalFormat}, {mipGenerationFunction}, {fastCopyFunctions}, {colorReadFunction}, {colorWriteFunction}, {namedComponentType}, {R}, {G}, {B}, {A}, {L}, {D}, {S}, {pixelBytes}, {componentAlignmentMask}, {isBlock}, {isFixed}, {isScaled}, {isSRGB}, {vertexAttribType} }}, format_entry_template = """ {{ FormatID::{id}, {glInternalFormat}, {fboImplementationInternalFormat}, {mipGenerationFunction}, {fastCopyFunctions}, {colorReadFunction}, {colorWriteFunction}, {namedComponentType}, {R}, {G}, {B}, {A}, {L}, {D}, {S}, {pixelBytes}, {componentAlignmentMask}, {isBlock}, {isFixed}, {isScaled}, {isSRGB}, {isYUV}, {vertexAttribType} }},
""" """
...@@ -341,6 +341,9 @@ def json_to_table_data(format_id, json, angle_to_gl): ...@@ -341,6 +341,9 @@ def json_to_table_data(format_id, json, angle_to_gl):
parsed["isFixed"] = bool_str("FIXED" in format_id) parsed["isFixed"] = bool_str("FIXED" in format_id)
parsed["isScaled"] = bool_str("SCALED" in format_id) parsed["isScaled"] = bool_str("SCALED" in format_id)
parsed["isSRGB"] = bool_str("SRGB" in format_id) parsed["isSRGB"] = bool_str("SRGB" in format_id)
# For now we only look for the 'PLANE' substring in format string. Expand this condition
# when adding support for YUV formats that have different identifying markers.
parsed["isYUV"] = bool_str("PLANE" in format_id)
parsed["vertexAttribType"] = "gl::VertexAttribType::" + get_vertex_attrib_type(format_id) parsed["vertexAttribType"] = "gl::VertexAttribType::" + get_vertex_attrib_type(format_id)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment