Revert "Move panic_handler and eh_personality to spirv-std (#95)"

This reverts commit 985ae7d494.
This commit is contained in:
khyperia 2020-10-22 21:36:09 +02:00
parent 048144ed4c
commit 8931f50c3c
2 changed files with 14 additions and 13 deletions

View File

@ -1,10 +1,13 @@
//! Ported to Rust from https://github.com/Tw1ddle/Sky-Shader/blob/master/src/shaders/glsl/sky.fragment
#![no_std]
#![feature(lang_items)]
#![feature(register_attr)]
#![register_attr(spirv)]
use core::f32::consts::PI;
#[cfg(not(test))]
use core::panic::PanicInfo;
use spirv_std::{Input, Mat4, MathExt, Output, Vec3, Vec4};
const DEPOLARIZATION_FACTOR: f32 = 0.035;
@ -181,3 +184,13 @@ pub fn main_vs(
out_pos.store(in_pos.load());
out_color.store(in_pos.load());
}
#[cfg(not(test))]
#[panic_handler]
fn panic(_: &PanicInfo) -> ! {
loop {}
}
#[cfg(not(test))]
#[lang = "eh_personality"]
extern "C" fn rust_eh_personality() {}

View File

@ -1,12 +1,10 @@
#![no_std]
#![feature(register_attr, repr_simd, core_intrinsics, lang_items)]
#![feature(register_attr, repr_simd, core_intrinsics)]
#![register_attr(spirv)]
pub mod math;
pub use crate::math::MathExt;
pub use crate::math::*;
#[cfg(target_arch = "spirv")]
use core::panic::PanicInfo;
macro_rules! pointer_addrspace_write {
(false) => {};
@ -69,16 +67,6 @@ pointer_addrspace!("physical_storage_buffer", PhysicalStorageBuffer, true);
#[repr(simd)]
pub struct f32x4(pub f32, pub f32, pub f32, pub f32);
#[cfg(target_arch = "spirv")]
#[panic_handler]
fn panic(_: &PanicInfo) -> ! {
loop {}
}
#[cfg(target_arch = "spirv")]
#[lang = "eh_personality"]
extern "C" fn rust_eh_personality() {}
/// libcore requires a few external symbols to be defined:
/// https://github.com/rust-lang/rust/blob/c2bc344eb23d8c1d18e803b3f1e631cf99926fbb/library/core/src/lib.rs#L23-L27
/// TODO: This is copied from compiler_builtins/mem.rs. Can we use that one instead? The note in the above link says