// services/viz/privileged/mojom/compositing/renderer_settings.mojom-shared.h is auto generated by mojom_bindings_generator.py, do not edit

// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef SERVICES_VIZ_PRIVILEGED_MOJOM_COMPOSITING_RENDERER_SETTINGS_MOJOM_SHARED_H_
#define SERVICES_VIZ_PRIVILEGED_MOJOM_COMPOSITING_RENDERER_SETTINGS_MOJOM_SHARED_H_

#include <stdint.h>

#include <functional>
#include <iosfwd>
#include <type_traits>
#include <utility>
#include "mojo/public/cpp/bindings/array_data_view.h"
#include "mojo/public/cpp/bindings/map_data_view.h"
#include "mojo/public/cpp/bindings/string_data_view.h"
#include "mojo/public/cpp/system/message_pipe.h"

#include "third_party/perfetto/include/perfetto/tracing/traced_value_forward.h"

#include "services/viz/privileged/mojom/compositing/renderer_settings.mojom-shared-internal.h"
#include "services/viz/privileged/mojom/compositing/overlay_strategy.mojom-shared.h"
#include "ui/gfx/geometry/mojom/geometry.mojom-shared.h"
#include "ui/gfx/mojom/color_space.mojom-shared.h"




#include "services/viz/privileged/mojom/compositing/renderer_settings.mojom-data-view.h"  // IWYU pragma: export




namespace std {

}  // namespace std

namespace mojo {


namespace internal {

template <typename MaybeConstUserType>
struct Serializer<::viz::mojom::OcclusionCullerSettingsDataView, MaybeConstUserType> {
  using UserType = typename std::remove_const<MaybeConstUserType>::type;
  using Traits = StructTraits<::viz::mojom::OcclusionCullerSettingsDataView, UserType>;

  static void Serialize(
      MaybeConstUserType& input,
      mojo::internal::MessageFragment<::viz::mojom::internal::OcclusionCullerSettings_Data>& fragment) {
    if (CallIsNullIfExists<Traits>(input))
      return;
    fragment.Allocate();

    fragment->quad_split_limit = Traits::quad_split_limit(input);

    fragment->maximum_occluder_complexity = Traits::maximum_occluder_complexity(input);

    fragment->minimum_fragments_reduced = Traits::minimum_fragments_reduced(input);

    fragment->generate_complex_occluder_for_rounded_corners = Traits::generate_complex_occluder_for_rounded_corners(input);
  }

  static bool Deserialize(::viz::mojom::internal::OcclusionCullerSettings_Data* input,
                          UserType* output,
                          Message* message) {
    if (!input)
      return CallSetToNullIfExists<Traits>(output);

    ::viz::mojom::OcclusionCullerSettingsDataView data_view(input, message);
    return CallTraitsRead<Traits>(data_view, output);
  }
};

}  // namespace internal


namespace internal {

template <typename MaybeConstUserType>
struct Serializer<::viz::mojom::RendererSettingsDataView, MaybeConstUserType> {
  using UserType = typename std::remove_const<MaybeConstUserType>::type;
  using Traits = StructTraits<::viz::mojom::RendererSettingsDataView, UserType>;

  static void Serialize(
      MaybeConstUserType& input,
      mojo::internal::MessageFragment<::viz::mojom::internal::RendererSettings_Data>& fragment) {
    if (CallIsNullIfExists<Traits>(input))
      return;
    fragment.Allocate();

    fragment->allow_antialiasing = Traits::allow_antialiasing(input);

    fragment->force_antialiasing = Traits::force_antialiasing(input);

    fragment->force_blending_with_shaders = Traits::force_blending_with_shaders(input);

    fragment->highp_threshold_min = Traits::highp_threshold_min(input);

    fragment->partial_swap_enabled = Traits::partial_swap_enabled(input);

    fragment->release_overlay_resources_after_gpu_query = Traits::release_overlay_resources_after_gpu_query(input);

    fragment->should_clear_root_render_pass = Traits::should_clear_root_render_pass(input);

    fragment->slow_down_compositing_scale_factor = Traits::slow_down_compositing_scale_factor(input);

    fragment->auto_resize_output_surface = Traits::auto_resize_output_surface(input);

    fragment->requires_alpha_channel = Traits::requires_alpha_channel(input);

    decltype(Traits::occlusion_culler_settings(input)) in_occlusion_culler_settings = Traits::occlusion_culler_settings(input);
    mojo::internal::MessageFragment<
        typename decltype(fragment->occlusion_culler_settings)::BaseType> occlusion_culler_settings_fragment(
            fragment.message());
    
    mojo::internal::Serialize<::viz::mojom::OcclusionCullerSettingsDataView>(
      in_occlusion_culler_settings,
      occlusion_culler_settings_fragment);

    fragment->occlusion_culler_settings.Set(
        occlusion_culler_settings_fragment.is_null() ? nullptr : occlusion_culler_settings_fragment.data());

    
    MOJO_INTERNAL_CHECK_SERIALIZATION(
      mojo::internal::SendValidation::kDefault,
      !(fragment->occlusion_culler_settings.is_null()),
      mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER,
      "null occlusion_culler_settings in RendererSettings struct");
  }

  static bool Deserialize(::viz::mojom::internal::RendererSettings_Data* input,
                          UserType* output,
                          Message* message) {
    if (!input)
      return CallSetToNullIfExists<Traits>(output);

    ::viz::mojom::RendererSettingsDataView data_view(input, message);
    return CallTraitsRead<Traits>(data_view, output);
  }
};

}  // namespace internal


namespace internal {

template <typename MaybeConstUserType>
struct Serializer<::viz::mojom::DebugRendererSettingsDataView, MaybeConstUserType> {
  using UserType = typename std::remove_const<MaybeConstUserType>::type;
  using Traits = StructTraits<::viz::mojom::DebugRendererSettingsDataView, UserType>;

  static void Serialize(
      MaybeConstUserType& input,
      mojo::internal::MessageFragment<::viz::mojom::internal::DebugRendererSettings_Data>& fragment) {
    if (CallIsNullIfExists<Traits>(input))
      return;
    fragment.Allocate();

    fragment->tint_composited_content = Traits::tint_composited_content(input);

    fragment->tint_composited_content_modulate = Traits::tint_composited_content_modulate(input);

    fragment->show_overdraw_feedback = Traits::show_overdraw_feedback(input);

    fragment->show_dc_layer_debug_borders = Traits::show_dc_layer_debug_borders(input);

    fragment->show_aggregated_damage = Traits::show_aggregated_damage(input);
  }

  static bool Deserialize(::viz::mojom::internal::DebugRendererSettings_Data* input,
                          UserType* output,
                          Message* message) {
    if (!input)
      return CallSetToNullIfExists<Traits>(output);

    ::viz::mojom::DebugRendererSettingsDataView data_view(input, message);
    return CallTraitsRead<Traits>(data_view, output);
  }
};

}  // namespace internal

}  // namespace mojo


namespace viz::mojom {



inline void RendererSettingsDataView::GetOcclusionCullerSettingsDataView(
    OcclusionCullerSettingsDataView* output) {
  auto pointer = data_->occlusion_culler_settings.Get();
  *output = OcclusionCullerSettingsDataView(pointer, message_);
}





}  // viz::mojom

// Declare TraceFormatTraits for enums, which should be defined in ::perfetto
// namespace.

#endif  // SERVICES_VIZ_PRIVILEGED_MOJOM_COMPOSITING_RENDERER_SETTINGS_MOJOM_SHARED_H_