1bf215546Sopenharmony_ci/*
2bf215546Sopenharmony_ci * Copyright © 2018 Broadcom
3bf215546Sopenharmony_ci *
4bf215546Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a
5bf215546Sopenharmony_ci * copy of this software and associated documentation files (the "Software"),
6bf215546Sopenharmony_ci * to deal in the Software without restriction, including without limitation
7bf215546Sopenharmony_ci * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8bf215546Sopenharmony_ci * and/or sell copies of the Software, and to permit persons to whom the
9bf215546Sopenharmony_ci * Software is furnished to do so, subject to the following conditions:
10bf215546Sopenharmony_ci *
11bf215546Sopenharmony_ci * The above copyright notice and this permission notice (including the next
12bf215546Sopenharmony_ci * paragraph) shall be included in all copies or substantial portions of the
13bf215546Sopenharmony_ci * Software.
14bf215546Sopenharmony_ci *
15bf215546Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16bf215546Sopenharmony_ci * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17bf215546Sopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
18bf215546Sopenharmony_ci * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19bf215546Sopenharmony_ci * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20bf215546Sopenharmony_ci * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21bf215546Sopenharmony_ci * IN THE SOFTWARE.
22bf215546Sopenharmony_ci */
23bf215546Sopenharmony_ci
24bf215546Sopenharmony_ci#include "pipe/p_screen.h"
25bf215546Sopenharmony_ci#include "util/u_screen.h"
26bf215546Sopenharmony_ci#include "util/u_debug.h"
27bf215546Sopenharmony_ci
28bf215546Sopenharmony_ci/**
29bf215546Sopenharmony_ci * Helper to use from a pipe_screen->get_param() implementation to return
30bf215546Sopenharmony_ci * default values for unsupported PIPE_CAPs.
31bf215546Sopenharmony_ci *
32bf215546Sopenharmony_ci * Call this function from your pipe_screen->get_param() implementation's
33bf215546Sopenharmony_ci * default case, so that implementors of new pipe caps don't need to
34bf215546Sopenharmony_ci */
35bf215546Sopenharmony_ciint
36bf215546Sopenharmony_ciu_pipe_screen_get_param_defaults(struct pipe_screen *pscreen,
37bf215546Sopenharmony_ci                                 enum pipe_cap param)
38bf215546Sopenharmony_ci{
39bf215546Sopenharmony_ci   assert(param < PIPE_CAP_LAST);
40bf215546Sopenharmony_ci
41bf215546Sopenharmony_ci   /* Let's keep these sorted by position in p_defines.h. */
42bf215546Sopenharmony_ci   switch (param) {
43bf215546Sopenharmony_ci   case PIPE_CAP_NPOT_TEXTURES:
44bf215546Sopenharmony_ci   case PIPE_CAP_MAX_DUAL_SOURCE_RENDER_TARGETS:
45bf215546Sopenharmony_ci   case PIPE_CAP_ANISOTROPIC_FILTER:
46bf215546Sopenharmony_ci   case PIPE_CAP_POINT_SPRITE:
47bf215546Sopenharmony_ci      return 0;
48bf215546Sopenharmony_ci
49bf215546Sopenharmony_ci   case PIPE_CAP_GRAPHICS:
50bf215546Sopenharmony_ci   case PIPE_CAP_GL_CLAMP:
51bf215546Sopenharmony_ci   case PIPE_CAP_MAX_RENDER_TARGETS:
52bf215546Sopenharmony_ci   case PIPE_CAP_DITHERING:
53bf215546Sopenharmony_ci      return 1;
54bf215546Sopenharmony_ci
55bf215546Sopenharmony_ci   case PIPE_CAP_OCCLUSION_QUERY:
56bf215546Sopenharmony_ci   case PIPE_CAP_QUERY_TIME_ELAPSED:
57bf215546Sopenharmony_ci   case PIPE_CAP_TEXTURE_SWIZZLE:
58bf215546Sopenharmony_ci      return 0;
59bf215546Sopenharmony_ci
60bf215546Sopenharmony_ci   case PIPE_CAP_MAX_TEXTURE_2D_SIZE:
61bf215546Sopenharmony_ci   case PIPE_CAP_MAX_TEXTURE_3D_LEVELS:
62bf215546Sopenharmony_ci   case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS:
63bf215546Sopenharmony_ci      unreachable("driver must implement these.");
64bf215546Sopenharmony_ci
65bf215546Sopenharmony_ci   case PIPE_CAP_TEXTURE_MIRROR_CLAMP:
66bf215546Sopenharmony_ci   case PIPE_CAP_BLEND_EQUATION_SEPARATE:
67bf215546Sopenharmony_ci   case PIPE_CAP_FRAGMENT_SHADER_TEXTURE_LOD:
68bf215546Sopenharmony_ci   case PIPE_CAP_FRAGMENT_SHADER_DERIVATIVES:
69bf215546Sopenharmony_ci   case PIPE_CAP_MAX_STREAM_OUTPUT_BUFFERS: /* enables EXT_transform_feedback */
70bf215546Sopenharmony_ci   case PIPE_CAP_PRIMITIVE_RESTART:
71bf215546Sopenharmony_ci   case PIPE_CAP_PRIMITIVE_RESTART_FIXED_INDEX:
72bf215546Sopenharmony_ci   case PIPE_CAP_INDEP_BLEND_ENABLE:
73bf215546Sopenharmony_ci   case PIPE_CAP_INDEP_BLEND_FUNC:
74bf215546Sopenharmony_ci   case PIPE_CAP_MAX_TEXTURE_ARRAY_LAYERS: /* Enables GL_EXT_texture_array */
75bf215546Sopenharmony_ci   case PIPE_CAP_FS_COORD_ORIGIN_UPPER_LEFT:
76bf215546Sopenharmony_ci   case PIPE_CAP_FS_COORD_ORIGIN_LOWER_LEFT:
77bf215546Sopenharmony_ci   case PIPE_CAP_FS_COORD_PIXEL_CENTER_HALF_INTEGER:
78bf215546Sopenharmony_ci   case PIPE_CAP_FS_COORD_PIXEL_CENTER_INTEGER:
79bf215546Sopenharmony_ci      return 0;
80bf215546Sopenharmony_ci
81bf215546Sopenharmony_ci   case PIPE_CAP_POINT_COORD_ORIGIN_UPPER_LEFT:
82bf215546Sopenharmony_ci      return 1;
83bf215546Sopenharmony_ci
84bf215546Sopenharmony_ci   case PIPE_CAP_DEPTH_CLIP_DISABLE:
85bf215546Sopenharmony_ci   case PIPE_CAP_DEPTH_CLIP_DISABLE_SEPARATE:
86bf215546Sopenharmony_ci   case PIPE_CAP_DEPTH_CLAMP_ENABLE:
87bf215546Sopenharmony_ci   case PIPE_CAP_SHADER_STENCIL_EXPORT:
88bf215546Sopenharmony_ci   case PIPE_CAP_VS_INSTANCEID:
89bf215546Sopenharmony_ci   case PIPE_CAP_VERTEX_ELEMENT_INSTANCE_DIVISOR:
90bf215546Sopenharmony_ci   case PIPE_CAP_FRAGMENT_COLOR_CLAMPED:
91bf215546Sopenharmony_ci   case PIPE_CAP_MIXED_COLORBUFFER_FORMATS:
92bf215546Sopenharmony_ci   case PIPE_CAP_SEAMLESS_CUBE_MAP:
93bf215546Sopenharmony_ci   case PIPE_CAP_SEAMLESS_CUBE_MAP_PER_TEXTURE:
94bf215546Sopenharmony_ci   case PIPE_CAP_RGB_OVERRIDE_DST_ALPHA_BLEND:
95bf215546Sopenharmony_ci      return 0;
96bf215546Sopenharmony_ci
97bf215546Sopenharmony_ci   case PIPE_CAP_SUPPORTED_PRIM_MODES_WITH_RESTART:
98bf215546Sopenharmony_ci   case PIPE_CAP_SUPPORTED_PRIM_MODES:
99bf215546Sopenharmony_ci      return BITFIELD_MASK(PIPE_PRIM_MAX);
100bf215546Sopenharmony_ci
101bf215546Sopenharmony_ci   case PIPE_CAP_MIN_TEXEL_OFFSET:
102bf215546Sopenharmony_ci      /* GL 3.x minimum value. */
103bf215546Sopenharmony_ci      return -8;
104bf215546Sopenharmony_ci   case PIPE_CAP_MAX_TEXEL_OFFSET:
105bf215546Sopenharmony_ci      return 7;
106bf215546Sopenharmony_ci
107bf215546Sopenharmony_ci   case PIPE_CAP_CONDITIONAL_RENDER:
108bf215546Sopenharmony_ci   case PIPE_CAP_TEXTURE_BARRIER:
109bf215546Sopenharmony_ci      return 0;
110bf215546Sopenharmony_ci
111bf215546Sopenharmony_ci   case PIPE_CAP_MAX_STREAM_OUTPUT_SEPARATE_COMPONENTS:
112bf215546Sopenharmony_ci      /* GL_EXT_transform_feedback minimum value. */
113bf215546Sopenharmony_ci      return 4;
114bf215546Sopenharmony_ci   case PIPE_CAP_MAX_STREAM_OUTPUT_INTERLEAVED_COMPONENTS:
115bf215546Sopenharmony_ci      return 64;
116bf215546Sopenharmony_ci
117bf215546Sopenharmony_ci   case PIPE_CAP_STREAM_OUTPUT_PAUSE_RESUME:
118bf215546Sopenharmony_ci   case PIPE_CAP_TGSI_CAN_COMPACT_CONSTANTS:
119bf215546Sopenharmony_ci   case PIPE_CAP_VERTEX_COLOR_UNCLAMPED:
120bf215546Sopenharmony_ci   case PIPE_CAP_VERTEX_COLOR_CLAMPED:
121bf215546Sopenharmony_ci      return 0;
122bf215546Sopenharmony_ci
123bf215546Sopenharmony_ci   case PIPE_CAP_GLSL_FEATURE_LEVEL:
124bf215546Sopenharmony_ci   case PIPE_CAP_GLSL_FEATURE_LEVEL_COMPATIBILITY:
125bf215546Sopenharmony_ci      /* Minimum GLSL level implemented by gallium drivers. */
126bf215546Sopenharmony_ci      return 120;
127bf215546Sopenharmony_ci
128bf215546Sopenharmony_ci   case PIPE_CAP_ESSL_FEATURE_LEVEL:
129bf215546Sopenharmony_ci      /* Tell gallium frontend to fallback to PIPE_CAP_GLSL_FEATURE_LEVEL */
130bf215546Sopenharmony_ci      return 0;
131bf215546Sopenharmony_ci
132bf215546Sopenharmony_ci   case PIPE_CAP_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION:
133bf215546Sopenharmony_ci   case PIPE_CAP_USER_VERTEX_BUFFERS:
134bf215546Sopenharmony_ci   case PIPE_CAP_VERTEX_BUFFER_OFFSET_4BYTE_ALIGNED_ONLY:
135bf215546Sopenharmony_ci   case PIPE_CAP_VERTEX_BUFFER_STRIDE_4BYTE_ALIGNED_ONLY:
136bf215546Sopenharmony_ci   case PIPE_CAP_VERTEX_ELEMENT_SRC_OFFSET_4BYTE_ALIGNED_ONLY:
137bf215546Sopenharmony_ci   case PIPE_CAP_VERTEX_ATTRIB_ELEMENT_ALIGNED_ONLY:
138bf215546Sopenharmony_ci   case PIPE_CAP_COMPUTE:
139bf215546Sopenharmony_ci      return 0;
140bf215546Sopenharmony_ci
141bf215546Sopenharmony_ci   case PIPE_CAP_CONSTANT_BUFFER_OFFSET_ALIGNMENT:
142bf215546Sopenharmony_ci      /* GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT default value. */
143bf215546Sopenharmony_ci      return 1;
144bf215546Sopenharmony_ci
145bf215546Sopenharmony_ci   case PIPE_CAP_START_INSTANCE:
146bf215546Sopenharmony_ci   case PIPE_CAP_QUERY_TIMESTAMP:
147bf215546Sopenharmony_ci   case PIPE_CAP_TEXTURE_MULTISAMPLE:
148bf215546Sopenharmony_ci      return 0;
149bf215546Sopenharmony_ci
150bf215546Sopenharmony_ci   case PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT:
151bf215546Sopenharmony_ci      /* GL_ARB_map_buffer_alignment minimum value. All drivers expose the
152bf215546Sopenharmony_ci       * extension.
153bf215546Sopenharmony_ci       */
154bf215546Sopenharmony_ci      return 64;
155bf215546Sopenharmony_ci
156bf215546Sopenharmony_ci   case PIPE_CAP_CUBE_MAP_ARRAY:
157bf215546Sopenharmony_ci   case PIPE_CAP_TEXTURE_BUFFER_OBJECTS:
158bf215546Sopenharmony_ci      return 0;
159bf215546Sopenharmony_ci
160bf215546Sopenharmony_ci   case PIPE_CAP_TEXTURE_BUFFER_OFFSET_ALIGNMENT:
161bf215546Sopenharmony_ci      /* GL_EXT_texture_buffer minimum value. */
162bf215546Sopenharmony_ci      return 256;
163bf215546Sopenharmony_ci
164bf215546Sopenharmony_ci   case PIPE_CAP_BUFFER_SAMPLER_VIEW_RGBA_ONLY:
165bf215546Sopenharmony_ci   case PIPE_CAP_TGSI_TEXCOORD:
166bf215546Sopenharmony_ci   case PIPE_CAP_TEXTURE_BUFFER_SAMPLER:
167bf215546Sopenharmony_ci      return 0;
168bf215546Sopenharmony_ci
169bf215546Sopenharmony_ci   case PIPE_CAP_TEXTURE_TRANSFER_MODES:
170bf215546Sopenharmony_ci      return PIPE_TEXTURE_TRANSFER_BLIT;
171bf215546Sopenharmony_ci
172bf215546Sopenharmony_ci   case PIPE_CAP_QUERY_PIPELINE_STATISTICS:
173bf215546Sopenharmony_ci   case PIPE_CAP_QUERY_PIPELINE_STATISTICS_SINGLE:
174bf215546Sopenharmony_ci   case PIPE_CAP_TEXTURE_BORDER_COLOR_QUIRK:
175bf215546Sopenharmony_ci      return 0;
176bf215546Sopenharmony_ci
177bf215546Sopenharmony_ci   case PIPE_CAP_MAX_TEXEL_BUFFER_ELEMENTS_UINT:
178bf215546Sopenharmony_ci      /* GL_EXT_texture_buffer minimum value. */
179bf215546Sopenharmony_ci      return 65536;
180bf215546Sopenharmony_ci
181bf215546Sopenharmony_ci   case PIPE_CAP_MAX_VIEWPORTS:
182bf215546Sopenharmony_ci      return 1;
183bf215546Sopenharmony_ci
184bf215546Sopenharmony_ci   case PIPE_CAP_ENDIANNESS:
185bf215546Sopenharmony_ci      return PIPE_ENDIAN_LITTLE;
186bf215546Sopenharmony_ci
187bf215546Sopenharmony_ci   case PIPE_CAP_MIXED_FRAMEBUFFER_SIZES:
188bf215546Sopenharmony_ci   case PIPE_CAP_VS_LAYER_VIEWPORT:
189bf215546Sopenharmony_ci   case PIPE_CAP_MAX_GEOMETRY_OUTPUT_VERTICES:
190bf215546Sopenharmony_ci   case PIPE_CAP_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS:
191bf215546Sopenharmony_ci   case PIPE_CAP_MAX_TEXTURE_GATHER_COMPONENTS: /* Enables ARB_texture_gather */
192bf215546Sopenharmony_ci   case PIPE_CAP_TEXTURE_GATHER_SM5:
193bf215546Sopenharmony_ci   case PIPE_CAP_BUFFER_MAP_PERSISTENT_COHERENT:
194bf215546Sopenharmony_ci   case PIPE_CAP_FAKE_SW_MSAA:
195bf215546Sopenharmony_ci   case PIPE_CAP_TEXTURE_QUERY_LOD:
196bf215546Sopenharmony_ci      return 0;
197bf215546Sopenharmony_ci
198bf215546Sopenharmony_ci   case PIPE_CAP_MIN_TEXTURE_GATHER_OFFSET:
199bf215546Sopenharmony_ci      return -8;
200bf215546Sopenharmony_ci   case PIPE_CAP_MAX_TEXTURE_GATHER_OFFSET:
201bf215546Sopenharmony_ci      return 7;
202bf215546Sopenharmony_ci
203bf215546Sopenharmony_ci   case PIPE_CAP_SAMPLE_SHADING:
204bf215546Sopenharmony_ci   case PIPE_CAP_TEXTURE_GATHER_OFFSETS:
205bf215546Sopenharmony_ci   case PIPE_CAP_VS_WINDOW_SPACE_POSITION:
206bf215546Sopenharmony_ci   case PIPE_CAP_MAX_VERTEX_STREAMS:
207bf215546Sopenharmony_ci   case PIPE_CAP_DRAW_INDIRECT:
208bf215546Sopenharmony_ci   case PIPE_CAP_FS_FINE_DERIVATIVE:
209bf215546Sopenharmony_ci      return 0;
210bf215546Sopenharmony_ci
211bf215546Sopenharmony_ci   case PIPE_CAP_VENDOR_ID:
212bf215546Sopenharmony_ci   case PIPE_CAP_DEVICE_ID:
213bf215546Sopenharmony_ci      return 0xffffffff;
214bf215546Sopenharmony_ci
215bf215546Sopenharmony_ci   case PIPE_CAP_ACCELERATED:
216bf215546Sopenharmony_ci   case PIPE_CAP_VIDEO_MEMORY:
217bf215546Sopenharmony_ci   case PIPE_CAP_UMA:
218bf215546Sopenharmony_ci      unreachable("driver must implement these.");
219bf215546Sopenharmony_ci
220bf215546Sopenharmony_ci   case PIPE_CAP_CONDITIONAL_RENDER_INVERTED:
221bf215546Sopenharmony_ci      return 0;
222bf215546Sopenharmony_ci
223bf215546Sopenharmony_ci   case PIPE_CAP_MAX_VERTEX_ATTRIB_STRIDE:
224bf215546Sopenharmony_ci      /* GL minimum value */
225bf215546Sopenharmony_ci      return 2048;
226bf215546Sopenharmony_ci
227bf215546Sopenharmony_ci   case PIPE_CAP_SAMPLER_VIEW_TARGET:
228bf215546Sopenharmony_ci   case PIPE_CAP_CLIP_HALFZ:
229bf215546Sopenharmony_ci   case PIPE_CAP_VERTEXID_NOBASE:
230bf215546Sopenharmony_ci   case PIPE_CAP_POLYGON_OFFSET_CLAMP:
231bf215546Sopenharmony_ci   case PIPE_CAP_MULTISAMPLE_Z_RESOLVE:
232bf215546Sopenharmony_ci   case PIPE_CAP_RESOURCE_FROM_USER_MEMORY:
233bf215546Sopenharmony_ci   case PIPE_CAP_RESOURCE_FROM_USER_MEMORY_COMPUTE_ONLY:
234bf215546Sopenharmony_ci   case PIPE_CAP_DEVICE_RESET_STATUS_QUERY:
235bf215546Sopenharmony_ci   case PIPE_CAP_DEVICE_PROTECTED_CONTENT:
236bf215546Sopenharmony_ci   case PIPE_CAP_MAX_SHADER_PATCH_VARYINGS:
237bf215546Sopenharmony_ci   case PIPE_CAP_TEXTURE_FLOAT_LINEAR:
238bf215546Sopenharmony_ci   case PIPE_CAP_TEXTURE_HALF_FLOAT_LINEAR:
239bf215546Sopenharmony_ci   case PIPE_CAP_DEPTH_BOUNDS_TEST:
240bf215546Sopenharmony_ci   case PIPE_CAP_TEXTURE_QUERY_SAMPLES:
241bf215546Sopenharmony_ci   case PIPE_CAP_FORCE_PERSAMPLE_INTERP:
242bf215546Sopenharmony_ci      return 0;
243bf215546Sopenharmony_ci
244bf215546Sopenharmony_ci   /* All drivers should expose this cap, as it is required for applications to
245bf215546Sopenharmony_ci    * be able to efficiently compile GL shaders from multiple threads during
246bf215546Sopenharmony_ci    * load.
247bf215546Sopenharmony_ci    */
248bf215546Sopenharmony_ci   case PIPE_CAP_SHAREABLE_SHADERS:
249bf215546Sopenharmony_ci      return 1;
250bf215546Sopenharmony_ci
251bf215546Sopenharmony_ci   case PIPE_CAP_COPY_BETWEEN_COMPRESSED_AND_PLAIN_FORMATS:
252bf215546Sopenharmony_ci   case PIPE_CAP_CLEAR_TEXTURE:
253bf215546Sopenharmony_ci   case PIPE_CAP_CLEAR_SCISSORED:
254bf215546Sopenharmony_ci   case PIPE_CAP_DRAW_PARAMETERS:
255bf215546Sopenharmony_ci   case PIPE_CAP_SHADER_PACK_HALF_FLOAT:
256bf215546Sopenharmony_ci   case PIPE_CAP_MULTI_DRAW_INDIRECT:
257bf215546Sopenharmony_ci   case PIPE_CAP_MULTI_DRAW_INDIRECT_PARAMS:
258bf215546Sopenharmony_ci   case PIPE_CAP_FS_POSITION_IS_SYSVAL:
259bf215546Sopenharmony_ci   case PIPE_CAP_FS_POINT_IS_SYSVAL:
260bf215546Sopenharmony_ci   case PIPE_CAP_FS_FACE_IS_INTEGER_SYSVAL:
261bf215546Sopenharmony_ci      return 0;
262bf215546Sopenharmony_ci   case PIPE_CAP_MULTI_DRAW_INDIRECT_PARTIAL_STRIDE:
263bf215546Sopenharmony_ci      return 1;
264bf215546Sopenharmony_ci
265bf215546Sopenharmony_ci   case PIPE_CAP_SHADER_BUFFER_OFFSET_ALIGNMENT:
266bf215546Sopenharmony_ci      /* Enables GL_ARB_shader_storage_buffer_object */
267bf215546Sopenharmony_ci      return 0;
268bf215546Sopenharmony_ci
269bf215546Sopenharmony_ci   case PIPE_CAP_INVALIDATE_BUFFER:
270bf215546Sopenharmony_ci   case PIPE_CAP_GENERATE_MIPMAP:
271bf215546Sopenharmony_ci   case PIPE_CAP_STRING_MARKER:
272bf215546Sopenharmony_ci   case PIPE_CAP_SURFACE_REINTERPRET_BLOCKS:
273bf215546Sopenharmony_ci   case PIPE_CAP_QUERY_BUFFER_OBJECT:
274bf215546Sopenharmony_ci   case PIPE_CAP_QUERY_MEMORY_INFO: /* Enables GL_ATI_meminfo */
275bf215546Sopenharmony_ci      return 0;
276bf215546Sopenharmony_ci
277bf215546Sopenharmony_ci   case PIPE_CAP_PCI_GROUP:
278bf215546Sopenharmony_ci   case PIPE_CAP_PCI_BUS:
279bf215546Sopenharmony_ci   case PIPE_CAP_PCI_DEVICE:
280bf215546Sopenharmony_ci   case PIPE_CAP_PCI_FUNCTION:
281bf215546Sopenharmony_ci      unreachable("driver must implement these.");
282bf215546Sopenharmony_ci
283bf215546Sopenharmony_ci   case PIPE_CAP_FRAMEBUFFER_NO_ATTACHMENT:
284bf215546Sopenharmony_ci   case PIPE_CAP_ROBUST_BUFFER_ACCESS_BEHAVIOR:
285bf215546Sopenharmony_ci   case PIPE_CAP_CULL_DISTANCE:
286bf215546Sopenharmony_ci   case PIPE_CAP_CULL_DISTANCE_NOCOMBINE:
287bf215546Sopenharmony_ci   case PIPE_CAP_SHADER_GROUP_VOTE:
288bf215546Sopenharmony_ci   case PIPE_CAP_MAX_WINDOW_RECTANGLES: /* Enables EXT_window_rectangles */
289bf215546Sopenharmony_ci   case PIPE_CAP_POLYGON_OFFSET_UNITS_UNSCALED:
290bf215546Sopenharmony_ci   case PIPE_CAP_VIEWPORT_SUBPIXEL_BITS:
291bf215546Sopenharmony_ci   case PIPE_CAP_VIEWPORT_SWIZZLE:
292bf215546Sopenharmony_ci   case PIPE_CAP_VIEWPORT_MASK:
293bf215546Sopenharmony_ci   case PIPE_CAP_MIXED_COLOR_DEPTH_BITS:
294bf215546Sopenharmony_ci   case PIPE_CAP_SHADER_ARRAY_COMPONENTS:
295bf215546Sopenharmony_ci   case PIPE_CAP_STREAM_OUTPUT_INTERLEAVE_BUFFERS:
296bf215546Sopenharmony_ci   case PIPE_CAP_SHADER_CAN_READ_OUTPUTS:
297bf215546Sopenharmony_ci   case PIPE_CAP_NATIVE_FENCE_FD:
298bf215546Sopenharmony_ci      return 0;
299bf215546Sopenharmony_ci
300bf215546Sopenharmony_ci   case PIPE_CAP_RASTERIZER_SUBPIXEL_BITS:
301bf215546Sopenharmony_ci      return 4; /* GLES 2.0 minimum value */
302bf215546Sopenharmony_ci
303bf215546Sopenharmony_ci   case PIPE_CAP_PREFER_BACK_BUFFER_REUSE:
304bf215546Sopenharmony_ci      return 1;
305bf215546Sopenharmony_ci
306bf215546Sopenharmony_ci   case PIPE_CAP_GLSL_TESS_LEVELS_AS_INPUTS:
307bf215546Sopenharmony_ci      return 0;
308bf215546Sopenharmony_ci
309bf215546Sopenharmony_ci   case PIPE_CAP_FBFETCH:
310bf215546Sopenharmony_ci   case PIPE_CAP_FBFETCH_COHERENT:
311bf215546Sopenharmony_ci   case PIPE_CAP_FBFETCH_ZS:
312bf215546Sopenharmony_ci   case PIPE_CAP_BLEND_EQUATION_ADVANCED:
313bf215546Sopenharmony_ci   case PIPE_CAP_LEGACY_MATH_RULES:
314bf215546Sopenharmony_ci   case PIPE_CAP_DOUBLES:
315bf215546Sopenharmony_ci   case PIPE_CAP_INT64:
316bf215546Sopenharmony_ci   case PIPE_CAP_INT64_DIVMOD:
317bf215546Sopenharmony_ci   case PIPE_CAP_TGSI_TEX_TXF_LZ:
318bf215546Sopenharmony_ci   case PIPE_CAP_SHADER_CLOCK:
319bf215546Sopenharmony_ci   case PIPE_CAP_POLYGON_MODE_FILL_RECTANGLE:
320bf215546Sopenharmony_ci   case PIPE_CAP_SPARSE_BUFFER_PAGE_SIZE:
321bf215546Sopenharmony_ci   case PIPE_CAP_SHADER_BALLOT:
322bf215546Sopenharmony_ci   case PIPE_CAP_TES_LAYER_VIEWPORT:
323bf215546Sopenharmony_ci   case PIPE_CAP_CAN_BIND_CONST_BUFFER_AS_VERTEX:
324bf215546Sopenharmony_ci   case PIPE_CAP_TGSI_DIV:
325bf215546Sopenharmony_ci   case PIPE_CAP_NIR_ATOMICS_AS_DEREF:
326bf215546Sopenharmony_ci      return 0;
327bf215546Sopenharmony_ci
328bf215546Sopenharmony_ci   case PIPE_CAP_ALLOW_MAPPED_BUFFERS_DURING_EXECUTION:
329bf215546Sopenharmony_ci      /* Drivers generally support this, and it reduces GL overhead just to
330bf215546Sopenharmony_ci       * throw an error when buffers are mapped.
331bf215546Sopenharmony_ci       */
332bf215546Sopenharmony_ci      return 1;
333bf215546Sopenharmony_ci
334bf215546Sopenharmony_ci   case PIPE_CAP_PREFER_IMM_ARRAYS_AS_CONSTBUF:
335bf215546Sopenharmony_ci      /* Don't unset this unless your driver can do better */
336bf215546Sopenharmony_ci      return 1;
337bf215546Sopenharmony_ci
338bf215546Sopenharmony_ci   case PIPE_CAP_POST_DEPTH_COVERAGE:
339bf215546Sopenharmony_ci   case PIPE_CAP_BINDLESS_TEXTURE:
340bf215546Sopenharmony_ci   case PIPE_CAP_NIR_SAMPLERS_AS_DEREF:
341bf215546Sopenharmony_ci   case PIPE_CAP_NIR_COMPACT_ARRAYS:
342bf215546Sopenharmony_ci   case PIPE_CAP_QUERY_SO_OVERFLOW:
343bf215546Sopenharmony_ci   case PIPE_CAP_MEMOBJ:
344bf215546Sopenharmony_ci   case PIPE_CAP_LOAD_CONSTBUF:
345bf215546Sopenharmony_ci   case PIPE_CAP_TILE_RASTER_ORDER:
346bf215546Sopenharmony_ci      return 0;
347bf215546Sopenharmony_ci
348bf215546Sopenharmony_ci   case PIPE_CAP_MAX_COMBINED_SHADER_OUTPUT_RESOURCES:
349bf215546Sopenharmony_ci      /* nonzero overrides defaults */
350bf215546Sopenharmony_ci      return 0;
351bf215546Sopenharmony_ci
352bf215546Sopenharmony_ci   case PIPE_CAP_FRAMEBUFFER_MSAA_CONSTRAINTS:
353bf215546Sopenharmony_ci   case PIPE_CAP_SIGNED_VERTEX_BUFFER_OFFSET:
354bf215546Sopenharmony_ci   case PIPE_CAP_CONTEXT_PRIORITY_MASK:
355bf215546Sopenharmony_ci   case PIPE_CAP_FENCE_SIGNAL:
356bf215546Sopenharmony_ci   case PIPE_CAP_CONSTBUF0_FLAGS:
357bf215546Sopenharmony_ci   case PIPE_CAP_PACKED_UNIFORMS:
358bf215546Sopenharmony_ci   case PIPE_CAP_CONSERVATIVE_RASTER_POST_SNAP_TRIANGLES:
359bf215546Sopenharmony_ci   case PIPE_CAP_CONSERVATIVE_RASTER_POST_SNAP_POINTS_LINES:
360bf215546Sopenharmony_ci   case PIPE_CAP_CONSERVATIVE_RASTER_PRE_SNAP_TRIANGLES:
361bf215546Sopenharmony_ci   case PIPE_CAP_CONSERVATIVE_RASTER_PRE_SNAP_POINTS_LINES:
362bf215546Sopenharmony_ci   case PIPE_CAP_MAX_CONSERVATIVE_RASTER_SUBPIXEL_PRECISION_BIAS:
363bf215546Sopenharmony_ci   case PIPE_CAP_CONSERVATIVE_RASTER_POST_DEPTH_COVERAGE:
364bf215546Sopenharmony_ci   case PIPE_CAP_CONSERVATIVE_RASTER_INNER_COVERAGE:
365bf215546Sopenharmony_ci   case PIPE_CAP_PROGRAMMABLE_SAMPLE_LOCATIONS:
366bf215546Sopenharmony_ci   case PIPE_CAP_MAX_COMBINED_SHADER_BUFFERS:
367bf215546Sopenharmony_ci   case PIPE_CAP_MAX_COMBINED_HW_ATOMIC_COUNTERS:
368bf215546Sopenharmony_ci   case PIPE_CAP_MAX_COMBINED_HW_ATOMIC_COUNTER_BUFFERS:
369bf215546Sopenharmony_ci   case PIPE_CAP_IMAGE_ATOMIC_FLOAT_ADD:
370bf215546Sopenharmony_ci   case PIPE_CAP_IMAGE_LOAD_FORMATTED:
371bf215546Sopenharmony_ci   case PIPE_CAP_IMAGE_STORE_FORMATTED:
372bf215546Sopenharmony_ci   case PIPE_CAP_PREFER_COMPUTE_FOR_MULTIMEDIA:
373bf215546Sopenharmony_ci   case PIPE_CAP_FRAGMENT_SHADER_INTERLOCK:
374bf215546Sopenharmony_ci   case PIPE_CAP_CS_DERIVED_SYSTEM_VALUES_SUPPORTED:
375bf215546Sopenharmony_ci   case PIPE_CAP_ATOMIC_FLOAT_MINMAX:
376bf215546Sopenharmony_ci   case PIPE_CAP_SHADER_SAMPLES_IDENTICAL:
377bf215546Sopenharmony_ci   case PIPE_CAP_IMAGE_ATOMIC_INC_WRAP:
378bf215546Sopenharmony_ci   case PIPE_CAP_TGSI_TG4_COMPONENT_IN_SWIZZLE:
379bf215546Sopenharmony_ci   case PIPE_CAP_GLSL_ZERO_INIT:
380bf215546Sopenharmony_ci   case PIPE_CAP_ALLOW_DRAW_OUT_OF_ORDER:
381bf215546Sopenharmony_ci      return 0;
382bf215546Sopenharmony_ci
383bf215546Sopenharmony_ci   case PIPE_CAP_MAX_GS_INVOCATIONS:
384bf215546Sopenharmony_ci      return 32;
385bf215546Sopenharmony_ci
386bf215546Sopenharmony_ci   case PIPE_CAP_MAX_SHADER_BUFFER_SIZE_UINT:
387bf215546Sopenharmony_ci      return 1 << 27;
388bf215546Sopenharmony_ci
389bf215546Sopenharmony_ci   case PIPE_CAP_TEXTURE_MIRROR_CLAMP_TO_EDGE:
390bf215546Sopenharmony_ci   case PIPE_CAP_MAX_TEXTURE_UPLOAD_MEMORY_BUDGET:
391bf215546Sopenharmony_ci      return 0;
392bf215546Sopenharmony_ci
393bf215546Sopenharmony_ci   case PIPE_CAP_MAX_VERTEX_ELEMENT_SRC_OFFSET:
394bf215546Sopenharmony_ci      return 2047;
395bf215546Sopenharmony_ci
396bf215546Sopenharmony_ci   case PIPE_CAP_SURFACE_SAMPLE_COUNT:
397bf215546Sopenharmony_ci      return 0;
398bf215546Sopenharmony_ci   case PIPE_CAP_DEST_SURFACE_SRGB_CONTROL:
399bf215546Sopenharmony_ci      return 1;
400bf215546Sopenharmony_ci
401bf215546Sopenharmony_ci   case PIPE_CAP_MAX_VARYINGS:
402bf215546Sopenharmony_ci      return 8;
403bf215546Sopenharmony_ci
404bf215546Sopenharmony_ci   case PIPE_CAP_COMPUTE_GRID_INFO_LAST_BLOCK:
405bf215546Sopenharmony_ci      return 0;
406bf215546Sopenharmony_ci
407bf215546Sopenharmony_ci   case PIPE_CAP_COMPUTE_SHADER_DERIVATIVES:
408bf215546Sopenharmony_ci      return 0;
409bf215546Sopenharmony_ci
410bf215546Sopenharmony_ci   case PIPE_CAP_THROTTLE:
411bf215546Sopenharmony_ci      return 1;
412bf215546Sopenharmony_ci
413bf215546Sopenharmony_ci   case PIPE_CAP_TEXTURE_SHADOW_LOD:
414bf215546Sopenharmony_ci      return 0;
415bf215546Sopenharmony_ci
416bf215546Sopenharmony_ci   case PIPE_CAP_GL_SPIRV:
417bf215546Sopenharmony_ci   case PIPE_CAP_GL_SPIRV_VARIABLE_POINTERS:
418bf215546Sopenharmony_ci      return 0;
419bf215546Sopenharmony_ci
420bf215546Sopenharmony_ci   case PIPE_CAP_DEMOTE_TO_HELPER_INVOCATION:
421bf215546Sopenharmony_ci      return 0;
422bf215546Sopenharmony_ci
423bf215546Sopenharmony_ci   case PIPE_CAP_DMABUF:
424bf215546Sopenharmony_ci#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD)
425bf215546Sopenharmony_ci      return 1;
426bf215546Sopenharmony_ci#else
427bf215546Sopenharmony_ci      return 0;
428bf215546Sopenharmony_ci#endif
429bf215546Sopenharmony_ci
430bf215546Sopenharmony_ci   case PIPE_CAP_TEXTURE_SHADOW_MAP: /* Enables ARB_shadow */
431bf215546Sopenharmony_ci      return 1;
432bf215546Sopenharmony_ci
433bf215546Sopenharmony_ci   case PIPE_CAP_FLATSHADE:
434bf215546Sopenharmony_ci   case PIPE_CAP_ALPHA_TEST:
435bf215546Sopenharmony_ci   case PIPE_CAP_POINT_SIZE_FIXED:
436bf215546Sopenharmony_ci   case PIPE_CAP_TWO_SIDED_COLOR:
437bf215546Sopenharmony_ci   case PIPE_CAP_CLIP_PLANES:
438bf215546Sopenharmony_ci      return 1;
439bf215546Sopenharmony_ci
440bf215546Sopenharmony_ci   case PIPE_CAP_MAX_VERTEX_BUFFERS:
441bf215546Sopenharmony_ci      return 16;
442bf215546Sopenharmony_ci
443bf215546Sopenharmony_ci   case PIPE_CAP_OPENCL_INTEGER_FUNCTIONS:
444bf215546Sopenharmony_ci   case PIPE_CAP_INTEGER_MULTIPLY_32X16:
445bf215546Sopenharmony_ci      return 0;
446bf215546Sopenharmony_ci   case PIPE_CAP_NIR_IMAGES_AS_DEREF:
447bf215546Sopenharmony_ci      return 1;
448bf215546Sopenharmony_ci
449bf215546Sopenharmony_ci   case PIPE_CAP_FRONTEND_NOOP:
450bf215546Sopenharmony_ci      /* Enables INTEL_blackhole_render */
451bf215546Sopenharmony_ci      return 0;
452bf215546Sopenharmony_ci
453bf215546Sopenharmony_ci   case PIPE_CAP_PACKED_STREAM_OUTPUT:
454bf215546Sopenharmony_ci      return 1;
455bf215546Sopenharmony_ci
456bf215546Sopenharmony_ci   case PIPE_CAP_VIEWPORT_TRANSFORM_LOWERED:
457bf215546Sopenharmony_ci   case PIPE_CAP_PSIZ_CLAMPED:
458bf215546Sopenharmony_ci   case PIPE_CAP_MAP_UNSYNCHRONIZED_THREAD_SAFE:
459bf215546Sopenharmony_ci      return 0;
460bf215546Sopenharmony_ci
461bf215546Sopenharmony_ci   case PIPE_CAP_GL_BEGIN_END_BUFFER_SIZE:
462bf215546Sopenharmony_ci      return 512 * 1024;
463bf215546Sopenharmony_ci
464bf215546Sopenharmony_ci   case PIPE_CAP_SYSTEM_SVM:
465bf215546Sopenharmony_ci   case PIPE_CAP_ALPHA_TO_COVERAGE_DITHER_CONTROL:
466bf215546Sopenharmony_ci   case PIPE_CAP_NO_CLIP_ON_COPY_TEX:
467bf215546Sopenharmony_ci   case PIPE_CAP_MAX_TEXTURE_MB:
468bf215546Sopenharmony_ci   case PIPE_CAP_PREFER_REAL_BUFFER_IN_CONSTBUF0:
469bf215546Sopenharmony_ci      return 0;
470bf215546Sopenharmony_ci
471bf215546Sopenharmony_ci   case PIPE_CAP_TEXRECT:
472bf215546Sopenharmony_ci      return 1;
473bf215546Sopenharmony_ci
474bf215546Sopenharmony_ci   case PIPE_CAP_SHADER_ATOMIC_INT64:
475bf215546Sopenharmony_ci      return 0;
476bf215546Sopenharmony_ci
477bf215546Sopenharmony_ci   case PIPE_CAP_SAMPLER_REDUCTION_MINMAX:
478bf215546Sopenharmony_ci   case PIPE_CAP_SAMPLER_REDUCTION_MINMAX_ARB:
479bf215546Sopenharmony_ci      return 0;
480bf215546Sopenharmony_ci
481bf215546Sopenharmony_ci   case PIPE_CAP_ALLOW_DYNAMIC_VAO_FASTPATH:
482bf215546Sopenharmony_ci      return 1;
483bf215546Sopenharmony_ci
484bf215546Sopenharmony_ci   case PIPE_CAP_EMULATE_NONFIXED_PRIMITIVE_RESTART:
485bf215546Sopenharmony_ci   case PIPE_CAP_DRAW_VERTEX_STATE:
486bf215546Sopenharmony_ci      return 0;
487bf215546Sopenharmony_ci
488bf215546Sopenharmony_ci   case PIPE_CAP_PREFER_POT_ALIGNED_VARYINGS:
489bf215546Sopenharmony_ci      return 0;
490bf215546Sopenharmony_ci
491bf215546Sopenharmony_ci   case PIPE_CAP_MAX_SPARSE_TEXTURE_SIZE:
492bf215546Sopenharmony_ci   case PIPE_CAP_MAX_SPARSE_3D_TEXTURE_SIZE:
493bf215546Sopenharmony_ci   case PIPE_CAP_MAX_SPARSE_ARRAY_TEXTURE_LAYERS:
494bf215546Sopenharmony_ci   case PIPE_CAP_SPARSE_TEXTURE_FULL_ARRAY_CUBE_MIPMAPS:
495bf215546Sopenharmony_ci   case PIPE_CAP_QUERY_SPARSE_TEXTURE_RESIDENCY:
496bf215546Sopenharmony_ci   case PIPE_CAP_CLAMP_SPARSE_TEXTURE_LOD:
497bf215546Sopenharmony_ci   case PIPE_CAP_TIMELINE_SEMAPHORE_IMPORT:
498bf215546Sopenharmony_ci      return 0;
499bf215546Sopenharmony_ci
500bf215546Sopenharmony_ci   case PIPE_CAP_MAX_CONSTANT_BUFFER_SIZE_UINT:
501bf215546Sopenharmony_ci      return pscreen->get_shader_param(pscreen, PIPE_SHADER_FRAGMENT,
502bf215546Sopenharmony_ci                                       PIPE_SHADER_CAP_MAX_CONST_BUFFER0_SIZE);
503bf215546Sopenharmony_ci
504bf215546Sopenharmony_ci   case PIPE_CAP_HARDWARE_GL_SELECT: {
505bf215546Sopenharmony_ci      /* =0: on CPU, always disabled
506bf215546Sopenharmony_ci       * >0: on GPU, enable by default, user can disable it manually
507bf215546Sopenharmony_ci       * <0: unknown, disable by default, user can enable it manually
508bf215546Sopenharmony_ci       */
509bf215546Sopenharmony_ci      int accel = pscreen->get_param(pscreen, PIPE_CAP_ACCELERATED);
510bf215546Sopenharmony_ci
511bf215546Sopenharmony_ci      return !!accel && debug_get_bool_option("MESA_HW_ACCEL_SELECT", accel > 0) &&
512bf215546Sopenharmony_ci         /* internal geometry shader need indirect array access */
513bf215546Sopenharmony_ci         pscreen->get_shader_param(pscreen, PIPE_SHADER_GEOMETRY,
514bf215546Sopenharmony_ci                                   PIPE_SHADER_CAP_INDIRECT_TEMP_ADDR) &&
515bf215546Sopenharmony_ci         /* internal geometry shader need SSBO support */
516bf215546Sopenharmony_ci         pscreen->get_shader_param(pscreen, PIPE_SHADER_GEOMETRY,
517bf215546Sopenharmony_ci                                   PIPE_SHADER_CAP_MAX_SHADER_BUFFERS);
518bf215546Sopenharmony_ci   }
519bf215546Sopenharmony_ci
520bf215546Sopenharmony_ci   default:
521bf215546Sopenharmony_ci      unreachable("bad PIPE_CAP_*");
522bf215546Sopenharmony_ci   }
523bf215546Sopenharmony_ci}
524