Skip to content

Commit 8cb8b46

Browse files
committed
Version 1.14.0 [release 1.14.0]
1 parent b17e85d commit 8cb8b46

21 files changed

+764
-180
lines changed

.github/workflows/build.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ jobs:
1616
cmake -B build
1717
cmake --build build --config Release --target axslcc
1818
- name: Upload
19-
uses: actions/upload-artifact@v5
19+
uses: actions/upload-artifact@v6
2020
with:
2121
path: ./build/src/Release/axslcc.exe
2222
name: axslcc-win64
2323
linux:
24-
runs-on: ubuntu-latest
24+
runs-on: debian-11 # self-hosted on org simdsoft, @halx99 personal machine
2525
steps:
2626
- uses: actions/checkout@v6
2727
- name: build
@@ -30,7 +30,7 @@ jobs:
3030
cmake -B build -DCMAKE_BUILD_TYPE=Release
3131
cmake --build build --config Release --target axslcc
3232
- name: Upload
33-
uses: actions/upload-artifact@v5
33+
uses: actions/upload-artifact@v6
3434
with:
3535
path: ./build/src/axslcc
3636
name: axslcc-linux
@@ -49,7 +49,7 @@ jobs:
4949
cmake --build build --config Release --target axslcc
5050
lipo -info ./build/src/axslcc
5151
- name: Upload
52-
uses: actions/upload-artifact@v5
52+
uses: actions/upload-artifact@v6
5353
with:
5454
path: ./build/src/axslcc
5555
name: axslcc-osx-arm64
@@ -69,7 +69,7 @@ jobs:
6969
cmake --build build --config Release --target axslcc
7070
lipo -info ./build/src/axslcc
7171
- name: Upload
72-
uses: actions/upload-artifact@v5
72+
uses: actions/upload-artifact@v6
7373
with:
7474
path: ./build/src/axslcc
7575
name: axslcc-osx-x64

.github/workflows/dist.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,4 +85,4 @@ jobs:
8585
./pkg_dir/*
8686
env:
8787
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
88-
GITHUB_REPOSITORY: axmolengine/axslcc
88+
GITHUB_REPOSITORY: simdsoft/axslcc

3rdparty/spirv-cross/spirv.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -645,6 +645,7 @@ typedef enum SpvDecoration_ {
645645
SpvDecorationConditionalINTEL = 6247,
646646
SpvDecorationCacheControlLoadINTEL = 6442,
647647
SpvDecorationCacheControlStoreINTEL = 6443,
648+
SpvDecorationSamplerSlot = 7000, // axslcc spec
648649
SpvDecorationMax = 0x7fffffff,
649650
} SpvDecoration;
650651

@@ -3693,6 +3694,7 @@ inline const char* SpvDecorationToString(SpvDecoration value) {
36933694
case SpvDecorationIndex: return "Index";
36943695
case SpvDecorationBinding: return "Binding";
36953696
case SpvDecorationDescriptorSet: return "DescriptorSet";
3697+
case SpvDecorationSamplerSlot: return "SamplerSlot"; // axslcc spec
36963698
case SpvDecorationOffset: return "Offset";
36973699
case SpvDecorationXfbBuffer: return "XfbBuffer";
36983700
case SpvDecorationXfbStride: return "XfbStride";

3rdparty/spirv-cross/spirv.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -641,6 +641,7 @@ enum Decoration {
641641
DecorationConditionalINTEL = 6247,
642642
DecorationCacheControlLoadINTEL = 6442,
643643
DecorationCacheControlStoreINTEL = 6443,
644+
DecorationSamplerSlot = 7000, // axslcc spec
644645
DecorationMax = 0x7fffffff,
645646
};
646647

@@ -3689,6 +3690,7 @@ inline const char* DecorationToString(Decoration value) {
36893690
case DecorationIndex: return "Index";
36903691
case DecorationBinding: return "Binding";
36913692
case DecorationDescriptorSet: return "DescriptorSet";
3693+
case DecorationSamplerSlot: return "SamplerSlot";
36923694
case DecorationOffset: return "Offset";
36933695
case DecorationXfbBuffer: return "XfbBuffer";
36943696
case DecorationXfbStride: return "XfbStride";

3rdparty/spirv-cross/spirv_common.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1798,6 +1798,7 @@ struct Meta
17981798
uint32_t component = 0;
17991799
uint32_t set = 0;
18001800
uint32_t binding = 0;
1801+
uint32_t sampler_slot = 0; // axslcc spec
18011802
uint32_t offset = 0;
18021803
uint32_t xfb_buffer = 0;
18031804
uint32_t xfb_stride = 0;

3rdparty/spirv-cross/spirv_cross.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -742,6 +742,14 @@ bool Compiler::is_physical_pointer(const SPIRType &type) const
742742
return type.op == OpTypePointer && type.storage == StorageClassPhysicalStorageBuffer;
743743
}
744744

745+
bool Compiler::is_physical_or_buffer_pointer(const SPIRType &type) const
746+
{
747+
return type.op == OpTypePointer &&
748+
(type.storage == StorageClassPhysicalStorageBuffer || type.storage == StorageClassUniform ||
749+
type.storage == StorageClassStorageBuffer || type.storage == StorageClassWorkgroup ||
750+
type.storage == StorageClassPushConstant);
751+
}
752+
745753
bool Compiler::is_physical_pointer_to_buffer_block(const SPIRType &type) const
746754
{
747755
return is_physical_pointer(type) && get_pointee_type(type).self == type.parent_type &&

3rdparty/spirv-cross/spirv_cross.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -694,6 +694,7 @@ class Compiler
694694
bool is_array(const SPIRType &type) const;
695695
bool is_pointer(const SPIRType &type) const;
696696
bool is_physical_pointer(const SPIRType &type) const;
697+
bool is_physical_or_buffer_pointer(const SPIRType &type) const;
697698
bool is_physical_pointer_to_buffer_block(const SPIRType &type) const;
698699
static bool is_runtime_size_array(const SPIRType &type);
699700
uint32_t expression_type_id(uint32_t id) const;

3rdparty/spirv-cross/spirv_cross_parsed_ir.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,10 @@ void ParsedIR::set_decoration(ID id, Decoration decoration, uint32_t argument)
431431
dec.set = argument;
432432
break;
433433

434+
case DecorationSamplerSlot: // axslcc spec
435+
dec.sampler_slot = argument;
436+
break;
437+
434438
case DecorationInputAttachmentIndex:
435439
dec.input_attachment = argument;
436440
break;
@@ -652,6 +656,8 @@ uint32_t ParsedIR::get_decoration(ID id, Decoration decoration) const
652656
return dec.stream;
653657
case DecorationBinding:
654658
return dec.binding;
659+
case DecorationSamplerSlot:
660+
return dec.sampler_slot;
655661
case DecorationDescriptorSet:
656662
return dec.set;
657663
case DecorationInputAttachmentIndex:
@@ -739,6 +745,10 @@ void ParsedIR::unset_decoration(ID id, Decoration decoration)
739745
dec.set = 0;
740746
break;
741747

748+
case DecorationSamplerSlot: // axslcc spec
749+
dec.sampler_slot = 0;
750+
break;
751+
742752
case DecorationInputAttachmentIndex:
743753
dec.input_attachment = 0;
744754
break;

3rdparty/spirv-cross/spirv_cross_util.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,13 @@ void inherit_combined_sampler_bindings(Compiler &compiler)
7272
uint32_t binding = compiler.get_decoration(s.image_id, DecorationBinding);
7373
compiler.set_decoration(s.combined_id, DecorationBinding, binding);
7474
}
75+
76+
// axslcc spec
77+
if (compiler.has_decoration(s.image_id, DecorationSamplerSlot))
78+
{
79+
uint32_t sampler_slot = compiler.get_decoration(s.image_id, DecorationSamplerSlot);
80+
compiler.set_decoration(s.combined_id, DecorationSamplerSlot, sampler_slot);
81+
}
7582
}
7683
}
7784
} // namespace spirv_cross_util

3rdparty/spirv-cross/spirv_glsl.cpp

Lines changed: 80 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -654,6 +654,20 @@ void CompilerGLSL::find_static_extensions()
654654
ray_tracing_is_khr = true;
655655
break;
656656

657+
case CapabilityRayQueryPositionFetchKHR:
658+
if (options.es || options.version < 460 || !options.vulkan_semantics)
659+
SPIRV_CROSS_THROW("RayQuery Position Fetch requires Vulkan GLSL 460.");
660+
require_extension_internal("GL_EXT_ray_tracing_position_fetch");
661+
ray_tracing_is_khr = true;
662+
break;
663+
664+
case CapabilityRayTracingPositionFetchKHR:
665+
if (options.es || options.version < 460 || !options.vulkan_semantics)
666+
SPIRV_CROSS_THROW("Ray Tracing Position Fetch requires Vulkan GLSL 460.");
667+
require_extension_internal("GL_EXT_ray_tracing_position_fetch");
668+
ray_tracing_is_khr = true;
669+
break;
670+
657671
case CapabilityRayTraversalPrimitiveCullingKHR:
658672
if (options.es || options.version < 460 || !options.vulkan_semantics)
659673
SPIRV_CROSS_THROW("RayQuery requires Vulkan GLSL 460.");
@@ -5040,10 +5054,10 @@ void CompilerGLSL::emit_polyfills(uint32_t polyfills, bool relaxed)
50405054
// Returns a string representation of the ID, usable as a function arg.
50415055
// Default is to simply return the expression representation fo the arg ID.
50425056
// Subclasses may override to modify the return value.
5043-
string CompilerGLSL::to_func_call_arg(const SPIRFunction::Parameter &, uint32_t id)
5057+
string CompilerGLSL::to_func_call_arg(const SPIRFunction::Parameter &arg, uint32_t id)
50445058
{
50455059
// BDA expects pointers through function interface.
5046-
if (is_physical_pointer(expression_type(id)))
5060+
if (!arg.alias_global_variable && is_physical_or_buffer_pointer(expression_type(id)))
50475061
return to_pointer_expression(id);
50485062

50495063
// Make sure that we use the name of the original variable, and not the parameter alias.
@@ -6885,6 +6899,16 @@ void CompilerGLSL::emit_uninitialized_temporary(uint32_t result_type, uint32_t r
68856899
}
68866900
}
68876901

6902+
bool CompilerGLSL::can_declare_inline_temporary(uint32_t id) const
6903+
{
6904+
if (!block_temporary_hoisting && current_continue_block && !hoisted_temporaries.count(id))
6905+
return false;
6906+
if (hoisted_temporaries.count(id))
6907+
return false;
6908+
6909+
return true;
6910+
}
6911+
68886912
string CompilerGLSL::declare_temporary(uint32_t result_type, uint32_t result_id)
68896913
{
68906914
auto &type = get<SPIRType>(result_type);
@@ -6962,6 +6986,42 @@ SPIRExpression &CompilerGLSL::emit_op(uint32_t result_type, uint32_t result_id,
69626986
}
69636987
}
69646988

6989+
void CompilerGLSL::emit_transposed_op(uint32_t result_type, uint32_t result_id, const string &rhs, bool forwarding)
6990+
{
6991+
if (forwarding && (forced_temporaries.find(result_id) == end(forced_temporaries)))
6992+
{
6993+
// Just forward it without temporary.
6994+
// If the forward is trivial, we do not force flushing to temporary for this expression.
6995+
forwarded_temporaries.insert(result_id);
6996+
auto &e = set<SPIRExpression>(result_id, rhs, result_type, true);
6997+
e.need_transpose = true;
6998+
}
6999+
else if (can_declare_inline_temporary(result_id))
7000+
{
7001+
// If expression isn't immutable, bind it to a temporary and make the new temporary immutable (they always are).
7002+
// Since the expression is transposed, we have to ensure the temporary is the transposed type.
7003+
7004+
auto &transposed_type_id = extra_sub_expressions[result_id];
7005+
if (!transposed_type_id)
7006+
{
7007+
auto dummy_type = get<SPIRType>(result_type);
7008+
std::swap(dummy_type.columns, dummy_type.vecsize);
7009+
transposed_type_id = ir.increase_bound_by(1);
7010+
set<SPIRType>(transposed_type_id, dummy_type);
7011+
}
7012+
7013+
statement(declare_temporary(transposed_type_id, result_id), rhs, ";");
7014+
auto &e = set<SPIRExpression>(result_id, to_name(result_id), result_type, true);
7015+
e.need_transpose = true;
7016+
}
7017+
else
7018+
{
7019+
// If we cannot declare the temporary because it's already been hoisted, we don't have the
7020+
// chance to override the temporary type ourselves. Just transpose() the expression.
7021+
emit_op(result_type, result_id, join("transpose(", rhs, ")"), forwarding);
7022+
}
7023+
}
7024+
69657025
void CompilerGLSL::emit_unary_op(uint32_t result_type, uint32_t result_id, uint32_t op0, const char *op)
69667026
{
69677027
bool forward = should_forward(op0);
@@ -10402,6 +10462,14 @@ string CompilerGLSL::builtin_to_glsl(BuiltIn builtin, StorageClass storage)
1040210462
case BuiltInCullPrimitiveEXT:
1040310463
return "gl_CullPrimitiveEXT";
1040410464

10465+
case BuiltInHitTriangleVertexPositionsKHR:
10466+
{
10467+
if (!options.vulkan_semantics)
10468+
SPIRV_CROSS_THROW("Need Vulkan semantics for EXT_ray_tracing_position_fetch.");
10469+
require_extension_internal("GL_EXT_ray_tracing_position_fetch");
10470+
return "gl_HitTriangleVertexPositionsEXT";
10471+
}
10472+
1040510473
case BuiltInClusterIDNV:
1040610474
{
1040710475
if (!options.vulkan_semantics)
@@ -11564,7 +11632,7 @@ bool CompilerGLSL::should_dereference(uint32_t id)
1156411632
// If id is a variable but not a phi variable, we should not dereference it.
1156511633
// BDA passed around as parameters are always pointers.
1156611634
if (auto *var = maybe_get<SPIRVariable>(id))
11567-
return (var->parameter && is_physical_pointer(type)) || var->phi_variable;
11635+
return (var->parameter && is_physical_or_buffer_pointer(type)) || var->phi_variable;
1156811636

1156911637
if (auto *expr = maybe_get<SPIRExpression>(id))
1157011638
{
@@ -11600,8 +11668,8 @@ bool CompilerGLSL::should_dereference(uint32_t id)
1160011668
bool CompilerGLSL::should_dereference_caller_param(uint32_t id)
1160111669
{
1160211670
const auto &type = expression_type(id);
11603-
// BDA is always passed around as pointers.
11604-
if (is_physical_pointer(type))
11671+
// BDA is always passed around as pointers. Similarly, we need to pass variable buffer pointers as pointers.
11672+
if (is_physical_or_buffer_pointer(type))
1160511673
return false;
1160611674

1160711675
return should_dereference(id);
@@ -13490,8 +13558,7 @@ void CompilerGLSL::emit_instruction(const Instruction &instruction)
1349013558
auto expr = join(enclose_expression(to_unpacked_row_major_matrix_expression(ops[3])), " * ",
1349113559
enclose_expression(to_unpacked_row_major_matrix_expression(ops[2])));
1349213560
bool forward = should_forward(ops[2]) && should_forward(ops[3]);
13493-
auto &e = emit_op(ops[0], ops[1], expr, forward);
13494-
e.need_transpose = true;
13561+
emit_transposed_op(ops[0], ops[1], expr, forward);
1349513562
a->need_transpose = true;
1349613563
b->need_transpose = true;
1349713564
inherit_expression_dependencies(ops[1], ops[2]);
@@ -13514,8 +13581,7 @@ void CompilerGLSL::emit_instruction(const Instruction &instruction)
1351413581
auto expr = join(enclose_expression(to_unpacked_row_major_matrix_expression(ops[2])), " * ",
1351513582
to_enclosed_unpacked_expression(ops[3]));
1351613583
bool forward = should_forward(ops[2]) && should_forward(ops[3]);
13517-
auto &e = emit_op(ops[0], ops[1], expr, forward);
13518-
e.need_transpose = true;
13584+
emit_transposed_op(ops[0], ops[1], expr, forward);
1351913585
a->need_transpose = true;
1352013586
inherit_expression_dependencies(ops[1], ops[2]);
1352113587
inherit_expression_dependencies(ops[1], ops[3]);
@@ -15535,6 +15601,11 @@ void CompilerGLSL::emit_instruction(const Instruction &instruction)
1553515601
flush_variable_declaration(ops[0]);
1553615602
statement("rayQueryConfirmIntersectionEXT(", to_expression(ops[0]), ");");
1553715603
break;
15604+
case OpRayQueryGetIntersectionTriangleVertexPositionsKHR:
15605+
flush_variable_declaration(ops[1]);
15606+
emit_uninitialized_temporary_expression(ops[0], ops[1]);
15607+
statement("rayQueryGetIntersectionTriangleVertexPositionsEXT(", to_expression(ops[2]), ", bool(", to_expression(ops[3]), "), ", to_expression(ops[1]), ");");
15608+
break;
1553815609
#define GLSL_RAY_QUERY_GET_OP(op) \
1553915610
case OpRayQueryGet##op##KHR: \
1554015611
flush_variable_declaration(ops[2]); \

0 commit comments

Comments
 (0)