d3d12: Update

This commit is contained in:
vlj 2015-05-19 20:21:37 +02:00 committed by Vincent Lejeune
parent 5681781ab0
commit d2beafca4d
2 changed files with 22 additions and 12 deletions

View File

@ -43,20 +43,8 @@ std::string D3D12FragmentDecompiler::getFunction(enum class FUNCTION f)
return "dot($0.xyz, $1.xyz).xxxx";
case FUNCTION::FUNCTION_DP4:
return "dot($0, $1).xxxx";
case FUNCTION::FUNCTION_SEQ:
return "($0 == $1).xxxx";
case FUNCTION::FUNCTION_SFL:
return "float4(0., 0., 0., 0.)";
case FUNCTION::FUNCTION_SGE:
return "($0 >= $1).xxxx";
case FUNCTION::FUNCTION_SGT:
return "($0 > $1).xxxx";
case FUNCTION::FUNCTION_SLE:
return "($0 <= $1).xxxx";
case FUNCTION::FUNCTION_SLT:
return "($0 < $1).xxxx";
case FUNCTION::FUNCTION_SNE:
return "($0 != $1).xxxx";
case FUNCTION::FUNCTION_STR:
return "float4(1., 1., 1., 1.)";
case FUNCTION::FUNCTION_FRACT:
@ -75,6 +63,27 @@ std::string D3D12FragmentDecompiler::saturate(const std::string & code)
return "saturate(" + code + ")";
}
std::string D3D12FragmentDecompiler::compareFunction(COMPARE f, const std::string &Op0, const std::string &Op1)
{
switch (f)
{
default:
abort();
case COMPARE::FUNCTION_SEQ:
return "(" + Op0 + " == " + Op1 + ".xxxx";
case COMPARE::FUNCTION_SGE:
return "(" + Op0 + " >= " + Op1 +").xxxx";
case COMPARE::FUNCTION_SGT:
return "(" + Op0 + " > " + Op1 + ").xxxx";
case COMPARE::FUNCTION_SLE:
return "(" + Op0 + " <= " + Op1 + ").xxxx";
case COMPARE::FUNCTION_SLT:
return "(" + Op0 + " < " + Op1 + ").xxxx";
case COMPARE::FUNCTION_SNE:
return "(" + Op0 + " != " + Op1 + ").xxxx";
}
}
void D3D12FragmentDecompiler::insertHeader(std::stringstream & OS)
{
OS << "// Header" << std::endl;

View File

@ -11,6 +11,7 @@ protected:
virtual std::string getFloatTypeName(size_t elementCount) override;
virtual std::string getFunction(enum class FUNCTION) override;
virtual std::string saturate(const std::string &code) override;
virtual std::string compareFunction(enum class COMPARE, const std::string &, const std::string &) override;
virtual void insertHeader(std::stringstream &OS) override;
virtual void insertIntputs(std::stringstream &OS) override;