blob: e2287b6add865c99f2e77492c30e432772dae234 [file] [log] [blame]
SKIP: FAILED
#include <metal_stdlib>
using namespace metal;
struct VertexOutputs {
float2 texcoords;
float4 position;
};
struct Uniforms {
float2 u_scale;
float2 u_offset;
};
struct tint_module_vars_struct {
const constant Uniforms* uniforms;
sampler mySampler;
texture2d<float, access::sample> myTexture;
thread bool* continue_execution;
};
template<typename T, size_t N>
struct tint_array {
const constant T& operator[](size_t i) const constant { return elements[i]; }
device T& operator[](size_t i) device { return elements[i]; }
const device T& operator[](size_t i) const device { return elements[i]; }
thread T& operator[](size_t i) thread { return elements[i]; }
const thread T& operator[](size_t i) const thread { return elements[i]; }
threadgroup T& operator[](size_t i) threadgroup { return elements[i]; }
const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; }
T elements[N];
};
struct vs_main_outputs {
float2 VertexOutputs_texcoords [[user(locn0)]];
float4 VertexOutputs_position [[position]];
};
struct fs_main_outputs {
float4 tint_symbol [[color(0)]];
};
struct fs_main_inputs {
float2 texcoord [[user(locn0)]];
};
VertexOutputs vs_main_inner(uint VertexIndex, tint_module_vars_struct tint_module_vars) {
tint_array<float2, 3> texcoord = tint_array<float2, 3>{float2(-0.5f, 0.0f), float2(1.5f, 0.0f), float2(0.5f, 2.0f)};
VertexOutputs output = {};
output.position = float4(((texcoord[VertexIndex] * 2.0f) - float2(1.0f)), 0.0f, 1.0f);
bool flipY = ((*tint_module_vars.uniforms).u_scale[1u] < 0.0f);
if (flipY) {
output.texcoords = ((((texcoord[VertexIndex] * (*tint_module_vars.uniforms).u_scale) + (*tint_module_vars.uniforms).u_offset) * float2(1.0f, -1.0f)) + float2(0.0f, 1.0f));
} else {
output.texcoords = ((((texcoord[VertexIndex] * float2(1.0f, -1.0f)) + float2(0.0f, 1.0f)) * (*tint_module_vars.uniforms).u_scale) + (*tint_module_vars.uniforms).u_offset);
}
return output;
}
float4 fs_main_inner(float2 texcoord, tint_module_vars_struct tint_module_vars) {
float2 clampedTexcoord = clamp(texcoord, float2(0.0f), float2(1.0f));
if (!(all((clampedTexcoord == texcoord)))) {
(*tint_module_vars.continue_execution) = false;
}
float4 srcColor = float4(0.0f);
if (!((*tint_module_vars.continue_execution))) {
discard_fragment();
}
return srcColor;
}
vertex vs_main_outputs vs_main(uint VertexIndex [[vertex_id]], const constant Uniforms* uniforms [[buffer(0)]]) {
tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.uniforms=uniforms};
VertexOutputs const v = vs_main_inner(VertexIndex, tint_module_vars);
return vs_main_outputs{.VertexOutputs_texcoords=v.texcoords, .VertexOutputs_position=v.position};
}
fragment fs_main_outputs fs_main(fs_main_inputs inputs [[stage_in]]) {
thread bool continue_execution = true;
tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.continue_execution=(&continue_execution)};
return fs_main_outputs{.tint_symbol=fs_main_inner(inputs.texcoord, tint_module_vars)};
}
program_source:64:94: error: call to deleted constructor of 'texture2d<float, access::sample>'
tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.uniforms=uniforms};
^
/System/Library/PrivateFrameworks/GPUCompiler.framework/Versions/32023/Libraries/lib/clang/32023.194/include/metal/metal_texture:6083:3: note: 'texture2d' has been explicitly marked deleted here
texture2d() thread = delete;
^
program_source:14:36: note: in implicit initialization of field 'myTexture' with omitted initializer
texture2d<float, access::sample> myTexture;
^
program_source:70:117: error: call to deleted constructor of 'texture2d<float, access::sample>'
tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.continue_execution=(&continue_execution)};
^
/System/Library/PrivateFrameworks/GPUCompiler.framework/Versions/32023/Libraries/lib/clang/32023.194/include/metal/metal_texture:6083:3: note: 'texture2d' has been explicitly marked deleted here
texture2d() thread = delete;
^
program_source:14:36: note: in implicit initialization of field 'myTexture' with omitted initializer
texture2d<float, access::sample> myTexture;
^