adding functions management
This commit is contained in:
@@ -7,15 +7,15 @@ struct FragOut
|
||||
[location(0)] color: vec4[f32]
|
||||
}
|
||||
|
||||
fn computeColor() -> f32
|
||||
fn computeColor(val: f32) -> f32
|
||||
{
|
||||
return 1.0;
|
||||
return 2.0 * val;
|
||||
}
|
||||
|
||||
[entry(frag)]
|
||||
fn main() -> FragOut
|
||||
{
|
||||
let output: FragOut;
|
||||
output.color = vec4[f32](computeColor(), computeColor(), computeColor(), computeColor());
|
||||
output.color = vec4[f32](computeColor(1.0), computeColor(2.0), computeColor(3.0), computeColor(4.0));
|
||||
return output;
|
||||
}
|
||||
|
||||
Binary file not shown.
@@ -1,50 +1,65 @@
|
||||
Version 1.0
|
||||
Generator: 2560130
|
||||
Bound: 27
|
||||
Bound: 38
|
||||
Schema: 0
|
||||
OpCapability Capability(Shader)
|
||||
OpCapability Capability(Float64)
|
||||
OpMemoryModel AddressingModel(Logical) MemoryModel(GLSL450)
|
||||
OpEntryPoint ExecutionModel(Fragment) %14 "main" %8
|
||||
OpExecutionMode %14 ExecutionMode(OriginUpperLeft)
|
||||
OpEntryPoint ExecutionModel(Fragment) %18 "main" %9
|
||||
OpExecutionMode %18 ExecutionMode(OriginUpperLeft)
|
||||
OpSource SourceLanguage(NZSL) 4198400
|
||||
OpSourceExtension "Version: 1.1"
|
||||
OpName %9 "FragOut"
|
||||
OpMemberName %9 0 "color"
|
||||
OpName %8 "color"
|
||||
OpName %13 "computeColor"
|
||||
OpName %14 "main"
|
||||
OpDecorate %8 Decoration(Location) 0
|
||||
OpMemberDecorate %9 0 Decoration(Offset) 0
|
||||
OpName %10 "FragOut"
|
||||
OpMemberName %10 0 "color"
|
||||
OpName %9 "color"
|
||||
OpName %17 "computeColor"
|
||||
OpName %18 "main"
|
||||
OpDecorate %9 Decoration(Location) 0
|
||||
OpMemberDecorate %10 0 Decoration(Offset) 0
|
||||
%1 = OpTypeFloat 32
|
||||
%2 = OpTypeFunction %1
|
||||
%3 = OpConstant %1 f32(1)
|
||||
%4 = OpTypeVoid
|
||||
%5 = OpTypeFunction %4
|
||||
%6 = OpTypeVector %1 4
|
||||
%7 = OpTypePointer StorageClass(Output) %6
|
||||
%9 = OpTypeStruct %6
|
||||
%10 = OpTypePointer StorageClass(Function) %9
|
||||
%11 = OpTypeInt 32 1
|
||||
%12 = OpConstant %11 i32(0)
|
||||
%24 = OpTypePointer StorageClass(Function) %6
|
||||
%8 = OpVariable %7 StorageClass(Output)
|
||||
%13 = OpFunction %1 FunctionControl(0) %2
|
||||
%15 = OpLabel
|
||||
OpReturnValue %3
|
||||
%2 = OpTypePointer StorageClass(Function) %1
|
||||
%3 = OpTypeFunction %1 %2
|
||||
%4 = OpConstant %1 f32(2)
|
||||
%5 = OpTypeVoid
|
||||
%6 = OpTypeFunction %5
|
||||
%7 = OpTypeVector %1 4
|
||||
%8 = OpTypePointer StorageClass(Output) %7
|
||||
%10 = OpTypeStruct %7
|
||||
%11 = OpTypePointer StorageClass(Function) %10
|
||||
%12 = OpTypeInt 32 1
|
||||
%13 = OpConstant %12 i32(0)
|
||||
%14 = OpConstant %1 f32(1)
|
||||
%15 = OpConstant %1 f32(3)
|
||||
%16 = OpConstant %1 f32(4)
|
||||
%35 = OpTypePointer StorageClass(Function) %7
|
||||
%9 = OpVariable %8 StorageClass(Output)
|
||||
%17 = OpFunction %1 FunctionControl(0) %3
|
||||
%19 = OpFunctionParameter %2
|
||||
%20 = OpLabel
|
||||
%21 = OpLoad %1 %19
|
||||
%22 = OpFMul %1 %4 %21
|
||||
OpReturnValue %22
|
||||
OpFunctionEnd
|
||||
%14 = OpFunction %4 FunctionControl(0) %5
|
||||
%16 = OpLabel
|
||||
%17 = OpVariable %10 StorageClass(Function)
|
||||
%18 = OpFunctionCall %1 %13
|
||||
%19 = OpFunctionCall %1 %13
|
||||
%20 = OpFunctionCall %1 %13
|
||||
%21 = OpFunctionCall %1 %13
|
||||
%22 = OpCompositeConstruct %6 %18 %19 %20 %21
|
||||
%23 = OpAccessChain %24 %17 %12
|
||||
OpStore %23 %22
|
||||
%25 = OpLoad %9 %17
|
||||
%26 = OpCompositeExtract %6 %25 0
|
||||
OpStore %8 %26
|
||||
%18 = OpFunction %5 FunctionControl(0) %6
|
||||
%23 = OpLabel
|
||||
%24 = OpVariable %11 StorageClass(Function)
|
||||
%25 = OpVariable %2 StorageClass(Function)
|
||||
%26 = OpVariable %2 StorageClass(Function)
|
||||
%27 = OpVariable %2 StorageClass(Function)
|
||||
%28 = OpVariable %2 StorageClass(Function)
|
||||
OpStore %25 %14
|
||||
%29 = OpFunctionCall %1 %17 %25
|
||||
OpStore %26 %4
|
||||
%30 = OpFunctionCall %1 %17 %26
|
||||
OpStore %27 %15
|
||||
%31 = OpFunctionCall %1 %17 %27
|
||||
OpStore %28 %16
|
||||
%32 = OpFunctionCall %1 %17 %28
|
||||
%33 = OpCompositeConstruct %7 %29 %30 %31 %32
|
||||
%34 = OpAccessChain %35 %24 %13
|
||||
OpStore %34 %33
|
||||
%36 = OpLoad %10 %24
|
||||
%37 = OpCompositeExtract %7 %36 0
|
||||
OpStore %9 %37
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
|
||||
Reference in New Issue
Block a user