Commit a4f0c896 by Nicolas Capens Committed by Nicolas Capens

Print uniform buffer registers as cb#[index].

This matches Shader Model 4+ assembly syntax and helps debug shader compilation issues. Change-Id: Iff2a2991794e13476b99e11d6ac07fdf5d37570b Reviewed-on: https://swiftshader-review.googlesource.com/13928Tested-by: 's avatarNicolas Capens <nicolascapens@google.com> Reviewed-by: 's avatarAlexis Hétu <sugoi@google.com> Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com>
parent 360a7741
......@@ -215,12 +215,18 @@ void Shader::compile()
if(false)
{
static int serial = 1;
char buffer[256];
sprintf(buffer, "shader-input-%d-%d.txt", getName(), serial);
FILE *file = fopen(buffer, "wt");
fprintf(file, "%s", mSource);
fclose(file);
if(false)
{
char buffer[256];
sprintf(buffer, "shader-input-%d-%d.txt", getName(), serial);
FILE *file = fopen(buffer, "wt");
fprintf(file, "%s", mSource);
fclose(file);
}
getShader()->print("shader-output-%d-%d.txt", getName(), serial);
serial++;
}
......
......@@ -503,6 +503,24 @@ namespace sw
return "";
}
std::string Shader::SourceParameter::string(ShaderType shaderType, unsigned short version) const
{
if(type == PARAMETER_CONST && bufferIndex >= 0)
{
std::ostringstream buffer;
buffer << bufferIndex;
std::ostringstream offset;
offset << index;
return "cb" + buffer.str() + "[" + offset.str() + "]";
}
else
{
return Parameter::string(shaderType, version);
}
}
std::string Shader::SourceParameter::swizzleString() const
{
return Instruction::swizzleString(type, swizzle);
......
......@@ -476,6 +476,7 @@ namespace sw
{
}
std::string string(ShaderType shaderType, unsigned short version) const;
std::string swizzleString() const;
std::string preModifierString() const;
std::string postModifierString() const;
......
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