#version 310 es
precision mediump float;

layout(r32i) uniform highp writeonly iimage2D arg_0_1;
void textureDimensions_c30e75() {
  ivec2 res = imageSize(arg_0_1);
}

vec4 vertex_main() {
  textureDimensions_c30e75();
  return vec4(0.0f, 0.0f, 0.0f, 0.0f);
}

void main() {
  vec4 inner_result = vertex_main();
  gl_Position = inner_result;
  gl_Position.y = -(gl_Position.y);
  gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
  return;
}
#version 310 es
precision mediump float;

layout(r32i) uniform highp writeonly iimage2D arg_0_1;
void textureDimensions_c30e75() {
  ivec2 res = imageSize(arg_0_1);
}

void fragment_main() {
  textureDimensions_c30e75();
}

void main() {
  fragment_main();
  return;
}
#version 310 es
precision mediump float;

layout(r32i) uniform highp writeonly iimage2D arg_0_1;
void textureDimensions_c30e75() {
  ivec2 res = imageSize(arg_0_1);
}

void compute_main() {
  textureDimensions_c30e75();
}

layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
  compute_main();
  return;
}
