MCPcopy Create free account
hub / github.com/Rust-GPU/rust-gpu / shader_entry_stub

Method shader_entry_stub

crates/rustc_codegen_spirv/src/codegen_cx/entry.rs:153–213  ·  view source on GitHub ↗
(
        &self,
        span: Span,
        entry_func: SpirvValue,
        entry_fn_abi: &FnAbi<'tcx, Ty<'tcx>>,
        hir_params: &[hir::Param<'tcx>],
        name: String,
        execution_mode

Source from the content-addressed store, hash-verified

151 }
152
153 fn shader_entry_stub(
154 &self,
155 span: Span,
156 entry_func: SpirvValue,
157 entry_fn_abi: &FnAbi<'tcx, Ty<'tcx>>,
158 hir_params: &[hir::Param<'tcx>],
159 name: String,
160 execution_model: ExecutionModel,
161 ) -> Word {
162 let stub_fn = {
163 let void = SpirvType::Void.def(span, self);
164 let fn_void_void = SpirvType::Function {
165 return_type: void,
166 arguments: &[],
167 }
168 .def(span, self);
169 let mut emit = self.emit_global();
170 let id = emit
171 .begin_function(void, None, FunctionControl::NONE, fn_void_void)
172 .unwrap();
173 emit.end_function().unwrap();
174 id.with_type(fn_void_void)
175 };
176
177 let mut op_entry_point_interface_operands = vec![];
178
179 let mut bx = Builder::build(self, Builder::append_block(self, stub_fn, ""));
180 let mut call_args = vec![];
181 let mut decoration_locations = FxHashMap::default();
182 for (entry_arg_abi, hir_param) in entry_fn_abi.args.iter().zip(hir_params) {
183 bx.set_span(hir_param.span);
184 self.declare_shader_interface_for_param(
185 execution_model,
186 entry_arg_abi,
187 hir_param,
188 &mut op_entry_point_interface_operands,
189 &mut bx,
190 &mut call_args,
191 &mut decoration_locations,
192 );
193 }
194 bx.set_span(span);
195 bx.call(
196 entry_func.ty,
197 None,
198 Some(entry_fn_abi),
199 entry_func,
200 &call_args,
201 None,
202 );
203 bx.ret_void();
204
205 let stub_fn_id = stub_fn.def_cx(self);
206 self.emit_global().entry_point(
207 execution_model,
208 stub_fn_id,
209 name,
210 op_entry_point_interface_operands,

Callers 1

entry_stubMethod · 0.80

Calls 9

emit_globalMethod · 0.80
with_typeMethod · 0.80
iterMethod · 0.80
set_spanMethod · 0.80
callMethod · 0.80
ret_voidMethod · 0.80
def_cxMethod · 0.80
defMethod · 0.45

Tested by

no test coverage detected