summaryrefslogtreecommitdiffstats
path: root/gpu/command_buffer/client/client_context_state_impl_autogen.h
blob: 8396e61b641bc8635cb5966fa10a2c641fa0bad2 (plain)
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
// Copyright 2014 The Chromium Authors. All rights reserved.
// 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) {}

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;
    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;
    default:
      return false;
  }
}
#endif  // GPU_COMMAND_BUFFER_CLIENT_CLIENT_CONTEXT_STATE_IMPL_AUTOGEN_H_