RIP to Float16, it's sad that Intel doesn't support you.

This commit is contained in:
Alex Zenla
2024-09-01 19:27:39 -04:00
committed by a dinosaur
parent b1f2f645f6
commit 4209a925c4
8 changed files with 35 additions and 40 deletions

View File

@ -10,12 +10,7 @@
#include <simd/simd.h>
// HACK: allow passing SIMD4<Float16> to shader while `simd_half4` is beta
#ifdef __METAL_VERSION__
typedef half4 color_half4;
#else
typedef simd_ushort4 color_half4;
#endif
typedef simd_float4 color_float4;
typedef NS_ENUM(NSInteger, VertexShaderInputIdx) {
VertexShaderInputIdxVertices = 0,
@ -26,14 +21,14 @@ typedef NS_ENUM(NSInteger, VertexShaderInputIdx) {
typedef struct {
vector_float3 position;
vector_float3 normal;
color_half4 color;
color_float4 color;
vector_float2 texCoord;
} ShaderVertex;
typedef struct {
matrix_float4x4 model;
matrix_float4x4 normalModel;
color_half4 color;
color_float4 color;
} VertexShaderInstance;
typedef struct {
@ -46,7 +41,7 @@ typedef NS_ENUM(NSInteger, FragmentShaderInputIdx) {
typedef struct {
vector_float3 cameraPosition, directionalLight;
color_half4 ambientColor, diffuseColor, specularColor;
color_float4 ambientColor, diffuseColor, specularColor;
float specularIntensity;
} FragmentShaderUniforms;