mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-23 15:23:33 +00:00
[spv-in] Fix empty gl_PerVertex name
This commit is contained in:
parent
9fbe681316
commit
1476ef84ff
@ -363,6 +363,7 @@ struct Assignment {
|
||||
value: Handle<crate::Expression>,
|
||||
}
|
||||
|
||||
#[derive(PartialEq)]
|
||||
enum ExtendedClass {
|
||||
Global(crate::StorageClass),
|
||||
Input,
|
||||
@ -3303,7 +3304,7 @@ impl<I: Iterator<Item = u32>> Parser<I> {
|
||||
} else {
|
||||
None
|
||||
};
|
||||
let dec = self.future_decor.remove(&id).unwrap_or_default();
|
||||
let mut dec = self.future_decor.remove(&id).unwrap_or_default();
|
||||
|
||||
let original_ty = self.lookup_type.lookup(type_id)?.handle;
|
||||
let (effective_ty, is_storage) = match module.types[original_ty].inner {
|
||||
@ -3322,6 +3323,17 @@ impl<I: Iterator<Item = u32>> Parser<I> {
|
||||
map_storage_class(storage_class)?
|
||||
};
|
||||
|
||||
// Fix empty name for gl_PerVertex struct generated by glslang
|
||||
if let crate::TypeInner::Pointer { .. } = module.types[original_ty].inner {
|
||||
if ext_class == ExtendedClass::Input || ext_class == ExtendedClass::Output {
|
||||
if let Some(ref dec_name) = dec.name {
|
||||
if dec_name.is_empty() {
|
||||
dec.name = Some("perVertexStruct".to_string())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let (inner, var) = match ext_class {
|
||||
ExtendedClass::Global(class) => {
|
||||
let storage_access = if is_storage {
|
||||
|
@ -20,12 +20,12 @@ struct type10 {
|
||||
void main1(
|
||||
thread metal::float2& v_uv,
|
||||
thread metal::float2 const& a_uv,
|
||||
thread gl_PerVertex& _,
|
||||
thread gl_PerVertex& perVertexStruct,
|
||||
thread metal::float2 const& a_pos
|
||||
) {
|
||||
v_uv = a_uv;
|
||||
metal::float2 _e13 = a_pos;
|
||||
_.gl_Position = metal::float4(_e13.x, _e13.y, 0.0, 1.0);
|
||||
perVertexStruct.gl_Position = metal::float4(_e13.x, _e13.y, 0.0, 1.0);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -44,13 +44,13 @@ vertex main2Output main2(
|
||||
) {
|
||||
metal::float2 v_uv = {};
|
||||
metal::float2 a_uv = {};
|
||||
gl_PerVertex _ = {};
|
||||
gl_PerVertex perVertexStruct = {};
|
||||
metal::float2 a_pos = {};
|
||||
const auto a_uv1 = varyings.a_uv1;
|
||||
const auto a_pos1 = varyings.a_pos1;
|
||||
a_uv = a_uv1;
|
||||
a_pos = a_pos1;
|
||||
main1(v_uv, a_uv, _, a_pos);
|
||||
const auto _tmp = type10 {v_uv, _.gl_Position, _.gl_PointSize, _.gl_ClipDistance};
|
||||
main1(v_uv, a_uv, perVertexStruct, a_pos);
|
||||
const auto _tmp = type10 {v_uv, perVertexStruct.gl_Position, perVertexStruct.gl_PointSize, perVertexStruct.gl_ClipDistance};
|
||||
return main2Output { _tmp.member, _tmp.gl_Position1, _tmp.gl_PointSize1, {_tmp.gl_ClipDistance1.inner[0]} };
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user