Allow overriding the variable type when formatting a shader variable

This commit is contained in:
baldurk
2017-02-10 21:36:03 +00:00
parent 354a2707ae
commit 4d699a2068
4 changed files with 11 additions and 5 deletions
+7 -4
View File
@@ -813,17 +813,20 @@ static QString RowValuesToString(int cols, el x, el y, el z, el w)
Formatter::Format(w);
}
QString RowString(const ShaderVariable &v, uint32_t row)
QString RowString(const ShaderVariable &v, uint32_t row, VarType type)
{
if(v.type == eVar_Double)
if(type == eVar_Unknown)
type = v.type;
if(type == eVar_Double)
return RowValuesToString((int)v.columns, v.value.dv[row * v.columns + 0],
v.value.dv[row * v.columns + 1], v.value.dv[row * v.columns + 2],
v.value.dv[row * v.columns + 3]);
else if(v.type == eVar_Int)
else if(type == eVar_Int)
return RowValuesToString((int)v.columns, v.value.iv[row * v.columns + 0],
v.value.iv[row * v.columns + 1], v.value.iv[row * v.columns + 2],
v.value.iv[row * v.columns + 3]);
else if(v.type == eVar_UInt)
else if(type == eVar_UInt)
return RowValuesToString((int)v.columns, v.value.uv[row * v.columns + 0],
v.value.uv[row * v.columns + 1], v.value.uv[row * v.columns + 2],
v.value.uv[row * v.columns + 3]);
+2 -1
View File
@@ -386,6 +386,7 @@ struct ToStr
case eVar_Int: return "int";
case eVar_UInt: return "uint";
case eVar_Double: return "double";
case eVar_Unknown: break;
}
return "Unknown";
}
@@ -442,7 +443,7 @@ struct FormatElement
};
QString TypeString(const ShaderVariable &v);
QString RowString(const ShaderVariable &v, uint32_t row);
QString RowString(const ShaderVariable &v, uint32_t row, VarType type = eVar_Unknown);
QString VarString(const ShaderVariable &v);
QString RowTypeString(const ShaderVariable &v);
+1
View File
@@ -40,6 +40,7 @@ enum DirectoryFileProperty
enum VarType
{
eVar_Unknown = -1,
eVar_Float = 0,
eVar_Int,
eVar_UInt,
+1
View File
@@ -2045,6 +2045,7 @@ void GLReplay::FillCBufferValue(WrappedOpenGL &gl, GLuint prog, bool bufferBacke
{
switch(outVar.type)
{
case eVar_Unknown:
case eVar_Float: gl.glGetUniformfv(prog, offs, outVar.value.fv); break;
case eVar_Int: gl.glGetUniformiv(prog, offs, outVar.value.iv); break;
case eVar_UInt: gl.glGetUniformuiv(prog, offs, outVar.value.uv); break;