da5cdf6a70
This allows interface blocks in Metal to compile even if `layout(binding=...)` is not specified. It will also be used in SPIR-V in the followup CL, when an interface block is automatically synthesized for top-level uniforms. This CL also reorganizes the unit tests around uniforms a bit. Change-Id: Ia898c536b454dda6f51677e232a8f6e6c3606022 Bug: skia:11225 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/360778 Commit-Queue: John Stiles <johnstiles@google.com> Reviewed-by: Brian Osman <brianosman@google.com> Auto-Submit: John Stiles <johnstiles@google.com>
21 lines
492 B
Metal
21 lines
492 B
Metal
#include <metal_stdlib>
|
|
#include <simd/simd.h>
|
|
using namespace metal;
|
|
struct Uniforms {
|
|
float myHalf;
|
|
float4 myHalf4;
|
|
};
|
|
struct Inputs {
|
|
};
|
|
struct Outputs {
|
|
float4 sk_FragColor [[color(0)]];
|
|
};
|
|
|
|
|
|
fragment Outputs fragmentMain(Inputs _in [[stage_in]], constant Uniforms& _uniforms [[buffer(0)]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) {
|
|
Outputs _out;
|
|
(void)_out;
|
|
_out.sk_FragColor = _uniforms.myHalf4 * _uniforms.myHalf;
|
|
return _out;
|
|
}
|