forked from KhronosGroup/SPIRV-Cross
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement packHalf2x16/unpackHalf2x16 on MSL.
- Loading branch information
1 parent
ae2680c
commit 4979d10
Showing
5 changed files
with
75 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#include <metal_stdlib> | ||
#include <simd/simd.h> | ||
|
||
using namespace metal; | ||
|
||
struct main0_in | ||
{ | ||
float2 FP32 [[user(locn1)]]; | ||
uint FP16 [[user(locn0)]]; | ||
}; | ||
|
||
struct main0_out | ||
{ | ||
float2 FP32Out [[color(0)]]; | ||
uint FP16Out [[color(1)]]; | ||
}; | ||
|
||
fragment main0_out main0(main0_in in [[stage_in]]) | ||
{ | ||
main0_out out = {}; | ||
out.FP32Out = float2(as_type<half2>(in.FP16)); | ||
out.FP16Out = as_type<uint>(half2(in.FP32)); | ||
return out; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#include <metal_stdlib> | ||
#include <simd/simd.h> | ||
|
||
using namespace metal; | ||
|
||
struct main0_in | ||
{ | ||
float2 FP32 [[user(locn1)]]; | ||
uint FP16 [[user(locn0)]]; | ||
}; | ||
|
||
struct main0_out | ||
{ | ||
float2 FP32Out [[color(0)]]; | ||
uint FP16Out [[color(1)]]; | ||
}; | ||
|
||
fragment main0_out main0(main0_in in [[stage_in]]) | ||
{ | ||
main0_out out = {}; | ||
out.FP32Out = float2(as_type<half2>(in.FP16)); | ||
out.FP16Out = as_type<uint>(half2(in.FP32)); | ||
return out; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#version 450 | ||
|
||
layout(location = 0) flat in uint FP16; | ||
layout(location = 1) flat in vec2 FP32; | ||
layout(location = 0) out vec2 FP32Out; | ||
layout(location = 1) out uint FP16Out; | ||
|
||
void main() | ||
{ | ||
FP32Out = unpackHalf2x16(FP16); | ||
FP16Out = packHalf2x16(FP32); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters