Home | History | Annotate | Download | only in client
      1 // Copyright 2014 The Chromium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 // This file is auto-generated from
      6 // gpu/command_buffer/build_gles2_cmd_buffer.py
      7 // It's formatted by clang-format using chromium coding style:
      8 //    clang-format -i -style=chromium filename
      9 // DO NOT EDIT!
     10 
     11 // It is included by client_context_state.cc
     12 #ifndef GPU_COMMAND_BUFFER_CLIENT_CLIENT_CONTEXT_STATE_IMPL_AUTOGEN_H_
     13 #define GPU_COMMAND_BUFFER_CLIENT_CLIENT_CONTEXT_STATE_IMPL_AUTOGEN_H_
     14 
     15 ClientContextState::EnableFlags::EnableFlags()
     16     : blend(false),
     17       cull_face(false),
     18       depth_test(false),
     19       dither(true),
     20       polygon_offset_fill(false),
     21       sample_alpha_to_coverage(false),
     22       sample_coverage(false),
     23       scissor_test(false),
     24       stencil_test(false) {
     25 }
     26 
     27 bool ClientContextState::SetCapabilityState(GLenum cap,
     28                                             bool enabled,
     29                                             bool* changed) {
     30   *changed = false;
     31   switch (cap) {
     32     case GL_BLEND:
     33       if (enable_flags.blend != enabled) {
     34         *changed = true;
     35         enable_flags.blend = enabled;
     36       }
     37       return true;
     38     case GL_CULL_FACE:
     39       if (enable_flags.cull_face != enabled) {
     40         *changed = true;
     41         enable_flags.cull_face = enabled;
     42       }
     43       return true;
     44     case GL_DEPTH_TEST:
     45       if (enable_flags.depth_test != enabled) {
     46         *changed = true;
     47         enable_flags.depth_test = enabled;
     48       }
     49       return true;
     50     case GL_DITHER:
     51       if (enable_flags.dither != enabled) {
     52         *changed = true;
     53         enable_flags.dither = enabled;
     54       }
     55       return true;
     56     case GL_POLYGON_OFFSET_FILL:
     57       if (enable_flags.polygon_offset_fill != enabled) {
     58         *changed = true;
     59         enable_flags.polygon_offset_fill = enabled;
     60       }
     61       return true;
     62     case GL_SAMPLE_ALPHA_TO_COVERAGE:
     63       if (enable_flags.sample_alpha_to_coverage != enabled) {
     64         *changed = true;
     65         enable_flags.sample_alpha_to_coverage = enabled;
     66       }
     67       return true;
     68     case GL_SAMPLE_COVERAGE:
     69       if (enable_flags.sample_coverage != enabled) {
     70         *changed = true;
     71         enable_flags.sample_coverage = enabled;
     72       }
     73       return true;
     74     case GL_SCISSOR_TEST:
     75       if (enable_flags.scissor_test != enabled) {
     76         *changed = true;
     77         enable_flags.scissor_test = enabled;
     78       }
     79       return true;
     80     case GL_STENCIL_TEST:
     81       if (enable_flags.stencil_test != enabled) {
     82         *changed = true;
     83         enable_flags.stencil_test = enabled;
     84       }
     85       return true;
     86     default:
     87       return false;
     88   }
     89 }
     90 bool ClientContextState::GetEnabled(GLenum cap, bool* enabled) const {
     91   switch (cap) {
     92     case GL_BLEND:
     93       *enabled = enable_flags.blend;
     94       return true;
     95     case GL_CULL_FACE:
     96       *enabled = enable_flags.cull_face;
     97       return true;
     98     case GL_DEPTH_TEST:
     99       *enabled = enable_flags.depth_test;
    100       return true;
    101     case GL_DITHER:
    102       *enabled = enable_flags.dither;
    103       return true;
    104     case GL_POLYGON_OFFSET_FILL:
    105       *enabled = enable_flags.polygon_offset_fill;
    106       return true;
    107     case GL_SAMPLE_ALPHA_TO_COVERAGE:
    108       *enabled = enable_flags.sample_alpha_to_coverage;
    109       return true;
    110     case GL_SAMPLE_COVERAGE:
    111       *enabled = enable_flags.sample_coverage;
    112       return true;
    113     case GL_SCISSOR_TEST:
    114       *enabled = enable_flags.scissor_test;
    115       return true;
    116     case GL_STENCIL_TEST:
    117       *enabled = enable_flags.stencil_test;
    118       return true;
    119     default:
    120       return false;
    121   }
    122 }
    123 #endif  // GPU_COMMAND_BUFFER_CLIENT_CLIENT_CONTEXT_STATE_IMPL_AUTOGEN_H_
    124