mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-08-23 23:16:31 +00:00
Go back to reporting normalised vertex inputs on GL as SNorm/UNorm
* This is still accurate, what we're missing is "read data as int, then cast to float" which is represented by setting 'floatCast' to true. A normalized cast or interpret is accurately represented by saying the input is snorm/unorm typed.
This commit is contained in:
@@ -1295,20 +1295,9 @@ void GLPipelineStateViewer::setState()
|
||||
QString format = QString(a.format.Name());
|
||||
|
||||
if(!a.enabled)
|
||||
{
|
||||
format = tr("Generic=") + MakeGenericValueString(compCount, compType, a);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(a.floatCast && a.normalizedCast)
|
||||
{
|
||||
format += tr(" Normalised and cast to float");
|
||||
}
|
||||
else if(a.floatCast)
|
||||
{
|
||||
format += tr(" Cast to float");
|
||||
}
|
||||
}
|
||||
else if(a.floatCast)
|
||||
format += tr(" Cast to float");
|
||||
|
||||
RDTreeWidgetItem *node =
|
||||
new RDTreeWidgetItem({i, a.enabled ? tr("Enabled") : tr("Disabled"), name, format,
|
||||
|
||||
@@ -43,8 +43,8 @@ struct VertexAttribute
|
||||
|
||||
bool operator==(const VertexAttribute &o) const
|
||||
{
|
||||
return enabled == o.enabled && floatCast == o.floatCast && normalizedCast == o.normalizedCast &&
|
||||
format == o.format && !memcmp(&genericValue, &o.genericValue, sizeof(genericValue)) &&
|
||||
return enabled == o.enabled && floatCast == o.floatCast && format == o.format &&
|
||||
!memcmp(&genericValue, &o.genericValue, sizeof(genericValue)) &&
|
||||
vertexBufferSlot == o.vertexBufferSlot && byteOffset == o.byteOffset;
|
||||
}
|
||||
bool operator<(const VertexAttribute &o) const
|
||||
@@ -53,8 +53,6 @@ struct VertexAttribute
|
||||
return enabled < o.enabled;
|
||||
if(!(floatCast == o.floatCast))
|
||||
return floatCast < o.floatCast;
|
||||
if(!(normalizedCast == o.normalizedCast))
|
||||
return normalizedCast < o.normalizedCast;
|
||||
if(!(format == o.format))
|
||||
return format < o.format;
|
||||
if(memcmp(&genericValue, &o.genericValue, sizeof(genericValue)) < 0)
|
||||
@@ -71,16 +69,10 @@ struct VertexAttribute
|
||||
DOCUMENT(R"(Only valid for integer formatted attributes, ``True`` if they are cast to float.
|
||||
|
||||
This is because they were specified with an integer format but glVertexAttribFormat (not
|
||||
glVertexAttribIFormat) so they will be cast. See also :data:`normalisedCast` to see if the integer
|
||||
data is normalised to [0,1] or [-1,1] while being cast.
|
||||
glVertexAttribIFormat) so they will be cast.
|
||||
)");
|
||||
bool floatCast = false;
|
||||
|
||||
DOCUMENT(R"(Only valid for integer formatted attributes, ``True`` if the data is normalised while
|
||||
cast to float. See :data:`floatCast` for more information.
|
||||
)");
|
||||
bool normalizedCast = false;
|
||||
|
||||
DOCUMENT("The :class:`ResourceFormat` of the vertex attribute.");
|
||||
ResourceFormat format;
|
||||
|
||||
|
||||
@@ -957,25 +957,25 @@ void GLReplay::SavePipelineState(uint32_t eventId)
|
||||
}
|
||||
}
|
||||
|
||||
pipe.vertexInput.attributes[i].format = fmt;
|
||||
|
||||
// normalized/floatCast flags are irrelevant for float formats
|
||||
if(fmt.compType == CompType::SInt || fmt.compType == CompType::UInt)
|
||||
{
|
||||
// if it wasn't an integer, it's cast to float
|
||||
pipe.vertexInput.attributes[i].floatCast = !integer;
|
||||
|
||||
// if we're casting, also store whether or not it's normalised
|
||||
// if we're casting, change the component type as appropriate
|
||||
if(!integer)
|
||||
pipe.vertexInput.attributes[i].normalizedCast = normalized != 0;
|
||||
else
|
||||
pipe.vertexInput.attributes[i].normalizedCast = false;
|
||||
{
|
||||
if(normalized != 0)
|
||||
fmt.compType = (fmt.compType == CompType::SInt) ? CompType::SNorm : CompType::UNorm;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
pipe.vertexInput.attributes[i].floatCast = pipe.vertexInput.attributes[i].normalizedCast =
|
||||
false;
|
||||
pipe.vertexInput.attributes[i].floatCast = false;
|
||||
}
|
||||
|
||||
pipe.vertexInput.attributes[i].format = fmt;
|
||||
}
|
||||
|
||||
pipe.vertexInput.provokingVertexLast = (rs.ProvokingVertex != eGL_FIRST_VERTEX_CONVENTION);
|
||||
|
||||
@@ -1551,13 +1551,12 @@ void DoSerialise(SerialiserType &ser, GLPipe::VertexAttribute &el)
|
||||
{
|
||||
SERIALISE_MEMBER(enabled);
|
||||
SERIALISE_MEMBER(floatCast);
|
||||
SERIALISE_MEMBER(normalizedCast);
|
||||
SERIALISE_MEMBER(format);
|
||||
SERIALISE_MEMBER(genericValue);
|
||||
SERIALISE_MEMBER(vertexBufferSlot);
|
||||
SERIALISE_MEMBER(byteOffset);
|
||||
|
||||
SIZE_CHECK(36);
|
||||
SIZE_CHECK(32);
|
||||
}
|
||||
|
||||
template <typename SerialiserType>
|
||||
|
||||
Reference in New Issue
Block a user