Statement for void function call

This commit is contained in:
Dzmitry Malyshau
2021-02-05 10:54:50 -05:00
committed by Dzmitry Malyshau
parent f9f41fc9bf
commit d949d58f7b
12 changed files with 668 additions and 621 deletions

View File

@@ -979,11 +979,11 @@ impl<'a, W: Write> Writer<'a, W> {
// The indentation is only for readability
write!(self.out, "{}", INDENT.repeat(indent))?;
match sta {
match *sta {
// Blocks are simple we just need to write the block statements between braces
// We could also just print the statements but this is more readable and maps more
// closely to the IR
Statement::Block(block) => {
Statement::Block(ref block) => {
writeln!(self.out, "{{")?;
for sta in block.iter() {
// Increase the indentation to help with readability
@@ -1001,11 +1001,11 @@ impl<'a, W: Write> Writer<'a, W> {
// ```
Statement::If {
condition,
accept,
reject,
ref accept,
ref reject,
} => {
write!(self.out, "if(")?;
self.write_expr(*condition, ctx)?;
self.write_expr(condition, ctx)?;
writeln!(self.out, ") {{")?;
for sta in accept {
@@ -1044,12 +1044,12 @@ impl<'a, W: Write> Writer<'a, W> {
// so that we don't need to print a `break` for it
Statement::Switch {
selector,
cases,
default,
ref cases,
ref default,
} => {
// Start the switch
write!(self.out, "switch(")?;
self.write_expr(*selector, ctx)?;
self.write_expr(selector, ctx)?;
writeln!(self.out, ") {{")?;
// Write all cases
@@ -1091,7 +1091,10 @@ impl<'a, W: Write> Writer<'a, W> {
// continuing
// }
// ```
Statement::Loop { body, continuing } => {
Statement::Loop {
ref body,
ref continuing,
} => {
writeln!(self.out, "while(true) {{")?;
for sta in body.iter().chain(continuing.iter()) {
@@ -1111,7 +1114,7 @@ impl<'a, W: Write> Writer<'a, W> {
// Write the expression to be returned if needed
if let Some(expr) = value {
write!(self.out, " ")?;
self.write_expr(*expr, ctx)?;
self.write_expr(expr, ctx)?;
}
writeln!(self.out, ";")?;
}
@@ -1121,11 +1124,20 @@ impl<'a, W: Write> Writer<'a, W> {
Statement::Kill => writeln!(self.out, "discard;")?,
// Stores in glsl are just variable assignments written as `pointer = value;`
Statement::Store { pointer, value } => {
self.write_expr(*pointer, ctx)?;
self.write_expr(pointer, ctx)?;
write!(self.out, " = ")?;
self.write_expr(*value, ctx)?;
self.write_expr(value, ctx)?;
writeln!(self.out, ";")?
}
// A `Call` is written `name(arguments)` where `arguments` is a comma separated expressions list
Statement::Call {
function,
ref arguments,
} => {
write!(self.out, "{}(", &self.names[&NameKey::Function(function)])?;
self.write_slice(arguments, |this, _, arg| this.write_expr(*arg, ctx))?;
write!(self.out, ");")?
}
}
Ok(())

View File

@@ -741,6 +741,15 @@ impl<W: Write> Writer<W> {
self.put_expression(value, context)?;
writeln!(self.out, ";")?;
}
crate::Statement::Call {
function,
ref arguments,
} => {
let name = &self.names[&NameKey::Function(function)];
write!(self.out, "{}", name)?;
self.put_call("", arguments, context)?;
writeln!(self.out, ";")?;
}
}
}
Ok(())

View File

@@ -181,7 +181,7 @@ pub struct Writer {
debugs: Vec<Instruction>,
annotations: Vec<Instruction>,
flags: WriterFlags,
void_type: Option<u32>,
void_type: u32,
lookup_type: crate::FastHashMap<LookupType, Word>,
lookup_function: crate::FastHashMap<crate::Handle<crate::Function>, Word>,
lookup_function_type: crate::FastHashMap<LookupFunctionType, Word>,
@@ -209,19 +209,19 @@ impl Writer {
Writer {
physical_layout: PhysicalLayout::new(header),
logical_layout: LogicalLayout::default(),
id_count: 0,
id_count: 2, // 0 is void type, 1 is the GLSL ext inst
capabilities,
debugs: vec![],
annotations: vec![],
flags,
void_type: None,
void_type: 0,
lookup_type: crate::FastHashMap::default(),
lookup_function: crate::FastHashMap::default(),
lookup_function_type: crate::FastHashMap::default(),
lookup_constant: crate::FastHashMap::default(),
lookup_global_variable: crate::FastHashMap::default(),
struct_type_handles: crate::FastHashMap::default(),
gl450_ext_inst_id: 0,
gl450_ext_inst_id: 1,
layouter: Layouter::default(),
typifier: Typifier::new(),
}
@@ -295,26 +295,6 @@ impl Writer {
})
}
fn get_function_return_type(
&mut self,
ty: Option<crate::Handle<crate::Type>>,
arena: &crate::Arena<crate::Type>,
) -> Result<Word, Error> {
match ty {
Some(handle) => self.get_type_id(arena, LookupType::Handle(handle)),
None => Ok(match self.void_type {
Some(id) => id,
None => {
let id = self.generate_id();
self.void_type = Some(id);
super::instructions::instruction_type_void(id)
.to_words(&mut self.logical_layout.declarations);
id
}
}),
}
}
fn get_pointer_id(
&mut self,
arena: &crate::Arena<crate::Type>,
@@ -415,8 +395,10 @@ impl Writer {
.insert(handle, LocalVariable { id, instruction });
}
let return_type_id =
self.get_function_return_type(ir_function.return_type, &ir_module.types)?;
let return_type_id = match ir_function.return_type {
Some(handle) => self.get_type_id(&ir_module.types, LookupType::Handle(handle))?,
None => self.void_type,
};
let mut parameter_type_ids = Vec::with_capacity(ir_function.arguments.len());
for argument in ir_function.arguments.iter() {
@@ -1922,6 +1904,10 @@ impl Writer {
block = Block::new(merge_id);
}
crate::Statement::Switch { .. } => {
log::error!("unimplemented Switch");
return Err(Error::FeatureNotImplemented("switch"));
}
crate::Statement::Loop {
ref body,
ref continuing,
@@ -2007,9 +1993,33 @@ impl Writer {
pointer_id, value_id, None,
));
}
_ => {
log::error!("unimplemented {:?}", statement);
return Err(Error::FeatureNotImplemented("statement"));
crate::Statement::Call {
function: local_function,
ref arguments,
} => {
let id = self.generate_id();
//TODO: avoid heap allocation
let mut argument_ids = vec![];
for argument in arguments {
let arg_id = self.write_expression(
ir_module,
ir_function,
*argument,
&mut block,
function,
)?;
argument_ids.push(arg_id);
}
block
.body
.push(super::instructions::instruction_function_call(
self.void_type,
id,
*self.lookup_function.get(&local_function).unwrap(),
argument_ids.as_slice(),
));
}
}
}
@@ -2030,7 +2040,8 @@ impl Writer {
}
fn write_logical_layout(&mut self, ir_module: &crate::Module) -> Result<(), Error> {
self.gl450_ext_inst_id = self.generate_id();
super::instructions::instruction_type_void(self.void_type)
.to_words(&mut self.logical_layout.declarations);
super::instructions::instruction_ext_inst_import(self.gl450_ext_inst_id, "GLSL.std.450")
.to_words(&mut self.logical_layout.ext_inst_imports);
@@ -2113,9 +2124,9 @@ mod tests {
fn test_writer_generate_id() {
let mut writer = create_writer();
assert_eq!(writer.id_count, 0);
assert_eq!(writer.id_count, 2);
writer.generate_id();
assert_eq!(writer.id_count, 1);
assert_eq!(writer.id_count, 3);
}
#[test]
@@ -2123,7 +2134,7 @@ mod tests {
let mut writer = create_writer();
assert_eq!(writer.physical_layout.bound, 0);
writer.write_physical_layout();
assert_eq!(writer.physical_layout.bound, 1);
assert_eq!(writer.physical_layout.bound, 3);
}
fn create_writer() -> Writer {

View File

@@ -802,6 +802,11 @@ pub enum Statement {
pointer: Handle<Expression>,
value: Handle<Expression>,
},
/// Calls a function with no return value.
Call {
function: Handle<Function>,
arguments: Vec<Handle<Expression>>,
},
}
/// A function argument.

View File

@@ -203,6 +203,15 @@ where
self.visitor.visit_lhs_expr(&self.expressions[left]);
self.traverse_expr(value);
}
S::Call {
function,
ref arguments,
} => {
for &argument in arguments {
self.traverse_expr(argument);
}
self.visitor.visit_fun(function);
}
}
}
}

View File

@@ -35,6 +35,7 @@ pub fn ensure_block_returns(block: &mut crate::Block) {
| Some(&mut crate::Statement::Kill) => (),
Some(&mut crate::Statement::Loop { .. })
| Some(&mut crate::Statement::Store { .. })
| Some(&mut crate::Statement::Call { .. })
| None => block.push(crate::Statement::Return { value: None }),
}
}

View File

@@ -32,124 +32,124 @@ OpDecorate %122 DescriptorSet 0
OpDecorate %122 Binding 0
OpDecorate %274 DescriptorSet 0
OpDecorate %274 Binding 2
%3 = OpTypeInt 32 1
%2 = OpConstant %3 1500
%5 = OpTypeFloat 32
%4 = OpConstant %5 0.0
%6 = OpConstant %3 0
%8 = OpTypeInt 32 0
%7 = OpConstant %8 0
%9 = OpConstant %3 1
%10 = OpConstant %8 1
%11 = OpConstant %5 1.0
%12 = OpConstant %5 0.1
%13 = OpConstant %5 -1.0
%15 = OpTypeVector %5 2
%16 = OpTypePointer Function %15
%22 = OpTypePointer Function %3
%27 = OpTypePointer Function %8
%28 = OpTypeVoid
%30 = OpTypeFunction %28
%0 = OpTypeVoid
%4 = OpTypeInt 32 1
%3 = OpConstant %4 1500
%6 = OpTypeFloat 32
%5 = OpConstant %6 0.0
%7 = OpConstant %4 0
%9 = OpTypeInt 32 0
%8 = OpConstant %9 0
%10 = OpConstant %4 1
%11 = OpConstant %9 1
%12 = OpConstant %6 1.0
%13 = OpConstant %6 0.1
%14 = OpConstant %6 -1.0
%16 = OpTypeVector %6 2
%17 = OpTypePointer Function %16
%23 = OpTypePointer Function %4
%28 = OpTypePointer Function %9
%30 = OpTypeFunction %0
%32 = OpTypeBool
%35 = OpTypeVector %8 3
%35 = OpTypeVector %9 3
%37 = OpTypePointer Input %35
%36 = OpVariable %37 Input
%38 = OpTypePointer Input %8
%39 = OpConstant %3 0
%45 = OpTypeStruct %15 %15
%38 = OpTypePointer Input %9
%39 = OpConstant %4 0
%45 = OpTypeStruct %16 %16
%47 = OpTypeRuntimeArray %45
%49 = OpTypeStruct %47
%51 = OpTypePointer Uniform %49
%50 = OpVariable %51 Uniform
%52 = OpTypePointer Uniform %47
%53 = OpConstant %3 0
%55 = OpTypePointer Input %8
%56 = OpConstant %3 0
%53 = OpConstant %4 0
%55 = OpTypePointer Input %9
%56 = OpConstant %4 0
%58 = OpTypePointer Uniform %45
%59 = OpTypePointer Uniform %15
%60 = OpConstant %3 0
%59 = OpTypePointer Uniform %16
%60 = OpConstant %4 0
%65 = OpTypePointer Uniform %47
%66 = OpConstant %3 0
%68 = OpTypePointer Input %8
%69 = OpConstant %3 0
%66 = OpConstant %4 0
%68 = OpTypePointer Input %9
%69 = OpConstant %4 0
%71 = OpTypePointer Uniform %45
%72 = OpTypePointer Uniform %15
%73 = OpConstant %3 1
%90 = OpTypePointer Input %8
%91 = OpConstant %3 0
%72 = OpTypePointer Uniform %16
%73 = OpConstant %4 1
%90 = OpTypePointer Input %9
%91 = OpConstant %4 0
%99 = OpTypePointer Uniform %47
%100 = OpConstant %3 0
%100 = OpConstant %4 0
%102 = OpTypePointer Uniform %45
%103 = OpTypePointer Uniform %15
%104 = OpConstant %3 0
%103 = OpTypePointer Uniform %16
%104 = OpConstant %4 0
%109 = OpTypePointer Uniform %47
%110 = OpConstant %3 0
%110 = OpConstant %4 0
%112 = OpTypePointer Uniform %45
%113 = OpTypePointer Uniform %15
%114 = OpConstant %3 1
%121 = OpTypeStruct %5 %5 %5 %5 %5 %5 %5
%113 = OpTypePointer Uniform %16
%114 = OpConstant %4 1
%121 = OpTypeStruct %6 %6 %6 %6 %6 %6 %6
%123 = OpTypePointer Uniform %121
%122 = OpVariable %123 Uniform
%124 = OpTypePointer Uniform %5
%125 = OpConstant %3 1
%140 = OpTypePointer Uniform %5
%141 = OpConstant %3 2
%156 = OpTypePointer Uniform %5
%157 = OpConstant %3 3
%198 = OpTypePointer Uniform %5
%199 = OpConstant %3 4
%204 = OpTypePointer Uniform %5
%205 = OpConstant %3 5
%210 = OpTypePointer Uniform %5
%211 = OpConstant %3 6
%224 = OpTypePointer Uniform %5
%225 = OpConstant %3 0
%229 = OpTypePointer Function %5
%230 = OpConstant %3 0
%236 = OpTypePointer Function %5
%237 = OpConstant %3 0
%240 = OpTypePointer Function %5
%241 = OpConstant %3 0
%247 = OpTypePointer Function %5
%248 = OpConstant %3 0
%251 = OpTypePointer Function %5
%252 = OpConstant %3 1
%258 = OpTypePointer Function %5
%259 = OpConstant %3 1
%262 = OpTypePointer Function %5
%263 = OpConstant %3 1
%269 = OpTypePointer Function %5
%270 = OpConstant %3 1
%124 = OpTypePointer Uniform %6
%125 = OpConstant %4 1
%140 = OpTypePointer Uniform %6
%141 = OpConstant %4 2
%156 = OpTypePointer Uniform %6
%157 = OpConstant %4 3
%198 = OpTypePointer Uniform %6
%199 = OpConstant %4 4
%204 = OpTypePointer Uniform %6
%205 = OpConstant %4 5
%210 = OpTypePointer Uniform %6
%211 = OpConstant %4 6
%224 = OpTypePointer Uniform %6
%225 = OpConstant %4 0
%229 = OpTypePointer Function %6
%230 = OpConstant %4 0
%236 = OpTypePointer Function %6
%237 = OpConstant %4 0
%240 = OpTypePointer Function %6
%241 = OpConstant %4 0
%247 = OpTypePointer Function %6
%248 = OpConstant %4 0
%251 = OpTypePointer Function %6
%252 = OpConstant %4 1
%258 = OpTypePointer Function %6
%259 = OpConstant %4 1
%262 = OpTypePointer Function %6
%263 = OpConstant %4 1
%269 = OpTypePointer Function %6
%270 = OpConstant %4 1
%274 = OpVariable %51 Uniform
%275 = OpTypePointer Uniform %47
%276 = OpConstant %3 0
%278 = OpTypePointer Input %8
%279 = OpConstant %3 0
%276 = OpConstant %4 0
%278 = OpTypePointer Input %9
%279 = OpConstant %4 0
%281 = OpTypePointer Uniform %45
%282 = OpTypePointer Uniform %15
%283 = OpConstant %3 0
%282 = OpTypePointer Uniform %16
%283 = OpConstant %4 0
%288 = OpTypePointer Uniform %47
%289 = OpConstant %3 0
%291 = OpTypePointer Input %8
%292 = OpConstant %3 0
%289 = OpConstant %4 0
%291 = OpTypePointer Input %9
%292 = OpConstant %4 0
%294 = OpTypePointer Uniform %45
%295 = OpTypePointer Uniform %15
%296 = OpConstant %3 1
%29 = OpFunction %28 None %30
%295 = OpTypePointer Uniform %16
%296 = OpConstant %4 1
%29 = OpFunction %0 None %30
%31 = OpLabel
%26 = OpVariable %27 Function %7
%23 = OpVariable %22 Function %6
%19 = OpVariable %16 Function
%14 = OpVariable %16 Function
%24 = OpVariable %16 Function
%20 = OpVariable %16 Function
%17 = OpVariable %16 Function
%25 = OpVariable %16 Function
%21 = OpVariable %22 Function %6
%18 = OpVariable %16 Function
%27 = OpVariable %28 Function %8
%24 = OpVariable %23 Function %7
%20 = OpVariable %17 Function
%15 = OpVariable %17 Function
%25 = OpVariable %17 Function
%21 = OpVariable %17 Function
%18 = OpVariable %17 Function
%26 = OpVariable %17 Function
%22 = OpVariable %23 Function %7
%19 = OpVariable %17 Function
%34 = OpAccessChain %38 %36 %39
%40 = OpLoad %8 %34
%33 = OpUGreaterThanEqual %32 %40 %2
%40 = OpLoad %9 %34
%33 = OpUGreaterThanEqual %32 %40 %3
OpSelectionMerge %41 None
OpBranchConditional %33 %42 %43
%42 = OpLabel
@@ -159,31 +159,31 @@ OpBranch %41
%41 = OpLabel
%48 = OpAccessChain %52 %50 %53
%54 = OpAccessChain %55 %36 %56
%57 = OpLoad %8 %54
%57 = OpLoad %9 %54
%46 = OpAccessChain %58 %48 %57
%44 = OpAccessChain %59 %46 %60
%61 = OpLoad %15 %44
OpStore %14 %61
%61 = OpLoad %16 %44
OpStore %15 %61
%64 = OpAccessChain %65 %50 %66
%67 = OpAccessChain %68 %36 %69
%70 = OpLoad %8 %67
%70 = OpLoad %9 %67
%63 = OpAccessChain %71 %64 %70
%62 = OpAccessChain %72 %63 %73
%74 = OpLoad %15 %62
OpStore %17 %74
%75 = OpCompositeConstruct %15 %4 %4
OpStore %18 %75
%76 = OpCompositeConstruct %15 %4 %4
OpStore %19 %76
%77 = OpCompositeConstruct %15 %4 %4
OpStore %20 %77
%74 = OpLoad %16 %62
OpStore %18 %74
%75 = OpCompositeConstruct %16 %5 %5
OpStore %19 %75
%76 = OpCompositeConstruct %16 %5 %5
OpStore %20 %76
%77 = OpCompositeConstruct %16 %5 %5
OpStore %21 %77
OpBranch %78
%78 = OpLabel
OpLoopMerge %79 %81 None
OpBranch %80
%80 = OpLabel
%83 = OpLoad %8 %26
%82 = OpUGreaterThanEqual %32 %83 %2
%83 = OpLoad %9 %27
%82 = OpUGreaterThanEqual %32 %83 %3
OpSelectionMerge %84 None
OpBranchConditional %82 %85 %86
%85 = OpLabel
@@ -191,9 +191,9 @@ OpBranch %79
%86 = OpLabel
OpBranch %84
%84 = OpLabel
%88 = OpLoad %8 %26
%88 = OpLoad %9 %27
%89 = OpAccessChain %90 %36 %91
%92 = OpLoad %8 %89
%92 = OpLoad %9 %89
%87 = OpIEqual %32 %88 %92
OpSelectionMerge %93 None
OpBranchConditional %87 %94 %95
@@ -203,207 +203,207 @@ OpBranch %81
OpBranch %93
%93 = OpLabel
%98 = OpAccessChain %99 %50 %100
%101 = OpLoad %8 %26
%101 = OpLoad %9 %27
%97 = OpAccessChain %102 %98 %101
%96 = OpAccessChain %103 %97 %104
%105 = OpLoad %15 %96
OpStore %24 %105
%105 = OpLoad %16 %96
OpStore %25 %105
%108 = OpAccessChain %109 %50 %110
%111 = OpLoad %8 %26
%111 = OpLoad %9 %27
%107 = OpAccessChain %112 %108 %111
%106 = OpAccessChain %113 %107 %114
%115 = OpLoad %15 %106
OpStore %25 %115
%117 = OpLoad %15 %24
%118 = OpLoad %15 %14
%119 = OpExtInst %5 %1 Distance %117 %118
%115 = OpLoad %16 %106
OpStore %26 %115
%117 = OpLoad %16 %25
%118 = OpLoad %16 %15
%119 = OpExtInst %6 %1 Distance %117 %118
%120 = OpAccessChain %124 %122 %125
%126 = OpLoad %5 %120
%126 = OpLoad %6 %120
%116 = OpFOrdLessThan %32 %119 %126
OpSelectionMerge %127 None
OpBranchConditional %116 %128 %129
%128 = OpLabel
%131 = OpLoad %15 %18
%132 = OpLoad %15 %24
%130 = OpFAdd %15 %131 %132
OpStore %18 %130
%134 = OpLoad %3 %21
%133 = OpIAdd %3 %134 %9
OpStore %21 %133
%131 = OpLoad %16 %19
%132 = OpLoad %16 %25
%130 = OpFAdd %16 %131 %132
OpStore %19 %130
%134 = OpLoad %4 %22
%133 = OpIAdd %4 %134 %10
OpStore %22 %133
OpBranch %127
%129 = OpLabel
OpBranch %127
%127 = OpLabel
%136 = OpLoad %15 %24
%137 = OpLoad %15 %14
%138 = OpExtInst %5 %1 Distance %136 %137
%136 = OpLoad %16 %25
%137 = OpLoad %16 %15
%138 = OpExtInst %6 %1 Distance %136 %137
%139 = OpAccessChain %140 %122 %141
%142 = OpLoad %5 %139
%142 = OpLoad %6 %139
%135 = OpFOrdLessThan %32 %138 %142
OpSelectionMerge %143 None
OpBranchConditional %135 %144 %145
%144 = OpLabel
%147 = OpLoad %15 %20
%149 = OpLoad %15 %24
%150 = OpLoad %15 %14
%148 = OpFSub %15 %149 %150
%146 = OpFSub %15 %147 %148
OpStore %20 %146
%147 = OpLoad %16 %21
%149 = OpLoad %16 %25
%150 = OpLoad %16 %15
%148 = OpFSub %16 %149 %150
%146 = OpFSub %16 %147 %148
OpStore %21 %146
OpBranch %143
%145 = OpLabel
OpBranch %143
%143 = OpLabel
%152 = OpLoad %15 %24
%153 = OpLoad %15 %14
%154 = OpExtInst %5 %1 Distance %152 %153
%152 = OpLoad %16 %25
%153 = OpLoad %16 %15
%154 = OpExtInst %6 %1 Distance %152 %153
%155 = OpAccessChain %156 %122 %157
%158 = OpLoad %5 %155
%158 = OpLoad %6 %155
%151 = OpFOrdLessThan %32 %154 %158
OpSelectionMerge %159 None
OpBranchConditional %151 %160 %161
%160 = OpLabel
%163 = OpLoad %15 %19
%164 = OpLoad %15 %25
%162 = OpFAdd %15 %163 %164
OpStore %19 %162
%166 = OpLoad %3 %23
%165 = OpIAdd %3 %166 %9
OpStore %23 %165
%163 = OpLoad %16 %20
%164 = OpLoad %16 %26
%162 = OpFAdd %16 %163 %164
OpStore %20 %162
%166 = OpLoad %4 %24
%165 = OpIAdd %4 %166 %10
OpStore %24 %165
OpBranch %159
%161 = OpLabel
OpBranch %159
%159 = OpLabel
OpBranch %81
%81 = OpLabel
%168 = OpLoad %8 %26
%167 = OpIAdd %8 %168 %10
OpStore %26 %167
%168 = OpLoad %9 %27
%167 = OpIAdd %9 %168 %11
OpStore %27 %167
OpBranch %78
%79 = OpLabel
%170 = OpLoad %3 %21
%169 = OpSGreaterThan %32 %170 %6
%170 = OpLoad %4 %22
%169 = OpSGreaterThan %32 %170 %7
OpSelectionMerge %171 None
OpBranchConditional %169 %172 %173
%172 = OpLabel
%176 = OpLoad %15 %18
%178 = OpLoad %3 %21
%179 = OpConvertSToF %5 %178
%177 = OpFDiv %5 %11 %179
%175 = OpVectorTimesScalar %15 %176 %177
%180 = OpLoad %15 %14
%174 = OpFSub %15 %175 %180
OpStore %18 %174
%176 = OpLoad %16 %19
%178 = OpLoad %4 %22
%179 = OpConvertSToF %6 %178
%177 = OpFDiv %6 %12 %179
%175 = OpVectorTimesScalar %16 %176 %177
%180 = OpLoad %16 %15
%174 = OpFSub %16 %175 %180
OpStore %19 %174
OpBranch %171
%173 = OpLabel
OpBranch %171
%171 = OpLabel
%182 = OpLoad %3 %23
%181 = OpSGreaterThan %32 %182 %6
%182 = OpLoad %4 %24
%181 = OpSGreaterThan %32 %182 %7
OpSelectionMerge %183 None
OpBranchConditional %181 %184 %185
%184 = OpLabel
%187 = OpLoad %15 %19
%189 = OpLoad %3 %23
%190 = OpConvertSToF %5 %189
%188 = OpFDiv %5 %11 %190
%186 = OpVectorTimesScalar %15 %187 %188
OpStore %19 %186
%187 = OpLoad %16 %20
%189 = OpLoad %4 %24
%190 = OpConvertSToF %6 %189
%188 = OpFDiv %6 %12 %190
%186 = OpVectorTimesScalar %16 %187 %188
OpStore %20 %186
OpBranch %183
%185 = OpLabel
OpBranch %183
%183 = OpLabel
%194 = OpLoad %15 %17
%196 = OpLoad %15 %18
%194 = OpLoad %16 %18
%196 = OpLoad %16 %19
%197 = OpAccessChain %198 %122 %199
%200 = OpLoad %5 %197
%195 = OpVectorTimesScalar %15 %196 %200
%193 = OpFAdd %15 %194 %195
%202 = OpLoad %15 %20
%200 = OpLoad %6 %197
%195 = OpVectorTimesScalar %16 %196 %200
%193 = OpFAdd %16 %194 %195
%202 = OpLoad %16 %21
%203 = OpAccessChain %204 %122 %205
%206 = OpLoad %5 %203
%201 = OpVectorTimesScalar %15 %202 %206
%192 = OpFAdd %15 %193 %201
%208 = OpLoad %15 %19
%206 = OpLoad %6 %203
%201 = OpVectorTimesScalar %16 %202 %206
%192 = OpFAdd %16 %193 %201
%208 = OpLoad %16 %20
%209 = OpAccessChain %210 %122 %211
%212 = OpLoad %5 %209
%207 = OpVectorTimesScalar %15 %208 %212
%191 = OpFAdd %15 %192 %207
OpStore %17 %191
%214 = OpLoad %15 %17
%215 = OpExtInst %15 %1 Normalize %214
%216 = OpLoad %15 %17
%217 = OpExtInst %5 %1 Length %216
%218 = OpExtInst %5 %1 FClamp %217 %4 %12
%213 = OpVectorTimesScalar %15 %215 %218
OpStore %17 %213
%220 = OpLoad %15 %14
%222 = OpLoad %15 %17
%212 = OpLoad %6 %209
%207 = OpVectorTimesScalar %16 %208 %212
%191 = OpFAdd %16 %192 %207
OpStore %18 %191
%214 = OpLoad %16 %18
%215 = OpExtInst %16 %1 Normalize %214
%216 = OpLoad %16 %18
%217 = OpExtInst %6 %1 Length %216
%218 = OpExtInst %6 %1 FClamp %217 %5 %13
%213 = OpVectorTimesScalar %16 %215 %218
OpStore %18 %213
%220 = OpLoad %16 %15
%222 = OpLoad %16 %18
%223 = OpAccessChain %224 %122 %225
%226 = OpLoad %5 %223
%221 = OpVectorTimesScalar %15 %222 %226
%219 = OpFAdd %15 %220 %221
OpStore %14 %219
%228 = OpAccessChain %229 %14 %230
%231 = OpLoad %5 %228
%227 = OpFOrdLessThan %32 %231 %13
%226 = OpLoad %6 %223
%221 = OpVectorTimesScalar %16 %222 %226
%219 = OpFAdd %16 %220 %221
OpStore %15 %219
%228 = OpAccessChain %229 %15 %230
%231 = OpLoad %6 %228
%227 = OpFOrdLessThan %32 %231 %14
OpSelectionMerge %232 None
OpBranchConditional %227 %233 %234
%233 = OpLabel
%235 = OpAccessChain %236 %14 %237
OpStore %235 %11
%235 = OpAccessChain %236 %15 %237
OpStore %235 %12
OpBranch %232
%234 = OpLabel
OpBranch %232
%232 = OpLabel
%239 = OpAccessChain %240 %14 %241
%242 = OpLoad %5 %239
%238 = OpFOrdGreaterThan %32 %242 %11
%239 = OpAccessChain %240 %15 %241
%242 = OpLoad %6 %239
%238 = OpFOrdGreaterThan %32 %242 %12
OpSelectionMerge %243 None
OpBranchConditional %238 %244 %245
%244 = OpLabel
%246 = OpAccessChain %247 %14 %248
OpStore %246 %13
%246 = OpAccessChain %247 %15 %248
OpStore %246 %14
OpBranch %243
%245 = OpLabel
OpBranch %243
%243 = OpLabel
%250 = OpAccessChain %251 %14 %252
%253 = OpLoad %5 %250
%249 = OpFOrdLessThan %32 %253 %13
%250 = OpAccessChain %251 %15 %252
%253 = OpLoad %6 %250
%249 = OpFOrdLessThan %32 %253 %14
OpSelectionMerge %254 None
OpBranchConditional %249 %255 %256
%255 = OpLabel
%257 = OpAccessChain %258 %14 %259
OpStore %257 %11
%257 = OpAccessChain %258 %15 %259
OpStore %257 %12
OpBranch %254
%256 = OpLabel
OpBranch %254
%254 = OpLabel
%261 = OpAccessChain %262 %14 %263
%264 = OpLoad %5 %261
%260 = OpFOrdGreaterThan %32 %264 %11
%261 = OpAccessChain %262 %15 %263
%264 = OpLoad %6 %261
%260 = OpFOrdGreaterThan %32 %264 %12
OpSelectionMerge %265 None
OpBranchConditional %260 %266 %267
%266 = OpLabel
%268 = OpAccessChain %269 %14 %270
OpStore %268 %13
%268 = OpAccessChain %269 %15 %270
OpStore %268 %14
OpBranch %265
%267 = OpLabel
OpBranch %265
%265 = OpLabel
%273 = OpAccessChain %275 %274 %276
%277 = OpAccessChain %278 %36 %279
%280 = OpLoad %8 %277
%280 = OpLoad %9 %277
%272 = OpAccessChain %281 %273 %280
%271 = OpAccessChain %282 %272 %283
%284 = OpLoad %15 %14
%284 = OpLoad %16 %15
OpStore %271 %284
%287 = OpAccessChain %288 %274 %289
%290 = OpAccessChain %291 %36 %292
%293 = OpLoad %8 %290
%293 = OpLoad %9 %290
%286 = OpAccessChain %294 %287 %293
%285 = OpAccessChain %295 %286 %296
%297 = OpLoad %15 %17
%297 = OpLoad %16 %18
OpStore %285 %297
OpReturn
OpFunctionEnd

View File

@@ -17,93 +17,93 @@ OpMemberDecorate %45 0 Offset 0
OpDecorate %46 DescriptorSet 0
OpDecorate %46 Binding 0
OpDecorate %53 BuiltIn GlobalInvocationId
%3 = OpTypeInt 32 0
%2 = OpConstant %3 0
%4 = OpConstant %3 1
%5 = OpConstant %3 2
%6 = OpConstant %3 3
%8 = OpTypePointer Function %3
%12 = OpTypeFunction %3 %3
%18 = OpTypeBool
%38 = OpTypeVoid
%40 = OpTypeFunction %38
%43 = OpTypeRuntimeArray %3
%0 = OpTypeVoid
%4 = OpTypeInt 32 0
%3 = OpConstant %4 0
%5 = OpConstant %4 1
%6 = OpConstant %4 2
%7 = OpConstant %4 3
%9 = OpTypePointer Function %4
%13 = OpTypeFunction %4 %4
%19 = OpTypeBool
%40 = OpTypeFunction %0
%43 = OpTypeRuntimeArray %4
%45 = OpTypeStruct %43
%47 = OpTypePointer Uniform %45
%46 = OpVariable %47 Uniform
%48 = OpTypePointer Uniform %43
%49 = OpTypeInt 32 1
%50 = OpConstant %49 0
%52 = OpTypeVector %3 3
%52 = OpTypeVector %4 3
%54 = OpTypePointer Input %52
%53 = OpVariable %54 Input
%55 = OpTypePointer Input %3
%55 = OpTypePointer Input %4
%56 = OpConstant %49 0
%58 = OpTypePointer Uniform %3
%58 = OpTypePointer Uniform %4
%62 = OpTypePointer Uniform %43
%63 = OpConstant %49 0
%65 = OpTypePointer Input %3
%65 = OpTypePointer Input %4
%66 = OpConstant %49 0
%68 = OpTypePointer Uniform %3
%11 = OpFunction %3 None %12
%10 = OpFunctionParameter %3
%13 = OpLabel
%7 = OpVariable %8 Function
%9 = OpVariable %8 Function %2
OpStore %7 %10
OpBranch %14
%68 = OpTypePointer Uniform %4
%12 = OpFunction %4 None %13
%11 = OpFunctionParameter %4
%14 = OpLabel
OpLoopMerge %15 %17 None
OpBranch %16
%16 = OpLabel
%20 = OpLoad %3 %7
%19 = OpULessThanEqual %18 %20 %4
OpSelectionMerge %21 None
OpBranchConditional %19 %22 %23
%22 = OpLabel
%8 = OpVariable %9 Function
%10 = OpVariable %9 Function %3
OpStore %8 %11
OpBranch %15
%23 = OpLabel
OpBranch %21
%21 = OpLabel
%26 = OpLoad %3 %7
%25 = OpUMod %3 %26 %5
%24 = OpIEqual %18 %25 %2
OpSelectionMerge %27 None
OpBranchConditional %24 %28 %29
%28 = OpLabel
%31 = OpLoad %3 %7
%30 = OpUDiv %3 %31 %5
OpStore %7 %30
OpBranch %27
%29 = OpLabel
%34 = OpLoad %3 %7
%33 = OpIMul %3 %6 %34
%32 = OpIAdd %3 %33 %4
OpStore %7 %32
OpBranch %27
%27 = OpLabel
%36 = OpLoad %3 %9
%35 = OpIAdd %3 %36 %4
OpStore %9 %35
%15 = OpLabel
OpLoopMerge %16 %18 None
OpBranch %17
%17 = OpLabel
OpBranch %14
%15 = OpLabel
%37 = OpLoad %3 %9
OpReturnValue %37
%21 = OpLoad %4 %8
%20 = OpULessThanEqual %19 %21 %5
OpSelectionMerge %22 None
OpBranchConditional %20 %23 %24
%23 = OpLabel
OpBranch %16
%24 = OpLabel
OpBranch %22
%22 = OpLabel
%27 = OpLoad %4 %8
%26 = OpUMod %4 %27 %6
%25 = OpIEqual %19 %26 %3
OpSelectionMerge %28 None
OpBranchConditional %25 %29 %30
%29 = OpLabel
%32 = OpLoad %4 %8
%31 = OpUDiv %4 %32 %6
OpStore %8 %31
OpBranch %28
%30 = OpLabel
%35 = OpLoad %4 %8
%34 = OpIMul %4 %7 %35
%33 = OpIAdd %4 %34 %5
OpStore %8 %33
OpBranch %28
%28 = OpLabel
%37 = OpLoad %4 %10
%36 = OpIAdd %4 %37 %5
OpStore %10 %36
OpBranch %18
%18 = OpLabel
OpBranch %15
%16 = OpLabel
%38 = OpLoad %4 %10
OpReturnValue %38
OpFunctionEnd
%39 = OpFunction %38 None %40
%39 = OpFunction %0 None %40
%41 = OpLabel
%44 = OpAccessChain %48 %46 %50
%51 = OpAccessChain %55 %53 %56
%57 = OpLoad %3 %51
%57 = OpLoad %4 %51
%42 = OpAccessChain %58 %44 %57
%61 = OpAccessChain %62 %46 %63
%64 = OpAccessChain %65 %53 %66
%67 = OpLoad %3 %64
%67 = OpLoad %4 %64
%60 = OpAccessChain %68 %61 %67
%69 = OpLoad %3 %60
%59 = OpFunctionCall %3 %11 %69
%69 = OpLoad %4 %60
%59 = OpFunctionCall %4 %12 %69
OpStore %42 %59
OpReturn
OpFunctionEnd

View File

@@ -11,9 +11,9 @@ OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %3 "main"
OpExecutionMode %3 LocalSize 1 1 1
%2 = OpTypeVoid
%4 = OpTypeFunction %2
%3 = OpFunction %2 None %4
%0 = OpTypeVoid
%4 = OpTypeFunction %0
%3 = OpFunction %0 None %4
%5 = OpLabel
OpReturn
OpFunctionEnd

View File

@@ -22,23 +22,23 @@ OpDecorate %27 Binding 0
OpDecorate %32 DescriptorSet 0
OpDecorate %32 Binding 1
OpDecorate %35 Location 0
%3 = OpTypeFloat 32
%2 = OpConstant %3 1.2
%4 = OpConstant %3 0.0
%5 = OpConstant %3 1.0
%6 = OpTypeVoid
%8 = OpTypeFunction %6
%10 = OpTypeVector %3 2
%0 = OpTypeVoid
%4 = OpTypeFloat 32
%3 = OpConstant %4 1.2
%5 = OpConstant %4 0.0
%6 = OpConstant %4 1.0
%8 = OpTypeFunction %0
%10 = OpTypeVector %4 2
%12 = OpTypePointer Output %10
%11 = OpVariable %12 Output
%14 = OpTypePointer Input %10
%13 = OpVariable %14 Input
%16 = OpTypeVector %3 4
%16 = OpTypeVector %4 4
%18 = OpTypePointer Output %16
%17 = OpVariable %18 Output
%20 = OpVariable %14 Input
%25 = OpVariable %18 Output
%26 = OpTypeImage %3 2D 0 0 0 1 Unknown
%26 = OpTypeImage %4 2D 0 0 0 1 Unknown
%28 = OpTypePointer UniformConstant %26
%27 = OpVariable %28 UniformConstant
%30 = OpTypeSampledImage %26
@@ -46,17 +46,17 @@ OpDecorate %35 Location 0
%33 = OpTypePointer UniformConstant %31
%32 = OpVariable %33 UniformConstant
%35 = OpVariable %14 Input
%7 = OpFunction %6 None %8
%7 = OpFunction %0 None %8
%9 = OpLabel
%15 = OpLoad %10 %13
OpStore %11 %15
%21 = OpLoad %10 %20
%19 = OpVectorTimesScalar %10 %21 %2
%22 = OpCompositeConstruct %16 %19 %4 %5
%19 = OpVectorTimesScalar %10 %21 %3
%22 = OpCompositeConstruct %16 %19 %5 %6
OpStore %17 %22
OpReturn
OpFunctionEnd
%23 = OpFunction %6 None %8
%23 = OpFunction %0 None %8
%24 = OpLabel
%29 = OpLoad %26 %27
%34 = OpLoad %31 %32

View File

@@ -11,10 +11,10 @@ OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %64 "fs_main" %114 %111 %217
OpExecutionMode %64 OriginUpperLeft
OpDecorate %27 DescriptorSet 0
OpDecorate %27 Binding 2
OpDecorate %32 DescriptorSet 0
OpDecorate %32 Binding 3
OpDecorate %28 DescriptorSet 0
OpDecorate %28 Binding 2
OpDecorate %33 DescriptorSet 0
OpDecorate %33 Binding 3
OpDecorate %76 Block
OpMemberDecorate %76 0 Offset 0
OpDecorate %77 DescriptorSet 0
@@ -33,161 +33,161 @@ OpDecorate %102 Binding 1
OpDecorate %111 Location 1
OpDecorate %114 Location 0
OpDecorate %217 Location 0
%3 = OpTypeFloat 32
%2 = OpConstant %3 0.0
%4 = OpConstant %3 1.0
%5 = OpConstant %3 0.5
%6 = OpConstant %3 -0.5
%7 = OpConstant %3 0.05
%9 = OpTypeVector %3 3
%8 = OpConstantComposite %9 %7 %7 %7
%11 = OpTypeInt 32 0
%10 = OpConstant %11 10
%12 = OpConstant %11 0
%13 = OpConstant %11 1
%16 = OpTypeVector %3 4
%18 = OpTypeFunction %3 %11 %16
%20 = OpTypeBool
%26 = OpTypeImage %3 2D 1 1 0 1 Unknown
%28 = OpTypePointer UniformConstant %26
%27 = OpVariable %28 UniformConstant
%30 = OpTypeSampledImage %26
%31 = OpTypeSampler
%33 = OpTypePointer UniformConstant %31
%32 = OpVariable %33 UniformConstant
%35 = OpTypeVector %3 2
%49 = OpTypeInt 32 1
%58 = OpConstant %3 0.0
%60 = OpTypePointer Function %9
%62 = OpTypePointer Function %11
%63 = OpTypeVoid
%65 = OpTypeFunction %63
%74 = OpTypeVector %11 4
%0 = OpTypeVoid
%4 = OpTypeFloat 32
%3 = OpConstant %4 0.0
%5 = OpConstant %4 1.0
%6 = OpConstant %4 0.5
%7 = OpConstant %4 -0.5
%8 = OpConstant %4 0.05
%10 = OpTypeVector %4 3
%9 = OpConstantComposite %10 %8 %8 %8
%12 = OpTypeInt 32 0
%11 = OpConstant %12 10
%13 = OpConstant %12 0
%14 = OpConstant %12 1
%17 = OpTypeVector %4 4
%19 = OpTypeFunction %4 %12 %17
%21 = OpTypeBool
%27 = OpTypeImage %4 2D 1 1 0 1 Unknown
%29 = OpTypePointer UniformConstant %27
%28 = OpVariable %29 UniformConstant
%31 = OpTypeSampledImage %27
%32 = OpTypeSampler
%34 = OpTypePointer UniformConstant %32
%33 = OpVariable %34 UniformConstant
%36 = OpTypeVector %4 2
%50 = OpTypeInt 32 1
%59 = OpConstant %4 0.0
%61 = OpTypePointer Function %10
%63 = OpTypePointer Function %12
%65 = OpTypeFunction %0
%74 = OpTypeVector %12 4
%76 = OpTypeStruct %74
%78 = OpTypePointer Uniform %76
%77 = OpVariable %78 Uniform
%79 = OpTypePointer Uniform %74
%80 = OpConstant %49 0
%81 = OpTypePointer Uniform %11
%82 = OpConstant %49 0
%95 = OpTypeMatrix %16 4
%97 = OpTypeStruct %95 %16 %16
%80 = OpConstant %50 0
%81 = OpTypePointer Uniform %12
%82 = OpConstant %50 0
%95 = OpTypeMatrix %17 4
%97 = OpTypeStruct %95 %17 %17
%99 = OpTypeRuntimeArray %97
%101 = OpTypeStruct %99
%103 = OpTypePointer Uniform %101
%102 = OpVariable %103 Uniform
%104 = OpTypePointer Uniform %99
%105 = OpConstant %49 0
%105 = OpConstant %50 0
%107 = OpTypePointer Uniform %97
%108 = OpTypePointer Uniform %95
%109 = OpConstant %49 0
%112 = OpTypePointer Input %16
%109 = OpConstant %50 0
%112 = OpTypePointer Input %17
%111 = OpVariable %112 Input
%115 = OpTypePointer Input %9
%115 = OpTypePointer Input %10
%114 = OpVariable %115 Input
%123 = OpTypePointer Uniform %99
%124 = OpConstant %49 0
%124 = OpConstant %50 0
%126 = OpTypePointer Uniform %97
%127 = OpTypePointer Uniform %16
%128 = OpConstant %49 1
%129 = OpTypePointer Uniform %3
%130 = OpConstant %49 0
%127 = OpTypePointer Uniform %17
%128 = OpConstant %50 1
%129 = OpTypePointer Uniform %4
%130 = OpConstant %50 0
%136 = OpTypePointer Uniform %99
%137 = OpConstant %49 0
%137 = OpConstant %50 0
%139 = OpTypePointer Uniform %97
%140 = OpTypePointer Uniform %16
%141 = OpConstant %49 1
%142 = OpTypePointer Uniform %3
%143 = OpConstant %49 1
%140 = OpTypePointer Uniform %17
%141 = OpConstant %50 1
%142 = OpTypePointer Uniform %4
%143 = OpConstant %50 1
%149 = OpTypePointer Uniform %99
%150 = OpConstant %49 0
%150 = OpConstant %50 0
%152 = OpTypePointer Uniform %97
%153 = OpTypePointer Uniform %16
%154 = OpConstant %49 1
%155 = OpTypePointer Uniform %3
%156 = OpConstant %49 2
%160 = OpTypePointer Input %3
%161 = OpConstant %49 0
%164 = OpTypePointer Input %3
%165 = OpConstant %49 1
%168 = OpTypePointer Input %3
%169 = OpConstant %49 2
%153 = OpTypePointer Uniform %17
%154 = OpConstant %50 1
%155 = OpTypePointer Uniform %4
%156 = OpConstant %50 2
%160 = OpTypePointer Input %4
%161 = OpConstant %50 0
%164 = OpTypePointer Input %4
%165 = OpConstant %50 1
%168 = OpTypePointer Input %4
%169 = OpConstant %50 2
%179 = OpTypePointer Uniform %99
%180 = OpConstant %49 0
%180 = OpConstant %50 0
%182 = OpTypePointer Uniform %97
%183 = OpTypePointer Uniform %16
%184 = OpConstant %49 2
%185 = OpTypePointer Uniform %3
%186 = OpConstant %49 0
%183 = OpTypePointer Uniform %17
%184 = OpConstant %50 2
%185 = OpTypePointer Uniform %4
%186 = OpConstant %50 0
%192 = OpTypePointer Uniform %99
%193 = OpConstant %49 0
%193 = OpConstant %50 0
%195 = OpTypePointer Uniform %97
%196 = OpTypePointer Uniform %16
%197 = OpConstant %49 2
%198 = OpTypePointer Uniform %3
%199 = OpConstant %49 1
%196 = OpTypePointer Uniform %17
%197 = OpConstant %50 2
%198 = OpTypePointer Uniform %4
%199 = OpConstant %50 1
%205 = OpTypePointer Uniform %99
%206 = OpConstant %49 0
%206 = OpConstant %50 0
%208 = OpTypePointer Uniform %97
%209 = OpTypePointer Uniform %16
%210 = OpConstant %49 2
%211 = OpTypePointer Uniform %3
%212 = OpConstant %49 2
%218 = OpTypePointer Output %16
%209 = OpTypePointer Uniform %17
%210 = OpConstant %50 2
%211 = OpTypePointer Uniform %4
%212 = OpConstant %50 2
%218 = OpTypePointer Output %17
%217 = OpVariable %218 Output
%17 = OpFunction %3 None %18
%14 = OpFunctionParameter %11
%15 = OpFunctionParameter %16
%19 = OpLabel
%22 = OpCompositeExtract %3 %15 3
%21 = OpFOrdLessThanEqual %20 %22 %2
OpSelectionMerge %23 None
OpBranchConditional %21 %24 %25
%24 = OpLabel
OpReturnValue %4
%18 = OpFunction %4 None %19
%15 = OpFunctionParameter %12
%16 = OpFunctionParameter %17
%20 = OpLabel
%23 = OpCompositeExtract %4 %16 3
%22 = OpFOrdLessThanEqual %21 %23 %3
OpSelectionMerge %24 None
OpBranchConditional %22 %25 %26
%25 = OpLabel
OpBranch %23
%23 = OpLabel
%29 = OpLoad %26 %27
%34 = OpLoad %31 %32
%39 = OpCompositeExtract %3 %15 0
%40 = OpCompositeExtract %3 %15 1
%41 = OpCompositeConstruct %35 %39 %40
%42 = OpCompositeConstruct %35 %5 %6
%38 = OpFMul %35 %41 %42
%44 = OpCompositeExtract %3 %15 3
%43 = OpFDiv %3 %4 %44
%37 = OpVectorTimesScalar %35 %38 %43
%45 = OpCompositeConstruct %35 %5 %5
%36 = OpFAdd %35 %37 %45
%46 = OpCompositeExtract %3 %36 0
%47 = OpCompositeExtract %3 %36 1
%50 = OpBitcast %49 %14
%48 = OpConvertUToF %3 %50
%51 = OpCompositeConstruct %9 %46 %47 %48
%52 = OpSampledImage %30 %29 %34
%55 = OpCompositeExtract %3 %15 2
%57 = OpCompositeExtract %3 %15 3
%56 = OpFDiv %3 %4 %57
%54 = OpFMul %3 %55 %56
%53 = OpImageSampleDrefExplicitLod %3 %52 %51 %54 Lod %58
OpReturnValue %53
OpReturnValue %5
%26 = OpLabel
OpBranch %24
%24 = OpLabel
%30 = OpLoad %27 %28
%35 = OpLoad %32 %33
%40 = OpCompositeExtract %4 %16 0
%41 = OpCompositeExtract %4 %16 1
%42 = OpCompositeConstruct %36 %40 %41
%43 = OpCompositeConstruct %36 %6 %7
%39 = OpFMul %36 %42 %43
%45 = OpCompositeExtract %4 %16 3
%44 = OpFDiv %4 %5 %45
%38 = OpVectorTimesScalar %36 %39 %44
%46 = OpCompositeConstruct %36 %6 %6
%37 = OpFAdd %36 %38 %46
%47 = OpCompositeExtract %4 %37 0
%48 = OpCompositeExtract %4 %37 1
%51 = OpBitcast %50 %15
%49 = OpConvertUToF %4 %51
%52 = OpCompositeConstruct %10 %47 %48 %49
%53 = OpSampledImage %31 %30 %35
%56 = OpCompositeExtract %4 %16 2
%58 = OpCompositeExtract %4 %16 3
%57 = OpFDiv %4 %5 %58
%55 = OpFMul %4 %56 %57
%54 = OpImageSampleDrefExplicitLod %4 %53 %52 %55 Lod %59
OpReturnValue %54
OpFunctionEnd
%64 = OpFunction %63 None %65
%64 = OpFunction %0 None %65
%66 = OpLabel
%59 = OpVariable %60 Function %8
%61 = OpVariable %62 Function %12
%60 = OpVariable %61 Function %9
%62 = OpVariable %63 Function %13
OpBranch %67
%67 = OpLabel
OpLoopMerge %68 %70 None
OpBranch %69
%69 = OpLabel
%72 = OpLoad %11 %61
%72 = OpLoad %12 %62
%75 = OpAccessChain %79 %77 %80
%73 = OpAccessChain %81 %75 %82
%83 = OpLoad %11 %73
%84 = OpExtInst %11 %1 UMin %83 %10
%71 = OpUGreaterThanEqual %20 %72 %84
%83 = OpLoad %12 %73
%84 = OpExtInst %12 %1 UMin %83 %11
%71 = OpUGreaterThanEqual %21 %72 %84
OpSelectionMerge %85 None
OpBranchConditional %71 %86 %87
%86 = OpLabel
@@ -195,80 +195,80 @@ OpBranch %68
%87 = OpLabel
OpBranch %85
%85 = OpLabel
%89 = OpLoad %9 %59
%93 = OpLoad %11 %61
%89 = OpLoad %10 %60
%93 = OpLoad %12 %62
%100 = OpAccessChain %104 %102 %105
%106 = OpLoad %11 %61
%106 = OpLoad %12 %62
%98 = OpAccessChain %107 %100 %106
%96 = OpAccessChain %108 %98 %109
%110 = OpLoad %95 %96
%113 = OpLoad %16 %111
%94 = OpMatrixTimesVector %16 %110 %113
%92 = OpFunctionCall %3 %17 %93 %94
%116 = OpLoad %9 %114
%117 = OpExtInst %9 %1 Normalize %116
%113 = OpLoad %17 %111
%94 = OpMatrixTimesVector %17 %110 %113
%92 = OpFunctionCall %4 %18 %93 %94
%116 = OpLoad %10 %114
%117 = OpExtInst %10 %1 Normalize %116
%122 = OpAccessChain %123 %102 %124
%125 = OpLoad %11 %61
%125 = OpLoad %12 %62
%121 = OpAccessChain %126 %122 %125
%120 = OpAccessChain %127 %121 %128
%119 = OpAccessChain %129 %120 %130
%131 = OpLoad %3 %119
%131 = OpLoad %4 %119
%135 = OpAccessChain %136 %102 %137
%138 = OpLoad %11 %61
%138 = OpLoad %12 %62
%134 = OpAccessChain %139 %135 %138
%133 = OpAccessChain %140 %134 %141
%132 = OpAccessChain %142 %133 %143
%144 = OpLoad %3 %132
%144 = OpLoad %4 %132
%148 = OpAccessChain %149 %102 %150
%151 = OpLoad %11 %61
%151 = OpLoad %12 %62
%147 = OpAccessChain %152 %148 %151
%146 = OpAccessChain %153 %147 %154
%145 = OpAccessChain %155 %146 %156
%157 = OpLoad %3 %145
%158 = OpCompositeConstruct %9 %131 %144 %157
%157 = OpLoad %4 %145
%158 = OpCompositeConstruct %10 %131 %144 %157
%159 = OpAccessChain %160 %111 %161
%162 = OpLoad %3 %159
%162 = OpLoad %4 %159
%163 = OpAccessChain %164 %111 %165
%166 = OpLoad %3 %163
%166 = OpLoad %4 %163
%167 = OpAccessChain %168 %111 %169
%170 = OpLoad %3 %167
%171 = OpCompositeConstruct %9 %162 %166 %170
%118 = OpFSub %9 %158 %171
%172 = OpExtInst %9 %1 Normalize %118
%173 = OpDot %3 %117 %172
%174 = OpExtInst %3 %1 FMax %2 %173
%91 = OpFMul %3 %92 %174
%170 = OpLoad %4 %167
%171 = OpCompositeConstruct %10 %162 %166 %170
%118 = OpFSub %10 %158 %171
%172 = OpExtInst %10 %1 Normalize %118
%173 = OpDot %4 %117 %172
%174 = OpExtInst %4 %1 FMax %3 %173
%91 = OpFMul %4 %92 %174
%178 = OpAccessChain %179 %102 %180
%181 = OpLoad %11 %61
%181 = OpLoad %12 %62
%177 = OpAccessChain %182 %178 %181
%176 = OpAccessChain %183 %177 %184
%175 = OpAccessChain %185 %176 %186
%187 = OpLoad %3 %175
%187 = OpLoad %4 %175
%191 = OpAccessChain %192 %102 %193
%194 = OpLoad %11 %61
%194 = OpLoad %12 %62
%190 = OpAccessChain %195 %191 %194
%189 = OpAccessChain %196 %190 %197
%188 = OpAccessChain %198 %189 %199
%200 = OpLoad %3 %188
%200 = OpLoad %4 %188
%204 = OpAccessChain %205 %102 %206
%207 = OpLoad %11 %61
%207 = OpLoad %12 %62
%203 = OpAccessChain %208 %204 %207
%202 = OpAccessChain %209 %203 %210
%201 = OpAccessChain %211 %202 %212
%213 = OpLoad %3 %201
%214 = OpCompositeConstruct %9 %187 %200 %213
%90 = OpVectorTimesScalar %9 %214 %91
%88 = OpFAdd %9 %89 %90
OpStore %59 %88
%213 = OpLoad %4 %201
%214 = OpCompositeConstruct %10 %187 %200 %213
%90 = OpVectorTimesScalar %10 %214 %91
%88 = OpFAdd %10 %89 %90
OpStore %60 %88
OpBranch %70
%70 = OpLabel
%216 = OpLoad %11 %61
%215 = OpIAdd %11 %216 %13
OpStore %61 %215
%216 = OpLoad %12 %62
%215 = OpIAdd %12 %216 %14
OpStore %62 %215
OpBranch %67
%68 = OpLabel
%219 = OpLoad %9 %59
%220 = OpCompositeConstruct %16 %219 %4
%219 = OpLoad %10 %60
%220 = OpCompositeConstruct %17 %219 %5
OpStore %217 %220
OpReturn
OpFunctionEnd

View File

@@ -30,95 +30,95 @@ OpDecorate %174 Binding 1
OpDecorate %179 DescriptorSet 0
OpDecorate %179 Binding 2
OpDecorate %182 Location 0
%3 = OpTypeInt 32 1
%2 = OpConstant %3 2
%4 = OpConstant %3 1
%6 = OpTypeFloat 32
%5 = OpConstant %6 4.0
%7 = OpConstant %6 1.0
%8 = OpConstant %6 0.0
%10 = OpTypePointer Function %3
%13 = OpTypeVector %6 4
%14 = OpTypePointer Function %13
%15 = OpTypeVoid
%17 = OpTypeFunction %15
%0 = OpTypeVoid
%4 = OpTypeInt 32 1
%3 = OpConstant %4 2
%5 = OpConstant %4 1
%7 = OpTypeFloat 32
%6 = OpConstant %7 4.0
%8 = OpConstant %7 1.0
%9 = OpConstant %7 0.0
%11 = OpTypePointer Function %4
%14 = OpTypeVector %7 4
%15 = OpTypePointer Function %14
%17 = OpTypeFunction %0
%20 = OpTypeInt 32 0
%22 = OpTypePointer Input %20
%21 = OpVariable %22 Input
%29 = OpTypeMatrix %13 4
%29 = OpTypeMatrix %14 4
%31 = OpTypeStruct %29 %29
%33 = OpTypePointer Uniform %31
%32 = OpVariable %33 Uniform
%34 = OpTypePointer Uniform %29
%35 = OpConstant %3 0
%46 = OpTypeVector %6 3
%35 = OpConstant %4 0
%46 = OpTypeVector %7 3
%48 = OpTypePointer Output %46
%47 = OpVariable %48 Output
%50 = OpTypeMatrix %46 3
%54 = OpTypePointer Uniform %29
%55 = OpConstant %3 1
%56 = OpTypePointer Uniform %13
%57 = OpConstant %3 0
%58 = OpTypePointer Uniform %6
%59 = OpConstant %3 0
%55 = OpConstant %4 1
%56 = OpTypePointer Uniform %14
%57 = OpConstant %4 0
%58 = OpTypePointer Uniform %7
%59 = OpConstant %4 0
%64 = OpTypePointer Uniform %29
%65 = OpConstant %3 1
%66 = OpTypePointer Uniform %13
%67 = OpConstant %3 0
%68 = OpTypePointer Uniform %6
%69 = OpConstant %3 1
%65 = OpConstant %4 1
%66 = OpTypePointer Uniform %14
%67 = OpConstant %4 0
%68 = OpTypePointer Uniform %7
%69 = OpConstant %4 1
%74 = OpTypePointer Uniform %29
%75 = OpConstant %3 1
%76 = OpTypePointer Uniform %13
%77 = OpConstant %3 0
%78 = OpTypePointer Uniform %6
%79 = OpConstant %3 2
%75 = OpConstant %4 1
%76 = OpTypePointer Uniform %14
%77 = OpConstant %4 0
%78 = OpTypePointer Uniform %7
%79 = OpConstant %4 2
%85 = OpTypePointer Uniform %29
%86 = OpConstant %3 1
%87 = OpTypePointer Uniform %13
%88 = OpConstant %3 1
%89 = OpTypePointer Uniform %6
%90 = OpConstant %3 0
%86 = OpConstant %4 1
%87 = OpTypePointer Uniform %14
%88 = OpConstant %4 1
%89 = OpTypePointer Uniform %7
%90 = OpConstant %4 0
%95 = OpTypePointer Uniform %29
%96 = OpConstant %3 1
%97 = OpTypePointer Uniform %13
%98 = OpConstant %3 1
%99 = OpTypePointer Uniform %6
%100 = OpConstant %3 1
%96 = OpConstant %4 1
%97 = OpTypePointer Uniform %14
%98 = OpConstant %4 1
%99 = OpTypePointer Uniform %7
%100 = OpConstant %4 1
%105 = OpTypePointer Uniform %29
%106 = OpConstant %3 1
%107 = OpTypePointer Uniform %13
%108 = OpConstant %3 1
%109 = OpTypePointer Uniform %6
%110 = OpConstant %3 2
%106 = OpConstant %4 1
%107 = OpTypePointer Uniform %14
%108 = OpConstant %4 1
%109 = OpTypePointer Uniform %7
%110 = OpConstant %4 2
%116 = OpTypePointer Uniform %29
%117 = OpConstant %3 1
%118 = OpTypePointer Uniform %13
%119 = OpConstant %3 2
%120 = OpTypePointer Uniform %6
%121 = OpConstant %3 0
%117 = OpConstant %4 1
%118 = OpTypePointer Uniform %14
%119 = OpConstant %4 2
%120 = OpTypePointer Uniform %7
%121 = OpConstant %4 0
%126 = OpTypePointer Uniform %29
%127 = OpConstant %3 1
%128 = OpTypePointer Uniform %13
%129 = OpConstant %3 2
%130 = OpTypePointer Uniform %6
%131 = OpConstant %3 1
%127 = OpConstant %4 1
%128 = OpTypePointer Uniform %14
%129 = OpConstant %4 2
%130 = OpTypePointer Uniform %7
%131 = OpConstant %4 1
%136 = OpTypePointer Uniform %29
%137 = OpConstant %3 1
%138 = OpTypePointer Uniform %13
%139 = OpConstant %3 2
%140 = OpTypePointer Uniform %6
%141 = OpConstant %3 2
%147 = OpTypePointer Function %6
%148 = OpConstant %3 0
%151 = OpTypePointer Function %6
%152 = OpConstant %3 1
%155 = OpTypePointer Function %6
%156 = OpConstant %3 2
%160 = OpTypePointer Output %13
%137 = OpConstant %4 1
%138 = OpTypePointer Uniform %14
%139 = OpConstant %4 2
%140 = OpTypePointer Uniform %7
%141 = OpConstant %4 2
%147 = OpTypePointer Function %7
%148 = OpConstant %4 0
%151 = OpTypePointer Function %7
%152 = OpConstant %4 1
%155 = OpTypePointer Function %7
%156 = OpConstant %4 2
%160 = OpTypePointer Output %14
%159 = OpVariable %160 Output
%172 = OpVariable %160 Output
%173 = OpTypeImage %6 Cube 0 0 0 1 Unknown
%173 = OpTypeImage %7 Cube 0 0 0 1 Unknown
%175 = OpTypePointer UniformConstant %173
%174 = OpVariable %175 UniformConstant
%177 = OpTypeSampledImage %173
@@ -127,101 +127,101 @@ OpDecorate %182 Location 0
%179 = OpVariable %180 UniformConstant
%183 = OpTypePointer Input %46
%182 = OpVariable %183 Input
%16 = OpFunction %15 None %17
%16 = OpFunction %0 None %17
%18 = OpLabel
%9 = OpVariable %10 Function
%11 = OpVariable %10 Function
%12 = OpVariable %14 Function
%10 = OpVariable %11 Function
%12 = OpVariable %11 Function
%13 = OpVariable %15 Function
%23 = OpLoad %20 %21
%24 = OpBitcast %3 %23
%19 = OpSDiv %3 %24 %2
OpStore %9 %19
%24 = OpBitcast %4 %23
%19 = OpSDiv %4 %24 %3
OpStore %10 %19
%26 = OpLoad %20 %21
%27 = OpBitcast %3 %26
%25 = OpBitwiseAnd %3 %27 %4
OpStore %11 %25
%27 = OpBitcast %4 %26
%25 = OpBitwiseAnd %4 %27 %5
OpStore %12 %25
%30 = OpAccessChain %34 %32 %35
%36 = OpLoad %29 %30
%39 = OpLoad %3 %9
%40 = OpConvertSToF %6 %39
%38 = OpFMul %6 %40 %5
%37 = OpFSub %6 %38 %7
%43 = OpLoad %3 %11
%44 = OpConvertSToF %6 %43
%42 = OpFMul %6 %44 %5
%41 = OpFSub %6 %42 %7
%45 = OpCompositeConstruct %13 %37 %41 %8 %7
%28 = OpMatrixTimesVector %13 %36 %45
OpStore %12 %28
%39 = OpLoad %4 %10
%40 = OpConvertSToF %7 %39
%38 = OpFMul %7 %40 %6
%37 = OpFSub %7 %38 %8
%43 = OpLoad %4 %12
%44 = OpConvertSToF %7 %43
%42 = OpFMul %7 %44 %6
%41 = OpFSub %7 %42 %8
%45 = OpCompositeConstruct %14 %37 %41 %9 %8
%28 = OpMatrixTimesVector %14 %36 %45
OpStore %13 %28
%53 = OpAccessChain %54 %32 %55
%52 = OpAccessChain %56 %53 %57
%51 = OpAccessChain %58 %52 %59
%60 = OpLoad %6 %51
%60 = OpLoad %7 %51
%63 = OpAccessChain %64 %32 %65
%62 = OpAccessChain %66 %63 %67
%61 = OpAccessChain %68 %62 %69
%70 = OpLoad %6 %61
%70 = OpLoad %7 %61
%73 = OpAccessChain %74 %32 %75
%72 = OpAccessChain %76 %73 %77
%71 = OpAccessChain %78 %72 %79
%80 = OpLoad %6 %71
%80 = OpLoad %7 %71
%81 = OpCompositeConstruct %46 %60 %70 %80
%84 = OpAccessChain %85 %32 %86
%83 = OpAccessChain %87 %84 %88
%82 = OpAccessChain %89 %83 %90
%91 = OpLoad %6 %82
%91 = OpLoad %7 %82
%94 = OpAccessChain %95 %32 %96
%93 = OpAccessChain %97 %94 %98
%92 = OpAccessChain %99 %93 %100
%101 = OpLoad %6 %92
%101 = OpLoad %7 %92
%104 = OpAccessChain %105 %32 %106
%103 = OpAccessChain %107 %104 %108
%102 = OpAccessChain %109 %103 %110
%111 = OpLoad %6 %102
%111 = OpLoad %7 %102
%112 = OpCompositeConstruct %46 %91 %101 %111
%115 = OpAccessChain %116 %32 %117
%114 = OpAccessChain %118 %115 %119
%113 = OpAccessChain %120 %114 %121
%122 = OpLoad %6 %113
%122 = OpLoad %7 %113
%125 = OpAccessChain %126 %32 %127
%124 = OpAccessChain %128 %125 %129
%123 = OpAccessChain %130 %124 %131
%132 = OpLoad %6 %123
%132 = OpLoad %7 %123
%135 = OpAccessChain %136 %32 %137
%134 = OpAccessChain %138 %135 %139
%133 = OpAccessChain %140 %134 %141
%142 = OpLoad %6 %133
%142 = OpLoad %7 %133
%143 = OpCompositeConstruct %46 %122 %132 %142
%144 = OpCompositeConstruct %50 %81 %112 %143
%145 = OpTranspose %50 %144
%146 = OpAccessChain %147 %12 %148
%149 = OpLoad %6 %146
%150 = OpAccessChain %151 %12 %152
%153 = OpLoad %6 %150
%154 = OpAccessChain %155 %12 %156
%157 = OpLoad %6 %154
%146 = OpAccessChain %147 %13 %148
%149 = OpLoad %7 %146
%150 = OpAccessChain %151 %13 %152
%153 = OpLoad %7 %150
%154 = OpAccessChain %155 %13 %156
%157 = OpLoad %7 %154
%158 = OpCompositeConstruct %46 %149 %153 %157
%49 = OpMatrixTimesVector %46 %145 %158
OpStore %47 %49
%163 = OpLoad %3 %9
%164 = OpConvertSToF %6 %163
%162 = OpFMul %6 %164 %5
%161 = OpFSub %6 %162 %7
%167 = OpLoad %3 %11
%168 = OpConvertSToF %6 %167
%166 = OpFMul %6 %168 %5
%165 = OpFSub %6 %166 %7
%169 = OpCompositeConstruct %13 %161 %165 %8 %7
%163 = OpLoad %4 %10
%164 = OpConvertSToF %7 %163
%162 = OpFMul %7 %164 %6
%161 = OpFSub %7 %162 %8
%167 = OpLoad %4 %12
%168 = OpConvertSToF %7 %167
%166 = OpFMul %7 %168 %6
%165 = OpFSub %7 %166 %8
%169 = OpCompositeConstruct %14 %161 %165 %9 %8
OpStore %159 %169
OpReturn
OpFunctionEnd
%170 = OpFunction %15 None %17
%170 = OpFunction %0 None %17
%171 = OpLabel
%176 = OpLoad %173 %174
%181 = OpLoad %178 %179
%184 = OpLoad %46 %182
%185 = OpSampledImage %177 %176 %181
%186 = OpImageSampleImplicitLod %13 %185 %184
%186 = OpImageSampleImplicitLod %14 %185 %184
OpStore %172 %186
OpReturn
OpFunctionEnd