mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-09-22 21:55:52 +00:00
Change SRGB to be a component type, not a ResourceFormat flag
* This allows us to have sRGB as a type hint, and better matches API format types. * It's currently impossible and unlikely to ever be the case that srgb is applied to anything other than UNorm, so having it be independent from the component type was a degree of freedom that was unused.
This commit is contained in:
@@ -180,10 +180,12 @@ struct ResourceFormat
|
||||
:rtype: ``bool``
|
||||
)");
|
||||
bool BGRAOrder() const { return (flags & ResourceFormat_BGRA) != 0; }
|
||||
DOCUMENT(R"(:return: ``True`` if the components are SRGB corrected on read and write.
|
||||
DOCUMENT(R"(Equivalent to checking if :data:`compType` is :data:`CompType.UNormSRGB`
|
||||
|
||||
:return: ``True`` if the components are SRGB corrected on read and write.
|
||||
:rtype: ``bool``
|
||||
)");
|
||||
bool SRGBCorrected() const { return (flags & ResourceFormat_SRGB) != 0; }
|
||||
bool SRGBCorrected() const { return compType == CompType::UNormSRGB; }
|
||||
DOCUMENT(R"(Get the subsampling rate for a YUV format. Only valid when :data:`type` is
|
||||
a YUV format like :attr:`ResourceFormatType.YUV8`.
|
||||
|
||||
@@ -232,18 +234,6 @@ For other formats, 1 is returned.
|
||||
flags &= ~ResourceFormat_BGRA;
|
||||
}
|
||||
|
||||
DOCUMENT(R"(Set SRGB correction flag. See :meth:`SRGBCorrected`.
|
||||
|
||||
:param bool flag: The new flag value.
|
||||
)");
|
||||
void SetSRGBCorrected(bool flag)
|
||||
{
|
||||
if(flag)
|
||||
flags |= ResourceFormat_SRGB;
|
||||
else
|
||||
flags &= ~ResourceFormat_SRGB;
|
||||
}
|
||||
|
||||
DOCUMENT(R"(Set YUV subsampling rate. See :meth:`YUVSubsampling`.
|
||||
|
||||
The value should be e.g. 444 for 4:4:4 or 422 for 4:2:2. Invalid values will result in 0 being set.
|
||||
@@ -289,7 +279,6 @@ private:
|
||||
enum
|
||||
{
|
||||
ResourceFormat_BGRA = 0x001,
|
||||
ResourceFormat_SRGB = 0x002,
|
||||
|
||||
ResourceFormat_444 = 0x004,
|
||||
ResourceFormat_422 = 0x008,
|
||||
|
||||
@@ -821,7 +821,6 @@ rdcarray<VertexInputAttribute> PipeState::GetVertexInputs() const
|
||||
ret[a].format.compCount = (uint8_t)compCount;
|
||||
ret[a].format.compType = compType;
|
||||
ret[a].format.type = ResourceFormatType::Regular;
|
||||
ret[a].format.SetSRGBCorrected(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -105,6 +105,7 @@ std::string DoStringise(const CompType &el)
|
||||
STRINGISE_ENUM_CLASS(SScaled);
|
||||
STRINGISE_ENUM_CLASS_NAMED(Depth, "Depth/Stencil");
|
||||
STRINGISE_ENUM_CLASS(Double);
|
||||
STRINGISE_ENUM_CLASS_NAMED(UNormSRGB, "sRGB");
|
||||
}
|
||||
END_ENUM_STRINGISE();
|
||||
}
|
||||
|
||||
@@ -225,6 +225,11 @@ DOCUMENT(R"(Represents the component type of a channel in a texture or element i
|
||||
.. data:: Double
|
||||
|
||||
A double-precision (64-bit) floating point value.
|
||||
|
||||
.. data:: UNormSRGB
|
||||
|
||||
Similar to :data:`UNorm` normalised between the minimum and maximum unsigned values to ``0.0`` -
|
||||
``1.0``, but with an sRGB gamma curve applied.
|
||||
)");
|
||||
enum class CompType : uint8_t
|
||||
{
|
||||
@@ -238,6 +243,7 @@ enum class CompType : uint8_t
|
||||
SScaled,
|
||||
Depth,
|
||||
Double,
|
||||
UNormSRGB,
|
||||
};
|
||||
|
||||
DECLARE_REFLECTION_ENUM(CompType);
|
||||
|
||||
Reference in New Issue
Block a user