Home | History | Annotate | Download | only in config
      1 // Copyright (c) 2013 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 #ifndef GPU_CONFIG_GPU_DRIVER_BUG_WORKAROUND_TYPE_H_
      6 #define GPU_CONFIG_GPU_DRIVER_BUG_WORKAROUND_TYPE_H_
      7 
      8 #include <string>
      9 
     10 #include "gpu/gpu_export.h"
     11 
     12 #define GPU_DRIVER_BUG_WORKAROUNDS(GPU_OP)                   \
     13   GPU_OP(CLEAR_ALPHA_IN_READPIXELS,                          \
     14          clear_alpha_in_readpixels)                          \
     15   GPU_OP(CLEAR_UNIFORMS_BEFORE_FIRST_PROGRAM_USE,            \
     16          clear_uniforms_before_first_program_use)            \
     17   GPU_OP(COUNT_ALL_IN_VARYINGS_PACKING,                      \
     18          count_all_in_varyings_packing)                      \
     19   GPU_OP(DISABLE_ANGLE_INSTANCED_ARRAYS,                     \
     20          disable_angle_instanced_arrays)                     \
     21   GPU_OP(DISABLE_ARB_SYNC,                                   \
     22          disable_arb_sync)                                   \
     23   GPU_OP(DISABLE_ASYNC_READPIXELS,                           \
     24          disable_async_readpixels)                           \
     25   GPU_OP(DISABLE_D3D11,                                      \
     26          disable_d3d11)                                      \
     27   GPU_OP(DISABLE_DEPTH_TEXTURE,                              \
     28          disable_depth_texture)                              \
     29   GPU_OP(DISABLE_EGL_KHR_FENCE_SYNC,                         \
     30          disable_egl_khr_fence_sync)                         \
     31   GPU_OP(DISABLE_EGL_KHR_WAIT_SYNC,                          \
     32          disable_egl_khr_wait_sync)                          \
     33   GPU_OP(DISABLE_EXT_DISCARD_FRAMEBUFFER,                    \
     34          disable_ext_discard_framebuffer)                    \
     35   GPU_OP(DISABLE_EXT_DRAW_BUFFERS,                           \
     36          disable_ext_draw_buffers)                           \
     37   GPU_OP(DISABLE_EXT_OCCLUSION_QUERY,                        \
     38          disable_ext_occlusion_query)                        \
     39   GPU_OP(DISABLE_MULTIMONITOR_MULTISAMPLING,                 \
     40          disable_multimonitor_multisampling)                 \
     41   GPU_OP(DISABLE_MULTISAMPLING,                              \
     42          disable_multisampling)                              \
     43   GPU_OP(DISABLE_OES_STANDARD_DERIVATIVES,                   \
     44          disable_oes_standard_derivatives)                   \
     45   GPU_OP(DISABLE_POST_SUB_BUFFERS_FOR_ONSCREEN_SURFACES,     \
     46          disable_post_sub_buffers_for_onscreen_surfaces)     \
     47   GPU_OP(ETC1_POWER_OF_TWO_ONLY,                             \
     48          etc1_power_of_two_only)                             \
     49   GPU_OP(EXIT_ON_CONTEXT_LOST,                               \
     50          exit_on_context_lost)                               \
     51   GPU_OP(FORCE_DISCRETE_GPU,                                 \
     52          force_discrete_gpu)                                 \
     53   GPU_OP(FORCE_GL_FINISH_AFTER_COMPOSITING,                  \
     54          force_gl_finish_after_compositing)                  \
     55   GPU_OP(FORCE_INTEGRATED_GPU,                               \
     56          force_integrated_gpu)                               \
     57   GPU_OP(INIT_GL_POSITION_IN_VERTEX_SHADER,                  \
     58          init_gl_position_in_vertex_shader)                  \
     59   GPU_OP(INIT_TEXTURE_MAX_ANISOTROPY,                        \
     60          init_texture_max_anisotropy)                        \
     61   GPU_OP(INIT_VARYINGS_WITHOUT_STATIC_USE,                   \
     62          init_varyings_without_static_use)                   \
     63   GPU_OP(INIT_VERTEX_ATTRIBUTES,                             \
     64          init_vertex_attributes)                             \
     65   GPU_OP(MAX_CUBE_MAP_TEXTURE_SIZE_LIMIT_1024,               \
     66          max_cube_map_texture_size_limit_1024)               \
     67   GPU_OP(MAX_CUBE_MAP_TEXTURE_SIZE_LIMIT_4096,               \
     68          max_cube_map_texture_size_limit_4096)               \
     69   GPU_OP(MAX_CUBE_MAP_TEXTURE_SIZE_LIMIT_512,                \
     70          max_cube_map_texture_size_limit_512)                \
     71   GPU_OP(MAX_FRAGMENT_UNIFORM_VECTORS_32,                    \
     72          max_fragment_uniform_vectors_32)                    \
     73   GPU_OP(MAX_TEXTURE_SIZE_LIMIT_4096,                        \
     74          max_texture_size_limit_4096)                        \
     75   GPU_OP(MAX_VARYING_VECTORS_16,                             \
     76          max_varying_vectors_16)                             \
     77   GPU_OP(MAX_VERTEX_UNIFORM_VECTORS_256,                     \
     78          max_vertex_uniform_vectors_256)                     \
     79   GPU_OP(NEEDS_GLSL_BUILT_IN_FUNCTION_EMULATION,             \
     80          needs_glsl_built_in_function_emulation)             \
     81   GPU_OP(NEEDS_OFFSCREEN_BUFFER_WORKAROUND,                  \
     82          needs_offscreen_buffer_workaround)                  \
     83   GPU_OP(REGENERATE_STRUCT_NAMES,                            \
     84          regenerate_struct_names)                            \
     85   GPU_OP(RELEASE_IMAGE_AFTER_USE,                            \
     86          release_image_after_use)                            \
     87   GPU_OP(RESTORE_SCISSOR_ON_FBO_CHANGE,                      \
     88          restore_scissor_on_fbo_change)                      \
     89   GPU_OP(REVERSE_POINT_SPRITE_COORD_ORIGIN,                  \
     90          reverse_point_sprite_coord_origin)                  \
     91   GPU_OP(SCALARIZE_VEC_AND_MAT_CONSTRUCTOR_ARGS,             \
     92          scalarize_vec_and_mat_constructor_args)             \
     93   GPU_OP(SET_TEXTURE_FILTER_BEFORE_GENERATING_MIPMAP,        \
     94          set_texture_filter_before_generating_mipmap)        \
     95   GPU_OP(SWIZZLE_RGBA_FOR_ASYNC_READPIXELS,                  \
     96          swizzle_rgba_for_async_readpixels)                  \
     97   GPU_OP(TEXSUBIMAGE2D_FASTER_THAN_TEXIMAGE2D,               \
     98          texsubimage2d_faster_than_teximage2d)               \
     99   GPU_OP(UNBIND_FBO_ON_CONTEXT_SWITCH,                       \
    100          unbind_fbo_on_context_switch)                       \
    101   GPU_OP(UNFOLD_SHORT_CIRCUIT_AS_TERNARY_OPERATION,          \
    102          unfold_short_circuit_as_ternary_operation)          \
    103   GPU_OP(UNROLL_FOR_LOOP_WITH_SAMPLER_ARRAY_INDEX,           \
    104          unroll_for_loop_with_sampler_array_index)           \
    105   GPU_OP(USE_CLIENT_SIDE_ARRAYS_FOR_STREAM_BUFFERS,          \
    106          use_client_side_arrays_for_stream_buffers)          \
    107   GPU_OP(USE_CURRENT_PROGRAM_AFTER_SUCCESSFUL_LINK,          \
    108          use_current_program_after_successful_link)          \
    109   GPU_OP(USE_NON_ZERO_SIZE_FOR_CLIENT_SIDE_STREAM_BUFFERS,   \
    110          use_non_zero_size_for_client_side_stream_buffers)   \
    111   GPU_OP(USE_VIRTUALIZED_GL_CONTEXTS,                        \
    112          use_virtualized_gl_contexts)                        \
    113   GPU_OP(VALIDATE_MULTISAMPLE_BUFFER_ALLOCATION,             \
    114          validate_multisample_buffer_allocation)             \
    115   GPU_OP(WAKE_UP_GPU_BEFORE_DRAWING,                         \
    116          wake_up_gpu_before_drawing)                         \
    117 
    118 namespace gpu {
    119 
    120 // Provides all types of GPU driver bug workarounds.
    121 enum GPU_EXPORT GpuDriverBugWorkaroundType {
    122 #define GPU_OP(type, name) type,
    123   GPU_DRIVER_BUG_WORKAROUNDS(GPU_OP)
    124 #undef GPU_OP
    125   NUMBER_OF_GPU_DRIVER_BUG_WORKAROUND_TYPES
    126 };
    127 
    128 GPU_EXPORT std::string GpuDriverBugWorkaroundTypeToString(
    129     GpuDriverBugWorkaroundType type);
    130 
    131 }  // namespace gpu
    132 
    133 #endif  // GPU_CONFIG_GPU_DRIVER_BUG_WORKAROUND_TYPE_H_
    134