mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-22 14:55:05 +00:00
[spv-in] Remove providing "perVertexStruct" for certain unnamed inputs
since we probably shouldn't be naming things if they don't have a name in the input. As requested here: https://github.com/gfx-rs/wgpu/pull/5227#issuecomment-1936027091
This commit is contained in:
parent
b704132b4c
commit
4554f852c1
@ -5079,7 +5079,7 @@ impl<I: Iterator<Item = u32>> Frontend<I> {
|
||||
None
|
||||
};
|
||||
let span = self.span_from_with_op(start);
|
||||
let mut dec = self.future_decor.remove(&id).unwrap_or_default();
|
||||
let dec = self.future_decor.remove(&id).unwrap_or_default();
|
||||
|
||||
let original_ty = self.lookup_type.lookup(type_id)?.handle;
|
||||
let mut ty = original_ty;
|
||||
@ -5125,17 +5125,6 @@ impl<I: Iterator<Item = u32>> Frontend<I> {
|
||||
None => 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(mut space) => {
|
||||
if let crate::AddressSpace::Storage { ref mut access } = space {
|
||||
|
@ -17,7 +17,7 @@ vec2 v_uv = vec2(0.0);
|
||||
|
||||
vec2 a_uv_1 = vec2(0.0);
|
||||
|
||||
gen_gl_PerVertex perVertexStruct = gen_gl_PerVertex(vec4(0.0, 0.0, 0.0, 1.0), 1.0, float[1](0.0), float[1](0.0));
|
||||
gen_gl_PerVertex unnamed = gen_gl_PerVertex(vec4(0.0, 0.0, 0.0, 1.0), 1.0, float[1](0.0), float[1](0.0));
|
||||
|
||||
vec2 a_pos_1 = vec2(0.0);
|
||||
|
||||
@ -29,7 +29,7 @@ void main_1() {
|
||||
vec2 _e6 = a_uv_1;
|
||||
v_uv = _e6;
|
||||
vec2 _e7 = a_pos_1;
|
||||
perVertexStruct.gen_gl_Position = vec4(_e7.x, _e7.y, 0.0, 1.0);
|
||||
unnamed.gen_gl_Position = vec4(_e7.x, _e7.y, 0.0, 1.0);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -40,7 +40,7 @@ void main() {
|
||||
a_pos_1 = a_pos;
|
||||
main_1();
|
||||
vec2 _e7 = v_uv;
|
||||
vec4 _e8 = perVertexStruct.gen_gl_Position;
|
||||
vec4 _e8 = unnamed.gen_gl_Position;
|
||||
type_4 _tmp_return = type_4(_e7, _e8);
|
||||
_vs2fs_location0 = _tmp_return.member;
|
||||
gl_Position = _tmp_return.gen_gl_Position;
|
||||
|
@ -22,7 +22,7 @@ gl_PerVertex Constructgl_PerVertex(float4 arg0, float arg1, float arg2[1], float
|
||||
|
||||
static float2 v_uv = (float2)0;
|
||||
static float2 a_uv_1 = (float2)0;
|
||||
static gl_PerVertex perVertexStruct = Constructgl_PerVertex(float4(0.0, 0.0, 0.0, 1.0), 1.0, (float[1])0, (float[1])0);
|
||||
static gl_PerVertex unnamed = Constructgl_PerVertex(float4(0.0, 0.0, 0.0, 1.0), 1.0, (float[1])0, (float[1])0);
|
||||
static float2 a_pos_1 = (float2)0;
|
||||
|
||||
struct VertexOutput_main {
|
||||
@ -35,7 +35,7 @@ void main_1()
|
||||
float2 _expr6 = a_uv_1;
|
||||
v_uv = _expr6;
|
||||
float2 _expr7 = a_pos_1;
|
||||
perVertexStruct.gl_Position = float4(_expr7.x, _expr7.y, 0.0, 1.0);
|
||||
unnamed.gl_Position = float4(_expr7.x, _expr7.y, 0.0, 1.0);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -52,7 +52,7 @@ VertexOutput_main main(float2 a_uv : LOC1, float2 a_pos : LOC0)
|
||||
a_pos_1 = a_pos;
|
||||
main_1();
|
||||
float2 _expr7 = v_uv;
|
||||
float4 _expr8 = perVertexStruct.gl_Position;
|
||||
float4 _expr8 = unnamed.gl_Position;
|
||||
const type_4 type_4_ = Constructtype_4(_expr7, _expr8);
|
||||
const VertexOutput_main type_4_1 = { type_4_.member, type_4_.gl_Position };
|
||||
return type_4_1;
|
||||
|
@ -21,13 +21,13 @@ struct type_4 {
|
||||
void main_1(
|
||||
thread metal::float2& v_uv,
|
||||
thread metal::float2& a_uv_1,
|
||||
thread gl_PerVertex& perVertexStruct,
|
||||
thread gl_PerVertex& unnamed,
|
||||
thread metal::float2& a_pos_1
|
||||
) {
|
||||
metal::float2 _e6 = a_uv_1;
|
||||
v_uv = _e6;
|
||||
metal::float2 _e7 = a_pos_1;
|
||||
perVertexStruct.gl_Position = metal::float4(_e7.x, _e7.y, 0.0, 1.0);
|
||||
unnamed.gl_Position = metal::float4(_e7.x, _e7.y, 0.0, 1.0);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -44,15 +44,15 @@ vertex main_Output main_(
|
||||
) {
|
||||
metal::float2 v_uv = {};
|
||||
metal::float2 a_uv_1 = {};
|
||||
gl_PerVertex perVertexStruct = gl_PerVertex {metal::float4(0.0, 0.0, 0.0, 1.0), 1.0, type_3 {}, type_3 {}};
|
||||
gl_PerVertex unnamed = gl_PerVertex {metal::float4(0.0, 0.0, 0.0, 1.0), 1.0, type_3 {}, type_3 {}};
|
||||
metal::float2 a_pos_1 = {};
|
||||
const auto a_uv = varyings.a_uv;
|
||||
const auto a_pos = varyings.a_pos;
|
||||
a_uv_1 = a_uv;
|
||||
a_pos_1 = a_pos;
|
||||
main_1(v_uv, a_uv_1, perVertexStruct, a_pos_1);
|
||||
main_1(v_uv, a_uv_1, unnamed, a_pos_1);
|
||||
metal::float2 _e7 = v_uv;
|
||||
metal::float4 _e8 = perVertexStruct.gl_Position;
|
||||
metal::float4 _e8 = unnamed.gl_Position;
|
||||
const auto _tmp = type_4 {_e7, _e8};
|
||||
return main_Output { _tmp.member, _tmp.gl_Position };
|
||||
}
|
||||
|
@ -12,14 +12,14 @@ struct VertexOutput {
|
||||
|
||||
var<private> v_uv: vec2<f32>;
|
||||
var<private> a_uv_1: vec2<f32>;
|
||||
var<private> perVertexStruct: gl_PerVertex = gl_PerVertex(vec4<f32>(0f, 0f, 0f, 1f), 1f, array<f32, 1>(), array<f32, 1>());
|
||||
var<private> unnamed: gl_PerVertex = gl_PerVertex(vec4<f32>(0f, 0f, 0f, 1f), 1f, array<f32, 1>(), array<f32, 1>());
|
||||
var<private> a_pos_1: vec2<f32>;
|
||||
|
||||
fn main_1() {
|
||||
let _e6 = a_uv_1;
|
||||
v_uv = _e6;
|
||||
let _e7 = a_pos_1;
|
||||
perVertexStruct.gl_Position = vec4<f32>(_e7.x, _e7.y, 0f, 1f);
|
||||
unnamed.gl_Position = vec4<f32>(_e7.x, _e7.y, 0f, 1f);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -29,6 +29,6 @@ fn main(@location(1) a_uv: vec2<f32>, @location(0) a_pos: vec2<f32>) -> VertexOu
|
||||
a_pos_1 = a_pos;
|
||||
main_1();
|
||||
let _e7 = v_uv;
|
||||
let _e8 = perVertexStruct.gl_Position;
|
||||
let _e8 = unnamed.gl_Position;
|
||||
return VertexOutput(_e7, _e8);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user