diff --git a/src/backends/metal/metal_codegen_ast.cpp b/src/backends/metal/metal_codegen_ast.cpp index 0998a7620..1757a1357 100644 --- a/src/backends/metal/metal_codegen_ast.cpp +++ b/src/backends/metal/metal_codegen_ast.cpp @@ -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()) { @@ -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; @@ -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)) {