Merge pull request #1277 from KhronosGroup/fix-1276
HLSL: Declare undef variables as static.
This commit is contained in:
commit
c53b34765d
@ -11,7 +11,7 @@ struct SPIRV_Cross_Output
|
|||||||
float4 FragColor : SV_Target0;
|
float4 FragColor : SV_Target0;
|
||||||
};
|
};
|
||||||
|
|
||||||
bool _47;
|
static bool _47;
|
||||||
|
|
||||||
void frag_main()
|
void frag_main()
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
RWByteAddressBuffer block : register(u0);
|
RWByteAddressBuffer block : register(u0);
|
||||||
|
|
||||||
float _15;
|
static float _15;
|
||||||
|
|
||||||
void comp_main()
|
void comp_main()
|
||||||
{
|
{
|
||||||
|
@ -11,7 +11,7 @@ struct SPIRV_Cross_Output
|
|||||||
float4 FragColor : SV_Target0;
|
float4 FragColor : SV_Target0;
|
||||||
};
|
};
|
||||||
|
|
||||||
float4 undef;
|
static float4 undef;
|
||||||
|
|
||||||
void frag_main()
|
void frag_main()
|
||||||
{
|
{
|
||||||
|
@ -11,7 +11,7 @@ struct SPIRV_Cross_Output
|
|||||||
float4 FragColor : SV_Target0;
|
float4 FragColor : SV_Target0;
|
||||||
};
|
};
|
||||||
|
|
||||||
float4 _21;
|
static float4 _21;
|
||||||
|
|
||||||
void frag_main()
|
void frag_main()
|
||||||
{
|
{
|
||||||
|
@ -1117,6 +1117,18 @@ void CompilerHLSL::replace_illegal_names()
|
|||||||
CompilerGLSL::replace_illegal_names();
|
CompilerGLSL::replace_illegal_names();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CompilerHLSL::declare_undefined_values()
|
||||||
|
{
|
||||||
|
bool emitted = false;
|
||||||
|
ir.for_each_typed_id<SPIRUndef>([&](uint32_t, const SPIRUndef &undef) {
|
||||||
|
statement("static ", variable_decl(this->get<SPIRType>(undef.basetype), to_name(undef.self), undef.self), ";");
|
||||||
|
emitted = true;
|
||||||
|
});
|
||||||
|
|
||||||
|
if (emitted)
|
||||||
|
statement("");
|
||||||
|
}
|
||||||
|
|
||||||
void CompilerHLSL::emit_resources()
|
void CompilerHLSL::emit_resources()
|
||||||
{
|
{
|
||||||
auto &execution = get_entry_point();
|
auto &execution = get_entry_point();
|
||||||
|
@ -186,6 +186,7 @@ private:
|
|||||||
void emit_hlsl_entry_point();
|
void emit_hlsl_entry_point();
|
||||||
void emit_header() override;
|
void emit_header() override;
|
||||||
void emit_resources();
|
void emit_resources();
|
||||||
|
void declare_undefined_values() override;
|
||||||
void emit_interface_block_globally(const SPIRVariable &type);
|
void emit_interface_block_globally(const SPIRVariable &type);
|
||||||
void emit_interface_block_in_struct(const SPIRVariable &type, std::unordered_set<uint32_t> &active_locations);
|
void emit_interface_block_in_struct(const SPIRVariable &type, std::unordered_set<uint32_t> &active_locations);
|
||||||
void emit_builtin_inputs_in_struct();
|
void emit_builtin_inputs_in_struct();
|
||||||
|
Loading…
Reference in New Issue
Block a user