mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-20 14:31:08 +01:00
18 lines
394 B
Plaintext
18 lines
394 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 x = metal::dfdx(foo);
|
|
metal::float4 y = metal::dfdy(foo);
|
|
metal::float4 z = metal::fwidth(foo);
|
|
return derivativesOutput { (x + y) * z };
|
|
}
|