diff --git a/engine/src/flutter/impeller/compositor/formats.h b/engine/src/flutter/impeller/compositor/formats.h index 2d51ecb711..d694bfbbb7 100644 --- a/engine/src/flutter/impeller/compositor/formats.h +++ b/engine/src/flutter/impeller/compositor/formats.h @@ -17,12 +17,40 @@ namespace impeller { class Texture; +//------------------------------------------------------------------------------ +/// @brief The Pixel formats supported by Impeller. The naming convention +/// denotes the usage of the component, the bit width of that +/// component, and then one or more qualifiers to its +/// interpretation. +/// +/// For instance, `kR8G8B8A8_UNormInt_SRGB` is a 32 bits-per-pixel +/// format ordered in RGBA with 8 bits per component with each +/// component expressed as an unsigned normalized integer and a +/// conversion from sRGB to linear color space. +/// +/// Key: +/// R -> Red Component +/// G -> Green Component +/// B -> Blue Component +/// D -> Depth Component +/// S -> Stencil Component +/// U -> Unsigned (Lack of this denotes a signed component) +/// Norm -> Normalized +/// SRGB -> sRGB to linear interpretation +/// +/// While the effective bit width of the pixel can be determined by +/// adding up the widths of each component, only the non-esoteric +/// formats are tightly packed. Do not assume tight packing for the +/// esoteric formats and use blit passes to convert to a +/// non-esoteric pass. +/// enum class PixelFormat { kUnknown, kR8G8B8A8_UNormInt, kR8G8B8A8_UNormInt_SRGB, kB8G8R8A8_UNormInt, kB8G8R8A8_UNormInt_SRGB, + // Esoteric formats only used as render targets. kD32_Float_S8_UNormInt, }; diff --git a/engine/src/flutter/impeller/compositor/shader_types.cc b/engine/src/flutter/impeller/compositor/shader_types.cc new file mode 100644 index 0000000000..7cc7587666 --- /dev/null +++ b/engine/src/flutter/impeller/compositor/shader_types.cc @@ -0,0 +1,11 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "impeller/compositor/shader_types.h" + +namespace impeller { + +// + +} // namespace impeller diff --git a/engine/src/flutter/impeller/compositor/shader_types.h b/engine/src/flutter/impeller/compositor/shader_types.h new file mode 100644 index 0000000000..9045829681 --- /dev/null +++ b/engine/src/flutter/impeller/compositor/shader_types.h @@ -0,0 +1,77 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#pragma once + +#include +#include +#include + +#include "impeller/geometry/matrix.h" + +namespace impeller { + +enum class ShaderStage { + kUnknown, + kVertex, + kFragment, +}; + +enum class ShaderType { + kUnknown, + kVoid, + kBoolean, + kSignedByte, + kUnsignedByte, + kSignedShort, + kUnsignedShort, + kSignedInt, + kUnsignedInt, + kSignedInt64, + kUnsignedInt64, + kAtomicCounter, + kHalfFloat, + kFloat, + kDouble, + kStruct, + kImage, + kSampledImage, + kSampler, +}; + +template +struct ShaderUniformSlot { + using Type = T; + const char* name; + size_t binding; +}; + +struct ShaderStageIOSlot { + const char* name; + size_t location; + size_t set; + size_t binding; + ShaderType type; + size_t bit_width; + size_t vec_size; + size_t columns; +}; + +struct SampledImageSlot { + const char* name; + size_t texture_index; + size_t sampler_index; + + constexpr bool HasTexture() const { return texture_index < 32u; } + + constexpr bool HasSampler() const { return sampler_index < 32u; } +}; + +template +struct Padding { + private: + uint8_t pad_[Size]; +}; + +} // namespace impeller diff --git a/engine/src/flutter/impeller/geometry/matrix.cc b/engine/src/flutter/impeller/geometry/matrix.cc index 662987053c..420be5fd6d 100644 --- a/engine/src/flutter/impeller/geometry/matrix.cc +++ b/engine/src/flutter/impeller/geometry/matrix.cc @@ -194,7 +194,7 @@ Scalar Matrix::GetDeterminant() const { } /* - * Adapted for Radar from Graphics Gems: + * Adapted for Impeller from Graphics Gems: * http://www.realtimerendering.com/resources/GraphicsGems/gemsii/unmatrix.c */ Matrix::DecompositionResult Matrix::Decompose() const {