Merge pull request #337 from msiglreith/early_fragment_tests

HLSL: Support early_fragment_tests attribute
This commit is contained in:
Hans-Kristian Arntzen 2017-11-21 15:18:03 +01:00 committed by GitHub
commit ac607e5382
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 27 additions and 1 deletions

View File

@ -0,0 +1,9 @@
void frag_main()
{
}
[earlydepthstencil]
void main()
{
frag_main();
}

View File

@ -0,0 +1,7 @@
#version 420
layout(early_fragment_tests) in;
void main()
{
}

View File

@ -1437,7 +1437,9 @@ void CompilerHLSL::emit_hlsl_entry_point()
auto &execution = get_entry_point();
if (execution.model == ExecutionModelGLCompute)
switch (execution.model)
{
case ExecutionModelGLCompute:
{
SpecializationConstant wg_x, wg_y, wg_z;
get_work_group_size_specialization_constants(wg_x, wg_y, wg_z);
@ -1454,6 +1456,14 @@ void CompilerHLSL::emit_hlsl_entry_point()
z = get<SPIRConstant>(wg_z.id).scalar();
statement("[numthreads(", x, ", ", y, ", ", z, ")]");
break;
}
case ExecutionModelFragment:
if (execution.flags & (1ull << ExecutionModeEarlyFragmentTests))
statement("[earlydepthstencil]");
break;
default:
break;
}
statement(require_output ? "SPIRV_Cross_Output " : "void ", "main(", merge(arguments), ")");