/*
 * Copyright (C) 2023 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
syntax = "proto2";

package gfxstream.proto;

message EglAvailability {
  optional string vendor = 1;
  optional string version = 2;
  optional string extensions = 3;
  optional string client_extensions = 4;

  message GlesContextAvailability {
    optional string vendor = 1;
    optional string version = 2;
    optional string renderer = 3;
    optional string extensions = 4;
  }

  // Loading GLES functions via EGL's eglGetProcAddress().
  optional GlesContextAvailability gles2_availability = 5;
  optional GlesContextAvailability gles3_availability = 6;

  // Loading GLES functions via GLESv2 library directly.
  optional GlesContextAvailability gles2_direct_availability = 7;
  optional GlesContextAvailability gles3_direct_availability = 8;

  repeated string errors = 9;
}

message VulkanExternalMemoryHostQuirks {
  repeated string errors = 1;
  optional bool can_import_shm = 2;
}

message VulkanQuirks {
  // See b/264575911.
  optional bool has_issue_with_precision_qualifiers_on_yuv_samplers = 1;

  optional VulkanExternalMemoryHostQuirks external_memory_host_quirks = 2;
}

message VulkanPhysicalDevice {
  optional string name = 1;
  repeated string extensions = 2;
  enum Type {
    TYPE_OTHER = 0;
    TYPE_DISCRETE_GPU = 1;
  }
  optional Type type = 3;

  optional VulkanQuirks quirks = 4;
}

message VulkanAvailability {
  repeated string instance_extensions = 1;

  repeated VulkanPhysicalDevice physical_devices = 2;
}

message GraphicsAvailability {
  optional EglAvailability egl = 1;
  optional VulkanAvailability vulkan = 2;

  repeated string errors = 3;
}
