mirror of
https://github.com/EmbarkStudios/rust-gpu.git
synced 2024-11-22 14:56:27 +00:00
Upgrade to nightly-2023-02-01
This commit is contained in:
parent
9cd0b2759f
commit
a239e344b6
@ -10,9 +10,9 @@ use std::process::{Command, ExitCode};
|
|||||||
/// `cargo publish`. We need to figure out a way to do this properly, but let's hardcode it for now :/
|
/// `cargo publish`. We need to figure out a way to do this properly, but let's hardcode it for now :/
|
||||||
//const REQUIRED_RUST_TOOLCHAIN: &str = include_str!("../../rust-toolchain");
|
//const REQUIRED_RUST_TOOLCHAIN: &str = include_str!("../../rust-toolchain");
|
||||||
const REQUIRED_RUST_TOOLCHAIN: &str = r#"[toolchain]
|
const REQUIRED_RUST_TOOLCHAIN: &str = r#"[toolchain]
|
||||||
channel = "nightly-2023-01-21"
|
channel = "nightly-2023-02-01"
|
||||||
components = ["rust-src", "rustc-dev", "llvm-tools-preview"]
|
components = ["rust-src", "rustc-dev", "llvm-tools-preview"]
|
||||||
# commit_hash = 5ce39f42bd2c8bca9c570f0560ebe1fce4eddb14"#;
|
# commit_hash = dc1d9d50fba2f6a1ccab8748a0050cde38253f60"#;
|
||||||
|
|
||||||
fn get_rustc_commit_hash() -> Result<String, Box<dyn Error>> {
|
fn get_rustc_commit_hash() -> Result<String, Box<dyn Error>> {
|
||||||
let rustc = std::env::var("RUSTC").unwrap_or_else(|_| String::from("rustc"));
|
let rustc = std::env::var("RUSTC").unwrap_or_else(|_| String::from("rustc"));
|
||||||
|
@ -44,11 +44,13 @@ pub(crate) fn provide(providers: &mut Providers) {
|
|||||||
// We can't capture the old fn_sig and just call that, because fn_sig is a `fn`, not a `Fn`, i.e. it can't
|
// We can't capture the old fn_sig and just call that, because fn_sig is a `fn`, not a `Fn`, i.e. it can't
|
||||||
// capture variables. Fortunately, the defaults are exposed (thanks rustdoc), so use that instead.
|
// capture variables. Fortunately, the defaults are exposed (thanks rustdoc), so use that instead.
|
||||||
let result = (rustc_interface::DEFAULT_QUERY_PROVIDERS.fn_sig)(tcx, def_id);
|
let result = (rustc_interface::DEFAULT_QUERY_PROVIDERS.fn_sig)(tcx, def_id);
|
||||||
result.map_bound(|mut inner| {
|
result.map_bound(|outer| {
|
||||||
if let SpecAbi::C { .. } = inner.abi {
|
outer.map_bound(|mut inner| {
|
||||||
inner.abi = SpecAbi::Unadjusted;
|
if let SpecAbi::C { .. } = inner.abi {
|
||||||
}
|
inner.abi = SpecAbi::Unadjusted;
|
||||||
inner
|
}
|
||||||
|
inner
|
||||||
|
})
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -502,7 +504,7 @@ fn trans_scalar<'tcx>(
|
|||||||
}
|
}
|
||||||
Primitive::F32 => SpirvType::Float(32).def(span, cx),
|
Primitive::F32 => SpirvType::Float(32).def(span, cx),
|
||||||
Primitive::F64 => SpirvType::Float(64).def(span, cx),
|
Primitive::F64 => SpirvType::Float(64).def(span, cx),
|
||||||
Primitive::Pointer => {
|
Primitive::Pointer(_) => {
|
||||||
let pointee_ty = dig_scalar_pointee(cx, ty, offset);
|
let pointee_ty = dig_scalar_pointee(cx, ty, offset);
|
||||||
// Pointers can be recursive. So, record what we're currently translating, and if we're already translating
|
// Pointers can be recursive. So, record what we're currently translating, and if we're already translating
|
||||||
// the same type, emit an OpTypeForwardPointer and use that ID.
|
// the same type, emit an OpTypeForwardPointer and use that ID.
|
||||||
|
@ -250,7 +250,7 @@ impl<'tcx> ConstMethods<'tcx> for CodegenCx<'tcx> {
|
|||||||
assert_eq!(res.ty, ty);
|
assert_eq!(res.ty, ty);
|
||||||
res
|
res
|
||||||
}
|
}
|
||||||
Primitive::Pointer => {
|
Primitive::Pointer(_) => {
|
||||||
if data == 0 {
|
if data == 0 {
|
||||||
self.constant_null(ty)
|
self.constant_null(ty)
|
||||||
} else {
|
} else {
|
||||||
@ -317,14 +317,13 @@ impl<'tcx> ConstMethods<'tcx> for CodegenCx<'tcx> {
|
|||||||
// let offset = self.constant_u64(ptr.offset.bytes());
|
// let offset = self.constant_u64(ptr.offset.bytes());
|
||||||
// self.gep(base_addr, once(offset))
|
// self.gep(base_addr, once(offset))
|
||||||
};
|
};
|
||||||
if layout.primitive() != Primitive::Pointer {
|
if let Primitive::Pointer(_) = layout.primitive() {
|
||||||
|
assert_ty_eq!(self, value.ty, ty);
|
||||||
|
value
|
||||||
|
} else {
|
||||||
self.tcx
|
self.tcx
|
||||||
.sess
|
.sess
|
||||||
.fatal("Non-pointer-typed scalar_to_backend Scalar::Ptr not supported");
|
.fatal("Non-pointer-typed scalar_to_backend Scalar::Ptr not supported");
|
||||||
// unsafe { llvm::LLVMConstPtrToInt(llval, llty) }
|
|
||||||
} else {
|
|
||||||
assert_ty_eq!(self, value.ty, ty);
|
|
||||||
value
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -440,7 +439,7 @@ impl<'tcx> CodegenCx<'tcx> {
|
|||||||
.fatal(format!("invalid size for float: {other}"));
|
.fatal(format!("invalid size for float: {other}"));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
SpirvType::Pointer { .. } => Primitive::Pointer,
|
SpirvType::Pointer { .. } => Primitive::Pointer(AddressSpace::DATA),
|
||||||
unsupported_spirv_type => bug!(
|
unsupported_spirv_type => bug!(
|
||||||
"invalid spirv type internal to create_alloc_const2: {:?}",
|
"invalid spirv type internal to create_alloc_const2: {:?}",
|
||||||
unsupported_spirv_type
|
unsupported_spirv_type
|
||||||
@ -454,7 +453,7 @@ impl<'tcx> CodegenCx<'tcx> {
|
|||||||
let value = match alloc.inner().read_scalar(
|
let value = match alloc.inner().read_scalar(
|
||||||
self,
|
self,
|
||||||
alloc_range(*offset, size),
|
alloc_range(*offset, size),
|
||||||
primitive.is_ptr(),
|
matches!(primitive, Primitive::Pointer(_)),
|
||||||
) {
|
) {
|
||||||
Ok(scalar) => {
|
Ok(scalar) => {
|
||||||
self.scalar_to_backend(scalar, self.primitive_to_scalar(primitive), ty)
|
self.scalar_to_backend(scalar, self.primitive_to_scalar(primitive), ty)
|
||||||
|
@ -284,6 +284,7 @@ impl CodegenBackend for SpirvCodegenBackend {
|
|||||||
impl WriteBackendMethods for SpirvCodegenBackend {
|
impl WriteBackendMethods for SpirvCodegenBackend {
|
||||||
type Module = Vec<u32>;
|
type Module = Vec<u32>;
|
||||||
type TargetMachine = ();
|
type TargetMachine = ();
|
||||||
|
type TargetMachineError = String;
|
||||||
type ModuleBuffer = SpirvModuleBuffer;
|
type ModuleBuffer = SpirvModuleBuffer;
|
||||||
type ThinData = ();
|
type ThinData = ();
|
||||||
type ThinBuffer = SpirvThinBuffer;
|
type ThinBuffer = SpirvThinBuffer;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[toolchain]
|
[toolchain]
|
||||||
channel = "nightly-2023-01-21"
|
channel = "nightly-2023-02-01"
|
||||||
components = ["rust-src", "rustc-dev", "llvm-tools-preview"]
|
components = ["rust-src", "rustc-dev", "llvm-tools-preview"]
|
||||||
# commit_hash = 5ce39f42bd2c8bca9c570f0560ebe1fce4eddb14
|
# commit_hash = dc1d9d50fba2f6a1ccab8748a0050cde38253f60
|
||||||
|
|
||||||
# Whenever changing the nightly channel, update the commit hash above, and make
|
# Whenever changing the nightly channel, update the commit hash above, and make
|
||||||
# sure to change REQUIRED_TOOLCHAIN in crates/rustc_codegen_spirv/src/build.rs also.
|
# sure to change REQUIRED_TOOLCHAIN in crates/rustc_codegen_spirv/src/build.rs also.
|
||||||
|
Loading…
Reference in New Issue
Block a user