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