mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-22 07:21:04 +01:00
18 lines
406 B
Plaintext
18 lines
406 B
Plaintext
#include <metal_stdlib>
|
|
#include <simd/simd.h>
|
|
|
|
|
|
struct derivativesInput {
|
|
};
|
|
struct derivativesOutput {
|
|
metal::float4 member [[color(0)]];
|
|
};
|
|
fragment derivativesOutput derivatives(
|
|
metal::float4 foo [[position]]
|
|
) {
|
|
metal::float4 _e1 = metal::dfdx(foo);
|
|
metal::float4 _e2 = metal::dfdy(foo);
|
|
metal::float4 _e3 = metal::fwidth(foo);
|
|
return derivativesOutput { (_e1 + _e2) * _e3 };
|
|
}
|