message: Added support of OpenGL ES 3.0 api in TensorLinearDescriptor.
diff: @@ -36,8 +36,16 @@ GPUResources TensorLinearDescriptor::GetGPUResources(
  desc.access_type = access_type_;
  desc.element_size = 4;
  desc.memory_type = memory_type;
  + if (gpu_info.IsApiOpenGl() && gpu_info.opengl_info.major_version == 3 &&
  + gpu_info.opengl_info.minor_version == 0) {
  + desc.memory_type = tflite::gpu::MemoryType::CONSTANT;
  + desc.attributes.push_back(std::to_string(size));
  + }
  resources.buffers.push_back({"buffer", desc});
  } else {
  + if (gpu_info.IsApiOpenGl() && gpu_info.opengl_info.major_version < 3) {
  + resources.floats.push_back("inv_tex_width");
  + }
  GPUImage2DDescriptor desc;
  desc.data_type = element_type;
  desc.normalized = false;
  @@ -61,8 +69,13 @@ absl::Status TensorLinearDescriptor::PerformSelector(
  return absl::InvalidArgumentError(
  "GetPtr selector supported for LinearStorageType::BUFFER only.");
  }
  + if (gpu_info.IsApiMetal() || gpu_info.IsApiOpenCl()) {
  *result = "buffer";
  return absl::OkStatus();
  + } else {
  + return absl::InvalidArgumentError(
  + "GetPtr selector supported only in Metal and OpenCL.");
  + }
  } else {
  return absl::NotFoundError(absl::StrCat(
  "TensorLinearDescriptor don't have selector with name - ", selector));
  @@ -90,6 +103,27 @@ absl::Status TensorLinearDescriptor::PerformReadSelector(
  *result =
  absl::StrCat(read, "(tex2d, smp_none, (int2)(", args[0], ", 0))");
  return absl::OkStatus();
  + } else if (gpu_info.IsApiOpenGl()) {
  + if (storage_type == LinearStorageType::BUFFER) {
  + if (element_type == DataType::FLOAT16) {
  + *result = absl::StrCat(
  + "vec4(unpackHalf2x16(buffer[", args[0], " / 2][", args[0],
  + " % 2 == 0 ? 0 : 2]), unpackHalf2x16(buffer[", args[0], " / 2][",
  + args[0], " % 2 == 0 ? 1 : 3]))");
  + } else {
  + *result = absl::StrCat("buffer[", args[0], "]");
  + }
  + return absl::OkStatus();
  + } else {
  + if (gpu_info.opengl_info.major_version < 3) {
  + *result = absl::StrCat("texture2D(tex2d, vec2(float(", args[0],
  + ") * inv_tex_width, 0.0))");
  + return absl::OkStatus();
  + } else {
  + *result = "texelFetch(tex2d, ivec2(" + args[0] + ", 0), 0)";
  + return absl::OkStatus();
  + }
  + }
  } else {
  return absl::UnimplementedError(
  "No implementation of TensorLinear.Read for this API.");
  