1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39
   40
   41
   42
   43
   44
   45
   46
   47
   48
   49
   50
   51
   52
   53
   54
   55
   56
   57
   58
   59
   60
   61
   62
   63
   64
   65
   66
   67
   68
   69
   70
   71
   72
   73
   74
   75
   76
   77
   78
   79
   80
   81
   82
   83
   84
   85
   86
   87
   88
   89
   90
   91
   92
   93
   94
   95
   96
   97
   98
   99
  100
  101
  102
  103
  104
  105
  106
  107
  108
  109
  110
  111
  112
  113
  114
  115
  116
  117
  118
  119
  120
  121
  122
  123
  124
  125
  126
  127
  128
  129
  130
  131
  132
  133
  134
  135
  136
  137
  138
  139
  140
  141
  142

gpu / command_buffer / client / client_context_state_impl_autogen.h [blame]

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

// This file is auto-generated from
// gpu/command_buffer/build_gles2_cmd_buffer.py
// It's formatted by clang-format using chromium coding style:
//    clang-format -i -style=chromium filename
// DO NOT EDIT!

// It is included by client_context_state.cc
#ifndef GPU_COMMAND_BUFFER_CLIENT_CLIENT_CONTEXT_STATE_IMPL_AUTOGEN_H_
#define GPU_COMMAND_BUFFER_CLIENT_CLIENT_CONTEXT_STATE_IMPL_AUTOGEN_H_

ClientContextState::EnableFlags::EnableFlags()
    : blend(false),
      cull_face(false),
      depth_test(false),
      dither(true),
      polygon_offset_fill(false),
      sample_alpha_to_coverage(false),
      sample_coverage(false),
      scissor_test(false),
      stencil_test(false),
      rasterizer_discard(false),
      primitive_restart_fixed_index(false) {}

bool ClientContextState::SetCapabilityState(GLenum cap,
                                            bool enabled,
                                            bool* changed) {
  *changed = false;
  switch (cap) {
    case GL_BLEND:
      if (enable_flags.blend != enabled) {
        *changed = true;
        enable_flags.blend = enabled;
      }
      return true;
    case GL_CULL_FACE:
      if (enable_flags.cull_face != enabled) {
        *changed = true;
        enable_flags.cull_face = enabled;
      }
      return true;
    case GL_DEPTH_TEST:
      if (enable_flags.depth_test != enabled) {
        *changed = true;
        enable_flags.depth_test = enabled;
      }
      return true;
    case GL_DITHER:
      if (enable_flags.dither != enabled) {
        *changed = true;
        enable_flags.dither = enabled;
      }
      return true;
    case GL_POLYGON_OFFSET_FILL:
      if (enable_flags.polygon_offset_fill != enabled) {
        *changed = true;
        enable_flags.polygon_offset_fill = enabled;
      }
      return true;
    case GL_SAMPLE_ALPHA_TO_COVERAGE:
      if (enable_flags.sample_alpha_to_coverage != enabled) {
        *changed = true;
        enable_flags.sample_alpha_to_coverage = enabled;
      }
      return true;
    case GL_SAMPLE_COVERAGE:
      if (enable_flags.sample_coverage != enabled) {
        *changed = true;
        enable_flags.sample_coverage = enabled;
      }
      return true;
    case GL_SCISSOR_TEST:
      if (enable_flags.scissor_test != enabled) {
        *changed = true;
        enable_flags.scissor_test = enabled;
      }
      return true;
    case GL_STENCIL_TEST:
      if (enable_flags.stencil_test != enabled) {
        *changed = true;
        enable_flags.stencil_test = enabled;
      }
      return true;
    case GL_RASTERIZER_DISCARD:
      if (enable_flags.rasterizer_discard != enabled) {
        *changed = true;
        enable_flags.rasterizer_discard = enabled;
      }
      return true;
    case GL_PRIMITIVE_RESTART_FIXED_INDEX:
      if (enable_flags.primitive_restart_fixed_index != enabled) {
        *changed = true;
        enable_flags.primitive_restart_fixed_index = enabled;
      }
      return true;
    default:
      return false;
  }
}
bool ClientContextState::GetEnabled(GLenum cap, bool* enabled) const {
  switch (cap) {
    case GL_BLEND:
      *enabled = enable_flags.blend;
      return true;
    case GL_CULL_FACE:
      *enabled = enable_flags.cull_face;
      return true;
    case GL_DEPTH_TEST:
      *enabled = enable_flags.depth_test;
      return true;
    case GL_DITHER:
      *enabled = enable_flags.dither;
      return true;
    case GL_POLYGON_OFFSET_FILL:
      *enabled = enable_flags.polygon_offset_fill;
      return true;
    case GL_SAMPLE_ALPHA_TO_COVERAGE:
      *enabled = enable_flags.sample_alpha_to_coverage;
      return true;
    case GL_SAMPLE_COVERAGE:
      *enabled = enable_flags.sample_coverage;
      return true;
    case GL_SCISSOR_TEST:
      *enabled = enable_flags.scissor_test;
      return true;
    case GL_STENCIL_TEST:
      *enabled = enable_flags.stencil_test;
      return true;
    case GL_RASTERIZER_DISCARD:
      *enabled = enable_flags.rasterizer_discard;
      return true;
    case GL_PRIMITIVE_RESTART_FIXED_INDEX:
      *enabled = enable_flags.primitive_restart_fixed_index;
      return true;
    default:
      return false;
  }
}
#endif  // GPU_COMMAND_BUFFER_CLIENT_CLIENT_CONTEXT_STATE_IMPL_AUTOGEN_H_