Do not intertwine TEXCOORD and POSITION outputs

This commit is contained in:
Robert Konrad 2016-09-23 23:56:37 +02:00
parent ea24ee8145
commit 4a0267e201
2 changed files with 25 additions and 12 deletions

View File

@ -153,7 +153,7 @@ void CompilerHLSL::emit_interface_block_globally(const SPIRVariable &var)
statement("static ", variable_decl(var), ";");
}
void CompilerHLSL::emit_interface_block_in_struct(const SPIRVariable &var, uint32_t &binding_number)
void CompilerHLSL::emit_interface_block_in_struct(const SPIRVariable &var, uint32_t &binding_number, bool builtins)
{
auto &execution = get_entry_point();
auto &type = get<SPIRType>(var.basetype);
@ -178,17 +178,22 @@ void CompilerHLSL::emit_interface_block_in_struct(const SPIRVariable &var, uint3
use_binding_number = false;
}
auto &m = meta[var.self].decoration;
if (use_binding_number)
bool is_no_builtin = !is_builtin_variable(var) && !var.remapped_variable;
if ((is_no_builtin && !builtins) || (!is_no_builtin && builtins))
{
statement(variable_decl(type, m.alias), " : ", binding, binding_number, ";");
}
else
{
statement(variable_decl(type, m.alias), " : ", binding, ";");
auto &m = meta[var.self].decoration;
if (use_binding_number)
{
statement(variable_decl(type, m.alias), " : ", binding, binding_number, ";");
}
else
{
statement(variable_decl(type, m.alias), " : ", binding, ";");
}
}
if (!is_builtin_variable(var) && !var.remapped_variable)
if (is_no_builtin)
{
++binding_number;
}
@ -297,7 +302,11 @@ void CompilerHLSL::emit_resources()
sort(variables.begin(), variables.end(), VariableComparator(meta));
for (auto var : variables)
{
emit_interface_block_in_struct(*var, binding_number);
emit_interface_block_in_struct(*var, binding_number, false);
}
for (auto var : variables)
{
emit_interface_block_in_struct(*var, binding_number, true);
}
end_scope_decl();
statement("");
@ -330,7 +339,11 @@ void CompilerHLSL::emit_resources()
sort(variables.begin(), variables.end(), VariableComparator(meta));
for (auto var : variables)
{
emit_interface_block_in_struct(*var, binding_number);
emit_interface_block_in_struct(*var, binding_number, false);
}
for (auto var : variables)
{
emit_interface_block_in_struct(*var, binding_number, true);
}
end_scope_decl();
statement("");

View File

@ -55,7 +55,7 @@ private:
void emit_header() override;
void emit_resources();
void emit_interface_block_globally(const SPIRVariable &type);
void emit_interface_block_in_struct(const SPIRVariable &type, uint32_t &binding_number);
void emit_interface_block_in_struct(const SPIRVariable &type, uint32_t &binding_number, bool builtins);
void emit_texture_op(const Instruction &i) override;
void emit_instruction(const Instruction &instruction) override;
void emit_binary_func_op_transpose_first(uint32_t result_type, uint32_t result_id, uint32_t op0, uint32_t op1,