Skip to content

Commit

Permalink
fix bindless buffer on metal
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike-Leo-Smith committed Dec 27, 2024
1 parent 14be1fd commit 6137bf4
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/backends/metal/metal_codegen_ast.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ void MetalCodegenAST::_emit_type_decls(Function kernel) noexcept {
// process types in topological order
types.clear();
auto emit = [&](auto &&self, auto type) noexcept -> void {
if (types.emplace(type).second) {
if (type != nullptr && types.emplace(type).second) {
if (type->is_array() || type->is_buffer()) {
self(self, type->element());
} else if (type->is_structure()) {
Expand Down Expand Up @@ -960,7 +960,12 @@ void MetalCodegenAST::visit(const CallExpr *expr) noexcept {
case CallOp::BUFFER_READ: _scratch << "buffer_read"; break;
case CallOp::BUFFER_WRITE: _scratch << "buffer_write"; break;
case CallOp::BUFFER_SIZE: _scratch << "buffer_size"; break;
case CallOp::BYTE_BUFFER_READ: _scratch << "byte_buffer_read"; break;
case CallOp::BYTE_BUFFER_READ: {
_scratch << "byte_buffer_read<";
_emit_type_name(expr->type());
_scratch << ">";
break;
}
case CallOp::BYTE_BUFFER_WRITE: _scratch << "byte_buffer_write"; break;
case CallOp::BYTE_BUFFER_SIZE: _scratch << "byte_buffer_size"; break;
case CallOp::TEXTURE_READ: _scratch << "texture_read"; break;
Expand Down Expand Up @@ -1137,6 +1142,15 @@ void MetalCodegenAST::visit(const CallExpr *expr) noexcept {
case CallOp::TEXTURE3D_SAMPLE_LEVEL: LUISA_NOT_IMPLEMENTED();
case CallOp::TEXTURE3D_SAMPLE_GRAD: LUISA_NOT_IMPLEMENTED();
case CallOp::TEXTURE3D_SAMPLE_GRAD_LEVEL: LUISA_NOT_IMPLEMENTED();
case CallOp::BINDLESS_TEXTURE2D_SAMPLE_SAMPLER: LUISA_NOT_IMPLEMENTED();
case CallOp::BINDLESS_TEXTURE2D_SAMPLE_LEVEL_SAMPLER: LUISA_NOT_IMPLEMENTED();
case CallOp::BINDLESS_TEXTURE2D_SAMPLE_GRAD_SAMPLER: LUISA_NOT_IMPLEMENTED();
case CallOp::BINDLESS_TEXTURE2D_SAMPLE_GRAD_LEVEL_SAMPLER: LUISA_NOT_IMPLEMENTED();
case CallOp::BINDLESS_TEXTURE3D_SAMPLE_SAMPLER: LUISA_NOT_IMPLEMENTED();
case CallOp::BINDLESS_TEXTURE3D_SAMPLE_LEVEL_SAMPLER: LUISA_NOT_IMPLEMENTED();
case CallOp::BINDLESS_TEXTURE3D_SAMPLE_GRAD_SAMPLER: LUISA_NOT_IMPLEMENTED();
case CallOp::BINDLESS_TEXTURE3D_SAMPLE_GRAD_LEVEL_SAMPLER: LUISA_NOT_IMPLEMENTED();
case CallOp::CLOCK: LUISA_NOT_IMPLEMENTED();
}
_scratch << "(";
if (auto op = expr->op(); is_atomic_operation(op)) {
Expand Down

0 comments on commit 6137bf4

Please sign in to comment.