summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/CMakeLists.txt4
-rw-r--r--tests/cl/api/build-program.c2
-rw-r--r--tests/cl/api/create-context.c2
-rw-r--r--tests/cl/api/create-program-with-binary.c24
-rw-r--r--tests/cl/api/create-program-with-source.c6
-rw-r--r--tests/cl/api/enqueue-fill-image.c2
-rw-r--r--tests/cl/api/enqueue-read_write-buffer.c8
-rw-r--r--tests/cl/api/get-device-info.c20
-rw-r--r--tests/cl/api/get-kernel-arg-info.c2
-rw-r--r--tests/cl/api/get-kernel-info.c2
-rw-r--r--tests/cl/api/get-kernel-work-group-info.c4
-rw-r--r--tests/cl/api/get-mem-object-info.c2
-rw-r--r--tests/cl/program/bitcoin-phatk.c2
-rw-r--r--tests/cl/program/execute/builtin/convert/float-convert_long.cl4
-rw-r--r--tests/cl/program/execute/non-entry-block-alloca.cl104
-rw-r--r--tests/cl/program/execute/reference.cl2
-rw-r--r--tests/cl/program/program-tester.c9
-rw-r--r--tests/deqp_gles3.py2
-rw-r--r--tests/egl/egl-configless-context.c11
-rw-r--r--tests/egl/egl-ext_egl_image_storage.c114
-rw-r--r--tests/egl/egl-util.c5
-rw-r--r--tests/egl/spec/egl_chromium_sync_control/egl_chromium_sync_control.c8
-rw-r--r--tests/egl/spec/egl_khr_create_context/CMakeLists.gles2.txt1
-rw-r--r--tests/egl/spec/egl_khr_create_context/core-profile.c2
-rw-r--r--tests/egl/spec/egl_khr_create_context/default-major-version-gl.c2
-rw-r--r--tests/egl/spec/egl_khr_create_context/default-major-version-gles.c2
-rw-r--r--tests/egl/spec/egl_khr_create_context/default-minor-version-gl.c2
-rw-r--r--tests/egl/spec/egl_khr_create_context/invalid-attribute-gl.c2
-rw-r--r--tests/egl/spec/egl_khr_create_context/invalid-profile.c2
-rw-r--r--tests/egl/spec/egl_khr_create_context/pre-GL32-profile.c2
-rw-r--r--tests/egl/spec/egl_khr_create_context/robustness.c162
-rw-r--r--tests/egl/spec/egl_khr_create_context/valid-attribute-empty-gl.c2
-rw-r--r--tests/egl/spec/egl_khr_create_context/valid-attribute-empty-gles.c2
-rw-r--r--tests/egl/spec/egl_khr_create_context/valid-attribute-null-gl.c2
-rw-r--r--tests/egl/spec/egl_khr_create_context/valid-attribute-null-gles.c2
-rw-r--r--tests/egl/spec/egl_khr_create_context/valid-flag-forward-compatible-gl.c2
-rw-r--r--tests/egl/spec/egl_khr_fence_sync/egl_khr_fence_sync.c8
-rw-r--r--tests/fast_color_clear/fast-slow-clear-interaction.shader_test2
-rw-r--r--tests/fast_color_clear/non-redundant-clear.shader_test2
-rw-r--r--tests/fbo/fbo-blending-format-quirks.c2
-rw-r--r--tests/fbo/fbo-blit-stretch.cpp2
-rw-r--r--tests/fbo/fbo-depth-sample-compare.c2
-rw-r--r--tests/fbo/fbo-drawbuffers-arbfp.c7
-rw-r--r--tests/fbo/fbo-drawbuffers.c6
-rw-r--r--tests/fbo/fbo-drawbuffers2-blend.c7
-rw-r--r--tests/fbo/fbo-drawbuffers2-colormask.c6
-rw-r--r--tests/fbo/fbo-fragcoord.c19
-rw-r--r--tests/fbo/fbo-mrt-alphatest.c1
-rw-r--r--tests/fbo/fbo-scissor-blit.c8
-rw-r--r--tests/fbo/fbo-viewport.c2
-rw-r--r--tests/gbm/CMakeLists.no_api.txt4
-rw-r--r--tests/gbm/gbm-device.c50
-rw-r--r--tests/gbm/gbm-multi-plane.c2
-rw-r--r--tests/general/CMakeLists.gl.txt3
-rw-r--r--tests/general/depth-clear-precision-check.c5
-rw-r--r--tests/general/depth-clear-with-copy.c105
-rw-r--r--tests/general/dlist-fdo3129-02.c2
-rw-r--r--tests/general/getactiveattrib.c2
-rw-r--r--tests/general/idtech-extension-strings.c2
-rw-r--r--tests/general/line-aa-width.c2
-rw-r--r--tests/general/line-smooth-coverage.c88
-rw-r--r--tests/general/line-smooth-stipple.c108
-rw-r--r--tests/general/object-namespace-pollution.c2
-rw-r--r--tests/general/ppgtt_memory_alignment.c2
-rw-r--r--tests/general/select.c4
-rw-r--r--tests/general/triangle-rasterization.cpp4
-rw-r--r--tests/glslparsertest/glsl2/gst-gl-sin.frag2
-rw-r--r--tests/glslparsertest/glsl2/parameters-08.vert2
-rw-r--r--tests/glslparsertest/glsl2/return-conversion-03.vert2
-rw-r--r--tests/glslparsertest/glsl2/xreal-lighting-d-omni.vert2
-rw-r--r--tests/glslparsertest/glsl2/xreal-lighting-db-omni.vert2
-rw-r--r--tests/glslparsertest/glsl2/xreal-lighting-dbs-omni.vert2
-rw-r--r--tests/glslparsertest/shaders/CorrectFull.vert2
-rw-r--r--tests/glslparsertest/shaders/CorrectPreprocess5.frag2
-rw-r--r--tests/glslparsertest/shaders/array1.frag2
-rw-r--r--tests/glslparsertest/shaders/comma2.frag2
-rw-r--r--tests/glslparsertest/shaders/function3.frag2
-rw-r--r--tests/glslparsertest/shaders/preprocess1.frag2
-rw-r--r--tests/glslparsertest/shaders/preprocess2.frag2
-rw-r--r--tests/glslparsertest/shaders/preprocess4.frag2
-rw-r--r--tests/glslparsertest/shaders/struct7.frag2
-rw-r--r--tests/glx/CMakeLists.gl.txt3
-rw-r--r--tests/glx/glx-copy-context-dest-current.c108
-rw-r--r--tests/glx/glx-make-current-other-thread.c122
-rw-r--r--tests/glx/glx-make-current.c50
-rw-r--r--tests/glx/glx-multithread-buffer.c2
-rw-r--r--tests/glx/glx-multithread-shader-compile.c2
-rw-r--r--tests/glx/glx-string-sanity.c11
-rw-r--r--tests/glx/glx-swap-event.c225
-rw-r--r--tests/hiz/hiz-util.c8
-rw-r--r--tests/llvmpipe/CMakeLists.gl.txt17
-rw-r--r--tests/llvmpipe/tests/random.h2
-rw-r--r--tests/llvmpipe/tests/test.h1
-rw-r--r--tests/llvmpipe/utils/framebuffer.h2
-rw-r--r--tests/no_error.py2
-rw-r--r--tests/opengl.py65
-rw-r--r--tests/perf/common.c2
-rw-r--r--tests/perf/draw-prim-rate.c192
-rw-r--r--tests/perf/pbobench.c25
-rw-r--r--tests/quick_shader.py2
-rw-r--r--tests/shaders/bin2h.py2
-rw-r--r--tests/shaders/built-in-constants.c4
-rw-r--r--tests/shaders/fp-indirections.c4
-rw-r--r--tests/shaders/fp-indirections2.c10
-rw-r--r--tests/shaders/fp-set-01.c4
-rw-r--r--tests/shaders/fp-set-02.c12
-rwxr-xr-xtests/shaders/getuniform-03.c4
-rw-r--r--tests/shaders/glsl-fs-raytrace-bug27060.c7
-rw-r--r--tests/shaders/glsl-light-model.c2
-rw-r--r--tests/shaders/glsl-link-initializer-03.c4
-rw-r--r--tests/shaders/glsl-max-varyings.c41
-rw-r--r--tests/shaders/glsl-vs-raytrace-bug26691.c7
-rw-r--r--tests/shaders/parser_utils.h4
-rw-r--r--tests/shaders/shader_runner.c43
-rw-r--r--tests/shaders/ssa/fs-while-loop-rotate-value.shader_test2
-rw-r--r--tests/shaders/useshaderprogram-flushverts-1.c2
-rw-r--r--tests/shaders/version-mixing.c2
-rw-r--r--tests/shaders/vp-bad-program.c4
-rw-r--r--tests/spec/CMakeLists.txt5
-rw-r--r--tests/spec/amd_gpu_shader_half_float/CMakeLists.gl.txt14
-rw-r--r--tests/spec/amd_gpu_shader_half_float/CMakeLists.txt1
-rw-r--r--tests/spec/amd_gpu_shader_half_float/compiler/builtin-functions/common/modf-f16vec2.vert4
-rw-r--r--tests/spec/amd_gpu_shader_half_float/compiler/builtin-functions/common/modf-f16vec3.vert4
-rw-r--r--tests/spec/amd_gpu_shader_half_float/compiler/builtin-functions/common/modf-f16vec4.vert4
-rw-r--r--tests/spec/amd_gpu_shader_half_float/compiler/varying_error.vert10
-rw-r--r--tests/spec/amd_gpu_shader_half_float/half-float-explicit-offset-bufferstorage.c260
-rw-r--r--tests/spec/amd_gpu_shader_half_float/half_float_util.c167
-rw-r--r--tests/spec/amd_gpu_shader_half_float/half_float_util.h33
-rw-r--r--tests/spec/apple_sync/CMakeLists.gles2.txt13
-rw-r--r--tests/spec/apple_sync/CMakeLists.txt1
-rw-r--r--tests/spec/apple_sync/ClientWaitSync-errors.c79
-rw-r--r--tests/spec/apple_sync/DeleteSync.c64
-rw-r--r--tests/spec/apple_sync/FenceSync-errors.c55
-rw-r--r--tests/spec/apple_sync/GetSynciv-errors.c74
-rw-r--r--tests/spec/apple_sync/IsSync.c67
-rw-r--r--tests/spec/apple_sync/WaitSync-errors.c62
-rw-r--r--tests/spec/apple_sync/repeat-wait.c73
-rw-r--r--tests/spec/apple_sync/sync-initialize.c116
-rw-r--r--tests/spec/apple_sync/timeout-zero.c96
-rw-r--r--tests/spec/arb_arrays_of_arrays/execution/atomic_counters/fs-indirect-index.shader_test4
-rw-r--r--tests/spec/arb_arrays_of_arrays/execution/atomic_counters/fs-simple-inc-dec-read.shader_test4
-rw-r--r--tests/spec/arb_arrays_of_arrays/execution/atomic_counters/vs-indirect-index.shader_test4
-rw-r--r--tests/spec/arb_arrays_of_arrays/execution/atomic_counters/vs-simple-inc-dec-read.shader_test4
-rw-r--r--tests/spec/arb_arrays_of_arrays/execution/glsl-arrays-copy-size-mismatch.shader_test1
-rw-r--r--tests/spec/arb_arrays_of_arrays/execution/sampler/vs-struct-nonconst-non-opaque-members.shader_test2
-rw-r--r--tests/spec/arb_arrays_of_arrays/linker/vs-to-fs-interface-field-unsized2.shader_test2
-rw-r--r--tests/spec/arb_arrays_of_arrays/max-binding.c6
-rw-r--r--tests/spec/arb_bindless_texture/errors.c2
-rw-r--r--tests/spec/arb_bindless_texture/execution/images/uniform-struct.shader_test49
-rw-r--r--tests/spec/arb_blend_func_extended/api/builtins.c14
-rw-r--r--tests/spec/arb_blend_func_extended/api/error-at-begin.c2
-rw-r--r--tests/spec/arb_blend_func_extended/api/output-location.c2
-rw-r--r--tests/spec/arb_blend_func_extended/execution/fbo-extended-blend-pattern.c8
-rw-r--r--tests/spec/arb_clear_texture/CMakeLists.gl.txt1
-rw-r--r--tests/spec/arb_clear_texture/depth.c12
-rw-r--r--tests/spec/arb_clear_texture/integer.c2
-rw-r--r--tests/spec/arb_clear_texture/supported-formats.c279
-rw-r--r--tests/spec/arb_clip_control/clip-control-depth-precision.c2
-rw-r--r--tests/spec/arb_clip_control/clip-control.c2
-rw-r--r--tests/spec/arb_color_buffer_float/mrt.c9
-rw-r--r--tests/spec/arb_compute_shader/compute-and-render-bug-109630.c4
-rw-r--r--tests/spec/arb_copy_image/CMakeLists.gl.txt1
-rw-r--r--tests/spec/arb_copy_image/api_errors.c2
-rw-r--r--tests/spec/arb_copy_image/formats.c6
-rw-r--r--tests/spec/arb_copy_image/levels-copy.c290
-rw-r--r--tests/spec/arb_cull_distance/exceed-limits.c2
-rw-r--r--tests/spec/arb_cull_distance/fs-cull-and-clip-distance-different.shader_test2
-rw-r--r--tests/spec/arb_direct_state_access/compressedtextureimage.c2
-rw-r--r--tests/spec/arb_direct_state_access/getcompressedtextureimage.c2
-rw-r--r--tests/spec/arb_direct_state_access/gettextureimage-targets.c2
-rw-r--r--tests/spec/arb_draw_buffers/state_change.c8
-rw-r--r--tests/spec/arb_draw_buffers_blend/state_set_get.c4
-rw-r--r--tests/spec/arb_explicit_attrib_location/1.10/compiler/layout-10.frag2
-rw-r--r--tests/spec/arb_explicit_attrib_location/1.10/compiler/layout-11.frag2
-rw-r--r--tests/spec/arb_explicit_attrib_location/1.10/compiler/layout-13.frag2
-rw-r--r--tests/spec/arb_explicit_attrib_location/1.20/compiler/layout-10.frag2
-rw-r--r--tests/spec/arb_explicit_attrib_location/1.20/compiler/layout-11.frag2
-rw-r--r--tests/spec/arb_explicit_attrib_location/1.20/compiler/layout-13.frag2
-rw-r--r--tests/spec/arb_explicit_attrib_location/overlapping-locations-input-attribs.c2
-rw-r--r--tests/spec/arb_explicit_uniform_location/linker/set-location-to-sampler.shader_test2
-rw-r--r--tests/spec/arb_fragment_layer_viewport/layer-gs-write-simple.shader_test10
-rw-r--r--tests/spec/arb_fragment_layer_viewport/layer-gs-writes-out-of-range.shader_test72
-rw-r--r--tests/spec/arb_fragment_layer_viewport/layer-vs-gs-write-simple.shader_test10
-rw-r--r--tests/spec/arb_fragment_layer_viewport/layer-vs-write-gs-no-write-simple.shader_test1
-rw-r--r--tests/spec/arb_fragment_layer_viewport/layer-vs-write-simple.shader_test10
-rw-r--r--tests/spec/arb_fragment_layer_viewport/viewport-gs-writes-out-of-range.shader_test73
-rw-r--r--tests/spec/arb_fragment_layer_viewport/viewport-vs-write-gs-no-write-simple.shader_test1
-rw-r--r--tests/spec/arb_fragment_program_shadow/tex-shadow2dnotdepth.shader_test41
-rw-r--r--tests/spec/arb_framebuffer_object/GenerateMipmap-versus-READ_FRAMEBUFFER.c2
-rw-r--r--tests/spec/arb_framebuffer_object/fbo-drawbuffers-none.c78
-rw-r--r--tests/spec/arb_geometry_shader4/execution/program-parameter/vertices-out.c4
-rw-r--r--tests/spec/arb_geometry_shader4/linker/2darray-vertex-index-oob.shader_test2
-rw-r--r--tests/spec/arb_get_program_binary/api-errors.c2
-rw-r--r--tests/spec/arb_get_program_binary/gpb-common.c2
-rw-r--r--tests/spec/arb_get_program_binary/retrievable_hint.c2
-rw-r--r--tests/spec/arb_get_texture_sub_image/errors.c6
-rw-r--r--tests/spec/arb_get_texture_sub_image/get.c2
-rw-r--r--tests/spec/arb_gpu_shader5/execution/built-in-functions/fs-bitfieldInsert-pow2-and-zero.shader_test46
-rw-r--r--tests/spec/arb_gpu_shader5/execution/built-in-functions/fs-ldexp.shader_test7
-rw-r--r--tests/spec/arb_gpu_shader5/execution/built-in-functions/vs-ldexp.shader_test7
-rw-r--r--tests/spec/arb_gpu_shader5/execution/instanced-inputs-built-in-variable.shader_test2
-rw-r--r--tests/spec/arb_gpu_shader5/execution/sampler_array_indexing/fs-struct-nonconst-multiple-samplers.shader_test2
-rw-r--r--tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/fs-ldexp-dvec4.shader_test7
-rw-r--r--tests/spec/arb_gpu_shader_fp64/execution/uniform-invalid-operation.c2
-rw-r--r--tests/spec/arb_gpu_shader_fp64/shader_storage/layout-std140-fp64-mixed-shader.c2
-rw-r--r--tests/spec/arb_gpu_shader_fp64/shader_storage/layout-std140-fp64-shader.c2
-rw-r--r--tests/spec/arb_gpu_shader_fp64/shader_storage/layout-std430-fp64-mixed-shader.c2
-rw-r--r--tests/spec/arb_gpu_shader_fp64/shader_storage/layout-std430-fp64-shader.c2
-rw-r--r--tests/spec/arb_gpu_shader_int64/execution/fs-ishl-then-ishr.shader_test2
-rw-r--r--tests/spec/arb_gpu_shader_int64/execution/fs-ishl-then-ushr.shader_test2
-rw-r--r--tests/spec/arb_gpu_shader_int64/execution/fs-ishr-and-mask.shader_test2
-rw-r--r--tests/spec/arb_gpu_shader_int64/execution/fs-ushr-and-mask.shader_test2
-rw-r--r--tests/spec/arb_instanced_arrays/vertex-attrib-divisor-index-error.c4
-rw-r--r--tests/spec/arb_internalformat_query2/common.c18
-rw-r--r--tests/spec/arb_internalformat_query2/generic-pname-checks.c2
-rw-r--r--tests/spec/arb_internalformat_query2/max-dimensions.c6
-rw-r--r--tests/spec/arb_map_buffer_range/map_buffer_range_error_check.c2
-rw-r--r--tests/spec/arb_map_buffer_range/map_buffer_range_test.c4
-rw-r--r--tests/spec/arb_multisample/pushpop.c2
-rw-r--r--tests/spec/arb_occlusion_query/occlusion_query.c27
-rw-r--r--tests/spec/arb_occlusion_query/occlusion_query_conform.c4
-rw-r--r--tests/spec/arb_point_parameters/point-attenuation.c25
-rw-r--r--tests/spec/arb_post_depth_coverage/basic.c2
-rwxr-xr-xtests/spec/arb_program_interface_query/getprogramresourceindex.c2
-rwxr-xr-xtests/spec/arb_program_interface_query/getprogramresourceiv.c2
-rwxr-xr-xtests/spec/arb_program_interface_query/resource-query.c4
-rw-r--r--tests/spec/arb_provoking_vertex/provoking-vertex-initial.c2
-rw-r--r--tests/spec/arb_query_buffer_object/qbo.c30
-rw-r--r--tests/spec/arb_sample_shading/execution/ignore-centroid-qualifier.cpp2
-rw-r--r--tests/spec/arb_sample_shading/execution/interpolate-at-sample-position.cpp2
-rw-r--r--tests/spec/arb_sample_shading/execution/samplemask.cpp3
-rw-r--r--tests/spec/arb_separate_shader_objects/CMakeLists.gl.txt1
-rw-r--r--tests/spec/arb_separate_shader_objects/ProgramUniform-coverage.c2
-rw-r--r--tests/spec/arb_separate_shader_objects/api-errors.c2
-rw-r--r--tests/spec/arb_separate_shader_objects/atomic-counter.c1
-rw-r--r--tests/spec/arb_separate_shader_objects/rendezvous_by_location-5-stages.c17
-rw-r--r--tests/spec/arb_separate_shader_objects/rendezvous_by_location.c8
-rw-r--r--tests/spec/arb_separate_shader_objects/xfb-explicit-location-array.c298
-rw-r--r--tests/spec/arb_shader_atomic_counters/max-counters.c2
-rw-r--r--tests/spec/arb_shader_atomic_counters/semantics.c10
-rw-r--r--tests/spec/arb_shader_image_load_store/execution/disable_early_z.shader_test2
-rw-r--r--tests/spec/arb_shader_image_load_store/grid.c2
-rw-r--r--tests/spec/arb_shader_texture_lod/execution/glsl-fs-texturelod-01.shader_test2
-rw-r--r--tests/spec/arb_tessellation_shader/execution/compatibility/vs-tcs-tes-clip-vertex-enables.shader_test2
-rw-r--r--tests/spec/arb_tessellation_shader/execution/tesslevels-indirect.shader_test52
-rw-r--r--tests/spec/arb_tessellation_shader/large-uniforms.c4
-rw-r--r--tests/spec/arb_tessellation_shader/layout-mismatch.c4
-rw-r--r--tests/spec/arb_tessellation_shader/tes-gs-max-output.cpp2
-rw-r--r--tests/spec/arb_texture_barrier/blending-in-shader-arb.c7
-rw-r--r--tests/spec/arb_texture_barrier/texture-halves-ping-pong-operation-chain.c3
-rw-r--r--tests/spec/arb_texture_buffer_object/texture-buffer-size-clamp.c10
-rw-r--r--tests/spec/arb_texture_cube_map_array/sampler-cube-array-shadow.c2
-rw-r--r--tests/spec/arb_texture_multisample/large-float-texture.c2
-rw-r--r--tests/spec/arb_texture_query_lod/execution/fs-textureQueryLOD-linear.shader_test3
-rw-r--r--tests/spec/arb_texture_query_lod/execution/fs-textureQueryLOD-nearest-biased.shader_test3
-rw-r--r--tests/spec/arb_texture_query_lod/execution/fs-textureQueryLOD-nearest.shader_test3
-rw-r--r--tests/spec/arb_texture_query_lod/execution/fs-textureQueryLOD-no-mipmap.shader_test4
-rw-r--r--tests/spec/arb_texture_storage_multisample/tex-param.c2
-rw-r--r--tests/spec/arb_texture_view/queries.c2
-rw-r--r--tests/spec/arb_timer_query/timestamp-get.c2
-rw-r--r--tests/spec/arb_transform_feedback2/api-queries.c2
-rw-r--r--tests/spec/arb_transform_feedback2/change-objects-while-paused.c2
-rw-r--r--tests/spec/arb_transform_feedback3/begin_end.c2
-rw-r--r--tests/spec/arb_transform_feedback3/set_invalid_varyings.c2
-rw-r--r--tests/spec/arb_transform_feedback3/set_varyings_with_invalid_args.c2
-rw-r--r--tests/spec/arb_transform_feedback_overflow_query/basic.c2
-rw-r--r--tests/spec/arb_uniform_buffer_object/referenced-by-shader.c2
-rw-r--r--tests/spec/arb_vertex_attrib_64bit/execution/unused-sub-dvec4-01.shader_test57
-rw-r--r--tests/spec/arb_vertex_attrib_64bit/execution/unused-sub-dvec4-02.shader_test57
-rw-r--r--tests/spec/arb_vertex_program/get-limits-without-fp.c2
-rw-r--r--tests/spec/arb_vertex_program/property-bindings.c12
-rw-r--r--tests/spec/arb_viewport_array/bounds.c6
-rw-r--r--tests/spec/arb_viewport_array/queries.c2
-rw-r--r--tests/spec/arb_viewport_array/render_scissor.c4
-rw-r--r--tests/spec/arb_viewport_array/viewport_indices.c2
-rw-r--r--tests/spec/ati_draw_buffers/arbfp-no-index.c7
-rw-r--r--tests/spec/ati_draw_buffers/arbfp-no-option.c7
-rw-r--r--tests/spec/ati_draw_buffers/arbfp.c7
-rw-r--r--tests/spec/ext_clear_texture/base-formats.c2
-rw-r--r--tests/spec/ext_debug_label/CMakeLists.gl.txt13
-rw-r--r--tests/spec/ext_debug_label/CMakeLists.gles2.txt13
-rw-r--r--tests/spec/ext_debug_label/CMakeLists.gles3.txt13
-rw-r--r--tests/spec/ext_debug_label/CMakeLists.txt1
-rw-r--r--tests/spec/ext_debug_label/debug-object-label.c436
-rw-r--r--tests/spec/ext_disjoint_timer_query/simple-query.c4
-rw-r--r--tests/spec/ext_external_objects/helpers.c17
-rw-r--r--tests/spec/ext_external_objects/params.h3
-rw-r--r--tests/spec/ext_external_objects/semaphore-api-errors.c2
-rw-r--r--tests/spec/ext_external_objects/vk.c98
-rw-r--r--tests/spec/ext_external_objects/vk_buf_exchange.c23
-rw-r--r--tests/spec/ext_external_objects/vk_depth_display.c28
-rw-r--r--tests/spec/ext_external_objects/vk_image_display.c52
-rw-r--r--tests/spec/ext_external_objects/vk_image_display_multiple_textures.c22
-rw-r--r--tests/spec/ext_external_objects/vk_image_display_overwrite.c33
-rw-r--r--tests/spec/ext_external_objects/vk_image_overwrite.c21
-rw-r--r--tests/spec/ext_external_objects/vk_pix_buf_update_errors.c12
-rw-r--r--tests/spec/ext_external_objects/vk_semaphores.c28
-rw-r--r--tests/spec/ext_external_objects/vk_semaphores2.c27
-rw-r--r--tests/spec/ext_external_objects/vk_stencil_display.c29
-rw-r--r--tests/spec/ext_external_objects/vk_vert_buf_reuse.c10
-rw-r--r--tests/spec/ext_external_objects/vk_vert_buf_update_errors.c12
-rw-r--r--tests/spec/ext_framebuffer_multisample/accuracy.cpp4
-rw-r--r--tests/spec/ext_framebuffer_multisample/blit-multiple-render-targets.cpp2
-rw-r--r--tests/spec/ext_framebuffer_multisample/clear.cpp2
-rw-r--r--tests/spec/ext_framebuffer_multisample/draw-buffers-common.cpp4
-rw-r--r--tests/spec/ext_framebuffer_multisample/fast-clear.c2
-rw-r--r--tests/spec/ext_framebuffer_multisample/interpolation.cpp2
-rw-r--r--tests/spec/ext_framebuffer_multisample/negative-mismatched-samples.c9
-rw-r--r--tests/spec/ext_framebuffer_multisample/sample-coverage.cpp2
-rw-r--r--tests/spec/ext_framebuffer_multisample/turn-on-off.cpp6
-rw-r--r--tests/spec/ext_image_dma_buf_import/CMakeLists.gles2.txt3
-rw-r--r--tests/spec/ext_image_dma_buf_import/export-tex.c9
-rw-r--r--tests/spec/ext_image_dma_buf_import/export.c4
-rw-r--r--tests/spec/ext_image_dma_buf_import/image_common.h2
-rw-r--r--tests/spec/ext_image_dma_buf_import/modifiers.c874
-rw-r--r--tests/spec/ext_image_dma_buf_import/refcount-multithread.c190
-rw-r--r--tests/spec/ext_image_dma_buf_import/refcount.c11
-rw-r--r--tests/spec/ext_image_dma_buf_import/reimport-bug.c2
-rw-r--r--tests/spec/ext_image_dma_buf_import/sample_common.c41
-rw-r--r--tests/spec/ext_image_dma_buf_import/sample_common.h5
-rw-r--r--tests/spec/ext_image_dma_buf_import/sample_yuv.c38
-rw-r--r--tests/spec/ext_instanced_arrays/CMakeLists.gles2.txt12
-rw-r--r--tests/spec/ext_instanced_arrays/CMakeLists.txt1
-rw-r--r--tests/spec/ext_instanced_arrays/instanced_arrays.c139
-rw-r--r--tests/spec/ext_instanced_arrays/vertex-attrib-divisor-index-error.c64
-rw-r--r--tests/spec/ext_occlusion_query_boolean/any-samples.c2
-rw-r--r--tests/spec/ext_packed_depth_stencil/errors.c2
-rw-r--r--tests/spec/ext_render_snorm/render.c20
-rw-r--r--tests/spec/ext_texture_env_combine/combine.c4
-rw-r--r--tests/spec/ext_texture_format_bgra8888/api-errors.c10
-rw-r--r--tests/spec/ext_texture_storage/CMakeLists.gles2.txt7
-rw-r--r--tests/spec/ext_texture_storage/CMakeLists.txt1
-rw-r--r--tests/spec/ext_texture_storage/formats.c211
-rw-r--r--tests/spec/ext_texture_swizzle/depth_texture_mode_and_swizzle.c2
-rw-r--r--tests/spec/ext_transform_feedback/api-errors.c1
-rw-r--r--tests/spec/ext_transform_feedback/builtin-varyings.c29
-rw-r--r--tests/spec/ext_transform_feedback/discard-bitmap.c2
-rw-r--r--tests/spec/ext_transform_feedback/discard-clear.c2
-rw-r--r--tests/spec/ext_transform_feedback/discard-copypixels.c2
-rw-r--r--tests/spec/ext_transform_feedback/discard-drawarrays.c2
-rw-r--r--tests/spec/ext_transform_feedback/discard-drawpixels.c2
-rw-r--r--tests/spec/ext_transform_feedback/geometry-shaders-basic.c23
-rw-r--r--tests/spec/ext_transform_feedback/max-varyings.c2
-rw-r--r--tests/spec/ext_transform_feedback/negative-prims.c2
-rw-r--r--tests/spec/ext_transform_feedback/order.c2
-rw-r--r--tests/spec/ext_transform_feedback/structs.c2
-rw-r--r--tests/spec/ext_transform_feedback/tessellation.c7
-rw-r--r--tests/spec/gl-1.0/dlist-beginend.c42
-rw-r--r--tests/spec/gl-1.0/logicop.c12
-rw-r--r--tests/spec/gl-1.0/no-op-paths.c2
-rw-r--r--tests/spec/gl-1.0/rendermode-feedback.c8
-rw-r--r--tests/spec/gl-1.0/scissor-bitmap.c16
-rw-r--r--tests/spec/gl-1.1/drawarrays-vertex-count.c2
-rw-r--r--tests/spec/gl-1.5/get-array-attribs.c2
-rw-r--r--tests/spec/gl-2.0/glsl-link-empty-prog.c2
-rw-r--r--tests/spec/gl-2.0/large-point-fs.c2
-rw-r--r--tests/spec/gl-2.1/pbo.c2
-rw-r--r--tests/spec/gl-3.0/api/bindfragdata-link-error.c4
-rw-r--r--tests/spec/gl-3.0/api/clearbuffer-mixed-format.c2
-rw-r--r--tests/spec/gl-3.0/bound-resource-limits.c12
-rw-r--r--tests/spec/gl-3.0/texture-integer.c32
-rw-r--r--tests/spec/gl-3.2/adj-prims.c2
-rw-r--r--tests/spec/gl-3.2/layered-rendering/blit.c6
-rw-r--r--tests/spec/gl-3.2/layered-rendering/clear-color.c2
-rw-r--r--tests/spec/gl-3.2/layered-rendering/clear-depth.c4
-rw-r--r--tests/spec/gl-3.2/layered-rendering/framebuffertexture-defaults.c4
-rw-r--r--tests/spec/gl-3.2/layered-rendering/gl-layer-cube-map.c4
-rw-r--r--tests/spec/gl-3.3/fb-null-attachment.shader_test33
-rw-r--r--tests/spec/gl-4.5/compare-framebuffer-parameter-with-get.c2
-rw-r--r--tests/spec/gles-3.0/CMakeLists.gles3.txt2
-rw-r--r--tests/spec/gles-3.0/clear-stencil.c231
-rw-r--r--tests/spec/gles-3.0/read-depth-offset.c252
-rw-r--r--tests/spec/gles-3.0/transform-feedback-uniform-buffer-object.c9
-rw-r--r--tests/spec/glsl-1.10/compiler/declarations/bad-array-type-global.frag2
-rw-r--r--tests/spec/glsl-1.10/compiler/declarations/bad-array-type-global.vert2
-rw-r--r--tests/spec/glsl-1.10/compiler/declarations/bad-array-type-parameter.frag2
-rw-r--r--tests/spec/glsl-1.10/compiler/declarations/bad-array-type-parameter.vert2
-rw-r--r--tests/spec/glsl-1.10/compiler/declarations/bad-array-type-struct-member.frag2
-rw-r--r--tests/spec/glsl-1.10/compiler/declarations/bad-array-type-struct-member.vert2
-rw-r--r--tests/spec/glsl-1.10/execution/built-in-matrix-state.c2
-rw-r--r--tests/spec/glsl-1.10/execution/built-in-uniform-state.c14
-rw-r--r--tests/spec/glsl-1.10/execution/builtins/glsl-fs-clamp-abs.shader_test17
-rw-r--r--tests/spec/glsl-1.10/execution/builtins/glsl-fs-clamp-neg.shader_test17
-rw-r--r--tests/spec/glsl-1.10/execution/color-interp-smooth-shademodel-flat.shader_test44
-rw-r--r--tests/spec/glsl-1.10/execution/copy-propagation/glsl-copy-propagation-loop-2.shader_test2
-rw-r--r--tests/spec/glsl-1.10/execution/copy-propagation/glsl-vs-copy-propagation-1.shader_test5
-rw-r--r--tests/spec/glsl-1.10/execution/discard/glsl-fs-discard-mrt.c9
-rw-r--r--tests/spec/glsl-1.10/execution/fs-nested-loop-unrolled-with-return.shader_test2
-rw-r--r--tests/spec/glsl-1.10/execution/fs-nested-return-in-loop-nested_in_if.shader_test2
-rw-r--r--tests/spec/glsl-1.10/execution/fs-texture-select.shader_test2
-rw-r--r--tests/spec/glsl-1.10/execution/glsl-override-builtin-2.shader_test2
-rw-r--r--tests/spec/glsl-1.10/execution/variable-indexing/vs-output-array-vec2-index-wr-no-unroll.shader_test84
-rw-r--r--tests/spec/glsl-1.10/execution/vs-loop-complex-no-unroll.shader_test68
-rw-r--r--tests/spec/glsl-1.10/execution/vs-loop-complex-with-else-break.shader_test2
-rw-r--r--tests/spec/glsl-1.10/execution/vs-loop-variable-iteration-limit-unroll4.shader_test2
-rw-r--r--tests/spec/glsl-1.10/execution/vs-multiple-shader-fragments-with-global.shader_test43
-rw-r--r--tests/spec/glsl-1.10/preprocessor/bogus-extension-test.frag2
-rw-r--r--tests/spec/glsl-1.10/preprocessor/unary-op-minus-define.shader_test19
-rw-r--r--tests/spec/glsl-1.20/compiler/structure-and-array-operations/array-size-sequence-in-parenthesis.vert2
-rw-r--r--tests/spec/glsl-1.20/compiler/structure-and-array-operations/array-size-sequence.vert2
-rw-r--r--tests/spec/glsl-1.20/execution/array_bounds/glsl-array-bounds-01.shader_test1
-rw-r--r--tests/spec/glsl-1.20/execution/array_bounds/glsl-array-bounds-02.shader_test1
-rw-r--r--tests/spec/glsl-1.20/execution/array_bounds/glsl-array-bounds-03.shader_test1
-rw-r--r--tests/spec/glsl-1.20/execution/array_bounds/glsl-array-bounds-04.shader_test1
-rw-r--r--tests/spec/glsl-1.20/execution/array_bounds/glsl-array-bounds-05.shader_test1
-rw-r--r--tests/spec/glsl-1.20/execution/array_bounds/glsl-array-bounds-06.shader_test1
-rw-r--r--tests/spec/glsl-1.20/execution/array_bounds/glsl-array-bounds-07.shader_test1
-rw-r--r--tests/spec/glsl-1.20/execution/array_bounds/glsl-array-bounds-08.shader_test1
-rw-r--r--tests/spec/glsl-1.20/execution/clipping/fixed-clip-enables.shader_test2
-rw-r--r--tests/spec/glsl-1.20/execution/clipping/vs-clip-vertex-enables.shader_test2
-rw-r--r--tests/spec/glsl-1.20/execution/fs-deref-literal-array-of-structs-with-multiple-members.shader_test2
-rw-r--r--tests/spec/glsl-1.20/recursion/recursion.c2
-rw-r--r--tests/spec/glsl-1.30/compiler/interpolation-qualifiers/local-smooth-01.frag2
-rw-r--r--tests/spec/glsl-1.30/compiler/storage-qualifiers/function-param-centroid-in-01.frag2
-rw-r--r--tests/spec/glsl-1.30/compiler/storage-qualifiers/local-centroid-in-01.frag2
-rw-r--r--tests/spec/glsl-1.30/compiler/storage-qualifiers/local-in-01.frag2
-rw-r--r--tests/spec/glsl-1.30/execution/clipping/vs-clip-distance-all-planes-enabled.shader_test2
-rw-r--r--tests/spec/glsl-1.30/execution/clipping/vs-clip-distance-bulk-assign.shader_test2
-rw-r--r--tests/spec/glsl-1.30/execution/clipping/vs-clip-distance-enables.shader_test2
-rw-r--r--tests/spec/glsl-1.30/execution/clipping/vs-clip-distance-in-param.shader_test2
-rw-r--r--tests/spec/glsl-1.30/execution/clipping/vs-clip-distance-inout-param.shader_test2
-rw-r--r--tests/spec/glsl-1.30/execution/clipping/vs-clip-distance-out-param.shader_test2
-rw-r--r--tests/spec/glsl-1.30/execution/clipping/vs-clip-distance-primitives.shader_test4
-rw-r--r--tests/spec/glsl-1.30/execution/clipping/vs-clip-distance-retval.shader_test2
-rw-r--r--tests/spec/glsl-1.30/execution/clipping/vs-clip-distance-uint-index.shader_test2
-rw-r--r--tests/spec/glsl-1.30/execution/interpolation/fs-int-interpolation.shader_test8
-rw-r--r--tests/spec/glsl-1.30/execution/interpolation/fs-uint-interpolation.shader_test8
-rw-r--r--tests/spec/glsl-1.30/execution/range_analysis_fsat_of_nan.shader_test2
-rw-r--r--tests/spec/glsl-1.30/execution/varying-packing-mixed-types.shader_test11
-rw-r--r--tests/spec/glsl-1.40/uniform_buffer/two-stages.shader_test79
-rw-r--r--tests/spec/glsl-1.50/execution/compatibility/clipping/gs-clip-vertex-enables.shader_test2
-rw-r--r--tests/spec/glsl-1.50/execution/compatibility/clipping/vs-gs-clip-vertex-enables.shader_test2
-rw-r--r--tests/spec/glsl-1.50/execution/compatibility/vs-gs-texcoord-array.shader_test6
-rw-r--r--tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-conflicting-case-2.shader_test2
-rw-r--r--tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-conflicting-case-3.shader_test2
-rw-r--r--tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-matching-case-2.shader_test2
-rw-r--r--tests/spec/glsl-1.50/execution/geometry/gs-max-output.cpp2
-rw-r--r--tests/spec/glsl-1.50/execution/geometry/tri-strip-ordering-with-prim-restart.c2
-rw-r--r--tests/spec/glsl-1.50/execution/interface-block-copy-vs-gs-fs.shader_test77
-rw-r--r--tests/spec/glsl-1.50/execution/primitive-id-no-gs-line.shader_test2
-rw-r--r--tests/spec/glsl-1.50/execution/primitive-id-no-gs-point.shader_test2
-rw-r--r--tests/spec/glsl-1.50/execution/varying-struct-basic-gs-fs.shader_test36
-rw-r--r--tests/spec/glsl-1.50/execution/varying-struct-basic-vs-fs.shader_test36
-rw-r--r--tests/spec/glsl-1.50/execution/varying-struct-basic-vs-gs.shader_test37
-rw-r--r--tests/spec/glsl-1.50/execution/vs-input-arrays.c2
-rw-r--r--tests/spec/glsl-1.50/execution/vs-named-block-no-modify.c2
-rw-r--r--tests/spec/glsl-es-1.00/execution/glsl-no-vertex-attribs.shader_test2
-rw-r--r--tests/spec/glsl-es-1.00/linker/fface-invariant.c11
-rw-r--r--tests/spec/glsl-es-3.00/execution/varying-struct-basic.shader_test36
-rw-r--r--tests/spec/glx_arb_create_context/invalid-attribute.c2
-rw-r--r--tests/spec/glx_arb_create_context/invalid-gl-version.c2
-rw-r--r--tests/spec/glx_arb_create_context/invalid-reset-strategy.c2
-rw-r--r--tests/spec/glx_ext_import_context/common.c3
-rw-r--r--tests/spec/glx_ext_import_context/query-context-info.c2
-rw-r--r--tests/spec/intel_performance_query/issue_2235.c2
-rw-r--r--tests/spec/intel_shader_atomic_float_minmax/execution/ssbo-atomicCompSwap-float-NaN.shader_test4
-rw-r--r--tests/spec/intel_shader_atomic_float_minmax/execution/ssbo-atomicMax-float-NaN.shader_test28
-rw-r--r--tests/spec/intel_shader_atomic_float_minmax/execution/ssbo-atomicMin-float-NaN.shader_test28
-rw-r--r--tests/spec/khr_debug/debug-push-pop-group.c2
-rw-r--r--tests/spec/khr_texture_compression_astc/khr_compressed_astc-miptree.c2
-rw-r--r--tests/spec/khr_texture_compression_astc/khr_compressed_astc-sliced-3d-miptree.c2
-rw-r--r--tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-ldexp.shader_test7
-rw-r--r--tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-ldexp.shader_test7
-rw-r--r--tests/spec/nv_conditional_render/begin-while-active.c2
-rw-r--r--tests/spec/nv_copy_image/formats.c4
-rw-r--r--tests/spec/nv_copy_image/simple.c21
-rw-r--r--tests/spec/nv_texture_env_combine4/combine.c2
-rw-r--r--tests/spec/oes_texture_compression_astc/oes_compressed_astc-miptree-3d.c2
-rw-r--r--tests/spec/oes_viewport_array/viewport-gs-writes-out-of-range.shader_test71
-rw-r--r--tests/texturing/CMakeLists.gl.txt1
-rw-r--r--tests/texturing/compressedteximage.c3
-rw-r--r--tests/texturing/copyteximage.c4
-rw-r--r--tests/texturing/fxt1-teximage.c2
-rw-r--r--tests/texturing/gen-compressed-teximage.c2
-rw-r--r--tests/texturing/gen-nonzero-unit.c2
-rw-r--r--tests/texturing/gen-teximage.c2
-rw-r--r--tests/texturing/gen-texsubimage.c2
-rw-r--r--tests/texturing/getteximage-targets.c2
-rw-r--r--tests/texturing/rg-teximage-common.c2
-rw-r--r--tests/texturing/s3tc-errors.c2
-rw-r--r--tests/texturing/s3tc-teximage.c2
-rw-r--r--tests/texturing/s3tc-texsubimage.c2
-rw-r--r--tests/texturing/shaders/texelFetch.c2
-rw-r--r--tests/texturing/shaders/textureGather.c2
-rw-r--r--tests/texturing/tex3d-npot.c23
-rw-r--r--tests/texturing/texdepth.c12
-rw-r--r--tests/texturing/teximage-colors.c10
-rw-r--r--tests/texturing/texsubimage-sync.c102
-rw-r--r--tests/texturing/texsubimage.c12
-rw-r--r--tests/util/config.h.in1
-rw-r--r--tests/util/minmax-test.c2
-rw-r--r--tests/util/piglit-dispatch.c2
-rw-r--r--tests/util/piglit-fbo.cpp2
-rw-r--r--tests/util/piglit-framework-cl-api.h2
-rw-r--r--tests/util/piglit-framework-cl-custom.h2
-rw-r--r--tests/util/piglit-framework-cl-program.h2
-rw-r--r--tests/util/piglit-framework-cl.h6
-rw-r--r--tests/util/piglit-framework-gl.c2
-rw-r--r--tests/util/piglit-framework-gl.h2
-rw-r--r--tests/util/piglit-framework-gl/README.txt2
-rw-r--r--tests/util/piglit-framework-gl/piglit_drm_dma_buf.c121
-rw-r--r--tests/util/piglit-framework-gl/piglit_drm_dma_buf.h9
-rw-r--r--tests/util/piglit-framework-gl/piglit_fbo_framework.c6
-rw-r--r--tests/util/piglit-framework-gl/piglit_gl_framework.h2
-rw-r--r--tests/util/piglit-framework-gl/piglit_glut_framework.c2
-rw-r--r--tests/util/piglit-framework-gl/piglit_wfl_framework.c16
-rw-r--r--tests/util/piglit-framework-gl/piglit_wgl_framework.c86
-rw-r--r--tests/util/piglit-framework-gl/piglit_winsys_framework.c4
-rw-r--r--tests/util/piglit-framework-gl/piglit_wl_framework.c2
-rw-r--r--tests/util/piglit-glx-util.c8
-rw-r--r--tests/util/piglit-matrix.c4
-rw-r--r--tests/util/piglit-shader.c1
-rw-r--r--tests/util/piglit-subprocess.c127
-rw-r--r--tests/util/piglit-util-cl.c40
-rw-r--r--tests/util/piglit-util-cl.h36
-rw-r--r--tests/util/piglit-util-gl.c170
-rw-r--r--tests/util/piglit-util-gl.h7
-rw-r--r--tests/util/piglit-util-waffle.c21
-rw-r--r--tests/util/piglit-util-waffle.h8
-rw-r--r--tests/util/piglit-util.c2
-rw-r--r--tests/util/piglit-util.h4
-rw-r--r--tests/util/piglit_ktx.c14
-rw-r--r--tests/util/piglit_ktx.h4
-rw-r--r--tests/wayland/CMakeLists.no_api.txt28
-rw-r--r--tests/wayland/CMakeLists.txt1
-rw-r--r--tests/wayland/wayland-dmabuf-target.c243
526 files changed, 8744 insertions, 1906 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 704129474..e3c964a67 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -43,4 +43,8 @@ IF(PIGLIT_BUILD_CL_TESTS)
add_subdirectory (cl)
ENDIF(PIGLIT_BUILD_CL_TESTS)
+if(PIGLIT_USE_WAYLAND)
+ add_subdirectory (wayland)
+ENDIF(PIGLIT_USE_WAYLAND)
+
piglit_include_target_api()
diff --git a/tests/cl/api/build-program.c b/tests/cl/api/build-program.c
index 4e23cc405..d8d10452c 100644
--- a/tests/cl/api/build-program.c
+++ b/tests/cl/api/build-program.c
@@ -54,7 +54,7 @@ const char* strings[] = {
};
const char* invalid_strings[] = {
- "kernel void dummy_kernel {}", // missing brackets intentionaly
+ "kernel void dummy_kernel {}", // missing brackets intentionally
};
const char* empty_strings[] = {
diff --git a/tests/cl/api/create-context.c b/tests/cl/api/create-context.c
index 4999bbf9b..6eb475815 100644
--- a/tests/cl/api/create-context.c
+++ b/tests/cl/api/create-context.c
@@ -256,7 +256,7 @@ piglit_cl_test(const int argc,
if(env->version >= 11) {
test(invalid_context_properties, num_devices, devices, NULL, NULL,
CL_INVALID_PROPERTY, &result,
- "Trigger CL_INVALID_PROPERTY if context property name in poperties is not a supported property name");
+ "Trigger CL_INVALID_PROPERTY if context property name in properties is not a supported property name");
test(multiple_platform_context_properties, num_devices, devices,
NULL, NULL,
CL_INVALID_PROPERTY, &result,
diff --git a/tests/cl/api/create-program-with-binary.c b/tests/cl/api/create-program-with-binary.c
index 3f62cd88f..2d5dc2e49 100644
--- a/tests/cl/api/create-program-with-binary.c
+++ b/tests/cl/api/create-program-with-binary.c
@@ -168,8 +168,15 @@ piglit_cl_test(const int argc,
goto fail;
}
+ /* test0: Pass binary program to clBuildProgram() */
+ errNo = clBuildProgram(binary_program, ctx->num_devices,
+ ctx->device_ids, NULL, NULL, NULL);
+ if (!piglit_cl_check_error(errNo, CL_SUCCESS)) {
+ fprintf(stderr, "Failed to compile binary program.");
+ piglit_merge_result(&result, PIGLIT_FAIL);
+ }
- /* test0: Execute a binary program */
+ /* test1: Execute a binary program */
kernel = clCreateKernel(binary_program, "dummy_kernel", &errNo);
if (!piglit_cl_check_error(errNo, CL_SUCCESS)) {
@@ -177,7 +184,7 @@ piglit_cl_test(const int argc,
"(error code: %s)\n",
piglit_cl_get_error_name(errNo));
piglit_merge_result(&result, PIGLIT_FAIL);
- goto done_test0;
+ goto fail;
}
for (i = 0; i < ctx->num_devices; i++) {
@@ -190,29 +197,20 @@ piglit_cl_test(const int argc,
fprintf(stderr, "Failed to execute binary kernel.");
piglit_merge_result(&result, PIGLIT_FAIL);
}
+ clFinish(queue);
}
clReleaseKernel(kernel);
-done_test0:
-
- /* test1: Pass binary program to clBuildProgram() */
- errNo = clBuildProgram(binary_program, ctx->num_devices,
- ctx->device_ids, NULL, NULL, NULL);
- if (!piglit_cl_check_error(errNo, CL_SUCCESS)) {
- fprintf(stderr, "Failed to compile binary program.");
- piglit_merge_result(&result, PIGLIT_FAIL);
- }
/* test2 Pass binary program to clCompileProgram() */
#ifdef CL_VERSION_1_2
-
if (piglit_cl_get_platform_version(ctx->platform_id) >= 12) {
errNo = clCompileProgram(binary_program, ctx->num_devices,
ctx->device_ids, NULL, 0, NULL, NULL,
NULL, NULL);
if (!piglit_cl_check_error(errNo, CL_INVALID_OPERATION)) {
- fprintf(stderr, "Passing a binary program to "
+ fprintf(stderr, "if program has no source or IL available"
"clCompileProgram() should return "
"CL_INVALID_OPERATION");
piglit_merge_result(&result, PIGLIT_FAIL);
diff --git a/tests/cl/api/create-program-with-source.c b/tests/cl/api/create-program-with-source.c
index f0d6f3c3d..857257b48 100644
--- a/tests/cl/api/create-program-with-source.c
+++ b/tests/cl/api/create-program-with-source.c
@@ -142,7 +142,7 @@ piglit_cl_test(const int argc,
"Create program with 1 source string and defined length");
test(env->context->cl_ctx, 1, &strings[i], NULL,
CL_SUCCESS, &result,
- "Create program with 1 source string and lenghts == NULL");
+ "Create program with 1 source string and lengths == NULL");
/* all, i-th length is 0 */
partial_lengths[i] = 0;
@@ -150,7 +150,7 @@ piglit_cl_test(const int argc,
test(env->context->cl_ctx, 2, strings, partial_lengths,
CL_SUCCESS, &result,
- "Create program with multiple source strings and only some lenghts defined (others are NULL)");
+ "Create program with multiple source strings and only some lengths defined (others are NULL)");
free(partial_lengths);
}
@@ -161,7 +161,7 @@ piglit_cl_test(const int argc,
"Create program with multiple source strings and defined lengths");
test(env->context->cl_ctx, 2, strings, NULL,
CL_SUCCESS, &result,
- "Create program with multiple source strings and lenghts == NULL");
+ "Create program with multiple source strings and lengths == NULL");
/*** Errors ***/
diff --git a/tests/cl/api/enqueue-fill-image.c b/tests/cl/api/enqueue-fill-image.c
index 4de5dcaf3..edb3e0888 100644
--- a/tests/cl/api/enqueue-fill-image.c
+++ b/tests/cl/api/enqueue-fill-image.c
@@ -145,7 +145,7 @@ piglit_cl_test(const int argc,
/*
* fill the host buffer with the pattern
- * for exemple : pattern == 1234
+ * for example : pattern == 1234
*
* 12341234abcdabcd
* 12341234abcdabcd
diff --git a/tests/cl/api/enqueue-read_write-buffer.c b/tests/cl/api/enqueue-read_write-buffer.c
index c7ca9a49f..6fd902629 100644
--- a/tests/cl/api/enqueue-read_write-buffer.c
+++ b/tests/cl/api/enqueue-read_write-buffer.c
@@ -423,22 +423,22 @@ piglit_cl_test(const int argc,
BUFFER_SIZE+1, host_buffer_write,
0, NULL, NULL,
CL_INVALID_VALUE, &result,
- "Trigger CL_INVALID_VALUE when the region being read spcified by (offset, cb) is out of bounds");
+ "Trigger CL_INVALID_VALUE when the region being read specified by (offset, cb) is out of bounds");
test_read(env->context->command_queues[0], mem, true, 0,
BUFFER_SIZE+1, host_buffer_read,
0, NULL, NULL,
CL_INVALID_VALUE, &result,
- "Trigger CL_INVALID_VALUE when the region being read spcified by (offset, cb) is out of bounds");
+ "Trigger CL_INVALID_VALUE when the region being read specified by (offset, cb) is out of bounds");
test_write(env->context->command_queues[0], mem, true, 1,
BUFFER_SIZE, host_buffer_write,
0, NULL, NULL,
CL_INVALID_VALUE, &result,
- "Trigger CL_INVALID_VALUE when the region being read spcified by (offset, cb) is out of bounds");
+ "Trigger CL_INVALID_VALUE when the region being read specified by (offset, cb) is out of bounds");
test_read(env->context->command_queues[0], mem, true, 1,
BUFFER_SIZE, host_buffer_read,
0, NULL, NULL,
CL_INVALID_VALUE, &result,
- "Trigger CL_INVALID_VALUE when the region being read spcified by (offset, cb) is out of bounds");
+ "Trigger CL_INVALID_VALUE when the region being read specified by (offset, cb) is out of bounds");
test_write(env->context->command_queues[0], mem, true, 0,
BUFFER_SIZE, NULL,
0, NULL, NULL,
diff --git a/tests/cl/api/get-device-info.c b/tests/cl/api/get-device-info.c
index 7d2c0c5b3..ba9622118 100644
--- a/tests/cl/api/get-device-info.c
+++ b/tests/cl/api/get-device-info.c
@@ -58,7 +58,7 @@ static bool
check_size(size_t expected_size, size_t actual_size, enum piglit_result *result) {
if (expected_size != actual_size) {
printf(": failed, expected and actual size differ. Expect %lu, got %lu",
- expected_size, actual_size);
+ (unsigned long) expected_size, (unsigned long) actual_size);
piglit_merge_result(result, PIGLIT_FAIL);
return false;
}
@@ -119,7 +119,7 @@ check_sub_string(char* expected_sub, char* actual_value, enum piglit_result *res
static bool
check_min_int(size_t expected, size_t actual_value, enum piglit_result *result) {
if (actual_value < expected) {
- printf(": failed, expected at least %lu, got %lu ", expected, actual_value);
+ printf(": failed, expected at least %lu, got %lu ", (unsigned long) expected, (unsigned long) actual_value);
piglit_merge_result(result, PIGLIT_FAIL);
return false;
}
@@ -130,7 +130,7 @@ check_min_int(size_t expected, size_t actual_value, enum piglit_result *result)
static bool
check_max_int(size_t expected, size_t actual_value, enum piglit_result *result) {
if (actual_value > expected) {
- printf(": failed, expected at most %lu, got %lu ", expected, actual_value);
+ printf(": failed, expected at most %lu, got %lu ", (unsigned long) expected, (unsigned long) actual_value);
piglit_merge_result(result, PIGLIT_FAIL);
return false;
}
@@ -324,7 +324,7 @@ check_info(const struct piglit_cl_api_test_env* env,
case CL_DEVICE_IMAGE_MAX_BUFFER_SIZE:
valid = check_size(sizeof(size_t), param_value_size, result);
if (valid && device_config->has_image) {
- check_min_int(65536, *(size_t*)param_value, result);
+ valid = check_min_int(65536, *(size_t*)param_value, result);
}
if (valid) {
@@ -335,7 +335,7 @@ check_info(const struct piglit_cl_api_test_env* env,
case CL_DEVICE_IMAGE2D_MAX_HEIGHT:
valid = check_size(sizeof(size_t), param_value_size, result);
if (valid && device_config->has_image) {
- check_min_int(8192, *(size_t*)param_value, result);
+ valid = check_min_int(8192, *(size_t*)param_value, result);
}
if (valid) {
@@ -348,7 +348,7 @@ check_info(const struct piglit_cl_api_test_env* env,
case CL_DEVICE_IMAGE3D_MAX_DEPTH:
valid = check_size(sizeof(size_t), param_value_size, result);
if (valid && device_config->has_image) {
- check_min_int(2048, *(size_t*)param_value, result);
+ valid = check_min_int(2048, *(size_t*)param_value, result);
}
if (valid) {
@@ -558,7 +558,7 @@ check_info(const struct piglit_cl_api_test_env* env,
case CL_DEVICE_PARTITION_PROPERTIES:
if (param_value_size < sizeof(cl_device_partition_property)) {
printf(": failed, expected and actual size differ. Expect >=%lu, got %lu",
- sizeof(cl_device_partition_property), param_value_size);
+ (unsigned long) sizeof(cl_device_partition_property), (unsigned long) param_value_size);
piglit_merge_result(result, PIGLIT_FAIL);
} else {
// TODO this a array of cl_device_partition_property
@@ -594,7 +594,7 @@ check_info(const struct piglit_cl_api_test_env* env,
if (param_value_size) {
if (param_value_size < sizeof(cl_device_affinity_domain)) {
printf(": failed, expected and actual size differ. Expect >=%lu, got %lu",
- sizeof(cl_device_affinity_domain), param_value_size);
+ (unsigned long) sizeof(cl_device_affinity_domain), (unsigned long) param_value_size);
piglit_merge_result(result, PIGLIT_FAIL);
} else {
printf(": %lx", *(cl_device_affinity_domain*)param_value);
@@ -651,9 +651,9 @@ piglit_cl_test(const int argc,
if (env->version >= 12) {
// for some check we need some infos to be read before others
- // piglit-util-cl-enum could be re ordered partialy
+ // piglit-util-cl-enum could be re ordered partially
// the first 10 elements are ok,
- // after that we want to start with dependant stuff
+ // after that we want to start with dependent stuff
int sorted_idx;
cl_device_info *sorted_infos = malloc(sizeof(cl_device_info) * num_device_infos);
memcpy(sorted_infos, device_infos_enum, sizeof(cl_device_info) * 10);
diff --git a/tests/cl/api/get-kernel-arg-info.c b/tests/cl/api/get-kernel-arg-info.c
index 7b34724a1..6fc0e7519 100644
--- a/tests/cl/api/get-kernel-arg-info.c
+++ b/tests/cl/api/get-kernel-arg-info.c
@@ -159,7 +159,7 @@ piglit_cl_test(const int argc,
if (ret_value_size != expected_size) {
fprintf(stderr,
"Failed: the returned size doesn't matches. Expected %lu, got %lu\n",
- expected_size, ret_value_size);
+ (unsigned long) expected_size, (unsigned long) ret_value_size);
piglit_merge_result(&result, PIGLIT_FAIL);
}
diff --git a/tests/cl/api/get-kernel-info.c b/tests/cl/api/get-kernel-info.c
index 56bdfc9ff..31652a989 100644
--- a/tests/cl/api/get-kernel-info.c
+++ b/tests/cl/api/get-kernel-info.c
@@ -53,7 +53,7 @@ static bool
check_size(size_t expected_size, size_t actual_size, enum piglit_result *result) {
if (expected_size != actual_size) {
printf(": failed, expected and actual size differ. Expect %lu, got %lu",
- expected_size, actual_size);
+ (unsigned long) expected_size, (unsigned long) actual_size);
piglit_merge_result(result, PIGLIT_FAIL);
return false;
}
diff --git a/tests/cl/api/get-kernel-work-group-info.c b/tests/cl/api/get-kernel-work-group-info.c
index 9b92497ef..e338b76a8 100644
--- a/tests/cl/api/get-kernel-work-group-info.c
+++ b/tests/cl/api/get-kernel-work-group-info.c
@@ -53,7 +53,7 @@ static bool
check_size(size_t expected_size, size_t actual_size, enum piglit_result *result) {
if (expected_size != actual_size) {
printf(": failed, expected and actual size differ. Expect %lu, got %lu",
- expected_size, actual_size);
+ (unsigned long) expected_size, (unsigned long) actual_size);
piglit_merge_result(result, PIGLIT_FAIL);
return false;
}
@@ -157,7 +157,7 @@ piglit_cl_test(const int argc,
#if defined(CL_VERSION_1_2)
/* CL_KERNEL_GLOBAL_WORK_SIZE query
- * is valid for custom device or build-in kernel
+ * is valid for custom device or built-in kernel
*/
if (kernel_work_group_infos[i] == CL_KERNEL_GLOBAL_WORK_SIZE) {
cl_device_type* dev_type_ptr =
diff --git a/tests/cl/api/get-mem-object-info.c b/tests/cl/api/get-mem-object-info.c
index 5dcb4752d..3e70ca2d1 100644
--- a/tests/cl/api/get-mem-object-info.c
+++ b/tests/cl/api/get-mem-object-info.c
@@ -115,7 +115,7 @@ test(int n,
if (param_value_size != sizeof(_type_)) { \
fprintf(stderr, \
"Buffer %d, failed: the returned size doesn't match. Expected %lu, got %lu\n", \
- n, sizeof(_type_), param_value_size); \
+ n, (unsigned long) sizeof(_type_), (unsigned long) param_value_size); \
return PIGLIT_FAIL; \
}
diff --git a/tests/cl/program/bitcoin-phatk.c b/tests/cl/program/bitcoin-phatk.c
index f57d41b27..563483280 100644
--- a/tests/cl/program/bitcoin-phatk.c
+++ b/tests/cl/program/bitcoin-phatk.c
@@ -143,7 +143,7 @@ char *source =
-"//Partial W calculations (used for the begining where only some values are nonzero)\n"
+"//Partial W calculations (used for the beginning where only some values are nonzero)\n"
"#define P1(n) ((rot(W[(n)-2],15u)^rot(W[(n)-2],13u)^((W[(n)-2])>>10U)))\n"
"#define P2(n) ((rot(W[(n)-15],25u)^rot(W[(n)-15],14u)^((W[(n)-15])>>3U)))\n"
diff --git a/tests/cl/program/execute/builtin/convert/float-convert_long.cl b/tests/cl/program/execute/builtin/convert/float-convert_long.cl
index c8baa3845..3aea84f04 100644
--- a/tests/cl/program/execute/builtin/convert/float-convert_long.cl
+++ b/tests/cl/program/execute/builtin/convert/float-convert_long.cl
@@ -9,7 +9,7 @@ local_size: 1 1 1
name: convert_long(float)
kernel_name: test_long
arg_out: 0 buffer long[8] 0 36864 -47104 41943040 -35651584 131 5000000000 -6000000000
-# These values were choosen to exercise all code paths in the generic
+# These values were chosen to exercise all code paths in the generic
# implementation of __fixsfdi in compiler-rt:
# https://github.com/llvm-mirror/compiler-rt/blob/master/lib/builtins/fixsfdi.c
arg_in: 1 buffer float[8] 0x1.2p-5 \ # exp < 0
@@ -25,7 +25,7 @@ arg_in: 1 buffer float[8] 0x1.2p-5 \ # exp < 0
name: convert_ulong(float)
kernel_name: test_ulong
arg_out: 0 buffer ulong[8] 0 36864 47104 41943040 35651584 131 5000000000 9223372036854775808
-# These values were choosen to exercise all code paths in the generic
+# These values were chosen to exercise all code paths in the generic
# implementation of __fixsfdi in compiler-rt:
# https://github.com/llvm-mirror/compiler-rt/blob/master/lib/builtins/fixsfdi.c
arg_in: 1 buffer float[8] 0x1.2p-5 \ # exp < 0
diff --git a/tests/cl/program/execute/non-entry-block-alloca.cl b/tests/cl/program/execute/non-entry-block-alloca.cl
new file mode 100644
index 000000000..735fca19b
--- /dev/null
+++ b/tests/cl/program/execute/non-entry-block-alloca.cl
@@ -0,0 +1,104 @@
+/*!
+
+# FIXME: This requires OpenCL 2.0 due to a bug in the
+# __builtin_alloca handling, which is incorrectly returning a
+# generic pointer instead of private.
+
+# TODO: Also stress __builtin_alloca_with_align, and in non-kernel
+# functions.
+
+[config]
+name: kernel with builtin_alloca
+build_options: -cl-std=CL2.0
+clc_version_min: 20
+
+[test]
+name: builtin alloca outside control flow
+kernel_name: non_entry_block_alloca_kernel_constant_size
+dimensions: 1
+global_size: 32 0 0
+local_size: 32 0 0
+
+arg_out: 0 buffer int[32] \
+ 0x07080900 0x07080901 0x07080902 0x07080903 0x07080904 \
+ 0x07080905 0x07080906 0x07080907 0x07080908 0x07080909 \
+ 0x0708090a 0x0708090b 0x0708090c 0x0708090d 0x0708090e \
+ 0x0708090f 0x07080910 0x07080911 0x07080912 0x07080913 \
+ 0x07080914 0x07080915 0x07080916 0x07080917 0x07080918 \
+ 0x07080919 0x0708091a 0x0708091b 0x0708091c 0x0708091d \
+ 0x0708091e 0x0708091f
+
+arg_out: 1 buffer int[12] \
+ 0xdeadbeef 0xfeedbeef 0x1234abcd 0x8910ddbb \
+ 0x11111111 0x22222222 0x33333333 0x44444444 \
+ 0x55555555 0x66666666 0x77777777 0x88888888
+
+arg_in: 2 int 1
+
+!*/
+
+// The point is to stress __builtin_alloca, but we don't have a way to
+// skip the test if it's not supported.
+
+#ifndef __has_builtin
+ #define __has_builtin(x) 0
+#endif
+
+kernel void non_entry_block_alloca_kernel_constant_size(
+ global int* out0, global int* out1, int c) {
+#if !__has_builtin(__builtin_alloca)
+ volatile private int alloc_ptr[32];
+#endif
+
+ const int num_alloca_elts = 32;
+
+ // Add a static sized object to make sure it isn't clobbered in the
+ // dynamic region. Ideally this will exceed the wave size in bytes.
+ volatile int other_array[12] = {
+ 0xffffffff, 0xffffeeee, 0x11111111, 0xf0f0f0f0,
+ 0x99999999, 0xaaaaaaaa, 0xbbbbbbbb, 0x0f0f0f0f,
+ 0x88988989, 0x59419293, 0x02349249, 0x92392399
+ };
+
+ int lid = get_local_id(0);
+
+ if (c) {
+#if __has_builtin(__builtin_alloca)
+ // Allocate a fixed size amount outside of the entry block.
+ // FIXME: to_private should be unnecessary.
+ volatile private int* alloc_ptr =
+ to_private(__builtin_alloca(num_alloca_elts * sizeof(int)));
+#endif
+
+ // Write some sample values to the dynamic stack object.
+ for (int i = 0; i < num_alloca_elts; ++i) {
+ const int test_val = 0x07080900 | i;
+ alloc_ptr[i] = test_val;
+ }
+
+ // Write some new values to the static object to make sure nothing
+ // is clobbered.
+ other_array[0] = 0xdeadbeef;
+ other_array[1] = 0xfeedbeef;
+ other_array[2] = 0x1234abcd;
+ other_array[3] = 0x8910ddbb;
+ other_array[4] = 0x11111111;
+ other_array[5] = 0x22222222;
+ other_array[6] = 0x33333333;
+ other_array[7] = 0x44444444;
+ other_array[8] = 0x55555555;
+ other_array[9] = 0x66666666;
+ other_array[10] = 0x77777777;
+ other_array[11] = 0x88888888;
+
+ // Make sure we got the right values in the alloca block.
+ out0[lid] = alloc_ptr[lid];
+ }
+
+ if (lid == 0) {
+ // Make sure the other array wasn't clobbered.
+ for (int i = 0; i < 12; ++i) {
+ out1[i] = other_array[i];
+ }
+ }
+}
diff --git a/tests/cl/program/execute/reference.cl b/tests/cl/program/execute/reference.cl
index e0295c184..76fe10bcb 100644
--- a/tests/cl/program/execute/reference.cl
+++ b/tests/cl/program/execute/reference.cl
@@ -1,6 +1,6 @@
/*!
[config]
-name: Reference and dereferance operators
+name: Reference and dereference operators
clc_version_min: 10
[test]
diff --git a/tests/cl/program/program-tester.c b/tests/cl/program/program-tester.c
index f70497b08..e47fb5aac 100644
--- a/tests/cl/program/program-tester.c
+++ b/tests/cl/program/program-tester.c
@@ -31,10 +31,13 @@
#include <inttypes.h>
#include <math.h>
#include <regex.h>
-#include <libgen.h>
#include "piglit-framework-cl-program.h"
+#ifdef HAVE_LIBGEN_H
+#include <libgen.h>
+#endif
+
/* Regexes */
/*
@@ -983,7 +986,7 @@ get_test_arg_value(struct test_arg* test_arg, const char* value, size_t length)
size_t i; // index in array
size_t c; // component in element
size_t ra; // offset from the beginning of array
- size_t rb; // offset from the beginning of bufffer
+ size_t rb; // offset from the beginning of buffer
int64_t* int_array = NULL;
uint64_t* uint_array = NULL;
@@ -2180,7 +2183,7 @@ test_kernel(const struct piglit_cl_program_test_config* config,
return PIGLIT_SKIP;
}
- /* Create or use apropriate kernel */
+ /* Create or use appropriate kernel */
if(test.kernel_name == NULL) {
kernel_name = config->kernel_name;
kernel = env->kernel;
diff --git a/tests/deqp_gles3.py b/tests/deqp_gles3.py
index 6a7806e92..e383e57e4 100644
--- a/tests/deqp_gles3.py
+++ b/tests/deqp_gles3.py
@@ -32,7 +32,7 @@ __all__ = ['profile']
def _deprecated_get(env_, conf_, dep_env=None, dep_conf=('', ''), **kwargs):
- """Attempt to get deprecated values, then modern vaules.
+ """Attempt to get deprecated values, then modern values.
If a deprecated value is found give the user a warning, this uses
deqp_get_option internally for both the deprecated and undeprecated paths,
diff --git a/tests/egl/egl-configless-context.c b/tests/egl/egl-configless-context.c
index dbbc1496c..0fe018e67 100644
--- a/tests/egl/egl-configless-context.c
+++ b/tests/egl/egl-configless-context.c
@@ -311,14 +311,23 @@ run_tests(struct state *state)
"warning: not testing binding draw and read surfaces "
"with different configs\n");
} else {
+ bool khr = piglit_is_egl_extension_supported(state->egl_dpy,
+ "EGL_KHR_no_config_context");
status = eglMakeCurrent(state->egl_dpy,
shallow->surface,
other_window->surface,
state->ctx);
- if (status) {
+
+ /* The Khronos extension (implicitly) allows this */
+ if (status && !khr) {
fprintf(stderr,
"Binding incompatible surfaces together "
"unexpectedly succeeded\n");
+ piglit_report_result(PIGLIT_WARN);
+ } else if (!status && khr) {
+ fprintf(stderr,
+ "Binding incompatible surfaces together "
+ "unexpectedly failed\n");
piglit_report_result(PIGLIT_FAIL);
}
}
diff --git a/tests/egl/egl-ext_egl_image_storage.c b/tests/egl/egl-ext_egl_image_storage.c
index 4a052fb86..2010a95e5 100644
--- a/tests/egl/egl-ext_egl_image_storage.c
+++ b/tests/egl/egl-ext_egl_image_storage.c
@@ -30,7 +30,7 @@
PIGLIT_GL_TEST_CONFIG_BEGIN
- config.supports_gl_es_version = 31;
+ config.supports_gl_es_version = 30;
PIGLIT_GL_TEST_CONFIG_END
@@ -102,6 +102,113 @@ test_invalid_params(EGLImageKHR egl_image)
}
}
+static bool
+test_invalid_target_dmabuf(EGLDisplay dpy)
+{
+ /*
+ * EXT_EGL_image_storage
+ *
+ * If the EGL image was created using EGL_EXT_image_dma_buf_import,
+ * then the following applies:
+ *
+ * - <target> must be GL_TEXTURE_2D or GL_TEXTURE_EXTERNAL_OES.
+ * Otherwise, the error INVALID_OPERATION is generated.
+ */
+
+ if (!piglit_is_egl_extension_supported(dpy,
+ "EGL_MESA_image_dma_buf_export") ||
+ !piglit_is_egl_extension_supported(dpy,
+ "EGL_EXT_image_dma_buf_import")) {
+ piglit_logi("dma_buf export and/or import ext not available\n");
+ return true;
+ }
+
+ int w = 32, h = 32;
+
+ GLuint tex;
+ glGenTextures(1, &tex);
+ glBindTexture(GL_TEXTURE_3D, tex);
+ glTexStorage3D(GL_TEXTURE_3D, 1, GL_RGBA8, w, h, 1);
+
+ EGLImage img = eglCreateImage(dpy, eglGetCurrentContext(),
+ EGL_GL_TEXTURE_3D, (EGLClientBuffer)(uintptr_t)tex, NULL);
+ if (!img) {
+ piglit_loge("failed to create EGLImage\n");
+ return false;
+ }
+ glDeleteTextures(1, &tex);
+
+ PFNEGLEXPORTDMABUFIMAGEQUERYMESAPROC dmabuf_query;
+ PFNEGLEXPORTDMABUFIMAGEMESAPROC dmabuf_export;
+
+ dmabuf_query =
+ (PFNEGLEXPORTDMABUFIMAGEQUERYMESAPROC) eglGetProcAddress(
+ "eglExportDMABUFImageQueryMESA");
+ dmabuf_export =
+ (PFNEGLEXPORTDMABUFIMAGEMESAPROC) eglGetProcAddress(
+ "eglExportDMABUFImageMESA");
+
+ if (!dmabuf_query || !dmabuf_export) {
+ piglit_loge("could not find extension entrypoints\n");
+ return false;
+ }
+
+ int fourcc = -1;
+ int num_planes = -1;
+ EGLuint64KHR modifier;
+ int fd = -1;
+ EGLint stride = -1;
+ EGLint offset = -1;
+
+ /* Query the image properties, verify fourcc and num planes. */
+ if (!dmabuf_query(dpy, img, &fourcc, &num_planes, &modifier) ||
+ !piglit_check_egl_error(EGL_SUCCESS)) {
+ piglit_loge("failed to query EGLImage dmabuf params\n");
+ return false;
+ }
+
+ /* Export the image, verify success. */
+ if (!dmabuf_export(dpy, img, &fd, &stride, &offset) ||
+ !piglit_check_egl_error(EGL_SUCCESS)) {
+ piglit_loge("failed to export EGLImage dmabuf\n");
+ return false;
+ }
+
+ eglDestroyImage(dpy, img);
+
+ const EGLAttrib attrs[] = {
+ EGL_IMAGE_PRESERVED, EGL_TRUE,
+ EGL_WIDTH, w,
+ EGL_HEIGHT, h,
+ EGL_LINUX_DRM_FOURCC_EXT, fourcc,
+ EGL_DMA_BUF_PLANE0_FD_EXT, fd,
+ EGL_DMA_BUF_PLANE0_OFFSET_EXT, offset,
+ EGL_DMA_BUF_PLANE0_PITCH_EXT, stride,
+ EGL_DMA_BUF_PLANE0_MODIFIER_LO_EXT, modifier,
+ EGL_DMA_BUF_PLANE0_MODIFIER_HI_EXT, modifier >> 32,
+ EGL_NONE, EGL_NONE
+ };
+
+ img = eglCreateImage(eglGetCurrentDisplay(), EGL_NO_CONTEXT,
+ EGL_LINUX_DMA_BUF_EXT, (EGLClientBuffer)0, attrs);
+
+ if (!piglit_check_egl_error(EGL_SUCCESS)) {
+ piglit_loge("failed to import dmabuf EGLImage\n");
+ return false;
+ }
+
+ glGenTextures(1, &tex);
+ glBindTexture(GL_TEXTURE_3D, tex);
+ glEGLImageTargetTexStorageEXT(GL_TEXTURE_3D, img, NULL);
+
+ bool ret = piglit_check_gl_error(GL_INVALID_OPERATION);
+
+ eglDestroyImage(dpy, img);
+ glDeleteTextures(1, &tex);
+
+ return ret;
+}
+
void
piglit_init(int argc, char **argv)
{
@@ -208,5 +315,10 @@ piglit_init(int argc, char **argv)
glDeleteTextures(1, &texture_b);
peglDestroyImageKHR(dpy, egl_image);
+ if (!test_invalid_target_dmabuf(dpy)) {
+ fprintf(stderr, "failed to test dma-buf storage\n");
+ piglit_report_result(PIGLIT_FAIL);
+ }
+
piglit_report_result(PIGLIT_PASS);
}
diff --git a/tests/egl/egl-util.c b/tests/egl/egl-util.c
index fa2f6a37c..07bdf93cb 100644
--- a/tests/egl/egl-util.c
+++ b/tests/egl/egl-util.c
@@ -210,7 +210,7 @@ egl_util_run(const struct egl_test *test, int argc, char *argv[])
struct egl_state state = { 0 };
EGLint count;
enum piglit_result result = PIGLIT_PASS;
- int i, dispatch_api, api_bit = EGL_OPENGL_BIT;
+ int i, dispatch_api, api_bit = ~0;
EGLint nCtxAttribs = 0;
EGLint ctxAttribs[40];
@@ -247,6 +247,9 @@ egl_util_run(const struct egl_test *test, int argc, char *argv[])
ctxAttribs[nCtxAttribs++] = EGL_CONTEXT_CLIENT_VERSION;
ctxAttribs[nCtxAttribs++] = 2;
break;
+ case EGL_OPENGL_BIT:
+ dispatch_api = PIGLIT_DISPATCH_GL;
+ break;
default:
fprintf(stderr, "Note: No EGL_RENDERABLE_TYPE defined in test attributes, defaulted to gl\n");
dispatch_api = PIGLIT_DISPATCH_GL;
diff --git a/tests/egl/spec/egl_chromium_sync_control/egl_chromium_sync_control.c b/tests/egl/spec/egl_chromium_sync_control/egl_chromium_sync_control.c
index 2df2a52ca..3cb0fc8bb 100644
--- a/tests/egl/spec/egl_chromium_sync_control/egl_chromium_sync_control.c
+++ b/tests/egl/spec/egl_chromium_sync_control/egl_chromium_sync_control.c
@@ -139,7 +139,7 @@ test_eglGetSyncValuesCHROMIUM_ust_test(struct egl_state *state)
if (ust > ust2 || ust > ust3 || ust2 > ust3) {
piglit_loge("eglGetSyncValuesCHROMIUM UST is not monotonically increasing");
- piglit_loge("UST values 0.032 seconds apart: %lu %lu %lu",
+ piglit_loge("UST values 0.032 seconds apart: %"PRIu64" %"PRIu64" %"PRIu64,
ust, ust2, ust3);
return PIGLIT_FAIL;
}
@@ -206,15 +206,15 @@ test_eglGetSyncValuesCHROMIUM_msc_and_sbc_test(struct egl_state *state)
return PIGLIT_FAIL;
}
if (sbc2 == sbc) {
- piglit_loge("SBC did not change after second SwapBuffers: %lu", sbc);
+ piglit_loge("SBC did not change after second SwapBuffers: %"PRIu64, sbc);
return PIGLIT_FAIL;
}
if (min_swap_interval > 0 && msc == msc2) {
- piglit_loge("MSC did not change after second SwapBuffers: %lu", msc);
+ piglit_loge("MSC did not change after second SwapBuffers: %"PRIu64, msc);
return PIGLIT_FAIL;
}
if (sbc2 > (sbc + 2)) {
- piglit_loge("SBC increased by more than two after second SwapBuffers: %lu (before) %lu (after)", sbc, sbc2);
+ piglit_loge("SBC increased by more than two after second SwapBuffers: %"PRIu64" (before) %"PRIu64" (after)", sbc, sbc2);
return PIGLIT_FAIL;
}
return PIGLIT_PASS;
diff --git a/tests/egl/spec/egl_khr_create_context/CMakeLists.gles2.txt b/tests/egl/spec/egl_khr_create_context/CMakeLists.gles2.txt
index a27ef2da2..459e94b9e 100644
--- a/tests/egl/spec/egl_khr_create_context/CMakeLists.gles2.txt
+++ b/tests/egl/spec/egl_khr_create_context/CMakeLists.gles2.txt
@@ -21,5 +21,6 @@ piglit_add_executable (egl-create-context-valid-flag-debug-gles valid-flag-debug
# Tests that use ES 2 and Desktop GL.
piglit_add_executable (egl-create-context-no-error no-error.c common.c)
+piglit_add_executable (egl-create-context-robustness robustness.c common.c)
# vim: ft=cmake:
diff --git a/tests/egl/spec/egl_khr_create_context/core-profile.c b/tests/egl/spec/egl_khr_create_context/core-profile.c
index 0b3f04aa6..c0b91fa76 100644
--- a/tests/egl/spec/egl_khr_create_context/core-profile.c
+++ b/tests/egl/spec/egl_khr_create_context/core-profile.c
@@ -52,7 +52,7 @@ int main(int argc, char **argv)
EGLContext ctx;
if (!EGL_KHR_create_context_setup(EGL_OPENGL_BIT)) {
- fprintf(stderr, "Desktop GL not available.\n");
+ printf("Desktop GL not available.\n");
piglit_report_result(PIGLIT_SKIP);
}
eglBindAPI(EGL_OPENGL_API);
diff --git a/tests/egl/spec/egl_khr_create_context/default-major-version-gl.c b/tests/egl/spec/egl_khr_create_context/default-major-version-gl.c
index cd7acf99a..e7b6acf48 100644
--- a/tests/egl/spec/egl_khr_create_context/default-major-version-gl.c
+++ b/tests/egl/spec/egl_khr_create_context/default-major-version-gl.c
@@ -33,7 +33,7 @@ int main(int argc, char **argv)
int minor;
if (!EGL_KHR_create_context_setup(EGL_OPENGL_BIT)) {
- fprintf(stderr, "Desktop GL not available.\n");
+ printf("Desktop GL not available.\n");
piglit_report_result(PIGLIT_SKIP);
}
eglBindAPI(EGL_OPENGL_API);
diff --git a/tests/egl/spec/egl_khr_create_context/default-major-version-gles.c b/tests/egl/spec/egl_khr_create_context/default-major-version-gles.c
index 03e16a960..130fcdc0a 100644
--- a/tests/egl/spec/egl_khr_create_context/default-major-version-gles.c
+++ b/tests/egl/spec/egl_khr_create_context/default-major-version-gles.c
@@ -33,7 +33,7 @@ int main(int argc, char **argv)
int minor;
if (!EGL_KHR_create_context_setup(EGL_OPENGL_ES_BIT)) {
- fprintf(stderr, "ES 1 not available.\n");
+ printf("ES 1 not available.\n");
piglit_report_result(PIGLIT_SKIP);
}
diff --git a/tests/egl/spec/egl_khr_create_context/default-minor-version-gl.c b/tests/egl/spec/egl_khr_create_context/default-minor-version-gl.c
index d2635379d..07ead2f5b 100644
--- a/tests/egl/spec/egl_khr_create_context/default-minor-version-gl.c
+++ b/tests/egl/spec/egl_khr_create_context/default-minor-version-gl.c
@@ -33,7 +33,7 @@ int main(int argc, char **argv)
int minor;
if (!EGL_KHR_create_context_setup(EGL_OPENGL_BIT)) {
- fprintf(stderr, "Desktop GL not available.\n");
+ printf("Desktop GL not available.\n");
piglit_report_result(PIGLIT_SKIP);
}
eglBindAPI(EGL_OPENGL_API);
diff --git a/tests/egl/spec/egl_khr_create_context/invalid-attribute-gl.c b/tests/egl/spec/egl_khr_create_context/invalid-attribute-gl.c
index e7261bdd8..48e10ebf8 100644
--- a/tests/egl/spec/egl_khr_create_context/invalid-attribute-gl.c
+++ b/tests/egl/spec/egl_khr_create_context/invalid-attribute-gl.c
@@ -63,7 +63,7 @@ int main(int argc, char **argv)
unsigned i;
if (!EGL_KHR_create_context_setup(EGL_OPENGL_BIT)) {
- fprintf(stderr, "Desktop GL not available.\n");
+ printf("Desktop GL not available.\n");
piglit_report_result(PIGLIT_SKIP);
}
eglBindAPI(EGL_OPENGL_API);
diff --git a/tests/egl/spec/egl_khr_create_context/invalid-profile.c b/tests/egl/spec/egl_khr_create_context/invalid-profile.c
index 23c527854..ad21ff812 100644
--- a/tests/egl/spec/egl_khr_create_context/invalid-profile.c
+++ b/tests/egl/spec/egl_khr_create_context/invalid-profile.c
@@ -71,7 +71,7 @@ int main(int argc, char **argv)
uint32_t i;
if (!EGL_KHR_create_context_setup(EGL_OPENGL_BIT)) {
- fprintf(stderr, "Desktop GL not available.\n");
+ printf("Desktop GL not available.\n");
piglit_report_result(PIGLIT_SKIP);
}
eglBindAPI(EGL_OPENGL_API);
diff --git a/tests/egl/spec/egl_khr_create_context/pre-GL32-profile.c b/tests/egl/spec/egl_khr_create_context/pre-GL32-profile.c
index 66f244491..915d8dc4c 100644
--- a/tests/egl/spec/egl_khr_create_context/pre-GL32-profile.c
+++ b/tests/egl/spec/egl_khr_create_context/pre-GL32-profile.c
@@ -89,7 +89,7 @@ int main(int argc, char **argv)
bool pass = true;
if (!EGL_KHR_create_context_setup(EGL_OPENGL_BIT)) {
- fprintf(stderr, "Desktop GL not available.\n");
+ printf("Desktop GL not available.\n");
piglit_report_result(PIGLIT_SKIP);
}
eglBindAPI(EGL_OPENGL_API);
diff --git a/tests/egl/spec/egl_khr_create_context/robustness.c b/tests/egl/spec/egl_khr_create_context/robustness.c
new file mode 100644
index 000000000..36f206756
--- /dev/null
+++ b/tests/egl/spec/egl_khr_create_context/robustness.c
@@ -0,0 +1,162 @@
+/* Copyright 2017 Simon Zeni <simon.zeni@collabora.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+#include <stdbool.h>
+
+#include "piglit-util-egl.h"
+#include "common.h"
+
+#define BOOLSTR(x) ((x) ? "yes" : "no")
+
+static void
+check_extension(EGLint mask)
+{
+ if (!EGL_KHR_create_context_setup(mask))
+ piglit_report_result(PIGLIT_SKIP);
+
+ piglit_require_egl_extension(egl_dpy, "EGL_EXT_create_context_robustness");
+ piglit_require_egl_extension(egl_dpy, "EGL_EXT_query_reset_notification_strategy");
+
+ EGL_KHR_create_context_teardown();
+}
+
+static enum piglit_result
+check_robustness(EGLenum api, bool robust, bool reset_notif)
+{
+ enum piglit_result result = PIGLIT_SKIP;
+ EGLContext ctx;
+ EGLint attribs[11];
+ size_t ai = 0;
+ EGLint mask = (api == EGL_OPENGL_API) ? EGL_OPENGL_BIT : EGL_OPENGL_ES2_BIT;
+
+ if (!EGL_KHR_create_context_setup(mask))
+ goto out;
+
+ if (eglBindAPI(api) != EGL_TRUE)
+ goto out;
+
+ /* Always use OpenGL 2.0 or OpenGL ES 2.0 to keep this test reasonably
+ * simple; there are enough variants as-is.
+ */
+ attribs[ai++] = EGL_CONTEXT_MAJOR_VERSION_KHR;
+ attribs[ai++] = 2;
+ attribs[ai++] = EGL_CONTEXT_MINOR_VERSION_KHR;
+ attribs[ai++] = 0;
+
+ if (api == EGL_OPENGL_ES_API) {
+ attribs[ai++] = EGL_CONTEXT_CLIENT_VERSION;
+ attribs[ai++] = 2;
+ }
+
+ if (robust) {
+ attribs[ai++] = EGL_CONTEXT_OPENGL_ROBUST_ACCESS_EXT;
+ attribs[ai++] = EGL_TRUE;
+ }
+
+ if (reset_notif) {
+ attribs[ai++] = EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_EXT;
+ attribs[ai++] = EGL_LOSE_CONTEXT_ON_RESET_EXT;
+ }
+
+ attribs[ai++] = EGL_NONE;
+
+ ctx = eglCreateContext(egl_dpy, cfg, EGL_NO_CONTEXT, attribs);
+
+ if (ctx == EGL_NO_CONTEXT) {
+ /*
+ * [EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_EXT] is only
+ * meaningful for OpenGL ES contexts, and specifying it for
+ * other types of contexts will generate an EGL_BAD_ATTRIBUTE
+ * error.
+ */
+ if (api == EGL_OPENGL_API && reset_notif) {
+ if (!piglit_check_egl_error(EGL_BAD_ATTRIBUTE)) {
+ piglit_loge("expected EGL_BAD_ATTRIBUTE");
+ result = PIGLIT_FAIL;
+ goto out;
+ }
+
+ result = PIGLIT_PASS;
+ goto out;
+ } else {
+ piglit_loge("failed to create EGL context");
+ result = PIGLIT_FAIL;
+ goto out;
+ }
+ }
+
+ if (eglMakeCurrent(egl_dpy, EGL_NO_SURFACE, EGL_NO_SURFACE,
+ ctx) != EGL_TRUE) {
+ piglit_loge("error: failed to make context current");
+ result = PIGLIT_FAIL;
+ goto out;
+ }
+
+ EGLint strategy;
+ EGLBoolean st = eglQueryContext(egl_dpy, ctx,
+ EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_EXT, &strategy);
+ if (st == EGL_FALSE || !piglit_check_egl_error(EGL_SUCCESS)) {
+ piglit_loge("failed to query EGL context notification strategy");
+ result = PIGLIT_FAIL;
+ goto out;
+ }
+
+ if (reset_notif && strategy != EGL_LOSE_CONTEXT_ON_RESET_EXT) {
+ piglit_loge("invalid reset strategy");
+ result = PIGLIT_FAIL;
+ goto out;
+ } else if (!reset_notif && strategy != EGL_NO_RESET_NOTIFICATION_EXT) {
+ piglit_loge("unexpected reset strategy");
+ result = PIGLIT_FAIL;
+ goto out;
+ }
+
+ /* Everything turned out to be fine */
+ result = PIGLIT_PASS;
+out:
+
+ piglit_logi("%s robust=%s reset_notification=%s : %s",
+ (api == EGL_OPENGL_API) ? "OpenGL" : "OpenGL ES",
+ BOOLSTR(robust), BOOLSTR(reset_notif),
+ piglit_result_to_string(result));
+ EGL_KHR_create_context_teardown();
+ return result;
+}
+
+int main(int argc, char **argv)
+{
+ enum piglit_result result = PIGLIT_SKIP;
+
+ check_extension(EGL_OPENGL_BIT);
+ check_extension(EGL_OPENGL_ES2_BIT);
+
+ piglit_merge_result(&result, check_robustness(EGL_OPENGL_API, true, true));
+ piglit_merge_result(&result, check_robustness(EGL_OPENGL_API, true, false));
+ piglit_merge_result(&result, check_robustness(EGL_OPENGL_API, false, true));
+ piglit_merge_result(&result, check_robustness(EGL_OPENGL_API, false, false));
+ piglit_merge_result(&result, check_robustness(EGL_OPENGL_ES_API, true, true));
+ piglit_merge_result(&result, check_robustness(EGL_OPENGL_ES_API, true, false));
+ piglit_merge_result(&result, check_robustness(EGL_OPENGL_ES_API, false, true));
+ piglit_merge_result(&result, check_robustness(EGL_OPENGL_ES_API, false, false));
+
+ piglit_report_result(result);
+}
diff --git a/tests/egl/spec/egl_khr_create_context/valid-attribute-empty-gl.c b/tests/egl/spec/egl_khr_create_context/valid-attribute-empty-gl.c
index 40613ba41..56f809e9c 100644
--- a/tests/egl/spec/egl_khr_create_context/valid-attribute-empty-gl.c
+++ b/tests/egl/spec/egl_khr_create_context/valid-attribute-empty-gl.c
@@ -32,7 +32,7 @@ int main(int argc, char **argv)
int minor;
if (!EGL_KHR_create_context_setup(EGL_OPENGL_BIT)) {
- fprintf(stderr, "Desktop GL not available.\n");
+ printf("Desktop GL not available.\n");
piglit_report_result(PIGLIT_SKIP);
}
eglBindAPI(EGL_OPENGL_API);
diff --git a/tests/egl/spec/egl_khr_create_context/valid-attribute-empty-gles.c b/tests/egl/spec/egl_khr_create_context/valid-attribute-empty-gles.c
index b1766cfd1..01c6ab495 100644
--- a/tests/egl/spec/egl_khr_create_context/valid-attribute-empty-gles.c
+++ b/tests/egl/spec/egl_khr_create_context/valid-attribute-empty-gles.c
@@ -32,7 +32,7 @@ int main(int argc, char **argv)
int minor;
if (!EGL_KHR_create_context_setup(EGL_OPENGL_ES_BIT)) {
- fprintf(stderr, "ES 1 not available.\n");
+ printf("ES 1 not available.\n");
piglit_report_result(PIGLIT_SKIP);
}
diff --git a/tests/egl/spec/egl_khr_create_context/valid-attribute-null-gl.c b/tests/egl/spec/egl_khr_create_context/valid-attribute-null-gl.c
index f251b1d04..ec18d1048 100644
--- a/tests/egl/spec/egl_khr_create_context/valid-attribute-null-gl.c
+++ b/tests/egl/spec/egl_khr_create_context/valid-attribute-null-gl.c
@@ -29,7 +29,7 @@ int main(int argc, char **argv)
int minor;
if (!EGL_KHR_create_context_setup(EGL_OPENGL_BIT)) {
- fprintf(stderr, "Desktop GL not available.\n");
+ printf("Desktop GL not available.\n");
piglit_report_result(PIGLIT_SKIP);
}
eglBindAPI(EGL_OPENGL_API);
diff --git a/tests/egl/spec/egl_khr_create_context/valid-attribute-null-gles.c b/tests/egl/spec/egl_khr_create_context/valid-attribute-null-gles.c
index a4b5fdeff..4b43881cb 100644
--- a/tests/egl/spec/egl_khr_create_context/valid-attribute-null-gles.c
+++ b/tests/egl/spec/egl_khr_create_context/valid-attribute-null-gles.c
@@ -29,7 +29,7 @@ int main(int argc, char **argv)
int minor;
if (!EGL_KHR_create_context_setup(EGL_OPENGL_ES_BIT)) {
- fprintf(stderr, "ES 1 not available.\n");
+ printf("ES 1 not available.\n");
piglit_report_result(PIGLIT_SKIP);
}
diff --git a/tests/egl/spec/egl_khr_create_context/valid-flag-forward-compatible-gl.c b/tests/egl/spec/egl_khr_create_context/valid-flag-forward-compatible-gl.c
index 42feb54d6..95dc52398 100644
--- a/tests/egl/spec/egl_khr_create_context/valid-flag-forward-compatible-gl.c
+++ b/tests/egl/spec/egl_khr_create_context/valid-flag-forward-compatible-gl.c
@@ -68,7 +68,7 @@ int main(int argc, char **argv)
bool pass = true;
if (!EGL_KHR_create_context_setup(EGL_OPENGL_BIT)) {
- fprintf(stderr, "Desktop GL not available.\n");
+ printf("Desktop GL not available.\n");
piglit_report_result(PIGLIT_SKIP);
}
eglBindAPI(EGL_OPENGL_API);
diff --git a/tests/egl/spec/egl_khr_fence_sync/egl_khr_fence_sync.c b/tests/egl/spec/egl_khr_fence_sync/egl_khr_fence_sync.c
index 336508e15..fd0a94acd 100644
--- a/tests/egl/spec/egl_khr_fence_sync/egl_khr_fence_sync.c
+++ b/tests/egl/spec/egl_khr_fence_sync/egl_khr_fence_sync.c
@@ -293,7 +293,7 @@ cleanup:
/**
* Verify that eglCreateSyncKHR(), when given an empty attribute list,
- * intializes the sync object's attributes to the correct values.
+ * initializes the sync object's attributes to the correct values.
*
* From the EGL_KHR_fence_sync spec:
*
@@ -1177,7 +1177,7 @@ test_eglCreateSyncKHR_with_display_bound_in_other_thread(void *test_data)
err = pthread_join(thread2, (void**) &t2_result);
if (err) {
- piglit_loge("failed to join thread %"PRIuMAX, (uintmax_t) thread2);
+ piglit_loge("failed to join thread %"PRIuPTR, (uintptr_t) thread2);
result = PIGLIT_FAIL;
goto cleanup;
}
@@ -1193,8 +1193,8 @@ test_eglCreateSyncKHR_with_display_bound_in_other_thread(void *test_data)
else
piglit_merge_result(&result, *t2_result);
} else {
- piglit_loge("thread %"PRIuMAX" returned no piglit_result",
- (uintmax_t) thread2);
+ piglit_loge("thread %"PRIuPTR" returned no piglit_result",
+ (uintptr_t) thread2);
result = PIGLIT_FAIL;
}
diff --git a/tests/fast_color_clear/fast-slow-clear-interaction.shader_test b/tests/fast_color_clear/fast-slow-clear-interaction.shader_test
index e3a724cf4..09bf17ca5 100644
--- a/tests/fast_color_clear/fast-slow-clear-interaction.shader_test
+++ b/tests/fast_color_clear/fast-slow-clear-interaction.shader_test
@@ -7,7 +7,7 @@
# that they happen either during rendering or at the time buffer data
# is read (e.g. by glReadPixels). If two fast clears appear in a row,
# the second clear can be elided. But if other rendering (in this
-# case a slow clear) occurrs between the two fast clears, the second
+# case a slow clear) occurs between the two fast clears, the second
# fast clear is necessary, since some of the first fast clear's writes
# may already have been performed.
#
diff --git a/tests/fast_color_clear/non-redundant-clear.shader_test b/tests/fast_color_clear/non-redundant-clear.shader_test
index 208091f26..3e056ae83 100644
--- a/tests/fast_color_clear/non-redundant-clear.shader_test
+++ b/tests/fast_color_clear/non-redundant-clear.shader_test
@@ -6,7 +6,7 @@
# memory writes that would normally be done during a buffer clear so
# that they happen either during rendering or at the time buffer data
# is read (e.g. by glReadPixels). If two fast clears appear in a row,
-# the second clear can be elided. But if rendering occurrs between
+# the second clear can be elided. But if rendering occurs between
# the two fast clears, the second clear is necessary, since some of
# the first clear's writes may already have been performed.
#
diff --git a/tests/fbo/fbo-blending-format-quirks.c b/tests/fbo/fbo-blending-format-quirks.c
index 85fcc8352..292198952 100644
--- a/tests/fbo/fbo-blending-format-quirks.c
+++ b/tests/fbo/fbo-blending-format-quirks.c
@@ -183,7 +183,7 @@ enum piglit_result piglit_display(void)
void piglit_init(int argc, char **argv)
{
piglit_require_extension("GL_EXT_framebuffer_object");
- piglit_require_draw_buffers(2);
+ piglit_require_minimum_getinteger(GL_MAX_DRAW_BUFFERS, 2);
glDisable(GL_DITHER);
}
diff --git a/tests/fbo/fbo-blit-stretch.cpp b/tests/fbo/fbo-blit-stretch.cpp
index 4beedbe2e..a83288c0f 100644
--- a/tests/fbo/fbo-blit-stretch.cpp
+++ b/tests/fbo/fbo-blit-stretch.cpp
@@ -141,7 +141,7 @@ filter(const TestCase &test, float coord, GLint &coord0, GLint &coord1, float &w
switch (test.filter) {
case GL_NEAREST:
coord0 = roundf(coord);
- // ambigious
+ // ambiguous
assert(fabsf(coord0 - coord) != 0.5f);
weight = 0.0f;
break;
diff --git a/tests/fbo/fbo-depth-sample-compare.c b/tests/fbo/fbo-depth-sample-compare.c
index 033f3030f..9c68028fc 100644
--- a/tests/fbo/fbo-depth-sample-compare.c
+++ b/tests/fbo/fbo-depth-sample-compare.c
@@ -319,7 +319,7 @@ draw_sphere(void)
assert(&v[8] == &vertex_data[ARRAY_SIZE(vertex_data)]);
for (i = 0; i < slices; i++) {
- /* The outer loop walks around the first circluar slice of vertex
+ /* The outer loop walks around the first circular slice of vertex
* data. This occupies vertices [0, slices]. Looking at the sphere,
* there is a vertex on the left side of the polygon being emitted,
* and the next vertex in the sequence is on the right.
diff --git a/tests/fbo/fbo-drawbuffers-arbfp.c b/tests/fbo/fbo-drawbuffers-arbfp.c
index b9bc67263..00f6cbdec 100644
--- a/tests/fbo/fbo-drawbuffers-arbfp.c
+++ b/tests/fbo/fbo-drawbuffers-arbfp.c
@@ -145,8 +145,6 @@ piglit_display(void)
void
piglit_init(int argc, char **argv)
{
- GLint num;
-
piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
piglit_require_extension("GL_EXT_framebuffer_object");
@@ -154,10 +152,7 @@ piglit_init(int argc, char **argv)
piglit_require_extension("GL_ARB_fragment_program");
piglit_require_extension("GL_ARB_vertex_program");
piglit_require_extension("GL_ARB_texture_non_power_of_two");
-
- glGetIntegerv(GL_MAX_DRAW_BUFFERS_ARB, &num);
- if (num < 2)
- piglit_report_result(PIGLIT_SKIP);
+ piglit_require_minimum_getinteger(GL_MAX_DRAW_BUFFERS_ARB, 2);
piglit_compile_program(GL_FRAGMENT_PROGRAM_ARB, mrt_fp_string);
}
diff --git a/tests/fbo/fbo-drawbuffers.c b/tests/fbo/fbo-drawbuffers.c
index 9f21f94bf..24775d6fd 100644
--- a/tests/fbo/fbo-drawbuffers.c
+++ b/tests/fbo/fbo-drawbuffers.c
@@ -149,7 +149,6 @@ piglit_display(void)
void
piglit_init(int argc, char **argv)
{
- GLint num;
int i;
for (i = 1; i < argc; i++) {
@@ -164,8 +163,5 @@ piglit_init(int argc, char **argv)
piglit_require_extension("GL_EXT_framebuffer_object");
piglit_require_extension("GL_ARB_draw_buffers");
piglit_require_extension("GL_ARB_texture_non_power_of_two");
-
- glGetIntegerv(GL_MAX_DRAW_BUFFERS_ARB, &num);
- if (num < 2)
- piglit_report_result(PIGLIT_SKIP);
+ piglit_require_minimum_getinteger(GL_MAX_DRAW_BUFFERS_ARB, 2);
}
diff --git a/tests/fbo/fbo-drawbuffers2-blend.c b/tests/fbo/fbo-drawbuffers2-blend.c
index 2c16b8f70..c7eec4a62 100644
--- a/tests/fbo/fbo-drawbuffers2-blend.c
+++ b/tests/fbo/fbo-drawbuffers2-blend.c
@@ -141,16 +141,11 @@ piglit_display(void)
void
piglit_init(int argc, char **argv)
{
- GLint num;
-
piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
piglit_require_extension("GL_EXT_framebuffer_object");
piglit_require_extension("GL_ARB_draw_buffers");
piglit_require_extension("GL_EXT_draw_buffers2");
piglit_require_extension("GL_ARB_texture_non_power_of_two");
-
- glGetIntegerv(GL_MAX_DRAW_BUFFERS_ARB, &num);
- if (num < 2)
- piglit_report_result(PIGLIT_SKIP);
+ piglit_require_minimum_getinteger(GL_MAX_DRAW_BUFFERS_ARB, 2);
}
diff --git a/tests/fbo/fbo-drawbuffers2-colormask.c b/tests/fbo/fbo-drawbuffers2-colormask.c
index 8ce8851cc..45b2c5f61 100644
--- a/tests/fbo/fbo-drawbuffers2-colormask.c
+++ b/tests/fbo/fbo-drawbuffers2-colormask.c
@@ -147,7 +147,6 @@ piglit_display(void)
void
piglit_init(int argc, char **argv)
{
- GLint num;
int i;
for (i = 1; i < argc; i++) {
@@ -163,8 +162,5 @@ piglit_init(int argc, char **argv)
piglit_require_extension("GL_ARB_draw_buffers");
piglit_require_extension("GL_EXT_draw_buffers2");
piglit_require_extension("GL_ARB_texture_non_power_of_two");
-
- glGetIntegerv(GL_MAX_DRAW_BUFFERS_ARB, &num);
- if (num < 2)
- piglit_report_result(PIGLIT_SKIP);
+ piglit_require_minimum_getinteger(GL_MAX_DRAW_BUFFERS_ARB, 2);
}
diff --git a/tests/fbo/fbo-fragcoord.c b/tests/fbo/fbo-fragcoord.c
index 9c3047339..30a1e011f 100644
--- a/tests/fbo/fbo-fragcoord.c
+++ b/tests/fbo/fbo-fragcoord.c
@@ -92,7 +92,6 @@ create_fbo(unsigned width, unsigned height, GLuint *out_tex)
enum piglit_result
piglit_display(void)
{
- GLboolean pass = GL_TRUE;
int x, y;
GLuint fb, tex;
@@ -127,20 +126,20 @@ piglit_display(void)
if (!piglit_check_gl_error(GL_NO_ERROR))
piglit_report_result(PIGLIT_FAIL);
+ float *color = malloc(piglit_width * piglit_height * 3 * sizeof(float));
+
for (y = 0; y < piglit_height; y++) {
for (x = 0; x < piglit_width; x++) {
- float color[3];
-
- color[0] = x / 256.0;
- color[1] = y / 256.0;
- color[2] = 0;
-
- pass &= piglit_probe_pixel_rgb(x, y, color);
- if (!pass)
- break;
+ color[(y * piglit_width + x) * 3 + 0] = x / 256.0;
+ color[(y * piglit_width + x) * 3 + 1] = y / 256.0;
+ color[(y * piglit_width + x) * 3 + 2] = 0;
}
}
+ bool pass = piglit_probe_image_rgb(0, 0, piglit_width, piglit_height, color);
+
+ free(color);
+
piglit_present_results();
return pass ? PIGLIT_PASS : PIGLIT_FAIL;
diff --git a/tests/fbo/fbo-mrt-alphatest.c b/tests/fbo/fbo-mrt-alphatest.c
index 3173f18f6..7b7c17a23 100644
--- a/tests/fbo/fbo-mrt-alphatest.c
+++ b/tests/fbo/fbo-mrt-alphatest.c
@@ -54,6 +54,7 @@ void
piglit_init(int argc, char **argv)
{
piglit_require_GLSL_version(120);
+ piglit_require_minimum_getinteger(GL_MAX_DRAW_BUFFERS, 2);
glGenFramebuffers(1, &fbo);
glBindFramebuffer(GL_FRAMEBUFFER, fbo);
diff --git a/tests/fbo/fbo-scissor-blit.c b/tests/fbo/fbo-scissor-blit.c
index 5ff5c82ab..574454518 100644
--- a/tests/fbo/fbo-scissor-blit.c
+++ b/tests/fbo/fbo-scissor-blit.c
@@ -96,9 +96,13 @@ piglit_init(int argc, char **argv)
if (argc != 2)
print_usage_and_exit(argv[0]);
- if (strcmp(argv[1], "window") == 0)
+ if (strcmp(argv[1], "window") == 0) {
blit_to_fbo = false;
- else if (strcmp(argv[1], "fbo") == 0)
+ if (piglit_winsys_fbo != 0) {
+ fprintf(stderr, "window case is for using a winsys surface, must be run without -fbo\n");
+ piglit_report_result(PIGLIT_FAIL);
+ }
+ } else if (strcmp(argv[1], "fbo") == 0)
blit_to_fbo = true;
else {
blit_to_fbo = false;
diff --git a/tests/fbo/fbo-viewport.c b/tests/fbo/fbo-viewport.c
index b2e351ce1..df54078ef 100644
--- a/tests/fbo/fbo-viewport.c
+++ b/tests/fbo/fbo-viewport.c
@@ -151,7 +151,7 @@ piglit_display(void)
glBindFramebuffer(GL_FRAMEBUFFER, piglit_winsys_fbo);
-#if 0 /* for debug/compare (alternate diplaying Window vs. FBO image) */
+#if 0 /* for debug/compare (alternate displaying Window vs. FBO image) */
{
int i;
glWindowPos2i(0,0);
diff --git a/tests/gbm/CMakeLists.no_api.txt b/tests/gbm/CMakeLists.no_api.txt
index c1fd99c66..57c750d2e 100644
--- a/tests/gbm/CMakeLists.no_api.txt
+++ b/tests/gbm/CMakeLists.no_api.txt
@@ -11,4 +11,8 @@ if(PIGLIT_HAS_GBM_BO_GET_FD_FOR_PLANE AND LIBDRM_FOUND)
piglit_add_executable(gbm-multi-plane gbm-multi-plane.c)
endif()
+if(PIGLIT_HAS_GBM)
+ piglit_add_executable(gbm-device gbm-device.c)
+endif()
+
# vim: ft=cmake:
diff --git a/tests/gbm/gbm-device.c b/tests/gbm/gbm-device.c
new file mode 100644
index 000000000..8e1a82fde
--- /dev/null
+++ b/tests/gbm/gbm-device.c
@@ -0,0 +1,50 @@
+/* Copyright (c) 2024 Collabora Ltd
+ * SPDX-License-Identifier: MIT
+ */
+
+/**
+ * \file
+ * \brief Tests for libgbm.
+ */
+
+#include <errno.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <gbm.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+
+#include "piglit-util.h"
+
+int
+main(int argc, char **argv)
+{
+ int drm_fd;
+ char *nodename;
+ struct gbm_device *gbm;
+
+ /* Strip common piglit args. */
+ piglit_strip_arg(&argc, argv, "-fbo");
+ piglit_strip_arg(&argc, argv, "-auto");
+
+ nodename = getenv("WAFFLE_GBM_DEVICE");
+ if (!nodename)
+ nodename = "/dev/dri/renderD128";
+ drm_fd = open(nodename, O_RDWR);
+ if (drm_fd == -1) {
+ perror("Error opening render node");
+ piglit_report_result(PIGLIT_SKIP);
+ }
+
+ gbm = gbm_create_device(drm_fd);
+ if (!gbm)
+ piglit_report_result(PIGLIT_FAIL);
+
+ if (gbm_device_get_fd(gbm) != drm_fd)
+ piglit_report_result(PIGLIT_FAIL);
+
+ gbm_device_destroy(gbm);
+ close(drm_fd);
+
+ piglit_report_result(PIGLIT_PASS);
+}
diff --git a/tests/gbm/gbm-multi-plane.c b/tests/gbm/gbm-multi-plane.c
index 1debd60b6..7ee823b42 100644
--- a/tests/gbm/gbm-multi-plane.c
+++ b/tests/gbm/gbm-multi-plane.c
@@ -25,7 +25,7 @@
* \brief Tests for libgbm.
*/
-#include <drm_fourcc.h>
+#include "drm-uapi/drm_fourcc.h"
#include <errno.h>
#include <fcntl.h>
#include <gbm.h>
diff --git a/tests/general/CMakeLists.gl.txt b/tests/general/CMakeLists.gl.txt
index a9a35e5ca..23ea39e9c 100644
--- a/tests/general/CMakeLists.gl.txt
+++ b/tests/general/CMakeLists.gl.txt
@@ -35,6 +35,7 @@ piglit_add_executable (dlist-fdo3129-02 dlist-fdo3129-02.c)
piglit_add_executable (dlist-fdo31590 dlist-fdo31590.c)
piglit_add_executable (depth_clamp depth_clamp.c)
piglit_add_executable (depth-clear-precision-check depth-clear-precision-check.c)
+piglit_add_executable (depth-clear-with-copy depth-clear-with-copy.c)
piglit_add_executable (depthfunc depthfunc.c)
piglit_add_executable (depthrange-clear depthrange-clear.c)
piglit_add_executable (draw-arrays-colormaterial draw-arrays-colormaterial.c)
@@ -76,6 +77,8 @@ piglit_add_executable (line-aa-width line-aa-width.c)
IF (UNIX)
target_link_libraries (line-aa-width m)
ENDIF (UNIX)
+piglit_add_executable (line-smooth-coverage line-smooth-coverage.c)
+piglit_add_executable (line-smooth-stipple line-smooth-stipple.c)
piglit_add_executable (line-flat-clip-color line-flat-clip-color.c)
piglit_add_executable (lineloop lineloop.c)
piglit_add_executable (longprim longprim.c)
diff --git a/tests/general/depth-clear-precision-check.c b/tests/general/depth-clear-precision-check.c
index 318df08d1..c2fc3573c 100644
--- a/tests/general/depth-clear-precision-check.c
+++ b/tests/general/depth-clear-precision-check.c
@@ -34,6 +34,8 @@ const struct piglit_subtest subtests[];
enum piglit_result test(void *data);
static struct piglit_gl_test_config *piglit_config;
+#define ftoh(x) (piglit_float_from_half(piglit_half_from_float(x)))
+
PIGLIT_GL_TEST_CONFIG_BEGIN
piglit_config = &config;
@@ -217,6 +219,9 @@ test(void *data)
assert(maxStoreableValue * fdepth == depth);
+ if (numOfBits < 32)
+ fdepth = ftoh(depth / (float)maxStoreableValue);
+
pass = check_color(fdepth);
if (!pass) {
diff --git a/tests/general/depth-clear-with-copy.c b/tests/general/depth-clear-with-copy.c
new file mode 100644
index 000000000..db6cbeafa
--- /dev/null
+++ b/tests/general/depth-clear-with-copy.c
@@ -0,0 +1,105 @@
+/*
+ * Copyright © 2023 Zeb Figura
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+/** @file depth-copy.c
+ *
+ * A regression test for a broken code path in radeonsi related to
+ * fast depth clears.
+ */
+
+#include "piglit-util-gl.h"
+#include <stdlib.h>
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+ config.supports_gl_compat_version = 11;
+ config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE |
+ PIGLIT_GL_VISUAL_DEPTH;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+void piglit_init(int argc, char **argv)
+{
+ piglit_require_extension("GL_ARB_copy_image");
+ piglit_require_extension("GL_ARB_framebuffer_object");
+ glDepthFunc(GL_ALWAYS);
+ glEnable(GL_DEPTH_TEST);
+ glDepthMask(GL_TRUE);
+}
+
+enum piglit_result piglit_display(void)
+{
+ GLuint fb, depth[2];
+ bool pass = true;
+ GLfloat *pixels;
+ unsigned int i;
+
+ glGenTextures(2, depth);
+ glBindTexture(GL_TEXTURE_2D, depth[0]);
+ glTexStorage2D(GL_TEXTURE_2D, 1, GL_DEPTH_COMPONENT24, piglit_width, piglit_height);
+ glBindTexture(GL_TEXTURE_2D, depth[1]);
+ glTexStorage2D(GL_TEXTURE_2D, 1, GL_DEPTH_COMPONENT24, piglit_width, piglit_height);
+
+ /* Clear the first texture to 0. */
+ glGenFramebuffers(1, &fb);
+ glBindFramebuffer(GL_FRAMEBUFFER, fb);
+ glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, depth[0], 0);
+ assert(glCheckFramebufferStatus(GL_FRAMEBUFFER) == GL_FRAMEBUFFER_COMPLETE);
+ glClearDepth(0.0);
+ glClear(GL_DEPTH_BUFFER_BIT);
+
+ /* Copy to the second texture. */
+ glCopyImageSubData(depth[0], GL_TEXTURE_2D, 0, 0, 0, 0, depth[1], GL_TEXTURE_2D, 0, 0, 0, 0, piglit_width, piglit_height, 1);
+
+ /* Clear the first texture to 1. */
+ glClearDepth(1.0);
+ glClear(GL_DEPTH_BUFFER_BIT);
+
+ /* Draw to the first texture. */
+
+ glBegin(GL_TRIANGLE_STRIP);
+ glVertex3f(-0.6f, -0.7f, 0.5f);
+ glVertex3f( 0.8f, 0.5f, 0.5f);
+ glVertex3f( 0.7f, -0.7f, 0.5f);
+ glEnd();
+
+ pixels = malloc(piglit_width * piglit_height * sizeof(*pixels));
+ glReadPixels(0, 0, piglit_width, piglit_height, GL_DEPTH_COMPONENT, GL_FLOAT, pixels);
+ for (i = 0; i < piglit_width * piglit_height; ++i) {
+ GLfloat probe = pixels[i];
+ /* Every pixel should either be 0.75f (tri depth) or 1.0f (clear depth). */
+ if (fabsf(probe - 0.75f) >= 0.01 && fabsf(probe - 1.0f) >= 0.01) {
+ printf("Got depth %.8e at (%u, %u).\n", probe, i % piglit_width, i / piglit_width);
+ pass = false;
+ break;
+ }
+ }
+ free(pixels);
+
+ piglit_present_results();
+
+ glDeleteFramebuffers(1, &fb);
+ glDeleteTextures(2, depth);
+
+ return pass ? PIGLIT_PASS : PIGLIT_FAIL;
+}
diff --git a/tests/general/dlist-fdo3129-02.c b/tests/general/dlist-fdo3129-02.c
index fff8eccaa..e905f6819 100644
--- a/tests/general/dlist-fdo3129-02.c
+++ b/tests/general/dlist-fdo3129-02.c
@@ -55,7 +55,7 @@ piglit_display(void)
glColor3fv(color);
- /* Compile a list. Start with two-component vertexes, then, after the
+ /* Compile a list. Start with two-component vertices, then, after the
* first primitive is complete, use a three-component vertex.
* in the list.
*/
diff --git a/tests/general/getactiveattrib.c b/tests/general/getactiveattrib.c
index 0e73f4a3d..767265591 100644
--- a/tests/general/getactiveattrib.c
+++ b/tests/general/getactiveattrib.c
@@ -47,7 +47,7 @@ struct attribute {
* This attribute must be active in the linked shader.
*
* Some attributes must be active and some may or may not be active
- * (becuase a clever compiler could optimize them away. Attributes
+ * (because a clever compiler could optimize them away. Attributes
* that must not be active should not be listed in
* \c test::attributes.
*/
diff --git a/tests/general/idtech-extension-strings.c b/tests/general/idtech-extension-strings.c
index cecd47bde..b6463af9b 100644
--- a/tests/general/idtech-extension-strings.c
+++ b/tests/general/idtech-extension-strings.c
@@ -29,7 +29,7 @@
* For a long time idTech2- and idTech3-based games contained a bug in
* extension string handling. The engine would copy the extension string
* returned by the driver into a buffer on the stack. The engine would not be
- * able to detect the existence of any extensions that occured after the size
+ * able to detect the existence of any extensions that occurred after the size
* of the buffer.
*
* A 2011 Wine bug
diff --git a/tests/general/line-aa-width.c b/tests/general/line-aa-width.c
index 9590c027f..8b5103275 100644
--- a/tests/general/line-aa-width.c
+++ b/tests/general/line-aa-width.c
@@ -31,7 +31,7 @@
* Tests that width 1.0 AA lines are of the appropriate thickness.
*
* The 965 driver was rendering them so that when the line was
- * centered on a pixel it was fullly lit and when it was off the pixel
+ * centered on a pixel it was fully lit and when it was off the pixel
* center neither of the neighbors would be lit at all. It's quite
* ugly.
*/
diff --git a/tests/general/line-smooth-coverage.c b/tests/general/line-smooth-coverage.c
new file mode 100644
index 000000000..9295e23b0
--- /dev/null
+++ b/tests/general/line-smooth-coverage.c
@@ -0,0 +1,88 @@
+/*
+ * Copyright © 2022 Collabora Ltd
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ *
+ * Authors:
+ * Erik Faye-Lund <erik.faye-lund@collabora.com>
+ *
+ */
+
+/*
+ * Test that the coverage of multiple line-segments split at various positions
+ * adds up to one.
+ */
+
+#include "piglit-util-gl.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+ config.supports_gl_compat_version = 10;
+
+ config.window_width = 300;
+ config.window_height = 100;
+ config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+enum piglit_result
+piglit_display(void)
+{
+ glClearColor(0.0, 0.0, 0.0, 0.0);
+ glClear(GL_COLOR_BUFFER_BIT);
+
+ glColor4f(0.5, 0.5, 0.5, 1.0);
+ glEnable(GL_LINE_SMOOTH);
+ /* GL AA lines produce an alpha value */
+ glEnable(GL_BLEND);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE);
+
+ glLineWidth(3.0f);
+
+ int y;
+ for (y = 0; y * 4 < piglit_height; y++) {
+ float seg_width = 0.25 + y * 0.25;
+ float x1;
+ for (x1 = 0; x1 < piglit_width; x1 += seg_width) {
+ float x2 = x1 + seg_width;
+
+ glBegin(GL_LINES);
+ glVertex2f(x1, 1.5 + y * 4);
+ glVertex2f(x2, 1.5 + y * 4);
+ glEnd();
+ }
+ }
+
+ GLboolean pass = GL_TRUE;
+ for (y = 1; y < piglit_height; y += 4) {
+ float expected[4] = { 0.5, 0.5, 0.5, 1.0 };
+ pass = pass && piglit_probe_rect_rgb(0, y, piglit_width, 1, expected);
+ }
+
+ piglit_present_results();
+
+ return pass ? PIGLIT_PASS : PIGLIT_FAIL;
+}
+
+void
+piglit_init(int argc, char **argv)
+{
+ piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
+}
diff --git a/tests/general/line-smooth-stipple.c b/tests/general/line-smooth-stipple.c
new file mode 100644
index 000000000..0b54edeb6
--- /dev/null
+++ b/tests/general/line-smooth-stipple.c
@@ -0,0 +1,108 @@
+/*
+ * Copyright © 2022 Collabora Ltd
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ *
+ * Authors:
+ * Erik Faye-Lund <erik.faye-lund@collabora.com>
+ *
+ */
+
+/*
+ * Test the coverage of stippled multiple line-segments
+ */
+
+#include "piglit-util-gl.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+ config.supports_gl_compat_version = 10;
+
+ config.window_width = 300;
+ config.window_height = 100;
+ config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+float stipple_pattern(float counter, int factor)
+{
+ counter += 0.5;
+ counter = counter - floor(counter / (2 * factor)) * 2 * factor;
+ return MIN2(MAX2(fabs(counter - 8.0) - (factor * 0.5) + 0.5,
+ 0.0f), 1.0f);
+}
+
+enum piglit_result
+piglit_display(void)
+{
+ glClearColor(0.0, 0.0, 0.0, 0.0);
+ glClear(GL_COLOR_BUFFER_BIT);
+
+ glEnable(GL_LINE_SMOOTH);
+ /* GL AA lines produce an alpha value */
+ glEnable(GL_BLEND);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE);
+
+ glLineWidth(3.0f);
+ glEnable(GL_LINE_STIPPLE);
+
+ int y;
+ for (y = 0; y * 4 < piglit_height; y++) {
+ float offset = 1.0 + y / 4.0f;
+ glLineStipple(8, 0x5555);
+ glColor4f(0.5, 0.0, 0.5, 1.0);
+ glBegin(GL_LINES);
+ glVertex2f(offset, 1.5 + y * 4);
+ glVertex2f(piglit_width - 1.0, 1.5 + y * 4);
+ glEnd();
+
+ glLineStipple(8, ~0x5555);
+ glColor4f(0.0, 0.5, 0.0, 1.0);
+ glBegin(GL_LINES);
+ glVertex2f(offset, 1.5 + y * 4);
+ glVertex2f(piglit_width - 1.0, 1.5 + y * 4);
+ glEnd();
+ }
+
+ GLboolean pass = GL_TRUE;
+
+ float *expected = malloc(piglit_width * sizeof(float) * 3);
+ for (y = 0; y * 4 < piglit_height; y++) {
+ float offset = 1.0 + y / 4.0f;
+ int start_x = ceil(offset);
+ for (int x = 0; x < piglit_width; ++x) {
+ expected[x * 3 + 0] = stipple_pattern(x - offset - 4, 8) * 0.5;
+ expected[x * 3 + 1] = stipple_pattern(x - offset + 4, 8) * 0.5;
+ expected[x * 3 + 2] = stipple_pattern(x - offset - 4, 8) * 0.5;
+ }
+ pass = pass && piglit_probe_rect_rgb_varying(start_x, y * 4 + 1, piglit_width - start_x - 2, 1, expected + start_x * 3, 0);
+ }
+ free(expected);
+
+ piglit_present_results();
+
+ return pass ? PIGLIT_PASS : PIGLIT_FAIL;
+}
+
+void
+piglit_init(int argc, char **argv)
+{
+ piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
+}
diff --git a/tests/general/object-namespace-pollution.c b/tests/general/object-namespace-pollution.c
index 03441494c..b1857cb0a 100644
--- a/tests/general/object-namespace-pollution.c
+++ b/tests/general/object-namespace-pollution.c
@@ -161,7 +161,7 @@ lfsr(uint16_t *state)
* Fill some memory with pseudorandom values
*
* Using two seed values, a pair of LFSRs are used to generate pseudorandom
- * values to fill the specified memory buffer. Seprarate invocations with
+ * values to fill the specified memory buffer. Separate invocations with
* identical \c bytes, \c seed1, and \c seed2 parameters will generate
* identical data. This can be used generate data to initialize a buffer and
* regenerate the same data to validate the buffer.
diff --git a/tests/general/ppgtt_memory_alignment.c b/tests/general/ppgtt_memory_alignment.c
index 114561491..1c53cb5d2 100644
--- a/tests/general/ppgtt_memory_alignment.c
+++ b/tests/general/ppgtt_memory_alignment.c
@@ -91,7 +91,7 @@ piglit_init(int argc, char **argv)
/* Maximal value of cache-size supported by driver */
const GLsizei cache_max_size = 64 * 1024 * 1024;
const GLsizei cache_extra_size = cache_max_size * 16;
-#ifdef _MSC_VER
+#if defined(_MSC_VER) || defined(__MINGW32__)
SYSTEM_INFO sysInfo;
GetSystemInfo(&sysInfo);
const unsigned int page_size = sysInfo.dwPageSize;
diff --git a/tests/general/select.c b/tests/general/select.c
index c71fe2041..03550d58d 100644
--- a/tests/general/select.c
+++ b/tests/general/select.c
@@ -173,8 +173,8 @@ validate_select_buffer(GLuint* buffer)
}
ptr = buffer;
- /* ordering in select buffer isn't necessarly the same as drawing order,
- * so we need to look for each hit entry
+ /* ordering in select buffer isn't necessarily the same as drawing order,
+ * so we need to look for each hit entry
*/
for (i=0; i<hits; i++) {
for (j=0; j<3; j++) {
diff --git a/tests/general/triangle-rasterization.cpp b/tests/general/triangle-rasterization.cpp
index 3ebff79cc..c1e1be7e8 100644
--- a/tests/general/triangle-rasterization.cpp
+++ b/tests/general/triangle-rasterization.cpp
@@ -420,7 +420,7 @@ void random_triangle(Triangle& tri)
* which either top, left, bottom or right edges of a triangles 'belong' to it,
* that is, if one of those edges intersects with a fragment center, the
* fragment is produced. Additionally, for 'top' and 'bottom'-type triangles
- * either left or right vertical edges 'belong' to it. Similarily the same is
+ * either left or right vertical edges 'belong' to it. Similarly the same is
* true with horizontal edges and 'left' and 'right'-type triangles.
*
* For example: consider these 8 triangles centered around a fragment center:
@@ -437,7 +437,7 @@ void random_triangle(Triangle& tri)
* and left because all left facing edges 'belong' to it).
*
* This function determines the convention by drawing the 8 triangles shown
- * above in sub-pixel-size into 8 seperate pixels and checks which
+ * above in sub-pixel-size into 8 separate pixels and checks which
* pixel is filled.
*/
void get_filling_convention(void)
diff --git a/tests/glslparsertest/glsl2/gst-gl-sin.frag b/tests/glslparsertest/glsl2/gst-gl-sin.frag
index d917faa65..7b39adc32 100644
--- a/tests/glslparsertest/glsl2/gst-gl-sin.frag
+++ b/tests/glslparsertest/glsl2/gst-gl-sin.frag
@@ -28,7 +28,7 @@
uniform sampler2DRect tex;
vec3 rgb2hsl (vec3 v)
{
-/* TODO: check this algorythm */
+/* TODO: check this algorithm */
float MIN, MAX;
float r, g, b;
float h, l, s;
diff --git a/tests/glslparsertest/glsl2/parameters-08.vert b/tests/glslparsertest/glsl2/parameters-08.vert
index 7a97862aa..8aa6a6ab1 100644
--- a/tests/glslparsertest/glsl2/parameters-08.vert
+++ b/tests/glslparsertest/glsl2/parameters-08.vert
@@ -4,7 +4,7 @@
//
// [end config]
-/* FAIL - size must be speicified for formal parameter arrays
+/* FAIL - size must be specified for formal parameter arrays
*/
float a(float x[], int y)
{
diff --git a/tests/glslparsertest/glsl2/return-conversion-03.vert b/tests/glslparsertest/glsl2/return-conversion-03.vert
index 0d5aa4030..4702d4391 100644
--- a/tests/glslparsertest/glsl2/return-conversion-03.vert
+++ b/tests/glslparsertest/glsl2/return-conversion-03.vert
@@ -9,7 +9,7 @@
* by other sections of this specification."
*
* Neither section 6.1 (Function Definitions) nor section 6.4 (Jumps) make any
- * mention of implicit conversions occuring on the expression of a return
+ * mention of implicit conversions occurring on the expression of a return
* statement.
*/
#version 120
diff --git a/tests/glslparsertest/glsl2/xreal-lighting-d-omni.vert b/tests/glslparsertest/glsl2/xreal-lighting-d-omni.vert
index a9f138b89..6d2b010c2 100644
--- a/tests/glslparsertest/glsl2/xreal-lighting-d-omni.vert
+++ b/tests/glslparsertest/glsl2/xreal-lighting-d-omni.vert
@@ -35,7 +35,7 @@ varying vec4 var_TexAtten;
void main()
{
- // transform vertex position into homogenous clip-space
+ // transform vertex position into homogeneous clip-space
gl_Position = ftransform();
// assign position in object space
diff --git a/tests/glslparsertest/glsl2/xreal-lighting-db-omni.vert b/tests/glslparsertest/glsl2/xreal-lighting-db-omni.vert
index 029164e35..4b1864e13 100644
--- a/tests/glslparsertest/glsl2/xreal-lighting-db-omni.vert
+++ b/tests/glslparsertest/glsl2/xreal-lighting-db-omni.vert
@@ -38,7 +38,7 @@ varying mat3 var_OS2TSMatrix;
void main()
{
- // transform vertex position into homogenous clip-space
+ // transform vertex position into homogeneous clip-space
gl_Position = ftransform();
// assign position in object space
diff --git a/tests/glslparsertest/glsl2/xreal-lighting-dbs-omni.vert b/tests/glslparsertest/glsl2/xreal-lighting-dbs-omni.vert
index 69183a019..e98086729 100644
--- a/tests/glslparsertest/glsl2/xreal-lighting-dbs-omni.vert
+++ b/tests/glslparsertest/glsl2/xreal-lighting-dbs-omni.vert
@@ -39,7 +39,7 @@ varying mat3 var_OS2TSMatrix;
void main()
{
- // transform vertex position into homogenous clip-space
+ // transform vertex position into homogeneous clip-space
gl_Position = ftransform();
// assign position in object space
diff --git a/tests/glslparsertest/shaders/CorrectFull.vert b/tests/glslparsertest/shaders/CorrectFull.vert
index b3ff1e97a..d64ec713d 100644
--- a/tests/glslparsertest/shaders/CorrectFull.vert
+++ b/tests/glslparsertest/shaders/CorrectFull.vert
@@ -59,7 +59,7 @@ struct light7 {
light3 struct_var = light3(5.0);
-// Attribtue variables can only be Global
+// Attribute variables can only be Global
attribute float flt_attrib;
attribute vec2 vec2_attrib;
attribute vec3 vec3_attrib;
diff --git a/tests/glslparsertest/shaders/CorrectPreprocess5.frag b/tests/glslparsertest/shaders/CorrectPreprocess5.frag
index 09607731b..b7b2eac20 100644
--- a/tests/glslparsertest/shaders/CorrectPreprocess5.frag
+++ b/tests/glslparsertest/shaders/CorrectPreprocess5.frag
@@ -4,7 +4,7 @@
//
// [end config]
-//mutiple line macros - test case.
+//multiple line macros - test case.
#define test 5
#define t1 1
diff --git a/tests/glslparsertest/shaders/array1.frag b/tests/glslparsertest/shaders/array1.frag
index 74240cb98..06f7bd5dc 100644
--- a/tests/glslparsertest/shaders/array1.frag
+++ b/tests/glslparsertest/shaders/array1.frag
@@ -6,5 +6,5 @@
void main()
{
- int array[2][2]; // two dimentional arrays are not allowed
+ int array[2][2]; // two dimensional arrays are not allowed
}
diff --git a/tests/glslparsertest/shaders/comma2.frag b/tests/glslparsertest/shaders/comma2.frag
index 15e53ba4f..5e0925e44 100644
--- a/tests/glslparsertest/shaders/comma2.frag
+++ b/tests/glslparsertest/shaders/comma2.frag
@@ -6,7 +6,7 @@
void main()
{
- const vec4 v = (vec4(1,2,3,4), vec4(5,6,7,8), 1.2); // right most value of comma operator shoul be a vec4
+ const vec4 v = (vec4(1,2,3,4), vec4(5,6,7,8), 1.2); // right most value of comma operator should be a vec4
const vec4 v1 = (vec3(0.2, 2.0), vec4(1,2,3,4), vec4(5,6,7,8));
const vec4 v2 = (vec4(1,2,3,4), vec2(2.1, 2), vec4(5,6,7,8));
gl_FragColor = v + v1 + v2;
diff --git a/tests/glslparsertest/shaders/function3.frag b/tests/glslparsertest/shaders/function3.frag
index ff67b2a4e..46a920227 100644
--- a/tests/glslparsertest/shaders/function3.frag
+++ b/tests/glslparsertest/shaders/function3.frag
@@ -6,7 +6,7 @@
void function(const int i)
{
- i = 3; // const value cant be modified
+ i = 3; // const value can't be modified
}
void main()
diff --git a/tests/glslparsertest/shaders/preprocess1.frag b/tests/glslparsertest/shaders/preprocess1.frag
index 5802dc559..ae368fcaf 100644
--- a/tests/glslparsertest/shaders/preprocess1.frag
+++ b/tests/glslparsertest/shaders/preprocess1.frag
@@ -4,7 +4,7 @@
//
// [end config]
-// tests for macro redifinition (t2) and the #if and #else nestings.
+// tests for macro redefinition (t2) and the #if and #else nestings.
// takes care of elif also.
#define t1 (1+2)
diff --git a/tests/glslparsertest/shaders/preprocess2.frag b/tests/glslparsertest/shaders/preprocess2.frag
index bed38f441..f61779db2 100644
--- a/tests/glslparsertest/shaders/preprocess2.frag
+++ b/tests/glslparsertest/shaders/preprocess2.frag
@@ -6,7 +6,7 @@
// #line directive-- test cases.
// chks for Invalid directives, all possible #line errors
-// Also checks the correct verions of #line dorective.
+// Also checks the correct versions of #line dorective.
#define t1 1
#define t2 2
diff --git a/tests/glslparsertest/shaders/preprocess4.frag b/tests/glslparsertest/shaders/preprocess4.frag
index 6c3362602..1d89d12fb 100644
--- a/tests/glslparsertest/shaders/preprocess4.frag
+++ b/tests/glslparsertest/shaders/preprocess4.frag
@@ -50,6 +50,6 @@ int foo(int test)
#pragma bind
#pragma (on)
#pragma on (on)
-#pragma optmize(on
+#pragma optimize(on
diff --git a/tests/glslparsertest/shaders/struct7.frag b/tests/glslparsertest/shaders/struct7.frag
index 54d21957e..04176b5a9 100644
--- a/tests/glslparsertest/shaders/struct7.frag
+++ b/tests/glslparsertest/shaders/struct7.frag
@@ -7,5 +7,5 @@
void main()
{
struct s {
- } s1; // structures have to be declared with atleast one member
+ } s1; // structures have to be declared with at least one member
}
diff --git a/tests/glx/CMakeLists.gl.txt b/tests/glx/CMakeLists.gl.txt
index 5dfe9f58c..f34342cfe 100644
--- a/tests/glx/CMakeLists.gl.txt
+++ b/tests/glx/CMakeLists.gl.txt
@@ -12,6 +12,7 @@ endif(PIGLIT_BUILD_GLX_TESTS)
link_libraries (
${OPENGL_gl_LIBRARY}
+ ${CMAKE_THREAD_LIBS_INIT}
)
IF(PIGLIT_BUILD_GLX_TESTS)
@@ -56,6 +57,8 @@ IF(PIGLIT_BUILD_GLX_TESTS)
piglit_add_executable (glx-multithread-shader-compile glx-multithread-shader-compile.c)
target_link_libraries(glx-multithread-shader-compile pthread)
piglit_add_executable (glx-make-current glx-make-current.c)
+ piglit_add_executable (glx-make-current-other-thread glx-make-current-other-thread.c)
+ piglit_add_executable (glx-copy-context-dest-current glx-copy-context-dest-current.c)
piglit_add_executable (glx-swap-event glx-swap-event.c)
piglit_add_executable (glx-make-glxdrawable-current glx-make-glxdrawable-current.c)
piglit_add_executable (glx-swap-exchange glx-swap-exchange.c)
diff --git a/tests/glx/glx-copy-context-dest-current.c b/tests/glx/glx-copy-context-dest-current.c
new file mode 100644
index 000000000..a4bd496b8
--- /dev/null
+++ b/tests/glx/glx-copy-context-dest-current.c
@@ -0,0 +1,108 @@
+/*
+ * Copyright (c) 2023 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+/** @file glx-copy-context-dest-current.c
+ *
+ * BadAccess is generated if dst is current to any thread (including the
+ * calling thread) at the time glXCopyContext is called.
+ */
+
+#include <unistd.h>
+#include "piglit-util-gl.h"
+#include "piglit-glx-util.h"
+
+static Display *dpy;
+static Window win;
+static XVisualInfo *visinfo;
+
+unsigned char glx_error = Success;
+int
+expect_badvalue(Display *dpy, XErrorEvent *e)
+{
+ glx_error = e->error_code;
+ return 0;
+}
+
+int
+main(int argc, char **argv)
+{
+ int i;
+ int ret;
+ int (*old_handler)(Display *, XErrorEvent *);
+
+ for (i = 1; i < argc; ++i) {
+ if (!strcmp(argv[i], "-auto"))
+ piglit_automatic = 1;
+ else
+ fprintf(stderr, "Unknown option: %s\n", argv[i]);
+ }
+
+ dpy = XOpenDisplay(NULL);
+ if (dpy == NULL) {
+ fprintf(stderr, "couldn't open display\n");
+ piglit_report_result(PIGLIT_FAIL);
+ }
+ visinfo = piglit_get_glx_visual(dpy);
+ win = piglit_get_glx_window(dpy, visinfo);
+
+ old_handler = XSetErrorHandler(expect_badvalue);
+
+ GLXContext ctx1, ctx2;
+ ctx1 = piglit_get_glx_context(dpy, visinfo);
+ ctx2 = piglit_get_glx_context(dpy, visinfo);
+
+ ret = glXMakeCurrent(dpy, win, ctx1);
+ if (ret != True) {
+ printf("glXMakeCurrent ctx1 has failed.\n");
+ piglit_report_result(PIGLIT_FAIL);
+ }
+
+ ret = glXMakeCurrent(dpy, win, ctx2);
+ if (ret != True) {
+ printf("glXMakeCurrent ctx2 has failed.\n");
+ piglit_report_result(PIGLIT_FAIL);
+ }
+
+ glXCopyContext(dpy, ctx1, ctx2, ULONG_MAX);
+ XSync(dpy, False);
+
+ if (glx_error != BadAccess) {
+ printf("Failed to get BadAccess from glXCopyContext with already "
+ "current dest.\n");
+ piglit_report_result(PIGLIT_FAIL);
+ }
+
+ /* Free our resources when we're done. */
+ XSetErrorHandler(old_handler);
+ glXMakeCurrent(dpy, None, NULL);
+
+ glXDestroyContext(dpy, ctx1);
+ glXDestroyContext(dpy, ctx2);
+
+ if (glx_error == BadAccess)
+ piglit_report_result(PIGLIT_PASS);
+ else
+ piglit_report_result(PIGLIT_FAIL);
+
+ return 0;
+}
diff --git a/tests/glx/glx-make-current-other-thread.c b/tests/glx/glx-make-current-other-thread.c
new file mode 100644
index 000000000..56dc650d1
--- /dev/null
+++ b/tests/glx/glx-make-current-other-thread.c
@@ -0,0 +1,122 @@
+/*
+ * Copyright (c) 2023 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+/** @file glx-make-current-other-thread.c
+ *
+ * According to GLX spec BadAccess is generated if ctx was current
+ * to another thread at the time glXMakeCurrent was called.
+ */
+
+#include <unistd.h>
+#include "piglit-util-gl.h"
+#include "piglit-glx-util.h"
+#include "pthread.h"
+
+static Display *dpy;
+static Window win;
+static XVisualInfo *visinfo;
+
+unsigned char glx_error = Success;
+int
+expect_badvalue(Display *dpy, XErrorEvent *e)
+{
+ glx_error = e->error_code;
+ return 0;
+}
+
+static void *
+thread_func(void *arg)
+{
+ GLXContext ctx = arg;
+ int ret = glXMakeCurrent(dpy, win, ctx);
+ glXDestroyContext(dpy, ctx);
+ return (void *)(intptr_t)ret;
+}
+
+int
+main(int argc, char **argv)
+{
+ int i;
+ int ret;
+ void *retval;
+ pthread_t thread;
+ int (*old_handler)(Display *, XErrorEvent *);
+
+ for (i = 1; i < argc; ++i) {
+ if (!strcmp(argv[i], "-auto"))
+ piglit_automatic = 1;
+ else
+ fprintf(stderr, "Unknown option: %s\n", argv[i]);
+ }
+
+ dpy = XOpenDisplay(NULL);
+ if (dpy == NULL) {
+ fprintf(stderr, "couldn't open display\n");
+ piglit_report_result(PIGLIT_FAIL);
+ }
+ visinfo = piglit_get_glx_visual(dpy);
+ win = piglit_get_glx_window(dpy, visinfo);
+
+ old_handler = XSetErrorHandler(expect_badvalue);
+
+ GLXContext ctx;
+ ctx = piglit_get_glx_context(dpy, visinfo);
+ ret = glXMakeCurrent(dpy, win, ctx);
+
+ if (ret != True) {
+ printf("First glXMakeCurrent has failed.\n");
+ piglit_report_result(PIGLIT_FAIL);
+ }
+
+ ret = glXMakeCurrent(dpy, win, ctx);
+
+ if (ret != True) {
+ printf("Second glXMakeCurrent in same thread has failed.\n");
+ piglit_report_result(PIGLIT_FAIL);
+ }
+
+ pthread_create(&thread, NULL, thread_func, ctx);
+
+ ret = pthread_join(thread, &retval);
+ if (retval != False) {
+ printf("Second glXMakeCurrent in other thread has NOT failed.\n");
+ piglit_report_result(PIGLIT_FAIL);
+ }
+
+ if (glx_error != BadAccess) {
+ printf(
+ "Failed to get BadAccess from glXMakeCurrent() in other thread.\n");
+ piglit_report_result(PIGLIT_FAIL);
+ }
+
+ /* Free our resources when we're done. */
+ XSetErrorHandler(old_handler);
+ glXMakeCurrent(dpy, None, NULL);
+
+ if (glx_error == BadAccess)
+ piglit_report_result(PIGLIT_PASS);
+ else
+ piglit_report_result(PIGLIT_FAIL);
+
+ return 0;
+}
diff --git a/tests/glx/glx-make-current.c b/tests/glx/glx-make-current.c
index 108ecc3b0..32caddae4 100644
--- a/tests/glx/glx-make-current.c
+++ b/tests/glx/glx-make-current.c
@@ -37,40 +37,42 @@
int piglit_width = 50, piglit_height = 50;
static Display *dpy;
-static Window win_one, win_two;
+#define NUM_WINDOWS 3
+static Window wins[NUM_WINDOWS];
static XVisualInfo *visinfo;
enum piglit_result
draw(Display *dpy)
{
GLXContext ctx;
- float green[] = {0.0, 1.0, 0.0, 0.0};
+ float color[] = {
+ (float)rand() / RAND_MAX, (float)rand() / RAND_MAX, (float)rand() / RAND_MAX, 0.0
+ };
GLboolean pass = GL_TRUE;
ctx = piglit_get_glx_context(dpy, visinfo);
- glXMakeCurrent(dpy, win_one, ctx);
+ glXMakeCurrent(dpy, wins[0], ctx);
piglit_dispatch_default_init(PIGLIT_DISPATCH_GL);
-
- glClearColor(0.0, 1.0, 0.0, 1.0);
- glClear(GL_COLOR_BUFFER_BIT);
-
- glXMakeCurrent(dpy, win_two, ctx);
-
+ glClearColor(color[0], color[1], color[2], 1.0);
glClear(GL_COLOR_BUFFER_BIT);
+ for (int i = 1; i < NUM_WINDOWS; i++) {
+ glXMakeCurrent(dpy, wins[i], ctx);
+ glClear(GL_COLOR_BUFFER_BIT);
+ }
- glXMakeCurrent(dpy, win_one, ctx);
- pass &= piglit_probe_pixel_rgb(1, 1, green);
-
- glXMakeCurrent(dpy, win_two, ctx);
- pass &= piglit_probe_pixel_rgb(1, 1, green);
-
- glXSwapBuffers(dpy, win_one);
- glXSwapBuffers(dpy, win_two);
+ for (int i = 0; i < NUM_WINDOWS; i++) {
+ glXMakeCurrent(dpy, wins[i], ctx);
+ if (!piglit_probe_pixel_rgb(1, 1, color)) {
+ printf(" (test failed for window %d)\n", i);
+ pass = false;
+ }
+ }
- /* Free our resources when we're done. */
- glXMakeCurrent(dpy, None, NULL);
- glXDestroyContext(dpy, ctx);
+ for (int i = 0; i < NUM_WINDOWS; i++) {
+ glXMakeCurrent(dpy, wins[i], ctx);
+ glXSwapBuffers(dpy, wins[i]);
+ }
return pass ? PIGLIT_PASS : PIGLIT_FAIL;
}
@@ -93,10 +95,14 @@ main(int argc, char **argv)
piglit_report_result(PIGLIT_FAIL);
}
visinfo = piglit_get_glx_visual(dpy);
- win_one = piglit_get_glx_window(dpy, visinfo);
- win_two = piglit_get_glx_window(dpy, visinfo);
+ for (int i = 0; i < NUM_WINDOWS; i++)
+ wins[i] = piglit_get_glx_window(dpy, visinfo);
piglit_glx_event_loop(dpy, draw);
+ /* Free our resources when we're done. */
+ glXMakeCurrent(dpy, None, NULL);
+ glXDestroyContext(dpy, piglit_get_glx_context(dpy, visinfo));
+
return 0;
}
diff --git a/tests/glx/glx-multithread-buffer.c b/tests/glx/glx-multithread-buffer.c
index 0581c80d1..fedd69b40 100644
--- a/tests/glx/glx-multithread-buffer.c
+++ b/tests/glx/glx-multithread-buffer.c
@@ -76,6 +76,8 @@ draw(Display *dpy)
piglit_dispatch_default_init(PIGLIT_DISPATCH_GL);
+ piglit_require_GLSL_version(140);
+
glGenBuffers(1, &buf);
glBindBuffer(GL_UNIFORM_BUFFER, buf);
glBufferData(GL_UNIFORM_BUFFER, 2048, NULL, GL_DYNAMIC_DRAW);
diff --git a/tests/glx/glx-multithread-shader-compile.c b/tests/glx/glx-multithread-shader-compile.c
index 7d7723da8..d9ffc7ac2 100644
--- a/tests/glx/glx-multithread-shader-compile.c
+++ b/tests/glx/glx-multithread-shader-compile.c
@@ -26,7 +26,7 @@
* @author Mathias Fröhlich
*
* Create two GLX contexts and concurrently compile shaders.
- * Exercises a race conditon with the r600 llvm compiler.
+ * Exercises a race condition with the r600 llvm compiler.
*/
#include "piglit-util-gl.h"
diff --git a/tests/glx/glx-string-sanity.c b/tests/glx/glx-string-sanity.c
index 3a86f11b8..1a881375d 100644
--- a/tests/glx/glx-string-sanity.c
+++ b/tests/glx/glx-string-sanity.c
@@ -155,16 +155,7 @@ main(int argc, char **argv)
/* Try to find the extension in the client extension list.
*/
client = find_extension(client_string, buf, bytes);
- if (client != NULL) {
- if (find_extension(unified_string, buf, bytes) == NULL) {
- fprintf(stderr,
- "%s found in both client and server "
- "extension strings, but missing from "
- "unified string.\n",
- buf);
- pass = false;
- }
- } else {
+ if (client == NULL) {
if (find_extension(unified_string, buf, bytes) != NULL) {
fprintf(stderr,
"%s not found in client extension "
diff --git a/tests/glx/glx-swap-event.c b/tests/glx/glx-swap-event.c
index a86410380..705fb8da9 100644
--- a/tests/glx/glx-swap-event.c
+++ b/tests/glx/glx-swap-event.c
@@ -30,6 +30,7 @@
*/
#include "piglit-util-gl.h"
+#include "piglit-glx-util.h"
#include "GL/glx.h"
#include <sys/time.h>
@@ -41,174 +42,40 @@ current_time(void)
return (double) piglit_time_get_nano() / 1000000000.0;
}
-PFNGLXSWAPINTERVALMESAPROC pglXSwapIntervalMESA;
-PFNGLXGETSWAPINTERVALMESAPROC pglXGetSwapIntervalMESA;
-
#define STACK_L 10
static GLboolean fullscreen = GL_FALSE; /* Create a fullscreen window */
static GLboolean verbose = GL_FALSE; /* Disable verbose. */
static GLboolean Automatic = GL_FALSE; /* Test automatically. */
-static GLboolean test_events = GL_FALSE; /* Test event can be received. */
-static GLboolean interval_diff = GL_FALSE; /* Test interval can be set. */
-static GLboolean async = GL_FALSE; /* Test asynchronize. */
+static GLboolean interval_0 = GL_FALSE; /* Test with swap interval 0. */
int event_base, Glx_event, count=0, swap_count=0, event_count=0;
-static int Intel_swap_event=0;
-int event_count_total=0, frames_total=0, message_count=0;
-static double time_call=0.0, time_fin=0.0, time_val=0.0;
+int event_count_total=0, frames_total=0;
double swap_start[STACK_L],swap_returned[STACK_L];
-int interval=0;
char * swap_event_type=NULL;
-/**
- * Determine whether or not a GLX extension is supported.
- */
-static int
-is_glx_extension_supported(Display *dpy, const char *query)
-{
- const int scrnum = DefaultScreen(dpy);
- const char *glx_extensions = NULL;
- const size_t len = strlen(query);
- const char *ptr;
-
- if (glx_extensions == NULL) {
- glx_extensions = glXQueryExtensionsString(dpy, scrnum);
- }
-
- ptr = strstr(glx_extensions, query);
- return ((ptr != NULL) && ((ptr[len] == ' ') || (ptr[len] == '\0')));
-}
-
-static void
-query_swap_event(Display *dpy)
-{
-
- if ( ! is_glx_extension_supported(dpy, "GLX_INTEL_swap_event")) {
- printf("The GLX_INTEL_swap_event is not supported in current version.\n");
- piglit_report_result(PIGLIT_SKIP);
- } else {
- printf("The GLX_INTEL_swap_event is supported in current version.\n");
- }
-
- if (interval_diff) {
- if ( ! is_glx_extension_supported(dpy, "GLX_MESA_swap_control")) {
- printf("GLX_MESA_swap_control was not supported by the driver.\n");
- piglit_report_result(PIGLIT_SKIP);
- } else {
- pglXGetSwapIntervalMESA = (PFNGLXGETSWAPINTERVALMESAPROC)
- glXGetProcAddressARB((const GLubyte *) "glXGetSwapIntervalMESA");
- pglXSwapIntervalMESA = (PFNGLXSWAPINTERVALMESAPROC)
- glXGetProcAddressARB((const GLubyte *) "glXSwapIntervalMESA");
- }
- }
-}
+double start_time;
/** Draw single frame, do SwapBuffers, compute FPS */
static void
draw_frame(Display *dpy, Window win)
{
- static int frames = 0, async_swap;
- static double tRot0 = -1.0, tRate0 = -1.0;
- static double swap_freq[2];
+ static int frames = 0;
double t = current_time();
- int tem, ret;
-
- if (tRot0 < 0.0)
- tRot0 = t;
- tRot0 = t;
-
- if (tRate0 < 0.0)
- tRate0 = t;
- if (t - tRate0 >= 3.0) {
- GLfloat seconds;
- if (interval_diff) {
- if (message_count & 0x1) {
- ret = (*pglXSwapIntervalMESA)(1);
- if ( ret ) {
- printf("Failed to set swap interval to 1 (%d).\n", ret);
- piglit_report_result(PIGLIT_FAIL);
- }
- } else{
- ret = (*pglXSwapIntervalMESA)(0);
- if ( ret ) {
- printf("Failed to set swap interval to 0.\n");
- piglit_report_result(PIGLIT_FAIL);
- }
- }
- }
- message_count++;
- seconds = t - tRate0;
- if ( (time_val / frames) < 0.0016 ) {
- // 0.0016 <=> 60Hz * 10 or 100Hz * 6
- async_swap=1;
- } else{
- async_swap=0;
- }
- interval=1-interval;
- swap_freq[interval] = frames / seconds;
+
+ GLfloat duration = t - start_time;
+ if (duration >= 3.0) {
if (Automatic) {
- if (message_count==2) {
- if (test_events) {
- if ( Intel_swap_event != 0 ) {
- if (verbose) {
- printf("glXSwapBuffers is called %d times and there\
- is %d Intel_swap_event received in past %3.1f seconds.\n", swap_count,
-event_count, seconds);
- printf("There is swap event received, and the swap \
-type is %s.\n", swap_event_type);
- }
- piglit_report_result(PIGLIT_PASS);
- } else{
- if (verbose) {
- printf("glXSwapBuffers is called %d times and there\
- is %d Intel_swap_event received in past %3.1f seconds.\n", swap_count,
-event_count, seconds);
- printf("There is no swap event received, and the \
-swap type is %s.\n", swap_event_type);
- }
- piglit_report_result(PIGLIT_FAIL);
- }
-
- }
- if (interval_diff) {
- tem = 1.5 * swap_freq[1];
- if ( swap_freq[0] >= tem ) {
- if (verbose) {
- printf("The swap frequency of no swap interval is \
-much larger than swap interval being 1.\n");
- }
- piglit_report_result(PIGLIT_PASS);
- } else{
- if(fullscreen)
- {
- if(verbose)
- printf("In fullscreen mode, the swap frequency of \
-no swap interval is limited under fresh rate.\n");
- piglit_report_result(PIGLIT_PASS);
- }
- if (verbose) {
- printf("The swap frequency of no swap interval is \
-not much larger than swap interval being 1. They are %lf and %lf.\n",
-swap_freq[0], swap_freq[1]);
- }
- piglit_report_result(PIGLIT_FAIL);
- }
- }
- if (async) {
- if (verbose) {
- printf("It takes about %lf seconds returning back from\
- the glXSwapBuffers call on average.\n", (time_val / frames));
- }
- if (async_swap ==1 ) {
- piglit_report_result(PIGLIT_PASS);
- } else{
- piglit_report_result(PIGLIT_FAIL);
- }
- }
- }
+ printf("glXSwapBuffers is called %d times and there were "
+ "%d swap events received in past %3.1f seconds.\n",
+ swap_count, event_count, duration);
+ if (event_count != 0) {
+ printf("swap type was %s.\n", swap_event_type);
+ piglit_report_result(PIGLIT_PASS);
+ } else {
+ piglit_report_result(PIGLIT_FAIL);
+ }
}
- tRate0 = t;
+ start_time = t;
frames = 0;
- time_val = 0;
swap_count= 0;
event_count= 0;
}
@@ -222,12 +89,9 @@ swap_freq[0], swap_freq[1]);
}
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
count=frames_total%STACK_L;
- time_call=current_time();
- swap_start[count]=time_call;
+ swap_start[count] = current_time();
glXSwapBuffers(dpy, win);
- time_fin=current_time();
- swap_returned[count]=time_fin;
- time_val+=(time_fin-time_call);
+ swap_returned[count] = current_time();
frames++;
frames_total++;
@@ -376,19 +240,19 @@ handle_event(Display *dpy, Window win, XEvent *event)
XEvent * event_p=event;
GLXBufferSwapComplete * glx_event=(GLXBufferSwapComplete *) event_p;
static double t_last=-1.0;
- time_fin=current_time();
+ double_t time = current_time();
if (t_last < 0) {
- t_last=time_fin;
+ t_last=time;
}
- if ( time_fin - t_last >= 3.0) {
+ if ( time - t_last >= 3.0) {
if ( verbose ) {
count=event_count_total%STACK_L;
printf("It receives the recent event at %lf seconds, and that\
glXSwapBuffers was called at %lf seconds, its swap returned at %lf seconds, so\
- the total time of glXSwapBuffers takes is %lf seconds.\n", time_fin,
-swap_start[count], swap_returned[count], (time_fin-swap_start[count]));
+ the total time of glXSwapBuffers takes is %lf seconds.\n", time,
+swap_start[count], swap_returned[count], (time - swap_start[count]));
}
- t_last=time_fin;
+ t_last=time;
}
if (glx_event->drawable != win) {
@@ -415,19 +279,16 @@ swap_start[count], swap_returned[count], (time_fin-swap_start[count]));
(unsigned long long)glx_event->sbc);
switch (glx_event->event_type) {
case GLX_EXCHANGE_COMPLETE_INTEL:
- Intel_swap_event=GLX_EXCHANGE_COMPLETE_INTEL;
swap_event_type="GLX_EXCHANGE_COMPLETE_INTEL";
event_count++;
event_count_total++;
break;
case GLX_COPY_COMPLETE_INTEL:
- Intel_swap_event=GLX_COPY_COMPLETE_INTEL;
swap_event_type="GLX_COPY_COMPLETE_INTEL";
event_count++;
event_count_total++;
break;
case GLX_FLIP_COMPLETE_INTEL:
- Intel_swap_event=GLX_FLIP_COMPLETE_INTEL;
swap_event_type="GLX_FLIP_COMPLETE_INTEL";
event_count++;
event_count_total++;
@@ -440,6 +301,8 @@ swap_start[count], swap_returned[count], (time_fin-swap_start[count]));
static void
event_loop(Display *dpy, GLXWindow glxWin, Window win)
{
+ start_time = current_time();
+
while (1) {
while (XPending(dpy) > 0) {
XEvent event;
@@ -460,10 +323,7 @@ usage(void)
printf(" -fullscreen run in fullscreen mode\n");
printf(" -v verbose mode, have more log\n");
printf(" -auto test automatically \n");
- printf(" --event test whether we can get swap events\n");
- printf(" --interval we expect that swap interval set to 0 should \
-have higher swap frequency than interval to 1\n");
- printf(" --async test whether glXSwapBuffers is done asynchronously\n");
+ printf(" --interval-0 test swap event delivery with swap interval 0\n");
}
@@ -489,25 +349,14 @@ main(int argc, char *argv[])
else if (strcmp(argv[i], "-fullscreen") == 0) {
fullscreen = GL_TRUE;
}
- else if (strcmp(argv[i], "--event") == 0) {
- test_events=GL_TRUE;
- }
- else if (strcmp(argv[i], "--async") == 0) {
- async = GL_TRUE;
- }
- else if (strcmp(argv[i], "--interval") == 0) {
- interval_diff = GL_TRUE;
+ else if (strcmp(argv[i], "--interval-0") == 0) {
+ interval_0 = GL_TRUE;
}
else {
usage();
piglit_report_result(PIGLIT_SKIP);
}
}
- if (!( interval_diff || async || test_events )) {
- printf("Which do you want to test, events? asynchronous? or swap interval?\n");
- usage();
- piglit_report_result(PIGLIT_SKIP);
- }
dpy = XOpenDisplay(dpyName);
if (!dpy) {
@@ -518,14 +367,18 @@ main(int argc, char *argv[])
make_window(dpy, "Swap event test", x, y, winWidth, winHeight, &win, &ctx, &glxWin);
- query_swap_event(dpy);
+ piglit_require_glx_extension(dpy, "GLX_INTEL_swap_event");
glXQueryExtension(dpy, &error_base, &event_base);
- if (interval_diff) {
- ret = (*pglXSwapIntervalMESA)(1);
+ if (interval_0) {
+ piglit_require_glx_extension(dpy, "GLX_INTEL_swap_event");
+ PFNGLXSWAPINTERVALMESAPROC pglXSwapIntervalMESA = (PFNGLXSWAPINTERVALMESAPROC)
+ glXGetProcAddressARB((const GLubyte *)"glXSwapIntervalMESA");
+
+ ret = (*pglXSwapIntervalMESA)(0);
if ( ret ) {
- printf("Failed to set swap interval to 1 (%d).\n", ret);
+ printf("Failed to set swap interval to 0 (%d).\n", ret);
piglit_report_result(PIGLIT_FAIL);
}
}
diff --git a/tests/hiz/hiz-util.c b/tests/hiz/hiz-util.c
index 253df9139..831ea3d5c 100644
--- a/tests/hiz/hiz-util.c
+++ b/tests/hiz/hiz-util.c
@@ -188,7 +188,7 @@ hiz_delete_fbo(GLuint fbo)
/* ------------------------------------------------------------------------ */
/**
- * \name hiz_run_depth_test utilties
+ * \name hiz_run_depth_test utilities
*
* Utilities for testing depth testing.
*
@@ -281,7 +281,7 @@ hiz_run_test_depth_test_window()
/* ------------------------------------------------------------------------ */
/**
- * \name hiz_run_depth_read utilties
+ * \name hiz_run_depth_read utilities
*
* Utilities for testing depth reads.
*
@@ -385,7 +385,7 @@ hiz_run_test_depth_read_window()
/* ------------------------------------------------------------------------ */
/**
- * \name hiz_run_stencil_test utilties
+ * \name hiz_run_stencil_test utilities
*
* Utilities for testing stencil testing.
*
@@ -492,7 +492,7 @@ hiz_run_test_stencil_test_window()
/* ------------------------------------------------------------------------ */
/**
- * \name hiz_run_stencil_read utilties
+ * \name hiz_run_stencil_read utilities
*
* Utilities for testing the reading of the stencil buffer.
*
diff --git a/tests/llvmpipe/CMakeLists.gl.txt b/tests/llvmpipe/CMakeLists.gl.txt
index 6994a6e61..d8a22a4b4 100644
--- a/tests/llvmpipe/CMakeLists.gl.txt
+++ b/tests/llvmpipe/CMakeLists.gl.txt
@@ -17,7 +17,7 @@ link_libraries (
find_package(Git)
-IF( GIT_FOUND )
+IF( EXISTS ${CMAKE_SOURCE_DIR}/.git AND GIT_FOUND )
EXECUTE_PROCESS( COMMAND "${GIT_EXECUTABLE}" -C "${CMAKE_SOURCE_DIR}" rev-parse HEAD
WORKING_DIRECTORY "${DIR}"
RESULT_VARIABLE GIT_RESULT
@@ -28,22 +28,9 @@ IF( GIT_FOUND )
IF( NOT ${GIT_RESULT} EQUAL 0 )
MESSAGE( SEND_ERROR "Command '${GIT_EXECUTABLE} -C ${CMAKE_SOURCE_DIR} rev-parse HEAD' failed with following output:\n${GIT_ERROR}" )
ENDIF( NOT ${GIT_RESULT} EQUAL 0 )
-
- EXECUTE_PROCESS( COMMAND "${GIT_EXECUTABLE}" -C "${CMAKE_SOURCE_DIR}" rev-parse --short HEAD
- WORKING_DIRECTORY "${DIR}"
- RESULT_VARIABLE GIT_RESULT
- OUTPUT_VARIABLE "GIT_HEAD_HASH_SHORT"
- ERROR_VARIABLE GIT_ERROR
- OUTPUT_STRIP_TRAILING_WHITESPACE )
-
- IF( NOT ${GIT_RESULT} EQUAL 0 )
- MESSAGE( SEND_ERROR "Command '${GIT_EXECUTABLE} -C ${CMAKE_SOURCE_DIR} rev-parse --short HEAD' failed with following output:\n${GIT_ERROR}" )
- ENDIF( NOT ${GIT_RESULT} EQUAL 0 )
-
-ENDIF( GIT_FOUND )
+ENDIF( EXISTS ${CMAKE_SOURCE_DIR}/.git AND GIT_FOUND )
set ("GIT_HEAD_HASH" "${GIT_HEAD_HASH}" )
-set ("GIT_HEAD_HASH_SHORT" "${GIT_HEAD_HASH_SHORT}")
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/version.h.in
diff --git a/tests/llvmpipe/tests/random.h b/tests/llvmpipe/tests/random.h
index dc7b57f1c..32ace790e 100644
--- a/tests/llvmpipe/tests/random.h
+++ b/tests/llvmpipe/tests/random.h
@@ -129,7 +129,7 @@ protected:
for (int y = 0; y < height; ++y) {
for (int x = 0; x < width; ++x) {
Colour& pixel = result[x + y * width];
- /* A easily identifiable pattern with x / y co-ordinates in color values
+ /* A easily identifiable pattern with x / y coordinates in color values
pixel[0] = (x % 10) / 10.0f;
pixel[1] = (y % 10) / 10.0f;
pixel[2] = (x % 10) / 10.0f + (y % 10) / 100.0f;
diff --git a/tests/llvmpipe/tests/test.h b/tests/llvmpipe/tests/test.h
index 1d26786a5..c948cac7f 100644
--- a/tests/llvmpipe/tests/test.h
+++ b/tests/llvmpipe/tests/test.h
@@ -31,6 +31,7 @@
class Test {
public:
Test()
+ : mErrorX(0), mErrorY(0)
{
mDraw.width = piglit_width;
mDraw.height = piglit_height;
diff --git a/tests/llvmpipe/utils/framebuffer.h b/tests/llvmpipe/utils/framebuffer.h
index b60fa20d0..c49a963f4 100644
--- a/tests/llvmpipe/utils/framebuffer.h
+++ b/tests/llvmpipe/utils/framebuffer.h
@@ -31,7 +31,7 @@ class FrameBuffer
{
public:
FrameBuffer()
- : mWidth(0), mHeight(0), mTexture(0), mFrameBuffer(0)
+ : mWidth(0), mHeight(0), mTexture(0), mFrameBuffer(0), mChannelType(0), mClamped(false)
{
mInternalFormat = GL_RGBA;
mFormat = GL_BGRA;
diff --git a/tests/no_error.py b/tests/no_error.py
index 7799cef02..4ecaa9a01 100644
--- a/tests/no_error.py
+++ b/tests/no_error.py
@@ -15,7 +15,7 @@ profile = TestProfile()
profile.filters = _profile1.filters + _profile2.filters
# Add a modified version of each PiglitGLTest as a khr_no_error variant.
-# Shader runner doesn't explitly test for expected errors so we add shader
+# Shader runner doesn't explicitly test for expected errors so we add shader
# tests as is. We actively filter GLSL parser and any other type of tests.
for name, test in itertools.chain(_profile1.test_list.items(),
_profile2.test_list.items()):
diff --git a/tests/opengl.py b/tests/opengl.py
index ec67aa4dc..b9bd17a9d 100644
--- a/tests/opengl.py
+++ b/tests/opengl.py
@@ -383,17 +383,15 @@ with profile.test_list.group_manager(
g(['glx-multithread-shader-compile'], run_concurrent=False)
g(['glx-shader-sharing'], run_concurrent=False)
g(['glx-swap-exchange'], run_concurrent=False)
- g(['glx-swap-event', '--event'], 'glx-swap-event_event',
- run_concurrent=False)
- g(['glx-swap-event', '--async'], 'glx-swap-event_async',
- run_concurrent=False)
- g(['glx-swap-event', '--interval'], 'glx-swap-event_interval',
- run_concurrent=False)
+ g(['glx-swap-event', '--event'], 'glx-swap-event')
+ g(['glx-swap-event', '--interval-0'], 'glx-swap-event-interval-0')
g(['glx-swap-pixmap'], run_concurrent=False)
g(['glx-swap-pixmap-bad'], run_concurrent=False)
g(['glx-swap-singlebuffer'], run_concurrent=False)
g(['glx-swap-copy'], run_concurrent=False)
- g(['glx-make-current'], run_concurrent=False)
+ g(['glx-make-current'])
+ g(['glx-make-current-other-thread'])
+ g(['glx-copy-context-dest-current'])
g(['glx-make-glxdrawable-current'], run_concurrent=False)
g(['glx-context-flush-control'], run_concurrent=False)
g(['glx-buffer-age'], run_concurrent=False)
@@ -614,6 +612,7 @@ with profile.test_list.group_manager(
g(['gl-1.0-user-clip-all-planes'])
g(['rasterpos'])
g(['depth-clear-precision-check'])
+ g(['depth-clear-with-copy'])
with profile.test_list.group_manager(
PiglitGLTest,
@@ -659,6 +658,8 @@ with profile.test_list.group_manager(
g(['hiz'])
g(['infinite-spot-light'])
g(['line-aa-width'])
+ g(['line-smooth-coverage'])
+ g(['line-smooth-stipple'])
g(['line-flat-clip-color'])
g(['lineloop'])
g(['lineloop', '-dlist'], 'lineloop-dlist')
@@ -946,6 +947,7 @@ with profile.test_list.group_manager(
g(['generatemipmap-base-change', 'format'])
g(['generatemipmap-cubemap'])
g(['viewport-clamp'])
+ g(['texsubimage-sync'])
with profile.test_list.group_manager(
PiglitGLTest,
@@ -1708,6 +1710,19 @@ with profile.test_list.group_manager(
g(['arb_sync-ClientWaitSync-timeout'], 'ClientWaitSync-timeout')
g(['sync_api'])
+# Group APPLE_sync
+with profile.test_list.group_manager(
+ PiglitGLTest, grouptools.join('spec', 'APPLE_sync')) as g:
+ g(['apple_sync-client-wait-errors'], 'ClientWaitSync-errors')
+ g(['apple_sync-delete'], 'DeleteSync')
+ g(['apple_sync-fence-sync-errors'], 'FenceSync-errors')
+ g(['apple_sync-get-sync-errors'], 'GetSynciv-errors')
+ g(['apple_sync-is-sync'], 'IsSync')
+ g(['apple_sync-repeat-wait'], 'repeat-wait')
+ g(['apple_sync-sync-initialize'], 'sync-initialize')
+ g(['apple_sync-timeout-zero'], 'timeout-zero')
+ g(['apple_sync-WaitSync-errors'], 'WaitSync-errors')
+
# Group ARB_ES2_compatibility
with profile.test_list.group_manager(
PiglitGLTest, grouptools.join('spec', 'ARB_ES2_compatibility')) as g:
@@ -2167,6 +2182,15 @@ with profile.test_list.group_manager(
'uniform namespace is per-program')
g(['arb_separate_shader_object-xfb-rendezvous_by_location'],
'Transform feedback with rendezvous by location')
+ g(['arb_separate_shader_object-xfb-explicit-location-array', 'vs'],
+ 'xfb-explicit-location-array_vs',
+ run_concurrent=False)
+ g(['arb_separate_shader_object-xfb-explicit-location-array', 'gs'],
+ 'xfb-explicit-location-array_gs',
+ run_concurrent=False)
+ g(['arb_separate_shader_object-xfb-explicit-location-array', 'gs_max'],
+ 'xfb-explicit-location-array_gs_max',
+ run_concurrent=False)
# Group ARB_sampler_objects
with profile.test_list.group_manager(
@@ -2239,6 +2263,14 @@ with profile.test_list.group_manager(
g(['arb_occlusion_query2-api'], 'api')
g(['arb_occlusion_query2-render'], 'render')
+# Group EXT_debug_label
+with profile.test_list.group_manager(
+ PiglitGLTest,
+ grouptools.join('spec', 'EXT_debug_label')) as g:
+ g(['ext_debug_label-object-label_gl'], 'object-label_gl')
+ g(['ext_debug_label-object-label_gles2'], 'object-label_gles2')
+ g(['ext_debug_label-object-label_gles3'], 'object-label_gles3')
+
# Group EXT_external_objects tests
with profile.test_list.group_manager(
PiglitGLTest,
@@ -3156,6 +3188,7 @@ with profile.test_list.group_manager(
g(['ext_image_dma_buf_import-unsupported_format'], run_concurrent=False)
g(['ext_image_dma_buf_import-intel_external_sampler_only'],
run_concurrent=False)
+ g(['ext_image_dma_buf_import-modifiers'])
g(['ext_image_dma_buf_import-refcount'])
g(['ext_image_dma_buf_import-sample_rgb', '-fmt=AR24'],
'ext_image_dma_buf_import-sample_argb8888', run_concurrent=False)
@@ -3163,6 +3196,8 @@ with profile.test_list.group_manager(
'ext_image_dma_buf_import-sample_xrgb8888', run_concurrent=False)
g(['ext_image_dma_buf_import-sample_yuv', '-fmt=NV12'],
'ext_image_dma_buf_import-sample_nv12', run_concurrent=False)
+ g(['ext_image_dma_buf_import-sample_yuv', '-fmt=NV21'],
+ 'ext_image_dma_buf_import-sample_nv21', run_concurrent=False)
g(['ext_image_dma_buf_import-sample_yuv', '-fmt=YU12'],
'ext_image_dma_buf_import-sample_yuv420', run_concurrent=False)
g(['ext_image_dma_buf_import-sample_yuv', '-fmt=YV12'],
@@ -3191,14 +3226,19 @@ with profile.test_list.group_manager(
'ext_image_dma_buf_import-sample_y416', run_concurrent=False)
g(['ext_image_dma_buf_import-sample_yuv', '-fmt=YUYV'],
'ext_image_dma_buf_import-sample_yuyv', run_concurrent=False)
+ g(['ext_image_dma_buf_import-sample_yuv', '-fmt=YVYU'],
+ 'ext_image_dma_buf_import-sample_yvyu', run_concurrent=False)
g(['ext_image_dma_buf_import-sample_yuv', '-fmt=UYVY'],
'ext_image_dma_buf_import-sample_uyvy', run_concurrent=False)
+ g(['ext_image_dma_buf_import-sample_yuv', '-fmt=VYUY'],
+ 'ext_image_dma_buf_import-sample_vyuy', run_concurrent=False)
g(['ext_image_dma_buf_import-transcode-nv12-as-r8-gr88'],
'ext_image_dma_buf_import-transcode-nv12-as-r8-gr88',
run_concurrent=False)
g(['ext_image_dma_buf_import-export'], run_concurrent=False)
g(['ext_image_dma_buf_import-export-tex'], run_concurrent=False)
g(['ext_image_dma_buf_import-reimport-bug'], run_concurrent=False)
+ g(['ext_image_dma_buf_import-refcount-multithread'], run_concurrent=False)
with profile.test_list.group_manager(
PiglitGLTest,
@@ -3568,7 +3608,8 @@ with profile.test_list.group_manager(
'gl_ClipDistance[5]-no-subscript',
'gl_ClipDistance[6]-no-subscript',
'gl_ClipDistance[7]-no-subscript',
- 'gl_ClipDistance[8]-no-subscript']:
+ 'gl_ClipDistance[8]-no-subscript',
+ 'gl_CullDistance']:
g(['ext_transform_feedback-builtin-varyings', varying],
'builtin-varyings {}'.format(varying), run_concurrent=False)
@@ -3924,6 +3965,11 @@ with profile.test_list.group_manager(
g(['arb_seamless_cubemap-three-faces-average'])
with profile.test_list.group_manager(
+ PiglitGLTest,
+ grouptools.join('spec', 'amd_gpu_shader_half_float')) as g:
+ g(['amd_gpu_shader_half_float-explicit-offset-bufferstorage'], 'explicit-offset-bufferstorage')
+
+with profile.test_list.group_manager(
PiglitGLTest, grouptools.join('spec', 'AMD_pinned_memory')) as g:
g(['amd_pinned_memory', 'offset=0'], 'offset=0')
g(['amd_pinned_memory', 'increment-offset'], 'increment-offset')
@@ -4050,6 +4096,7 @@ with profile.test_list.group_manager(
g(['arb_clear_texture-stencil'])
g(['arb_clear_texture-texview'])
g(['arb_clear_texture-depth'])
+ g(['arb_clear_texture-supported-formats'])
with profile.test_list.group_manager(
PiglitGLTest,
@@ -4070,6 +4117,8 @@ with profile.test_list.group_manager(
with profile.test_list.group_manager(
PiglitGLTest,
grouptools.join('spec', 'arb_copy_image')) as g:
+ g(['arb_copy_image-levels-copy'])
+ g(['arb_copy_image-levels-copy', 'add-illegal-levels'])
g(['arb_copy_image-simple', '--tex-to-tex'])
g(['arb_copy_image-simple', '--rb-to-tex'])
g(['arb_copy_image-simple', '--rb-to-rb'])
diff --git a/tests/perf/common.c b/tests/perf/common.c
index 4aa029e0a..b07bd480c 100644
--- a/tests/perf/common.c
+++ b/tests/perf/common.c
@@ -69,7 +69,7 @@ measure_rate(perf_rate_func f, double duration, unsigned initial_iterations,
static double
measure_cpu_time(perf_rate_func f, unsigned iterations)
{
- intptr_t t0 = piglit_time_get_nano();
+ int64_t t0 = piglit_time_get_nano();
f(iterations); /* call the rendering function */
glFinish();
return (piglit_time_get_nano() - t0) * 0.000000001;
diff --git a/tests/perf/draw-prim-rate.c b/tests/perf/draw-prim-rate.c
index 5eabda43c..14c8a0aff 100644
--- a/tests/perf/draw-prim-rate.c
+++ b/tests/perf/draw-prim-rate.c
@@ -51,7 +51,7 @@ PIGLIT_GL_TEST_CONFIG_BEGIN
PIGLIT_GL_TEST_CONFIG_END
static unsigned gpu_freq_mhz;
-static GLint progs[3];
+static GLint progs[9];
void
piglit_init(int argc, char **argv)
@@ -64,18 +64,63 @@ piglit_init(int argc, char **argv)
piglit_require_gl_version(32);
progs[0] = piglit_build_simple_program(
- "#version 120 \n"
+ "#version 150 compatibility \n"
"void main() { \n"
" gl_Position = gl_Vertex; \n"
"}",
- "#version 120 \n"
+ "#version 150 compatibility \n"
"void main() { \n"
" gl_FragColor = vec4(1.0); \n"
"}");
progs[1] = piglit_build_simple_program(
"#version 150 compatibility \n"
+ "varying vec4 v[1]; \n"
+ "attribute vec4 a[1]; \n"
+ "void main() { \n"
+ " for (int i = 0; i < 1; i++) v[i] = a[i]; \n"
+ " gl_Position = gl_Vertex; \n"
+ "}",
+
+ "#version 150 compatibility \n"
+ "varying vec4 v[1]; \n"
+ "void main() { \n"
+ " gl_FragColor = v[0]; \n"
+ "}");
+
+ progs[2] = piglit_build_simple_program(
+ "#version 150 compatibility \n"
+ "varying vec4 v[2]; \n"
+ "attribute vec4 a[2]; \n"
+ "void main() { \n"
+ " for (int i = 0; i < 2; i++) v[i] = a[i]; \n"
+ " gl_Position = gl_Vertex; \n"
+ "}",
+
+ "#version 150 compatibility \n"
+ "varying vec4 v[2]; \n"
+ "void main() { \n"
+ " gl_FragColor = vec4(dot(v[0] * v[1], vec4(1.0)) == 1.0 ? 1.0 : 0.0); \n"
+ "}");
+
+ progs[3] = piglit_build_simple_program(
+ "#version 150 compatibility \n"
+ "varying vec4 v[3]; \n"
+ "attribute vec4 a[3]; \n"
+ "void main() { \n"
+ " for (int i = 0; i < 3; i++) v[i] = a[i]; \n"
+ " gl_Position = gl_Vertex; \n"
+ "}",
+
+ "#version 150 compatibility \n"
+ "varying vec4 v[3]; \n"
+ "void main() { \n"
+ " gl_FragColor = vec4(dot(v[0] * v[1] * v[2], vec4(1.0)) == 1.0 ? 1.0 : 0.0); \n"
+ "}");
+
+ progs[4] = piglit_build_simple_program(
+ "#version 150 compatibility \n"
"varying vec4 v[4]; \n"
"attribute vec4 a[4]; \n"
"void main() { \n"
@@ -86,10 +131,25 @@ piglit_init(int argc, char **argv)
"#version 150 compatibility \n"
"varying vec4 v[4]; \n"
"void main() { \n"
- " gl_FragColor = vec4(dot(v[0] + v[1] + v[2] + v[3], vec4(1.0)) == 1.0 ? 0.0 : 1.0); \n"
+ " gl_FragColor = vec4(dot(v[0] * v[1] * v[2] * v[3], vec4(1.0)) == 1.0 ? 1.0 : 0.0); \n"
"}");
- progs[2] = piglit_build_simple_program(
+ progs[6] = piglit_build_simple_program(
+ "#version 150 compatibility \n"
+ "varying vec4 v[6]; \n"
+ "attribute vec4 a[6]; \n"
+ "void main() { \n"
+ " for (int i = 0; i < 6; i++) v[i] = a[i]; \n"
+ " gl_Position = gl_Vertex; \n"
+ "}",
+
+ "#version 150 compatibility \n"
+ "varying vec4 v[6]; \n"
+ "void main() { \n"
+ " gl_FragColor = vec4(dot(v[0] * v[1] * v[2] * v[3] * v[4] * v[5], vec4(1.0)) == 1.0 ? 1.0 : 0.0); \n"
+ "}");
+
+ progs[8] = piglit_build_simple_program(
"#version 150 compatibility \n"
"varying vec4 v[8]; \n"
"attribute vec4 a[8]; \n"
@@ -101,7 +161,7 @@ piglit_init(int argc, char **argv)
"#version 150 compatibility \n"
"varying vec4 v[8]; \n"
"void main() { \n"
- " gl_FragColor = vec4(dot(v[0] + v[1] + v[2] + v[3] + v[4] + v[5] + v[6] + v[7], vec4(1.0)) == 1.0 ? 0.0 : 1.0); \n"
+ " gl_FragColor = vec4(dot(v[0] * v[1] * v[2] * v[3] * v[4] * v[5] * v[6] * v[7], vec4(1.0)) == 1.0 ? 1.0 : 0.0); \n"
"}");
glEnableClientState(GL_VERTEX_ARRAY);
@@ -111,7 +171,7 @@ piglit_init(int argc, char **argv)
static void
gen_triangle_tile(unsigned num_quads_per_dim, double prim_size_in_pixels,
- unsigned cull_percentage,
+ unsigned cull_percentage, unsigned vertices_per_prim,
bool back_face_culling, bool view_culling, bool degenerate_prims,
unsigned max_vertices, unsigned *num_vertices, float *vertices,
unsigned max_indices, unsigned *num_indices, unsigned *indices)
@@ -176,13 +236,25 @@ gen_triangle_tile(unsigned num_quads_per_dim, double prim_size_in_pixels,
int base_index = *num_vertices;
- *num_vertices += 2;
+ *num_vertices += vertices_per_prim == 2 ? 4 : 2;
assert(*num_vertices <= max_vertices);
+ if (vertices_per_prim == 2) {
+ vertices[elem++] = xoffset + first + d * x;
+ vertices[elem++] = yoffset + first + d * (y + 1);
+ vertices[elem++] = zoffset;
+ }
+
vertices[elem++] = xoffset + first + d * (x + 1);
vertices[elem++] = yoffset + first + d * y;
vertices[elem++] = zoffset;
+ if (vertices_per_prim == 2) {
+ vertices[elem++] = xoffset + first + d * (x + 1);
+ vertices[elem++] = yoffset + first + d * y;
+ vertices[elem++] = zoffset;
+ }
+
vertices[elem++] = xoffset + first + d * (x + 1);
vertices[elem++] = yoffset + first + d * (y + 1);
vertices[elem++] = zoffset;
@@ -192,13 +264,23 @@ gen_triangle_tile(unsigned num_quads_per_dim, double prim_size_in_pixels,
*num_indices += 6;
assert(*num_indices <= max_indices);
- indices[idx++] = base_index - 2;
- indices[idx++] = base_index;
- indices[idx++] = base_index - 1;
+ if (vertices_per_prim == 2) {
+ indices[idx++] = base_index - 2;
+ indices[idx++] = base_index + 1;
+ indices[idx++] = base_index;
+
+ indices[idx++] = base_index - 1;
+ indices[idx++] = base_index + 2;
+ indices[idx++] = base_index + 3;
+ } else {
+ indices[idx++] = base_index - 2;
+ indices[idx++] = base_index;
+ indices[idx++] = base_index - 1;
- indices[idx++] = base_index - 1;
- indices[idx++] = base_index;
- indices[idx++] = base_index + 1;
+ indices[idx++] = base_index - 1;
+ indices[idx++] = base_index;
+ indices[idx++] = base_index + 1;
+ }
if (cull && back_face_culling) {
/* switch the winding order */
@@ -383,6 +465,7 @@ gen_triangle_strip_tile(unsigned num_quads_per_dim, double prim_size_in_pixels,
enum draw_method {
INDEXED_TRIANGLES,
+ INDEXED_TRIANGLES_2VTX, /* every triangle adds 2 new vertices and reuses 1 vertex */
TRIANGLES,
TRIANGLE_STRIP,
INDEXED_TRIANGLE_STRIP,
@@ -400,7 +483,8 @@ static void
run_draw(unsigned iterations)
{
for (unsigned i = 0; i < iterations; i++) {
- if (global_draw_method == INDEXED_TRIANGLES) {
+ if (global_draw_method == INDEXED_TRIANGLES ||
+ global_draw_method == INDEXED_TRIANGLES_2VTX) {
glDrawElements(GL_TRIANGLES, count,
GL_UNSIGNED_INT,
(void*)(long)(ib_size * duplicate_index));
@@ -445,6 +529,7 @@ run_test(unsigned debug_num_iterations, enum draw_method draw_method,
unsigned *indices = NULL;
if (draw_method == INDEXED_TRIANGLES ||
+ draw_method == INDEXED_TRIANGLES_2VTX ||
draw_method == INDEXED_TRIANGLE_STRIP ||
draw_method == INDEXED_TRIANGLE_STRIP_PRIM_RESTART)
indices = (unsigned*)malloc(max_indices * 4);
@@ -463,6 +548,7 @@ run_test(unsigned debug_num_iterations, enum draw_method draw_method,
} else {
gen_triangle_tile(num_quads_per_dim, quad_size_in_pixels,
cull_percentage,
+ draw_method == INDEXED_TRIANGLES_2VTX ? 2 : 1,
cull_method == BACK_FACE_CULLING,
cull_method == VIEW_CULLING,
cull_method == DEGENERATE_PRIMS,
@@ -473,10 +559,19 @@ run_test(unsigned debug_num_iterations, enum draw_method draw_method,
vb_size = num_vertices * 12;
ib_size = num_indices * 4;
- /* Duplicate buffers and switch between them, so that no data is cached
- * between draws. 32 MB should be greater than any cache.
- */
- num_duplicates = MAX2(1, 32*1024*1024 / vb_size);
+ bool cached = true; /* TODO: test both cached and uncached vertices */
+
+ if (cached) {
+ num_duplicates = 1;
+ } else {
+ /* Duplicate buffers and switch between them, so that no data is cached
+ * between draws. 256 MB should be greater than any cache.
+ *
+ * TODO: Varyings are sourced from zero-stride vertex attribs, so they don't
+ * consume any bandwidth.
+ */
+ num_duplicates = MAX2(1, 256*1024*1024 / vb_size);
+ }
/* Create buffers. */
GLuint vb, ib;
@@ -524,7 +619,7 @@ run_test(unsigned debug_num_iterations, enum draw_method draw_method,
if (debug_num_iterations)
run_draw(debug_num_iterations);
else
- rate = perf_measure_gpu_rate(run_draw, 0.05);
+ rate = perf_measure_gpu_rate(run_draw, 0.01);
if (cull_method == RASTERIZER_DISCARD)
glDisable(GL_RASTERIZER_DISCARD);
@@ -544,7 +639,7 @@ run(enum draw_method draw_method, enum cull_method cull_method,
unsigned num_prim_sets)
{
unsigned num_subtests = 1;
- static unsigned cull_percentages[] = {100, 75, 50, 25};
+ static unsigned cull_percentages[] = {100, 75, 50};
static double quad_sizes_in_pixels[] = {1.0 / 7, 0.25, 0.5};
if (cull_method == BACK_FACE_CULLING ||
@@ -568,11 +663,12 @@ run(enum draw_method draw_method, enum cull_method cull_method,
}
printf(" %-14s, ",
- draw_method == INDEXED_TRIANGLES ? "glDrawElements" :
- draw_method == TRIANGLES ? "glDrawArraysT" :
- draw_method == TRIANGLE_STRIP ? "glDrawArraysTS" :
- draw_method == INDEXED_TRIANGLE_STRIP ? "glDrawElemsTS" :
- "glDrawTS_PrimR");
+ draw_method == INDEXED_TRIANGLES ? "DrawElems1Vtx" :
+ draw_method == INDEXED_TRIANGLES_2VTX ? "DrawElems2Vtx" :
+ draw_method == TRIANGLES ? "DrawArraysT" :
+ draw_method == TRIANGLE_STRIP ? "DrawArraysTS" :
+ draw_method == INDEXED_TRIANGLE_STRIP ? "DrawElemsTS" :
+ "DrawTS_PrimR");
if (cull_method == NONE ||
cull_method == RASTERIZER_DISCARD) {
@@ -592,6 +688,9 @@ run(enum draw_method draw_method, enum cull_method cull_method,
fflush(stdout);
for (unsigned prog = 0; prog < ARRAY_SIZE(progs); prog++) {
+ if (!progs[prog])
+ continue;
+
glUseProgram(progs[prog]);
if (prog)
@@ -605,9 +704,9 @@ run(enum draw_method draw_method, enum cull_method cull_method,
if (gpu_freq_mhz) {
rate /= gpu_freq_mhz * 1000000.0;
- printf(",%7.4f", rate);
+ printf(",%6.3f", rate);
} else {
- printf(",%7.4f", rate / 1000000000);
+ printf(",%6.3f", rate / 1000000000);
}
fflush(stdout);
}
@@ -623,51 +722,54 @@ piglit_display(void)
/* for debugging */
if (getenv("ONE")) {
- glUseProgram(progs[0]);
- run_test(1, INDEXED_TRIANGLE_STRIP, BACK_FACE_CULLING, ceil(sqrt(0.5 * 512000)), 2, 50);
+ glUseProgram(progs[2]);
+ run_test(1, INDEXED_TRIANGLES_2VTX, BACK_FACE_CULLING, ceil(sqrt(0.5 * 512000)), 2, 50);
piglit_swap_buffers();
return PIGLIT_PASS;
}
const unsigned num_quads_per_dim[] = {
/* The second number is the approx. number of primitives. */
- ceil(sqrt(0.5 * 1000)),
ceil(sqrt(0.5 * 2000)),
- ceil(sqrt(0.5 * 4000)),
- ceil(sqrt(0.5 * 6000)),
ceil(sqrt(0.5 * 8000)),
- ceil(sqrt(0.5 * 16000)),
ceil(sqrt(0.5 * 32000)),
ceil(sqrt(0.5 * 128000)),
ceil(sqrt(0.5 * 512000)),
- /* 512000 is the maximum number when everything fits into the window */
- /* After that, the prim size decreases, so you'll get subpixel prims. */
- ceil(sqrt(0.5 * 2000000)),
- ceil(sqrt(0.5 * 8000000)),
};
unsigned num_prims[ARRAY_SIZE(num_quads_per_dim)];
for (int i = 0; i < ARRAY_SIZE(num_quads_per_dim); i++)
num_prims[i] = num_quads_per_dim[i] * num_quads_per_dim[i] * 2;
- printf(" Measuring %-27s, 0 Varying 4 Varyings 8 Varyings\n",
- gpu_freq_mhz ? "Prims/clock," : "GPrims/second,");
- printf(" Draw Call , Cull Method ");
+ printf(" Measuring %-27s, ", gpu_freq_mhz ? "Prims/clock," : "GPrims/second,");
+ for (unsigned prog = 0; prog < ARRAY_SIZE(progs); prog++) {
+ if (progs[prog])
+ printf("%u Varyings %27s", prog, " ");
+ }
+ printf("\n");
+ printf(" Draw Call , Cull Method ");
for (unsigned prog = 0; prog < ARRAY_SIZE(progs); prog++) {
+ if (!progs[prog])
+ continue;
if (prog)
printf(" ");
for (int i = 0; i < ARRAY_SIZE(num_prims); i++)
- printf(", %4uK", num_prims[i] / 1000);
+ printf(", %3uK", num_prims[i] / 1000);
}
printf("\n");
- for (int cull_method = 0; cull_method < NUM_CULL_METHODS; cull_method++)
+ for (int cull_method = 0; cull_method < RASTERIZER_DISCARD; cull_method++)
+ run(INDEXED_TRIANGLES, cull_method, num_quads_per_dim, num_prims, ARRAY_SIZE(num_prims));
+ for (int cull_method = 0; cull_method < RASTERIZER_DISCARD; cull_method++)
+ run(INDEXED_TRIANGLES_2VTX, cull_method, num_quads_per_dim, num_prims, ARRAY_SIZE(num_prims));
+
+ for (int cull_method = RASTERIZER_DISCARD; cull_method < NUM_CULL_METHODS; cull_method++)
run(INDEXED_TRIANGLES, cull_method, num_quads_per_dim, num_prims, ARRAY_SIZE(num_prims));
- /* glDrawArrays: Only test NONE, BACK_FACE_CULLING, and RASTERIZER_DISCARD. */
+ /* glDrawArrays: Only test NONE and BACK_FACE_CULLING. */
for (int draw_method = TRIANGLES; draw_method < NUM_DRAW_METHODS; draw_method++) {
- for (int cull_method = 0; cull_method <= RASTERIZER_DISCARD; cull_method++)
+ for (int cull_method = 0; cull_method <= BACK_FACE_CULLING; cull_method++)
run(draw_method, cull_method, num_quads_per_dim, num_prims, ARRAY_SIZE(num_prims));
}
diff --git a/tests/perf/pbobench.c b/tests/perf/pbobench.c
index 71da4c3cb..c9ac46319 100644
--- a/tests/perf/pbobench.c
+++ b/tests/perf/pbobench.c
@@ -125,6 +125,11 @@ static const Format format_es[] = {
{GL_ALPHA, GL_ALPHA, GL_UNSIGNED_BYTE}
};
+#ifdef _MSC_VER
+__pragma(warning(suppress:4100 4101))
+#else
+__attribute__((unused))
+#endif
static const Format format_es_int[] = {
{GL_RGBA8UI, GL_RGBA_INTEGER, GL_UNSIGNED_BYTE},
{GL_RGBA8I, GL_RGBA_INTEGER, GL_BYTE},
@@ -159,6 +164,11 @@ static const Format format_es_int[] = {
{GL_DEPTH32F_STENCIL8,GL_DEPTH_STENCIL, GL_FLOAT_32_UNSIGNED_INT_24_8_REV},
};
+#ifdef _MSC_VER
+__pragma(warning(suppress:4100 4101))
+#else
+__attribute__((unused))
+#endif
static const Format format_core[] = {
{GL_RGB, GL_RGB, GL_UNSIGNED_BYTE_3_3_2},
{GL_RGB, GL_RGB, GL_UNSIGNED_BYTE_2_3_3_REV},
@@ -184,6 +194,11 @@ static const Format format_core[] = {
{GL_BGRA, GL_BGRA, GL_UNSIGNED_INT_2_10_10_10_REV},
};
+#ifdef _MSC_VER
+__pragma(warning(suppress:4100 4101))
+#else
+__attribute__((unused))
+#endif
static const Format format_core_int[] = {
{GL_RGB_INTEGER, GL_RGB_INTEGER,GL_UNSIGNED_BYTE_3_3_2},
{GL_RGB_INTEGER, GL_RGB_INTEGER,GL_UNSIGNED_BYTE_2_3_3_REV},
@@ -209,11 +224,21 @@ static const Format format_core_int[] = {
{GL_DEPTH_STENCIL,GL_DEPTH_STENCIL,GL_FLOAT_32_UNSIGNED_INT_24_8_REV}
};
+#ifdef _MSC_VER
+__pragma(warning(suppress:4100 4101))
+#else
+__attribute__((unused))
+#endif
static const Format formats_EXT_texture_type_2_10_10_10_REV[] = {
{GL_RGBA,GL_RGBA,GL_UNSIGNED_INT_2_10_10_10_REV_EXT},
{GL_RGB,GL_RGB,GL_UNSIGNED_INT_2_10_10_10_REV_EXT}
};
+#ifdef _MSC_VER
+__pragma(warning(suppress:4100 4101))
+#else
+__attribute__((unused))
+#endif
static const Format formats_OES_required_internalformat[] = {
{GL_RGB8_OES,GL_RGB,GL_UNSIGNED_INT_2_10_10_10_REV_EXT},
{GL_RGB565,GL_RGB,GL_UNSIGNED_INT_2_10_10_10_REV_EXT}
diff --git a/tests/quick_shader.py b/tests/quick_shader.py
index c32ece9ea..8f74cc7bf 100644
--- a/tests/quick_shader.py
+++ b/tests/quick_shader.py
@@ -1,5 +1,5 @@
# encoding=utf-8
-# Copyright © 2018 Intel Coproration
+# Copyright © 2018 Intel Corporation
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
diff --git a/tests/shaders/bin2h.py b/tests/shaders/bin2h.py
index 0f40bb83a..3a3e67828 100644
--- a/tests/shaders/bin2h.py
+++ b/tests/shaders/bin2h.py
@@ -7,7 +7,7 @@ def main():
args = parser.parse_args()
with open(args.input, 'rb') as f:
- print('static const char {}[] = {{'.format(args.symbol))
+ print('static const unsigned char {}[] = {{'.format(args.symbol))
while True:
bytes = f.read(12)
if not bytes:
diff --git a/tests/shaders/built-in-constants.c b/tests/shaders/built-in-constants.c
index df5fa2a84..304073c6b 100644
--- a/tests/shaders/built-in-constants.c
+++ b/tests/shaders/built-in-constants.c
@@ -557,7 +557,7 @@ piglit_init(int argc, char **argv)
for (i = 0; i < num_tests; i++) {
bool subtest_pass = true;
- const char *comparitor =
+ const char *comparator =
parse_str(tests[i].name, "gl_Min", NULL) ? "<=" : ">=";
/* Generate the uniform declaration for the test. This will
@@ -565,7 +565,7 @@ piglit_init(int argc, char **argv)
*/
snprintf(uniform, sizeof(uniform),
uniform_template,
- tests[i].name, comparitor, tests[i].minimum);
+ tests[i].name, comparator, tests[i].minimum);
/* Try to compile the vertex shader.
*/
diff --git a/tests/shaders/fp-indirections.c b/tests/shaders/fp-indirections.c
index 540c252f3..584cff17b 100644
--- a/tests/shaders/fp-indirections.c
+++ b/tests/shaders/fp-indirections.c
@@ -48,7 +48,7 @@ static int get_program_i(GLenum pname)
* Generate a program that samples the texture into the same temporary over
* and over..
*
- * This should excersize case (2) of question (24) of the ARB_fragment_program
+ * This should exercise case (2) of question (24) of the ARB_fragment_program
* spec.
*
* Note that the compiler could optimize out our inner TEX instructions
@@ -105,7 +105,7 @@ static char *gen_temporary_dest_indirections(int sample_count,
* Generate a program that samples two textures into a pair of temporaries
* over and over.
*
- * This should excersize case (1) of question (24) of the ARB_fragment_program
+ * This should exercise case (1) of question (24) of the ARB_fragment_program
* spec without hitting case (2) at the same time.
*
* Note that the compiler could optimize out our inner TEX instructions
diff --git a/tests/shaders/fp-indirections2.c b/tests/shaders/fp-indirections2.c
index 23f63dbb4..04c703bef 100644
--- a/tests/shaders/fp-indirections2.c
+++ b/tests/shaders/fp-indirections2.c
@@ -189,17 +189,25 @@ static enum piglit_result test(unsigned int dim, unsigned int samples)
free(program_text);
+ float *pixels = malloc(draw_height * TEXTURE_SIZE * 3 * sizeof(float));
+ glReadPixels(0, 0, TEXTURE_SIZE, draw_height, GL_RGB, GL_FLOAT, pixels);
+
for(y = 0; y < draw_height; ++y) {
for(x = 0; x < TEXTURE_SIZE; ++x) {
float expected[3];
texture_follow(dim, x, y, 0, samples, expected);
- if (!piglit_probe_pixel_rgb(x, y, expected)) {
+ if (!piglit_compare_pixels(x, y, expected,
+ pixels + (y * TEXTURE_SIZE + x) * 3,
+ piglit_tolerance, 3)) {
fprintf(stderr, "Failure in dim = %i, samples = %i\n", dim, samples);
+ free(pixels);
return PIGLIT_FAIL;
}
}
}
+ free(pixels);
+
return PIGLIT_PASS;
}
diff --git a/tests/shaders/fp-set-01.c b/tests/shaders/fp-set-01.c
index 84a4ce8a1..760455907 100644
--- a/tests/shaders/fp-set-01.c
+++ b/tests/shaders/fp-set-01.c
@@ -83,7 +83,7 @@ static GLint progs[2];
enum piglit_result
piglit_display(void)
{
- const GLfloat comparitor[4] = { 0.5, 0.5, 0.5, 0.5 };
+ const GLfloat comparator[4] = { 0.5, 0.5, 0.5, 0.5 };
unsigned i;
unsigned j;
enum piglit_result result = PIGLIT_PASS;
@@ -106,7 +106,7 @@ piglit_display(void)
glProgramEnvParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, 0,
color);
glProgramEnvParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, 1,
- comparitor);
+ comparator);
piglit_draw_rect(x, 1, BOX_SIZE, BOX_SIZE);
diff --git a/tests/shaders/fp-set-02.c b/tests/shaders/fp-set-02.c
index e88cc61be..c34f3c049 100644
--- a/tests/shaders/fp-set-02.c
+++ b/tests/shaders/fp-set-02.c
@@ -157,7 +157,7 @@ tr_func(float a, float b)
enum piglit_result
piglit_display(void)
{
- const GLfloat comparitor[4] = { 0.5, 0.5, 0.5, 0.5 };
+ const GLfloat comparator[4] = { 0.5, 0.5, 0.5, 0.5 };
static const float values[3] = { 0.0, 0.5, 1.0 };
unsigned i;
unsigned j;
@@ -168,7 +168,7 @@ piglit_display(void)
glClear(GL_COLOR_BUFFER_BIT);
glEnable(GL_FRAGMENT_PROGRAM_ARB);
- glProgramEnvParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, 1, comparitor);
+ glProgramEnvParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, 1, comparator);
for (i = 0; i < (2 * ARRAY_SIZE(progs)); i++) {
const int y = (i * (BOX_SIZE + 1)) + 1;
@@ -194,13 +194,13 @@ piglit_display(void)
ref[2] = values[(j / 9) % 3];
ref[3] = values[(j / 27) % 3];
- color[0] = tests[idx].func(comparitor[0], ref[0])
+ color[0] = tests[idx].func(comparator[0], ref[0])
? 1.0 : 0.0;
- color[1] = tests[idx].func(comparitor[1], ref[1])
+ color[1] = tests[idx].func(comparator[1], ref[1])
? 1.0 : 0.0;
- color[2] = tests[idx].func(comparitor[2], ref[2])
+ color[2] = tests[idx].func(comparator[2], ref[2])
? 1.0 : 0.0;
- color[3] = tests[idx].func(comparitor[3], ref[3])
+ color[3] = tests[idx].func(comparator[3], ref[3])
? 1.0 : 0.0;
glProgramEnvParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB,
diff --git a/tests/shaders/getuniform-03.c b/tests/shaders/getuniform-03.c
index 9de9993bf..1e83141de 100755
--- a/tests/shaders/getuniform-03.c
+++ b/tests/shaders/getuniform-03.c
@@ -226,11 +226,11 @@ piglit_init(int argc, char **argv)
glGetProgramiv(prog, GL_ACTIVE_UNIFORMS, &numUniforms);
if (numUniforms != ARRAY_SIZE(uniforms)) {
printf("Unexpected number of uniforms (found %d, expected "
- "%lu)\n", numUniforms, ARRAY_SIZE(uniforms));
+ "%zu)\n", numUniforms, ARRAY_SIZE(uniforms));
}
/* check the types of the active uniforms and check which ones got
- * references by glGetActiveUniform for later comparaison. */
+ * references by glGetActiveUniform for later comparison. */
for (i = 0; i < numUniforms; i++) {
struct builtin_uniform_t *uniform;
GLcharARB name[100];
diff --git a/tests/shaders/glsl-fs-raytrace-bug27060.c b/tests/shaders/glsl-fs-raytrace-bug27060.c
index 15ac9316c..008000558 100644
--- a/tests/shaders/glsl-fs-raytrace-bug27060.c
+++ b/tests/shaders/glsl-fs-raytrace-bug27060.c
@@ -258,6 +258,9 @@ piglit_display(void)
assert(piglit_height == 256);
assert(piglit_width == 256);
+ float *pixels = malloc(piglit_width * piglit_height * 3 * sizeof(float));
+ glReadPixels(0, 0, piglit_width, piglit_height, GL_RGB, GL_FLOAT, pixels);
+
for (y = 0; y < piglit_height; y++)
{
for (x = 0; x < piglit_width; x++)
@@ -268,11 +271,13 @@ piglit_display(void)
color[1] = (float)pixel_data[(y*256+x)*3 +1] / 256.0F;
color[2] = (float)pixel_data[(y*256+x)*3 +2] / 256.0F;
- if(piglit_probe_pixel_rgb(x, 255-y, color))
+ if (piglit_compare_pixels(x, 255-y, color, pixels + ((255-y) * piglit_width + x) * 3, piglit_tolerance, 3))
passed_cnt++;
}
}
+ free(pixels);
+
piglit_present_results();
return ((float)passed_cnt > (1.0F-failing_pixel_percentage)
diff --git a/tests/shaders/glsl-light-model.c b/tests/shaders/glsl-light-model.c
index 63b5ce4b1..e85d3ee76 100644
--- a/tests/shaders/glsl-light-model.c
+++ b/tests/shaders/glsl-light-model.c
@@ -27,7 +27,7 @@
*
* Each of the 3 shaders involved in this test have a global variable called
* \c global_variable. Two of the shaders have (differing) initializers for
- * this variable, and the other lacks an initalizer. The test verifies that
+ * this variable, and the other lacks an initializer. The test verifies that
* linking the 3 shaders together results in an error due to the conflicting
* initializer.
*
diff --git a/tests/shaders/glsl-link-initializer-03.c b/tests/shaders/glsl-link-initializer-03.c
index 05edafea9..e44a681da 100644
--- a/tests/shaders/glsl-link-initializer-03.c
+++ b/tests/shaders/glsl-link-initializer-03.c
@@ -27,9 +27,9 @@
*
* Each of the 3 shaders involved in this test have a global variable called
* \c global_variable. Two of the shaders have (differing) initializers for
- * this variable, and the other lacks an initalizer. The test verifies that
+ * this variable, and the other lacks an initializer. The test verifies that
* the shader lacking an initializer can successfully be linked with each of
- * the shaders that have initalizers.
+ * the shaders that have initializers.
*
* \author Ian Romanick
*/
diff --git a/tests/shaders/glsl-max-varyings.c b/tests/shaders/glsl-max-varyings.c
index 83310cb15..75146ba53 100644
--- a/tests/shaders/glsl-max-varyings.c
+++ b/tests/shaders/glsl-max-varyings.c
@@ -35,14 +35,14 @@
#define MAX_VARYING 256
-/* 2x2 rectangles with 2 pixels of pad. Deal with up to 256 varyings. */
+/* 1x1 rectangles with 1 pixels of pad. Deal with up to 256 varyings. */
PIGLIT_GL_TEST_CONFIG_BEGIN
config.supports_gl_compat_version = 10;
- config.window_width = (2+MAX_VARYING*4);
- config.window_height = (2+MAX_VARYING*4);
+ config.window_width = MAX_VARYING;
+ config.window_height = MAX_VARYING;
config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE;
PIGLIT_GL_TEST_CONFIG_END
@@ -142,12 +142,6 @@ static GLint get_fs(int num_varyings)
return shader;
}
-static int
-coord_from_index(int index)
-{
- return 2 + 4 * index;
-}
-
static bool
draw(int num_varyings)
{
@@ -210,16 +204,16 @@ draw(int num_varyings)
if (data_varying > 0)
glUniform1f(contribution_loc + data_varying - 1, 0.0);
- x = coord_from_index(data_varying);
- y = coord_from_index(num_varyings - 1);
+ x = data_varying;
+ y = num_varyings - 1;
vertex[0][0] = x;
vertex[0][1] = y;
- vertex[1][0] = x + 2;
+ vertex[1][0] = x + 1;
vertex[1][1] = y;
vertex[2][0] = x;
- vertex[2][1] = y + 2;
- vertex[3][0] = x + 2;
- vertex[3][1] = y + 2;
+ vertex[2][1] = y + 1;
+ vertex[3][0] = x + 1;
+ vertex[3][1] = y + 1;
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
}
@@ -237,6 +231,7 @@ piglit_display(void)
int test_varyings, row, col;
GLboolean pass = GL_TRUE, warned = GL_FALSE;
bool drew[MAX_VARYING];
+ float readback_buffer[MAX_VARYING * MAX_VARYING * 3] = {0};
piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
@@ -263,6 +258,8 @@ piglit_display(void)
drew[row] = draw(row + 1);
}
+ glReadPixels(0, 0, test_varyings, test_varyings, GL_RGB, GL_FLOAT, readback_buffer);
+
for (row = 0; row < test_varyings; row++) {
if (!drew[row])
continue;
@@ -270,15 +267,21 @@ piglit_display(void)
for (col = 0; col <= row; col++) {
GLboolean ok;
float green[3] = {0.0, 1.0, 0.0};
+ int pixel_id = 3 * (row * test_varyings + col);
+
+ ok = readback_buffer[pixel_id + 0] == green[0] &&
+ readback_buffer[pixel_id + 1] == green[1] &&
+ readback_buffer[pixel_id + 2] == green[2];
- ok = piglit_probe_rect_rgb(coord_from_index(col),
- coord_from_index(row),
- 2, 2,
- green);
if (!ok) {
printf(" Failure with %d vec4 varyings used "
"in varying index %d\n",
row + 1, col);
+ printf(" Expected %f %f %f\n Got %f %f %f\n\n",
+ green[0], green[1], green[2],
+ readback_buffer[pixel_id + 0],
+ readback_buffer[pixel_id + 1],
+ readback_buffer[pixel_id + 2]);
pass = GL_FALSE;
break;
}
diff --git a/tests/shaders/glsl-vs-raytrace-bug26691.c b/tests/shaders/glsl-vs-raytrace-bug26691.c
index 7e9a27b1b..6b5cb844b 100644
--- a/tests/shaders/glsl-vs-raytrace-bug26691.c
+++ b/tests/shaders/glsl-vs-raytrace-bug26691.c
@@ -250,6 +250,9 @@ piglit_display(void)
assert(piglit_height == 256);
assert(piglit_width == 256);
+ float *pixels = malloc(piglit_width * piglit_height * 3 * sizeof(float));
+ glReadPixels(0, 0, piglit_width, piglit_height, GL_RGB, GL_FLOAT, pixels);
+
for (y = 0; y < piglit_height; y++)
{
for (x = 0; x < piglit_width; x++)
@@ -260,11 +263,13 @@ piglit_display(void)
color[1] = (float)pixel_data[(y*256+x)*3 +1] / 256.0F;
color[2] = (float)pixel_data[(y*256+x)*3 +2] / 256.0F;
- if(piglit_probe_pixel_rgb(x, 255-y, color))
+ if (piglit_compare_pixels(x, 255-y, color, pixels + ((255-y) * piglit_width + x) * 3, piglit_tolerance, 3))
passed_cnt++;
}
}
+ free(pixels);
+
piglit_present_results();
return ((float)passed_cnt > (1.0F-failing_pixel_percentage)
diff --git a/tests/shaders/parser_utils.h b/tests/shaders/parser_utils.h
index 0768b2752..30db0b3a8 100644
--- a/tests/shaders/parser_utils.h
+++ b/tests/shaders/parser_utils.h
@@ -40,7 +40,7 @@
*
* If the input cannot be parsed as a "foo" object, the boolean return
* value will evaluate to false and the input string will be returned
- * as output string as-is (which mimicks the behavior of the C
+ * as output string as-is (which mimics the behavior of the C
* standard library strto* functions). The "foo" output argument will
* be left in an undefined state in that case.
*/
@@ -157,7 +157,7 @@ parse_word(const char *s, const char **t, const char **rest);
* buffer pointed to by \p t and null-terminated.
*
* The parse is considered to fail if the size of the result
- * (including the terminating null character) would have exceded the
+ * (including the terminating null character) would have exceeded the
* number of characters allocated for it in the buffer as given by the
* \p n argument.
*/
diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index 7a9640beb..f57727797 100644
--- a/tests/shaders/shader_runner.c
+++ b/tests/shaders/shader_runner.c
@@ -21,9 +21,10 @@
* DEALINGS IN THE SOFTWARE.
*/
+#include <ctype.h>
+#include <inttypes.h>
#include <stdbool.h>
#include <string.h>
-#include <ctype.h>
#include "piglit-util.h"
#include "piglit-util-gl.h"
@@ -727,7 +728,7 @@ program_binary_save_restore(bool script_command)
free(binary);
if (!piglit_check_gl_error(GL_NO_ERROR)) {
fprintf(stderr, "glProgramBinary error "
- "(should not happend according to spec.)\n");
+ "(should not happen according to spec.)\n");
piglit_report_result(PIGLIT_FAIL);
}
@@ -1329,6 +1330,8 @@ process_requirement(const char *line)
if (spirv_replaces_glsl)
force_no_names = true;
+ } else if (parse_str(line, "ignore_missing_uniforms", &line)) {
+ ignore_missing_uniforms = true;
}
return PIGLIT_PASS;
}
@@ -3576,6 +3579,14 @@ static const struct string_to_enum enable_table[] = {
{ "GL_CLIP_PLANE5", GL_CLIP_PLANE5 },
{ "GL_CLIP_PLANE6", GL_CLIP_PLANE0+6 },
{ "GL_CLIP_PLANE7", GL_CLIP_PLANE0+7 },
+ { "GL_CLIP_DISTANCE0", GL_CLIP_DISTANCE0 },
+ { "GL_CLIP_DISTANCE1", GL_CLIP_DISTANCE1 },
+ { "GL_CLIP_DISTANCE2", GL_CLIP_DISTANCE2 },
+ { "GL_CLIP_DISTANCE3", GL_CLIP_DISTANCE3 },
+ { "GL_CLIP_DISTANCE4", GL_CLIP_DISTANCE4 },
+ { "GL_CLIP_DISTANCE5", GL_CLIP_DISTANCE5 },
+ { "GL_CLIP_DISTANCE6", GL_CLIP_DISTANCE6 },
+ { "GL_CLIP_DISTANCE7", GL_CLIP_DISTANCE7 },
{ "GL_VERTEX_PROGRAM_TWO_SIDE", GL_VERTEX_PROGRAM_TWO_SIDE },
{ "GL_PROGRAM_POINT_SIZE", GL_PROGRAM_POINT_SIZE },
{ "GL_DEPTH_TEST", GL_DEPTH_TEST },
@@ -4156,8 +4167,8 @@ probe_ssbo_uint64(GLint ssbo_index, GLint ssbo_offset, const char *op, uint64_t
if (!result) {
printf("SSBO %d test failed: Reference %s Observed\n",
ssbo_offset, comparison_string(cmp));
- printf(" Reference: %lu\n", value);
- printf(" Observed: %lu\n", observed);
+ printf(" Reference: %"PRIu64"\n", value);
+ printf(" Observed: %"PRIu64"\n", observed);
glUnmapBuffer(GL_SHADER_STORAGE_BUFFER);
return false;
}
@@ -4228,8 +4239,8 @@ probe_ssbo_int64(GLint ssbo_index, GLint ssbo_offset, const char *op, int64_t va
if (!result) {
printf("SSBO %d test failed: Reference %s Observed\n",
ssbo_offset, comparison_string(cmp));
- printf(" Reference: %ld\n", value);
- printf(" Observed: %ld\n", observed);
+ printf(" Reference: %"PRId64"\n", value);
+ printf(" Observed: %"PRId64"\n", observed);
glUnmapBuffer(GL_SHADER_STORAGE_BUFFER);
return false;
}
@@ -4636,7 +4647,7 @@ piglit_display(void)
glFramebufferTexture2D(
target, attachments[num_attachments],
GL_TEXTURE_2D,
- get_texture_binding(tex)->obj, 0);
+ tex == -1 ? 0 : get_texture_binding(tex)->obj, 0);
if (!piglit_check_gl_error(GL_NO_ERROR)) {
fprintf(stderr,
@@ -4645,13 +4656,15 @@ piglit_display(void)
}
num_attachments++;
+ if (tex != -1) {
+ w = get_texture_binding(tex)->width;
+ h = get_texture_binding(tex)->height;
+ }
}
if (target != GL_READ_FRAMEBUFFER)
glDrawBuffers(num_attachments, attachments);
- w = get_texture_binding(tex)->width;
- h = get_texture_binding(tex)->height;
} else if (parse_str(rest, "tex slice ", &rest)) {
GLenum tex_target;
@@ -4910,7 +4923,7 @@ piglit_display(void)
&x, &y, s, &z) == 4) {
if (!probe_ssbo_uint(x, y, s, z))
result = PIGLIT_FAIL;
- } else if (sscanf(line, "probe ssbo uint64 %d %d %s %lu",
+ } else if (sscanf(line, "probe ssbo uint64 %d %d %s %"PRIu64,
&x, &y, s, &luz) == 4) {
if (!probe_ssbo_uint64(x, y, s, luz))
result = PIGLIT_FAIL;
@@ -4918,7 +4931,7 @@ piglit_display(void)
&x, &y, s, &z) == 4) {
if (!probe_ssbo_int(x, y, s, z))
result = PIGLIT_FAIL;
- } else if (sscanf(line, "probe ssbo int64 %d %d %s %ld",
+ } else if (sscanf(line, "probe ssbo int64 %d %d %s %"PRId64,
&x, &y, s, &lz) == 4) {
if (!probe_ssbo_int64(x, y, s, lz))
result = PIGLIT_FAIL;
@@ -5091,11 +5104,11 @@ piglit_display(void)
parse_doubles(s, &d[0], 1, NULL);
glBindBuffer(GL_SHADER_STORAGE_BUFFER, ssbo[x]);
glBufferSubData(GL_SHADER_STORAGE_BUFFER, y, sizeof(double), &d[0]);
- } else if (sscanf(line, "ssbo %d subdata int64 %ld %s", &x, &ly, s) == 3) {
+ } else if (sscanf(line, "ssbo %d subdata int64 %"PRId64" %s", &x, &ly, s) == 3) {
parse_int64s(s, &lz, 1, NULL);
glBindBuffer(GL_SHADER_STORAGE_BUFFER, ssbo[x]);
glBufferSubData(GL_SHADER_STORAGE_BUFFER, ly, sizeof(int64_t), &lz);
- } else if (sscanf(line, "ssbo %d subdata uint64 %lu %s", &x, &luy, s) == 3) {
+ } else if (sscanf(line, "ssbo %d subdata uint64 %"PRIu64" %s", &x, &luy, s) == 3) {
parse_uint64s(s, &luz, 1, NULL);
glBindBuffer(GL_SHADER_STORAGE_BUFFER, ssbo[x]);
glBufferSubData(GL_SHADER_STORAGE_BUFFER, luy, sizeof(uint64_t), &luz);
@@ -5415,10 +5428,10 @@ piglit_display(void)
} else if (parse_str(line, "link error", &rest)) {
link_error_expected = true;
if (link_ok) {
- printf("shader link error expected, but it was successful!\n");
+ fprintf(stderr, "shader link error expected, but it was successful!\n");
piglit_report_result(PIGLIT_FAIL);
} else {
- fprintf(stderr, "Failed to link:\n%s\n", prog_err_info);
+ printf("Failed to link (as expected):\n%s\n", prog_err_info);
}
} else if (parse_str(line, "link success", &rest)) {
result = program_must_be_in_use();
diff --git a/tests/shaders/ssa/fs-while-loop-rotate-value.shader_test b/tests/shaders/ssa/fs-while-loop-rotate-value.shader_test
index e2893b679..337f578a1 100644
--- a/tests/shaders/ssa/fs-while-loop-rotate-value.shader_test
+++ b/tests/shaders/ssa/fs-while-loop-rotate-value.shader_test
@@ -1,6 +1,6 @@
# test to check a bug in r600 sb backend
# it miscompiles this due to the 1.0
-# at the end wierdly.
+# at the end weirdly.
[require]
GLSL >= 1.10
diff --git a/tests/shaders/useshaderprogram-flushverts-1.c b/tests/shaders/useshaderprogram-flushverts-1.c
index e1593d75e..9c5e812ad 100644
--- a/tests/shaders/useshaderprogram-flushverts-1.c
+++ b/tests/shaders/useshaderprogram-flushverts-1.c
@@ -27,7 +27,7 @@
/** @file useshaderprogram-flushverts-1.c
*
- * Tests that a change in the shader progarm results in previous
+ * Tests that a change in the shader program results in previous
* vertices getting flushed correctly with the previous shader.
*/
diff --git a/tests/shaders/version-mixing.c b/tests/shaders/version-mixing.c
index f24d06257..88ef1042b 100644
--- a/tests/shaders/version-mixing.c
+++ b/tests/shaders/version-mixing.c
@@ -59,7 +59,7 @@ static enum test_type {
test_type_vs_gs,
} test_type;
-static void parse_params();
+static void parse_params(int argc, char **argv);
PIGLIT_GL_TEST_CONFIG_BEGIN
diff --git a/tests/shaders/vp-bad-program.c b/tests/shaders/vp-bad-program.c
index 784ff45b0..433cc2b1d 100644
--- a/tests/shaders/vp-bad-program.c
+++ b/tests/shaders/vp-bad-program.c
@@ -79,7 +79,7 @@ piglit_display(void)
}
/* Check that we correctly produce GL_INVALID_OPERATION when rendering
- * with an invalid/non-existant program.
+ * with an invalid/non-existent program.
*/
glBindProgramARB(GL_VERTEX_PROGRAM_ARB, 99);
glEnable(GL_VERTEX_PROGRAM_ARB);
@@ -104,7 +104,7 @@ piglit_display(void)
}
/* Check that we correctly produce GL_INVALID_OPERATION when doing
- * glDrawArrays with an invalid/non-existant program.
+ * glDrawArrays with an invalid/non-existent program.
*/
glVertexPointer(3, GL_FLOAT, 0, vertcoords);
diff --git a/tests/spec/CMakeLists.txt b/tests/spec/CMakeLists.txt
index 035f43f74..544d7da54 100644
--- a/tests/spec/CMakeLists.txt
+++ b/tests/spec/CMakeLists.txt
@@ -1,8 +1,10 @@
add_subdirectory (amd_compressed_atc_texture)
add_subdirectory (amd_framebuffer_multisample_advanced)
add_subdirectory (amd_depth_clamp_separate)
+add_subdirectory (amd_gpu_shader_half_float)
add_subdirectory (amd_performance_monitor)
add_subdirectory (amd_pinned_memory)
+add_subdirectory (apple_sync)
add_subdirectory (arb_arrays_of_arrays)
add_subdirectory (arb_base_instance)
add_subdirectory (arb_bindless_texture)
@@ -194,6 +196,7 @@ add_subdirectory (ext_render_snorm)
add_subdirectory (ext_texture_compression_bptc)
add_subdirectory (ext_texture_compression_rgtc)
add_subdirectory (ext_color_buffer_float)
+add_subdirectory (ext_debug_label)
add_subdirectory (khr_parallel_shader_compile)
add_subdirectory (ext_direct_state_access)
add_subdirectory (arb_gpu_shader_int64)
@@ -204,3 +207,5 @@ add_subdirectory (nv_viewport_swizzle)
add_subdirectory (nv_alpha_to_coverage_dither_control)
add_subdirectory (nv_copy_depth_to_color)
add_subdirectory (arm_shader_framebuffer_fetch_depth_stencil)
+add_subdirectory (ext_instanced_arrays)
+add_subdirectory (ext_texture_storage)
diff --git a/tests/spec/amd_gpu_shader_half_float/CMakeLists.gl.txt b/tests/spec/amd_gpu_shader_half_float/CMakeLists.gl.txt
new file mode 100644
index 000000000..0301f4de1
--- /dev/null
+++ b/tests/spec/amd_gpu_shader_half_float/CMakeLists.gl.txt
@@ -0,0 +1,14 @@
+include_directories(
+ ${GLEXT_INCLUDE_DIR}
+ ${OPENGL_INCLUDE_PATH}
+ ${piglit_SOURCE_DIR}/tests/util
+)
+
+link_libraries (
+ piglitutil_${piglit_target_api}
+ ${OPENGL_gl_LIBRARY}
+)
+
+piglit_add_executable (amd_gpu_shader_half_float-explicit-offset-bufferstorage half-float-explicit-offset-bufferstorage.c half_float_util.c)
+
+# vim: ft=cmake:
diff --git a/tests/spec/amd_gpu_shader_half_float/CMakeLists.txt b/tests/spec/amd_gpu_shader_half_float/CMakeLists.txt
new file mode 100644
index 000000000..144a306f4
--- /dev/null
+++ b/tests/spec/amd_gpu_shader_half_float/CMakeLists.txt
@@ -0,0 +1 @@
+piglit_include_target_api()
diff --git a/tests/spec/amd_gpu_shader_half_float/compiler/builtin-functions/common/modf-f16vec2.vert b/tests/spec/amd_gpu_shader_half_float/compiler/builtin-functions/common/modf-f16vec2.vert
index 0394adc9c..0e17769fb 100644
--- a/tests/spec/amd_gpu_shader_half_float/compiler/builtin-functions/common/modf-f16vec2.vert
+++ b/tests/spec/amd_gpu_shader_half_float/compiler/builtin-functions/common/modf-f16vec2.vert
@@ -12,7 +12,7 @@
f16vec2 test() {
float16_t x = 0.999HF;
- float16_t i = 0.567HF;
+ f16vec2 i = f16vec2(0.567HF);
- return modf(f16vec2(x), f16vec2(i));
+ return modf(f16vec2(x), i);
}
diff --git a/tests/spec/amd_gpu_shader_half_float/compiler/builtin-functions/common/modf-f16vec3.vert b/tests/spec/amd_gpu_shader_half_float/compiler/builtin-functions/common/modf-f16vec3.vert
index d0df92fa4..f9d08e91b 100644
--- a/tests/spec/amd_gpu_shader_half_float/compiler/builtin-functions/common/modf-f16vec3.vert
+++ b/tests/spec/amd_gpu_shader_half_float/compiler/builtin-functions/common/modf-f16vec3.vert
@@ -12,7 +12,7 @@
f16vec3 test() {
float16_t x = 0.999HF;
- float16_t i = 0.567HF;
+ f16vec3 i = f16vec3(0.567HF);
- return modf(f16vec3(x), f16vec3(i));
+ return modf(f16vec3(x), i);
}
diff --git a/tests/spec/amd_gpu_shader_half_float/compiler/builtin-functions/common/modf-f16vec4.vert b/tests/spec/amd_gpu_shader_half_float/compiler/builtin-functions/common/modf-f16vec4.vert
index b33bc219a..f97f07f69 100644
--- a/tests/spec/amd_gpu_shader_half_float/compiler/builtin-functions/common/modf-f16vec4.vert
+++ b/tests/spec/amd_gpu_shader_half_float/compiler/builtin-functions/common/modf-f16vec4.vert
@@ -12,7 +12,7 @@
f16vec4 test() {
float16_t x = 0.999HF;
- float16_t i = 0.567HF;
+ f16vec4 i = f16vec4(0.567HF);
- return modf(f16vec4(x), f16vec4(i));
+ return modf(f16vec4(x), i);
}
diff --git a/tests/spec/amd_gpu_shader_half_float/compiler/varying_error.vert b/tests/spec/amd_gpu_shader_half_float/compiler/varying_error.vert
new file mode 100644
index 000000000..c5b6bf71b
--- /dev/null
+++ b/tests/spec/amd_gpu_shader_half_float/compiler/varying_error.vert
@@ -0,0 +1,10 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.10
+// [end config]
+//
+// Tests an error is thrown when using half float varying without enabling
+
+#version 110
+
+varying float16_t x;
diff --git a/tests/spec/amd_gpu_shader_half_float/half-float-explicit-offset-bufferstorage.c b/tests/spec/amd_gpu_shader_half_float/half-float-explicit-offset-bufferstorage.c
new file mode 100644
index 000000000..3b8aedcc1
--- /dev/null
+++ b/tests/spec/amd_gpu_shader_half_float/half-float-explicit-offset-bufferstorage.c
@@ -0,0 +1,260 @@
+/*
+ * Copyright (c) 2014 VMware, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+/** @file half-float-explicit-offset-bufferstorage.c
+ *
+ * This is a copy of the arb_uniform_buffer_object bufferstorage test updated
+ * to make use of explicit offsets and half floats.
+ *
+ * Test rendering with UBOs. We draw four squares with different
+ * positions, sizes, rotations and colors where those parameters come
+ * from UBOs. Same as rendering.c, except that the UBOs are
+ * persistently mapped.
+ */
+
+#include "piglit-util-gl.h"
+
+#include "half_float_util.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+ config.supports_gl_core_version = 40;
+ config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+static const char vert_shader_text[] =
+ "#version 400\n"
+ "#extension GL_ARB_enhanced_layouts : require\n"
+ "#extension GL_AMD_gpu_shader_half_float : require\n"
+ "\n"
+ "in vec4 piglit_vertex;\n"
+ "\n"
+ "layout(std140) uniform;\n"
+ "layout(std140) uniform ub_pos_size {\n"
+ " layout(offset = 0) float16_t size;\n"
+ " layout(offset = 2) float16_t pos1;\n"
+ " layout(offset = 6) float16_t pos2;\n"
+ "};\n"
+ "uniform ub_rot {float rotation; };\n"
+ "\n"
+ "void main()\n"
+ "{\n"
+ " mat2 m;\n"
+ " m[0][0] = m[1][1] = cos(rotation); \n"
+ " m[0][1] = sin(rotation); \n"
+ " m[1][0] = -m[0][1]; \n"
+ " gl_Position.xy = m * piglit_vertex.xy * vec2(size) + vec2(pos1, pos2);\n"
+ " gl_Position.zw = vec2(0, 1);\n"
+ "}\n";
+
+static const char frag_shader_text[] =
+ "#version 400\n"
+ "#extension GL_ARB_enhanced_layouts : require\n"
+ "#extension GL_AMD_gpu_shader_half_float : require\n"
+ "\n"
+ "layout(std140) uniform;\n"
+ "layout(std140) uniform ub_color {\n"
+ " layout(offset = 0) vec4 color;\n"
+ " layout(offset = 22) float16_t color_scale;\n"
+ "} named_ub;\n"
+ "\n"
+ "void main()\n"
+ "{\n"
+ " gl_FragColor = named_ub.color * float(named_ub.color_scale);\n"
+ "}\n";
+
+#define NUM_SQUARES 4
+#define NUM_UBOS 3
+
+/* Square positions and sizes */
+static const float pos_size[NUM_SQUARES][3] = {
+ { 0.1, -0.5, -0.5 },
+ { 0.2, 0.5, -0.5 },
+ { 0.3, -0.5, 0.5 },
+ { 0.4, 0.5, 0.5 }
+};
+
+/* Square color and color_scales */
+static const float color[NUM_SQUARES][4] = {
+ { 2.0, 0.0, 0.0, 1.0 },
+ { 0.0, 4.0, 0.0, 1.0 },
+ { 0.0, 0.0, 5.0, 1.0 },
+ { 0.2, 0.2, 0.2, 0.2 }
+};
+
+static const float color_scale[NUM_SQUARES] = {
+ 0.50,
+ 0.25,
+ 0.20,
+ 5.00
+};
+
+/* Square rotations */
+static const float rotation[NUM_SQUARES] = {
+ 0.0,
+ 0.1,
+ 0.2,
+ 0.3
+};
+
+static GLuint prog;
+static GLuint buffers[NUM_UBOS];
+static void *ubos[NUM_UBOS];
+
+static void
+setup_ubos(void)
+{
+ static const char *names[NUM_UBOS] = {
+ "ub_pos_size",
+ "ub_color",
+ "ub_rot"
+ };
+ int i;
+
+ glGenBuffers(NUM_UBOS, buffers);
+
+ for (i = 0; i < NUM_UBOS; i++) {
+ GLint index, size;
+
+ /* query UBO index */
+ index = glGetUniformBlockIndex(prog, names[i]);
+
+ /* query UBO size */
+ glGetActiveUniformBlockiv(prog, index,
+ GL_UNIFORM_BLOCK_DATA_SIZE, &size);
+
+ printf("UBO %s: index = %d, size = %d\n",
+ names[i], index, size);
+
+ /* Allocate UBO */
+ glBindBuffer(GL_UNIFORM_BUFFER, buffers[i]);
+ glBufferStorage(GL_UNIFORM_BUFFER, size, NULL,
+ GL_MAP_WRITE_BIT |
+ GL_MAP_PERSISTENT_BIT |
+ GL_MAP_COHERENT_BIT |
+ GL_DYNAMIC_STORAGE_BIT);
+
+ piglit_check_gl_error(GL_NO_ERROR);
+
+ ubos[i] = glMapBufferRange(GL_UNIFORM_BUFFER, 0, size,
+ GL_MAP_WRITE_BIT |
+ GL_MAP_PERSISTENT_BIT |
+ GL_MAP_COHERENT_BIT);
+
+ piglit_check_gl_error(GL_NO_ERROR);
+
+ if (!ubos[i])
+ piglit_report_result(PIGLIT_FAIL);
+
+ /* Attach UBO */
+ glBindBufferBase(GL_UNIFORM_BUFFER, i, buffers[i]);
+ glUniformBlockBinding(prog, index, i);
+
+ if (!piglit_check_gl_error(GL_NO_ERROR))
+ piglit_report_result(PIGLIT_FAIL);
+ }
+}
+
+void
+piglit_init(int argc, char **argv)
+{
+ piglit_require_extension("GL_ARB_enhanced_layouts");
+ piglit_require_extension("GL_AMD_gpu_shader_half_float");
+
+ prog = piglit_build_simple_program(vert_shader_text, frag_shader_text);
+ assert(prog);
+ glUseProgram(prog);
+
+ setup_ubos();
+
+ glClearColor(0.2, 0.2, 0.2, 0.2);
+}
+
+static bool
+probe(int x, int y, int color_index)
+{
+ float expected[4];
+
+ /* mul color by color_scale */
+ expected[0] = color[color_index][0] * color_scale[color_index];
+ expected[1] = color[color_index][1] * color_scale[color_index];
+ expected[2] = color[color_index][2] * color_scale[color_index];
+ expected[3] = color[color_index][3] * color_scale[color_index];
+
+ return piglit_probe_pixel_rgba(x, y, expected);
+}
+
+
+enum piglit_result
+piglit_display(void)
+{
+ GLsync fence;
+ bool pass = true;
+ int x0 = piglit_width / 4;
+ int x1 = piglit_width * 3 / 4;
+ int y0 = piglit_height / 4;
+ int y1 = piglit_height * 3 / 4;
+ int i;
+
+ glViewport(0, 0, piglit_width, piglit_height);
+
+ glClear(GL_COLOR_BUFFER_BIT);
+
+ for (i = 0; i < NUM_SQUARES; i++) {
+ /* Wait for any previous rendering to finish before
+ * updating the UBOs
+ */
+ fence = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
+ glClientWaitSync(fence, GL_SYNC_FLUSH_COMMANDS_BIT,
+ GL_TIMEOUT_IGNORED);
+
+ /* Load UBO data */
+ uint16_t half_float_val = _mesa_float_to_half_slow(pos_size[i][0]);
+ memcpy(ubos[0], &half_float_val, 2);
+
+ half_float_val = _mesa_float_to_half_slow(pos_size[i][1]);
+ memcpy((uint8_t *)ubos[0] + 2, &half_float_val, 2);
+
+ half_float_val = _mesa_float_to_half_slow(pos_size[i][2]);
+ memcpy((uint8_t *)ubos[0] + 6, &half_float_val, 2);
+
+ memcpy(ubos[1], color[i], sizeof(color[0]));
+
+ half_float_val = _mesa_float_to_half_slow(color_scale[i]);
+ memcpy(((uint8_t *)ubos[1]) + 22, &half_float_val, 2);
+
+ memcpy(ubos[2], &rotation[i], sizeof(rotation[0]));
+
+ piglit_draw_rect(-1, -1, 2, 2);
+ }
+
+ pass = probe(x0, y0, 0) && pass;
+ pass = probe(x1, y0, 1) && pass;
+ pass = probe(x0, y1, 2) && pass;
+ pass = probe(x1, y1, 3) && pass;
+
+ piglit_present_results();
+
+ return pass ? PIGLIT_PASS : PIGLIT_FAIL;
+}
diff --git a/tests/spec/amd_gpu_shader_half_float/half_float_util.c b/tests/spec/amd_gpu_shader_half_float/half_float_util.c
new file mode 100644
index 000000000..a4b5ffd8a
--- /dev/null
+++ b/tests/spec/amd_gpu_shader_half_float/half_float_util.c
@@ -0,0 +1,167 @@
+/*
+ * Copyright (C) 1999-2007 Brian Paul All Rights Reserved.
+ * Copyright 2015 Philip Taylor <philip@zaynar.co.uk>
+ * Copyright 2018 Advanced Micro Devices, Inc.
+ * Copyright (C) 2018-2019 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+ /* These functions were copied from Mesas util library. The only difference
+ * is the custom optimised _mesa_roundevenf() calls were replaced with
+ * lrintf()
+ */
+
+#include <assert.h>
+#include <math.h>
+#include <stdint.h>
+
+#include "half_float_util.h"
+
+typedef union { float f; int32_t i; uint32_t u; } fi_type;
+
+/**
+ * Convert a 4-byte float to a 2-byte half float.
+ *
+ * Not all float32 values can be represented exactly as a float16 value. We
+ * round such intermediate float32 values to the nearest float16. When the
+ * float32 lies exactly between to float16 values, we round to the one with
+ * an even mantissa.
+ *
+ * This rounding behavior has several benefits:
+ * - It has no sign bias.
+ *
+ * - It reproduces the behavior of real hardware: opcode F32TO16 in Intel's
+ * GPU ISA.
+ *
+ * - By reproducing the behavior of the GPU (at least on Intel hardware),
+ * compile-time evaluation of constant packHalf2x16 GLSL expressions will
+ * result in the same value as if the expression were executed on the GPU.
+ */
+uint16_t
+_mesa_float_to_half_slow(float val)
+{
+ const fi_type fi = {val};
+ const int flt_m = fi.i & 0x7fffff;
+ const int flt_e = (fi.i >> 23) & 0xff;
+ const int flt_s = (fi.i >> 31) & 0x1;
+ int s, e, m = 0;
+ uint16_t result;
+
+ /* sign bit */
+ s = flt_s;
+
+ /* handle special cases */
+ if ((flt_e == 0) && (flt_m == 0)) {
+ /* zero */
+ /* m = 0; - already set */
+ e = 0;
+ }
+ else if ((flt_e == 0) && (flt_m != 0)) {
+ /* denorm -- denorm float maps to 0 half */
+ /* m = 0; - already set */
+ e = 0;
+ }
+ else if ((flt_e == 0xff) && (flt_m == 0)) {
+ /* infinity */
+ /* m = 0; - already set */
+ e = 31;
+ }
+ else if ((flt_e == 0xff) && (flt_m != 0)) {
+ /* Retain the top bits of a NaN to make sure that the quiet/signaling
+ * status stays the same.
+ */
+ m = flt_m >> 13;
+ if (!m)
+ m = 1;
+ e = 31;
+ }
+ else {
+ /* regular number */
+ const int new_exp = flt_e - 127;
+ if (new_exp < -14) {
+ /* The float32 lies in the range (0.0, min_normal16) and is rounded
+ * to a nearby float16 value. The result will be either zero, subnormal,
+ * or normal.
+ */
+ e = 0;
+ m = lrintf((1 << 24) * fabsf(fi.f));
+ }
+ else if (new_exp > 15) {
+ /* map this value to infinity */
+ /* m = 0; - already set */
+ e = 31;
+ }
+ else {
+ /* The float32 lies in the range
+ * [min_normal16, max_normal16 + max_step16)
+ * and is rounded to a nearby float16 value. The result will be
+ * either normal or infinite.
+ */
+ e = new_exp + 15;
+ m = lrintf(flt_m / (float) (1 << 13));
+ }
+ }
+
+ assert(0 <= m && m <= 1024);
+ if (m == 1024) {
+ /* The float32 was rounded upwards into the range of the next exponent,
+ * so bump the exponent. This correctly handles the case where f32
+ * should be rounded up to float16 infinity.
+ */
+ ++e;
+ m = 0;
+ }
+
+ result = (s << 15) | (e << 10) | m;
+ return result;
+}
+
+/**
+ * Convert a 2-byte half float to a 4-byte float.
+ * Based on code from:
+ * http://www.opengl.org/discussion_boards/ubb/Forum3/HTML/008786.html
+ */
+float
+_mesa_half_to_float_slow(uint16_t val)
+{
+ fi_type infnan;
+ fi_type magic;
+ fi_type f32;
+
+ infnan.u = 0x8f << 23;
+ infnan.f = 65536.0f;
+ magic.u = 0xef << 23;
+
+ /* Exponent / Mantissa */
+ f32.u = (val & 0x7fff) << 13;
+
+ /* Adjust */
+ f32.f *= magic.f;
+ /* XXX: The magic mul relies on denorms being available */
+
+ /* Inf / NaN */
+ if (f32.f >= infnan.f)
+ f32.u |= 0xff << 23;
+
+ /* Sign */
+ f32.u |= (uint32_t)(val & 0x8000) << 16;
+
+ return f32.f;
+} \ No newline at end of file
diff --git a/tests/spec/amd_gpu_shader_half_float/half_float_util.h b/tests/spec/amd_gpu_shader_half_float/half_float_util.h
new file mode 100644
index 000000000..f0f50fd22
--- /dev/null
+++ b/tests/spec/amd_gpu_shader_half_float/half_float_util.h
@@ -0,0 +1,33 @@
+/*
+ * Copyright © 2015 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+#ifndef _HALF_FLOAT_H_
+#define _HALF_FLOAT_H_
+
+#define FP16_ONE ((uint16_t) 0x3c00)
+#define FP16_ZERO ((uint16_t) 0)
+
+uint16_t _mesa_float_to_half_slow(float val);
+float _mesa_half_to_float_slow(uint16_t val);
+
+#endif /* _HALF_FLOAT_H_ */
diff --git a/tests/spec/apple_sync/CMakeLists.gles2.txt b/tests/spec/apple_sync/CMakeLists.gles2.txt
new file mode 100644
index 000000000..39e90fb4b
--- /dev/null
+++ b/tests/spec/apple_sync/CMakeLists.gles2.txt
@@ -0,0 +1,13 @@
+link_libraries (
+ piglitutil_${piglit_target_api}
+)
+
+piglit_add_executable (apple_sync-client-wait-errors ClientWaitSync-errors.c)
+piglit_add_executable (apple_sync-delete DeleteSync.c)
+piglit_add_executable (apple_sync-fence-sync-errors FenceSync-errors.c)
+piglit_add_executable (apple_sync-get-sync-errors GetSynciv-errors.c)
+piglit_add_executable (apple_sync-is-sync IsSync.c)
+piglit_add_executable (apple_sync-repeat-wait repeat-wait.c)
+piglit_add_executable (apple_sync-sync-initialize sync-initialize.c)
+piglit_add_executable (apple_sync-timeout-zero timeout-zero.c)
+piglit_add_executable (apple_sync-WaitSync-errors WaitSync-errors.c)
diff --git a/tests/spec/apple_sync/CMakeLists.txt b/tests/spec/apple_sync/CMakeLists.txt
new file mode 100644
index 000000000..144a306f4
--- /dev/null
+++ b/tests/spec/apple_sync/CMakeLists.txt
@@ -0,0 +1 @@
+piglit_include_target_api()
diff --git a/tests/spec/apple_sync/ClientWaitSync-errors.c b/tests/spec/apple_sync/ClientWaitSync-errors.c
new file mode 100644
index 000000000..1129d0e3c
--- /dev/null
+++ b/tests/spec/apple_sync/ClientWaitSync-errors.c
@@ -0,0 +1,79 @@
+/*
+ * Copyright © 2013 Intel Corporation
+ * Copyright © 2023 Lucas Stach (adapted to GL ES)
+ *
+ * SPDX-License-Identifier: MIT
+ */
+
+/**
+ * \file
+ * Test ClientWaitSyncAPPLE() returns correct error messages for invalid input
+ *
+ *
+ * Section 5.2.1 (Waiting for Sync Objects) of the extension spec says:
+ *
+ * "If <sync> is not the name of a sync object, an INVALID_VALUE error
+ * is generated. If <flags> contains any bits other than
+ * SYNC_FLUSH_COMMANDS_BIT_APPLE, an INVALID_VALUE error is generated."
+ *
+ */
+
+#include "piglit-util-gl.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+ config.supports_gl_es_version = 20;
+ config.khr_no_error_support = PIGLIT_HAS_ERRORS;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+enum piglit_result
+piglit_display(void)
+{
+ /* UNREACHED */
+ return PIGLIT_FAIL;
+}
+
+void
+piglit_init(int argc, char **argv)
+{
+ bool pass = true;
+ GLsync a = (GLsync)0xDEADBEEF;
+ GLenum status;
+ int i;
+
+ piglit_require_extension("GL_APPLE_sync");
+
+ /* sync not set up yet so this should fail with both GL error and
+ * respond GL_WAIT_FAILED
+ */
+ status = glClientWaitSyncAPPLE(a, GL_SYNC_FLUSH_COMMANDS_BIT_APPLE, 0);
+ pass = piglit_check_gl_error(GL_INVALID_VALUE) && pass;
+ if (status != GL_WAIT_FAILED_APPLE) {
+ printf("Expected GL_WAIT_FAILED but returned: %s\n",
+ piglit_get_gl_enum_name(status));
+ pass = false;
+ }
+
+ a = glFenceSyncAPPLE(GL_SYNC_GPU_COMMANDS_COMPLETE_APPLE, 0);
+
+ /* test that valid sync results in NO_ERROR */
+ status = glClientWaitSyncAPPLE(a, GL_SYNC_FLUSH_COMMANDS_BIT_APPLE, 0);
+ pass = piglit_check_gl_error(GL_NO_ERROR) && pass;
+
+ /* test that invalid flag value results in INVALID_VALUE */
+ for (i = 0; i < sizeof(GLbitfield) * 8; i++) {
+ GLbitfield mask = 1 << i;
+ /* Skip over the valid bit */
+ if (mask == GL_SYNC_FLUSH_COMMANDS_BIT_APPLE) {
+ continue;
+ }
+ status = glClientWaitSyncAPPLE(a, mask, 0);
+ pass = (status == GL_WAIT_FAILED_APPLE) && pass;
+ pass = piglit_check_gl_error(GL_INVALID_VALUE) && pass;
+ }
+
+ glDeleteSyncAPPLE(a);
+
+ piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);
+}
diff --git a/tests/spec/apple_sync/DeleteSync.c b/tests/spec/apple_sync/DeleteSync.c
new file mode 100644
index 000000000..ca8e7f562
--- /dev/null
+++ b/tests/spec/apple_sync/DeleteSync.c
@@ -0,0 +1,64 @@
+/*
+ * Copyright © 2013 Intel Corporation
+ * Copyright © 2023 Lucas Stach (adapted to GL ES)
+ *
+ * SPDX-License-Identifier: MIT
+ */
+
+/**
+ * \file
+ * Test DeleteSyncAPPLE() returns correct error messages
+ *
+ * Section 5.2 (Sync Objects and Fences) of the extension spec says:
+ *
+ * "DeleteSyncAPPLE will silently ignore a <sync> value of zero. An
+ * INVALID_VALUE error is generated if <sync> is neither zero nor the
+ * name of a sync object."
+ *
+ */
+
+#include "piglit-util-gl.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+ config.supports_gl_es_version = 20;
+ config.khr_no_error_support = PIGLIT_NO_ERRORS;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+enum piglit_result
+piglit_display(void)
+{
+ /* UNREACHED */
+ return PIGLIT_FAIL;
+}
+
+void
+piglit_init(int argc, char **argv)
+{
+ bool pass = true;
+ GLsync sync;
+ GLsync invalid = (GLsync) GL_FRONT;
+
+ piglit_require_extension("GL_APPLE_sync");
+
+ /* Test for successful function calls
+ * DeleteSync will silently ignore a sync value of zero
+ */
+ glDeleteSync(0);
+ pass = piglit_check_gl_error(GL_NO_ERROR) && pass;
+
+ sync = glFenceSyncAPPLE(GL_SYNC_GPU_COMMANDS_COMPLETE_APPLE, 0);
+ glDeleteSyncAPPLE(sync);
+ pass = piglit_check_gl_error(GL_NO_ERROR) && pass;
+ /* Check if sync was deleted */
+ pass = !glIsSyncAPPLE(sync) && pass;
+
+ if (!piglit_khr_no_error) {
+ /* Test for unsuccessful function calls */
+ glDeleteSyncAPPLE(invalid);
+ pass = piglit_check_gl_error(GL_INVALID_VALUE) && pass;
+ }
+
+ piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);
+}
diff --git a/tests/spec/apple_sync/FenceSync-errors.c b/tests/spec/apple_sync/FenceSync-errors.c
new file mode 100644
index 000000000..28bd799bf
--- /dev/null
+++ b/tests/spec/apple_sync/FenceSync-errors.c
@@ -0,0 +1,55 @@
+/*
+ * Copyright © 2013 Intel Corporation
+ * Copyright © 2023 Lucas Stach (adapted to GL ES)
+ *
+ * SPDX-License-Identifier: MIT
+ */
+
+/**
+ * \file
+ * Test FenceSyncAPPLE() returns correct error messages for invalid input
+ *
+ * Section 5.2 (Sync Objects and Fences) of the extension spec says:
+ *
+ * "An INVALID_ENUM error is generated if <condition> is not
+ * SYNC_GPU_COMMANDS_COMPLETE_APPLE. If <flags> is not zero,
+ * an INVALID_VALUE error is generated."
+ *
+ */
+
+#include "piglit-util-gl.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+ config.supports_gl_es_version = 20;
+ config.khr_no_error_support = PIGLIT_HAS_ERRORS;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+enum piglit_result
+piglit_display(void)
+{
+ /* UNREACHED */
+ return PIGLIT_FAIL;
+}
+
+void
+piglit_init(int argc, char **argv)
+{
+ bool pass = true;
+ GLsync a, b;
+
+ piglit_require_extension("GL_APPLE_sync");
+
+ /* test that an invalid condition results in INVALID_ENUM */
+ a = glFenceSyncAPPLE(GL_NONE, 0);
+ pass = piglit_check_gl_error(GL_INVALID_ENUM) && pass;
+ glDeleteSyncAPPLE(a);
+
+ /* test that invalid flag value results in INVALID_VALUE */
+ b = glFenceSyncAPPLE(GL_SYNC_GPU_COMMANDS_COMPLETE_APPLE, 1);
+ pass = piglit_check_gl_error(GL_INVALID_VALUE) && pass;
+ glDeleteSyncAPPLE(b);
+
+ piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);
+}
diff --git a/tests/spec/apple_sync/GetSynciv-errors.c b/tests/spec/apple_sync/GetSynciv-errors.c
new file mode 100644
index 000000000..0dc7cdb80
--- /dev/null
+++ b/tests/spec/apple_sync/GetSynciv-errors.c
@@ -0,0 +1,74 @@
+/*
+ * Copyright © 2013 Intel Corporation
+ * Copyright © 2023 Lucas Stach (adapted to GL ES)
+ *
+ * SPDX-License-Identifier: MIT
+ */
+
+/**
+ * \file
+ * Test GetSyncivAPPLE() sets correct error codes
+ *
+ * Section 6.1.6 (Sync Object Queries) of the extension spec says:
+ *
+ * "If <sync> is not the name of a sync object, an INVALID_VALUE error
+ * is generated. If <pname> is not one of the values described above,
+ * an INVALID_ENUM error is generated."
+ *
+ */
+
+#include "piglit-util-gl.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+ config.supports_gl_es_version = 20;
+ config.khr_no_error_support = PIGLIT_HAS_ERRORS;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+enum piglit_result
+piglit_display(void)
+{
+ /* UNREACHED */
+ return PIGLIT_FAIL;
+}
+
+void
+piglit_init(int argc, char **argv)
+{
+ bool pass = true;
+ GLsync valid_fence;
+ GLsync invalid_fence = (GLsync) 0x1373;
+
+ GLsizei len;
+ GLint val;
+
+ piglit_require_extension("GL_APPLE_sync");
+
+ valid_fence = glFenceSyncAPPLE(GL_SYNC_GPU_COMMANDS_COMPLETE_APPLE, 0);
+
+ /* test that invalid sync results in INVALID_VALUE */
+ glGetSyncivAPPLE(invalid_fence, GL_SYNC_STATUS_APPLE, 1, &len, &val);
+ pass = piglit_check_gl_error(GL_INVALID_VALUE) && pass;
+
+ /* test valid pname values result in NO_ERROR */
+ glGetSyncivAPPLE(valid_fence, GL_OBJECT_TYPE_APPLE, 1, &len, &val);
+ pass = piglit_check_gl_error(GL_NO_ERROR) && pass;
+
+ glGetSyncivAPPLE(valid_fence, GL_SYNC_STATUS_APPLE, 1, &len, &val);
+ pass = piglit_check_gl_error(GL_NO_ERROR) && pass;
+
+ glGetSyncivAPPLE(valid_fence, GL_SYNC_CONDITION_APPLE, 1, &len, &val);
+ pass = piglit_check_gl_error(GL_NO_ERROR) && pass;
+
+ glGetSyncivAPPLE(valid_fence, GL_SYNC_FLAGS_APPLE, 1, &len, &val);
+ pass = piglit_check_gl_error(GL_NO_ERROR) && pass;
+
+ /* test that invalid pname results in INVALID_ENUM */
+ glGetSyncivAPPLE(valid_fence, GL_INVALID_VALUE, 1, &len, &val);
+ pass = piglit_check_gl_error(GL_INVALID_ENUM) && pass;
+
+ glDeleteSyncAPPLE(valid_fence);
+
+ piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);
+}
diff --git a/tests/spec/apple_sync/IsSync.c b/tests/spec/apple_sync/IsSync.c
new file mode 100644
index 000000000..9269fbf9a
--- /dev/null
+++ b/tests/spec/apple_sync/IsSync.c
@@ -0,0 +1,67 @@
+/*
+ * Copyright © 2013 Intel Corporation
+ * Copyright © 2023 Lucas Stach (adapted to GL ES)
+ *
+ * SPDX-License-Identifier: MIT
+ */
+
+/**
+ * \file
+ * Test IsSyncAPPLE()
+ *
+ * Section 6.1.6 (Sync Object Queries) of the extension spec says:
+ *
+ * "The command
+ * boolean IsSyncAPPLE(sync sync);
+ * returns TRUE if <sync> is the name of a sync object. If <sync> is
+ * not the name of a sync object, or if an error condition occurs,
+ * IsSyncAPPLE returns FALSE (note that zero is not the name of a
+ * sync object).
+ *
+ */
+
+#include "piglit-util-gl.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+ config.supports_gl_es_version = 20;
+ config.khr_no_error_support = PIGLIT_NO_ERRORS;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+enum piglit_result
+piglit_display(void)
+{
+ /* UNREACHED */
+ return PIGLIT_FAIL;
+}
+
+void
+piglit_init(int argc, char **argv)
+{
+ bool pass = true;
+ GLsync valid_sync;
+ GLsync invalid_sync = (GLsync)GL_BACK;
+
+ piglit_require_extension("GL_APPLE_sync");
+
+ /* Create valid sync object */
+ valid_sync = glFenceSyncAPPLE(GL_SYNC_GPU_COMMANDS_COMPLETE_APPLE, 0);
+
+ /* Check if a valid name returns true */
+ pass = glIsSyncAPPLE(valid_sync) && pass;
+
+ /* Check if invalid names return false.
+ * From the extension specification:
+ * "If <sync> is not the name of a sync object, or if an error
+ * condition occurs, IsSyncAPPLE returns FALSE (note that zero
+ * is not the name of a sync object)."
+ */
+ pass = !glIsSyncAPPLE(invalid_sync) && pass;
+
+ pass = !glIsSyncAPPLE(0) && pass;
+
+ glDeleteSyncAPPLE(valid_sync);
+
+ piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);
+}
diff --git a/tests/spec/apple_sync/WaitSync-errors.c b/tests/spec/apple_sync/WaitSync-errors.c
new file mode 100644
index 000000000..0133b5368
--- /dev/null
+++ b/tests/spec/apple_sync/WaitSync-errors.c
@@ -0,0 +1,62 @@
+/*
+ * Copyright © 2013 Intel Corporation
+ * Copyright © 2023 Lucas Stach (adapted to GL ES)
+ *
+ * SPDX-License-Identifier: MIT
+ */
+
+/**
+ * \file
+ * Test WaitSyncAPPLE() returns correct error codes
+ *
+ * Section 5.2.1 (Waiting for Sync Objects) of the extension spec says:
+ *
+ * "If <sync> is not the name of a sync object, an INVALID_VALUE error
+ * is generated. If <flags> contains any bits other than
+ * SYNC_FLUSH_COMMANDS_BIT_APPLE, an INVALID_VALUE error is generated."
+ *
+ */
+
+#include "piglit-util-gl.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+ config.supports_gl_es_version = 20;
+ config.khr_no_error_support = PIGLIT_HAS_ERRORS;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+enum piglit_result
+piglit_display(void)
+{
+ /* UNREACHED */
+ return PIGLIT_FAIL;
+}
+
+void
+piglit_init(int argc, char **argv)
+{
+ bool pass = true;
+ GLsync valid_sync;
+ GLsync invalid_sync = (GLsync)20;
+
+ piglit_require_extension("GL_APPLE_sync");
+
+ valid_sync = glFenceSyncAPPLE(GL_SYNC_GPU_COMMANDS_COMPLETE_APPLE, 0);
+
+ /* test that valid parameters passed results in NO_ERROR */
+ glWaitSyncAPPLE(valid_sync, 0, GL_TIMEOUT_IGNORED_APPLE);
+ pass = piglit_check_gl_error(GL_NO_ERROR) && pass;
+
+ /* test that invalid sync results in INVALID_VALUE */
+ glWaitSyncAPPLE(invalid_sync, 0, GL_TIMEOUT_IGNORED_APPLE);
+ pass = piglit_check_gl_error(GL_INVALID_VALUE) && pass;
+
+ /* test that invalid flag value results in INVALID_VALUE */
+ glWaitSyncAPPLE(valid_sync, 3, GL_TIMEOUT_IGNORED_APPLE);
+ pass = piglit_check_gl_error(GL_INVALID_VALUE) && pass;
+
+ glDeleteSyncAPPLE(valid_sync);
+
+ piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);
+}
diff --git a/tests/spec/apple_sync/repeat-wait.c b/tests/spec/apple_sync/repeat-wait.c
new file mode 100644
index 000000000..e905706e4
--- /dev/null
+++ b/tests/spec/apple_sync/repeat-wait.c
@@ -0,0 +1,73 @@
+/*
+ * Copyright © 2012 Intel Corporation
+ * Copyright © 2023 Lucas Stach (adapted to GL ES)
+ *
+ * SPDX-License-Identifier: MIT
+ */
+
+/** @file repeat-wait.c
+ *
+ * From the GL_APPLE_sync spec:
+ *
+ * "A return value of ALREADY_SIGNALED_APPLE indicates that <sync>
+ * was signaled at the time ClientWaitSyncAPPLE was called.
+ * ALREADY_SIGNALED_APPLE will always be returned if <sync> was
+ * signaled, even if the value of <timeout> is zero."
+ *
+ * There was concern that the implementation of the kernel API on i965
+ * might violate this for the specific case of back-to-back
+ * ClientWaitSyncs, but Mesa core doesn't end up calling into the
+ * driver on a later ClientWaitSync.
+ */
+
+#include "piglit-util-gl.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+ config.supports_gl_es_version = 20;
+
+ config.window_width = 10;
+ config.window_height = 10;
+ config.window_visual = PIGLIT_GL_VISUAL_RGBA | PIGLIT_GL_VISUAL_DOUBLE;
+ config.khr_no_error_support = PIGLIT_NO_ERRORS;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+#define ONE_SECOND 1000000000
+
+enum piglit_result
+piglit_display(void)
+{
+ /* UNREACHED */
+ return PIGLIT_FAIL;
+}
+
+void
+piglit_init(int argc, char **argv)
+{
+ GLsync sync;
+ GLenum ret1, ret2;
+
+ piglit_require_extension("GL_APPLE_sync");
+
+ glClear(GL_COLOR_BUFFER_BIT);
+
+ sync = glFenceSyncAPPLE(GL_SYNC_GPU_COMMANDS_COMPLETE_APPLE, 0);
+
+ ret1 = glClientWaitSyncAPPLE(sync, GL_SYNC_FLUSH_COMMANDS_BIT_APPLE, ONE_SECOND);
+ ret2 = glClientWaitSyncAPPLE(sync, 0, ONE_SECOND);
+
+ if (ret1 == GL_TIMEOUT_EXPIRED_APPLE) {
+ printf("timeout expired on the first wait\n");
+ piglit_report_result(PIGLIT_SKIP);
+ }
+
+ if (ret2 != GL_ALREADY_SIGNALED_APPLE) {
+ fprintf(stderr,
+ "Expected GL_ALREADY_SIGNALED_APPLE on second wait, got %s",
+ piglit_get_gl_enum_name(ret2));
+ piglit_report_result(PIGLIT_FAIL);
+ }
+
+ piglit_report_result(PIGLIT_PASS);
+}
diff --git a/tests/spec/apple_sync/sync-initialize.c b/tests/spec/apple_sync/sync-initialize.c
new file mode 100644
index 000000000..2aed5ac23
--- /dev/null
+++ b/tests/spec/apple_sync/sync-initialize.c
@@ -0,0 +1,116 @@
+/*
+ * Copyright © 2013 Intel Corporation
+ * Copyright © 2023 Lucas Stach (adapted to GL ES)
+ *
+ * SPDX-License-Identifier: MIT
+ */
+
+/**
+ * \file
+ * Test that a sync is initialized correctly with FenceSyncAPPLE
+ *
+ * Section 5.2 (Sync Objects and Fences) of the extension spec says:
+ * "Table 5.props: Initial properties of a sync object
+ * created with FenceSyncAPPLE."
+ *
+ * Property Name Property Value
+ * --------------------------------------
+ * OBJECT_TYPE_APPLE SYNC_FENCE_APPLE
+ * SYNC_CONDITION_APPLE <condition>
+ * SYNC_STATUS_APPLE UNSIGNALED_APPLE
+ * SYNC_FLAGS_APPLE <flags>
+ *
+ */
+
+#include "piglit-util-gl.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+ config.supports_gl_es_version = 20;
+ config.khr_no_error_support = PIGLIT_NO_ERRORS;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+enum piglit_result
+piglit_display(void)
+{
+ /* UNREACHED */
+ return PIGLIT_FAIL;
+}
+
+void
+piglit_init(int argc, char **argv)
+{
+ bool pass = true;
+ GLsizei length = -5;
+ GLint value;
+ GLsync sync;
+
+ piglit_require_extension("GL_APPLE_sync");
+
+ /* Create a new fence sync */
+ sync = glFenceSyncAPPLE(GL_SYNC_GPU_COMMANDS_COMPLETE_APPLE, 0);
+
+ /* Test initialized as fence type */
+ glGetSyncivAPPLE(sync, GL_OBJECT_TYPE_APPLE, 1, &length, &value);
+ if (length != 1) {
+ printf("length should be 1 but incorrectly returned: %d\n",
+ length);
+ pass = false;
+ }
+ if (value != GL_SYNC_FENCE_APPLE) {
+ printf("Expected GL_SYNC_FENCE_APPLE but returned: %s\n",
+ piglit_get_gl_enum_name(value));
+ pass = false;
+ }
+
+ /* Test initialized to given condition */
+ length = -5;
+ glGetSyncivAPPLE(sync, GL_SYNC_CONDITION_APPLE, 1, &length, &value);
+ if (length != 1) {
+ printf("length should be 1 but incorrectly returned: %d\n",
+ length);
+ pass = false;
+ }
+ if (value != GL_SYNC_GPU_COMMANDS_COMPLETE_APPLE) {
+ printf("Expected GL_SYNC_GPU_COMMANDS_COMPLETE_APPLE but returned: %s\n",
+ piglit_get_gl_enum_name(value));
+ pass = false;
+ }
+
+ /* Test initialized to unsignaled */
+ length = -5;
+ glGetSyncivAPPLE(sync, GL_SYNC_STATUS_APPLE, 1, &length, &value);
+ if (length != 1) {
+ printf("length should be 1 but incorrectly returned: %d\n",
+ length);
+ pass = false;
+ }
+ /* We can't test for just GL_UNSIGNALED_APPLE here, since the
+ * driver may have actually completed any previous rendering
+ * (or, in our case, no rendering at all) already.
+ */
+ if (value != GL_UNSIGNALED_APPLE && value != GL_SIGNALED_APPLE) {
+ printf("Expected GL_UNSIGNALED_APPLE or GL_SIGNALED_APPLE but returned: %s\n",
+ piglit_get_gl_enum_name(value));
+ pass = false;
+ }
+
+ /* Test initialized with given flag */
+ length = -5;
+ glGetSyncivAPPLE(sync, GL_SYNC_FLAGS_APPLE, 1, &length, &value);
+ if (length != 1) {
+ printf("length should be 1 but incorrectly returned: %d\n",
+ length);
+ pass = false;
+ }
+ if (value != 0) {
+ printf("Expected GL_SYNC_FLAGS_APPLE == 0 but returned: %d\n",
+ value);
+ pass = false;
+ }
+
+ glDeleteSyncAPPLE(sync);
+
+ piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);
+}
diff --git a/tests/spec/apple_sync/timeout-zero.c b/tests/spec/apple_sync/timeout-zero.c
new file mode 100644
index 000000000..5a7aa3a94
--- /dev/null
+++ b/tests/spec/apple_sync/timeout-zero.c
@@ -0,0 +1,96 @@
+/*
+ * Copyright © 2012 Intel Corporation
+ * Copyright © 2023 Lucas Stach (adapted to GL ES)
+ *
+ * SPDX-License-Identifier: MIT
+ */
+
+/** @file repeat-wait.c
+ *
+ * From the GL_APPLE_sync spec:
+ *
+ * "ALREADY_SIGNALED_APPLE will always be returned if <sync> was
+ * signaled, even if the value of <timeout> is zero.
+ *
+ * ...
+ *
+ * If the value of <timeout> is zero, then ClientWaitSyncAPPLE
+ * does not block, but simply tests the current state of <sync>.
+ * TIMEOUT_EXPIRED_APPLE will be returned in this case if <sync>
+ * is not signaled, even though no actual wait was performed."
+ *
+ */
+
+#include "piglit-util-gl.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+ config.supports_gl_es_version = 20;
+
+ config.window_width = 10;
+ config.window_height = 10;
+ config.window_visual = PIGLIT_GL_VISUAL_RGBA | PIGLIT_GL_VISUAL_DOUBLE;
+ config.khr_no_error_support = PIGLIT_NO_ERRORS;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+enum piglit_result
+piglit_display(void)
+{
+ /* UNREACHED */
+ return PIGLIT_FAIL;
+}
+
+void
+piglit_init(int argc, char **argv)
+{
+ GLsync sync;
+ GLenum ret1, ret2;
+ bool pass = true;
+
+
+ piglit_require_extension("GL_APPLE_sync");
+
+ glClear(GL_COLOR_BUFFER_BIT);
+ sync = glFenceSyncAPPLE(GL_SYNC_GPU_COMMANDS_COMPLETE_APPLE, 0);
+ ret1 = glClientWaitSyncAPPLE(sync, GL_SYNC_FLUSH_COMMANDS_BIT_APPLE, 0);
+ glFinish();
+ ret2 = glClientWaitSyncAPPLE(sync, 0, 0);
+
+ glDeleteSyncAPPLE(sync);
+
+ if (ret1 != GL_TIMEOUT_EXPIRED_APPLE &&
+ ret1 != GL_ALREADY_SIGNALED_APPLE) {
+ fprintf(stderr,
+ "On first wait:\n"
+ " Expected GL_ALREADY_SIGNALED_APPLE or GL_TIMEOUT_EXPIRED_APPLE\n"
+ " Got %s\n",
+ piglit_get_gl_enum_name(ret1));
+ pass = false;
+ }
+
+ if (ret2 != GL_ALREADY_SIGNALED_APPLE) {
+ fprintf(stderr,
+ "On repeated wait:\n"
+ " Expected GL_ALREADY_SIGNALED_APPLE\n"
+ " Got %s\n",
+ piglit_get_gl_enum_name(ret2));
+ pass = false;
+ }
+
+ glClear(GL_COLOR_BUFFER_BIT);
+ sync = glFenceSyncAPPLE(GL_SYNC_GPU_COMMANDS_COMPLETE_APPLE, 0);
+ glFinish();
+ ret1 = glClientWaitSyncAPPLE(sync, GL_SYNC_FLUSH_COMMANDS_BIT_APPLE, 0);
+
+ if (ret1 != GL_ALREADY_SIGNALED_APPLE) {
+ fprintf(stderr,
+ "On wait after a finish:\n"
+ " Expected GL_ALREADY_SIGNALED_APPLE\n"
+ " Got %s\n",
+ piglit_get_gl_enum_name(ret1));
+ pass = false;
+ }
+
+ piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);
+}
diff --git a/tests/spec/arb_arrays_of_arrays/execution/atomic_counters/fs-indirect-index.shader_test b/tests/spec/arb_arrays_of_arrays/execution/atomic_counters/fs-indirect-index.shader_test
index 39dc268df..27e85fd3b 100644
--- a/tests/spec/arb_arrays_of_arrays/execution/atomic_counters/fs-indirect-index.shader_test
+++ b/tests/spec/arb_arrays_of_arrays/execution/atomic_counters/fs-indirect-index.shader_test
@@ -1,4 +1,4 @@
-# Simple test of accessing an atomic counter with dynamic indicies.
+# Simple test of accessing an atomic counter with dynamic indexes.
#
[require]
@@ -26,7 +26,7 @@ void main()
uint v0[12];
uint v1[12];
- /* Get all initail values of a0 */
+ /* Get all initial values of a0 */
v0[0] = atomicCounter(a0[0][0]);
v0[1] = atomicCounter(a0[0][1]);
v0[2] = atomicCounter(a0[0][2]);
diff --git a/tests/spec/arb_arrays_of_arrays/execution/atomic_counters/fs-simple-inc-dec-read.shader_test b/tests/spec/arb_arrays_of_arrays/execution/atomic_counters/fs-simple-inc-dec-read.shader_test
index 9949df843..dd2c3b734 100644
--- a/tests/spec/arb_arrays_of_arrays/execution/atomic_counters/fs-simple-inc-dec-read.shader_test
+++ b/tests/spec/arb_arrays_of_arrays/execution/atomic_counters/fs-simple-inc-dec-read.shader_test
@@ -25,7 +25,7 @@ void main()
uint v0[12];
uint v1[12];
- /* Get all initail values of a0 */
+ /* Get all initial values of a0 */
v0[0] = atomicCounter(a0[0][0]);
v0[1] = atomicCounter(a0[0][1]);
v0[2] = atomicCounter(a0[0][2]);
@@ -59,7 +59,7 @@ void main()
atomicCounterDecrement(a1[0][1][1]);
atomicCounterDecrement(a1[2][0][1]);
- /* Get all initail values of a1 */
+ /* Get all initial values of a1 */
v0[0] = atomicCounter(a1[0][0][0]);
v0[1] = atomicCounter(a1[0][0][1]);
v0[2] = atomicCounter(a1[0][1][0]);
diff --git a/tests/spec/arb_arrays_of_arrays/execution/atomic_counters/vs-indirect-index.shader_test b/tests/spec/arb_arrays_of_arrays/execution/atomic_counters/vs-indirect-index.shader_test
index d58b07691..f6d72751e 100644
--- a/tests/spec/arb_arrays_of_arrays/execution/atomic_counters/vs-indirect-index.shader_test
+++ b/tests/spec/arb_arrays_of_arrays/execution/atomic_counters/vs-indirect-index.shader_test
@@ -1,4 +1,4 @@
-# Simple test of accessing an atomic counter with dynamic indicies.
+# Simple test of accessing an atomic counter with dynamic indices.
#
[require]
@@ -26,7 +26,7 @@ void main()
uint v0[12];
uint v1[12];
- /* Get all initail values of a0 */
+ /* Get all initial values of a0 */
v0[0] = atomicCounter(a0[0][0]);
v0[1] = atomicCounter(a0[0][1]);
v0[2] = atomicCounter(a0[0][2]);
diff --git a/tests/spec/arb_arrays_of_arrays/execution/atomic_counters/vs-simple-inc-dec-read.shader_test b/tests/spec/arb_arrays_of_arrays/execution/atomic_counters/vs-simple-inc-dec-read.shader_test
index c5c3015dc..fd9344394 100644
--- a/tests/spec/arb_arrays_of_arrays/execution/atomic_counters/vs-simple-inc-dec-read.shader_test
+++ b/tests/spec/arb_arrays_of_arrays/execution/atomic_counters/vs-simple-inc-dec-read.shader_test
@@ -25,7 +25,7 @@ void main()
uint v0[12];
uint v1[12];
- /* Get all initail values of a0 */
+ /* Get all initial values of a0 */
v0[0] = atomicCounter(a0[0][0]);
v0[1] = atomicCounter(a0[0][1]);
v0[2] = atomicCounter(a0[0][2]);
@@ -59,7 +59,7 @@ void main()
atomicCounterDecrement(a1[0][1][1]);
atomicCounterDecrement(a1[2][0][1]);
- /* Get all initail values of a1 */
+ /* Get all initial values of a1 */
v0[0] = atomicCounter(a1[0][0][0]);
v0[1] = atomicCounter(a1[0][0][1]);
v0[2] = atomicCounter(a1[0][1][0]);
diff --git a/tests/spec/arb_arrays_of_arrays/execution/glsl-arrays-copy-size-mismatch.shader_test b/tests/spec/arb_arrays_of_arrays/execution/glsl-arrays-copy-size-mismatch.shader_test
index b7256b39b..04ac3ea38 100644
--- a/tests/spec/arb_arrays_of_arrays/execution/glsl-arrays-copy-size-mismatch.shader_test
+++ b/tests/spec/arb_arrays_of_arrays/execution/glsl-arrays-copy-size-mismatch.shader_test
@@ -1,5 +1,6 @@
[require]
GLSL >= 1.20
+GL_ARB_arrays_of_arrays
[vertex shader]
#version 120
diff --git a/tests/spec/arb_arrays_of_arrays/execution/sampler/vs-struct-nonconst-non-opaque-members.shader_test b/tests/spec/arb_arrays_of_arrays/execution/sampler/vs-struct-nonconst-non-opaque-members.shader_test
index dbc9c40e4..8eae15c5b 100644
--- a/tests/spec/arb_arrays_of_arrays/execution/sampler/vs-struct-nonconst-non-opaque-members.shader_test
+++ b/tests/spec/arb_arrays_of_arrays/execution/sampler/vs-struct-nonconst-non-opaque-members.shader_test
@@ -1,5 +1,5 @@
# This test verifies that dynamically uniform indexing of sampler arrays
-# in the vertex shader behaves correctly, and the offests for the
+# in the vertex shader behaves correctly, and the offsets for the
# non-opaque members are calculated correctly.
[require]
diff --git a/tests/spec/arb_arrays_of_arrays/linker/vs-to-fs-interface-field-unsized2.shader_test b/tests/spec/arb_arrays_of_arrays/linker/vs-to-fs-interface-field-unsized2.shader_test
index 269690462..da8ed8661 100644
--- a/tests/spec/arb_arrays_of_arrays/linker/vs-to-fs-interface-field-unsized2.shader_test
+++ b/tests/spec/arb_arrays_of_arrays/linker/vs-to-fs-interface-field-unsized2.shader_test
@@ -4,7 +4,7 @@
#
# Note: The size of the arrays also means this tests the
# max boundary of GL_MAX_VERTEX_ATTRIBS when it's set
-# to 64 (the mininum allowed for an implementation).
+# to 64 (the minimum allowed for an implementation).
[require]
GLSL >= 1.50
diff --git a/tests/spec/arb_arrays_of_arrays/max-binding.c b/tests/spec/arb_arrays_of_arrays/max-binding.c
index 9d9bd2d47..4622f1d53 100644
--- a/tests/spec/arb_arrays_of_arrays/max-binding.c
+++ b/tests/spec/arb_arrays_of_arrays/max-binding.c
@@ -23,7 +23,7 @@
/** @file max-binding.c
*
- * Test that using more than the maximum number of suported interface block,
+ * Test that using more than the maximum number of supported interface block,
* sampler, or atomic bindings fails with a compile error.
*/
@@ -49,7 +49,7 @@ generate_and_compile_shader(GLuint stage, const char *src_template,
ret = asprintf(&src, src_template, binding);
assert(ret);
- ret = piglit_compile_shader_text_nothrow(stage, src, true);
+ ret = piglit_compile_shader_text_nothrow(stage, src, false);
free(src);
return ret;
@@ -172,7 +172,7 @@ piglit_init(int argc, char **argv)
/* test max boundary */
if(!run_test_sampler_max_bindings(max_samp_binding-array_elements))
subtest_fail(&status, "Test sampler binding on boundary "
- "of maximum number of texure "
+ "of maximum number of texture "
"unit bindings");
if (piglit_is_extension_supported("GL_ARB_shader_atomic_counters")) {
diff --git a/tests/spec/arb_bindless_texture/errors.c b/tests/spec/arb_bindless_texture/errors.c
index fa66c9f2c..eaeab6b9b 100644
--- a/tests/spec/arb_bindless_texture/errors.c
+++ b/tests/spec/arb_bindless_texture/errors.c
@@ -299,7 +299,7 @@ check_MakeImageHandleResident_invalid_enum(void *data)
* <access> specifies whether the texture bound to the image handle
* will be treated as READ_ONLY, WRITE_ONLY, or READ_WRITE."
*
- * NOTE: The spec doesn't explicitely say that INVALID_ENUM should
+ * NOTE: The spec doesn't explicitly say that INVALID_ENUM should
* be returned, but I think it makes sense (like NVIDIA).
*/
tex = piglit_rgbw_texture(GL_RGBA32F, 16, 16, GL_FALSE, GL_FALSE,
diff --git a/tests/spec/arb_bindless_texture/execution/images/uniform-struct.shader_test b/tests/spec/arb_bindless_texture/execution/images/uniform-struct.shader_test
new file mode 100644
index 000000000..d2c538569
--- /dev/null
+++ b/tests/spec/arb_bindless_texture/execution/images/uniform-struct.shader_test
@@ -0,0 +1,49 @@
+# Test access to a uniform where it has a structure which contains a bindless
+# image.
+[require]
+GL >= 3.3
+GLSL >= 3.30
+GL_ARB_bindless_texture
+GL_ARB_shader_image_load_store
+
+[vertex shader passthrough]
+
+[fragment shader]
+#version 330
+#extension GL_ARB_bindless_texture: require
+#extension GL_ARB_shader_image_load_store: enable
+#extension GL_ARB_uniform_buffer_object: enable
+
+struct Struct {
+ vec4 color;
+ writeonly image2D img;
+};
+
+uniform Struct s;
+
+out vec4 outcolor;
+
+void main()
+{
+ imageStore(s.img, ivec2(gl_FragCoord.xy), s.color);
+ outcolor = vec4(0.0, 0.0, 0.0, 1.0);
+}
+
+[test]
+# Texture 0 is the imageStore output.
+texture rgbw 0 (16, 16) GL_RGBA8
+resident image texture 0 GL_RGBA8
+uniform handle s.img 0
+
+# Texture 1 is the rendering output. We don't care about this.
+texture rgbw 1 (16, 16) GL_RGBA8
+
+# Store red using imageStore
+uniform vec4 s.color 1.0 0.0 0.0 1.0
+fb tex 2d 1
+draw rect -1 -1 2 2
+
+# Test the result of imageStore
+memory barrier GL_FRAMEBUFFER_BARRIER_BIT
+fb tex 2d 0
+probe all rgba 1.0 0.0 0.0 1.0
diff --git a/tests/spec/arb_blend_func_extended/api/builtins.c b/tests/spec/arb_blend_func_extended/api/builtins.c
index a71608373..4752b170a 100644
--- a/tests/spec/arb_blend_func_extended/api/builtins.c
+++ b/tests/spec/arb_blend_func_extended/api/builtins.c
@@ -31,7 +31,7 @@ PIGLIT_GL_TEST_CONFIG_BEGIN
PIGLIT_GL_TEST_CONFIG_END
-bool compile_simple_program(const char* vs_text, const char* fs_text)
+bool compile_simple_program(const char* vs_text, const char* fs_text, bool err_to_stderr)
{
GLuint vs;
GLuint fs;
@@ -40,8 +40,8 @@ bool compile_simple_program(const char* vs_text, const char* fs_text)
prog = glCreateProgram();
- vs = piglit_compile_shader_text_nothrow(GL_VERTEX_SHADER, vs_text, true);
- fs = piglit_compile_shader_text_nothrow(GL_FRAGMENT_SHADER, fs_text, true);
+ vs = piglit_compile_shader_text_nothrow(GL_VERTEX_SHADER, vs_text, err_to_stderr);
+ fs = piglit_compile_shader_text_nothrow(GL_FRAGMENT_SHADER, fs_text, err_to_stderr);
if (!vs || !fs)
return false;
@@ -89,26 +89,26 @@ void piglit_init(int argc, char **argv)
snprintf(fs_text, 256, fs_template,
"gl_FragColor",
"gl_SecondaryFragColorEXT");
- pass = compile_simple_program(vs_text, fs_text) && pass;
+ pass = compile_simple_program(vs_text, fs_text, true) && pass;
// Regular FragData
snprintf(fs_text, 256, fs_template,
"gl_FragData[0]",
"gl_SecondaryFragDataEXT[0]");
- pass = compile_simple_program(vs_text, fs_text) && pass;
+ pass = compile_simple_program(vs_text, fs_text, true) && pass;
// Tests that should fail
// FragColor & SecondaryFragData
snprintf(fs_text, 256, fs_template,
"gl_FragColor",
"gl_SecondaryFragDataEXT[0]");
- pass = !compile_simple_program(vs_text, fs_text) && pass;
+ pass = !compile_simple_program(vs_text, fs_text, false) && pass;
// FragData & SecondaryFragColor
snprintf(fs_text, 256, fs_template,
"gl_FragData[0]",
"gl_SecondaryFragColorEXT");
- pass = !compile_simple_program(vs_text, fs_text) && pass;
+ pass = !compile_simple_program(vs_text, fs_text, false) && pass;
piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);
diff --git a/tests/spec/arb_blend_func_extended/api/error-at-begin.c b/tests/spec/arb_blend_func_extended/api/error-at-begin.c
index 7acf33396..9627068a2 100644
--- a/tests/spec/arb_blend_func_extended/api/error-at-begin.c
+++ b/tests/spec/arb_blend_func_extended/api/error-at-begin.c
@@ -30,7 +30,7 @@
* implicitly calls Begin if any draw buffer has a blend function requiring the
* second color input (SRC1_COLOR, ONE_MINUS_SRC1_COLOR, SRC1_ALPHA or
* ONE_MINUS_SRC1_ALPHA), and a framebuffer is bound that has more than
- * the value of MAX_DUAL_SOURCE_DRAW_BUFFERS-1 active color attachements."
+ * the value of MAX_DUAL_SOURCE_DRAW_BUFFERS-1 active color attachments."
*/
#include "piglit-util-gl.h"
diff --git a/tests/spec/arb_blend_func_extended/api/output-location.c b/tests/spec/arb_blend_func_extended/api/output-location.c
index dbda66f7d..21aeaf80b 100644
--- a/tests/spec/arb_blend_func_extended/api/output-location.c
+++ b/tests/spec/arb_blend_func_extended/api/output-location.c
@@ -114,7 +114,7 @@ void piglit_init(int argc, char **argv)
/* Linking should fail as the location set is too big. */
glLinkProgram(prog);
- if (piglit_link_check_status(prog))
+ if (piglit_link_check_status_quiet(prog))
piglit_report_result(PIGLIT_FAIL);
piglit_report_result(PIGLIT_PASS);
diff --git a/tests/spec/arb_blend_func_extended/execution/fbo-extended-blend-pattern.c b/tests/spec/arb_blend_func_extended/execution/fbo-extended-blend-pattern.c
index 94c779175..19b190805 100644
--- a/tests/spec/arb_blend_func_extended/execution/fbo-extended-blend-pattern.c
+++ b/tests/spec/arb_blend_func_extended/execution/fbo-extended-blend-pattern.c
@@ -28,10 +28,10 @@
* On Intel hardware at least, SIMD16 dual source rendering requires handling
* pixel data in two sets of 8 pixels each. Incorrect implementations may fail
* to map correct colors for each pixel group (for example by using the color
- * for the first group as the color for the second group or viceversa). However,
- * tests that render using solid colors across the entire polygon won't catch
- * these cases (since in that case the color is the same for boths groups of
- * pixels).
+ * for the first group as the color for the second group or vice-versa).
+ * However, tests that render using solid colors across the entire polygon
+ * won't catch these cases (since in that case the color is the same for both
+ * groups of pixels).
*
* This test blends using a checker board pattern where each cell is
* 10px wide and 10px tall. This makes it so that the two sets of 8 pixels
diff --git a/tests/spec/arb_clear_texture/CMakeLists.gl.txt b/tests/spec/arb_clear_texture/CMakeLists.gl.txt
index 98dfd6576..fe07688a9 100644
--- a/tests/spec/arb_clear_texture/CMakeLists.gl.txt
+++ b/tests/spec/arb_clear_texture/CMakeLists.gl.txt
@@ -24,5 +24,6 @@ piglit_add_executable (arb_clear_texture-srgb srgb.c common.c)
piglit_add_executable (arb_clear_texture-stencil stencil.c common.c)
piglit_add_executable (arb_clear_texture-texview texview.c)
piglit_add_executable (arb_clear_texture-depth depth.c common.c)
+piglit_add_executable (arb_clear_texture-supported-formats supported-formats.c common.c)
# vim: ft=cmake:
diff --git a/tests/spec/arb_clear_texture/depth.c b/tests/spec/arb_clear_texture/depth.c
index 93c5b1be0..096885ee9 100644
--- a/tests/spec/arb_clear_texture/depth.c
+++ b/tests/spec/arb_clear_texture/depth.c
@@ -40,10 +40,14 @@ PIGLIT_GL_TEST_CONFIG_BEGIN
PIGLIT_GL_TEST_CONFIG_END
static const struct format
-formats[] = {
+base_formats[] = {
{ GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, 4 },
{ GL_DEPTH_COMPONENT24, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, 4 },
{ GL_DEPTH_COMPONENT32, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, 4 },
+};
+
+static const struct format
+float_formats[] = {
{ GL_DEPTH_COMPONENT32F, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, 4 },
};
@@ -54,7 +58,11 @@ piglit_init(int argc, char **argv)
piglit_require_extension("GL_ARB_depth_texture");
- pass = test_formats(formats, ARRAY_SIZE(formats));
+ pass = test_formats(base_formats, ARRAY_SIZE(base_formats));
+
+ if (piglit_is_extension_supported("GL_ARB_depth_buffer_float")) {
+ pass &= test_formats(float_formats, ARRAY_SIZE(float_formats));
+ }
piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);
}
diff --git a/tests/spec/arb_clear_texture/integer.c b/tests/spec/arb_clear_texture/integer.c
index 03ea16ef6..1e2632e66 100644
--- a/tests/spec/arb_clear_texture/integer.c
+++ b/tests/spec/arb_clear_texture/integer.c
@@ -28,7 +28,7 @@
* texture where the first four texels are cleared to known values
* using separate calls to glClearTexSubImage. The values are chosen
* to potentially trigger problems with signed conversions. The rest
- * of the texture is initalised to zeroes. The textures are then read
+ * of the texture is initialised to zeroes. The textures are then read
* back with glGetTexImage and compared with the expected values.
*/
diff --git a/tests/spec/arb_clear_texture/supported-formats.c b/tests/spec/arb_clear_texture/supported-formats.c
new file mode 100644
index 000000000..e2eca537b
--- /dev/null
+++ b/tests/spec/arb_clear_texture/supported-formats.c
@@ -0,0 +1,279 @@
+/*
+ * Copyright (c) 2023 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+/**
+ * @file supported-formats.c
+ *
+ * Test using GL_CLEAR_COLOR with a range of formats.
+ */
+
+#include "common.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+ config.supports_gl_compat_version = 10;
+ config.window_visual = PIGLIT_GL_VISUAL_RGB;
+ config.khr_no_error_support = PIGLIT_NO_ERRORS;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+static const GLenum valid_targets[] = {
+ GL_TEXTURE_1D,
+ GL_TEXTURE_1D_ARRAY,
+ GL_TEXTURE_2D,
+ GL_TEXTURE_2D_ARRAY,
+ GL_TEXTURE_2D_MULTISAMPLE,
+ GL_TEXTURE_2D_MULTISAMPLE_ARRAY,
+ GL_TEXTURE_3D,
+ GL_TEXTURE_CUBE_MAP,
+ GL_TEXTURE_CUBE_MAP_ARRAY,
+ GL_TEXTURE_RECTANGLE,
+};
+
+static const GLenum invalid_targets[] = {
+ GL_RENDERBUFFER,
+ GL_TEXTURE_BUFFER,
+ GL_FRAMEBUFFER,
+ GL_COLOR_ATTACHMENT0,
+ GL_COLOR_ATTACHMENT1,
+ GL_COLOR_ATTACHMENT2,
+ GL_COLOR_ATTACHMENT3,
+ GL_COLOR_ATTACHMENT4,
+ GL_COLOR_ATTACHMENT5,
+ GL_COLOR_ATTACHMENT6,
+ GL_COLOR_ATTACHMENT7,
+ GL_COLOR_ATTACHMENT8,
+ GL_COLOR_ATTACHMENT9,
+ GL_COLOR_ATTACHMENT10,
+ GL_COLOR_ATTACHMENT11,
+ GL_COLOR_ATTACHMENT12,
+ GL_COLOR_ATTACHMENT13,
+ GL_COLOR_ATTACHMENT14,
+ GL_COLOR_ATTACHMENT15,
+ GL_DEPTH_ATTACHMENT,
+ GL_STENCIL_ATTACHMENT,
+ GL_TEXTURE_4D_SGIS,
+ GL_TEXTURE_RENDERBUFFER_NV,
+};
+
+static const GLenum valid_internal_formats[] = {
+ /* Base/unsized internal format (from Table 8.11) */
+ GL_DEPTH_COMPONENT,
+ GL_DEPTH_STENCIL,
+ GL_RED,
+ GL_RG,
+ GL_RGB,
+ GL_RGBA,
+ GL_STENCIL_INDEX,
+ /* Table 8.12 */
+ GL_R8,
+ GL_R8_SNORM,
+ GL_R16,
+ GL_R16_SNORM,
+ GL_RG8,
+ GL_RG8_SNORM,
+ GL_RG16,
+ GL_RG16_SNORM,
+ GL_R3_G3_B2,
+ GL_RGB4,
+ GL_RGB5,
+ GL_RGB8,
+ GL_RGB8_SNORM,
+ GL_RGB10,
+ GL_RGB12,
+ GL_RGB16,
+ GL_RGB16_SNORM,
+ GL_RGBA2,
+ GL_RGBA4,
+ GL_RGB5_A1,
+ GL_RGBA8,
+ GL_RGBA8_SNORM,
+ GL_RGB10_A2,
+ GL_RGB10_A2UI,
+ GL_RGBA12,
+ GL_RGBA16,
+ GL_RGBA16_SNORM,
+ GL_SRGB8,
+ GL_SRGB8_ALPHA8,
+ GL_R16F,
+ GL_RG16F,
+ GL_RGB16F,
+ GL_RGBA16F,
+ GL_R32F,
+ GL_RG32F,
+ GL_RGB32F,
+ GL_RGBA32F,
+ GL_R11F_G11F_B10F,
+ GL_RGB9_E5,
+ GL_R8I,
+ GL_R8UI,
+ GL_R16I,
+ GL_R16UI,
+ GL_R32I,
+ GL_R32UI,
+ GL_RG8I,
+ GL_RG16I,
+ GL_RG16UI,
+ GL_RG32I,
+ GL_RG32UI,
+ GL_RGB8I,
+ GL_RGB8UI,
+ GL_RGB16I,
+ GL_RGB16UI,
+ GL_RGB32I,
+ GL_RGB32UI,
+ GL_RGBA8I,
+ GL_RGBA8UI,
+ GL_RGBA16I,
+ GL_RGBA16UI,
+ GL_RGBA32I,
+ GL_RGBA32UI,
+ /* Table 8.13 */
+ GL_DEPTH_COMPONENT16,
+ GL_DEPTH_COMPONENT24,
+ GL_DEPTH_COMPONENT32,
+ GL_DEPTH_COMPONENT32F,
+ GL_DEPTH24_STENCIL8,
+ GL_DEPTH32F_STENCIL8,
+ GL_STENCIL_INDEX1,
+ GL_STENCIL_INDEX4,
+ GL_STENCIL_INDEX8,
+ GL_STENCIL_INDEX16
+};
+
+static const GLenum invalid_internal_formats[] = {
+ /* Table 8.14 */
+ GL_COMPRESSED_RED,
+ GL_COMPRESSED_RG,
+ GL_COMPRESSED_RGB,
+ GL_COMPRESSED_RGBA,
+ GL_COMPRESSED_SRGB,
+ GL_COMPRESSED_SRGB_ALPHA,
+ GL_COMPRESSED_RED_RGTC1,
+ GL_COMPRESSED_SIGNED_RED_RGTC1,
+ GL_COMPRESSED_RG_RGTC2,
+ GL_COMPRESSED_SIGNED_RG_RGTC2,
+ GL_COMPRESSED_RGBA_BPTC_UNORM,
+ GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM,
+ GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT,
+ GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT,
+ GL_COMPRESSED_RGB8_ETC2,
+ GL_COMPRESSED_SRGB8_ETC2,
+ GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,
+ GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,
+ GL_COMPRESSED_RGBA8_ETC2_EAC,
+ GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,
+ GL_COMPRESSED_R11_EAC,
+ GL_COMPRESSED_SIGNED_R11_EAC,
+ GL_COMPRESSED_RG11_EAC,
+ GL_COMPRESSED_SIGNED_RG11_EAC
+};
+
+enum piglit_result
+piglit_display(void)
+{
+ return PIGLIT_FAIL;
+}
+
+static bool
+try(const GLenum *targets, unsigned num_targets,
+ const GLenum *pinternal_formats, unsigned num_formats,
+ GLenum expected_result)
+{
+ bool pass = true;
+
+ for (unsigned i = 0; i < num_targets; i++) {
+ for (unsigned j = 0; j < num_formats; j++) {
+ GLint param;
+ GLint64 param64;
+
+ glGetInternalformativ(targets[i],
+ pinternal_formats[j],
+ GL_CLEAR_TEXTURE,
+ 1,
+ &param);
+
+ glGetInternalformati64v(targets[i],
+ pinternal_formats[j],
+ GL_CLEAR_TEXTURE,
+ 1,
+ &param64);
+
+ bool test = (expected_result == param);
+ bool test64 = (expected_result == param64);
+
+ if (test && test64)
+ continue;
+
+ fprintf(stderr,
+ " Failing case was "
+ "Result: %s NOT %s\n"
+ "target = %s, internal format = %s. \n",
+ piglit_get_gl_enum_name(param),
+ piglit_get_gl_enum_name(expected_result),
+ piglit_get_gl_enum_name(targets[i]),
+ piglit_get_gl_enum_name(pinternal_formats[j]));
+
+ if (!test)
+ fprintf(stderr,
+ " Calling glGetInternalformativ\n");
+
+ if (!test64)
+ fprintf(stderr,
+ " Calling glGetInternalformati64v\n");
+
+ pass = false;
+ }
+ }
+
+ return pass;
+}
+
+static bool
+check_supported_formats()
+{
+ bool pass = true;
+
+ pass = try(valid_targets, ARRAY_SIZE(valid_targets), valid_internal_formats,
+ ARRAY_SIZE(valid_internal_formats), GL_FULL_SUPPORT)
+ && pass;
+ pass = try(invalid_targets, ARRAY_SIZE(invalid_targets),
+ valid_internal_formats, ARRAY_SIZE(valid_internal_formats), GL_NONE)
+ && pass;
+ pass = try(valid_targets, ARRAY_SIZE(valid_targets),
+ invalid_internal_formats, ARRAY_SIZE(invalid_internal_formats), GL_NONE)
+ && pass;
+
+ return pass;
+}
+
+void
+piglit_init(int argc, char **argv)
+{
+ piglit_require_extension("GL_ARB_clear_texture");
+ piglit_require_extension("GL_ARB_internalformat_query2");
+
+ piglit_report_result(check_supported_formats() ?
+ PIGLIT_PASS :
+ PIGLIT_FAIL);
+} \ No newline at end of file
diff --git a/tests/spec/arb_clip_control/clip-control-depth-precision.c b/tests/spec/arb_clip_control/clip-control-depth-precision.c
index 61282a0ad..1a5433e8e 100644
--- a/tests/spec/arb_clip_control/clip-control-depth-precision.c
+++ b/tests/spec/arb_clip_control/clip-control-depth-precision.c
@@ -40,7 +40,7 @@
* This extension avoids adding a constant number even in an intermediate
* step which would destroy the effective depth precision possible with
* the floating point depth buffers.
- * Roughtly in numbers:
+ * Roughly in numbers:
* Two fragments at 5000001 and 5000000 \about 5000001*(1 - eps) distance
* from the eye point should yield to different values in the depth buffer.
* The same goes for about any fragment distance x that you should be able
diff --git a/tests/spec/arb_clip_control/clip-control.c b/tests/spec/arb_clip_control/clip-control.c
index 020ea0aa2..5a9466a73 100644
--- a/tests/spec/arb_clip_control/clip-control.c
+++ b/tests/spec/arb_clip_control/clip-control.c
@@ -225,7 +225,7 @@ draw_test(void)
pass = piglit_probe_pixel_depth(5, 5, 1.0) && pass;
- /* Defaut depth rage all clip control combinations */
+ /* Default depth rage all clip control combinations */
pass = test_patches(GL_LOWER_LEFT, GL_NEGATIVE_ONE_TO_ONE,
near, far, 10) && pass;
pass = test_patches(GL_LOWER_LEFT, GL_ZERO_TO_ONE,
diff --git a/tests/spec/arb_color_buffer_float/mrt.c b/tests/spec/arb_color_buffer_float/mrt.c
index 73166f728..ee72f0c63 100644
--- a/tests/spec/arb_color_buffer_float/mrt.c
+++ b/tests/spec/arb_color_buffer_float/mrt.c
@@ -132,17 +132,10 @@ test()
unsigned
init()
{
- GLint num;
-
piglit_require_extension("GL_ARB_vertex_program");
piglit_require_extension("GL_ARB_fragment_program");
piglit_require_extension("GL_ARB_draw_buffers");
-
- glGetIntegerv(GL_MAX_DRAW_BUFFERS_ARB, &num);
- if (num < 2) {
- printf("Test requires 2 draw buffers, found %d\n", num);
- piglit_report_result(PIGLIT_SKIP);
- }
+ piglit_require_minimum_getinteger(GL_MAX_DRAW_BUFFERS_ARB, 2);
mrt_vp = piglit_compile_program(GL_VERTEX_PROGRAM_ARB, mrt_vp_string);
mrt_fp = piglit_compile_program(GL_FRAGMENT_PROGRAM_ARB, mrt_fp_string);
diff --git a/tests/spec/arb_compute_shader/compute-and-render-bug-109630.c b/tests/spec/arb_compute_shader/compute-and-render-bug-109630.c
index e6ae51570..de3914fb9 100644
--- a/tests/spec/arb_compute_shader/compute-and-render-bug-109630.c
+++ b/tests/spec/arb_compute_shader/compute-and-render-bug-109630.c
@@ -27,7 +27,7 @@
* Test verifies that after compute workload geometry renders fine.
* This exercises hardware issue in Intel's GEN9 GPU which resulted
* in geometry flickering see https://bugs.freedesktop.org/show_bug.cgi?id=109630
- * There is no guarantied way to reproduce the issue but to run the
+ * There is no guaranteed way to reproduce the issue but to run the
* core part of the test many times.
*
* \author Andrii Kryvytskyi <andrii.o.kryvytskyi@globallogic.com>
@@ -157,7 +157,7 @@ piglit_display(void) {
glFinish();
if (!piglit_probe_pixel_rgba(0, 0, expected)) {
- printf("Failed on interation #%d \n", i);
+ printf("Failed on iteration #%d \n", i);
pass = false;
break;
}
diff --git a/tests/spec/arb_copy_image/CMakeLists.gl.txt b/tests/spec/arb_copy_image/CMakeLists.gl.txt
index 304148c95..cd6b5264a 100644
--- a/tests/spec/arb_copy_image/CMakeLists.gl.txt
+++ b/tests/spec/arb_copy_image/CMakeLists.gl.txt
@@ -11,6 +11,7 @@ link_libraries (
piglit_add_executable (arb_copy_image-api_errors api_errors.c)
piglit_add_executable (arb_copy_image-format-swizzle format-swizzle.c)
piglit_add_executable (arb_copy_image-formats formats.c)
+piglit_add_executable (arb_copy_image-levels-copy levels-copy.c)
piglit_add_executable (arb_copy_image-simple simple.c)
piglit_add_executable (arb_copy_image-srgb-copy srgb-copy.c)
piglit_add_executable (arb_copy_image-targets targets.c)
diff --git a/tests/spec/arb_copy_image/api_errors.c b/tests/spec/arb_copy_image/api_errors.c
index 75cd27439..b144d60c1 100644
--- a/tests/spec/arb_copy_image/api_errors.c
+++ b/tests/spec/arb_copy_image/api_errors.c
@@ -241,7 +241,7 @@ test_compressed_alignment_errors()
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
GL_NEAREST_MIPMAP_NEAREST);
- /* Check for alignment constaints */
+ /* Check for alignment constraints */
/* bad width = 21 */
glCopyImageSubData(tex[0], GL_TEXTURE_2D, 0, 0, 0, 0,
tex[1], GL_TEXTURE_2D, 0, 0, 0, 0, 21, 24, 1);
diff --git a/tests/spec/arb_copy_image/formats.c b/tests/spec/arb_copy_image/formats.c
index 95bbd04d7..6de6e7780 100644
--- a/tests/spec/arb_copy_image/formats.c
+++ b/tests/spec/arb_copy_image/formats.c
@@ -327,7 +327,7 @@ piglit_init(int argc, char **argv)
if (src_format_arg) {
/* Since we know the source format, we know the number of
- * bits per texel, so we can restrict the ammount of random
+ * bits per texel, so we can restrict the amount of random
* data we generate.
*/
Bpp = src_format_arg->bytes;
@@ -455,7 +455,7 @@ setup_test_data(const struct texture_format *src_format,
for (j = 0; j < samples; ++j) {
src_image = src_data + (j * image_size);
res_image = res_data + (j * image_size);
- /* Copy the center TEX_SIZE/2 x TEX_SIZE/2 pixels froms
+ /* Copy the center TEX_SIZE/2 x TEX_SIZE/2 pixels forms
* src_data to res_data
*/
memcpy_rect(src_image, stride, TEX_SIZE/4, TEX_SIZE/4,
@@ -563,7 +563,7 @@ load_compare_program(const struct texture_format *format)
} else if (compare == &icomp) {
gtype = "i";
} else {
- assert(!"Invalid comparison fucntion");
+ assert(!"Invalid comparison function");
gtype = "";
}
diff --git a/tests/spec/arb_copy_image/levels-copy.c b/tests/spec/arb_copy_image/levels-copy.c
new file mode 100644
index 000000000..9df1461c8
--- /dev/null
+++ b/tests/spec/arb_copy_image/levels-copy.c
@@ -0,0 +1,290 @@
+/* Copyright © 2020 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+/** @file layers-copy.c
+ *
+ * Tests that glCopyImageSubData correctly copies all levels of a texture.
+ * Also tests that the order in which levels are initialized doesn't affect
+ * the copying (some drivers, e.g. gallium drivers, may be sensitive to the
+ * initialization order).
+ */
+
+#include "piglit-util-gl.h"
+#include <math.h>
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+ config.supports_gl_compat_version = 13;
+
+ config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE;
+ config.khr_no_error_support = PIGLIT_NO_ERRORS;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+enum piglit_result
+piglit_display(void)
+{
+ return PIGLIT_FAIL;
+}
+
+static const int tex_default_width = 32;
+static const int tex_default_height = 32;
+static const int tex_default_depth = 8;
+static const int tex_default_levels = 6;
+
+static int illegal_levels_amount = 0;
+
+struct image {
+ GLuint texture;
+ GLenum target;
+ int levels;
+ int width, height, depth;
+};
+
+static void
+get_img_dims(struct image *img, int level,
+ int *width, int *height, int *depth)
+{
+ *width = MAX2(img->width >> level, 1);
+ *height = MAX2(img->height >> level, 1);
+ *depth = MAX2(img->depth >> level, 1);
+
+ switch (img->target) {
+ case GL_TEXTURE_1D:
+ case GL_TEXTURE_1D_ARRAY:
+ *height = 1;
+ *depth = 1;
+ break;
+
+ case GL_TEXTURE_CUBE_MAP:
+ *depth = 6;
+ break;
+
+ case GL_TEXTURE_2D:
+ case GL_TEXTURE_2D_ARRAY:
+ *depth = 1;
+ break;
+ }
+}
+
+static void
+init_image(struct image *img, GLenum texture_type,
+ int width, int height, int depth, int levels)
+{
+ img->target = texture_type;
+
+ img->width = width;
+ img->height = height;
+ img->depth = depth;
+ img->levels = levels;
+
+ get_img_dims(img, 0, &img->width, &img->height, &img->depth);
+
+ glGenTextures(1, &img->texture);
+ glBindTexture(img->target, img->texture);
+ glTexParameteri(img->target, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+ glTexParameteri(img->target, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+}
+
+static void
+tex_image(struct image *img, int level, bool upload_data)
+{
+ glBindTexture(img->target, img->texture);
+
+ int width, height, depth;
+ get_img_dims(img, level, &width, &height, &depth);
+
+ GLuint *data = NULL;
+ if (upload_data) {
+ data = malloc(width * height * depth * sizeof(GLuint));
+ for (int i = 0; i < width * height * depth; i++) {
+ data[i] = 0xFF / (level + 1);
+ }
+ }
+
+ switch (img->target) {
+ case GL_TEXTURE_1D:
+ glTexImage1D(img->target, level,
+ GL_RGBA8, width, 0,
+ GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, data);
+ break;
+
+ case GL_TEXTURE_CUBE_MAP:
+ for (int k = 0; k < 6; ++k) {
+ glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + k, level,
+ GL_RGBA8, width, height, 0,
+ GL_RGBA, GL_UNSIGNED_INT_8_8_8_8,
+ data);
+ }
+ break;
+
+ case GL_TEXTURE_2D:
+ case GL_TEXTURE_1D_ARRAY:
+ glTexImage2D(img->target, level,
+ GL_RGBA8, width, height, 0,
+ GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, data);
+ break;
+
+ case GL_TEXTURE_3D:
+ case GL_TEXTURE_2D_ARRAY:
+ glTexImage3D(img->target, level,
+ GL_RGBA8, width, height, depth, 0,
+ GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, data);
+ break;
+ default:
+ assert(!"Invalid target");
+ }
+
+ free(data);
+}
+
+static bool
+check_image(GLenum target_type, int level, int data_size)
+{
+ bool pass = true;
+ GLuint expected = 0xFF / (level + 1);
+
+ GLuint *data = malloc(data_size * sizeof(GLuint));
+ glGetTexImage(target_type, level, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, data);
+
+ if(level < tex_default_levels) /*Skip illegal levels*/
+ {
+ for (int i = 0; i < data_size; i++) {
+ if (data[i] != expected) {
+ pass = false;
+ fprintf(stderr, "%s: level %d, texel idx %d (%d total) "
+ "comparison failed (%d != %d)\n",
+ piglit_get_gl_enum_name(target_type),
+ level, i, data_size, data[i], expected);
+ break;
+ }
+ }
+ }
+
+ free(data);
+
+ return pass;
+}
+
+enum tex_init_order {
+ TEX_ORDER_FORWARD,
+ TEX_ORDER_BACKWARD,
+
+ TEX_ORDER_END,
+};
+
+static bool
+run_test(GLenum target_type, enum tex_init_order init_order)
+{
+ struct image srcImg, dstImg;
+ bool pass = true;
+
+ init_image(&srcImg, target_type, tex_default_width, tex_default_height,
+ tex_default_depth, tex_default_levels + illegal_levels_amount);
+ init_image(&dstImg, target_type, tex_default_width, tex_default_height,
+ tex_default_depth, tex_default_levels + illegal_levels_amount);
+
+ if (init_order == TEX_ORDER_FORWARD) {
+ for(int level = 0; level < srcImg.levels; level++) {
+ tex_image(&srcImg, level, true);
+ tex_image(&dstImg, level, false);
+ }
+ } else {
+ for(int level = srcImg.levels - 1; level >= 0; level--) {
+ tex_image(&srcImg, level, true);
+ tex_image(&dstImg, level, false);
+ }
+ }
+
+ for(int level = 0; level < srcImg.levels; level++) {
+ int width, height, depth;
+ get_img_dims(&srcImg, level, &width, &height, &depth);
+
+ glCopyImageSubData(srcImg.texture, target_type, level, 0, 0, 0, dstImg.texture,
+ target_type, level, 0, 0, 0, width, height, depth);
+ }
+
+ for(int level = 0; level < srcImg.levels; level++) {
+ int width, height, depth;
+ get_img_dims(&srcImg, level, &width, &height, &depth);
+
+ glBindTexture(target_type, dstImg.texture);
+
+ if (target_type == GL_TEXTURE_CUBE_MAP) {
+ for (int k = 0; k < 6; ++k) {
+ pass = check_image(GL_TEXTURE_CUBE_MAP_POSITIVE_X + k,
+ level, width * height) && pass;
+ }
+ } else {
+ pass = check_image(target_type, level, width * height * depth) && pass;
+ }
+ }
+
+ glDeleteTextures(1, &srcImg.texture);
+ glDeleteTextures(1, &dstImg.texture);
+
+ piglit_report_subtest_result(pass ? PIGLIT_PASS : PIGLIT_FAIL,
+ "Target type: %s, width: %d, height: %d, depth: %d, levels: %d, init order: %s",
+ piglit_get_gl_enum_name(target_type), srcImg.width, srcImg.height,
+ srcImg.depth, srcImg.levels,
+ init_order == TEX_ORDER_FORWARD ? "'forward'" : "'backward'");
+
+ return pass;
+}
+
+void
+piglit_init(int argc, char **argv)
+{
+ piglit_require_extension("GL_ARB_copy_image");
+
+ for (int i = 1; i < argc; i++) {
+ if (strcmp(argv[i], "add-illegal-levels") == 0) {
+ illegal_levels_amount = 2;
+ break;
+ }
+ }
+ /* When ran with 'add-illegal-levels' argument,
+ * we generate 2 more mipmap levels than allowed by texture size.
+ * Which can possibly corrupt data of existing layers.
+ * We don't check the data correctness of illegal levels, since
+ * spec doesn't say what should be in them.
+ */
+
+ bool pass = true;
+
+ for (enum tex_init_order order = TEX_ORDER_FORWARD; order < TEX_ORDER_END; order++) {
+ pass = run_test(GL_TEXTURE_1D, order) && pass;
+ pass = run_test(GL_TEXTURE_2D, order) && pass;
+ pass = run_test(GL_TEXTURE_3D, order) && pass;
+
+ if (piglit_is_extension_supported("GL_EXT_texture_array")) {
+ pass = run_test(GL_TEXTURE_1D_ARRAY, order) && pass;
+ pass = run_test(GL_TEXTURE_2D_ARRAY, order) && pass;
+ }
+
+ if (piglit_is_extension_supported("GL_ARB_texture_cube_map")) {
+ pass = run_test(GL_TEXTURE_CUBE_MAP, order) && pass;
+ }
+ }
+
+ piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);
+}
diff --git a/tests/spec/arb_cull_distance/exceed-limits.c b/tests/spec/arb_cull_distance/exceed-limits.c
index d7704d552..561d59e62 100644
--- a/tests/spec/arb_cull_distance/exceed-limits.c
+++ b/tests/spec/arb_cull_distance/exceed-limits.c
@@ -95,7 +95,7 @@ piglit_init(int argc, char **argv)
piglit_require_gl_version(30);
piglit_require_extension("GL_ARB_cull_distance");
- vs = piglit_compile_shader_text_nothrow(GL_VERTEX_SHADER, vert, true);
+ vs = piglit_compile_shader_text_nothrow(GL_VERTEX_SHADER, vert, false);
if (vs == 0)
piglit_report_result(PIGLIT_PASS);
diff --git a/tests/spec/arb_cull_distance/fs-cull-and-clip-distance-different.shader_test b/tests/spec/arb_cull_distance/fs-cull-and-clip-distance-different.shader_test
index 27fff6ff3..24468f3bf 100644
--- a/tests/spec/arb_cull_distance/fs-cull-and-clip-distance-different.shader_test
+++ b/tests/spec/arb_cull_distance/fs-cull-and-clip-distance-different.shader_test
@@ -5,7 +5,7 @@
# stage, as described in section 13.5.
#
# This test checks that the arrays gl_ClipDistance and gl_CullDistance only
-# interfer by gl_MaxCombinedClipAndCullDistances and not by its entrys.
+# interfere by gl_MaxCombinedClipAndCullDistances and not by its entries.
[require]
GLSL >= 1.30
diff --git a/tests/spec/arb_direct_state_access/compressedtextureimage.c b/tests/spec/arb_direct_state_access/compressedtextureimage.c
index 7b93fda8f..872340c4a 100644
--- a/tests/spec/arb_direct_state_access/compressedtextureimage.c
+++ b/tests/spec/arb_direct_state_access/compressedtextureimage.c
@@ -121,7 +121,7 @@ display_mipmaps(int x, int y)
glEnable(GL_TEXTURE_2D);
- /* Disply all the mipmap levels */
+ /* Display all the mipmap levels */
for (i = SIZE; i > 0; i /= 2) {
piglit_draw_rect_tex(x, y, i, i,
0, 0, 1, 1);
diff --git a/tests/spec/arb_direct_state_access/getcompressedtextureimage.c b/tests/spec/arb_direct_state_access/getcompressedtextureimage.c
index 4206a4714..a28d9f83a 100644
--- a/tests/spec/arb_direct_state_access/getcompressedtextureimage.c
+++ b/tests/spec/arb_direct_state_access/getcompressedtextureimage.c
@@ -223,7 +223,7 @@ getTexImage(bool doPBO, GLenum target, GLubyte *data,
*/
if (target == GL_TEXTURE_CUBE_MAP)
comp_size *= num_faces;
- printf("\tThe size of the texture in bytes is %d.\n", comp_size);
+ printf("\the size of the texture in bytes is %d.\n", comp_size);
/* Show the uncompressed data. */
show_image(data, num_layers * num_faces, "Data Before Compression");
diff --git a/tests/spec/arb_direct_state_access/gettextureimage-targets.c b/tests/spec/arb_direct_state_access/gettextureimage-targets.c
index 4ebb73f59..05ffc7609 100644
--- a/tests/spec/arb_direct_state_access/gettextureimage-targets.c
+++ b/tests/spec/arb_direct_state_access/gettextureimage-targets.c
@@ -58,7 +58,7 @@ init_layer_data(GLubyte *layer_data, int num_layers)
int b = (z + 1) * 255 / (num_layers - 1);
int a = x ^ y ^ z;
- /* each 4x4 block constains only one color (for S3TC) */
+ /* each 4x4 block contains only one color (for S3TC) */
for (i = 0; i < 4; i++) {
for (j = 0; j < 4; j++) {
data[((y + j) * IMAGE_WIDTH + x
diff --git a/tests/spec/arb_draw_buffers/state_change.c b/tests/spec/arb_draw_buffers/state_change.c
index e067d77a9..e9cf67899 100644
--- a/tests/spec/arb_draw_buffers/state_change.c
+++ b/tests/spec/arb_draw_buffers/state_change.c
@@ -131,13 +131,7 @@ piglit_display(void)
void
piglit_init(int argc, char **argv)
{
- GLint i;
-
piglit_require_extension("GL_EXT_framebuffer_object");
piglit_require_extension("GL_ARB_draw_buffers");
- glGetIntegerv(GL_MAX_DRAW_BUFFERS_ARB, &i);
- if (i < 2) {
- printf("2 draw buffers required, %d reported.\n", i);
- piglit_report_result(PIGLIT_SKIP);
- }
+ piglit_require_minimum_getinteger(GL_MAX_DRAW_BUFFERS_ARB, 2);
}
diff --git a/tests/spec/arb_draw_buffers_blend/state_set_get.c b/tests/spec/arb_draw_buffers_blend/state_set_get.c
index a8e2f2630..280994e80 100644
--- a/tests/spec/arb_draw_buffers_blend/state_set_get.c
+++ b/tests/spec/arb_draw_buffers_blend/state_set_get.c
@@ -88,7 +88,7 @@ set_state(int buffer,
}
if (test_dlist) {
- glEndList(list);
+ glEndList();
glCallList(list);
glDeleteLists(list, 1);
}
@@ -133,7 +133,7 @@ set_state_all_buffers(GLenum srcRGB, GLenum srcA,
}
if (test_dlist) {
- glEndList(list);
+ glEndList();
glCallList(list);
glDeleteLists(list, 1);
}
diff --git a/tests/spec/arb_explicit_attrib_location/1.10/compiler/layout-10.frag b/tests/spec/arb_explicit_attrib_location/1.10/compiler/layout-10.frag
index ba7ca4e7f..3cfe18859 100644
--- a/tests/spec/arb_explicit_attrib_location/1.10/compiler/layout-10.frag
+++ b/tests/spec/arb_explicit_attrib_location/1.10/compiler/layout-10.frag
@@ -20,7 +20,7 @@
// * if more than one varying out variable is bound to the same
// number and index; or
//
-// * if the explicit binding assigments do not leave enough space
+// * if the explicit binding assignments do not leave enough space
// for the linker to automatically assign a location for a varying
// out array, which requires multiple contiguous locations."
diff --git a/tests/spec/arb_explicit_attrib_location/1.10/compiler/layout-11.frag b/tests/spec/arb_explicit_attrib_location/1.10/compiler/layout-11.frag
index e9a1f3878..3e6238c35 100644
--- a/tests/spec/arb_explicit_attrib_location/1.10/compiler/layout-11.frag
+++ b/tests/spec/arb_explicit_attrib_location/1.10/compiler/layout-11.frag
@@ -20,7 +20,7 @@
// * if more than one varying out variable is bound to the same
// number and index; or
//
-// * if the explicit binding assigments do not leave enough space
+// * if the explicit binding assignments do not leave enough space
// for the linker to automatically assign a location for a varying
// out array, which requires multiple contiguous locations."
//
diff --git a/tests/spec/arb_explicit_attrib_location/1.10/compiler/layout-13.frag b/tests/spec/arb_explicit_attrib_location/1.10/compiler/layout-13.frag
index 413778a3d..9f1799347 100644
--- a/tests/spec/arb_explicit_attrib_location/1.10/compiler/layout-13.frag
+++ b/tests/spec/arb_explicit_attrib_location/1.10/compiler/layout-13.frag
@@ -20,7 +20,7 @@
// * if more than one varying out variable is bound to the same
// number and index; or
//
-// * if the explicit binding assigments do not leave enough space
+// * if the explicit binding assignments do not leave enough space
// for the linker to automatically assign a location for a varying
// out array, which requires multiple contiguous locations."
diff --git a/tests/spec/arb_explicit_attrib_location/1.20/compiler/layout-10.frag b/tests/spec/arb_explicit_attrib_location/1.20/compiler/layout-10.frag
index 610976b13..6231e303b 100644
--- a/tests/spec/arb_explicit_attrib_location/1.20/compiler/layout-10.frag
+++ b/tests/spec/arb_explicit_attrib_location/1.20/compiler/layout-10.frag
@@ -20,7 +20,7 @@
// * if more than one varying out variable is bound to the same
// number and index; or
//
-// * if the explicit binding assigments do not leave enough space
+// * if the explicit binding assignments do not leave enough space
// for the linker to automatically assign a location for a varying
// out array, which requires multiple contiguous locations."
diff --git a/tests/spec/arb_explicit_attrib_location/1.20/compiler/layout-11.frag b/tests/spec/arb_explicit_attrib_location/1.20/compiler/layout-11.frag
index 1720d6635..342b01fa2 100644
--- a/tests/spec/arb_explicit_attrib_location/1.20/compiler/layout-11.frag
+++ b/tests/spec/arb_explicit_attrib_location/1.20/compiler/layout-11.frag
@@ -20,7 +20,7 @@
// * if more than one varying out variable is bound to the same
// number and index; or
//
-// * if the explicit binding assigments do not leave enough space
+// * if the explicit binding assignments do not leave enough space
// for the linker to automatically assign a location for a varying
// out array, which requires multiple contiguous locations."
//
diff --git a/tests/spec/arb_explicit_attrib_location/1.20/compiler/layout-13.frag b/tests/spec/arb_explicit_attrib_location/1.20/compiler/layout-13.frag
index c6e6d049a..8a4c55a19 100644
--- a/tests/spec/arb_explicit_attrib_location/1.20/compiler/layout-13.frag
+++ b/tests/spec/arb_explicit_attrib_location/1.20/compiler/layout-13.frag
@@ -20,7 +20,7 @@
// * if more than one varying out variable is bound to the same
// number and index; or
//
-// * if the explicit binding assigments do not leave enough space
+// * if the explicit binding assignments do not leave enough space
// for the linker to automatically assign a location for a varying
// out array, which requires multiple contiguous locations."
diff --git a/tests/spec/arb_explicit_attrib_location/overlapping-locations-input-attribs.c b/tests/spec/arb_explicit_attrib_location/overlapping-locations-input-attribs.c
index ec6df3b17..f107d80c0 100644
--- a/tests/spec/arb_explicit_attrib_location/overlapping-locations-input-attribs.c
+++ b/tests/spec/arb_explicit_attrib_location/overlapping-locations-input-attribs.c
@@ -36,7 +36,7 @@
* in this case."
*
* Aliasing of vertex input variables is allowed in: OpenGL
- * 2.0 (and above) and OpenGL ES 2.0. This test varifies
+ * 2.0 (and above) and OpenGL ES 2.0. This test verifies
* that aliasing can be used successfully in a vertex shader
* under the constraints defined in OpenGL spec.
*/
diff --git a/tests/spec/arb_explicit_uniform_location/linker/set-location-to-sampler.shader_test b/tests/spec/arb_explicit_uniform_location/linker/set-location-to-sampler.shader_test
index 31c0c693e..965f809cd 100644
--- a/tests/spec/arb_explicit_uniform_location/linker/set-location-to-sampler.shader_test
+++ b/tests/spec/arb_explicit_uniform_location/linker/set-location-to-sampler.shader_test
@@ -1,5 +1,5 @@
#
-# Tests that an opaque type (sampler) gets a location succesfully
+# Tests that an opaque type (sampler) gets a location successfully
#
[require]
GLSL >= 1.30
diff --git a/tests/spec/arb_fragment_layer_viewport/layer-gs-write-simple.shader_test b/tests/spec/arb_fragment_layer_viewport/layer-gs-write-simple.shader_test
index bfafcb1f2..a43293581 100644
--- a/tests/spec/arb_fragment_layer_viewport/layer-gs-write-simple.shader_test
+++ b/tests/spec/arb_fragment_layer_viewport/layer-gs-write-simple.shader_test
@@ -39,15 +39,9 @@ clear color 0.0 0.0 0.0 0.0
clear
uniform int layer 0
-draw rect -1 -1 1 1
+draw rect -1 -1 1 2
uniform int layer 1
-draw rect 0 -1 1 1
-
-uniform int layer 10000
-draw rect -1 0 1 1
-
-uniform int layer -10000
-draw rect 0 0 1 1
+draw rect 0 -1 1 2
probe all rgb 0.0 1.0 0.0
diff --git a/tests/spec/arb_fragment_layer_viewport/layer-gs-writes-out-of-range.shader_test b/tests/spec/arb_fragment_layer_viewport/layer-gs-writes-out-of-range.shader_test
deleted file mode 100644
index 06a859b64..000000000
--- a/tests/spec/arb_fragment_layer_viewport/layer-gs-writes-out-of-range.shader_test
+++ /dev/null
@@ -1,72 +0,0 @@
-[require]
-GLSL >= 1.50
-GL_ARB_fragment_layer_viewport
-GL_ARB_shader_atomic_counters
-
-#
-# Ensure that the fragment stage reads the same value for gl_Layer as was
-# written by the geometry stage.
-#
-# This test covers the case where the value written is out of range.
-#
-
-[vertex shader]
-#version 150
-in vec4 piglit_vertex;
-
-void main()
-{
- gl_Position = piglit_vertex;
-}
-
-[geometry shader]
-#version 150
-
-layout(triangles) in;
-layout(triangle_strip, max_vertices=9) out;
-
-const int layers[] = int[]( -1, 4, 2048 );
-flat out int layer_written;
-
-void main()
-{
- for (int layer = 0; layer < layers.length(); layer++) {
-
- for (int i = 0; i < 3; i++) {
- gl_Position = gl_in[i].gl_Position;
- layer_written = layers[layer];
- gl_Layer = layers[layer];
- EmitVertex();
- }
-
- EndPrimitive();
- }
-}
-
-[fragment shader]
-#version 150
-#extension GL_ARB_fragment_layer_viewport: require
-#extension GL_ARB_shader_atomic_counters: require
-
-flat in int layer_written;
-
-layout(binding = 0) uniform atomic_uint mismatches;
-
-void main()
-{
- if (layer_written != gl_Layer)
- atomicCounterIncrement(mismatches);
-
- gl_FragColor = vec4(0);
-}
-
-[test]
-texture junk 2DArray 0 ( 64 , 64 , 4 )
-fb tex layered 0
-
-atomic counters 1
-
-
-draw rect -1 -1 2 2
-
-probe atomic counter 0 == 0
diff --git a/tests/spec/arb_fragment_layer_viewport/layer-vs-gs-write-simple.shader_test b/tests/spec/arb_fragment_layer_viewport/layer-vs-gs-write-simple.shader_test
index aab8a5b6e..2b7210eab 100644
--- a/tests/spec/arb_fragment_layer_viewport/layer-vs-gs-write-simple.shader_test
+++ b/tests/spec/arb_fragment_layer_viewport/layer-vs-gs-write-simple.shader_test
@@ -50,15 +50,9 @@ clear color 0.0 0.0 0.0 0.0
clear
uniform int layer 0
-draw rect -1 -1 1 1
+draw rect -1 -1 1 2
uniform int layer 1
-draw rect 0 -1 1 1
-
-uniform int layer 10000
-draw rect -1 0 1 1
-
-uniform int layer -10000
-draw rect 0 0 1 1
+draw rect 0 -1 1 2
probe all rgb 0.0 1.0 0.0
diff --git a/tests/spec/arb_fragment_layer_viewport/layer-vs-write-gs-no-write-simple.shader_test b/tests/spec/arb_fragment_layer_viewport/layer-vs-write-gs-no-write-simple.shader_test
index 3dfc2c447..30a229730 100644
--- a/tests/spec/arb_fragment_layer_viewport/layer-vs-write-gs-no-write-simple.shader_test
+++ b/tests/spec/arb_fragment_layer_viewport/layer-vs-write-gs-no-write-simple.shader_test
@@ -2,6 +2,7 @@
GLSL >= 1.50
GL_ARB_fragment_layer_viewport
GL_AMD_vertex_shader_layer
+ignore_missing_uniforms
[vertex shader]
#version 140
diff --git a/tests/spec/arb_fragment_layer_viewport/layer-vs-write-simple.shader_test b/tests/spec/arb_fragment_layer_viewport/layer-vs-write-simple.shader_test
index fe453fb17..d9f002aa3 100644
--- a/tests/spec/arb_fragment_layer_viewport/layer-vs-write-simple.shader_test
+++ b/tests/spec/arb_fragment_layer_viewport/layer-vs-write-simple.shader_test
@@ -34,15 +34,9 @@ clear color 0.0 0.0 0.0 0.0
clear
uniform int layer 0
-draw rect -1 -1 1 1
+draw rect -1 -1 1 2
uniform int layer 1
-draw rect 0 -1 1 1
-
-uniform int layer 10000
-draw rect -1 0 1 1
-
-uniform int layer -10000
-draw rect 0 0 1 1
+draw rect 0 -1 1 2
probe all rgb 0.0 1.0 0.0
diff --git a/tests/spec/arb_fragment_layer_viewport/viewport-gs-writes-out-of-range.shader_test b/tests/spec/arb_fragment_layer_viewport/viewport-gs-writes-out-of-range.shader_test
deleted file mode 100644
index 9418e161b..000000000
--- a/tests/spec/arb_fragment_layer_viewport/viewport-gs-writes-out-of-range.shader_test
+++ /dev/null
@@ -1,73 +0,0 @@
-[require]
-GLSL >= 1.50
-GL_ARB_fragment_layer_viewport
-GL_ARB_shader_atomic_counters
-
-#
-# Ensure that the fragment stage reads the same value for gl_ViewportIndex as was
-# written by the geometry stage.
-#
-# This test covers the case where the value written is out of range.
-#
-
-[vertex shader]
-#version 150
-in vec4 piglit_vertex;
-
-void main()
-{
- gl_Position = piglit_vertex;
-}
-
-[geometry shader]
-#version 150
-#extension GL_ARB_viewport_array: require
-
-layout(triangles) in;
-layout(triangle_strip, max_vertices=9) out;
-
-const int vps[] = int[]( -1, 16, 2048 );
-flat out int vp_written;
-
-void main()
-{
- for (int vp = 0; vp < vps.length(); vp++) {
-
- for (int i = 0; i < 3; i++) {
- gl_Position = gl_in[i].gl_Position;
- vp_written = vps[vp];
- gl_ViewportIndex = vps[vp];
- EmitVertex();
- }
-
- EndPrimitive();
- }
-}
-
-[fragment shader]
-#version 150
-#extension GL_ARB_fragment_layer_viewport: require
-#extension GL_ARB_shader_atomic_counters: require
-
-flat in int vp_written;
-
-layout(binding = 0) uniform atomic_uint mismatches;
-
-void main()
-{
- if (vp_written != gl_ViewportIndex)
- atomicCounterIncrement(mismatches);
-
- gl_FragColor = vec4(0);
-}
-
-[test]
-texture junk 2DArray 0 ( 64 , 64 , 1 )
-fb tex layered 0
-
-atomic counters 1
-
-
-draw rect -1 -1 2 2
-
-probe atomic counter 0 == 0
diff --git a/tests/spec/arb_fragment_layer_viewport/viewport-vs-write-gs-no-write-simple.shader_test b/tests/spec/arb_fragment_layer_viewport/viewport-vs-write-gs-no-write-simple.shader_test
index faec9f07a..81d947a44 100644
--- a/tests/spec/arb_fragment_layer_viewport/viewport-vs-write-gs-no-write-simple.shader_test
+++ b/tests/spec/arb_fragment_layer_viewport/viewport-vs-write-gs-no-write-simple.shader_test
@@ -2,6 +2,7 @@
GLSL >= 1.50
GL_ARB_fragment_layer_viewport
GL_AMD_vertex_shader_viewport_index
+ignore_missing_uniforms
[vertex shader]
#version 140
diff --git a/tests/spec/arb_fragment_program_shadow/tex-shadow2dnotdepth.shader_test b/tests/spec/arb_fragment_program_shadow/tex-shadow2dnotdepth.shader_test
new file mode 100644
index 000000000..d46a16358
--- /dev/null
+++ b/tests/spec/arb_fragment_program_shadow/tex-shadow2dnotdepth.shader_test
@@ -0,0 +1,41 @@
+[require]
+GL_ARB_texture_rectangle
+GL_ARB_fragment_program_shadow
+
+[vertex program]
+!!ARBvp1.0
+TEMP texcoord;
+
+ADD texcoord.xyz, vertex.position.xyyy, {1}.x;
+MUL texcoord.xyz, texcoord, {0.5}.x;
+MOV texcoord.w, {0}.x;
+
+MOV result.position, vertex.position;
+MOV result.texcoord[0], texcoord;
+END
+
+[fragment program]
+!!ARBfp1.0
+OPTION ARB_fragment_program_shadow;
+TEX result.color, fragment.texcoord[0], texture[0], SHADOW2D;
+END
+
+[test]
+texture rgbw 0 (8, 8)
+draw rect -1 -1 2 2
+
+# Test fallback to a not shadow sampler for a not depth texture
+# It is how AMD and NVIDIA work on Windows, and games might abuse this:
+# https://gitlab.freedesktop.org/mesa/mesa/-/issues/8425
+
+relative probe rgba (0.0, 0.0) (1.0, 0.0, 0.0, 1.0)
+relative probe rgba (0.4, 0.4) (1.0, 0.0, 0.0, 1.0)
+
+relative probe rgba (1.0, 0.0) (0.0, 1.0, 0.0, 1.0)
+relative probe rgba (0.6, 0.4) (0.0, 1.0, 0.0, 1.0)
+
+relative probe rgba (0.0, 1.0) (0.0, 0.0, 1.0, 1.0)
+relative probe rgba (0.4, 0.6) (0.0, 0.0, 1.0, 1.0)
+
+relative probe rgba (1.0, 1.0) (1.0, 1.0, 1.0, 1.0)
+relative probe rgba (0.6, 0.6) (1.0, 1.0, 1.0, 1.0) \ No newline at end of file
diff --git a/tests/spec/arb_framebuffer_object/GenerateMipmap-versus-READ_FRAMEBUFFER.c b/tests/spec/arb_framebuffer_object/GenerateMipmap-versus-READ_FRAMEBUFFER.c
index cc24d17af..6d23c0ff3 100644
--- a/tests/spec/arb_framebuffer_object/GenerateMipmap-versus-READ_FRAMEBUFFER.c
+++ b/tests/spec/arb_framebuffer_object/GenerateMipmap-versus-READ_FRAMEBUFFER.c
@@ -70,7 +70,7 @@ piglit_init(int argc, char **argv)
fprintf(stderr,
"Either OpenGL 3.0, or GL_ARB_framebuffer_object, or "
"GL_EXT_framebuffer_object and GL_EXT_framebuffer_blit "
- "is requred.\n");
+ "is required.\n");
piglit_report_result(PIGLIT_SKIP);
}
diff --git a/tests/spec/arb_framebuffer_object/fbo-drawbuffers-none.c b/tests/spec/arb_framebuffer_object/fbo-drawbuffers-none.c
index f6a8a2044..ec3395f81 100644
--- a/tests/spec/arb_framebuffer_object/fbo-drawbuffers-none.c
+++ b/tests/spec/arb_framebuffer_object/fbo-drawbuffers-none.c
@@ -121,6 +121,7 @@ static const char *fs_template_write_different =
static char *fs_write_different;
static char *test_name, *prog_name;
static GLuint fb, prog_write_all_red, prog_write_all_different;
+bool (*run_test)(const GLenum drawbuffers[4]);
static void
@@ -422,8 +423,6 @@ print_usage_and_exit(void)
void
piglit_init(int argc, char **argv)
{
- int max_draw_bufs;
-
prog_name = malloc((strlen(argv[0]) + 1));
assert(prog_name);
strcpy(prog_name, argv[0]);
@@ -437,11 +436,42 @@ piglit_init(int argc, char **argv)
piglit_require_gl_version(21);
piglit_require_extension("GL_ARB_framebuffer_object");
+ piglit_require_minimum_getinteger(GL_MAX_DRAW_BUFFERS_ARB, 4);
- glGetIntegerv(GL_MAX_DRAW_BUFFERS_ARB, &max_draw_bufs);
- if (max_draw_bufs < 4) {
- puts("At least 4 draw buffers are required.");
- piglit_report_result(PIGLIT_SKIP);
+ if (streq(test_name, "glClear")) {
+ run_test = &test_glClear;
+ }
+ else if (streq(test_name, "glClearBuffer")) {
+ piglit_require_gl_version(30);
+ run_test = &test_glClearBuffer;
+ }
+ else if (streq(test_name, "gl_FragColor")) {
+ run_test = &test_fragcolor;
+ }
+ else if (streq(test_name, "gl_FragData")) {
+ run_test = &test_fragdata;
+ }
+ else if (streq(test_name, "use_frag_out")) {
+ piglit_require_GLSL_version(130);
+ run_test = &test_fragout;
+ }
+ else if (streq(test_name, "glColorMaskIndexed")) {
+ piglit_require_extension("GL_EXT_draw_buffers2");
+ run_test = &test_glColorMaskIndexed;
+ }
+ else if (streq(test_name, "glBlendFunci")) {
+ piglit_require_extension("GL_ARB_draw_buffers_blend");
+ run_test = &test_glBlendFunci;
+ }
+ else if (streq(test_name, "glDrawPixels")) {
+ run_test = &test_glDrawPixels;
+ }
+ else if (streq(test_name, "glBlitFramebuffer")) {
+ run_test = &test_glBlitFramebuffer;
+ }
+ else {
+ printf("Unknown subtest: %s\n", test_name);
+ print_usage_and_exit();
}
create_shaders();
@@ -460,41 +490,7 @@ piglit_display(void)
glDrawBuffers(4, drawbuf_config[i]);
- if (streq(test_name, "glClear")) {
- pass = test_glClear(drawbuf_config[i]) && pass;
- }
- else if (streq(test_name, "glClearBuffer")) {
- piglit_require_gl_version(30);
- pass = test_glClearBuffer(drawbuf_config[i]) && pass;
- }
- else if (streq(test_name, "gl_FragColor")) {
- pass = test_fragcolor(drawbuf_config[i]) && pass;
- }
- else if (streq(test_name, "gl_FragData")) {
- pass = test_fragdata(drawbuf_config[i]) && pass;
- }
- else if (streq(test_name, "use_frag_out")) {
- piglit_require_GLSL_version(130);
- pass = test_fragout(drawbuf_config[i]) && pass;
- }
- else if (streq(test_name, "glColorMaskIndexed")) {
- piglit_require_extension("GL_EXT_draw_buffers2");
- pass = test_glColorMaskIndexed(drawbuf_config[i]) && pass;
- }
- else if (streq(test_name, "glBlendFunci")) {
- piglit_require_extension("GL_ARB_draw_buffers_blend");
- pass = test_glBlendFunci(drawbuf_config[i]) && pass;
- }
- else if (streq(test_name, "glDrawPixels")) {
- pass = test_glDrawPixels(drawbuf_config[i]) && pass;
- }
- else if (streq(test_name, "glBlitFramebuffer")) {
- pass = test_glBlitFramebuffer(drawbuf_config[i]) && pass;
- }
- else {
- printf("Unknown subtest: %s\n", test_name);
- print_usage_and_exit();
- }
+ pass = run_test(drawbuf_config[i]) && pass;
}
pass = piglit_check_gl_error(GL_NO_ERROR) && pass;
diff --git a/tests/spec/arb_geometry_shader4/execution/program-parameter/vertices-out.c b/tests/spec/arb_geometry_shader4/execution/program-parameter/vertices-out.c
index 4d23526a4..b4b7488c1 100644
--- a/tests/spec/arb_geometry_shader4/execution/program-parameter/vertices-out.c
+++ b/tests/spec/arb_geometry_shader4/execution/program-parameter/vertices-out.c
@@ -28,7 +28,7 @@
* variable number of output components.
*
* The value of GEOMETRY_VERTICES_OUT is limited by the implementation
- * dependend constants MAX_GEOMETRY_OUTPUT_VERTICES and
+ * dependent constants MAX_GEOMETRY_OUTPUT_VERTICES and
* MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS.
*
* From the ARB_geometry_shader4 spec (section Errors):
@@ -126,7 +126,7 @@ test_geometry_vertices_out(const GLuint prog)
* > MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS, the spec requires
* ProgramParameter to throw an INVALID_VALUE and subsequent linking to
* fail.
- * But the number of output components can only be infered from the
+ * But the number of output components can only be inferred from the
* geometry shader source (and a geometry shader might not even be
* attached to the program object when ProgramParameter is called).
* So, ignore any errors generated from ProgramParameter and only check
diff --git a/tests/spec/arb_geometry_shader4/linker/2darray-vertex-index-oob.shader_test b/tests/spec/arb_geometry_shader4/linker/2darray-vertex-index-oob.shader_test
index 60db7e918..05d0587e9 100644
--- a/tests/spec/arb_geometry_shader4/linker/2darray-vertex-index-oob.shader_test
+++ b/tests/spec/arb_geometry_shader4/linker/2darray-vertex-index-oob.shader_test
@@ -29,7 +29,7 @@ varying out float gs_out;
void main()
{
- /* This sould fail at link time once the size of the outer dimension of
+ /* This should fail at link time once the size of the outer dimension of
* gs_input (3) is known.
*/
float s = gs_input[3][0];
diff --git a/tests/spec/arb_get_program_binary/api-errors.c b/tests/spec/arb_get_program_binary/api-errors.c
index 5b104bb43..9b1356502 100644
--- a/tests/spec/arb_get_program_binary/api-errors.c
+++ b/tests/spec/arb_get_program_binary/api-errors.c
@@ -23,7 +23,7 @@
/**
* \file coverage.c
- * Attempt quering every enum in the spec. Sanity check initial values.
+ * Attempt querying every enum in the spec. Sanity check initial values.
*
* GL_NUM_PROGRAM_BINARY_FORMATS and GL_PROGRAM_BINARY_FORMATS are not
* covered by this test because they are heavily covered by the
diff --git a/tests/spec/arb_get_program_binary/gpb-common.c b/tests/spec/arb_get_program_binary/gpb-common.c
index 438e4992d..224173d5d 100644
--- a/tests/spec/arb_get_program_binary/gpb-common.c
+++ b/tests/spec/arb_get_program_binary/gpb-common.c
@@ -76,7 +76,7 @@ gpb_restore_program(GLuint prog, void *binary, GLsizei length, GLenum format)
glProgramBinary(prog, format, binary, length);
if (!piglit_check_gl_error(GL_NO_ERROR)) {
fprintf(stderr, "glProgramBinary error "
- "(should not happend according to spec.)\n");
+ "(should not happen according to spec.)\n");
piglit_report_result(PIGLIT_FAIL);
}
diff --git a/tests/spec/arb_get_program_binary/retrievable_hint.c b/tests/spec/arb_get_program_binary/retrievable_hint.c
index a81a9f63b..9d6e2c651 100644
--- a/tests/spec/arb_get_program_binary/retrievable_hint.c
+++ b/tests/spec/arb_get_program_binary/retrievable_hint.c
@@ -23,7 +23,7 @@
/**
* \file coverage.c
- * Attempt quering every enum in the spec. Sanity check initial values.
+ * Attempt querying every enum in the spec. Sanity check initial values.
*
* GL_NUM_PROGRAM_BINARY_FORMATS and GL_PROGRAM_BINARY_FORMATS are not
* covered by this test because they are heavily covered by the
diff --git a/tests/spec/arb_get_texture_sub_image/errors.c b/tests/spec/arb_get_texture_sub_image/errors.c
index 4b99d1cc2..a733d6c20 100644
--- a/tests/spec/arb_get_texture_sub_image/errors.c
+++ b/tests/spec/arb_get_texture_sub_image/errors.c
@@ -125,7 +125,7 @@ test_buffer_size(void)
if (!piglit_check_gl_error(GL_INVALID_OPERATION))
pass = false;
- /* Test getting a quadrant, sufficent buffer size */
+ /* Test getting a quadrant, sufficient buffer size */
glPixelStorei(GL_PACK_SKIP_ROWS, 0);
glPixelStorei(GL_PACK_SKIP_PIXELS, 0);
glPixelStorei(GL_PACK_ROW_LENGTH, 0);
@@ -137,7 +137,7 @@ test_buffer_size(void)
if (!piglit_check_gl_error(GL_NO_ERROR))
pass = false;
- /* Test getting a quadrant, insufficent buffer size */
+ /* Test getting a quadrant, insufficient buffer size */
glPixelStorei(GL_PACK_SKIP_ROWS, 0);
glPixelStorei(GL_PACK_SKIP_PIXELS, 0);
glPixelStorei(GL_PACK_ROW_LENGTH, 0);
@@ -194,7 +194,7 @@ test_invalid_values(void)
if (!piglit_check_gl_error(GL_INVALID_VALUE))
pass = false;
- /* Test non-existant level */
+ /* Test non-existent level */
glGetTextureSubImage(tex, 4,
0, 0, 0, /* offset */
8, 8, 1, /* size */
diff --git a/tests/spec/arb_get_texture_sub_image/get.c b/tests/spec/arb_get_texture_sub_image/get.c
index 4abf3a596..a0ba906f7 100644
--- a/tests/spec/arb_get_texture_sub_image/get.c
+++ b/tests/spec/arb_get_texture_sub_image/get.c
@@ -194,7 +194,7 @@ test_getsubimage(GLenum target,
y1 = MAX2(1, mip_height / 3);
z1 = MAX2(1, mip_depth / 3);
if (intFormat == GL_COMPRESSED_RGBA_S3TC_DXT5_EXT) {
- /* x1, y1 must be a multipe of 4 */
+ /* x1, y1 must be a multiple of 4 */
x1 &= ~0x3;
y1 &= ~0x3;
}
diff --git a/tests/spec/arb_gpu_shader5/execution/built-in-functions/fs-bitfieldInsert-pow2-and-zero.shader_test b/tests/spec/arb_gpu_shader5/execution/built-in-functions/fs-bitfieldInsert-pow2-and-zero.shader_test
new file mode 100644
index 000000000..daf968d55
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/execution/built-in-functions/fs-bitfieldInsert-pow2-and-zero.shader_test
@@ -0,0 +1,46 @@
+# Verify an optimization pattern that was added in mesa!19968
+
+[require]
+GLSL >= 1.50
+GL_ARB_gpu_shader5
+
+[vertex shader passthrough]
+
+[fragment shader]
+#extension GL_ARB_gpu_shader5 : enable
+
+out vec4 color;
+
+uniform vec2 expected[4] = vec2[](vec2(0.0, 0.0),
+ vec2(16384.0, 0.0),
+ vec2(0.0, 4096.0),
+ vec2(16384.0, 4096.0));
+
+void main()
+{
+ vec4 c = vec4(0.0, 1.0, 0.0, 1.0);
+ uint i = (uint(gl_FragCoord.x) & 1) + ((uint(gl_FragCoord.y) & 1) << 1);
+
+ /* Result of bitfieldInsert(0, X, Y, 1) is either 0 or (1 << Y)
+ * depending on whether X is even or odd, respectively.
+ */
+
+ if (float(bitfieldInsert(0, uint(gl_FragCoord.x), 14, 1)) !=
+ expected[i].x) {
+ c.x = 1.0;
+ c.y = 0.0;
+ }
+
+ if (float(bitfieldInsert(0, uint(gl_FragCoord.y), 12, 1)) !=
+ expected[i].y) {
+ c.y = 0.0;
+ c.z = 1.0;
+ }
+
+ color = c;
+}
+
+[test]
+clear
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/spec/arb_gpu_shader5/execution/built-in-functions/fs-ldexp.shader_test b/tests/spec/arb_gpu_shader5/execution/built-in-functions/fs-ldexp.shader_test
index 763e8bbf8..ea855c943 100644
--- a/tests/spec/arb_gpu_shader5/execution/built-in-functions/fs-ldexp.shader_test
+++ b/tests/spec/arb_gpu_shader5/execution/built-in-functions/fs-ldexp.shader_test
@@ -63,11 +63,6 @@ uniform ivec4 given_exponent 125 125 -128 -128
draw rect -1 -1 2 2
probe all rgba 0.0 1.0 0.0 1.0
-# Test underflow generates zero with sign of x.
-uniform vec4 expected_float 0.0 -0.0 0.0 -0.0
-uniform vec4 given_float 0.0 -0.0 0.5 -0.5
-uniform ivec4 given_exponent -127 -127 -127 -127
-draw rect -1 -1 2 2
-probe all rgba 0.0 1.0 0.0 1.0
+# Underflow may flush to zero or not, so can't test that with this shader.
# Overflow is undefined according to the GLSL spec, so nothing to test.
diff --git a/tests/spec/arb_gpu_shader5/execution/built-in-functions/vs-ldexp.shader_test b/tests/spec/arb_gpu_shader5/execution/built-in-functions/vs-ldexp.shader_test
index b819f8a10..9ad954a18 100644
--- a/tests/spec/arb_gpu_shader5/execution/built-in-functions/vs-ldexp.shader_test
+++ b/tests/spec/arb_gpu_shader5/execution/built-in-functions/vs-ldexp.shader_test
@@ -73,11 +73,6 @@ uniform ivec4 given_exponent 125 125 -128 -128
draw rect -1 -1 2 2
probe all rgba 0.0 1.0 0.0 1.0
-# Test underflow generates zero with sign of x.
-uniform vec4 expected_float 0.0 -0.0 0.0 -0.0
-uniform vec4 given_float 0.0 -0.0 0.5 -0.5
-uniform ivec4 given_exponent -127 -127 -127 -127
-draw rect -1 -1 2 2
-probe all rgba 0.0 1.0 0.0 1.0
+# Underflow may flush to zero or not, so can't test that with this shader.
# Overflow is undefined according to the GLSL spec, so nothing to test.
diff --git a/tests/spec/arb_gpu_shader5/execution/instanced-inputs-built-in-variable.shader_test b/tests/spec/arb_gpu_shader5/execution/instanced-inputs-built-in-variable.shader_test
index 8021ba03b..22181d1b3 100644
--- a/tests/spec/arb_gpu_shader5/execution/instanced-inputs-built-in-variable.shader_test
+++ b/tests/spec/arb_gpu_shader5/execution/instanced-inputs-built-in-variable.shader_test
@@ -1,5 +1,5 @@
# This test is essentially the same as the "instanced-inputs.shader_test" test
-# except that it makes use of gl_Position between the vertx and geometry
+# except that it makes use of gl_Position between the vertex and geometry
# shader. Using gl_Position allows us to reproduce Mesa bug #96354.
[require]
diff --git a/tests/spec/arb_gpu_shader5/execution/sampler_array_indexing/fs-struct-nonconst-multiple-samplers.shader_test b/tests/spec/arb_gpu_shader5/execution/sampler_array_indexing/fs-struct-nonconst-multiple-samplers.shader_test
index b717196d2..8e53c62db 100644
--- a/tests/spec/arb_gpu_shader5/execution/sampler_array_indexing/fs-struct-nonconst-multiple-samplers.shader_test
+++ b/tests/spec/arb_gpu_shader5/execution/sampler_array_indexing/fs-struct-nonconst-multiple-samplers.shader_test
@@ -1,5 +1,5 @@
# This test verifies that dynamic uniform indexing of samplers inside
-# a stuct array in the fragment shader behaves correctly.
+# a struct array in the fragment shader behaves correctly.
[require]
GLSL >= 1.50
diff --git a/tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/fs-ldexp-dvec4.shader_test b/tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/fs-ldexp-dvec4.shader_test
index 38214dee6..72040cdd8 100644
--- a/tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/fs-ldexp-dvec4.shader_test
+++ b/tests/spec/arb_gpu_shader_fp64/execution/built-in-functions/fs-ldexp-dvec4.shader_test
@@ -89,12 +89,7 @@ uniform ivec4 given_exponent 1021 1021 -1024 -1024
draw arrays GL_TRIANGLE_FAN 0 4
probe rgba 5 0 0.0 0.0 0.0 0.0
-# Test underflow generates zero with sign of x.
-uniform dvec4 expected_double 0.0 -0.0 0.0 -0.0
-uniform dvec4 given_double 0.0 -0.0 0.5 -0.5
-uniform ivec4 given_exponent -1028 -1028 -1078 -1078
-draw arrays GL_TRIANGLE_FAN 0 4
-probe rgba 6 0 0.0 0.0 0.0 0.0
+# Underflow may flush to zero or not, so can't test that with this shader.
uniform dvec4 expected_double 0.0 -0.0 0.0 -0.0
uniform dvec4 given_double 2.2250738585072014E-308 -2.2250738585072014E-308 1.7976931348623157E+308 -1.7976931348623157E+308
diff --git a/tests/spec/arb_gpu_shader_fp64/execution/uniform-invalid-operation.c b/tests/spec/arb_gpu_shader_fp64/execution/uniform-invalid-operation.c
index aa61afdcc..1bd051200 100644
--- a/tests/spec/arb_gpu_shader_fp64/execution/uniform-invalid-operation.c
+++ b/tests/spec/arb_gpu_shader_fp64/execution/uniform-invalid-operation.c
@@ -25,7 +25,7 @@
* \file uniform-invalid-operation.c
*
* From the GL_ARB_gpu_shader_fp64 spec:
- * "regarding INVALID_OPERATION errors in Uniform* comamnds, if the type of
+ * "regarding INVALID_OPERATION errors in Uniform* commands, if the type of
* the uniform declared in the shader does not match the component type and
* count indicated in the Uniform* command name (where a boolean uniform
* component type is considered to match any of the Uniform*i{v},
diff --git a/tests/spec/arb_gpu_shader_fp64/shader_storage/layout-std140-fp64-mixed-shader.c b/tests/spec/arb_gpu_shader_fp64/shader_storage/layout-std140-fp64-mixed-shader.c
index 043581b01..58f17b61f 100644
--- a/tests/spec/arb_gpu_shader_fp64/shader_storage/layout-std140-fp64-mixed-shader.c
+++ b/tests/spec/arb_gpu_shader_fp64/shader_storage/layout-std140-fp64-mixed-shader.c
@@ -259,6 +259,8 @@ piglit_init(int argc, char **argv)
piglit_draw_rect(-1, -1, 2, 2);
+ glMemoryBarrier(GL_BUFFER_UPDATE_BARRIER_BIT);
+
glBindBuffer(GL_SHADER_STORAGE_BUFFER, buffer);
map_f = glMapBuffer(GL_SHADER_STORAGE_BUFFER, GL_READ_ONLY);
diff --git a/tests/spec/arb_gpu_shader_fp64/shader_storage/layout-std140-fp64-shader.c b/tests/spec/arb_gpu_shader_fp64/shader_storage/layout-std140-fp64-shader.c
index 0fe636e42..122187638 100644
--- a/tests/spec/arb_gpu_shader_fp64/shader_storage/layout-std140-fp64-shader.c
+++ b/tests/spec/arb_gpu_shader_fp64/shader_storage/layout-std140-fp64-shader.c
@@ -217,6 +217,8 @@ piglit_init(int argc, char **argv)
piglit_draw_rect(-1, -1, 2, 2);
+ glMemoryBarrier(GL_BUFFER_UPDATE_BARRIER_BIT);
+
glBindBuffer(GL_SHADER_STORAGE_BUFFER, buffer);
map = (double *) glMapBuffer(GL_SHADER_STORAGE_BUFFER, GL_READ_ONLY);
diff --git a/tests/spec/arb_gpu_shader_fp64/shader_storage/layout-std430-fp64-mixed-shader.c b/tests/spec/arb_gpu_shader_fp64/shader_storage/layout-std430-fp64-mixed-shader.c
index b994b39ed..d6ed63762 100644
--- a/tests/spec/arb_gpu_shader_fp64/shader_storage/layout-std430-fp64-mixed-shader.c
+++ b/tests/spec/arb_gpu_shader_fp64/shader_storage/layout-std430-fp64-mixed-shader.c
@@ -291,6 +291,8 @@ piglit_init(int argc, char **argv)
piglit_draw_rect(-1, -1, 2, 2);
+ glMemoryBarrier(GL_BUFFER_UPDATE_BARRIER_BIT);
+
glBindBuffer(GL_SHADER_STORAGE_BUFFER, buffer);
map_f = glMapBuffer(GL_SHADER_STORAGE_BUFFER, GL_READ_ONLY);
diff --git a/tests/spec/arb_gpu_shader_fp64/shader_storage/layout-std430-fp64-shader.c b/tests/spec/arb_gpu_shader_fp64/shader_storage/layout-std430-fp64-shader.c
index 314c510e3..156645040 100644
--- a/tests/spec/arb_gpu_shader_fp64/shader_storage/layout-std430-fp64-shader.c
+++ b/tests/spec/arb_gpu_shader_fp64/shader_storage/layout-std430-fp64-shader.c
@@ -251,6 +251,8 @@ piglit_init(int argc, char **argv)
piglit_draw_rect(-1, -1, 2, 2);
+ glMemoryBarrier(GL_BUFFER_UPDATE_BARRIER_BIT);
+
glBindBuffer(GL_SHADER_STORAGE_BUFFER, buffer);
map = (double *) glMapBuffer(GL_SHADER_STORAGE_BUFFER, GL_READ_ONLY);
diff --git a/tests/spec/arb_gpu_shader_int64/execution/fs-ishl-then-ishr.shader_test b/tests/spec/arb_gpu_shader_int64/execution/fs-ishl-then-ishr.shader_test
index f6a6ba542..49be888a4 100644
--- a/tests/spec/arb_gpu_shader_int64/execution/fs-ishl-then-ishr.shader_test
+++ b/tests/spec/arb_gpu_shader_int64/execution/fs-ishl-then-ishr.shader_test
@@ -38,7 +38,7 @@ void main()
/* This is INTENTIONALLY not a loop. Putting it in a loop causes the
* optimization that generates the extract instructions to trigger
* before the shift count is known to be a constant. The effectively
- * prevents the bad code generation in the i965 driver from occuring.
+ * prevents the bad code generation in the i965 driver from occurring.
*/
i = 0;
result = (ival[i] << (56u - (i * 8u))) >> 56u;
diff --git a/tests/spec/arb_gpu_shader_int64/execution/fs-ishl-then-ushr.shader_test b/tests/spec/arb_gpu_shader_int64/execution/fs-ishl-then-ushr.shader_test
index 30844ea0b..bbad7ddd9 100644
--- a/tests/spec/arb_gpu_shader_int64/execution/fs-ishl-then-ushr.shader_test
+++ b/tests/spec/arb_gpu_shader_int64/execution/fs-ishl-then-ushr.shader_test
@@ -38,7 +38,7 @@ void main()
/* This is INTENTIONALLY not a loop. Putting it in a loop causes the
* optimization that generates the extract instructions to trigger
* before the shift count is known to be a constant. The effectively
- * prevents the bad code generation in the i965 driver from occuring.
+ * prevents the bad code generation in the i965 driver from occurring.
*/
i = 0;
result = (ival[i] << (56u - (i * 8u))) >> 56u;
diff --git a/tests/spec/arb_gpu_shader_int64/execution/fs-ishr-and-mask.shader_test b/tests/spec/arb_gpu_shader_int64/execution/fs-ishr-and-mask.shader_test
index fa1509dfa..897d97f0e 100644
--- a/tests/spec/arb_gpu_shader_int64/execution/fs-ishr-and-mask.shader_test
+++ b/tests/spec/arb_gpu_shader_int64/execution/fs-ishr-and-mask.shader_test
@@ -38,7 +38,7 @@ void main()
/* This is INTENTIONALLY not a loop. Putting it in a loop causes the
* optimization that generates the extract instructions to trigger
* before the shift count is known to be a constant. The effectively
- * prevents the bad code generation in the i965 driver from occuring.
+ * prevents the bad code generation in the i965 driver from occurring.
*/
i = 0;
result = (ival[i] >> (i * 8u)) & 0x0FFl;
diff --git a/tests/spec/arb_gpu_shader_int64/execution/fs-ushr-and-mask.shader_test b/tests/spec/arb_gpu_shader_int64/execution/fs-ushr-and-mask.shader_test
index 96519624b..36b577c2b 100644
--- a/tests/spec/arb_gpu_shader_int64/execution/fs-ushr-and-mask.shader_test
+++ b/tests/spec/arb_gpu_shader_int64/execution/fs-ushr-and-mask.shader_test
@@ -38,7 +38,7 @@ void main()
/* This is INTENTIONALLY not a loop. Putting it in a loop causes the
* optimization that generates the extract instructions to trigger
* before the shift count is known to be a constant. The effectively
- * prevents the bad code generation in the i965 driver from occuring.
+ * prevents the bad code generation in the i965 driver from occurring.
*/
i = 0;
result = (ival[i] >> (i * 8u)) & 0x0FFul;
diff --git a/tests/spec/arb_instanced_arrays/vertex-attrib-divisor-index-error.c b/tests/spec/arb_instanced_arrays/vertex-attrib-divisor-index-error.c
index 4e4bc542c..4e95774e9 100644
--- a/tests/spec/arb_instanced_arrays/vertex-attrib-divisor-index-error.c
+++ b/tests/spec/arb_instanced_arrays/vertex-attrib-divisor-index-error.c
@@ -45,11 +45,13 @@ void
piglit_init(int argc, char **argv)
{
bool pass = true;
+ GLint maxAttribCount = 0;
if(piglit_get_gl_version() < 33)
piglit_require_extension("GL_ARB_instanced_arrays");
- glVertexAttribDivisor(GL_MAX_VERTEX_ATTRIBS, 0);
+ glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, &maxAttribCount);
+ glVertexAttribDivisor(maxAttribCount, 0);
pass = piglit_check_gl_error(GL_INVALID_VALUE) && pass;
piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);
diff --git a/tests/spec/arb_internalformat_query2/common.c b/tests/spec/arb_internalformat_query2/common.c
index 67f04b133..ba27fac48 100644
--- a/tests/spec/arb_internalformat_query2/common.c
+++ b/tests/spec/arb_internalformat_query2/common.c
@@ -151,7 +151,7 @@ test_data_value_at_index(test_data *data,
{
if (index > data->params_size || index < 0) {
fprintf(stderr, "ERROR: invalid index while retrieving"
- " data from auxiliar test data\n");
+ " data from auxiliary test data\n");
return -1;
}
@@ -329,7 +329,7 @@ void print_failing_case_full(const GLenum target, const GLenum internalformat,
* the cases where the set of returned values is not specified in
* detail by the spec (like INTERNALFORMAT_PREFERRED). On that case,
* it is not tested the returned value, and just tested that if not
- * suppported, the returned value is the usupported value defined by
+ * supported, the returned value is the unsupported value defined by
* the spec.
*
*/
@@ -875,7 +875,7 @@ check_query2_target_dependencies(const GLenum target)
return true;
}
-/* Returns is @pname and @target dependencies are fullfilled */
+/* Returns is @pname and @target dependencies are fulfilled */
bool
check_query2_dependencies(const GLenum pname,
const GLenum target)
@@ -1010,7 +1010,7 @@ test_data_set_value_at_index(test_data *data,
{
if (index > data->params_size || index < 0) {
fprintf(stderr, "ERROR: invalid index while setting"
- " auxiliar test data\n");
+ " auxiliary test data\n");
return;
}
@@ -1027,18 +1027,18 @@ test_data_equal_at_index(test_data *data,
unsigned index)
{
if (data->testing64 != data_copy->testing64) {
- fprintf(stderr, "ERROR: trying to compare imcompatible"
- " auxiliar test data structures\n");
+ fprintf(stderr, "ERROR: trying to compare incompatible"
+ " auxiliary test data structures\n");
return false;
}
if (data->params_size != data_copy->params_size) {
- fprintf(stderr, "ERROR: trying to compare imcompatible"
- " auxiliar test data structures\n");
+ fprintf(stderr, "ERROR: trying to compare incompatible"
+ " auxiliary test data structures\n");
return false;
}
if (index > data->params_size) {
fprintf(stderr, "ERROR: invalid index while setting"
- " auxiliar test data\n");
+ " auxiliary test data\n");
return false;
}
diff --git a/tests/spec/arb_internalformat_query2/generic-pname-checks.c b/tests/spec/arb_internalformat_query2/generic-pname-checks.c
index bd44da038..bbb922920 100644
--- a/tests/spec/arb_internalformat_query2/generic-pname-checks.c
+++ b/tests/spec/arb_internalformat_query2/generic-pname-checks.c
@@ -244,7 +244,7 @@ piglit_display(void)
/*
* Executes try_basic on a list of pnames/possible values.
*
- * check_basic and try_basic are splitted because for some pnames, we
+ * check_basic and try_basic are split because for some pnames, we
* would need to check more than just try_basic.
*/
static bool
diff --git a/tests/spec/arb_internalformat_query2/max-dimensions.c b/tests/spec/arb_internalformat_query2/max-dimensions.c
index 50190d56d..2f82c1ec4 100644
--- a/tests/spec/arb_internalformat_query2/max-dimensions.c
+++ b/tests/spec/arb_internalformat_query2/max-dimensions.c
@@ -316,7 +316,7 @@ try(const GLenum *targets, unsigned num_targets,
value_test = test_data_is_unsupported_response(data, pname);
} else {
/*
- * If suppported and enough dimensions, we compare against the values
+ * If supported and enough dimensions, we compare against the values
* returned by GetInteger
*/
value_test = check_params_against_get_integer(data,
@@ -478,7 +478,7 @@ try_max_layers(const GLenum *targets, unsigned num_targets,
value_test =
check_params_against_dimension(data,
targets[i],
- internalformats[i]);
+ internalformats[j]);
/* We check that is the returned value by GetInteger */
value_test = value_test &&
check_params_against_get_integer(data,
@@ -607,7 +607,7 @@ check_against_combined_dimensions(test_data *data,
*
* This method compares against zero if unsupported. If supported it
* computes the value using MAX_WIDTH, MAX_HEIGHT, MAX_DEPTH,
- * MAX_LAYERS and SAMPLES, and compare it agains the returned value.
+ * MAX_LAYERS and SAMPLES, and compare it against the returned value.
*/
static bool
try_max_combined_dimensions(const GLenum *targets, unsigned num_targets,
diff --git a/tests/spec/arb_map_buffer_range/map_buffer_range_error_check.c b/tests/spec/arb_map_buffer_range/map_buffer_range_error_check.c
index bcb759d26..7cf18d89a 100644
--- a/tests/spec/arb_map_buffer_range/map_buffer_range_error_check.c
+++ b/tests/spec/arb_map_buffer_range/map_buffer_range_error_check.c
@@ -80,7 +80,7 @@ piglit_init(int argc, char *argv[])
if (!piglit_check_gl_error(GL_INVALID_VALUE))
piglit_report_result(PIGLIT_FAIL);
- /* offset + lenght > GL_BUFFER_SIZE */
+ /* offset + length > GL_BUFFER_SIZE */
glMapBufferRange(target, 1, GL_BUFFER_SIZE, access);
if (!piglit_check_gl_error(GL_INVALID_VALUE))
piglit_report_result(PIGLIT_FAIL);
diff --git a/tests/spec/arb_map_buffer_range/map_buffer_range_test.c b/tests/spec/arb_map_buffer_range/map_buffer_range_test.c
index 493924cbe..f0a793e7a 100644
--- a/tests/spec/arb_map_buffer_range/map_buffer_range_test.c
+++ b/tests/spec/arb_map_buffer_range/map_buffer_range_test.c
@@ -60,14 +60,14 @@ clear_buffer(GLenum target)
{
if (piglit_is_extension_supported("GL_ARB_clear_buffer_object")) {
/* Clear the buffer just to make the device busy, so that
- * the driver can't optimize MapBufferRange to unsychronized
+ * the driver can't optimize MapBufferRange to unsynchronized
* without explicit_flush.
*/
glClearBufferData(target, GL_R32I, GL_RED_INTEGER, GL_INT, NULL);
}
}
-/* This test relies on simple patterns, so using offets which are multiples of
+/* This test relies on simple patterns, so using offsets which are multiples of
* 0x100 is bad
*/
void
diff --git a/tests/spec/arb_multisample/pushpop.c b/tests/spec/arb_multisample/pushpop.c
index e6d8cf34d..1e6365341 100644
--- a/tests/spec/arb_multisample/pushpop.c
+++ b/tests/spec/arb_multisample/pushpop.c
@@ -141,7 +141,7 @@ test_coverage(bool mode)
static bool
test_state(bool enable_on, bool coverage_mode)
{
- return test_enable_bits(enable_on) & test_coverage(coverage_mode);
+ return test_enable_bits(enable_on) && test_coverage(coverage_mode);
}
static void
diff --git a/tests/spec/arb_occlusion_query/occlusion_query.c b/tests/spec/arb_occlusion_query/occlusion_query.c
index d28699813..66da0cdec 100644
--- a/tests/spec/arb_occlusion_query/occlusion_query.c
+++ b/tests/spec/arb_occlusion_query/occlusion_query.c
@@ -107,6 +107,14 @@ static int do_test(float x, int all_at_once)
glColor3ub(0xff, 0x00, 0x00);
draw_box(x + 20.0f, 20.0f, 0.0f, 55.0f, 55.0f);
+ /* It is legal for a driver to support the query API but not have
+ * any query bits. However, drivers must still allow calling the API
+ * entrypoints, so let's test that but ignore the result.
+ */
+ GLint query_bits;
+ glGetQueryiv(GL_SAMPLES_PASSED, GL_QUERY_COUNTER_BITS,
+ & query_bits);
+
for (i = 0; i < MAX_QUERIES; i++) {
glBeginQuery(GL_SAMPLES_PASSED, occ_queries[i]);
glColor3ubv(tests[i].color);
@@ -117,7 +125,8 @@ static int do_test(float x, int all_at_once)
if (! all_at_once) {
glGetQueryObjectiv(occ_queries[i],
GL_QUERY_RESULT, &passed);
- test_pass &= check_result(passed, tests[i].expected);
+ if (query_bits > 0)
+ test_pass &= check_result(passed, tests[i].expected);
}
}
@@ -126,7 +135,8 @@ static int do_test(float x, int all_at_once)
for (i = 0; i < MAX_QUERIES; i++) {
glGetQueryObjectiv(occ_queries[i], GL_QUERY_RESULT,
&passed);
- test_pass &= check_result(passed, tests[i].expected);
+ if (query_bits > 0)
+ test_pass &= check_result(passed, tests[i].expected);
}
}
@@ -153,8 +163,6 @@ piglit_display(void)
void
piglit_init(int argc, char **argv)
{
- GLint query_bits;
-
glClearColor(0.0, 0.2, 0.3, 0.0);
glClearDepth(1.0);
@@ -163,16 +171,5 @@ piglit_init(int argc, char **argv)
piglit_require_extension("GL_ARB_occlusion_query");
- /* It is legal for a driver to support the query API but not have
- * any query bits. I wonder how many applications actually check for
- * this case...
- */
- glGetQueryiv(GL_SAMPLES_PASSED, GL_QUERY_COUNTER_BITS,
- & query_bits);
- if (query_bits == 0) {
- piglit_report_result(PIGLIT_SKIP);
- }
-
-
glGenQueries(MAX_QUERIES, occ_queries);
}
diff --git a/tests/spec/arb_occlusion_query/occlusion_query_conform.c b/tests/spec/arb_occlusion_query/occlusion_query_conform.c
index df82a35fc..1d22b413c 100644
--- a/tests/spec/arb_occlusion_query/occlusion_query_conform.c
+++ b/tests/spec/arb_occlusion_query/occlusion_query_conform.c
@@ -104,7 +104,7 @@ conformOQ_GetObjivAval_multi1(void *data)
piglit_draw_rect(-0.51, 0.51, 0.51, -0.51);
glEndQueryARB(GL_SAMPLES_PASSED_ARB);
- /* draw the 2nd box (blue) which is occluded by the occluder throughly */
+ /* draw the 2nd box (blue) which is occluded by the occluder thoroughly */
glBeginQueryARB(GL_SAMPLES_PASSED_ARB, id);
glColor3f(0, 0, 1);
piglit_draw_rect(-0.4, 0.4, 0.4, -0.4);
@@ -126,7 +126,7 @@ conformOQ_GetObjivAval_multi1(void *data)
return passed > 0 ? PIGLIT_FAIL : PIGLIT_PASS;
}
-/* If mutiple queries are issued on the same target and diff ids prior
+/* If multiple queries are issued on the same target and diff ids prior
* to calling GetQueryObject[u]iVARB, the results should be
* corresponding to those queries (ids) respectively.
*/
diff --git a/tests/spec/arb_point_parameters/point-attenuation.c b/tests/spec/arb_point_parameters/point-attenuation.c
index ed77064bd..178a240b5 100644
--- a/tests/spec/arb_point_parameters/point-attenuation.c
+++ b/tests/spec/arb_point_parameters/point-attenuation.c
@@ -87,25 +87,20 @@ expectedSize(GLfloat initSize,
/* measure size of rendered point at yPos (in model coords) */
static GLfloat
-measureSize(GLfloat yPos)
+measureSize(float *pixels, GLfloat yPos)
{
assert(yPos >= -10.0);
assert(yPos <= 10.0);
float yNdc = (yPos + 10.0) / 20.0; /* See glOrtho above */
- int x = 0;
int y = (int) (yNdc * windowHeight);
int w = windowWidth;
- int h = 3;
- GLfloat image[3 * windowWidth * 3]; /* three rows of RGB values */
- /* Read three row of pixels and add up colors in each row.
- * Use the row with the greatest sum. This helps gives us a bit
- * of leeway in vertical point positioning.
+ /* Add up colors in 3 rows, and use the row with the greatest sum.
+ * This helps gives us a bit of leeway in vertical point positioning.
* Colors should be white or shades of gray if smoothing is enabled.
- */
- glReadPixels(x, y - 1, w, h, GL_RGB, GL_FLOAT, image);
-
- float sum[3] = { 0.0, 0.0, 0.0 };
+ */
+ float *image = pixels + (y - 1) * windowWidth * 3;
+ float sum[3] = {0.0, 0.0, 0.0};
for (int j = 0; j < 3; j++) {
for (int i = 0; i < w; i++) {
int k = j * 3 * w + i * 3;
@@ -142,6 +137,8 @@ testPointRendering(bool smooth)
glDisable(GL_BLEND);
}
+ float *pixels = malloc(piglit_width * piglit_height * 3 * sizeof(float));
+
for (int a = 0; a < 3; a++) {
atten[0] = pow(10.0, -a);
for (int b = -2; b < 3; b++) {
@@ -164,12 +161,14 @@ testPointRendering(bool smooth)
}
glEnd();
+ glReadPixels(0, 0, piglit_width, piglit_height, GL_RGB, GL_FLOAT, pixels);
+
/* test the column of points */
for (float z = -6.0; z <= 6.0; z += 1.0) {
float expected
= expectedSize(size, atten, min, max,
z, smooth);
- float actual = measureSize(z);
+ float actual = measureSize(pixels, z);
if (fabs(expected - actual) > epsilon) {
reportFailure(size, atten, min, max,
z, expected, actual);
@@ -187,6 +186,8 @@ testPointRendering(bool smooth)
}
}
+ free(pixels);
+
if (!piglit_check_gl_error(0))
return false;
diff --git a/tests/spec/arb_post_depth_coverage/basic.c b/tests/spec/arb_post_depth_coverage/basic.c
index 07f6ab1af..9f41859b8 100644
--- a/tests/spec/arb_post_depth_coverage/basic.c
+++ b/tests/spec/arb_post_depth_coverage/basic.c
@@ -209,6 +209,8 @@ piglit_display(void)
glUniform1i(2, piglit_width);
glDrawArrays(GL_TRIANGLES, 6, 6);
+ glMemoryBarrier(GL_BUFFER_UPDATE_BARRIER_BIT);
+
glGetBufferSubData(GL_SHADER_STORAGE_BUFFER, 0, sizeof(GLint) *
piglit_width * piglit_height, &sample_mask[0]);
diff --git a/tests/spec/arb_program_interface_query/getprogramresourceindex.c b/tests/spec/arb_program_interface_query/getprogramresourceindex.c
index 16b38e2d5..f3491f491 100755
--- a/tests/spec/arb_program_interface_query/getprogramresourceindex.c
+++ b/tests/spec/arb_program_interface_query/getprogramresourceindex.c
@@ -146,7 +146,7 @@ struct subtest_index_t {
GLenum programInterface;
const char *name;
bool valid_index;
- GLint expect_value; /* -1, means don't check for an epected value */
+ GLint expect_value; /* -1, means don't check for an expected value */
GLenum expected_error;
};
diff --git a/tests/spec/arb_program_interface_query/getprogramresourceiv.c b/tests/spec/arb_program_interface_query/getprogramresourceiv.c
index e55cf96ac..571ae7f2e 100755
--- a/tests/spec/arb_program_interface_query/getprogramresourceiv.c
+++ b/tests/spec/arb_program_interface_query/getprogramresourceiv.c
@@ -820,7 +820,7 @@ check_prop(GLuint prog, GLenum programInterface, int index, const char *name,
break;
}
- /* harcode the index test for GL_ATOMIC_COUNTER_BUFFER */
+ /* hardcode the index test for GL_ATOMIC_COUNTER_BUFFER */
if (programInterface == GL_ATOMIC_COUNTER_BUFFER) {
if (values[0] != 0) {
diff --git a/tests/spec/arb_program_interface_query/resource-query.c b/tests/spec/arb_program_interface_query/resource-query.c
index b94a50bc8..1ea96d970 100755
--- a/tests/spec/arb_program_interface_query/resource-query.c
+++ b/tests/spec/arb_program_interface_query/resource-query.c
@@ -303,8 +303,8 @@ static const char *st_r_tes_sub_uni[] = {"TESS_EVALUATION", NULL};
* include all active variables for the interface, including any active
* built-in variables.
*
- * For PROGRAM_INPUT and PROGRAM_OUTPUT interfaces for shaders that recieve
- * or produce patch primitves, the active resource list will include both
+ * For PROGRAM_INPUT and PROGRAM_OUTPUT interfaces for shaders that receive
+ * or produce patch primitives, the active resource list will include both
* per-vertex and per-patch inputs and outputs.
*
* For the TRANSFORM_FEEDBACK_VARYING interface, the active resource list
diff --git a/tests/spec/arb_provoking_vertex/provoking-vertex-initial.c b/tests/spec/arb_provoking_vertex/provoking-vertex-initial.c
index d4031a8c9..72eab9719 100644
--- a/tests/spec/arb_provoking_vertex/provoking-vertex-initial.c
+++ b/tests/spec/arb_provoking_vertex/provoking-vertex-initial.c
@@ -22,7 +22,7 @@
*/
/**
- * Test that the intitial value of PROVOKING_VERTEX is LAST_VERTEX_CONVENTION
+ * Test that the initial value of PROVOKING_VERTEX is LAST_VERTEX_CONVENTION
*
* Section 2.18(Flatshading) of OpenGL 3.2 Core says:
* "The initial value of the provoking vertex mode is LAST_VERTEX_CONVENTION."
diff --git a/tests/spec/arb_query_buffer_object/qbo.c b/tests/spec/arb_query_buffer_object/qbo.c
index 3ba11ee26..05be962a8 100644
--- a/tests/spec/arb_query_buffer_object/qbo.c
+++ b/tests/spec/arb_query_buffer_object/qbo.c
@@ -27,10 +27,11 @@
* \file qbo.c
* Tests ARB_query_buffer_object
* - synchronous wait for result
- * - asynchrounous result, default value is left intact if result unavailable
- * - asynchrounous result, retrieve result to client memory before & after
+ * - asynchronous result, default value is left intact if result unavailable
+ * - asynchronous result, retrieve result to client memory before & after
*/
+#include <inttypes.h>
#include "common.h"
PIGLIT_GL_TEST_CONFIG_BEGIN
@@ -96,6 +97,23 @@ cpu_gather_query(bool exact, uint32_t expected, uint64_t *cpu_result)
? PIGLIT_PASS : PIGLIT_FAIL;
}
+static bool
+is_gs_valid(const struct query_type_desc *desc, uint32_t expected, uint64_t cpu_result)
+{
+ switch (desc->type) {
+ case GL_GEOMETRY_SHADER_INVOCATIONS:
+ case GL_GEOMETRY_SHADER_PRIMITIVES_EMITTED_ARB:
+ if (!expected && cpu_result) {
+ fprintf(stderr, "WARNING: GEOMETRY_SHADER statistics query returned nonzero when no GS bound\n");
+ return true;
+ }
+ return false;
+ default:
+ break;
+ }
+ return true;
+}
+
enum piglit_result
run_subtest(void)
{
@@ -119,7 +137,7 @@ run_subtest(void)
if (sync_mode == QBO_ASYNC_CPU_READ_BEFORE) {
if (cpu_gather_query(exact, expected, &cpu_result))
- return PIGLIT_FAIL;
+ return is_gs_valid(query_desc, expected, cpu_result) ? PIGLIT_WARN : PIGLIT_FAIL;
have_cpu_result = true;
}
@@ -155,7 +173,7 @@ run_subtest(void)
if (sync_mode == QBO_SYNC_CPU_READ_AFTER_CACHE_TEST ||
sync_mode == QBO_ASYNC_CPU_READ_AFTER) {
if (cpu_gather_query(exact, expected, &cpu_result))
- return PIGLIT_FAIL;
+ return is_gs_valid(query_desc, expected, cpu_result) ? PIGLIT_WARN : PIGLIT_FAIL;
have_cpu_result = true;
}
@@ -182,11 +200,11 @@ run_subtest(void)
printf("Expected: %u\n", expected);
if (have_cpu_result)
- printf("CPU result: %lu\n", cpu_result);
+ printf("CPU result: %"PRIu64"\n", cpu_result);
printf("QBO: %u %u %u %u\n", ptr[0], ptr[1], ptr[2], ptr[3]);
glUnmapBuffer(GL_QUERY_BUFFER);
- return PIGLIT_FAIL;
+ return is_gs_valid(query_desc, expected, cpu_result) ? PIGLIT_WARN : PIGLIT_FAIL;
}
return PIGLIT_PASS;
diff --git a/tests/spec/arb_sample_shading/execution/ignore-centroid-qualifier.cpp b/tests/spec/arb_sample_shading/execution/ignore-centroid-qualifier.cpp
index 105f8377e..cea1f88e8 100644
--- a/tests/spec/arb_sample_shading/execution/ignore-centroid-qualifier.cpp
+++ b/tests/spec/arb_sample_shading/execution/ignore-centroid-qualifier.cpp
@@ -132,7 +132,7 @@ piglit_init(int argc, char**argv)
msConfig.num_tex_attachments = 1;
multisampled_fbo.setup(msConfig);
- /* Reduced tolerence for stricter color matching */
+ /* Reduced tolerance for stricter color matching */
piglit_set_tolerance_for_bits(16, 16, 16, 16);
draw_prog_left = piglit_build_simple_program(
"#version 130\n"
diff --git a/tests/spec/arb_sample_shading/execution/interpolate-at-sample-position.cpp b/tests/spec/arb_sample_shading/execution/interpolate-at-sample-position.cpp
index 36ede0d7e..9216964da 100644
--- a/tests/spec/arb_sample_shading/execution/interpolate-at-sample-position.cpp
+++ b/tests/spec/arb_sample_shading/execution/interpolate-at-sample-position.cpp
@@ -144,7 +144,7 @@ piglit_init(int argc, char**argv)
msConfig.tex_attachment[1] = GL_COLOR_ATTACHMENT1;
multisampled_fbo.setup(msConfig);
- /* Reduced tolerence for stricter color matching */
+ /* Reduced tolerance for stricter color matching */
piglit_set_tolerance_for_bits(16, 16, 16, 16);
draw_prog_left = piglit_build_simple_program(
"#version 130\n"
diff --git a/tests/spec/arb_sample_shading/execution/samplemask.cpp b/tests/spec/arb_sample_shading/execution/samplemask.cpp
index 4be7e3a52..5f16d7f1a 100644
--- a/tests/spec/arb_sample_shading/execution/samplemask.cpp
+++ b/tests/spec/arb_sample_shading/execution/samplemask.cpp
@@ -309,6 +309,9 @@ test_fix(enum rate_mode mode, float sample_rate)
static enum piglit_result
test_mask_in_one(enum rate_mode mode, float sample_rate)
{
+ if (!mask_in_one_supported)
+ return PIGLIT_SKIP;
+
glClearColor(0.0, 0.0, 0.0, 0.0);
/* 1. Draw everything outputting gl_SampleMaskIn, with msaa disabled; */
diff --git a/tests/spec/arb_separate_shader_objects/CMakeLists.gl.txt b/tests/spec/arb_separate_shader_objects/CMakeLists.gl.txt
index ce257ca2e..37d19e3c3 100644
--- a/tests/spec/arb_separate_shader_objects/CMakeLists.gl.txt
+++ b/tests/spec/arb_separate_shader_objects/CMakeLists.gl.txt
@@ -31,3 +31,4 @@ piglit_add_executable (arb_separate_shader_object-UseProgramStages-non-separable
piglit_add_executable (arb_separate_shader_object-ValidateProgramPipeline ValidateProgramPipeline.c)
piglit_add_executable (arb_separate_shader_object-atomic-counter atomic-counter.c)
piglit_add_executable (arb_separate_shader_object-xfb-rendezvous_by_location xfb-rendezvous_by_location.c sso-common.c)
+piglit_add_executable (arb_separate_shader_object-xfb-explicit-location-array xfb-explicit-location-array.c)
diff --git a/tests/spec/arb_separate_shader_objects/ProgramUniform-coverage.c b/tests/spec/arb_separate_shader_objects/ProgramUniform-coverage.c
index 5763d155d..95ef98a64 100644
--- a/tests/spec/arb_separate_shader_objects/ProgramUniform-coverage.c
+++ b/tests/spec/arb_separate_shader_objects/ProgramUniform-coverage.c
@@ -219,7 +219,7 @@ random_uints(unsigned int *v, unsigned count)
* \name Data checking functions.
*
* Each of these functions verifies that one set of data matches another set
- * of data. If a discrepency is found, the failing location is logged.
+ * of data. If a discrepancy is found, the failing location is logged.
*/
/*@{*/
static bool
diff --git a/tests/spec/arb_separate_shader_objects/api-errors.c b/tests/spec/arb_separate_shader_objects/api-errors.c
index 1d6069e11..fd36ce951 100644
--- a/tests/spec/arb_separate_shader_objects/api-errors.c
+++ b/tests/spec/arb_separate_shader_objects/api-errors.c
@@ -24,7 +24,7 @@
/**
* \file api-errors.c
- * Verify miscelaneous API error conditions from the specification.
+ * Verify miscellaneous API error conditions from the specification.
*/
#include "piglit-util-gl.h"
#include "sso-common.h"
diff --git a/tests/spec/arb_separate_shader_objects/atomic-counter.c b/tests/spec/arb_separate_shader_objects/atomic-counter.c
index a773b64c9..a1df46fa9 100644
--- a/tests/spec/arb_separate_shader_objects/atomic-counter.c
+++ b/tests/spec/arb_separate_shader_objects/atomic-counter.c
@@ -104,6 +104,7 @@ piglit_init(int argc, char **argv)
bool pass = true;
uint32_t counter = 0;
+ piglit_require_GLSL_version(150);
piglit_require_extension("GL_ARB_shader_atomic_counters");
piglit_require_extension("GL_ARB_separate_shader_objects");
diff --git a/tests/spec/arb_separate_shader_objects/rendezvous_by_location-5-stages.c b/tests/spec/arb_separate_shader_objects/rendezvous_by_location-5-stages.c
index 9d72cb4e6..4e81cac26 100644
--- a/tests/spec/arb_separate_shader_objects/rendezvous_by_location-5-stages.c
+++ b/tests/spec/arb_separate_shader_objects/rendezvous_by_location-5-stages.c
@@ -179,6 +179,7 @@ piglit_display(void)
void piglit_init(int argc, char **argv)
{
GLuint vs_prog, tcs_prog, tes_prog, gs_prog, fs_prog;
+ bool pass = true;
piglit_require_gl_version(32);
piglit_require_extension("GL_ARB_separate_shader_objects");
@@ -187,23 +188,23 @@ void piglit_init(int argc, char **argv)
vs_prog = glCreateShaderProgramv(GL_VERTEX_SHADER, 1,
(const GLchar *const*)&vs_code);
- piglit_link_check_status(vs_prog);
+ pass = piglit_link_check_status(vs_prog) && pass;
tcs_prog = glCreateShaderProgramv(GL_TESS_CONTROL_SHADER, 1,
(const GLchar *const *)&tcs_code);
- piglit_link_check_status(tcs_prog);
+ pass = piglit_link_check_status(tcs_prog) && pass;
tes_prog = glCreateShaderProgramv(GL_TESS_EVALUATION_SHADER, 1,
(const GLchar *const *)&tes_code);
- piglit_link_check_status(tes_prog);
+ pass = piglit_link_check_status(tes_prog) && pass;
gs_prog = glCreateShaderProgramv(GL_GEOMETRY_SHADER, 1,
(const GLchar *const *)&gs_code);
- piglit_link_check_status(gs_prog);
+ pass = piglit_link_check_status(gs_prog) && pass;
fs_prog = glCreateShaderProgramv(GL_FRAGMENT_SHADER, 1,
(const GLchar *const *)&fs_code);
- piglit_link_check_status(fs_prog);
+ pass = piglit_link_check_status(fs_prog) && pass;
glGenProgramPipelines(1, &pipeline);
glUseProgramStages(pipeline, GL_VERTEX_SHADER_BIT, vs_prog);
@@ -211,8 +212,10 @@ void piglit_init(int argc, char **argv)
glUseProgramStages(pipeline, GL_TESS_EVALUATION_SHADER_BIT, tes_prog);
glUseProgramStages(pipeline, GL_GEOMETRY_SHADER_BIT, gs_prog);
glUseProgramStages(pipeline, GL_FRAGMENT_SHADER_BIT, fs_prog);
- piglit_program_pipeline_check_status(pipeline);
+ pass = piglit_program_pipeline_check_status(pipeline) && pass;
- if (!piglit_check_gl_error(0))
+ pass = piglit_check_gl_error(0) && pass;
+
+ if (!pass)
piglit_report_result(PIGLIT_FAIL);
}
diff --git a/tests/spec/arb_separate_shader_objects/rendezvous_by_location.c b/tests/spec/arb_separate_shader_objects/rendezvous_by_location.c
index c9c673a54..4e2ffeccd 100644
--- a/tests/spec/arb_separate_shader_objects/rendezvous_by_location.c
+++ b/tests/spec/arb_separate_shader_objects/rendezvous_by_location.c
@@ -26,13 +26,13 @@
* Simple test for separate shader objects that use rendezvous-by-location.
*
* There are two ways one might expect rendezvous-by-location to fail. One
- * predicatble failure mode is for variables between two program objects to be
- * linked in the order they appear in the shader text. Another predicatble
+ * predictable failure mode is for variables between two program objects to be
+ * linked in the order they appear in the shader text. Another predictable
* failure mode is for variables between two program objects to be linked by
* name.
*
- * This test tries both modes using a single fragement shader program. This
- * program outputs two varibles, a and b, with locations specified. Two
+ * This test tries both modes using a single fragment shader program. This
+ * program outputs two variables, a and b, with locations specified. Two
* fragment shader programs are created, each having input variables a and b,
* with locations specified. In the first case, a and b are listed in the
* same order as in the vertex shader, but the locations are reversed (vertex
diff --git a/tests/spec/arb_separate_shader_objects/xfb-explicit-location-array.c b/tests/spec/arb_separate_shader_objects/xfb-explicit-location-array.c
new file mode 100644
index 000000000..e76207653
--- /dev/null
+++ b/tests/spec/arb_separate_shader_objects/xfb-explicit-location-array.c
@@ -0,0 +1,298 @@
+/*
+ * Copyright © 2016 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+/* Tests xfb with explicit locations. Specifically this was written to test
+ * a mesa bug with the handling of xfb output arrays that have an explicit
+ * location.
+ */
+
+#include "piglit-util-gl.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+ config.supports_gl_compat_version = 32;
+ config.supports_gl_core_version = 32;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+static const char vs_pass_thru_text[] =
+ "#version 150\n"
+ "void main() {\n"
+ " gl_Position = vec4(0.0);\n"
+ "}\n";
+
+static const char vs_shader_text[] =
+ "#version 150\n"
+ "#extension GL_ARB_separate_shader_objects: require\n"
+ "\n"
+ "out float x1_out;\n"
+ "layout(location = 4) out float x2_out[2];\n"
+ "layout(location = 6) out vec3 x3_out;\n"
+ "layout(location = 2) out float y1_out;\n"
+ "layout(location = 3) out vec4 y2_out;\n"
+ "void main() {\n"
+ " gl_Position = vec4(0.0);\n"
+ " x1_out = 1.0;\n"
+ " x2_out[0] = 2.0;\n"
+ " x2_out[1] = 3.0;\n"
+ " x3_out = vec3(4.0, 5.0, 6.0);\n"
+ " y1_out = 7.0;\n"
+ " y2_out = vec4(8.0, 9.0, 10.0, 11.0);\n"
+ "}";
+
+static const char gs_text_tmpl[] =
+ "#version 150\n"
+ "#extension GL_ARB_separate_shader_objects: require\n"
+ "#extension GL_ARB_gpu_shader5 : enable\n"
+ "#define INVOCATION_MAX_N %u\n"
+ "layout(points, invocations = INVOCATION_MAX_N) in;\n"
+ "layout(points, max_vertices = 1) out;\n"
+ "\n"
+ "out float x1_out;\n"
+ "layout(location = 4) out float x2_out[2];\n"
+ "layout(location = 6) out vec3 x3_out;\n"
+ "out vec3 not_captured1;\n"
+ "layout(location = 2) out float y1_out;\n"
+ "layout(location = 1) out vec4 y2_out;\n"
+ "out vec3 not_captured2;\n"
+ "void main() {\n"
+ " gl_Position = gl_in[0].gl_Position;\n"
+ " x1_out = 1.0 + gl_InvocationID;\n"
+ " x2_out[0] = 2.0 + gl_InvocationID;\n"
+ " x2_out[1] = 3.0 + gl_InvocationID;\n"
+ " x3_out = vec3(4.0 + gl_InvocationID, 5.0 + gl_InvocationID,\n"
+ " 6.0 + gl_InvocationID);\n"
+ " y1_out = 7.0 + gl_InvocationID;\n"
+ " y2_out = vec4(8.0 + gl_InvocationID, 9.0 + gl_InvocationID,\n"
+ " 10.0 + gl_InvocationID, 11.0 + gl_InvocationID);\n"
+ " not_captured1 = vec3(1.0);"
+ " not_captured2 = vec3(1.0);"
+ " EmitVertex();\n"
+ " EndPrimitive();\n"
+ "}";
+
+#define BUF_1_FLOAT_N 6
+#define BUF_2_FLOAT_N 5
+
+static void
+print_usage_and_exit(const char *prog_name)
+{
+ printf("Usage: %s <subtest>\n"
+ " where <subtest> is one of the following:\n"
+ " vs (vertex shader only)\n"
+ " gs (with geometry shader invoked once per stage)\n"
+ " gs_max (with geometry shader invoked max times per "
+ "stage)\n", prog_name);
+ piglit_report_result(PIGLIT_FAIL);
+}
+
+static void
+build_and_use_program(unsigned gs_invocation_n, const char *vs_text)
+{
+ GLuint prog;
+
+ if (gs_invocation_n == 0) {
+ prog = piglit_build_simple_program_multiple_shaders(
+ GL_VERTEX_SHADER, vs_text, 0);
+ } else {
+ char *gs_text;
+
+ (void)!asprintf(&gs_text, gs_text_tmpl, gs_invocation_n);
+ prog = piglit_build_simple_program_multiple_shaders(
+ GL_VERTEX_SHADER, vs_pass_thru_text,
+ GL_GEOMETRY_SHADER, gs_text, 0);
+ free(gs_text);
+ }
+
+ const char *varyings[] = {
+ "x1_out", "x2_out[0]", "x2_out[1]", "x3_out", "gl_NextBuffer", "gl_NextBuffer","y1_out", "y2_out"
+ };
+
+ glTransformFeedbackVaryings(prog, 8, varyings, GL_INTERLEAVED_ATTRIBS);
+
+ glLinkProgram(prog);
+ if (!piglit_link_check_status(prog))
+ piglit_report_result(PIGLIT_FAIL);
+ if (!piglit_check_gl_error(GL_NO_ERROR))
+ piglit_report_result(PIGLIT_FAIL);
+
+ glUseProgram(prog);
+}
+
+static bool
+probe_buffers(const GLuint *xfb, const GLuint *queries, unsigned primitive_n)
+{
+ bool pass;
+ unsigned i;
+ GLuint query_result;
+ float *first;
+ float *second;
+
+ const unsigned first_n = primitive_n * BUF_1_FLOAT_N;
+ const unsigned second_n = primitive_n * BUF_2_FLOAT_N;
+
+ glGetQueryObjectuiv(queries[0], GL_QUERY_RESULT, &query_result);
+ if (query_result != primitive_n) {
+ printf("Expected %u primitives written, got %u\n",
+ primitive_n, query_result);
+ piglit_report_result(PIGLIT_FAIL);
+ }
+
+ glGetQueryObjectuiv(queries[1], GL_QUERY_RESULT, &query_result);
+ if (query_result != primitive_n) {
+ printf("Expected %u primitives generated, got %u\n",
+ primitive_n, query_result);
+ piglit_report_result(PIGLIT_FAIL);
+ }
+
+ first = malloc(first_n * sizeof(float));
+ second = malloc(second_n * sizeof(float));
+
+ for (i = 0; i < primitive_n; ++i) {
+ first[i * BUF_1_FLOAT_N + 0] = i + 1.0; /* x1 */
+ first[i * BUF_1_FLOAT_N + 1] = i + 2.0; /* x2[0] */
+ first[i * BUF_1_FLOAT_N + 2] = i + 3.0; /* x2[1] */
+ first[i * BUF_1_FLOAT_N + 3] = i + 4.0; /* x3[0] */
+ first[i * BUF_1_FLOAT_N + 4] = i + 5.0; /* x3[1] */
+ first[i * BUF_1_FLOAT_N + 5] = i + 6.0; /* x3[2] */
+
+ second[i * BUF_2_FLOAT_N + 0] = i + 7.0; /* y1 */
+ second[i * BUF_2_FLOAT_N + 1] = i + 8.0; /* y2[0] */
+ second[i * BUF_2_FLOAT_N + 2] = i + 9.0; /* y2[1] */
+ second[i * BUF_2_FLOAT_N + 3] = i + 10.0; /* y2[2] */
+ second[i * BUF_2_FLOAT_N + 4] = i + 11.0; /* y2u3] */
+ }
+
+ pass = piglit_probe_buffer(xfb[0], GL_TRANSFORM_FEEDBACK_BUFFER,
+ "first", 1, first_n, first);
+ pass = piglit_probe_buffer(xfb[1], GL_TRANSFORM_FEEDBACK_BUFFER,
+ "second", 1, second_n, second) &&
+ pass;
+
+ free(first);
+ free(second);
+
+ return pass;
+}
+
+static unsigned
+parse_args(int argc, char **argv, const char **vs_text)
+{
+ GLint gs_invocation_n;
+
+ if (argc != 2)
+ print_usage_and_exit(argv[0]);
+
+ if (strcmp(argv[1], "vs") == 0) {
+ *vs_text = vs_shader_text;
+ return 0;
+ }
+
+ piglit_require_extension("GL_ARB_gpu_shader5");
+ if (strcmp(argv[1], "gs") == 0)
+ return 1;
+
+ if (strcmp(argv[1], "gs_max") != 0)
+ print_usage_and_exit(argv[0]);
+
+ glGetIntegerv(GL_MAX_GEOMETRY_SHADER_INVOCATIONS, &gs_invocation_n);
+ if (gs_invocation_n <= 0) {
+ printf("Maximum amount of geometry shader invocations "
+ "needs to be positive (%u).\n", gs_invocation_n);
+ piglit_report_result(PIGLIT_FAIL);
+ }
+
+ return gs_invocation_n;
+}
+
+void
+piglit_init(int argc, char **argv)
+{
+ bool pass;
+ unsigned primitive_n, gs_invocation_n;
+ const char *vs_text;
+ GLuint queries[2];
+ GLuint xfb[2];
+ GLuint vao;
+
+ piglit_require_extension("GL_ARB_transform_feedback3");
+ piglit_require_extension("GL_ARB_separate_shader_objects");
+
+
+ gs_invocation_n = parse_args(argc, argv, &vs_text);
+
+ /* Zero invocations means the feedback is produced by vertex shader */
+ primitive_n = gs_invocation_n ? gs_invocation_n : 1;
+
+ build_and_use_program(gs_invocation_n, vs_text);
+
+ /* Set up the transform feedback buffers. */
+ glGenBuffers(ARRAY_SIZE(xfb), xfb);
+ glBindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER, 0, xfb[0]);
+ glBufferData(GL_TRANSFORM_FEEDBACK_BUFFER,
+ primitive_n * BUF_1_FLOAT_N * sizeof(float), NULL,
+ GL_STREAM_READ);
+ glBindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER, 2, xfb[1]);
+ glBufferData(GL_TRANSFORM_FEEDBACK_BUFFER,
+ primitive_n * BUF_2_FLOAT_N * sizeof(float), NULL,
+ GL_STREAM_READ);
+
+ /* Test only records using transform feedback. */
+ glEnable(GL_RASTERIZER_DISCARD);
+
+ if (!piglit_check_gl_error(GL_NO_ERROR))
+ piglit_report_result(PIGLIT_FAIL);
+
+ glGenQueries(2, queries);
+ glBeginQuery(GL_PRIMITIVES_GENERATED, queries[0]);
+ glBeginQuery(GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN, queries[1]);
+
+ /* Test is run under desktop OpenGL 3.2 -> use of VAOs is required */
+ glGenVertexArrays(1, &vao);
+ glBindVertexArray(vao);
+
+ /* Draw and record */
+ glBeginTransformFeedback(GL_POINTS);
+ glDrawArrays(GL_POINTS, 0, 1);
+ glEndQuery(GL_PRIMITIVES_GENERATED);
+ glEndQuery(GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN);
+ glEndTransformFeedback();
+ glDeleteVertexArrays(1, &vao);
+
+ if (!piglit_check_gl_error(GL_NO_ERROR))
+ piglit_report_result(PIGLIT_FAIL);
+
+ pass = probe_buffers(xfb, queries, primitive_n);
+
+ glDeleteBuffers(2, xfb);
+ glDeleteQueries(2, queries);
+
+ piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);
+}
+
+enum piglit_result
+piglit_display(void)
+{
+ /* Should never be reached */
+ return PIGLIT_FAIL;
+}
diff --git a/tests/spec/arb_shader_atomic_counters/max-counters.c b/tests/spec/arb_shader_atomic_counters/max-counters.c
index f3df5f8ba..19b0444d5 100644
--- a/tests/spec/arb_shader_atomic_counters/max-counters.c
+++ b/tests/spec/arb_shader_atomic_counters/max-counters.c
@@ -23,7 +23,7 @@
/** @file max-counters.c
*
- * Test that using more than the maximum number of suported atomic
+ * Test that using more than the maximum number of supported atomic
* counters, buffers or bindings fails with a linking error.
*/
diff --git a/tests/spec/arb_shader_atomic_counters/semantics.c b/tests/spec/arb_shader_atomic_counters/semantics.c
index 7da358399..633ff7349 100644
--- a/tests/spec/arb_shader_atomic_counters/semantics.c
+++ b/tests/spec/arb_shader_atomic_counters/semantics.c
@@ -164,14 +164,14 @@ run_test_fragment(GLint max_bindings)
const char *fs_template = "#version 140\n"
"#extension GL_ARB_shader_atomic_counters : enable\n"
"\n"
- "out ivec4 fcolor;\n"
+ "out uvec4 fcolor;\n"
"layout(binding = %i, offset = 0) uniform atomic_uint x;\n"
"\n"
"void main() {\n"
- " fcolor.x = int(atomicCounterDecrement(x));\n"
- " fcolor.y = int(atomicCounterIncrement(x));\n"
- " fcolor.z = int(atomicCounterIncrement(x));\n"
- " fcolor.w = int(atomicCounter(x));\n"
+ " fcolor.x = atomicCounterDecrement(x);\n"
+ " fcolor.y = atomicCounterIncrement(x);\n"
+ " fcolor.z = atomicCounterIncrement(x);\n"
+ " fcolor.w = atomicCounter(x);\n"
"}\n";
const char *vs_source = "#version 140\n"
"#extension GL_ARB_shader_atomic_counters : enable\n"
diff --git a/tests/spec/arb_shader_image_load_store/execution/disable_early_z.shader_test b/tests/spec/arb_shader_image_load_store/execution/disable_early_z.shader_test
index e970757bd..2dc94f686 100644
--- a/tests/spec/arb_shader_image_load_store/execution/disable_early_z.shader_test
+++ b/tests/spec/arb_shader_image_load_store/execution/disable_early_z.shader_test
@@ -1,4 +1,4 @@
-# Test that Z runs lates when the fragment shader contains stores.
+# Test that Z runs later when the fragment shader contains stores.
#
[require]
GL >= 3.3
diff --git a/tests/spec/arb_shader_image_load_store/grid.c b/tests/spec/arb_shader_image_load_store/grid.c
index 7454e52f2..9e7e2c17f 100644
--- a/tests/spec/arb_shader_image_load_store/grid.c
+++ b/tests/spec/arb_shader_image_load_store/grid.c
@@ -261,7 +261,7 @@ generate_program_v(const struct grid_info grid, const char **sources)
GL_GEOMETRY_SHADER_BIT);
const unsigned stages =
(grid.stages |
- /* Make a full pipeline if a tesselation shader was
+ /* Make a full pipeline if a tessellation shader was
* requested. */
(grid.stages & tess_stages ? graphic_stages : 0) |
/* Make sure there is always a vertex and fragment
diff --git a/tests/spec/arb_shader_texture_lod/execution/glsl-fs-texturelod-01.shader_test b/tests/spec/arb_shader_texture_lod/execution/glsl-fs-texturelod-01.shader_test
index f5ea392c0..77f324c08 100644
--- a/tests/spec/arb_shader_texture_lod/execution/glsl-fs-texturelod-01.shader_test
+++ b/tests/spec/arb_shader_texture_lod/execution/glsl-fs-texturelod-01.shader_test
@@ -1,6 +1,6 @@
[require]
GLSL >= 1.20
-require GL_ARB_shader_texture_lod
+GL_ARB_shader_texture_lod
[vertex shader]
#version 120
diff --git a/tests/spec/arb_tessellation_shader/execution/compatibility/vs-tcs-tes-clip-vertex-enables.shader_test b/tests/spec/arb_tessellation_shader/execution/compatibility/vs-tcs-tes-clip-vertex-enables.shader_test
index 546d785a6..20b3a0224 100644
--- a/tests/spec/arb_tessellation_shader/execution/compatibility/vs-tcs-tes-clip-vertex-enables.shader_test
+++ b/tests/spec/arb_tessellation_shader/execution/compatibility/vs-tcs-tes-clip-vertex-enables.shader_test
@@ -5,7 +5,7 @@
#
# To verify that each enable works, the combinations of enables were
# chosen such that:
-# - Every plane is enabled at least once and disbled at least once.
+# - Every plane is enabled at least once and disabled at least once.
# - Every plane is enabled and disabled in a different pattern.
#
# Note: Some implementations have bugs related to improper coordinate
diff --git a/tests/spec/arb_tessellation_shader/execution/tesslevels-indirect.shader_test b/tests/spec/arb_tessellation_shader/execution/tesslevels-indirect.shader_test
new file mode 100644
index 000000000..a05610a6e
--- /dev/null
+++ b/tests/spec/arb_tessellation_shader/execution/tesslevels-indirect.shader_test
@@ -0,0 +1,52 @@
+# Test a set of simple pass-through tessellation shaders
+
+[require]
+GLSL >= 1.50
+GL_ARB_tessellation_shader
+
+[vertex shader]
+#version 150
+
+void main()
+{
+}
+
+[tessellation control shader]
+#version 150
+#extension GL_ARB_tessellation_shader : require
+
+layout(vertices = 4) out;
+
+void main()
+{
+ float tessOuter = 1.0;
+ gl_TessLevelInner[0] = 1.0;
+ gl_TessLevelInner[1] = 1.0;
+ gl_TessLevelOuter[gl_InvocationID] = tessOuter;
+}
+
+[tessellation evaluation shader]
+#version 150
+#extension GL_ARB_tessellation_shader : require
+
+layout(quads, equal_spacing) in;
+
+void main()
+{
+ gl_Position = vec4(gl_TessCoord.x * 2 - 1, gl_TessCoord.y * 2 - 1, 0, 1);
+}
+
+[fragment shader]
+#version 150
+
+void main()
+{
+ gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);
+}
+
+[test]
+clear color 0.1 0.1 0.1 0.1
+clear
+patch parameter vertices 4
+draw arrays GL_PATCHES 0 4
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/spec/arb_tessellation_shader/large-uniforms.c b/tests/spec/arb_tessellation_shader/large-uniforms.c
index 91bd30fc5..4e7adf809 100644
--- a/tests/spec/arb_tessellation_shader/large-uniforms.c
+++ b/tests/spec/arb_tessellation_shader/large-uniforms.c
@@ -154,7 +154,7 @@ test_uniform_array(const GLenum shader, const int n, const bool expect_fail)
if (link_status && expect_fail) {
fprintf(stderr, "Program with %d uniform components in %s "
- "linked succesfully\n", n,
+ "linked successfully\n", n,
piglit_get_gl_enum_name(shader));
free(source_uniforms);
return false;
@@ -199,7 +199,7 @@ test_uniform_block(const GLenum shader, const int num_blocks, const int size,
sum = malloc((strlen(summand_template) + 8) * num_blocks);
sum[0] = '\0';
for(i = 0; i < num_blocks; ++i) {
- char summand[40];
+ char summand[44];
sprintf(summand, summand_template, i);
strcat(sum, summand);
}
diff --git a/tests/spec/arb_tessellation_shader/layout-mismatch.c b/tests/spec/arb_tessellation_shader/layout-mismatch.c
index 988d26cfc..f752b3499 100644
--- a/tests/spec/arb_tessellation_shader/layout-mismatch.c
+++ b/tests/spec/arb_tessellation_shader/layout-mismatch.c
@@ -127,7 +127,7 @@ test_tcs_layout(const int i, const int j)
if (link_status && (i != j)) {
fprintf(stderr, "Program with different vertices "
- "specifications linked succesfully\n");
+ "specifications linked successfully\n");
return false;
}
if (!link_status && (i == j)) {
@@ -164,7 +164,7 @@ test_tes_layout(const char *const layout1, const char *const layout2,
if (link_status && (layout1 != layout2)) {
fprintf(stderr, "Program with different %s "
- "specifications linked succesfully\n", layout_name);
+ "specifications linked successfully\n", layout_name);
return false;
}
if (!link_status && (layout1 == layout2)) {
diff --git a/tests/spec/arb_tessellation_shader/tes-gs-max-output.cpp b/tests/spec/arb_tessellation_shader/tes-gs-max-output.cpp
index acfb5e714..23744e129 100644
--- a/tests/spec/arb_tessellation_shader/tes-gs-max-output.cpp
+++ b/tests/spec/arb_tessellation_shader/tes-gs-max-output.cpp
@@ -67,7 +67,7 @@ struct testcase {
unsigned tessfactor_u;
unsigned tessfactor_v;
unsigned num_invocations; /* GS invocations / instances */
- unsigned num_outputs; /* # vertex ouput per GS invocation */
+ unsigned num_outputs; /* # vertex output per GS invocation */
unsigned num_extra_components; /* # extra components per GS output vertex */
bool operator<(const testcase &o) const {
diff --git a/tests/spec/arb_texture_barrier/blending-in-shader-arb.c b/tests/spec/arb_texture_barrier/blending-in-shader-arb.c
index ce19c2951..d61d5a214 100644
--- a/tests/spec/arb_texture_barrier/blending-in-shader-arb.c
+++ b/tests/spec/arb_texture_barrier/blending-in-shader-arb.c
@@ -177,7 +177,8 @@ initialize_data()
glActiveTexture(GL_TEXTURE0 + t);
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, width, height, GL_RED_INTEGER,
GL_UNSIGNED_INT, tex_data[t]);
- glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + t, tex[t], 0);
+ glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + t,
+ GL_TEXTURE_2D, tex[t], 0);
}
assert(glCheckFramebufferStatus(GL_FRAMEBUFFER) == GL_FRAMEBUFFER_COMPLETE);
}
@@ -207,7 +208,7 @@ interpolate_square(const Vertex square[4],
/*
* Tesselates @square_pos, returning a set of vertex information and
* indices compatible to draw with glDrawElements at (@tesselated_pos,
- * @indices). @granularity is the number of vertexes per side. So the
+ * @indices). @granularity is the number of vertices per side. So the
* minimum should be 2.
*
* Is assumed that the vertex at @square_pos are in the order
@@ -231,7 +232,7 @@ util_tesselate_square(const Vertex square_pos[4],
if (granularity < 2) {
fprintf(stderr, "Granularity should be equal or greater to 2"
- " in order to tesselate a square. Setting it to 2.\n");
+ " in order to tessellate a square. Setting it to 2.\n");
granularity = 2;
}
diff --git a/tests/spec/arb_texture_barrier/texture-halves-ping-pong-operation-chain.c b/tests/spec/arb_texture_barrier/texture-halves-ping-pong-operation-chain.c
index 41a840148..23b03531b 100644
--- a/tests/spec/arb_texture_barrier/texture-halves-ping-pong-operation-chain.c
+++ b/tests/spec/arb_texture_barrier/texture-halves-ping-pong-operation-chain.c
@@ -163,7 +163,8 @@ initialize_fbo()
unsigned fbo;
glGenFramebuffers(1, &fbo);
glBindFramebuffer(GL_FRAMEBUFFER, fbo);
- glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, tex, 0);
+ glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
+ GL_TEXTURE_2D, tex, 0);
assert(glCheckFramebufferStatus(GL_FRAMEBUFFER) ==
GL_FRAMEBUFFER_COMPLETE);
}
diff --git a/tests/spec/arb_texture_buffer_object/texture-buffer-size-clamp.c b/tests/spec/arb_texture_buffer_object/texture-buffer-size-clamp.c
index 5696da5f1..93ef5a4fd 100644
--- a/tests/spec/arb_texture_buffer_object/texture-buffer-size-clamp.c
+++ b/tests/spec/arb_texture_buffer_object/texture-buffer-size-clamp.c
@@ -249,7 +249,7 @@ piglit_init(int argc, char **argv)
"void main() {gl_Position = piglit_vertex;}";
static const char frag[] = "#version 140\n"
- "uniform samplerBuffer s;\n"
+ "uniform usamplerBuffer s;\n"
"uniform int size, maxSize;\n"
"void main()\n"
"{\n"
@@ -264,7 +264,7 @@ piglit_init(int argc, char **argv)
"#extension GL_ARB_shader_storage_buffer_object: require\n"
"#extension GL_ARB_shader_image_size: require\n"
"layout(local_size_x = 1) in;\n"
- "writeonly readonly uniform imageBuffer s;\n"
+ "writeonly readonly uniform uimageBuffer s;\n"
"layout(std430, binding=0) writeonly buffer SZ\n"
"{\n"
" int size;\n"
@@ -277,7 +277,11 @@ piglit_init(int argc, char **argv)
GLuint prog_sampler = piglit_build_simple_program(vert, frag);
GLuint prog_image = 0;
- if (piglit_is_extension_supported("GL_ARB_compute_shader")) {
+
+ bool es;
+ int major, minor;
+ piglit_get_glsl_version(&es, &major, &minor);
+ if (piglit_is_extension_supported("GL_ARB_compute_shader") && major * 100 + minor >= 420) {
GLuint shader =
piglit_compile_shader_text(GL_COMPUTE_SHADER, comp);
diff --git a/tests/spec/arb_texture_cube_map_array/sampler-cube-array-shadow.c b/tests/spec/arb_texture_cube_map_array/sampler-cube-array-shadow.c
index 95eeb04df..a16455112 100644
--- a/tests/spec/arb_texture_cube_map_array/sampler-cube-array-shadow.c
+++ b/tests/spec/arb_texture_cube_map_array/sampler-cube-array-shadow.c
@@ -63,7 +63,7 @@ static GLfloat compvals[6][4] = { { -0.50, 0.00, 0.50, 0.00 },
#define STRIDE (9 * sizeof(GLfloat))
/* Setup interleaved vertex attributes for 6 * 4 vertices:
* 4 float vertex coordinates for drawing 6 quads aligned in a 3x2 grid with
- * some space inbetween.
+ * some space in between.
* 4 float texture coordinates for sampling one cube map face per quad.
* 1 float compare value for shadow texture fetch.
*/
diff --git a/tests/spec/arb_texture_multisample/large-float-texture.c b/tests/spec/arb_texture_multisample/large-float-texture.c
index 3c18ee25e..78953bfb7 100644
--- a/tests/spec/arb_texture_multisample/large-float-texture.c
+++ b/tests/spec/arb_texture_multisample/large-float-texture.c
@@ -351,7 +351,7 @@ extract_texture_image(GLuint readbackProg,
static bool
nearly_equal(const GLfloat x[4], const GLfloat y[4])
{
- /* XXX this tolerance was chosen emperically */
+ /* XXX this tolerance was chosen empirically */
const float maxRelDiff = 0.0005;
int i;
for (i = 0; i < 4; i++) {
diff --git a/tests/spec/arb_texture_query_lod/execution/fs-textureQueryLOD-linear.shader_test b/tests/spec/arb_texture_query_lod/execution/fs-textureQueryLOD-linear.shader_test
index edae0319f..8f44d9ce1 100644
--- a/tests/spec/arb_texture_query_lod/execution/fs-textureQueryLOD-linear.shader_test
+++ b/tests/spec/arb_texture_query_lod/execution/fs-textureQueryLOD-linear.shader_test
@@ -55,11 +55,12 @@ void main()
{
vec4 frag1 = texture(tex, gl_TexCoord[0].st);
vec4 frag2 = textureLod(tex, gl_TexCoord[0].st, lod);
+ vec2 queried_lod = textureQueryLOD(tex, gl_TexCoord[0].st);
+
if (!equal_v4(frag1, frag2)) {
discard;
}
- vec2 queried_lod = textureQueryLOD(tex, gl_TexCoord[0].st);
if (!equal(queried_lod.x, queried_lod.y)) {
discard;
}
diff --git a/tests/spec/arb_texture_query_lod/execution/fs-textureQueryLOD-nearest-biased.shader_test b/tests/spec/arb_texture_query_lod/execution/fs-textureQueryLOD-nearest-biased.shader_test
index 5fa9c9cf2..d34e5c121 100644
--- a/tests/spec/arb_texture_query_lod/execution/fs-textureQueryLOD-nearest-biased.shader_test
+++ b/tests/spec/arb_texture_query_lod/execution/fs-textureQueryLOD-nearest-biased.shader_test
@@ -68,11 +68,12 @@ void main()
vec4 frag1 = texture(tex, gl_TexCoord[0].st);
vec4 frag2 = textureLod(tex, gl_TexCoord[0].st, nearest_lod);
+ vec2 queried_lod = textureQueryLOD(tex, gl_TexCoord[0].st);
+
if (frag1 != frag2) {
discard;
}
- vec2 queried_lod = textureQueryLOD(tex, gl_TexCoord[0].st);
if (!equal(queried_lod.x, min(queried_lod.y, MAX_MIPMAP_LEVEL))) {
discard;
}
diff --git a/tests/spec/arb_texture_query_lod/execution/fs-textureQueryLOD-nearest.shader_test b/tests/spec/arb_texture_query_lod/execution/fs-textureQueryLOD-nearest.shader_test
index 9782abba3..ae6a26b78 100644
--- a/tests/spec/arb_texture_query_lod/execution/fs-textureQueryLOD-nearest.shader_test
+++ b/tests/spec/arb_texture_query_lod/execution/fs-textureQueryLOD-nearest.shader_test
@@ -63,11 +63,12 @@ void main()
vec4 frag1 = texture(tex, gl_TexCoord[0].st);
vec4 frag2 = textureLod(tex, gl_TexCoord[0].st, nearest_lod);
+ vec2 queried_lod = textureQueryLOD(tex, gl_TexCoord[0].st);
+
if (frag1 != frag2) {
discard;
}
- vec2 queried_lod = textureQueryLOD(tex, gl_TexCoord[0].st);
if (!equal(queried_lod.x, queried_lod.y)) {
discard;
}
diff --git a/tests/spec/arb_texture_query_lod/execution/fs-textureQueryLOD-no-mipmap.shader_test b/tests/spec/arb_texture_query_lod/execution/fs-textureQueryLOD-no-mipmap.shader_test
index 205a0871e..f81765af1 100644
--- a/tests/spec/arb_texture_query_lod/execution/fs-textureQueryLOD-no-mipmap.shader_test
+++ b/tests/spec/arb_texture_query_lod/execution/fs-textureQueryLOD-no-mipmap.shader_test
@@ -57,11 +57,13 @@ uniform float lambda_prime;
void main()
{
+ vec4 color = texture(tex, gl_TexCoord[0].st);
+
if (!equal_v2(textureQueryLOD(tex, gl_TexCoord[0].st), vec2(0.0f, lambda_prime))) {
discard;
}
- gl_FragColor = texture(tex, gl_TexCoord[0].st);
+ gl_FragColor = color;
}
[vertex shader]
diff --git a/tests/spec/arb_texture_storage_multisample/tex-param.c b/tests/spec/arb_texture_storage_multisample/tex-param.c
index bc40ecc82..531e71779 100644
--- a/tests/spec/arb_texture_storage_multisample/tex-param.c
+++ b/tests/spec/arb_texture_storage_multisample/tex-param.c
@@ -119,7 +119,7 @@ check_subtest(struct subtest *t)
return PIGLIT_FAIL;
}
- /* verify that the new value stuck (or didnt, if we expected failure) */
+ /* verify that the new value stuck (or didn't, if we expected failure) */
glGetTexParameteriv(GL_TEXTURE_2D_MULTISAMPLE, t->param, &val);
expected_val = t->expected_error == GL_NO_ERROR ? t->value : t->initial_value;
diff --git a/tests/spec/arb_texture_view/queries.c b/tests/spec/arb_texture_view/queries.c
index 026d97ece..b603791a1 100644
--- a/tests/spec/arb_texture_view/queries.c
+++ b/tests/spec/arb_texture_view/queries.c
@@ -42,7 +42,7 @@ PIGLIT_GL_TEST_CONFIG_BEGIN
PIGLIT_GL_TEST_CONFIG_END
/**
- * make sure default intial state is correct for textureView
+ * make sure default initial state is correct for textureView
* In OpenGL Core 4.3 spec see table 23.15 for default values.
*/
static bool
diff --git a/tests/spec/arb_timer_query/timestamp-get.c b/tests/spec/arb_timer_query/timestamp-get.c
index fc48d85b0..3fdf3813b 100644
--- a/tests/spec/arb_timer_query/timestamp-get.c
+++ b/tests/spec/arb_timer_query/timestamp-get.c
@@ -80,7 +80,7 @@ validate_times(GLint64 t1, GLint64 t2, GLint64 tolerance)
piglit_report_result(PIGLIT_FAIL);
}
- /* the tolerance of 1 milisecond seems to be sufficient */
+ /* the tolerance of 1 millisecond seems to be sufficient */
if (t2 - t1 > tolerance) {
printf("time 1 = %" PRIu64 " us\n", (uint64_t) t1 / 1000);
printf("time 2 = %" PRIu64 " us\n", (uint64_t) t2 / 1000);
diff --git a/tests/spec/arb_transform_feedback2/api-queries.c b/tests/spec/arb_transform_feedback2/api-queries.c
index 03b39e124..d074d29ca 100644
--- a/tests/spec/arb_transform_feedback2/api-queries.c
+++ b/tests/spec/arb_transform_feedback2/api-queries.c
@@ -129,7 +129,7 @@ void piglit_init(int argc, char **argv)
glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, id);
glBindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER, 0, buf);
- /* Verify the initial state of transform feedback object queires.
+ /* Verify the initial state of transform feedback object queries.
*/
pass = check_int(GL_TRANSFORM_FEEDBACK_BINDING, id) && pass;
diff --git a/tests/spec/arb_transform_feedback2/change-objects-while-paused.c b/tests/spec/arb_transform_feedback2/change-objects-while-paused.c
index b81fbd87a..e110e7c65 100644
--- a/tests/spec/arb_transform_feedback2/change-objects-while-paused.c
+++ b/tests/spec/arb_transform_feedback2/change-objects-while-paused.c
@@ -29,7 +29,7 @@
*
* - Bind an XFB object, start XFB, draw something, pause XFB.
*
- * - Bind a different XFB object, start XFB, draw someting, pause XFB.
+ * - Bind a different XFB object, start XFB, draw something, pause XFB.
*
* - Rebind the first XFB object, resume XFB, draw something, end XFB.
*
diff --git a/tests/spec/arb_transform_feedback3/begin_end.c b/tests/spec/arb_transform_feedback3/begin_end.c
index e95c6e657..104cb1f79 100644
--- a/tests/spec/arb_transform_feedback3/begin_end.c
+++ b/tests/spec/arb_transform_feedback3/begin_end.c
@@ -53,7 +53,7 @@ piglit_init(int argc, char **argv)
glGetIntegerv(GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS,
&max_attrib_n);
if (!max_attrib_n) {
- printf("Maximum number of separete attributes is zero\n");
+ printf("Maximum number of separate attributes is zero\n");
piglit_report_result(PIGLIT_FAIL);
}
diff --git a/tests/spec/arb_transform_feedback3/set_invalid_varyings.c b/tests/spec/arb_transform_feedback3/set_invalid_varyings.c
index ee4b596a6..80124ed60 100644
--- a/tests/spec/arb_transform_feedback3/set_invalid_varyings.c
+++ b/tests/spec/arb_transform_feedback3/set_invalid_varyings.c
@@ -160,7 +160,7 @@ piglit_init(int argc, char **argv)
glGetIntegerv(GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS,
&max_attrib_n);
if (!max_attrib_n) {
- printf("Maximum number of separete attributes is zero\n");
+ printf("Maximum number of separate attributes is zero\n");
piglit_report_result(PIGLIT_FAIL);
}
diff --git a/tests/spec/arb_transform_feedback3/set_varyings_with_invalid_args.c b/tests/spec/arb_transform_feedback3/set_varyings_with_invalid_args.c
index a9efccb19..96262f07a 100644
--- a/tests/spec/arb_transform_feedback3/set_varyings_with_invalid_args.c
+++ b/tests/spec/arb_transform_feedback3/set_varyings_with_invalid_args.c
@@ -97,7 +97,7 @@ piglit_init(int argc, char **argv)
glGetIntegerv(GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS,
&max_attrib_n);
if (!max_attrib_n) {
- printf("Maximum number of separete attributes is zero\n");
+ printf("Maximum number of separate attributes is zero\n");
piglit_report_result(PIGLIT_FAIL);
}
diff --git a/tests/spec/arb_transform_feedback_overflow_query/basic.c b/tests/spec/arb_transform_feedback_overflow_query/basic.c
index 017335c98..6ccc0e850 100644
--- a/tests/spec/arb_transform_feedback_overflow_query/basic.c
+++ b/tests/spec/arb_transform_feedback_overflow_query/basic.c
@@ -326,7 +326,7 @@ run_subtest(int n_streams, int array_sizes[], int stream, GLuint query_type,
} else if (!strcmp(test_type, "buffer_object")) {
pass = overflow_buffer_object(query, expected);
} else {
- printf("Unkown test.\n");
+ printf("Unknown test.\n");
pass = PIGLIT_FAIL;
}
diff --git a/tests/spec/arb_uniform_buffer_object/referenced-by-shader.c b/tests/spec/arb_uniform_buffer_object/referenced-by-shader.c
index a1d7b93e8..a4229f97a 100644
--- a/tests/spec/arb_uniform_buffer_object/referenced-by-shader.c
+++ b/tests/spec/arb_uniform_buffer_object/referenced-by-shader.c
@@ -71,7 +71,7 @@ piglit_init(int argc, char **argv)
"uniform vsgsfs { float vgf; };\n"
"void main() {\n"
" for(int i = 0; i < 3; i++) {\n"
- " gl_Position = vec4(g + vg + gf + vgf);\n"
+ " gl_Position = vec4(g + vg + gf + vgf) + gl_in[i].gl_Position;\n"
" EmitVertex();\n"
" }\n"
"}\n";
diff --git a/tests/spec/arb_vertex_attrib_64bit/execution/unused-sub-dvec4-01.shader_test b/tests/spec/arb_vertex_attrib_64bit/execution/unused-sub-dvec4-01.shader_test
new file mode 100644
index 000000000..2a467fa39
--- /dev/null
+++ b/tests/spec/arb_vertex_attrib_64bit/execution/unused-sub-dvec4-01.shader_test
@@ -0,0 +1,57 @@
+[require]
+GLSL >= 1.50
+GL_ARB_gpu_shader_fp64
+GL_ARB_vertex_attrib_64bit
+GL_ARB_explicit_attrib_location
+
+[vertex shader]
+#version 150
+#extension GL_ARB_gpu_shader_fp64 : require
+#extension GL_ARB_vertex_attrib_64bit : require
+#extension GL_ARB_explicit_attrib_location : require
+
+layout(location = 0) in dvec4 position;
+layout(location = 1) in dvec4 color0;
+layout(location = 2) in dvec4 color1;
+layout(location = 3) in dvec4 color2;
+
+flat out dvec4 fscolor0;
+flat out dvec4 fscolor1;
+flat out dvec4 fscolor2;
+
+void main()
+{
+ gl_Position = vec4(position);
+ fscolor0 = color0;
+ fscolor1 = color1;
+ fscolor2 = color2;
+}
+
+[fragment shader]
+#version 150
+#extension GL_ARB_gpu_shader_fp64 : require
+
+flat in dvec4 fscolor0;
+flat in dvec4 fscolor1;
+flat in dvec4 fscolor2;
+
+out vec4 color;
+
+void main()
+{
+ // NOTE: fscolor1.zw is unused
+ color = vec4((fscolor0 + fscolor1.xyyx + fscolor2) / 3.0);
+}
+
+[vertex data]
+position/double/4 color0/double/4 color1/double/4 color2/double/4
+-1.0 -1.0 0.0 1.0 0.0 1.0 0.0 1.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 1.0
+ 1.0 -1.0 0.0 1.0 0.0 1.0 0.0 1.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 1.0
+ 1.0 1.0 0.0 1.0 0.0 1.0 0.0 1.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 1.0
+-1.0 1.0 0.0 1.0 0.0 1.0 0.0 1.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 1.0
+
+[test]
+clear color 0.0 0.0 1.0 0.0
+clear
+draw arrays GL_TRIANGLE_FAN 0 4
+probe rgba 0 0 0.333333 0.333333 0.333333 1.0
diff --git a/tests/spec/arb_vertex_attrib_64bit/execution/unused-sub-dvec4-02.shader_test b/tests/spec/arb_vertex_attrib_64bit/execution/unused-sub-dvec4-02.shader_test
new file mode 100644
index 000000000..a31b29be5
--- /dev/null
+++ b/tests/spec/arb_vertex_attrib_64bit/execution/unused-sub-dvec4-02.shader_test
@@ -0,0 +1,57 @@
+[require]
+GLSL >= 1.50
+GL_ARB_gpu_shader_fp64
+GL_ARB_vertex_attrib_64bit
+GL_ARB_explicit_attrib_location
+
+[vertex shader]
+#version 150
+#extension GL_ARB_gpu_shader_fp64 : require
+#extension GL_ARB_vertex_attrib_64bit : require
+#extension GL_ARB_explicit_attrib_location : require
+
+layout(location = 0) in dvec4 position;
+layout(location = 1) in dvec4 color0;
+layout(location = 2) in dvec4 color1;
+layout(location = 3) in dvec4 color2;
+
+flat out dvec4 fscolor0;
+flat out dvec4 fscolor1;
+flat out dvec4 fscolor2;
+
+void main()
+{
+ gl_Position = vec4(position);
+ fscolor0 = color0;
+ fscolor1 = color1;
+ fscolor2 = color2;
+}
+
+[fragment shader]
+#version 150
+#extension GL_ARB_gpu_shader_fp64 : require
+
+flat in dvec4 fscolor0;
+flat in dvec4 fscolor1;
+flat in dvec4 fscolor2;
+
+out vec4 color;
+
+void main()
+{
+ // NOTE: fscolor1.xy is unused
+ color = vec4((fscolor0 + fscolor1.wzzw + fscolor2) / 3.0);
+}
+
+[vertex data]
+position/double/4 color0/double/4 color1/double/4 color2/double/4
+-1.0 -1.0 0.0 1.0 0.0 1.0 0.0 1.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 1.0
+ 1.0 -1.0 0.0 1.0 0.0 1.0 0.0 1.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 1.0
+ 1.0 1.0 0.0 1.0 0.0 1.0 0.0 1.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 1.0
+-1.0 1.0 0.0 1.0 0.0 1.0 0.0 1.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 1.0
+
+[test]
+clear color 0.0 0.0 1.0 0.0
+clear
+draw arrays GL_TRIANGLE_FAN 0 4
+probe rgba 0 0 0.333333 0.333333 0.333333 1.0
diff --git a/tests/spec/arb_vertex_program/get-limits-without-fp.c b/tests/spec/arb_vertex_program/get-limits-without-fp.c
index d4f2b3eab..6c2bedc61 100644
--- a/tests/spec/arb_vertex_program/get-limits-without-fp.c
+++ b/tests/spec/arb_vertex_program/get-limits-without-fp.c
@@ -29,7 +29,7 @@
* \file get-vp-limit-without-fp.c
*
* Test for the crash reported in bugs.freedesktop.org bug #24066.
- * This occured when the native limits of a vertex program are queried
+ * This occurred when the native limits of a vertex program are queried
* before a fragment program has been setup.
*/
diff --git a/tests/spec/arb_vertex_program/property-bindings.c b/tests/spec/arb_vertex_program/property-bindings.c
index 381ecab2f..f9d0c947e 100644
--- a/tests/spec/arb_vertex_program/property-bindings.c
+++ b/tests/spec/arb_vertex_program/property-bindings.c
@@ -361,11 +361,19 @@ piglit_display(void)
glFogfv(GL_FOG_COLOR, val);
pass = check_prg_param(val, "state.fog.color") && pass;
- random_vec4(val);
+ /* Don't test infinity because shader comparisons with infinity are
+ * undefined.
+ */
+ float fog_scale;
+ do {
+ random_vec4(val);
+ fog_scale = 1 / (val[2] - val[1]);
+ } while (isinf(fog_scale));
+
glFogf(GL_FOG_DENSITY, val[0]);
glFogf(GL_FOG_START, val[1]);
glFogf(GL_FOG_END, val[2]);
- val[3] = 1 / (val[2] - val[1]);
+ val[3] = fog_scale;
pass = check_prg_param(val, "state.fog.params") && pass;
/* Clip Plane Property Bindings */
diff --git a/tests/spec/arb_viewport_array/bounds.c b/tests/spec/arb_viewport_array/bounds.c
index 8d43e9f97..e3717c5db 100644
--- a/tests/spec/arb_viewport_array/bounds.c
+++ b/tests/spec/arb_viewport_array/bounds.c
@@ -74,7 +74,7 @@ viewport_bounds(GLint maxVP)
bool pass = true;
int i;
- /* intial values for x,y,w,h */
+ /* initial values for x,y,w,h */
for (i = 0; i < maxVP; i++) {
glGetFloati_v(GL_VIEWPORT, i, vp);
if (vp[0] != 0.0 || vp[1] != 0.0 ||
@@ -154,7 +154,7 @@ depth_range_bounds(GLint maxVP)
#endif
int i;
- /* intial values for near, far are 0.0, 1.0 repsectively */
+ /* initial values for near, far are 0.0, 1.0 respectively */
for (i = 0; i < maxVP; i++) {
#ifdef PIGLIT_USE_OPENGL
glGetDoublei_v(GL_DEPTH_RANGE, i, dr);
@@ -219,7 +219,7 @@ scissor_bounds(GLint maxVP)
bool pass = true;
int i;
- /* intial values for left, bottom, width, height */
+ /* initial values for left, bottom, width, height */
for (i = 0; i < maxVP; i++) {
glGetIntegeri_v(GL_SCISSOR_BOX, i, sc);
if (sc[0] != 0 || sc[1] != 0 || sc[2] != piglit_width ||
diff --git a/tests/spec/arb_viewport_array/queries.c b/tests/spec/arb_viewport_array/queries.c
index efd280b30..af9c20537 100644
--- a/tests/spec/arb_viewport_array/queries.c
+++ b/tests/spec/arb_viewport_array/queries.c
@@ -84,7 +84,7 @@ piglit_init(int argc, char **argv)
* depthrange-indices and viewport-indices tests.
* OpenGL 4.3 Core section 22.1 ref:
* "An INVALID_ENUM error is generated if target is not
- * indexed state queriable with these commands."
+ * indexed state queryable with these commands."
*/
for (i = 0; i < ARRAY_SIZE(tokens); i++) {
glGetFloati_v(tokens[i], 1, valf);
diff --git a/tests/spec/arb_viewport_array/render_scissor.c b/tests/spec/arb_viewport_array/render_scissor.c
index 93f07754a..b6e5b6374 100644
--- a/tests/spec/arb_viewport_array/render_scissor.c
+++ b/tests/spec/arb_viewport_array/render_scissor.c
@@ -52,7 +52,7 @@ PIGLIT_GL_TEST_CONFIG_BEGIN
PIGLIT_GL_TEST_CONFIG_END
-/* number of viewport/scissor rectangle divisons in x and y */
+/* number of viewport/scissor rectangle divisions in x and y */
static const int divX=2, divY=3;
/**
@@ -128,7 +128,7 @@ draw_multi_scissor_rect(void)
* Draws a single quad full window size, with different scissor rectangles
* and different scissor test enables for each viewport index.
* Scissor rectangles or viewport restrict drawing to sub-area of full
- * window surface. Geometry shader is responsible for exapnding primitves
+ * window surface. Geometry shader is responsible for exapnding primitives
* to cover all divX * divY viewport/scissor indices. The function reads
* back the expected color to test if the scissored drawing was correct.
*/
diff --git a/tests/spec/arb_viewport_array/viewport_indices.c b/tests/spec/arb_viewport_array/viewport_indices.c
index 567f83d36..8f8aa0590 100644
--- a/tests/spec/arb_viewport_array/viewport_indices.c
+++ b/tests/spec/arb_viewport_array/viewport_indices.c
@@ -161,7 +161,7 @@ test_preserve_invalid_index(GLint maxVP)
GLboolean scEnabled;
int i;
- /* intialize all indices to know values */
+ /* initialize all indices to know values */
for (i = 0; i < maxVP; i++) {
glViewportIndexedfv(i, vp);
#ifdef PIGLIT_USE_OPENGL
diff --git a/tests/spec/ati_draw_buffers/arbfp-no-index.c b/tests/spec/ati_draw_buffers/arbfp-no-index.c
index b928cab63..cb86203f1 100644
--- a/tests/spec/ati_draw_buffers/arbfp-no-index.c
+++ b/tests/spec/ati_draw_buffers/arbfp-no-index.c
@@ -152,18 +152,13 @@ piglit_display(void)
void
piglit_init(int argc, char **argv)
{
- GLint num;
-
piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
piglit_require_extension("GL_EXT_framebuffer_object");
piglit_require_extension("GL_ATI_draw_buffers");
piglit_require_extension("GL_ARB_fragment_program");
piglit_require_extension("GL_ARB_vertex_program");
-
- glGetIntegerv(GL_MAX_DRAW_BUFFERS_ARB, &num);
- if (num < 2)
- piglit_report_result(PIGLIT_SKIP);
+ piglit_require_minimum_getinteger(GL_MAX_DRAW_BUFFERS_ARB, 2);
piglit_compile_program(GL_FRAGMENT_PROGRAM_ARB, mrt_fp_string);
}
diff --git a/tests/spec/ati_draw_buffers/arbfp-no-option.c b/tests/spec/ati_draw_buffers/arbfp-no-option.c
index ae062cca0..00e03245f 100644
--- a/tests/spec/ati_draw_buffers/arbfp-no-option.c
+++ b/tests/spec/ati_draw_buffers/arbfp-no-option.c
@@ -138,16 +138,11 @@ piglit_display(void)
void
piglit_init(int argc, char **argv)
{
- GLint num;
-
piglit_require_extension("GL_EXT_framebuffer_object");
piglit_require_extension("GL_ATI_draw_buffers");
piglit_require_extension("GL_ARB_fragment_program");
piglit_require_extension("GL_ARB_vertex_program");
-
- glGetIntegerv(GL_MAX_DRAW_BUFFERS_ARB, &num);
- if (num < 2)
- piglit_report_result(PIGLIT_SKIP);
+ piglit_require_minimum_getinteger(GL_MAX_DRAW_BUFFERS_ARB, 2);
piglit_compile_program(GL_FRAGMENT_PROGRAM_ARB, mrt_fp_string);
}
diff --git a/tests/spec/ati_draw_buffers/arbfp.c b/tests/spec/ati_draw_buffers/arbfp.c
index 34805c3aa..5d4c3a5bb 100644
--- a/tests/spec/ati_draw_buffers/arbfp.c
+++ b/tests/spec/ati_draw_buffers/arbfp.c
@@ -144,18 +144,13 @@ piglit_display(void)
void
piglit_init(int argc, char **argv)
{
- GLint num;
-
piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
piglit_require_extension("GL_EXT_framebuffer_object");
piglit_require_extension("GL_ATI_draw_buffers");
piglit_require_extension("GL_ARB_fragment_program");
piglit_require_extension("GL_ARB_vertex_program");
-
- glGetIntegerv(GL_MAX_DRAW_BUFFERS_ARB, &num);
- if (num < 2)
- piglit_report_result(PIGLIT_SKIP);
+ piglit_require_minimum_getinteger(GL_MAX_DRAW_BUFFERS_ARB, 2);
piglit_compile_program(GL_FRAGMENT_PROGRAM_ARB, mrt_fp_string);
}
diff --git a/tests/spec/ext_clear_texture/base-formats.c b/tests/spec/ext_clear_texture/base-formats.c
index edf8738fa..7eb5eb670 100644
--- a/tests/spec/ext_clear_texture/base-formats.c
+++ b/tests/spec/ext_clear_texture/base-formats.c
@@ -29,7 +29,7 @@
* texture where the first four texels are cleared to known values
* using separate calls to glClearTexSubImage. The values are chosen
* to potentially trigger problems with signed conversions for integer
- * textures. The restof the texture is initalised to zeroes. The textures
+ * textures. The restof the texture is initialised to zeroes. The textures
* are then read back by attaching them to a fbo and calling glReadPixels
* or glReadnPixelsKHR if robustness is supported.
*/
diff --git a/tests/spec/ext_debug_label/CMakeLists.gl.txt b/tests/spec/ext_debug_label/CMakeLists.gl.txt
new file mode 100644
index 000000000..b08a2e547
--- /dev/null
+++ b/tests/spec/ext_debug_label/CMakeLists.gl.txt
@@ -0,0 +1,13 @@
+include_directories(
+ ${GLEXT_INCLUDE_DIR}
+ ${OPENGL_INCLUDE_PATH}
+)
+
+link_libraries (
+ piglitutil_${piglit_target_api}
+ ${OPENGL_gl_LIBRARY}
+)
+
+piglit_add_executable (ext_debug_label-object-label_${piglit_target_api} debug-object-label.c)
+
+# vim: ft=cmake:
diff --git a/tests/spec/ext_debug_label/CMakeLists.gles2.txt b/tests/spec/ext_debug_label/CMakeLists.gles2.txt
new file mode 100644
index 000000000..413dc3cd2
--- /dev/null
+++ b/tests/spec/ext_debug_label/CMakeLists.gles2.txt
@@ -0,0 +1,13 @@
+include_directories(
+ ${GLEXT_INCLUDE_DIR}
+ ${OPENGL_INCLUDE_PATH}
+)
+
+link_libraries (
+ piglitutil_${piglit_target_api}
+ ${EGL_LDFLAGS}
+)
+
+piglit_add_executable (ext_debug_label-object-label_${piglit_target_api} debug-object-label.c)
+
+# vim: ft=cmake:
diff --git a/tests/spec/ext_debug_label/CMakeLists.gles3.txt b/tests/spec/ext_debug_label/CMakeLists.gles3.txt
new file mode 100644
index 000000000..413dc3cd2
--- /dev/null
+++ b/tests/spec/ext_debug_label/CMakeLists.gles3.txt
@@ -0,0 +1,13 @@
+include_directories(
+ ${GLEXT_INCLUDE_DIR}
+ ${OPENGL_INCLUDE_PATH}
+)
+
+link_libraries (
+ piglitutil_${piglit_target_api}
+ ${EGL_LDFLAGS}
+)
+
+piglit_add_executable (ext_debug_label-object-label_${piglit_target_api} debug-object-label.c)
+
+# vim: ft=cmake:
diff --git a/tests/spec/ext_debug_label/CMakeLists.txt b/tests/spec/ext_debug_label/CMakeLists.txt
new file mode 100644
index 000000000..144a306f4
--- /dev/null
+++ b/tests/spec/ext_debug_label/CMakeLists.txt
@@ -0,0 +1 @@
+piglit_include_target_api()
diff --git a/tests/spec/ext_debug_label/debug-object-label.c b/tests/spec/ext_debug_label/debug-object-label.c
new file mode 100644
index 000000000..715dc1955
--- /dev/null
+++ b/tests/spec/ext_debug_label/debug-object-label.c
@@ -0,0 +1,436 @@
+/*
+ * Copyright (c) 2013 Timothy Arceri <t_arceri@yahoo.com.au>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * on the rights to use, copy, modify, merge, publish, distribute, sub
+ * license, and/or sell copies of the Software, and to permit persons to whom
+ * the Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL AUTHORS AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include "piglit-util-gl.h"
+
+static const char *TestLabel = "Test Label";
+#define TestLabelLen 10
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+#ifdef PIGLIT_USE_OPENGL
+ config.supports_gl_compat_version = 11;
+#else /* using GLES */
+ config.supports_gl_es_version = 11;
+#endif
+
+ config.window_visual = PIGLIT_GL_VISUAL_RGBA | PIGLIT_GL_VISUAL_DOUBLE;
+ config.khr_no_error_support = PIGLIT_HAS_ERRORS;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+enum piglit_result
+piglit_display(void)
+{
+ return PIGLIT_PASS;
+}
+
+/* <label> will be null-terminated. The actual number of
+ * characters written into <label>,
+ * excluding the null terminator, is returned in <length>.
+ */
+static bool
+check_label_and_length(char *label, int length, GLenum object)
+{
+ bool pass = true;
+ const char *name = piglit_get_gl_enum_name(object);
+
+ printf("Checking label and length of %s object\n", name);
+
+ if (!piglit_check_gl_error(GL_NO_ERROR))
+ pass = false;
+
+ if (length != TestLabelLen || (strcmp(TestLabel, label) != 0)) {
+ fprintf(stderr, "Label or length does not match in %s object\n", name);
+ printf(" actual label: %s actual length: %i\n", label, length);
+ printf(" expected label: %s expected length: %i\n", TestLabel, TestLabelLen);
+ pass = false;
+ }
+
+ return pass;
+}
+
+/* trivial tests to get/set labels on all the different types of objects */
+static bool
+test_object_label_types()
+{
+ #define numObjects 12
+ GLsizei length[numObjects]; /* create a fresh variable for each object to test */
+ GLchar label[numObjects][TestLabelLen + 1];
+ bool pass = true;
+
+ enum test_object_indices {
+ BUFFER_IDX, SHADER_IDX, PROGRAM_IDX, VERTEX_ARRAY_IDX, RENDERBUFFER_IDX,
+ FRAMEBUFFER_IDX, QUERY_IDX, PROGRAM_PIPELINE_IDX, TRANSFORM_FEEDBACK_IDX,
+ SAMPLER_IDX, TEXTURE_IDX, DISPLAY_LIST_IDX
+ };
+
+ GLuint buffer;
+ GLuint shader;
+ GLuint program;
+ GLuint vertexArray;
+ GLuint query;
+#ifdef PIGLIT_USE_OPENGL
+ GLuint programPipeline;
+#endif
+ GLuint transformFeedback;
+ GLuint sampler;
+ GLuint texture;
+ GLuint renderbuffer;
+ GLuint framebuffer;
+
+ /* Test BUFFER */
+ glGenBuffers(1, &buffer);
+ glBindBuffer(GL_ARRAY_BUFFER, buffer);
+ glLabelObjectEXT(GL_BUFFER_OBJECT_EXT, buffer, 0, TestLabel);
+ glGetObjectLabelEXT(GL_BUFFER_OBJECT_EXT, buffer, TestLabelLen + 1, &length[BUFFER_IDX], label[BUFFER_IDX]);
+
+ pass = check_label_and_length(label[BUFFER_IDX], length[BUFFER_IDX],
+ GL_BUFFER) && pass;
+
+ glDeleteBuffers(1, &buffer);
+
+ if (piglit_get_gl_version() >= 20) {
+ /* Test SHADER */
+ shader = glCreateShader(GL_FRAGMENT_SHADER);
+ glLabelObjectEXT(GL_SHADER_OBJECT_EXT, shader, 0, TestLabel);
+ glGetObjectLabelEXT(GL_SHADER_OBJECT_EXT, shader, TestLabelLen + 1,
+ &length[SHADER_IDX], label[SHADER_IDX]);
+
+ pass = check_label_and_length(label[SHADER_IDX], length[SHADER_IDX],
+ GL_SHADER) && pass;
+
+ glDeleteShader(shader);
+
+ /* Test PROGRAM */
+ program = glCreateProgram();
+ glLabelObjectEXT(GL_PROGRAM_OBJECT_EXT, program, 0, TestLabel);
+ glGetObjectLabelEXT(GL_PROGRAM_OBJECT_EXT, program, TestLabelLen + 1,
+ &length[PROGRAM_IDX], label[PROGRAM_IDX]);
+
+ pass = check_label_and_length(label[PROGRAM_IDX], length[PROGRAM_IDX],
+ GL_PROGRAM) && pass;
+
+ glDeleteProgram(program);
+ }
+
+ /* GL or GLES >= 3.0 supports vertex arrays*/
+ if (piglit_get_gl_version() >= 30) {
+ /* Test VERTEX_ARRAY */
+ glGenVertexArrays(1, &vertexArray);
+ glBindVertexArray(vertexArray);
+ glLabelObjectEXT(GL_VERTEX_ARRAY_OBJECT_EXT, vertexArray, 0, TestLabel);
+ glGetObjectLabelEXT(GL_VERTEX_ARRAY_OBJECT_EXT, vertexArray, TestLabelLen + 1,
+ &length[VERTEX_ARRAY_IDX], label[VERTEX_ARRAY_IDX]);
+
+ pass = check_label_and_length(label[VERTEX_ARRAY_IDX], length[VERTEX_ARRAY_IDX],
+ GL_VERTEX_ARRAY) && pass;
+
+ glDeleteVertexArrays(1, &vertexArray);
+ }
+
+ /* GLES supports render buffer and frame buffer since 2.0 */
+ if (piglit_is_gles() || piglit_get_gl_version() >= 30) {
+ /* Test RENDERBUFFER */
+ glGenRenderbuffers(1, &renderbuffer);
+ glBindRenderbuffer(GL_RENDERBUFFER, renderbuffer);
+ glLabelObjectEXT(GL_RENDERBUFFER, renderbuffer, 0, TestLabel);
+ glGetObjectLabelEXT(GL_RENDERBUFFER, renderbuffer, TestLabelLen + 1,
+ &length[RENDERBUFFER_IDX], label[RENDERBUFFER_IDX]);
+
+ pass = check_label_and_length(label[RENDERBUFFER_IDX], length[RENDERBUFFER_IDX],
+ GL_RENDERBUFFER) && pass;
+
+ glDeleteRenderbuffers(1, &renderbuffer);
+
+ /* Test FRAMEBUFFER */
+ glGenFramebuffers(1, &framebuffer);
+ glBindFramebuffer(GL_FRAMEBUFFER, framebuffer);
+ glLabelObjectEXT(GL_FRAMEBUFFER, framebuffer, 0, TestLabel);
+ glGetObjectLabelEXT(GL_FRAMEBUFFER, framebuffer, TestLabelLen + 1,
+ &length[FRAMEBUFFER_IDX], label[FRAMEBUFFER_IDX]);
+
+ pass = check_label_and_length(label[FRAMEBUFFER_IDX], length[FRAMEBUFFER_IDX],
+ GL_FRAMEBUFFER) && pass;
+
+ glDeleteFramebuffers(1, &framebuffer);
+ }
+
+ /* GLES >= 3.0 or GL compat */
+ if (piglit_is_extension_supported("GL_ARB_occlusion_query") ||
+ piglit_get_gl_version() >= 30) {
+ /* Test QUERY */
+ glGenQueries(1, &query);
+ if (piglit_is_gles()) {
+ glBeginQuery(GL_ANY_SAMPLES_PASSED, query);
+ glEndQuery(GL_ANY_SAMPLES_PASSED);
+ } else {
+ glBeginQuery(GL_SAMPLES_PASSED, query);
+ glEndQuery(GL_SAMPLES_PASSED);
+ }
+ glLabelObjectEXT(GL_QUERY_OBJECT_EXT, query, 0, TestLabel);
+ glGetObjectLabelEXT(GL_QUERY_OBJECT_EXT, query, TestLabelLen + 1, &length[QUERY_IDX], label[QUERY_IDX]);
+
+ pass = check_label_and_length(label[QUERY_IDX], length[QUERY_IDX],
+ GL_QUERY) && pass;
+
+ glDeleteQueries(1, &query);
+ }
+
+#ifdef PIGLIT_USE_OPENGL
+ /* Test PROGRAM_PIPELINE */
+ if (piglit_is_extension_supported("GL_ARB_separate_shader_objects")) {
+ glGenProgramPipelines(1, &programPipeline);
+ glBindProgramPipeline(programPipeline);
+ glLabelObjectEXT(GL_PROGRAM_PIPELINE_OBJECT_EXT, programPipeline, 0, TestLabel);
+ glGetObjectLabelEXT(GL_PROGRAM_PIPELINE_OBJECT_EXT, programPipeline, TestLabelLen + 1,
+ &length[PROGRAM_PIPELINE_IDX], label[PROGRAM_PIPELINE_IDX]);
+
+ pass = check_label_and_length(label[PROGRAM_PIPELINE_IDX], length[PROGRAM_PIPELINE_IDX],
+ GL_PROGRAM_PIPELINE) && pass;
+
+ glDeleteProgramPipelines(1, &programPipeline);
+ }
+#endif /* PIGLIT_USE_OPENGL */
+
+ /* Test TRANSFORM_FEEDBACK */
+ if ((piglit_is_gles() && piglit_get_gl_version() >= 30) ||
+ piglit_is_extension_supported("GL_ARB_transform_feedback2")) {
+ glGenTransformFeedbacks(1, &transformFeedback);
+ glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, transformFeedback);
+ glLabelObjectEXT(GL_TRANSFORM_FEEDBACK, transformFeedback, 0, TestLabel);
+ glGetObjectLabelEXT(GL_TRANSFORM_FEEDBACK, transformFeedback, TestLabelLen + 1,
+ &length[TRANSFORM_FEEDBACK_IDX], label[TRANSFORM_FEEDBACK_IDX]);
+
+ pass = check_label_and_length(label[TRANSFORM_FEEDBACK_IDX], length[TRANSFORM_FEEDBACK_IDX],
+ GL_TRANSFORM_FEEDBACK) && pass;
+
+ glDeleteTransformFeedbacks(1, &transformFeedback);
+ }
+
+ /* Test SAMPLER */
+ if ((piglit_is_gles() && piglit_get_gl_version() >= 30) ||
+ piglit_is_extension_supported("GL_ARB_sampler_objects")) {
+ glGenSamplers(1, &sampler);
+ glBindSampler(0, sampler);
+ glLabelObjectEXT(GL_SAMPLER, sampler, 0, TestLabel);
+ glGetObjectLabelEXT(GL_SAMPLER, sampler, TestLabelLen + 1, &length[SAMPLER_IDX], label[SAMPLER_IDX]);
+
+ pass = check_label_and_length(label[SAMPLER_IDX], length[SAMPLER_IDX],
+ GL_SAMPLER) && pass;
+
+ glDeleteSamplers(1, &sampler);
+ }
+
+ /* Test TEXTURE */
+ glGenTextures(1, &texture);
+ glBindTexture(GL_TEXTURE_2D, texture);
+ glLabelObjectEXT(GL_TEXTURE, texture, 0, TestLabel);
+ glGetObjectLabelEXT(GL_TEXTURE, texture, TestLabelLen + 1, &length[TEXTURE_IDX], label[TEXTURE_IDX]);
+
+ pass = check_label_and_length(label[TEXTURE_IDX], length[TEXTURE_IDX],
+ GL_TEXTURE) && pass;
+
+ glDeleteTextures(1, &texture);
+
+ return pass;
+}
+
+static bool
+test_object_label()
+{
+ GLsizei length;
+ GLuint buffer;
+ GLuint invalidBufferName;
+ GLchar label[TestLabelLen + 1];
+ bool pass = true;
+
+ puts("Test LabelObject");
+
+ glGenBuffers(1, &buffer);
+
+ /* If <label> is NULL, any debug label is effectively removed from the object.
+ */
+ glLabelObjectEXT(GL_BUFFER, buffer, 0, TestLabel);
+ glLabelObjectEXT(GL_BUFFER, buffer, 0, NULL);
+ glGetObjectLabelEXT(GL_BUFFER, buffer, TestLabelLen + 1, &length, label);
+
+ if (length != 0 || (strcmp("", label) != 0)) {
+ fprintf(stderr, "Setting label to NULL should remove the label\n");
+ printf(" actual label: %s actual length: %i\n", label, length);
+ pass = false;
+ }
+
+ /* An INVALID_ENUM error is generated by ObjectLabel if <identifier> is not
+ * one of the object types.
+ */
+ glLabelObjectEXT(GL_ARRAY_BUFFER, buffer, 0, TestLabel);
+
+ if (!piglit_check_gl_error(GL_INVALID_ENUM)) {
+ fprintf(stderr, "GL_INVALID_ENUM should be generated when the LabelObject identifier is invalid\n");
+ pass = false;
+ }
+
+ /* INVALID_VALUE is generated by LabelObjectEXT if <length> is less than zero. */
+ glLabelObjectEXT(GL_BUFFER, buffer, -1, TestLabel);
+
+ if (!piglit_check_gl_error(GL_INVALID_VALUE)) {
+ fprintf(stderr, "GL_INVALID_VALUE should be generated when the LabelObject length is less than 0\n");
+ pass = false;
+ }
+
+ /* INVALID_OPERATION is generated by LabelObjectEXT
+ * if the type of <object> does not match <type>.
+ */
+ invalidBufferName = buffer;
+ glDeleteBuffers(1, &buffer);
+ glLabelObjectEXT(GL_BUFFER, invalidBufferName, 0, TestLabel);
+
+ if (!piglit_check_gl_error(GL_INVALID_OPERATION)) {
+ fprintf(stderr, "GL_INVALID_OPERATION should be generated when the LabelObject name is invalid\n");
+ pass = false;
+ }
+
+ return pass;
+}
+
+static bool
+test_get_object_label()
+{
+ #define numBuffers 4
+ GLsizei length;
+ GLuint buffers[numBuffers];
+ GLuint invalidBufferName;
+ GLchar label[TestLabelLen + 1];
+ bool pass = true;
+
+ enum test_object_indices {
+ TEST_BUFSIZE_IDX, TEST_NO_LABEL_IDX, TEST_NULL_LABEL_IDX, TEST_NULL_LENGTH_IDX
+ };
+
+ puts("Test GetObjectLabel");
+
+ glGenBuffers(numBuffers, buffers);
+
+ /* The maximum number of characters that may
+ * be written into <label>, including the null terminator, is specified by
+ * <bufSize>.
+ */
+ glBindBuffer(GL_ARRAY_BUFFER, buffers[TEST_BUFSIZE_IDX]);
+ glLabelObjectEXT(GL_BUFFER, buffers[TEST_BUFSIZE_IDX], 0, TestLabel);
+ glGetObjectLabelEXT(GL_BUFFER, buffers[TEST_BUFSIZE_IDX], TestLabelLen, &length, label);
+
+ if (length != 9 || (strcmp("Test Labe", label) != 0)) {
+ fprintf(stderr, "BufSize should limit the maximum label length to 9\n");
+ printf(" actual label: %s actual length: %i\n", label, length);
+ pass = false;
+ }
+
+ /* If no debug label was specified for the object then <label>
+ * will contain a null-terminated empty string, and zero will be returned
+ * in <length>.
+ */
+ glBindBuffer(GL_ARRAY_BUFFER, buffers[TEST_NO_LABEL_IDX]);
+ glGetObjectLabelEXT(GL_BUFFER, buffers[TEST_NO_LABEL_IDX], TestLabelLen + 1, &length, label);
+
+ if (length != 0 || (strcmp("", label) != 0)) {
+ fprintf(stderr, "Label should be empty and length 0\n");
+ printf(" actual label: %s actual length: %i\n", label, length);
+ pass = false;
+ }
+
+ /* If <label> is NULL and <length> is non-NULL then no string
+ * will be returned and the length of the label will be returned in
+ * <length>.
+ */
+ glBindBuffer(GL_ARRAY_BUFFER, buffers[TEST_NULL_LABEL_IDX]);
+ glLabelObjectEXT(GL_BUFFER, buffers[TEST_NULL_LABEL_IDX], 0, TestLabel);
+ glGetObjectLabelEXT(GL_BUFFER, buffers[TEST_NULL_LABEL_IDX], TestLabelLen + 1, &length, NULL);
+
+ if (length != TestLabelLen) {
+ fprintf(stderr, "Label length should be %i\n", TestLabelLen);
+ printf(" actual length: %i\n", length);
+ pass = false;
+ }
+
+ /* If <length> is NULL, no length is returned.
+ */
+ glBindBuffer(GL_ARRAY_BUFFER, buffers[TEST_NULL_LENGTH_IDX]);
+ glLabelObjectEXT(GL_BUFFER, buffers[TEST_NULL_LENGTH_IDX], 0, TestLabel);
+ glGetObjectLabelEXT(GL_BUFFER, buffers[TEST_NULL_LENGTH_IDX], TestLabelLen + 1, NULL, label);
+
+ if (strcmp(TestLabel, label) != 0) {
+ fprintf(stderr, "Label doent match expected string when length NULL\n");
+ printf(" label: %s expected: %s\n", label, TestLabel);
+ pass = false;
+ }
+
+ /* An INVALID_ENUM error is generated by GetObjectLabel if identifier is not
+ * one of the valid object types
+ */
+ glGetObjectLabelEXT(GL_ARRAY_BUFFER, buffers[TEST_NULL_LENGTH_IDX], TestLabelLen + 1, &length, label);
+
+ if (!piglit_check_gl_error(GL_INVALID_ENUM)) {
+ fprintf(stderr, "GL_INVALID_ENUM should be generated when GetObjectLabel identifier is invalid\n");
+ pass = false;
+ }
+
+ /* INVALID_VALUE is generated by GetObjectLabelEXT if <bufSize> is less than zero. */
+ glGetObjectLabelEXT(GL_BUFFER, buffers[TEST_NULL_LENGTH_IDX], -1, &length, label);
+
+ if (!piglit_check_gl_error(GL_INVALID_VALUE)) {
+ fprintf(stderr, "GL_INVALID_VALUE should be generated when GetObjectLabel bufSize is less than 0\n");
+ pass = false;
+ }
+
+ /* INVALID_OPERATION is generated by GetObjectLabelEXT
+ * if the type of <object> does not match <type>.
+ */
+ invalidBufferName = buffers[TEST_NULL_LENGTH_IDX];
+ glDeleteBuffers(numBuffers, buffers);
+ glGetObjectLabelEXT(GL_BUFFER, invalidBufferName, TestLabelLen + 1, &length, label);
+
+ if (!piglit_check_gl_error(GL_INVALID_OPERATION)) {
+ fprintf(stderr, "GL_INVALID_OPERATION should be generated when GetObjectLabel name is invalid\n");
+ pass = false;
+ }
+
+ return pass;
+}
+
+void piglit_init(int argc, char **argv)
+{
+ bool pass = true;
+
+#ifdef PIGLIT_USE_OPENGL
+ piglit_require_gl_version(11);
+#endif
+ piglit_require_extension("GL_EXT_debug_label");
+
+ pass = test_object_label_types() && pass;
+ pass = test_object_label() && pass;
+ pass = test_get_object_label() && pass;
+
+ piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);
+}
diff --git a/tests/spec/ext_disjoint_timer_query/simple-query.c b/tests/spec/ext_disjoint_timer_query/simple-query.c
index 17d054ce9..b7e4bb31e 100644
--- a/tests/spec/ext_disjoint_timer_query/simple-query.c
+++ b/tests/spec/ext_disjoint_timer_query/simple-query.c
@@ -24,7 +24,7 @@
/**
* @file
* Tests GL_EXT_disjoint_timer_query extension. Test does not to cover
- * the whole API as that is tested throughly by existing query tests for
+ * the whole API as that is tested thoroughly by existing query tests for
* desktop GL. Main objective is to test that timer queries work on OpenGL
* ES 2.0 and we can get GL_GPU_DISJOINT_EXT value from the driver.
*/
@@ -132,7 +132,7 @@ piglit_display(void)
glGetQueryObjectui64vEXT(query, GL_QUERY_RESULT_EXT, &time);
- /* Check if disjoint operation occured. */
+ /* Check if disjoint operation occurred. */
glGetInteger64vEXT(GL_GPU_DISJOINT_EXT, &disjoint);
if (!piglit_check_gl_error(GL_NO_ERROR))
piglit_report_result(PIGLIT_FAIL);
diff --git a/tests/spec/ext_external_objects/helpers.c b/tests/spec/ext_external_objects/helpers.c
index 661da8d2f..897cb8a09 100644
--- a/tests/spec/ext_external_objects/helpers.c
+++ b/tests/spec/ext_external_objects/helpers.c
@@ -55,22 +55,7 @@ check_bound_fbo_status(void)
{
GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
if (status != GL_FRAMEBUFFER_COMPLETE) {
- switch(status) {
- case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT:
- fprintf(stderr, "GL FBO status: GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT\n");
- break;
- case GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS:
- fprintf(stderr, "GL FBO status: GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS\n");
- break;
- case GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:
- fprintf(stderr, "GL FBO status: GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT\n");
- break;
- case GL_FRAMEBUFFER_UNSUPPORTED:
- fprintf(stderr, "GL FBO status: GL_FRAMEBUFFER_UNSUPPORTED\n");
- break;
- default:
- fprintf(stderr, "GL FBO status: Unknown\n");
- }
+ fprintf(stderr, "GL FBO status: %s\n", piglit_get_gl_enum_name(status));
return false;
}
return true;
diff --git a/tests/spec/ext_external_objects/params.h b/tests/spec/ext_external_objects/params.h
index 87f75059e..ca9ff8c3c 100644
--- a/tests/spec/ext_external_objects/params.h
+++ b/tests/spec/ext_external_objects/params.h
@@ -29,9 +29,6 @@
#include "interop.h"
-uint32_t w;
-uint32_t h;
-uint32_t d = 1;
uint32_t num_samples = 1;
uint32_t num_levels = 1;
uint32_t num_layers = 1;
diff --git a/tests/spec/ext_external_objects/semaphore-api-errors.c b/tests/spec/ext_external_objects/semaphore-api-errors.c
index e20276a5f..cf8fa3d3d 100644
--- a/tests/spec/ext_external_objects/semaphore-api-errors.c
+++ b/tests/spec/ext_external_objects/semaphore-api-errors.c
@@ -51,7 +51,7 @@ test_gen_semaphores_value_errors()
static bool
test_delete_semaphores_value_errors()
{
- GLuint sem;
+ GLuint sem = 0;
glDeleteSemaphoresEXT(-1, &sem);
diff --git a/tests/spec/ext_external_objects/vk.c b/tests/spec/ext_external_objects/vk.c
index 7c7bf619c..d5ff36097 100644
--- a/tests/spec/ext_external_objects/vk.c
+++ b/tests/spec/ext_external_objects/vk.c
@@ -235,7 +235,7 @@ create_renderpass(struct vk_ctx *ctx,
struct vk_image_props *color_img_props,
struct vk_image_props *depth_img_props)
{
- uint32_t num_attachments = 2;
+ uint32_t num_attachments = depth_img_props ? 2 : 1;
VkAttachmentDescription att_dsc[2];
VkAttachmentReference att_rfc[2];
VkSubpassDescription subpass_dsc[1];
@@ -253,21 +253,24 @@ create_renderpass(struct vk_ctx *ctx,
att_dsc[0].stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE;
att_dsc[0].stencilStoreOp = VK_ATTACHMENT_STORE_OP_DONT_CARE;
- att_dsc[1].samples = get_num_samples(depth_img_props->num_samples);
- /* We might want to reuse a depth buffer */
- if (depth_img_props->in_layout != VK_IMAGE_LAYOUT_UNDEFINED) {
- att_dsc[1].loadOp = VK_ATTACHMENT_LOAD_OP_LOAD;
- att_dsc[1].stencilLoadOp = VK_ATTACHMENT_LOAD_OP_LOAD;
- }
- else {
- att_dsc[1].loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR;
- att_dsc[1].stencilLoadOp = VK_ATTACHMENT_LOAD_OP_CLEAR;
+ if (depth_img_props) {
+
+ att_dsc[1].samples = get_num_samples(depth_img_props->num_samples);
+ /* We might want to reuse a depth buffer */
+ if (depth_img_props->in_layout != VK_IMAGE_LAYOUT_UNDEFINED) {
+ att_dsc[1].loadOp = VK_ATTACHMENT_LOAD_OP_LOAD;
+ att_dsc[1].stencilLoadOp = VK_ATTACHMENT_LOAD_OP_LOAD;
+ }
+ else {
+ att_dsc[1].loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR;
+ att_dsc[1].stencilLoadOp = VK_ATTACHMENT_LOAD_OP_CLEAR;
+ }
+ att_dsc[1].storeOp = VK_ATTACHMENT_STORE_OP_STORE;
+ att_dsc[1].stencilStoreOp = VK_ATTACHMENT_STORE_OP_STORE;
+ att_dsc[1].initialLayout = depth_img_props->in_layout;
+ att_dsc[1].finalLayout = depth_img_props->end_layout;
+ att_dsc[1].format = depth_img_props->format;
}
- att_dsc[1].storeOp = VK_ATTACHMENT_STORE_OP_STORE;
- att_dsc[1].stencilStoreOp = VK_ATTACHMENT_STORE_OP_STORE;
- att_dsc[1].initialLayout = depth_img_props->in_layout;
- att_dsc[1].finalLayout = depth_img_props->end_layout;
- att_dsc[1].format = depth_img_props->format;
/* VkAttachmentReference */
memset(att_rfc, 0, num_attachments * sizeof att_rfc[0]);
@@ -275,15 +278,20 @@ create_renderpass(struct vk_ctx *ctx,
att_rfc[0].layout = color_img_props->tiling == VK_IMAGE_TILING_OPTIMAL ? VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL : VK_IMAGE_LAYOUT_GENERAL;
att_rfc[0].attachment = 0;
- att_rfc[1].layout = depth_img_props->tiling == VK_IMAGE_TILING_OPTIMAL ? VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL : VK_IMAGE_LAYOUT_GENERAL;
- att_rfc[1].attachment = 1;
+ if (depth_img_props) {
+ att_rfc[1].layout = depth_img_props->tiling == VK_IMAGE_TILING_OPTIMAL ? VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL : VK_IMAGE_LAYOUT_GENERAL;
+ att_rfc[1].attachment = 1;
+ }
/* VkSubpassDescription */
memset(&subpass_dsc, 0, sizeof subpass_dsc);
subpass_dsc[0].pipelineBindPoint = VK_PIPELINE_BIND_POINT_GRAPHICS;
subpass_dsc[0].colorAttachmentCount = 1;
subpass_dsc[0].pColorAttachments = &att_rfc[0];
- subpass_dsc[0].pDepthStencilAttachment = &att_rfc[1];
+
+ if (depth_img_props) {
+ subpass_dsc[0].pDepthStencilAttachment = &att_rfc[1];
+ }
/* VkRenderPassCreateInfo */
memset(&rpass_info, 0, sizeof rpass_info);
@@ -405,7 +413,7 @@ create_framebuffer(struct vk_ctx *ctx,
VkImageViewType view_type = get_image_view_type(&color_att->props);
VkImageView atts[2];
- if (!color_att->obj.img || !depth_att->obj.img) {
+ if (!color_att->obj.img || (depth_att && !depth_att->obj.img)) {
fprintf(stderr, "Invalid framebuffer attachment image.\n");
goto fail;
}
@@ -443,30 +451,34 @@ create_framebuffer(struct vk_ctx *ctx,
goto fail;
}
- /* depth view */
- memset(&sr, 0, sizeof sr);
- sr.aspectMask = get_aspect_from_depth_format(depth_att->props.format);
- sr.baseMipLevel = 0;
- sr.levelCount = depth_att->props.num_levels ? depth_att->props.num_levels : 1;
- sr.baseArrayLayer = 0;
- sr.layerCount = depth_att->props.num_layers ? depth_att->props.num_layers : 1;
-
- memset(&depth_info, 0, sizeof depth_info);
- depth_info.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO;
- depth_info.image = depth_att->obj.img;
- depth_info.viewType = depth_att->props.num_layers > 1 ? VK_IMAGE_VIEW_TYPE_2D_ARRAY : VK_IMAGE_VIEW_TYPE_2D;
- depth_info.viewType = VK_IMAGE_VIEW_TYPE_2D;
- depth_info.format = depth_att->props.format;
- depth_info.subresourceRange = sr;
-
- if (vkCreateImageView(ctx->dev, &depth_info, 0, &depth_att->obj.img_view) != VK_SUCCESS) {
- fprintf(stderr, "Failed to create depth image view for framebuffer.\n");
- vk_destroy_ext_image(ctx, &depth_att->obj);
- goto fail;
+ if (depth_att) {
+ /* depth view */
+ memset(&sr, 0, sizeof sr);
+ sr.aspectMask = get_aspect_from_depth_format(depth_att->props.format);
+ sr.baseMipLevel = 0;
+ sr.levelCount = depth_att->props.num_levels ? depth_att->props.num_levels : 1;
+ sr.baseArrayLayer = 0;
+ sr.layerCount = depth_att->props.num_layers ? depth_att->props.num_layers : 1;
+
+ memset(&depth_info, 0, sizeof depth_info);
+ depth_info.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO;
+ depth_info.image = depth_att->obj.img;
+ depth_info.viewType = depth_att->props.num_layers > 1 ? VK_IMAGE_VIEW_TYPE_2D_ARRAY : VK_IMAGE_VIEW_TYPE_2D;
+ depth_info.viewType = VK_IMAGE_VIEW_TYPE_2D;
+ depth_info.format = depth_att->props.format;
+ depth_info.subresourceRange = sr;
+
+ if (vkCreateImageView(ctx->dev, &depth_info, 0, &depth_att->obj.img_view) != VK_SUCCESS) {
+ fprintf(stderr, "Failed to create depth image view for framebuffer.\n");
+ vk_destroy_ext_image(ctx, &depth_att->obj);
+ goto fail;
+ }
}
atts[0] = color_att->obj.img_view;
- atts[1] = depth_att->obj.img_view;
+
+ if (depth_att)
+ atts[1] = depth_att->obj.img_view;
memset(&fb_info, 0, sizeof fb_info);
fb_info.sType = VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO;
@@ -474,7 +486,7 @@ create_framebuffer(struct vk_ctx *ctx,
fb_info.width = color_att->props.w;
fb_info.height = color_att->props.h;
fb_info.layers = color_att->props.num_layers ? color_att->props.num_layers : 1;
- fb_info.attachmentCount = 2;
+ fb_info.attachmentCount = depth_att ? 2 : 1;
fb_info.pAttachments = atts;
if (vkCreateFramebuffer(ctx->dev, &fb_info, 0, &renderer->fb) != VK_SUCCESS)
@@ -1221,7 +1233,7 @@ vk_create_renderer(struct vk_ctx *ctx,
if (vert_info)
renderer->vertex_info = *vert_info;
- renderer->renderpass = create_renderpass(ctx, &color_att->props, &depth_att->props);
+ renderer->renderpass = create_renderpass(ctx, &color_att->props, depth_att ? &depth_att->props : NULL);
if (renderer->renderpass == VK_NULL_HANDLE)
goto fail;
@@ -1669,7 +1681,7 @@ vk_clear_color(struct vk_ctx *ctx,
barrier->sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER;
bool is_depth =
- get_aspect_from_depth_format(att->props.format) != VK_NULL_HANDLE;
+ get_aspect_from_depth_format(att->props.format) != (uintptr_t)VK_NULL_HANDLE;
barrier->oldLayout = is_depth ?
VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL :
diff --git a/tests/spec/ext_external_objects/vk_buf_exchange.c b/tests/spec/ext_external_objects/vk_buf_exchange.c
index f564c68d0..9034d1eca 100644
--- a/tests/spec/ext_external_objects/vk_buf_exchange.c
+++ b/tests/spec/ext_external_objects/vk_buf_exchange.c
@@ -83,9 +83,6 @@ vk_cleanup(void);
static bool
gl_init();
-static void
-gl_cleanup(void);
-
static struct vk_ctx vk_core;
static struct vk_image_att vk_color_att;
static struct vk_image_att vk_depth_att;
@@ -112,10 +109,7 @@ piglit_init(int argc, char **argv)
atexit(cleanup);
- w = piglit_width;
- h = piglit_height;
-
- if (!vk_init(w, h, d, num_samples, num_levels, num_layers,
+ if (!vk_init(piglit_width, piglit_height, 1, num_samples, num_levels, num_layers,
color_format, depth_format,
color_tiling, depth_tiling,
color_in_layout, depth_in_layout,
@@ -135,9 +129,9 @@ piglit_init(int argc, char **argv)
}
vk_draw(&vk_core, 0, &vk_rnd, vk_fb_color, 4, 0,
- false, false, NULL, 0, 0, 0, w, h);
+ false, false, NULL, 0, 0, 0, piglit_width, piglit_height);
- vk_copy_image_to_buffer(&vk_core, &vk_color_att, &vk_bo, w, h);
+ vk_copy_image_to_buffer(&vk_core, &vk_color_att, &vk_bo, piglit_width, piglit_height);
if (!gl_init()) {
fprintf(stderr, "Failed to initialize OpenGL.\n");
@@ -294,7 +288,7 @@ gl_init()
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, gl_bo);
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F, w, h, 0, GL_RGBA, GL_FLOAT, 0);
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F, piglit_width, piglit_height, 0, GL_RGBA, GL_FLOAT, 0);
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
glBindTexture(GL_TEXTURE_2D, 0);
@@ -304,7 +298,6 @@ gl_init()
static void
cleanup(void)
{
- gl_cleanup();
vk_cleanup();
}
@@ -317,11 +310,3 @@ vk_cleanup(void)
vk_destroy_buffer(&vk_core, &vk_bo);
vk_cleanup_ctx(&vk_core);
}
-
-static void
-gl_cleanup(void)
-{
- glDeleteProgram(gl_prog);
- glDeleteMemoryObjectsEXT(1, &gl_memobj);
- glDeleteBuffers(1, &gl_bo);
-}
diff --git a/tests/spec/ext_external_objects/vk_depth_display.c b/tests/spec/ext_external_objects/vk_depth_display.c
index dea5f1287..ecfd5e16f 100644
--- a/tests/spec/ext_external_objects/vk_depth_display.c
+++ b/tests/spec/ext_external_objects/vk_depth_display.c
@@ -56,9 +56,6 @@ static void
vk_subtest_cleanup(void);
static void
-gl_cleanup(void);
-
-static void
gl_subtest_cleanup(void);
static void
@@ -136,9 +133,6 @@ piglit_init(int argc, char **argv)
atexit(cleanup);
- w = piglit_width;
- h = piglit_height;
-
if (!vk_init()) {
fprintf(stderr, "Failed to initialize Vulkan, skipping the test.\n");
piglit_report_result(PIGLIT_SKIP);
@@ -187,7 +181,7 @@ run_subtest(int case_num)
vk_draw(&vk_core,
0, &vk_rnd,
vk_fb_color,
- 4, 0, false, false, &vk_depth_att, 1, 0, 0, w, h);
+ 4, 0, false, false, &vk_depth_att, 1, 0, 0, piglit_width, piglit_height);
/* interoperability */
if (!gl_create_mem_obj_from_vk_mem(&vk_core, &vk_depth_att.obj.mobj,
@@ -223,7 +217,7 @@ run_subtest(int case_num)
/* the result must be: a blue quad that has the green framebuffer
* color in the middle */
- if (!piglit_probe_pixel_rgb(w / 2, h / 2, green))
+ if (!piglit_probe_pixel_rgb(piglit_width / 2, piglit_height / 2, green))
goto fail;
if (!piglit_probe_pixel_rgb(0, 0, blue) ||
@@ -281,7 +275,7 @@ static bool
vk_subtest_init(int case_num)
{
if (!vk_fill_ext_image_props(&vk_core,
- w, h, d,
+ piglit_width, piglit_height, 1,
num_samples,
num_levels,
num_layers,
@@ -300,7 +294,7 @@ vk_subtest_init(int case_num)
}
if (!vk_fill_ext_image_props(&vk_core,
- w, h, d,
+ piglit_width, piglit_height, 1,
num_samples,
num_levels,
num_layers,
@@ -411,21 +405,7 @@ vk_cleanup(void)
}
static void
-gl_cleanup(void)
-{
- glBindTexture(GL_TEXTURE_2D, 0);
- glUseProgram(0);
-
- glDeleteTextures(1, &gl_color_tex);
- glDeleteFramebuffers(1, &gl_fbo);
-
- glDeleteProgram(gl_prog);
- glDeleteProgram(gl_rnd2fbo_prog);
-}
-
-static void
cleanup(void)
{
- gl_cleanup();
vk_cleanup();
}
diff --git a/tests/spec/ext_external_objects/vk_image_display.c b/tests/spec/ext_external_objects/vk_image_display.c
index 03543109b..869fdb028 100644
--- a/tests/spec/ext_external_objects/vk_image_display.c
+++ b/tests/spec/ext_external_objects/vk_image_display.c
@@ -83,12 +83,8 @@ vk_cleanup(void);
static bool
gl_init();
-static void
-gl_cleanup(void);
-
static struct vk_ctx vk_core;
static struct vk_image_att vk_color_att;
-static struct vk_image_att vk_depth_att;
static struct vk_renderer vk_rnd;
static GLenum gl_target = GL_TEXTURE_2D;
@@ -112,10 +108,7 @@ void piglit_init(int argc, char **argv)
atexit(cleanup);
- w = piglit_width;
- h = piglit_height;
-
- if (!vk_init(w, h, d, num_samples, num_levels, num_layers,
+ if (!vk_init(piglit_width, piglit_height, 1, num_samples, num_levels, num_layers,
color_format, depth_format,
color_tiling, depth_tiling,
color_in_layout, depth_in_layout,
@@ -171,10 +164,10 @@ piglit_display(void)
glFlush();
}
- struct vk_image_att images[] = { vk_color_att, vk_depth_att };
+ struct vk_image_att images[] = { vk_color_att };
vk_draw(&vk_core, 0, &vk_rnd, vk_fb_color, 4, &vk_sem,
- vk_sem_has_wait, vk_sem_has_signal, images, ARRAY_SIZE(images), 0, 0, w, h);
+ vk_sem_has_wait, vk_sem_has_signal, images, ARRAY_SIZE(images), 0, 0, piglit_width, piglit_height);
layout = gl_get_layout_from_vk(color_end_layout);
if (vk_sem_has_signal) {
@@ -256,27 +249,6 @@ vk_init(uint32_t w,
return false;
}
- /* depth image */
- if (!vk_fill_ext_image_props(&vk_core,
- w, h, d,
- num_samples,
- num_levels,
- num_layers,
- depth_format,
- depth_tiling,
- depth_in_layout,
- depth_end_layout,
- false,
- &vk_depth_att.props)) {
- fprintf(stderr, "Unsupported depth image properties.\n");
- return false;
- }
-
- if (!vk_create_ext_image(&vk_core, &vk_depth_att.props, &vk_depth_att.obj)) {
- fprintf(stderr, "Failed to create depth image.\n");
- goto fail;
- }
-
/* load shaders */
if (!(vs_src = load_shader(VK_BANDS_VERT, &vs_sz)))
goto fail;
@@ -287,7 +259,7 @@ vk_init(uint32_t w,
/* create Vulkan renderer */
if (!vk_create_renderer(&vk_core, vs_src, vs_sz, fs_src, fs_sz,
false, false,
- &vk_color_att, &vk_depth_att, 0, &vk_rnd)) {
+ &vk_color_att, NULL, 0, &vk_rnd)) {
fprintf(stderr, "Failed to create Vulkan renderer.\n");
goto fail;
}
@@ -313,7 +285,6 @@ static void
vk_cleanup(void)
{
vk_destroy_ext_image(&vk_core, &vk_color_att.obj);
- vk_destroy_ext_image(&vk_core, &vk_depth_att.obj);
vk_destroy_renderer(&vk_core, &vk_rnd);
vk_destroy_semaphores(&vk_core, &vk_sem);
@@ -324,7 +295,6 @@ vk_cleanup(void)
static void
cleanup(void)
{
- gl_cleanup();
vk_cleanup();
}
@@ -337,17 +307,3 @@ gl_init()
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
return glGetError() == GL_NO_ERROR;
}
-
-static void
-gl_cleanup(void)
-{
- glBindTexture(gl_target, 0);
-
- glDeleteTextures(1, &gl_tex);
- glDeleteProgram(gl_prog);
-
- glDeleteSemaphoresEXT(1, &gl_sem.gl_frame_ready);
- glDeleteSemaphoresEXT(1, &gl_sem.vk_frame_done);
-
- glDeleteMemoryObjectsEXT(1, &gl_mem_obj);
-}
diff --git a/tests/spec/ext_external_objects/vk_image_display_multiple_textures.c b/tests/spec/ext_external_objects/vk_image_display_multiple_textures.c
index 3916b009d..00ff26f17 100644
--- a/tests/spec/ext_external_objects/vk_image_display_multiple_textures.c
+++ b/tests/spec/ext_external_objects/vk_image_display_multiple_textures.c
@@ -83,9 +83,6 @@ vk_cleanup(void);
static bool
gl_init();
-static void
-gl_cleanup(void);
-
static struct vk_ctx vk_core;
static struct vk_image_att vk_color_att;
static struct vk_image_att vk_depth_att;
@@ -115,10 +112,7 @@ void piglit_init(int argc, char **argv)
atexit(cleanup);
- w = piglit_width;
- h = piglit_height;
-
- if (!vk_init(w, h, d, num_samples, num_levels, num_layers,
+ if (!vk_init(piglit_width, piglit_height, 1, num_samples, num_levels, num_layers,
color_format, depth_format,
color_tiling, depth_tiling,
color_in_layout, depth_in_layout,
@@ -136,7 +130,7 @@ void piglit_init(int argc, char **argv)
struct vk_image_att images[] = { vk_color_att, vk_depth_att };
vk_draw(&vk_core, 0, &vk_rnd, vk_fb_color, 4, 0,
- false, false, images, ARRAY_SIZE(images), 0, 0, w, h);
+ false, false, images, ARRAY_SIZE(images), 0, 0, piglit_width, piglit_height);
/* generate NUM_TEX textures */
for (i = 0; i < NUM_TEX; i++) {
@@ -318,7 +312,6 @@ vk_cleanup(void)
static void
cleanup(void)
{
- gl_cleanup();
vk_cleanup();
}
@@ -332,14 +325,3 @@ gl_init()
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
return glGetError() == GL_NO_ERROR;
}
-
-static void
-gl_cleanup(void)
-{
- glBindTexture(gl_target, 0);
-
- glDeleteTextures(NUM_TEX, gl_textures);
- glDeleteProgram(gl_prog);
-
- glDeleteMemoryObjectsEXT(1, &gl_mem_obj);
-}
diff --git a/tests/spec/ext_external_objects/vk_image_display_overwrite.c b/tests/spec/ext_external_objects/vk_image_display_overwrite.c
index 192bf85e3..09ba7f0db 100644
--- a/tests/spec/ext_external_objects/vk_image_display_overwrite.c
+++ b/tests/spec/ext_external_objects/vk_image_display_overwrite.c
@@ -107,9 +107,6 @@ vk_cleanup(void);
static bool
gl_init();
-static void
-gl_cleanup(void);
-
static struct vk_ctx vk_core;
static struct vk_image_att vk_color_att;
static struct vk_image_att vk_depth_att;
@@ -142,10 +139,7 @@ void piglit_init(int argc, char **argv)
atexit(cleanup);
- w = piglit_width;
- h = piglit_height;
-
- if (!vk_init(w, h, d, num_samples, num_levels, num_layers,
+ if (!vk_init(piglit_width, piglit_height, 1, num_samples, num_levels, num_layers,
color_format, depth_format,
color_tiling, depth_tiling,
color_in_layout, depth_in_layout,
@@ -205,7 +199,7 @@ piglit_display(void)
vk_draw(&vk_core, 0, &vk_rnd, vk_fb_color, 4, &vk_sem,
vk_sem_has_wait, vk_sem_has_signal, images, ARRAY_SIZE(images),
- 0, 0, w, h);
+ 0, 0, piglit_width, piglit_height);
layout = gl_get_layout_from_vk(color_end_layout);
if (vk_sem_has_signal) {
@@ -221,7 +215,7 @@ piglit_display(void)
glBindFramebuffer(GL_FRAMEBUFFER, 0);
glFinish();
- vk_copy_image_to_buffer(&vk_core, &vk_color_att, &vk_bo, w, h);
+ vk_copy_image_to_buffer(&vk_core, &vk_color_att, &vk_bo, piglit_width, piglit_height);
if (vkMapMemory(vk_core.dev, vk_bo.mobj.mem, 0,
vk_bo.mobj.mem_sz, 0, &pixels) != VK_SUCCESS) {
fprintf(stderr, "Failed to map Vulkan image memory.\n");
@@ -232,7 +226,7 @@ piglit_display(void)
* pixels we've just read from Vulkan memory as texture data
* in a new OpenGL texture */
glBindTexture(gl_target, gl_disp_tex);
- glTexSubImage2D(gl_target, 0, 0, 0, w, h, GL_RGBA, GL_FLOAT, pixels);
+ glTexSubImage2D(gl_target, 0, 0, 0, piglit_width, piglit_height, GL_RGBA, GL_FLOAT, pixels);
glFinish();
vkUnmapMemory(vk_core.dev, vk_bo.mobj.mem);
@@ -387,7 +381,6 @@ vk_cleanup(void)
static void
cleanup(void)
{
- gl_cleanup();
vk_cleanup();
}
@@ -419,26 +412,10 @@ gl_init()
glBindTexture(gl_target, gl_disp_tex);
glTexParameteri(gl_target, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(gl_target, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- glTexImage2D(gl_target, 0, gl_tex_storage_format, w, h, 0, GL_RGBA, GL_FLOAT, 0);
+ glTexImage2D(gl_target, 0, gl_tex_storage_format, piglit_width, piglit_height, 0, GL_RGBA, GL_FLOAT, 0);
glBindTexture(gl_target, 0);
glClearColor(0.1, 0.1, 0.1, 1.0);
glClear(GL_COLOR_BUFFER_BIT);
return glGetError() == GL_NO_ERROR;
}
-
-static void
-gl_cleanup(void)
-{
- glBindTexture(gl_target, 0);
-
- glDeleteTextures(1, &gl_tex);
- glDeleteProgram(gl_prog);
-
- glDeleteSemaphoresEXT(1, &gl_sem.gl_frame_ready);
- glDeleteSemaphoresEXT(1, &gl_sem.vk_frame_done);
-
- glDeleteFramebuffers(1, &gl_fbo);
-
- glDeleteMemoryObjectsEXT(1, &gl_mem_obj);
-}
diff --git a/tests/spec/ext_external_objects/vk_image_overwrite.c b/tests/spec/ext_external_objects/vk_image_overwrite.c
index d5fe3a0d8..a4aefc217 100644
--- a/tests/spec/ext_external_objects/vk_image_overwrite.c
+++ b/tests/spec/ext_external_objects/vk_image_overwrite.c
@@ -116,9 +116,6 @@ static bool
gl_draw_texture(enum fragment_type fs_type, uint32_t w, uint32_t h);
static void
-gl_cleanup(void);
-
-static void
cleanup(void);
void
@@ -167,7 +164,7 @@ run_subtest(int case_num)
const float color_prb[] = { 0.0, 1.0, 0.0, 1.0 };
GLint loc = -1;
- if (!vk_set_image_props(piglit_width, piglit_height, d,
+ if (!vk_set_image_props(piglit_width, piglit_height, 1,
num_samples, num_levels,
vk_gl_format[case_num].vkformat,
vk_gl_format[case_num].tiling)) {
@@ -201,7 +198,6 @@ run_subtest(int case_num)
"%s: Failed to create texture from GL memory object.",
vk_gl_format[case_num].name);
vk_destroy_ext_image(&vk_core, &vk_img_obj);
- gl_cleanup();
return PIGLIT_FAIL;
}
@@ -210,7 +206,6 @@ run_subtest(int case_num)
"%s: Failed to initialize OpenGL FBO/RBO",
vk_gl_format[case_num].name);
vk_destroy_ext_image(&vk_core, &vk_img_obj);
- gl_cleanup();
return PIGLIT_FAIL;
}
@@ -269,7 +264,6 @@ run_subtest(int case_num)
default:
fprintf(stderr, "Invalid format. Shouldn't reach.\n");
vk_destroy_ext_image(&vk_core, &vk_img_obj);
- gl_cleanup();
return PIGLIT_FAIL;
};
@@ -290,7 +284,6 @@ run_subtest(int case_num)
piglit_present_results();
vk_destroy_ext_image(&vk_core, &vk_img_obj);
- gl_cleanup();
return subtest_result;
}
@@ -353,21 +346,9 @@ gl_draw_texture(enum fragment_type fs_type, uint32_t w, uint32_t h)
}
static void
-gl_cleanup(void)
-{
- glBindTexture(gl_get_target(&vk_img_props), 0);
- glBindFramebuffer(GL_FRAMEBUFFER, 0);
- glUseProgram(0);
-
- glDeleteTextures(1, &gl_tex);
- glDeleteMemoryObjectsEXT(1, &gl_mem_obj);
-}
-
-static void
cleanup(void)
{
vk_cleanup_ctx(&vk_core);
- gl_cleanup();
glDeleteFramebuffers(1, &gl_fbo);
diff --git a/tests/spec/ext_external_objects/vk_pix_buf_update_errors.c b/tests/spec/ext_external_objects/vk_pix_buf_update_errors.c
index 4ae1c9a7b..3570d8829 100644
--- a/tests/spec/ext_external_objects/vk_pix_buf_update_errors.c
+++ b/tests/spec/ext_external_objects/vk_pix_buf_update_errors.c
@@ -82,9 +82,6 @@ vk_cleanup(void);
static bool
gl_init();
-static void
-gl_cleanup(void);
-
static struct vk_ctx vk_core;
static struct vk_image_att vk_color_att;
static struct vk_image_att vk_depth_att;
@@ -342,7 +339,6 @@ gl_init()
static void
cleanup(void)
{
- gl_cleanup();
vk_cleanup();
}
@@ -355,11 +351,3 @@ vk_cleanup(void)
vk_destroy_buffer(&vk_core, &vk_bo);
vk_cleanup_ctx(&vk_core);
}
-
-static void
-gl_cleanup(void)
-{
- glDeleteProgram(gl_prog);
- glDeleteMemoryObjectsEXT(1, &gl_memobj);
- glDeleteBuffers(1, &gl_bo);
-}
diff --git a/tests/spec/ext_external_objects/vk_semaphores.c b/tests/spec/ext_external_objects/vk_semaphores.c
index 8b2a89be3..c7610611b 100644
--- a/tests/spec/ext_external_objects/vk_semaphores.c
+++ b/tests/spec/ext_external_objects/vk_semaphores.c
@@ -82,9 +82,6 @@ vk_cleanup(void);
static bool
gl_init();
-static void
-gl_cleanup(void);
-
static struct vk_ctx vk_core;
static struct vk_image_att vk_color_att;
static struct vk_image_att vk_depth_att;
@@ -113,10 +110,7 @@ void piglit_init(int argc, char **argv)
atexit(cleanup);
- w = piglit_width;
- h = piglit_height;
-
- if (!vk_init(w, h, d, num_samples, num_levels, num_layers,
+ if (!vk_init(piglit_width, piglit_height, 1, num_samples, num_levels, num_layers,
color_format, depth_format,
color_tiling, depth_tiling,
color_in_layout, depth_in_layout,
@@ -158,7 +152,8 @@ void piglit_init(int argc, char **argv)
struct vk_image_att images[] = { vk_color_att, vk_depth_att };
vk_draw(&vk_core, 0, &vk_rnd, vk_fb_color, 4, &vk_sem,
- vk_sem_has_wait, vk_sem_has_signal, images, ARRAY_SIZE(images), 0, 0, w, h);
+ vk_sem_has_wait, vk_sem_has_signal, images, ARRAY_SIZE(images), 0, 0,
+ piglit_width, piglit_height);
layout = gl_get_layout_from_vk(color_end_layout);
if (vk_sem_has_signal) {
@@ -194,7 +189,7 @@ piglit_display(void)
struct vk_image_att images[] = { vk_color_att, vk_depth_att };
vk_clear_color(&vk_core, 0, &vk_rnd, vk_fb_color, 4, &vk_sem,
vk_sem_has_wait, vk_sem_has_signal, images,
- ARRAY_SIZE(images), 0, 0, w, h);
+ ARRAY_SIZE(images), 0, 0, piglit_width, piglit_height);
layout = gl_get_layout_from_vk(color_end_layout);
if (vk_sem_has_signal) {
glWaitSemaphoreEXT(gl_sem.vk_frame_done, 0, 0, 1,
@@ -341,7 +336,6 @@ vk_cleanup(void)
static void
cleanup(void)
{
- gl_cleanup();
vk_cleanup();
}
@@ -354,17 +348,3 @@ gl_init()
glClear(GL_COLOR_BUFFER_BIT);
return glGetError() == GL_NO_ERROR;
}
-
-static void
-gl_cleanup(void)
-{
- glBindTexture(gl_target, 0);
-
- glDeleteTextures(1, &gl_tex);
- glDeleteProgram(gl_prog);
-
- glDeleteSemaphoresEXT(1, &gl_sem.gl_frame_ready);
- glDeleteSemaphoresEXT(1, &gl_sem.vk_frame_done);
-
- glDeleteMemoryObjectsEXT(1, &gl_mem_obj);
-}
diff --git a/tests/spec/ext_external_objects/vk_semaphores2.c b/tests/spec/ext_external_objects/vk_semaphores2.c
index b868951a3..44c921251 100644
--- a/tests/spec/ext_external_objects/vk_semaphores2.c
+++ b/tests/spec/ext_external_objects/vk_semaphores2.c
@@ -112,9 +112,6 @@ vk_cleanup(void);
static bool
gl_init();
-static void
-gl_cleanup(void);
-
static struct vk_ctx vk_core;
static struct vk_image_att vk_color_att;
static struct vk_image_att vk_depth_att;
@@ -144,10 +141,7 @@ void piglit_init(int argc, char **argv)
atexit(cleanup);
- w = piglit_width;
- h = piglit_height;
-
- if (!vk_init(w, h, d, num_samples, num_levels, num_layers,
+ if (!vk_init(piglit_width, piglit_height, 1, num_samples, num_levels, num_layers,
color_format, depth_format,
color_tiling, depth_tiling,
color_in_layout, depth_in_layout,
@@ -215,7 +209,7 @@ piglit_display(void)
struct vk_image_att images[] = { vk_color_att, vk_depth_att };
vk_draw(&vk_core, 0, &vk_rnd, vk_fb_color, 4, &vk_sem,
vk_sem_has_wait, vk_sem_has_signal, images, ARRAY_SIZE(images),
- 0, 0, w, h);
+ 0, 0, piglit_width, piglit_height);
layout = gl_get_layout_from_vk(color_end_layout);
if (vk_sem_has_signal) {
@@ -360,7 +354,6 @@ vk_cleanup(void)
static void
cleanup(void)
{
- gl_cleanup();
vk_cleanup();
}
@@ -392,19 +385,3 @@ gl_init()
glClear(GL_COLOR_BUFFER_BIT);
return glGetError() == GL_NO_ERROR;
}
-
-static void
-gl_cleanup(void)
-{
- glBindTexture(gl_target, 0);
-
- glDeleteTextures(1, &gl_tex);
- glDeleteProgram(gl_prog);
-
- glDeleteSemaphoresEXT(1, &gl_sem.gl_frame_ready);
- glDeleteSemaphoresEXT(1, &gl_sem.vk_frame_done);
-
- glDeleteFramebuffers(1, &gl_fbo);
-
- glDeleteMemoryObjectsEXT(1, &gl_mem_obj);
-}
diff --git a/tests/spec/ext_external_objects/vk_stencil_display.c b/tests/spec/ext_external_objects/vk_stencil_display.c
index 7418592ba..6d579e3e8 100644
--- a/tests/spec/ext_external_objects/vk_stencil_display.c
+++ b/tests/spec/ext_external_objects/vk_stencil_display.c
@@ -56,9 +56,6 @@ static void
vk_subtest_cleanup(void);
static void
-gl_cleanup(void);
-
-static void
gl_subtest_cleanup(void);
static void
@@ -75,7 +72,6 @@ static struct vk_renderer vk_rnd;
static GLuint gl_mem_obj;
static float vk_fb_color[4] = { 1.0, 0.0, 1.0, 1.0 };
-static GLenum gl_target = GL_TEXTURE_2D;
static GLuint vkgl_stencil_tex;
static GLuint gl_fbo;
static GLuint gl_color_tex;
@@ -136,9 +132,6 @@ piglit_init(int argc, char **argv)
atexit(cleanup);
- w = piglit_width;
- h = piglit_height;
-
if (!vk_init()) {
fprintf(stderr, "Failed to initialize Vulkan, skipping the test.\n");
piglit_report_result(PIGLIT_SKIP);
@@ -186,7 +179,7 @@ run_subtest(int case_num)
vk_draw(&vk_core,
0, &vk_rnd,
vk_fb_color,
- 4, 0, false, false, &vk_depth_att, 1, 0, 0, w, h);
+ 4, 0, false, false, &vk_depth_att, 1, 0, 0, piglit_width, piglit_height);
if (!gl_create_mem_obj_from_vk_mem(&vk_core, &vk_depth_att.obj.mobj,
&gl_mem_obj)) {
@@ -219,7 +212,7 @@ run_subtest(int case_num)
0, 0, 1, 1);
assert(glGetError() == GL_NO_ERROR);
- if (!piglit_probe_pixel_rgb(w / 2, h / 2, blue))
+ if (!piglit_probe_pixel_rgb(piglit_width / 2, piglit_height / 2, blue))
goto fail;
if (!piglit_probe_pixel_rgb(0, 0, green) ||
@@ -277,7 +270,7 @@ static bool
vk_subtest_init(int case_num)
{
if (!vk_fill_ext_image_props(&vk_core,
- w, h, d,
+ piglit_width, piglit_height, 1,
num_samples,
num_levels,
num_layers,
@@ -296,7 +289,7 @@ vk_subtest_init(int case_num)
}
if (!vk_fill_ext_image_props(&vk_core,
- w, h, d,
+ piglit_width, piglit_height, 1,
num_samples,
num_levels,
num_layers,
@@ -410,22 +403,8 @@ vk_cleanup(void)
}
static void
-gl_cleanup(void)
-{
- glBindTexture(gl_target, 0);
- glUseProgram(0);
-
- glDeleteTextures(1, &gl_color_tex);
- glDeleteFramebuffers(1, &gl_fbo);
-
- glDeleteProgram(gl_prog);
- glDeleteProgram(gl_rnd2fbo_prog);
-}
-
-static void
cleanup(void)
{
- gl_cleanup();
vk_cleanup();
}
diff --git a/tests/spec/ext_external_objects/vk_vert_buf_reuse.c b/tests/spec/ext_external_objects/vk_vert_buf_reuse.c
index 59879b22f..30129a972 100644
--- a/tests/spec/ext_external_objects/vk_vert_buf_reuse.c
+++ b/tests/spec/ext_external_objects/vk_vert_buf_reuse.c
@@ -60,7 +60,6 @@ static GLuint gl_disp_vk_prog;
static void cleanup();
static void vk_cleanup();
-static void gl_cleanup();
static bool vk_init();
static bool gl_init();
@@ -239,18 +238,9 @@ vk_cleanup()
}
static void
-gl_cleanup()
-{
- glDeleteProgram(gl_prog);
- glDeleteMemoryObjectsEXT(1, &gl_memobj);
- glDeleteBuffers(1, &gl_vk_vb);
-}
-
-static void
cleanup()
{
vk_cleanup();
- gl_cleanup();
}
static bool
diff --git a/tests/spec/ext_external_objects/vk_vert_buf_update_errors.c b/tests/spec/ext_external_objects/vk_vert_buf_update_errors.c
index f0af16854..ab6b9aa9b 100644
--- a/tests/spec/ext_external_objects/vk_vert_buf_update_errors.c
+++ b/tests/spec/ext_external_objects/vk_vert_buf_update_errors.c
@@ -37,7 +37,6 @@ PIGLIT_GL_TEST_CONFIG_END
static void cleanup();
static void vk_cleanup();
-static void gl_cleanup();
static bool vk_init();
static bool gl_init();
@@ -165,7 +164,7 @@ piglit_display(void)
piglit_present_results();
- /* Checking that calling glBufferSubData updates buffer succesfully. */
+ /* Checking that calling glBufferSubData updates buffer successfully. */
glBindBuffer(GL_ARRAY_BUFFER, gl_vk_vb);
glBufferSubData(GL_ARRAY_BUFFER, 0, vk_vb.mobj.mem_sz, checkerboard);
if (glGetError() != GL_NO_ERROR) {
@@ -195,18 +194,9 @@ vk_cleanup()
}
static void
-gl_cleanup()
-{
- glDeleteProgram(gl_prog);
- glDeleteMemoryObjectsEXT(1, &gl_memobj);
- glDeleteBuffers(1, &gl_vk_vb);
-}
-
-static void
cleanup()
{
vk_cleanup();
- gl_cleanup();
}
static bool
diff --git a/tests/spec/ext_framebuffer_multisample/accuracy.cpp b/tests/spec/ext_framebuffer_multisample/accuracy.cpp
index 76cb9e2ee..17667631f 100644
--- a/tests/spec/ext_framebuffer_multisample/accuracy.cpp
+++ b/tests/spec/ext_framebuffer_multisample/accuracy.cpp
@@ -27,12 +27,12 @@
*
* Verify the accuracy of multisample antialiasing.
*
- * This test utilizes the functions defined in common.cpp to verfify the
+ * This test utilizes the functions defined in common.cpp to verify the
* accuracy of MSAA.
*
* The test also accepts the following flags:
*
- * - "small": Causes the MSAA image to be renedered in extremely tiny
+ * - "small": Causes the MSAA image to be rendered in extremely tiny
* (16x16) tiles that are then stitched together. This verifies
* that MSAA works properly on very small buffers (a critical corner
* case on i965).
diff --git a/tests/spec/ext_framebuffer_multisample/blit-multiple-render-targets.cpp b/tests/spec/ext_framebuffer_multisample/blit-multiple-render-targets.cpp
index 2f5a37fba..ac25653fd 100644
--- a/tests/spec/ext_framebuffer_multisample/blit-multiple-render-targets.cpp
+++ b/tests/spec/ext_framebuffer_multisample/blit-multiple-render-targets.cpp
@@ -119,7 +119,7 @@ piglit_display()
glClearColor(0.0, 1.0, 0.0, 1.0);
glClear(GL_COLOR_BUFFER_BIT);
- /* Clear all color attachements of multisample_fbo to blue color */
+ /* Clear all color attachments of multisample_fbo to blue color */
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, multisample_fbo.handle);
glDrawBuffers(6, bufs);
glClearColor(0.0, 0.0, 1.0, 1.0);
diff --git a/tests/spec/ext_framebuffer_multisample/clear.cpp b/tests/spec/ext_framebuffer_multisample/clear.cpp
index c639e160d..b958a80e3 100644
--- a/tests/spec/ext_framebuffer_multisample/clear.cpp
+++ b/tests/spec/ext_framebuffer_multisample/clear.cpp
@@ -264,7 +264,7 @@ piglit_display()
pass = test_clear(1.0, 1.0, 1.0, 0.5, false) && pass;
/* Test with color values compatible with Intel's i965 driver's
- * 'fast clear' constraints. It varifies the 'fast clear' path
+ * 'fast clear' constraints. It verifies the 'fast clear' path
* if supported by the implementation.
*/
pass = test_clear(1.0, 1.0, 1.0, 0.0, true) && pass;
diff --git a/tests/spec/ext_framebuffer_multisample/draw-buffers-common.cpp b/tests/spec/ext_framebuffer_multisample/draw-buffers-common.cpp
index 2e6ca4413..48e1ad4a5 100644
--- a/tests/spec/ext_framebuffer_multisample/draw-buffers-common.cpp
+++ b/tests/spec/ext_framebuffer_multisample/draw-buffers-common.cpp
@@ -227,7 +227,7 @@ shader_compile(bool sample_alpha_to_coverage,
glBindAttribLocation(prog, 0, "pos");
glEnableVertexAttribArray(0);
- /* Linking is rquired after glBindFragDataLocation */
+ /* Linking is required after glBindFragDataLocation */
glLinkProgram(prog);
/* Set up uniforms */
@@ -902,7 +902,7 @@ ms_fbo_and_draw_buffers_setup(int samples,
ms_config.color_internalformat = color_buffer_zero_format;
ms_fbo.setup(ms_config);
- /* Create resolve_fbo with dimensions large enough to accomodate
+ /* Create resolve_fbo with dimensions large enough to accommodate
* all the draw buffers
*/
FboConfig resolve_config(0, pattern_width,
diff --git a/tests/spec/ext_framebuffer_multisample/fast-clear.c b/tests/spec/ext_framebuffer_multisample/fast-clear.c
index c0b249fb9..c5c4fbb64 100644
--- a/tests/spec/ext_framebuffer_multisample/fast-clear.c
+++ b/tests/spec/ext_framebuffer_multisample/fast-clear.c
@@ -27,7 +27,7 @@
* Clears a multisample texture with various formats to various
* different colors and then samples from it in a shader to ensure
* that the expected color is returned. This includes verifying that
- * when there are components missing they are overriden to the right
+ * when there are components missing they are overridden to the right
* value (such as GL_RED should report 0 for green and blue and 1 for
* the alpha). The main reason to do this is that the i965 driver has
* various different code paths to implement a fast clear optimisation
diff --git a/tests/spec/ext_framebuffer_multisample/interpolation.cpp b/tests/spec/ext_framebuffer_multisample/interpolation.cpp
index e57113ea5..32b19b9fd 100644
--- a/tests/spec/ext_framebuffer_multisample/interpolation.cpp
+++ b/tests/spec/ext_framebuffer_multisample/interpolation.cpp
@@ -306,7 +306,7 @@ print_usage_and_exit(char *prog_name)
" where <test_type> is one of:\n"
" non-centroid-disabled: non-centroid varying, MSAA off\n"
" centroid-disabled: centroid varying, MSAA off\n"
- " centroid-edges: centroid behaviour at trinagle edges\n"
+ " centroid-edges: centroid behaviour at triangle edges\n"
" non-centroid-deriv: dFdx/dFdy on non-centroid varying\n"
" non-centroid-deriv-disabled: As above, with MSAA off\n"
" centroid-deriv: dFdx/dFdy on centroid varying\n"
diff --git a/tests/spec/ext_framebuffer_multisample/negative-mismatched-samples.c b/tests/spec/ext_framebuffer_multisample/negative-mismatched-samples.c
index e4851100e..8c546b234 100644
--- a/tests/spec/ext_framebuffer_multisample/negative-mismatched-samples.c
+++ b/tests/spec/ext_framebuffer_multisample/negative-mismatched-samples.c
@@ -90,7 +90,7 @@ test_buffers(GLuint rb0, GLuint samples0,
void
piglit_init(int argc, char **argv)
{
- GLint max_samples, max_draw_buffers;
+ GLint max_samples;
GLuint *rb, fb;
GLint *rb_samples;
bool pass = true;
@@ -102,12 +102,7 @@ piglit_init(int argc, char **argv)
piglit_require_extension("GL_EXT_framebuffer_multisample");
piglit_require_extension("GL_ARB_draw_buffers");
-
- glGetIntegerv(GL_MAX_DRAW_BUFFERS, &max_draw_buffers);
- if (max_draw_buffers < 2) {
- printf("test requires 2 draw buffers.\n");
- piglit_report_result(PIGLIT_SKIP);
- }
+ piglit_require_minimum_getinteger(GL_MAX_DRAW_BUFFERS, 2);
glGetIntegerv(GL_MAX_SAMPLES, &max_samples);
diff --git a/tests/spec/ext_framebuffer_multisample/sample-coverage.cpp b/tests/spec/ext_framebuffer_multisample/sample-coverage.cpp
index 8cda26d7e..d535a7f9f 100644
--- a/tests/spec/ext_framebuffer_multisample/sample-coverage.cpp
+++ b/tests/spec/ext_framebuffer_multisample/sample-coverage.cpp
@@ -221,7 +221,7 @@ compute_expected(void)
for (i = 0; i < num_rects; i++) {
float samples_used = coverage[i] * num_samples;
- /* Exepected color values are computed only for integer
+ /* Expected color values are computed only for integer
* number of samples_used
*/
if(samples_used == (int)samples_used) {
diff --git a/tests/spec/ext_framebuffer_multisample/turn-on-off.cpp b/tests/spec/ext_framebuffer_multisample/turn-on-off.cpp
index bfc791cb5..2abc216ba 100644
--- a/tests/spec/ext_framebuffer_multisample/turn-on-off.cpp
+++ b/tests/spec/ext_framebuffer_multisample/turn-on-off.cpp
@@ -24,7 +24,7 @@
#include "common.h"
/**
* @file turn-on-off.c
- * This test varifies turning multisampling on/off by setting up FBO with
+ * This test verifies turning multisampling on/off by setting up FBO with
* appropriate sample count.
* Test algorithm:
* 1. Render the geometry to left half of default framebuffer and read color
@@ -34,7 +34,7 @@
* buffer in Step 1. It is expected to match.
*
* 3. Turn ON MSAA in FBO. Render the scene, draw reference image and measure
- * the accuracy of MSAA. This varifies if MSAA is turned ON.
+ * the accuracy of MSAA. This verifies if MSAA is turned ON.
*
* 4. Turn OFF MSAA in FBO. Render the scene and compare to the buffer in
* step 1. It is expected to match.
@@ -98,7 +98,7 @@ piglit_display(void)
test->draw_reference_image();
/* Measure the accuracy of MSAA in multisample FBO by comparing the
- * test image to reference image. This varifies if MSAA is actually
+ * test image to reference image. This verifies if MSAA is actually
* switched on.
*/
pass = test->measure_accuracy() && pass;
diff --git a/tests/spec/ext_image_dma_buf_import/CMakeLists.gles2.txt b/tests/spec/ext_image_dma_buf_import/CMakeLists.gles2.txt
index d33abd37b..8857cf6cd 100644
--- a/tests/spec/ext_image_dma_buf_import/CMakeLists.gles2.txt
+++ b/tests/spec/ext_image_dma_buf_import/CMakeLists.gles2.txt
@@ -22,7 +22,10 @@ if(PIGLIT_BUILD_DMA_BUF_TESTS)
piglit_add_executable(ext_image_dma_buf_import-transcode-nv12-as-r8-gr88 transcode-nv12-as-r8-gr88.c image_common.c)
piglit_add_executable(ext_image_dma_buf_import-export export.c sample_common.c image_common.c)
piglit_add_executable(ext_image_dma_buf_import-export-tex export-tex.c sample_common.c image_common.c)
+ piglit_add_executable(ext_image_dma_buf_import-modifiers modifiers.c sample_common.c image_common.c)
piglit_add_executable(ext_image_dma_buf_import-reimport-bug reimport-bug.c sample_common.c image_common.c)
+ piglit_add_executable(ext_image_dma_buf_import-refcount-multithread refcount-multithread.c sample_common.c image_common.c)
+ target_link_libraries(ext_image_dma_buf_import-refcount-multithread pthread)
endif()
# vim: ft=cmake:
diff --git a/tests/spec/ext_image_dma_buf_import/export-tex.c b/tests/spec/ext_image_dma_buf_import/export-tex.c
index ecf26e105..485ee0433 100644
--- a/tests/spec/ext_image_dma_buf_import/export-tex.c
+++ b/tests/spec/ext_image_dma_buf_import/export-tex.c
@@ -207,8 +207,8 @@ test(EGLDisplay egl_dpy, bool glfinish_after_dmabuf_export)
/* Draw EGLImage contents */
GLuint imported_tex;
- texture_for_egl_image(imported_img, &imported_tex);
- sample_tex(imported_tex, 0, 0, 1, piglit_height);
+ texture_for_egl_image(imported_img, &imported_tex, true);
+ sample_tex(imported_tex, 0, 0, 1, piglit_height, true);
/* Verify the contents */
const float ones[] = { CLEAR_VALUE };
@@ -224,12 +224,13 @@ piglit_init(int argc, char **argv)
piglit_require_egl_extension(egl_dpy, "EGL_EXT_image_dma_buf_import");
piglit_require_egl_extension(egl_dpy, "EGL_KHR_gl_texture_2D_image");
piglit_require_extension("GL_OES_EGL_image_external");
+ piglit_require_extension("GL_EXT_EGL_image_storage");
- fprintf(stderr, "Testing glFinish before dmabuf export\n");
+ printf("Testing glFinish before dmabuf export\n");
if (!test(egl_dpy, false))
piglit_report_result(PIGLIT_FAIL);
- fprintf(stderr, "Testing glFinish after dmabuf export\n");
+ printf("Testing glFinish after dmabuf export\n");
if (!test(egl_dpy, true))
piglit_report_result(PIGLIT_FAIL);
diff --git a/tests/spec/ext_image_dma_buf_import/export.c b/tests/spec/ext_image_dma_buf_import/export.c
index 0380ef9a6..fe47a5218 100644
--- a/tests/spec/ext_image_dma_buf_import/export.c
+++ b/tests/spec/ext_image_dma_buf_import/export.c
@@ -27,7 +27,7 @@
/**
* @file export.c
*
- * Test verifies that we can succesfully export imported dmabuf.
+ * Test verifies that we can successfully export imported dmabuf.
*/
PIGLIT_GL_TEST_CONFIG_BEGIN
@@ -42,6 +42,7 @@ static const int format_table[] = {
DRM_FORMAT_P012,
DRM_FORMAT_P016,
DRM_FORMAT_NV12,
+ DRM_FORMAT_NV21,
DRM_FORMAT_XRGB8888,
DRM_FORMAT_ARGB8888,
DRM_FORMAT_YUV420,
@@ -61,6 +62,7 @@ fourcc_num_planes(int fourcc)
case DRM_FORMAT_P012:
case DRM_FORMAT_P016:
case DRM_FORMAT_NV12:
+ case DRM_FORMAT_NV21:
return 2;
case DRM_FORMAT_XRGB8888:
case DRM_FORMAT_ARGB8888:
diff --git a/tests/spec/ext_image_dma_buf_import/image_common.h b/tests/spec/ext_image_dma_buf_import/image_common.h
index f9845c7cb..0d3a30c58 100644
--- a/tests/spec/ext_image_dma_buf_import/image_common.h
+++ b/tests/spec/ext_image_dma_buf_import/image_common.h
@@ -32,7 +32,7 @@
*/
#include <unistd.h>
-#include <drm_fourcc.h>
+#include "drm-uapi/drm_fourcc.h"
#include "piglit-util-egl.h"
#include "piglit-util-gl.h"
diff --git a/tests/spec/ext_image_dma_buf_import/modifiers.c b/tests/spec/ext_image_dma_buf_import/modifiers.c
new file mode 100644
index 000000000..28c3dccb9
--- /dev/null
+++ b/tests/spec/ext_image_dma_buf_import/modifiers.c
@@ -0,0 +1,874 @@
+/*
+ * Copyright © 2020 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+#include "piglit-util-compressed-grays.h"
+#include "sample_common.h"
+#include "image_common.h"
+#include "drm-uapi/drm_fourcc.h"
+
+#include <inttypes.h>
+
+#define PRIMARY_REFERENCE_MOD DRM_FORMAT_MOD_LINEAR
+
+#define W 257
+#define H 257
+#define MAX_PLANES 4
+
+/**
+ * @file modifiers.c
+ *
+ * Test various operations on imported dmabufs with supported modifiers.
+ */
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+ config.supports_gl_es_version = 20;
+ config.window_visual = PIGLIT_GL_VISUAL_RGBA;
+ config.window_height = 240;
+ config.window_width = 960;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+PFNEGLEXPORTDMABUFIMAGEQUERYMESAPROC dmabuf_query;
+PFNEGLEXPORTDMABUFIMAGEMESAPROC dmabuf_export;
+PFNEGLQUERYDMABUFFORMATSEXTPROC dmabuf_query_formats;
+PFNEGLQUERYDMABUFMODIFIERSEXTPROC dmabuf_query_modifiers;
+
+struct dma_buf_info {
+ int fd;
+ uint32_t w;
+ uint32_t h;
+ uint32_t n_planes;
+ uint32_t stride[4]; /* pitch for each plane */
+ uint32_t offset[4]; /* offset of each plane */
+};
+
+static void
+delete_tex(GLuint *tex)
+{
+ if (*tex != 0) {
+ glDeleteTextures(1, tex);
+ *tex = 0;
+ }
+}
+
+static void
+destroy_img(EGLImageKHR *img)
+{
+ if (*img != EGL_NO_IMAGE_KHR) {
+ eglDestroyImageKHR(eglGetCurrentDisplay(), *img);
+ *img = EGL_NO_IMAGE_KHR;
+ }
+}
+
+static int
+cpp_for_fourcc(uint32_t format)
+{
+ switch (format) {
+ case DRM_FORMAT_R8:
+ return 1;
+ case DRM_FORMAT_R16:
+ return 2;
+ case DRM_FORMAT_XBGR8888:
+ case DRM_FORMAT_XRGB8888:
+ case DRM_FORMAT_ABGR8888:
+ case DRM_FORMAT_ARGB8888:
+ return 4;
+ default:
+ fprintf(stderr, "invalid fourcc: %.4s\n", (char *)&format);
+ return 0;
+ }
+}
+
+struct modifier_name {
+ uint64_t mod;
+ const char *name;
+};
+
+#define CASE(mod) { mod, #mod }
+
+static const struct modifier_name known_modifiers[] = {
+ CASE(DRM_FORMAT_MOD_LINEAR),
+ CASE(I915_FORMAT_MOD_X_TILED),
+ CASE(I915_FORMAT_MOD_Y_TILED),
+ CASE(I915_FORMAT_MOD_Yf_TILED),
+ CASE(I915_FORMAT_MOD_Y_TILED_CCS),
+ CASE(I915_FORMAT_MOD_Yf_TILED_CCS),
+ CASE(I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS),
+ CASE(I915_FORMAT_MOD_Y_TILED_GEN12_MC_CCS),
+ CASE(I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS_CC),
+ CASE(DRM_FORMAT_MOD_SAMSUNG_64_32_TILE),
+ CASE(DRM_FORMAT_MOD_SAMSUNG_16_16_TILE),
+ CASE(DRM_FORMAT_MOD_QCOM_COMPRESSED),
+ CASE(DRM_FORMAT_MOD_QCOM_TILED3),
+ CASE(DRM_FORMAT_MOD_VIVANTE_TILED),
+ CASE(DRM_FORMAT_MOD_VIVANTE_SUPER_TILED),
+ CASE(DRM_FORMAT_MOD_VIVANTE_SPLIT_TILED),
+ CASE(DRM_FORMAT_MOD_VIVANTE_SPLIT_SUPER_TILED),
+ CASE(DRM_FORMAT_MOD_NVIDIA_TEGRA_TILED),
+ CASE(DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK_ONE_GOB),
+ CASE(DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK_TWO_GOB),
+ CASE(DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK_FOUR_GOB),
+ CASE(DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK_EIGHT_GOB),
+ CASE(DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK_SIXTEEN_GOB),
+ CASE(DRM_FORMAT_MOD_NVIDIA_16BX2_BLOCK_THIRTYTWO_GOB),
+ CASE(DRM_FORMAT_MOD_BROADCOM_VC4_T_TILED),
+ CASE(DRM_FORMAT_MOD_BROADCOM_SAND32),
+ CASE(DRM_FORMAT_MOD_BROADCOM_SAND64),
+ CASE(DRM_FORMAT_MOD_BROADCOM_SAND128),
+ CASE(DRM_FORMAT_MOD_BROADCOM_SAND256),
+ CASE(DRM_FORMAT_MOD_ALLWINNER_TILED),
+};
+#undef CASE
+
+const char *
+modifier_str(EGLuint64KHR mod)
+{
+ for (int i = 0; i < ARRAY_SIZE(known_modifiers); i++) {
+ if (known_modifiers[i].mod == mod)
+ return known_modifiers[i].name;
+ }
+ return NULL;
+}
+
+static EGLuint64KHR
+str_to_modifier(const char *mod)
+{
+ for (int i = 0; i < ARRAY_SIZE(known_modifiers); i++) {
+ if (strcmp(known_modifiers[i].name, mod) == 0)
+ return known_modifiers[i].mod;
+ }
+ return DRM_FORMAT_MOD_INVALID;
+}
+
+/* Shorten fourcc "strings" (e.g., "R8 " -> "R8") */
+static int
+format_no_space(int fmt)
+{
+ int fmt_no_space = fmt;
+ char *fmt_str = (char *)&fmt_no_space;
+ for (int i = 0; i < 4; i++)
+ if (fmt_str[i] == ' ')
+ fmt_str[i] = '\0';
+
+ return fmt_no_space;
+}
+
+static void
+report_result(enum piglit_result res, int fmt, EGLuint64KHR mod, bool autogen,
+ const char *fn)
+{
+ const char *mod_str = modifier_str(mod);
+ const int fmt_no_space = format_no_space(fmt);
+ const char *gen_str = autogen ? "autogen" : "pregen";
+
+ if (mod_str)
+ piglit_report_subtest_result(res, "%s-%.4s-%s-%s",
+ gen_str, (char*)&fmt_no_space,
+ mod_str, fn);
+ else
+ piglit_report_subtest_result(res, "%s-%.4s-0x%"PRIx64"-%s",
+ gen_str, (char*)&fmt_no_space,
+ mod, fn);
+}
+
+static enum piglit_result
+egl_image_for_dma_buf_fd_mod(struct dma_buf_info *buf, int fourcc,
+ EGLImageKHR *out_img, EGLuint64KHR modifier)
+{
+#define DMA_BUF_ATTRS \
+ EGL_IMAGE_PRESERVED, EGL_TRUE, \
+ EGL_WIDTH, buf->w, \
+ EGL_HEIGHT, buf->h, \
+ EGL_LINUX_DRM_FOURCC_EXT, fourcc
+#define PLANE_ATTRS \
+ EGL_NONE, EGL_NONE, \
+ EGL_NONE, EGL_NONE, \
+ EGL_NONE, EGL_NONE, \
+ EGL_NONE, EGL_NONE, \
+ EGL_NONE, EGL_NONE
+#define LIST_SIZE(type, list) ARRAY_SIZE(((type []) { list }))
+#define DMA_BUF_ATTRS_LEN LIST_SIZE(EGLint, DMA_BUF_ATTRS)
+#define PLANE_ATTRS_LEN LIST_SIZE(EGLint, PLANE_ATTRS)
+#define FILL_PLANE(attr, buf, fourcc, mod, p) \
+ if (p < buf->n_planes) { \
+ const EGLint plane_attr[PLANE_ATTRS_LEN] = { \
+ EGL_DMA_BUF_PLANE ## p ## _FD_EXT, \
+ buf->fd, \
+ EGL_DMA_BUF_PLANE ## p ## _OFFSET_EXT, \
+ buf->offset[p], \
+ EGL_DMA_BUF_PLANE ## p ## _PITCH_EXT, \
+ buf->stride[p], \
+ EGL_DMA_BUF_PLANE ## p ## _MODIFIER_LO_EXT, \
+ mod, \
+ EGL_DMA_BUF_PLANE ## p ## _MODIFIER_HI_EXT, \
+ mod >> 32, \
+ }; \
+ const unsigned plane_attr_offset = \
+ DMA_BUF_ATTRS_LEN + PLANE_ATTRS_LEN * p; \
+ assert(plane_attr_offset + PLANE_ATTRS_LEN < \
+ ARRAY_SIZE(attr)); \
+ memcpy(attr + plane_attr_offset, plane_attr, \
+ sizeof(plane_attr)); \
+ }
+
+ EGLint attr[] = {
+ DMA_BUF_ATTRS,
+ PLANE_ATTRS,
+ PLANE_ATTRS,
+ PLANE_ATTRS,
+ PLANE_ATTRS,
+ EGL_NONE,
+ };
+ FILL_PLANE(attr, buf, fourcc, modifier, 0)
+ FILL_PLANE(attr, buf, fourcc, modifier, 1)
+ FILL_PLANE(attr, buf, fourcc, modifier, 2)
+ FILL_PLANE(attr, buf, fourcc, modifier, 3)
+
+#undef FILL_PLANE
+#undef PLANE_ATTRS_LEN
+#undef DMA_BUF_ATTRS_LEN
+#undef LIST_SIZE
+#undef PLANE_ATTRS
+#undef DMA_BUF_ATTRS
+
+ EGLImageKHR img = eglCreateImageKHR(eglGetCurrentDisplay(),
+ EGL_NO_CONTEXT,
+ EGL_LINUX_DMA_BUF_EXT,
+ (EGLClientBuffer)0, attr);
+ EGLint error = eglGetError();
+
+ /* EGL may not support the format, this is not an error. */
+ if (!img && error == EGL_BAD_MATCH)
+ return PIGLIT_SKIP;
+
+ if (error != EGL_SUCCESS) {
+ printf("eglCreateImageKHR() failed: %s 0x%x\n",
+ piglit_get_egl_error_name(error), error);
+ return PIGLIT_FAIL;
+ }
+
+ *out_img = img;
+ return PIGLIT_PASS;
+}
+
+/* This function can be implemented locally to make this test load files
+ * that contain or point to dmabuf data. It's intended to be left
+ * unimplemented by default.
+ */
+static bool
+load_dma_buf_from_file(uint32_t format, EGLuint64KHR modifier,
+ struct dma_buf_info *buf)
+{
+ return false;
+}
+
+static bool
+create_dma_buf(uint32_t format, EGLuint64KHR modifier,
+ struct dma_buf_info *buf)
+{
+ /* Use 4KB worth of interesting data to initialize the dmabuf. */
+ assert(sizeof(piglit_fxt1_grayscale_blocks) == 4 * 1024);
+ const char *src_data = (const char*)piglit_fxt1_grayscale_blocks;
+ const int num_pixels = sizeof(piglit_fxt1_grayscale_blocks) /
+ cpp_for_fourcc(format);
+ const int dim = sqrt((double)num_pixels);
+
+ struct piglit_dma_buf *drm_buf = NULL;
+ enum piglit_result result =
+ piglit_drm_create_dma_buf_modifiers(dim, dim, format,
+ modifier, src_data,
+ &drm_buf);
+
+ if (result != PIGLIT_PASS) {
+ piglit_drm_destroy_dma_buf(drm_buf);
+ return false;
+ }
+
+ buf->n_planes = drm_buf->n_planes;
+ assert(buf->n_planes <= ARRAY_SIZE(drm_buf->offset));
+ for (int i = 0; i < buf->n_planes; i++) {
+ buf->offset[i] = drm_buf->offset[i];
+ buf->stride[i] = drm_buf->stride[i];
+ }
+ buf->fd = drm_buf->fd;
+ buf->w = drm_buf->w;
+ buf->h = drm_buf->h;
+
+ piglit_drm_destroy_dma_buf(drm_buf);
+ return true;
+}
+
+static bool
+get_dma_buf(uint32_t format, EGLuint64KHR modifier, bool external_only,
+ struct dma_buf_info *buf, bool autogen)
+{
+ if (autogen) {
+ /* GL drivers are generally unable to create external-only
+ * images. We can load them from external sources, however.
+ */
+ if (external_only)
+ return false;
+
+ return create_dma_buf(format, modifier, buf);
+ } else {
+ return load_dma_buf_from_file(format, modifier, buf);
+ }
+}
+
+static void
+clear_buffer(GLenum type)
+{
+ GLuint color_uint[] = {1, 1, 1, 1};
+ GLint color_int[] = {1, 1, 1, 1};
+ GLfloat color_float[] = {0.25 , 0.125, 0.0675, 0.25};
+ switch (type) {
+ case GL_INT:
+ glClearBufferiv(GL_COLOR, 0, color_int);
+ return;
+ case GL_UNSIGNED_INT:
+ glClearBufferuiv(GL_COLOR, 0, color_uint);
+ return;
+ case GL_FLOAT:
+ glClearBufferfv(GL_COLOR, 0, color_float);
+ return;
+ default:
+ assert(!"unhandled clear type");
+ }
+}
+
+static bool
+sample_compare(GLuint tex, GLuint tex_ref, bool external_only)
+{
+ const int piglit_width_half = piglit_width / 2;
+ sample_tex(tex, 0, 0, piglit_width_half, piglit_height,
+ external_only);
+ sample_tex(tex_ref, piglit_width_half, 0, piglit_width_half,
+ piglit_height, external_only);
+ return piglit_probe_rects_equal(0, 0, piglit_width_half, 0,
+ piglit_width_half, piglit_height,
+ GL_RGBA);
+}
+
+static bool
+clear_textures(GLuint tex, GLuint tex_ref, GLenum type)
+{
+ GLuint fbo;
+ glGenFramebuffers(1, &fbo);
+ glViewport(0, 0, piglit_width, piglit_height);
+ glBindFramebuffer(GL_FRAMEBUFFER, fbo);
+
+ GLuint textures[] = {tex, tex_ref};
+ for (int i = 0; i < ARRAY_SIZE(textures); i++) {
+ glBindTexture(GL_TEXTURE_2D, textures[i]);
+ glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
+ GL_TEXTURE_2D, textures[i], 0);
+ clear_buffer(type);
+ glBindTexture(GL_TEXTURE_2D, 0);
+ }
+
+ glBindFramebuffer(GL_FRAMEBUFFER, piglit_winsys_fbo);
+ glDeleteFramebuffers(1, &fbo);
+ return sample_compare(tex, tex_ref, false);
+}
+
+static enum piglit_result
+test_export(EGLImageKHR img, struct dma_buf_info *buf,
+ int format, EGLuint64KHR modifier)
+{
+ /* Export the buffer and query properties. */
+ int prop_fourcc = -1;
+ int num_planes = -1;
+
+ /* Query the image properties, verify fourcc and num planes. */
+ EGLDisplay egl_dpy = eglGetCurrentDisplay();
+ if (!dmabuf_query(egl_dpy, img, &prop_fourcc, &num_planes, NULL)) {
+ fprintf(stderr, "export dmabuf image query failed!\n");
+ return PIGLIT_FAIL;
+ }
+
+ if (!piglit_check_egl_error(EGL_SUCCESS)) {
+ fprintf(stderr, "image export failed!\n");
+ return PIGLIT_FAIL;
+ }
+
+ if (prop_fourcc != format) {
+ fprintf(stderr,
+ "fourcc mismatch, got %.4s expected %.4s\n",
+ (char *)&prop_fourcc, (char *)&format);
+ return PIGLIT_FAIL;
+ }
+
+ if (num_planes != buf->n_planes) {
+ fprintf(stderr, "planes mismatch, got %d expected %d\n",
+ num_planes, buf->n_planes);
+ return PIGLIT_FAIL;
+ }
+
+
+ /* Export the image, verify success. */
+ EGLint strides[MAX_PLANES] = {0,};
+ EGLint offsets[MAX_PLANES] = {0,};
+ if (!dmabuf_export(egl_dpy, img, NULL, strides, offsets)) {
+ fprintf(stderr, "image export failed!\n");
+ return PIGLIT_FAIL;
+ }
+
+ if (!piglit_check_egl_error(EGL_SUCCESS)) {
+ fprintf(stderr, "image export failed!\n");
+ return PIGLIT_FAIL;
+ }
+
+ /* Check if we got an expected stride and offset for each plane.
+ * The export spec doesn't require that the output stride and offset
+ * match the input, so don't fail if they're different. At this time
+ * though, drivers are expected to return the same values.
+ */
+ for (uint32_t i = 0; i < num_planes; i++) {
+ if (strides[i] != buf->stride[i] ||
+ offsets[i] != buf->offset[i]) {
+ fprintf(stderr, "suspect data from driver: "
+ "stride %d (expected %d) "
+ "offset %d (expected %d)\n",
+ strides[i], buf->stride[i], offsets[i],
+ buf->offset[i]);
+
+ /* TODO - propagate this warning up the stack (?) */
+
+ return PIGLIT_WARN;
+ }
+ }
+
+ return PIGLIT_PASS;
+}
+
+static bool
+test_gl_advanced(GLuint tex, GLuint tex_ref, int fourcc)
+{
+ /* DRI formats are non-integer, clear with floating point values. */
+ piglit_logd("Testing clears");
+ if (!clear_textures(tex, tex_ref, GL_FLOAT))
+ return false;
+
+ return true;
+}
+
+static enum piglit_result
+clear_reimport(uint32_t format, EGLuint64KHR reference_modifier,
+ EGLuint64KHR modifier, EGLBoolean external_only, bool autogen)
+{
+ GLuint tex = 0;
+ GLuint tex_ref = 0;
+ EGLImageKHR img = EGL_NO_IMAGE_KHR;
+ EGLImageKHR img_ref = EGL_NO_IMAGE_KHR;
+ struct dma_buf_info buf = { .fd = -1 };
+ struct dma_buf_info buf_ref = { .fd = -1 };
+ enum piglit_result res = PIGLIT_SKIP;
+
+ if (external_only) {
+ piglit_logd("External only format + modifier");
+ return PIGLIT_SKIP;
+ }
+
+ /* Create dma_buf_info. */
+ if (!get_dma_buf(format, modifier, external_only, &buf, autogen)) {
+ piglit_logd("No data found");
+ return PIGLIT_SKIP;
+ }
+
+ /* Create reference dma_buf_info. */
+ if (!get_dma_buf(format, reference_modifier, external_only,
+ &buf_ref, autogen)) {
+ piglit_logd("No data found");
+ goto destroy;
+ }
+
+ /* Perform EGL testing */
+ piglit_logd("Testing import");
+ res = egl_image_for_dma_buf_fd_mod(&buf, format, &img, modifier);
+ if (res != PIGLIT_PASS)
+ goto destroy;
+
+ res = egl_image_for_dma_buf_fd_mod(&buf_ref, format, &img_ref,
+ reference_modifier);
+ if (res != PIGLIT_PASS)
+ goto destroy;
+
+ /* Create textures */
+ res = texture_for_egl_image(img, &tex, external_only);
+ if (res != PIGLIT_PASS)
+ goto destroy;
+
+ res = texture_for_egl_image(img_ref, &tex_ref, external_only);
+ if (res != PIGLIT_PASS)
+ goto destroy;
+
+ piglit_logd("Testing clear, reimport, sample");
+ if (!clear_textures(tex, tex_ref, GL_FLOAT)) {
+ res = PIGLIT_FAIL;
+ goto destroy;
+ }
+
+ glFinish();
+ delete_tex(&tex);
+ delete_tex(&tex_ref);
+ destroy_img(&img);
+ destroy_img(&img_ref);
+
+ res = egl_image_for_dma_buf_fd_mod(&buf, format, &img, modifier);
+ if (res != PIGLIT_PASS)
+ goto destroy;
+
+ res = egl_image_for_dma_buf_fd_mod(&buf_ref, format, &img_ref,
+ reference_modifier);
+ if (res != PIGLIT_PASS)
+ goto destroy;
+
+ res = texture_for_egl_image(img, &tex, external_only);
+ if (res != PIGLIT_PASS)
+ goto destroy;
+
+ res = texture_for_egl_image(img_ref, &tex_ref, external_only);
+ if (res != PIGLIT_PASS)
+ goto destroy;
+
+ if (!sample_compare(tex, tex_ref, external_only)) {
+ res = PIGLIT_FAIL;
+ goto destroy;
+ }
+
+destroy:
+ delete_tex(&tex);
+ delete_tex(&tex_ref);
+ destroy_img(&img);
+ destroy_img(&img_ref);
+ close(buf.fd);
+ close(buf_ref.fd);
+
+ if (res == PIGLIT_FAIL)
+ piglit_present_results();
+
+ return res;
+}
+
+static enum piglit_result
+stress_test(uint32_t format, EGLuint64KHR reference_modifier,
+ EGLuint64KHR modifier, EGLBoolean external_only, bool autogen)
+{
+ GLuint tex = 0;
+ GLuint tex_ref = 0;
+ EGLImageKHR img = EGL_NO_IMAGE_KHR;
+ EGLImageKHR img_ref = EGL_NO_IMAGE_KHR;
+ struct dma_buf_info buf = { .fd = -1 };
+ struct dma_buf_info buf_ref = { .fd = -1 };
+ enum piglit_result res = PIGLIT_SKIP;
+
+ /* Create dma_buf_info structs. */
+ if (!get_dma_buf(format, modifier, external_only, &buf, autogen)) {
+ piglit_logd("No data found");
+ return PIGLIT_SKIP;
+ }
+
+ if (!get_dma_buf(format, reference_modifier, external_only,
+ &buf_ref, autogen)) {
+ piglit_logd("No data found");
+ goto destroy;
+ }
+
+ /* Perform EGL testing */
+ piglit_logd("Testing import");
+ res = egl_image_for_dma_buf_fd_mod(&buf, format, &img, modifier);
+ if (res != PIGLIT_PASS)
+ goto destroy;
+
+ res = egl_image_for_dma_buf_fd_mod(&buf_ref, format, &img_ref,
+ reference_modifier);
+ if (res != PIGLIT_PASS)
+ goto destroy;
+
+ piglit_logd("Testing export");
+ res = test_export(img, &buf, format, modifier);
+ if (res == PIGLIT_FAIL)
+ goto destroy;
+
+ /* Create textures */
+ res = texture_for_egl_image(img, &tex, external_only);
+ if (res != PIGLIT_PASS)
+ goto destroy;
+
+ res = texture_for_egl_image(img_ref, &tex_ref, external_only);
+ if (res != PIGLIT_PASS)
+ goto destroy;
+
+ /* Perform GL testing */
+ piglit_logd("Testing sampling");
+ if (!sample_compare(tex, tex_ref, external_only)) {
+ res = PIGLIT_FAIL;
+ goto destroy;
+ }
+
+ /* Display the result of sampling the test and reference textures. */
+ piglit_present_results();
+
+ if (!external_only && !test_gl_advanced(tex, tex_ref, format)) {
+ res = PIGLIT_FAIL;
+ goto destroy;
+ }
+
+destroy:
+ delete_tex(&tex);
+ delete_tex(&tex_ref);
+ destroy_img(&img);
+ destroy_img(&img_ref);
+ close(buf.fd);
+ close(buf_ref.fd);
+
+ if (res == PIGLIT_FAIL)
+ piglit_present_results();
+
+ return res;
+}
+
+static enum piglit_result
+modifier_test(uint32_t format, EGLuint64KHR modifier, bool external_only,
+ bool autogen)
+{
+ GLuint tex = 0;
+ EGLImageKHR img = EGL_NO_IMAGE_KHR;
+ struct dma_buf_info buf = { .fd = -1 };
+ enum piglit_result res = PIGLIT_SKIP;
+
+ /* Create dma_buf_info. */
+ if (!get_dma_buf(format, modifier, external_only, &buf, autogen)) {
+ piglit_logd("No data found");
+ return PIGLIT_SKIP;
+ }
+
+ /* Create EGLImage. */
+ res = egl_image_for_dma_buf_fd_mod(&buf, format, &img, modifier);
+
+ if (!img) {
+ /* Close the descriptor also, EGL does not have ownership */
+ close(buf.fd);
+ }
+
+ if (res != PIGLIT_PASS) {
+ piglit_logd("Failed EGL import");
+ goto destroy;
+ }
+
+ res = texture_for_egl_image(img, &tex, true);
+ if (res != PIGLIT_PASS) {
+ piglit_logd("Failed GL import");
+ goto destroy;
+ }
+
+ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+
+ /* TODO - verify results (?) */
+
+ sample_tex(tex, 0, 0, W, H, true);
+
+destroy:
+ delete_tex(&tex);
+ destroy_img(&img);
+ close(buf.fd);
+ return res;
+}
+
+static int arg_fmt = DRM_FORMAT_INVALID;
+static EGLuint64KHR arg_mod = DRM_FORMAT_MOD_INVALID;
+
+static bool
+skip_format(uint32_t format)
+{
+ if (arg_fmt != DRM_FORMAT_INVALID && arg_fmt != format)
+ return true;
+
+ switch (format) {
+ case DRM_FORMAT_R8:
+ case DRM_FORMAT_R16:
+ case DRM_FORMAT_XRGB8888:
+ case DRM_FORMAT_XBGR8888:
+ case DRM_FORMAT_ARGB8888:
+ case DRM_FORMAT_ABGR8888:
+ case DRM_FORMAT_YUYV:
+ case DRM_FORMAT_UYVY:
+ case DRM_FORMAT_P010:
+ case DRM_FORMAT_P012:
+ case DRM_FORMAT_P016:
+ case DRM_FORMAT_NV12:
+ return false;
+ default:
+ return true;
+ }
+}
+
+static bool
+skip_modifier(EGLuint64KHR mod)
+{
+ if (arg_mod != DRM_FORMAT_MOD_INVALID && arg_mod != mod)
+ return true;
+
+ return false;
+}
+
+enum piglit_result
+piglit_display(void)
+{
+ EGLDisplay egl_dpy = eglGetCurrentDisplay();
+
+#define MAX_FORMATS 256
+#define MAX_MODIFIERS 256
+
+ /* First query all available formats. */
+ EGLint formats[MAX_FORMATS];
+ EGLuint64KHR modifiers[MAX_MODIFIERS];
+ EGLBoolean external_only[MAX_MODIFIERS];
+ EGLint num_formats = 0;
+ EGLint num_modifiers = 0;
+
+ dmabuf_query_formats(egl_dpy, MAX_FORMATS, formats, &num_formats);
+
+ printf("found %d supported formats\n", num_formats);
+
+ enum piglit_result result = PIGLIT_SKIP;
+
+ bool autogen[] = { false, true };
+
+ for (unsigned g = 0; g < ARRAY_SIZE(autogen); g++) {
+ printf(autogen[g] ?
+ "\n\nTesting with autogenerated dmabufs\n\n" :
+ "\n\nTesting with pregenerated binaries\n\n");
+ for (unsigned i = 0; i < num_formats; i++) {
+ if (skip_format(formats[i]))
+ continue;
+
+ int32_t fmt = formats[i];
+
+ dmabuf_query_modifiers(egl_dpy, fmt, MAX_MODIFIERS,
+ modifiers, external_only,
+ &num_modifiers);
+
+ printf("format %.4s has %d supported modifiers\n",
+ (char *)&fmt, num_modifiers);
+
+ for (unsigned j = 0; j < num_modifiers; j++) {
+ if (skip_modifier(modifiers[j]))
+ continue;
+
+ enum piglit_result r;
+ r = modifier_test(fmt, modifiers[j],
+ external_only[j],
+ autogen[g]);
+ report_result(r, fmt, modifiers[j],
+ autogen[g], "modifiers_test");
+ piglit_merge_result(&result, r);
+
+ r = stress_test(fmt, PRIMARY_REFERENCE_MOD,
+ modifiers[j],
+ external_only[j],
+ autogen[g]);
+ report_result(r, fmt, modifiers[j],
+ autogen[g], "stress_test");
+ piglit_merge_result(&result, r);
+
+ r = clear_reimport(fmt, PRIMARY_REFERENCE_MOD,
+ modifiers[j],
+ external_only[j],
+ autogen[g]);
+ report_result(r, fmt, modifiers[j],
+ autogen[g], "clear_reimport");
+ piglit_merge_result(&result, r);
+ }
+ }
+ }
+
+ return result;
+}
+
+void
+piglit_init(int argc, char **argv)
+{
+ for (int i = 1; i < argc; i++) {
+
+ /* Init with spaces for codes with less than four chars. */
+ int tmp_fmt = fourcc_code(' ',' ',' ',' ');
+ if (sscanf(argv[i], "-fmt=%4c", (char *)&tmp_fmt) > 0) {
+
+ arg_fmt = tmp_fmt;
+
+ /* The invalid format is reserved for this test */
+ assert(arg_fmt != DRM_FORMAT_INVALID);
+ continue;
+ }
+
+ char mod_str[4096] = {0};
+ if (sscanf(argv[i], "-mod=%4096s", mod_str) > 0) {
+ arg_mod = str_to_modifier(mod_str);
+
+ /* The invalid modifier is reserved for this test */
+ assert(arg_mod != DRM_FORMAT_MOD_INVALID);
+ continue;
+ }
+
+ fprintf(stderr,"e.g., %s [-fmt=AR24] "
+ "[-mod=DRM_FORMAT_MOD_LINEAR]\n", argv[0]);
+ piglit_report_result(PIGLIT_FAIL);
+ }
+
+ EGLDisplay egl_dpy = eglGetCurrentDisplay();
+
+ piglit_require_egl_extension(
+ egl_dpy, "EGL_EXT_image_dma_buf_import_modifiers");
+ piglit_require_egl_extension(
+ egl_dpy, "EGL_MESA_image_dma_buf_export");
+ piglit_require_extension("GL_EXT_EGL_image_storage");
+ piglit_require_extension("GL_OES_texture_view");
+
+ dmabuf_query =
+ (PFNEGLEXPORTDMABUFIMAGEQUERYMESAPROC) eglGetProcAddress(
+ "eglExportDMABUFImageQueryMESA");
+
+ dmabuf_export =
+ (PFNEGLEXPORTDMABUFIMAGEMESAPROC) eglGetProcAddress(
+ "eglExportDMABUFImageMESA");
+
+ if (!dmabuf_query || !dmabuf_export) {
+ fprintf(stderr, "could not find extension entrypoints\n");
+ piglit_report_result(PIGLIT_FAIL);
+ }
+
+ dmabuf_query_formats =
+ (PFNEGLQUERYDMABUFFORMATSEXTPROC) eglGetProcAddress(
+ "eglQueryDmaBufFormatsEXT");
+
+ dmabuf_query_modifiers =
+ (PFNEGLQUERYDMABUFMODIFIERSEXTPROC) eglGetProcAddress(
+ "eglQueryDmaBufModifiersEXT");
+
+ if (!dmabuf_query_formats || !dmabuf_query_modifiers) {
+ fprintf(stderr, "could not find extension entrypoints\n");
+ piglit_report_result(PIGLIT_FAIL);
+ }
+}
diff --git a/tests/spec/ext_image_dma_buf_import/refcount-multithread.c b/tests/spec/ext_image_dma_buf_import/refcount-multithread.c
new file mode 100644
index 000000000..91a4736d5
--- /dev/null
+++ b/tests/spec/ext_image_dma_buf_import/refcount-multithread.c
@@ -0,0 +1,190 @@
+/*
+ * Copyright 2023 Google LLC
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+/**
+ * @file refcount-multithread.c
+ *
+ * Mesa drivers normally use a hash table to make sure there is a 1:1 mapping
+ * between gem bo handles and userspace bo handles. When a gem bo handle is
+ * imported, and if a userspace bo handle for the gem bo handle already
+ * exists, mesa drivers simply increase the reference count of the userspace
+ * bo handle.
+ *
+ * It occurred to multiple drivers in the past where the bo destroy function
+ * raced with the bo import function and led to use-after-free. This test
+ * attempts to catch such a driver bug.
+ */
+
+#include <pthread.h>
+
+#include "image_common.h"
+#include "sample_common.h"
+
+#define THREAD_COUNT 2
+#define THREAD_ITER 100000
+
+struct thread_data {
+ pthread_t thread;
+
+ struct piglit_dma_buf *buf;
+ int fourcc;
+
+ EGLDisplay dpy;
+ EGLContext ctx;
+ enum piglit_result result;
+};
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+ config.supports_gl_es_version = 20;
+ config.window_visual = PIGLIT_GL_VISUAL_RGBA;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+static enum piglit_result
+create_and_destroy_texture(struct piglit_dma_buf *buf, int fourcc)
+{
+ enum piglit_result res;
+ EGLImageKHR img;
+ GLuint tex;
+
+ res = egl_image_for_dma_buf_fd(buf, buf->fd, fourcc, &img);
+ if (res != PIGLIT_PASS)
+ return res;
+
+ res = texture_for_egl_image(img, &tex, true);
+ eglDestroyImageKHR(eglGetCurrentDisplay(), img);
+ if (res != PIGLIT_PASS)
+ return res;
+
+ glDeleteTextures(1, &tex);
+ glFinish();
+
+ return res;
+}
+
+static void
+thread_cleanup(struct thread_data *data)
+{
+ eglDestroyContext(data->dpy, data->ctx);
+}
+
+static enum piglit_result
+thread_init(struct thread_data *data)
+{
+ const EGLint attrs[] = {
+ EGL_CONTEXT_CLIENT_VERSION, 2,
+ EGL_NONE,
+ };
+ data->ctx = eglCreateContext(data->dpy, EGL_NO_CONFIG_KHR, EGL_NO_CONTEXT, attrs);
+ if (data->ctx == EGL_NO_CONTEXT)
+ return PIGLIT_FAIL;
+
+ if (!eglMakeCurrent(data->dpy, EGL_NO_SURFACE, EGL_NO_SURFACE, data->ctx)) {
+ eglDestroyContext(data->dpy, data->ctx);
+ return PIGLIT_FAIL;
+ }
+
+ return PIGLIT_PASS;
+}
+
+static void *
+thread_main(void *arg)
+{
+ struct thread_data *data = arg;
+
+ data->result = thread_init(data);
+ if (data->result != PIGLIT_PASS)
+ return NULL;
+
+ for (int i = 0; i < THREAD_ITER; i++) {
+ data->result = create_and_destroy_texture(data->buf, data->fourcc);
+ if (data->result != PIGLIT_PASS)
+ break;
+ }
+
+ thread_cleanup(data);
+
+ return NULL;
+}
+
+/* dummy */
+enum piglit_result
+piglit_display(void)
+{
+ return PIGLIT_PASS;
+}
+
+void
+piglit_init(int argc, char **argv)
+{
+ EGLDisplay egl_dpy = eglGetCurrentDisplay();
+
+ piglit_require_egl_extension(egl_dpy, "EGL_KHR_image_base");
+ piglit_require_egl_extension(egl_dpy, "EGL_EXT_image_dma_buf_import");
+ piglit_require_egl_extension(egl_dpy, "EGL_KHR_no_config_context");
+ piglit_require_egl_extension(egl_dpy, "EGL_KHR_surfaceless_context");
+
+ enum piglit_result res;
+
+ /* Create a DMABUF */
+ const uint32_t src_data[2][2] = { 0 };
+ const int fourcc = DRM_FORMAT_ABGR8888;
+ struct piglit_dma_buf *buf;
+ res = piglit_create_dma_buf(2, 2, fourcc, src_data, &buf);
+ if (res != PIGLIT_PASS)
+ piglit_report_result(PIGLIT_SKIP);
+
+ /* Make image_common.c resolve the entrypoints */
+ res = create_and_destroy_texture(buf, fourcc);
+ if (res != PIGLIT_PASS)
+ piglit_report_result(PIGLIT_SKIP);
+
+ /* Dissociate the DMABUF from the underlying driver */
+ struct piglit_dma_buf local_buf = *buf;
+ local_buf.fd = dup(buf->fd);
+ piglit_destroy_dma_buf(buf);
+
+ if (local_buf.fd < 0)
+ piglit_report_result(PIGLIT_FAIL);
+
+ struct thread_data data[THREAD_COUNT];
+ for (int i = 0; i < THREAD_COUNT; i++) {
+ data[i].buf = &local_buf;
+ data[i].fourcc = fourcc;
+ data[i].dpy = egl_dpy;
+ data[i].result = PIGLIT_PASS;
+
+ if (pthread_create(&data[i].thread, NULL, thread_main,
+ &data[i]))
+ piglit_report_result(PIGLIT_FAIL);
+ }
+
+ for (int i = 0; i < THREAD_COUNT; i++) {
+ pthread_join(data[i].thread, NULL);
+ if (data[i].result != PIGLIT_PASS)
+ piglit_report_result(data[i].result);
+ }
+
+ piglit_report_result(PIGLIT_PASS);
+}
diff --git a/tests/spec/ext_image_dma_buf_import/refcount.c b/tests/spec/ext_image_dma_buf_import/refcount.c
index 7ea200edd..6b6ac54b8 100644
--- a/tests/spec/ext_image_dma_buf_import/refcount.c
+++ b/tests/spec/ext_image_dma_buf_import/refcount.c
@@ -80,27 +80,27 @@ piglit_display(void)
close(buf->fd);
- res = texture_for_egl_image(img1, &tex1);
+ res = texture_for_egl_image(img1, &tex1, true);
if (res != PIGLIT_PASS)
return res;
- res = texture_for_egl_image(img2, &tex2);
+ res = texture_for_egl_image(img2, &tex2, true);
if (res != PIGLIT_PASS)
return res;
sample_tex(tex1,
0, y_spacing * 0,
- w * scale, h * scale);
+ w * scale, h * scale, true);
sample_tex(tex2,
0, y_spacing * 1,
- w * scale, h * scale);
+ w * scale, h * scale, true);
glDeleteTextures(1, &tex2);
eglDestroyImageKHR(eglGetCurrentDisplay(), img2);
sample_tex(tex1,
0, y_spacing * 2,
- w * scale, h * scale);
+ w * scale, h * scale, true);
expected = piglit_rgbw_image_ubyte(w * scale, h * scale, false);
@@ -127,4 +127,5 @@ piglit_init(int argc, char **argv)
piglit_require_egl_extension(egl_dpy, "EGL_EXT_image_dma_buf_import");
piglit_require_extension("GL_OES_EGL_image_external");
+ piglit_require_extension("GL_EXT_EGL_image_storage");
}
diff --git a/tests/spec/ext_image_dma_buf_import/reimport-bug.c b/tests/spec/ext_image_dma_buf_import/reimport-bug.c
index 185604d29..807e2e1ab 100644
--- a/tests/spec/ext_image_dma_buf_import/reimport-bug.c
+++ b/tests/spec/ext_image_dma_buf_import/reimport-bug.c
@@ -27,7 +27,7 @@
/**
* @file reimport-bug.c
*
- * Test verifies that we can succesfully reimport and map a DMABUF. This
+ * Test verifies that we can successfully reimport and map a DMABUF. This
* specifically checks that drivers, which may map a DMABUF, invalidates any
* such mappings (as needed) when it is reimported. This test has been tuned
* specifically for the iris driver.
diff --git a/tests/spec/ext_image_dma_buf_import/sample_common.c b/tests/spec/ext_image_dma_buf_import/sample_common.c
index b94cfd55e..7f3ac767d 100644
--- a/tests/spec/ext_image_dma_buf_import/sample_common.c
+++ b/tests/spec/ext_image_dma_buf_import/sample_common.c
@@ -28,7 +28,7 @@
#include "image_common.h"
#include "sample_common.h"
-static const char fs_src[] =
+static const char fs_src_external[] =
"#extension GL_OES_EGL_image_external : require\n"
"precision mediump float;\n"
"uniform samplerExternalOES sampler;\n"
@@ -38,6 +38,15 @@ static const char fs_src[] =
"{\n"
"gl_FragColor = texture2D(sampler, texcoords);\n"
"}\n";
+static const char fs_src[] =
+ "precision mediump float;\n"
+ "uniform sampler2D sampler;\n"
+ "varying vec2 texcoords;\n"
+ "\n"
+ "void main()\n"
+ "{\n"
+ "gl_FragColor = texture2D(sampler, texcoords);\n"
+ "}\n";
static const char vs_src[] =
"attribute vec4 piglit_vertex;\n"
"attribute vec4 piglit_texcoords;\n"
@@ -50,17 +59,17 @@ static const char vs_src[] =
"}\n";
enum piglit_result
-texture_for_egl_image(EGLImageKHR img, GLuint *out_tex)
+texture_for_egl_image(EGLImageKHR img, GLuint *out_tex, bool external)
{
GLuint tex;
GLenum error;
+ GLenum target = external ? GL_TEXTURE_EXTERNAL_OES : GL_TEXTURE_2D;
glGenTextures(1, &tex);
- glBindTexture(GL_TEXTURE_EXTERNAL_OES, tex);
+ glBindTexture(target, tex);
/* Set the image as level zero */
- glEGLImageTargetTexture2DOES(GL_TEXTURE_EXTERNAL_OES,
- (GLeglImageOES)img);
+ glEGLImageTargetTexStorageEXT(target, (GLeglImageOES)img, NULL);
error = glGetError();
/**
@@ -71,15 +80,13 @@ texture_for_egl_image(EGLImageKHR img, GLuint *out_tex)
return PIGLIT_SKIP;
if (error != GL_NO_ERROR) {
- printf("glEGLImageTargetTexture2DOES() failed: %s 0x%x\n",
+ printf("glEGLImageTargetTexStorageEXT() failed: %s 0x%x\n",
piglit_get_gl_error_name(error), error);
return PIGLIT_FAIL;
}
- glTexParameteri(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_MIN_FILTER,
- GL_NEAREST);
- glTexParameteri(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_MAG_FILTER,
- GL_NEAREST);
+ glTexParameteri(target, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+ glTexParameteri(target, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
*out_tex = tex;
@@ -87,15 +94,17 @@ texture_for_egl_image(EGLImageKHR img, GLuint *out_tex)
}
void
-sample_tex(GLuint tex, unsigned x, unsigned y, unsigned w, unsigned h)
+sample_tex(GLuint tex, unsigned x, unsigned y, unsigned w, unsigned h,
+ bool external)
{
GLuint prog;
- prog = piglit_build_simple_program(vs_src, fs_src);
+ prog = piglit_build_simple_program(vs_src, external ?
+ fs_src_external : fs_src);
glUseProgram(prog);
- glBindTexture(GL_TEXTURE_EXTERNAL_OES, tex);
+ glBindTexture(external ? GL_TEXTURE_EXTERNAL_OES : GL_TEXTURE_2D, tex);
glUniform1i(glGetUniformLocation(prog, "sampler"), 0);
glViewport(x, y, w, h);
@@ -153,6 +162,7 @@ egl_image_for_dma_buf_fd(struct piglit_dma_buf *buf, int fd, int fourcc, EGLImag
EGLint *attr;
switch (fourcc) {
case DRM_FORMAT_NV12:
+ case DRM_FORMAT_NV21:
case DRM_FORMAT_P010:
case DRM_FORMAT_P012:
case DRM_FORMAT_P016:
@@ -170,7 +180,6 @@ egl_image_for_dma_buf_fd(struct piglit_dma_buf *buf, int fd, int fourcc, EGLImag
img = eglCreateImageKHR(eglGetCurrentDisplay(), EGL_NO_CONTEXT,
EGL_LINUX_DMA_BUF_EXT, (EGLClientBuffer)0,
attr);
- *out_img = img;
error = eglGetError();
@@ -216,11 +225,11 @@ sample_buffer(struct piglit_dma_buf *buf, int fourcc)
if (res != PIGLIT_PASS)
return res;
- res = texture_for_egl_image(img, &tex);
+ res = texture_for_egl_image(img, &tex, true);
if (res != PIGLIT_PASS)
goto destroy;
- sample_tex(tex, 0, 0, w, h);
+ sample_tex(tex, 0, 0, w, h, true);
destroy:
glDeleteTextures(1, &tex);
diff --git a/tests/spec/ext_image_dma_buf_import/sample_common.h b/tests/spec/ext_image_dma_buf_import/sample_common.h
index f02e1e0e3..c12686dc7 100644
--- a/tests/spec/ext_image_dma_buf_import/sample_common.h
+++ b/tests/spec/ext_image_dma_buf_import/sample_common.h
@@ -40,10 +40,11 @@ enum piglit_result
egl_image_for_dma_buf_fd(struct piglit_dma_buf *buf, int fd, int fourcc, EGLImageKHR *out_img);
enum piglit_result
-texture_for_egl_image(EGLImageKHR img, GLuint *out_tex);
+texture_for_egl_image(EGLImageKHR img, GLuint *out_tex, bool external);
void
-sample_tex(GLuint tex, unsigned x, unsigned y, unsigned w, unsigned h);
+sample_tex(GLuint tex, unsigned x, unsigned y, unsigned w, unsigned h,
+ bool external);
void
usage(const char *name, const char *color_space);
diff --git a/tests/spec/ext_image_dma_buf_import/sample_yuv.c b/tests/spec/ext_image_dma_buf_import/sample_yuv.c
index ff5da0b3e..9283baad2 100644
--- a/tests/spec/ext_image_dma_buf_import/sample_yuv.c
+++ b/tests/spec/ext_image_dma_buf_import/sample_yuv.c
@@ -169,6 +169,15 @@ piglit_display(void)
/* UV */
120, 130, 140, 130,
120, 160, 140, 160,
+ }, nv21[] = {
+ /* Y */
+ 50, 70, 90, 110,
+ 50, 70, 90, 110,
+ 50, 70, 90, 110,
+ 50, 70, 90, 110,
+ /* VU */
+ 130, 120, 130, 140,
+ 160, 120, 160, 140,
}, yuv420[] = {
/* Y */
50, 70, 90, 110,
@@ -224,6 +233,26 @@ piglit_display(void)
90, 140, 110, 160,
50, 121, 70, 161,
90, 140, 110, 160,
+ }, yvyu[] = {
+ /* YVYU */
+ 50, 130, 70, 120,
+ 89, 130, 110, 140,
+ 50, 130, 70, 120,
+ 89, 130, 110, 140,
+ 50, 161, 70, 121,
+ 90, 160, 110, 140,
+ 50, 161, 70, 121,
+ 90, 160, 110, 140,
+ }, vyuy[] = {
+ /* VYUY */
+ 130, 50, 120, 70,
+ 130, 89, 140, 110,
+ 130, 50, 120, 70,
+ 130, 89, 140, 110,
+ 161, 50, 121, 70,
+ 160, 90, 140, 110,
+ 161, 50, 121, 70,
+ 160, 90, 140, 110,
}, uyvy[] = {
/* UYVY */
120, 50, 130, 70,
@@ -311,6 +340,9 @@ piglit_display(void)
case DRM_FORMAT_NV12:
t = nv12;
break;
+ case DRM_FORMAT_NV21:
+ t = nv21;
+ break;
case DRM_FORMAT_YUV420:
t = yuv420;
break;
@@ -324,9 +356,15 @@ piglit_display(void)
case DRM_FORMAT_YUYV:
t = yuyv;
break;
+ case DRM_FORMAT_YVYU:
+ t = yvyu;
+ break;
case DRM_FORMAT_UYVY:
t = uyvy;
break;
+ case DRM_FORMAT_VYUY:
+ t = vyuy;
+ break;
default:
fprintf(stderr, "invalid fourcc: %.4s\n", (char *)&fourcc);
return PIGLIT_SKIP;
diff --git a/tests/spec/ext_instanced_arrays/CMakeLists.gles2.txt b/tests/spec/ext_instanced_arrays/CMakeLists.gles2.txt
new file mode 100644
index 000000000..e755cf402
--- /dev/null
+++ b/tests/spec/ext_instanced_arrays/CMakeLists.gles2.txt
@@ -0,0 +1,12 @@
+include_directories(
+ ${GLEXT_INCLUDE_DIR}
+ ${OPENGL_INCLUDE_PATH}
+)
+
+link_libraries (
+ piglitutil_${piglit_target_api}
+ ${OPENGL_gl_LIBRARY}
+)
+
+piglit_add_executable (ext_instanced_arrays-instanced_arrays instanced_arrays.c)
+piglit_add_executable (ext_instanced_arrays-vertex-attrib-divisor-index-error vertex-attrib-divisor-index-error.c) \ No newline at end of file
diff --git a/tests/spec/ext_instanced_arrays/CMakeLists.txt b/tests/spec/ext_instanced_arrays/CMakeLists.txt
new file mode 100644
index 000000000..4a012b958
--- /dev/null
+++ b/tests/spec/ext_instanced_arrays/CMakeLists.txt
@@ -0,0 +1 @@
+piglit_include_target_api() \ No newline at end of file
diff --git a/tests/spec/ext_instanced_arrays/instanced_arrays.c b/tests/spec/ext_instanced_arrays/instanced_arrays.c
new file mode 100644
index 000000000..8b032af33
--- /dev/null
+++ b/tests/spec/ext_instanced_arrays/instanced_arrays.c
@@ -0,0 +1,139 @@
+/*
+ * Copyright 2023 Collabora, Ltd.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * on the rights to use, copy, modify, merge, publish, distribute, sub
+ * license, and/or sell copies of the Software, and to permit persons to whom
+ * the Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NON-INFRINGEMENT. IN NO EVENT SHALL VMWARE AND/OR THEIR SUPPLIERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/**
+ * @file
+ * Tests GL_EXT_instanced_arrays
+ */
+
+#include "piglit-util-gl.h"
+#include "piglit-matrix.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+ config.supports_gl_es_version = 20;
+
+ config.window_width = 500;
+ config.window_height = 500;
+ config.window_visual = PIGLIT_GL_VISUAL_RGBA | PIGLIT_GL_VISUAL_DOUBLE;
+ config.khr_no_error_support = PIGLIT_NO_ERRORS;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+#define NUM_TRIANGLES 10
+
+static const char *VertShaderText =
+ "attribute vec3 Vertex; \n"
+ "attribute mat4 Matrix; \n"
+ "void main() \n"
+ "{ \n"
+ " gl_Position = Matrix*vec4(Vertex, 1.0); \n"
+ "} \n";
+
+static const char *FragShaderText =
+ "void main() \n"
+ "{ \n"
+ " gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0); \n"
+ "} \n";
+
+
+static GLuint Program;
+static GLuint vbo, mbo;
+static GLint VertexAttrib, MatrixAttrib;
+
+enum piglit_result
+piglit_display(void)
+{
+ float white[] = { 1.0f, 1.0f, 1.0f, 1.0f };
+ float transparent[] = { 0.0f, 0.0f, 0.0f, 0.0f };
+ float vertices[9] = {-0.1f, -0.1f , 0.0f,
+ 0.1f, -0.1f , 0.0f,
+ 0.0f, 0.15f, 0.0f};
+ glGenBuffers(1, &vbo);
+ glBindBuffer(GL_ARRAY_BUFFER, vbo);
+ glBufferData(GL_ARRAY_BUFFER, 9*sizeof(float), vertices, GL_STATIC_DRAW);
+ glVertexAttribPointer(VertexAttrib, 3, GL_FLOAT, GL_FALSE, (GLsizei)3*sizeof(float), NULL);
+ glEnableVertexAttribArray(VertexAttrib);
+
+ float mat[NUM_TRIANGLES * 16];
+ for (int matrix_id=0; matrix_id < NUM_TRIANGLES; matrix_id++) {
+ float pos_x = cos(2*M_PI*matrix_id / NUM_TRIANGLES);
+ float pos_y = sin(2*M_PI*matrix_id / NUM_TRIANGLES);
+ int i = 16 * matrix_id;
+ piglit_identity_matrix (&mat[i]);
+ mat[i+12] = pos_x;
+ mat[i+13] = pos_y;
+ }
+ glGenBuffers(1, &mbo);
+ glBindBuffer(GL_ARRAY_BUFFER, mbo);
+ glBufferData(GL_ARRAY_BUFFER, NUM_TRIANGLES * 16 * sizeof(float),
+ mat, GL_DYNAMIC_DRAW);
+ for (unsigned int i = 0; i < 4; i++) {
+ glEnableVertexAttribArray(MatrixAttrib + i);
+ glVertexAttribPointer(MatrixAttrib + i, 4, GL_FLOAT, GL_FALSE,
+ 16 * sizeof(float),
+ (const GLvoid *)(sizeof(GLfloat) * i * 4));
+ glVertexAttribDivisorEXT(MatrixAttrib + i, 1);
+ if (!piglit_check_gl_error(GL_NO_ERROR)) {
+ piglit_present_results();
+ return PIGLIT_FAIL;
+ }
+ }
+
+ glClear(GL_COLOR_BUFFER_BIT);
+
+ glDrawArraysInstancedEXT(GL_TRIANGLES, 0, 3, (GLsizei)NUM_TRIANGLES);
+ if (!piglit_check_gl_error(GL_NO_ERROR)) {
+ piglit_present_results();
+ return PIGLIT_FAIL;
+ }
+
+ if (!piglit_probe_pixel_rgba(piglit_width - 1, piglit_height/2, white)) {
+ piglit_present_results();
+ return PIGLIT_FAIL;
+ }
+
+ if (!piglit_probe_pixel_rgba(0, 0, transparent)) {
+ piglit_present_results();
+ return PIGLIT_FAIL;
+ }
+
+ piglit_present_results();
+
+ return PIGLIT_PASS;
+}
+
+
+void
+piglit_init(int argc, char **argv)
+{
+ piglit_require_extension("GL_EXT_instanced_arrays");
+
+ Program = piglit_build_simple_program(VertShaderText, FragShaderText);
+
+ glUseProgram(Program);
+
+ VertexAttrib = glGetAttribLocation(Program, "Vertex");
+ MatrixAttrib = glGetAttribLocation(Program, "Matrix");
+}
diff --git a/tests/spec/ext_instanced_arrays/vertex-attrib-divisor-index-error.c b/tests/spec/ext_instanced_arrays/vertex-attrib-divisor-index-error.c
new file mode 100644
index 000000000..02ffb6321
--- /dev/null
+++ b/tests/spec/ext_instanced_arrays/vertex-attrib-divisor-index-error.c
@@ -0,0 +1,64 @@
+/**
+ * Copyright © 2013 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+/**
+ * \file
+ * Test that VertexAttribDivisor() generates INVALID_VALUE if index is greater
+ * than or equal to MAX_VERTEX_ATTRIBS.
+ *
+ * GL 3.3 core spec, section 2.8 (Vertex Arrays) says:
+ * "An INVALID_VALUE error is generated if index is greater than or equal to the
+ * value of MAX_VERTEX_ATTRIBS."
+ */
+
+#include "piglit-util-gl.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+ config.supports_gl_es_version = 20;
+ config.khr_no_error_support = PIGLIT_HAS_ERRORS;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+void
+piglit_init(int argc, char **argv)
+{
+ bool pass = true;
+ GLint maxAttribCount = 0;
+
+ if(piglit_get_gl_version() < 30)
+ piglit_require_extension("GL_EXT_instanced_arrays");
+
+ glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, &maxAttribCount);
+ glVertexAttribDivisor(maxAttribCount, 0);
+ pass = piglit_check_gl_error(GL_INVALID_VALUE) && pass;
+
+ piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);
+}
+
+enum piglit_result
+piglit_display(void)
+{
+ /* UNREACHED */
+ return PIGLIT_FAIL;
+}
diff --git a/tests/spec/ext_occlusion_query_boolean/any-samples.c b/tests/spec/ext_occlusion_query_boolean/any-samples.c
index 4963346d4..d10e24cd6 100644
--- a/tests/spec/ext_occlusion_query_boolean/any-samples.c
+++ b/tests/spec/ext_occlusion_query_boolean/any-samples.c
@@ -24,7 +24,7 @@
/**
* @file
* Tests GL_EXT_occlusion_query_boolean extension. Test does not to cover
- * the whole API as that is tested throughly by existing arb_occlusion_query
+ * the whole API as that is tested thoroughly by existing arb_occlusion_query
* and arb_occlusion_query2 tests. Main objective is to test that boolean
* query works on OpenGL ES 2.0.
*/
diff --git a/tests/spec/ext_packed_depth_stencil/errors.c b/tests/spec/ext_packed_depth_stencil/errors.c
index d2c1c4df4..6393a1f59 100644
--- a/tests/spec/ext_packed_depth_stencil/errors.c
+++ b/tests/spec/ext_packed_depth_stencil/errors.c
@@ -40,7 +40,7 @@ PIGLIT_GL_TEST_CONFIG_END
static bool
test_drawpixels(void)
{
- GLuint p[1];
+ GLuint p[1] = {0};
glDrawPixels(1, 1, GL_DEPTH_STENCIL_EXT, GL_UNSIGNED_INT, p);
if (!piglit_check_gl_error(GL_INVALID_ENUM))
diff --git a/tests/spec/ext_render_snorm/render.c b/tests/spec/ext_render_snorm/render.c
index 1d4a69c2d..be4adbe20 100644
--- a/tests/spec/ext_render_snorm/render.c
+++ b/tests/spec/ext_render_snorm/render.c
@@ -38,14 +38,14 @@
#include "piglit-util-gl.h"
PIGLIT_GL_TEST_CONFIG_BEGIN
- config.supports_gl_es_version = 31;
+ config.supports_gl_es_version = 30;
config.window_visual = PIGLIT_GL_VISUAL_RGBA;
PIGLIT_GL_TEST_CONFIG_END
#define PIGLIT_RESULT(x) x ? PIGLIT_PASS : PIGLIT_FAIL
static const char vs_source[] =
- "#version 310 es\n"
+ "#version 300 es\n"
"layout(location = 0) in highp vec4 vertex;\n"
"layout(location = 1) in highp vec4 uv;\n"
"out highp vec2 tex_coord;\n"
@@ -57,8 +57,8 @@ static const char vs_source[] =
"}\n";
static const char fs_source[] =
- "#version 310 es\n"
- "layout(location = 0) uniform sampler2D texture;\n"
+ "#version 300 es\n"
+ "uniform sampler2D texture;\n"
"in highp vec2 tex_coord;\n"
"out highp vec4 color;\n"
"void main()\n"
@@ -107,18 +107,18 @@ value_for_format(const struct fmt_test *test, void *value)
char *v = value;
/* red */
- v[0] = val;
+ v[0] = -val;
/* green */
if (test->bpp > 1) {
v[0] = 0;
- v[1] = val;
+ v[1] = -val;
}
/* blue */
if (test->bpp > 2) {
- v[0] = 0;
+ v[0] = -val;
v[1] = 0;
v[2] = val;
- v[3] = val;
+ v[3] = -val;
}
}
@@ -174,7 +174,7 @@ static GLuint
create_and_bind_fbo(const struct fmt_test *test, GLuint *tex)
{
GLuint fbo;
- GLuint fbo_tex = create_and_bind_empty_texture(test);
+ GLuint fbo_tex = create_and_bind_empty_texture();
upload(test, NULL);
*tex = fbo_tex;
@@ -235,7 +235,7 @@ test_format(const struct fmt_test *test)
bool pass = true;
glUseProgram(prog);
- glUniform1i(0 /* explicit loc */, 0);
+ glUniform1i(glGetUniformLocation(prog, "texture"), 0);
/* Test glRenderbufferStorage. */
GLuint rbo = create_and_bind_rbo(test);
diff --git a/tests/spec/ext_texture_env_combine/combine.c b/tests/spec/ext_texture_env_combine/combine.c
index 0b6486357..0254d94fd 100644
--- a/tests/spec/ext_texture_env_combine/combine.c
+++ b/tests/spec/ext_texture_env_combine/combine.c
@@ -1123,7 +1123,7 @@ run_multi_texture_test(void)
}
/* We do a really short, simple test for GL_ARB_texture_env_crossbar since the
- * preceeding tests are pretty comprehensive and the crossbar feature is just
+ * preceding tests are pretty comprehensive and the crossbar feature is just
* an incremental addition. Basically, if we have N texture units we run N
* tests. For test [i] we set texture unit [i] to fetch the texture color
* from unit [num_units - i - 1]. For units != i we use the constant color
@@ -1258,7 +1258,7 @@ piglit_init(int argc, char **argv)
{
piglit_require_extension("GL_EXT_texture_env_combine");
- /* Test the availability of the DOT3 extenstion */
+ /* Test the availability of the DOT3 extension */
have_dot3 = piglit_is_extension_supported("GL_EXT_texture_env_dot3");
have_crossbar =
diff --git a/tests/spec/ext_texture_format_bgra8888/api-errors.c b/tests/spec/ext_texture_format_bgra8888/api-errors.c
index a432ded5e..ea164ee57 100644
--- a/tests/spec/ext_texture_format_bgra8888/api-errors.c
+++ b/tests/spec/ext_texture_format_bgra8888/api-errors.c
@@ -41,11 +41,13 @@ PIGLIT_GL_TEST_CONFIG_END
static bool
run_test(void)
{
- GLuint tex;
+ GLuint tex, rb;
bool pass = true;
glGenTextures(1, &tex);
glBindTexture(GL_TEXTURE_2D, tex);
+ glGenRenderbuffers(1, &rb);
+ glBindRenderbuffer(GL_RENDERBUFFER, tex);
if (!piglit_check_gl_error(GL_NO_ERROR))
return false;
@@ -110,7 +112,13 @@ run_test(void)
if (!piglit_check_gl_error(GL_INVALID_OPERATION))
pass = false;
+ /* glRenderbufferStorage */
+ glRenderbufferStorage(GL_RENDERBUFFER, GL_BGRA_EXT, 2, 2);
+ if (!piglit_check_gl_error(GL_NO_ERROR))
+ pass = false;
+
glDeleteTextures(1, &tex);
+ glDeleteRenderbuffers(1, &rb);
return pass;
}
diff --git a/tests/spec/ext_texture_storage/CMakeLists.gles2.txt b/tests/spec/ext_texture_storage/CMakeLists.gles2.txt
new file mode 100644
index 000000000..26d2b4ab5
--- /dev/null
+++ b/tests/spec/ext_texture_storage/CMakeLists.gles2.txt
@@ -0,0 +1,7 @@
+link_libraries (
+ piglitutil_${piglit_target_api}
+)
+
+piglit_add_executable (ext_texture_storage-formats formats.c)
+
+# vim: ft=cmake:
diff --git a/tests/spec/ext_texture_storage/CMakeLists.txt b/tests/spec/ext_texture_storage/CMakeLists.txt
new file mode 100644
index 000000000..144a306f4
--- /dev/null
+++ b/tests/spec/ext_texture_storage/CMakeLists.txt
@@ -0,0 +1 @@
+piglit_include_target_api()
diff --git a/tests/spec/ext_texture_storage/formats.c b/tests/spec/ext_texture_storage/formats.c
new file mode 100644
index 000000000..95972ef8a
--- /dev/null
+++ b/tests/spec/ext_texture_storage/formats.c
@@ -0,0 +1,211 @@
+/*
+ * Copyright © 2024 Collabora, Ltd.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+/**
+ * @file
+ * Tests glTexStorage2DEXT interactions with formats defined in other
+ * extensions, which is not covered by the CTS.
+ */
+
+#include "piglit-util-gl.h"
+
+static struct piglit_gl_test_config *piglit_config;
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+ piglit_config = &config;
+ config.supports_gl_es_version = 20;
+ config.window_visual = PIGLIT_GL_VISUAL_RGBA;
+ config.khr_no_error_support = PIGLIT_HAS_ERRORS;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+struct format_test {
+ const char *ext_names[2];
+ const GLenum formats[5];
+};
+
+static enum piglit_result
+check_formats(void *data_)
+{
+ const struct format_test *data = data_;
+ bool failed = false;
+
+ for (int i = 0; i < ARRAY_SIZE(data->ext_names); i++) {
+ if (data->ext_names[i] &&
+ !piglit_is_extension_supported(data->ext_names[i])) {
+ return PIGLIT_SKIP;
+ }
+ }
+
+ piglit_reset_gl_error();
+
+ for (int i = 0; i < ARRAY_SIZE(data->formats); i++) {
+ GLuint tex;
+ GLint param;
+
+ if (data->formats[i] == GL_NONE)
+ continue;
+
+ piglit_logi("checking %s",
+ piglit_get_gl_enum_name(data->formats[i]));
+
+ glActiveTexture(GL_TEXTURE0);
+ glGenTextures(1, &tex);
+ glBindTexture(GL_TEXTURE_2D, tex);
+ glTexStorage2DEXT(GL_TEXTURE_2D, 1, data->formats[i], 128, 128);
+
+ if (!piglit_check_gl_error(GL_NO_ERROR))
+ failed = true;
+
+ glGetTexParameteriv(GL_TEXTURE_2D,
+ GL_TEXTURE_IMMUTABLE_FORMAT_EXT,
+ &param);
+ if (param != GL_TRUE)
+ failed = true;
+
+ glDeleteTextures(1, &tex);
+ }
+
+ return failed ? PIGLIT_FAIL : PIGLIT_PASS;
+}
+
+static const struct format_test format_tests[] = {
+ {
+ { },
+ { GL_ALPHA8_EXT, GL_LUMINANCE8_EXT, GL_LUMINANCE8_ALPHA8_EXT, },
+ },
+ {
+ { "GL_OES_texture_float", },
+ {
+ GL_RGBA32F_EXT, GL_RGB32F_EXT,
+ GL_ALPHA32F_EXT, GL_LUMINANCE32F_EXT,
+ GL_LUMINANCE_ALPHA32F_EXT,
+ },
+ },
+ {
+ { "GL_OES_texture_half_float", },
+ {
+ GL_RGBA16F_EXT, GL_RGB16F_EXT,
+ GL_ALPHA16F_EXT, GL_LUMINANCE16F_EXT,
+ GL_LUMINANCE_ALPHA16F_EXT,
+ },
+ },
+ {
+ { "GL_EXT_texture_type_2_10_10_10_REV", },
+ { GL_RGB10_A2_EXT, GL_RGB10_EXT, },
+ },
+ {
+ { "GL_EXT_texture_format_BGRA8888", },
+ { GL_BGRA8_EXT, },
+ },
+ {
+ { "GL_EXT_texture_rg", },
+ { GL_R8_EXT, GL_RG8_EXT, },
+ },
+ {
+ { "GL_EXT_texture_rg", "GL_OES_texture_float", },
+ { GL_R32F_EXT, GL_RG32F_EXT, },
+ },
+ {
+ { "GL_EXT_texture_rg", "GL_OES_texture_half_float", },
+ { GL_R16F_EXT, GL_RG16F_EXT, },
+ },
+ {
+ { "GL_APPLE_rgb_422", },
+ { GL_RGB_RAW_422_APPLE, },
+ },
+};
+
+enum piglit_result
+piglit_display(void)
+{
+ return PIGLIT_FAIL;
+}
+
+void
+piglit_init(int argc, char **argv)
+{
+ enum piglit_result result;
+ struct piglit_subtest subtests[ARRAY_SIZE(format_tests) + 1];
+
+ piglit_require_extension("GL_EXT_texture_storage");
+
+ subtests[0].name = strdup("Check core extension");
+ subtests[0].option = strdup("core");
+ subtests[0].subtest_func = check_formats;
+ subtests[0].data = (void *) &format_tests[0];
+
+ for (int i = 1; i < ARRAY_SIZE(format_tests); i++) {
+ const char *lead = "Check interactions with ";
+ char *name, *opt;
+ int ext_len = 0;
+
+ for (int j = 0; j < ARRAY_SIZE(format_tests[i].ext_names); j++) {
+ if (!format_tests[i].ext_names[j])
+ continue;
+ ext_len += strlen(format_tests[i].ext_names[j]) + 1;
+ }
+
+ name = calloc(strlen(lead) + ext_len + 1, 1);
+ opt = calloc(ext_len + 1, 1);
+ if (!name || !opt) {
+ free(name);
+ free(opt);
+ return;
+ }
+
+ strcat(name, lead);
+
+ for (int j = 0; j < ARRAY_SIZE(format_tests[i].ext_names); j++) {
+ if (!format_tests[i].ext_names[j])
+ continue;
+
+ if (j > 0) {
+ strcat(name, " ");
+ strcat(opt, "-");
+ }
+ strcat(name, format_tests[i].ext_names[j]);
+ strcat(opt, format_tests[i].ext_names[j]);
+ }
+
+ subtests[i].name = name;
+ subtests[i].option = opt;
+ subtests[i].subtest_func = check_formats;
+ subtests[i].data = (void *) &format_tests[i];
+ }
+
+ memset(&subtests[ARRAY_SIZE(format_tests)], 0, sizeof(*subtests));
+
+ result = piglit_run_selected_subtests(subtests,
+ piglit_config->selected_subtests,
+ piglit_config->num_selected_subtests,
+ PIGLIT_SKIP);
+
+ piglit_report_result(result);
+
+ for (int i = 0; i < ARRAY_SIZE(subtests); i++) {
+ free((char *) subtests[i].name);
+ free((char *) subtests[i].option);
+ }
+}
diff --git a/tests/spec/ext_texture_swizzle/depth_texture_mode_and_swizzle.c b/tests/spec/ext_texture_swizzle/depth_texture_mode_and_swizzle.c
index 6f9d7f38c..cb87fad1e 100644
--- a/tests/spec/ext_texture_swizzle/depth_texture_mode_and_swizzle.c
+++ b/tests/spec/ext_texture_swizzle/depth_texture_mode_and_swizzle.c
@@ -26,7 +26,7 @@
*
* Tests the interactions between EXT_texture_swizzle and DEPTH_TEXTURE_MODE.
*
- * From the EXT_texture_swizzle specfication:
+ * From the EXT_texture_swizzle specification:
* "4) How does this interact with depth component textures?
*
* RESOLVED: The swizzle is applied after the DEPTH_TEXTURE_MODE. This
diff --git a/tests/spec/ext_transform_feedback/api-errors.c b/tests/spec/ext_transform_feedback/api-errors.c
index b5437776c..d74943712 100644
--- a/tests/spec/ext_transform_feedback/api-errors.c
+++ b/tests/spec/ext_transform_feedback/api-errors.c
@@ -411,6 +411,7 @@ do_test(const struct test_desc *test)
break;
}
+ glEndTransformFeedback();
return pass;
}
diff --git a/tests/spec/ext_transform_feedback/builtin-varyings.c b/tests/spec/ext_transform_feedback/builtin-varyings.c
index 29d84fe96..aeee87057 100644
--- a/tests/spec/ext_transform_feedback/builtin-varyings.c
+++ b/tests/spec/ext_transform_feedback/builtin-varyings.c
@@ -433,6 +433,32 @@ struct test_desc {
GL_FLOAT, /* expected_type */
1, /* expected_size */
},
+ {
+ "gl_CullDistance", /* name */
+ 130, /* version */
+
+ "#version 130\n" /* vs */
+ "#extension GL_ARB_cull_distance : enable\n" /* vs */
+ "in vec4 vertex_pos;\n"
+ "in float vertex_num;\n"
+ "out float gl_CullDistance[8];\n"
+ "void main() {\n"
+ " gl_Position = vertex_pos;\n"
+ " float scale = 1.0/256.0;\n"
+ " for(int i = 0; i < 8; ++i)\n"
+ " gl_CullDistance[i] = (float(i) + 8.0 * vertex_num) * scale;\n"
+ "}\n",
+
+ 8, /* num_varyings */
+ {"gl_CullDistance[0]", "gl_CullDistance[1]", /* varyings */
+ "gl_CullDistance[2]", "gl_CullDistance[3]",
+ "gl_CullDistance[4]", "gl_CullDistance[5]",
+ "gl_CullDistance[6]", "gl_CullDistance[7]"},
+
+ 8, /* expected_num_output_components */
+ GL_FLOAT, /* expected_type */
+ 1, /* expected_size */
+ },
};
const struct test_desc *test_to_run;
@@ -480,6 +506,9 @@ piglit_init(int argc, char **argv)
/* Set up test */
piglit_require_vertex_shader();
piglit_require_GLSL_version(test_to_run->version);
+ if (strcmp("gl_CullDistance", test_to_run->name) == 0) {
+ piglit_require_extension("GL_ARB_cull_distance");
+ }
piglit_require_transform_feedback();
vs = piglit_compile_shader_text(GL_VERTEX_SHADER, test_to_run->vs);
prog = glCreateProgram();
diff --git a/tests/spec/ext_transform_feedback/discard-bitmap.c b/tests/spec/ext_transform_feedback/discard-bitmap.c
index 0f5db5018..428c87e06 100644
--- a/tests/spec/ext_transform_feedback/discard-bitmap.c
+++ b/tests/spec/ext_transform_feedback/discard-bitmap.c
@@ -32,7 +32,7 @@
*
* "Primitives can be optionally discarded before rasterization by
* calling Enable and Disable with RASTERIZER_DISCARD_EXT. When
- * enabled, primitives are discared right before the
+ * enabled, primitives are discarded right before the
* rasterization stage, but after the optional transform feedback
* stage. When disabled, primitives are passed through to the
* rasterization stage to be processed
diff --git a/tests/spec/ext_transform_feedback/discard-clear.c b/tests/spec/ext_transform_feedback/discard-clear.c
index d67aad5f2..9db26a9d5 100644
--- a/tests/spec/ext_transform_feedback/discard-clear.c
+++ b/tests/spec/ext_transform_feedback/discard-clear.c
@@ -32,7 +32,7 @@
*
* "Primitives can be optionally discarded before rasterization by
* calling Enable and Disable with RASTERIZER_DISCARD_EXT. When
- * enabled, primitives are discared right before the
+ * enabled, primitives are discarded right before the
* rasterization stage, but after the optional transform feedback
* stage. When disabled, primitives are passed through to the
* rasterization stage to be processed
diff --git a/tests/spec/ext_transform_feedback/discard-copypixels.c b/tests/spec/ext_transform_feedback/discard-copypixels.c
index cfd796b4e..b3c2f5fe9 100644
--- a/tests/spec/ext_transform_feedback/discard-copypixels.c
+++ b/tests/spec/ext_transform_feedback/discard-copypixels.c
@@ -32,7 +32,7 @@
*
* "Primitives can be optionally discarded before rasterization by
* calling Enable and Disable with RASTERIZER_DISCARD_EXT. When
- * enabled, primitives are discared right before the
+ * enabled, primitives are discarded right before the
* rasterization stage, but after the optional transform feedback
* stage. When disabled, primitives are passed through to the
* rasterization stage to be processed
diff --git a/tests/spec/ext_transform_feedback/discard-drawarrays.c b/tests/spec/ext_transform_feedback/discard-drawarrays.c
index ec47dd03d..f32807b72 100644
--- a/tests/spec/ext_transform_feedback/discard-drawarrays.c
+++ b/tests/spec/ext_transform_feedback/discard-drawarrays.c
@@ -33,7 +33,7 @@
*
* "Primitives can be optionally discarded before rasterization by
* calling Enable and Disable with RASTERIZER_DISCARD_EXT. When
- * enabled, primitives are discared right before the
+ * enabled, primitives are discarded right before the
* rasterization stage, but after the optional transform feedback
* stage. When disabled, primitives are passed through to the
* rasterization stage to be processed
diff --git a/tests/spec/ext_transform_feedback/discard-drawpixels.c b/tests/spec/ext_transform_feedback/discard-drawpixels.c
index a7958c9e4..94a643412 100644
--- a/tests/spec/ext_transform_feedback/discard-drawpixels.c
+++ b/tests/spec/ext_transform_feedback/discard-drawpixels.c
@@ -32,7 +32,7 @@
*
* "Primitives can be optionally discarded before rasterization by
* calling Enable and Disable with RASTERIZER_DISCARD_EXT. When
- * enabled, primitives are discared right before the
+ * enabled, primitives are discarded right before the
* rasterization stage, but after the optional transform feedback
* stage. When disabled, primitives are passed through to the
* rasterization stage to be processed
diff --git a/tests/spec/ext_transform_feedback/geometry-shaders-basic.c b/tests/spec/ext_transform_feedback/geometry-shaders-basic.c
index 213c80441..140de9b74 100644
--- a/tests/spec/ext_transform_feedback/geometry-shaders-basic.c
+++ b/tests/spec/ext_transform_feedback/geometry-shaders-basic.c
@@ -41,6 +41,7 @@
#include "piglit-util-gl.h"
#define GEOM_OUT_VERTS 10
+#define DRAW_COUNT 10
PIGLIT_GL_TEST_CONFIG_BEGIN
config.supports_gl_compat_version = 32;
@@ -114,9 +115,9 @@ piglit_init(int argc, char **argv)
glGenBuffers(1, &xfb_buf);
glBindBuffer(GL_TRANSFORM_FEEDBACK_BUFFER, xfb_buf);
glBufferData(GL_TRANSFORM_FEEDBACK_BUFFER,
- GEOM_OUT_VERTS * sizeof(GLint), NULL, GL_STREAM_READ);
+ DRAW_COUNT * GEOM_OUT_VERTS * sizeof(GLint), NULL, GL_STREAM_READ);
glBindBufferRange(GL_TRANSFORM_FEEDBACK_BUFFER, 0, xfb_buf, 0,
- GEOM_OUT_VERTS * sizeof(GLint));
+ DRAW_COUNT * GEOM_OUT_VERTS * sizeof(GLint));
/* Setup queries */
glGenQueries(1, &generated_query);
@@ -126,21 +127,25 @@ piglit_init(int argc, char **argv)
/* Do drawing */
glBeginTransformFeedback(GL_POINTS);
- glDrawArrays(GL_POINTS, 0, 1);
+ for (i = 0; i < DRAW_COUNT; i++) {
+ glDrawArrays(GL_POINTS, 0, 1);
+ glPauseTransformFeedback();
+ glResumeTransformFeedback();
+ }
glEndTransformFeedback();
/* Check query results */
glEndQuery(GL_PRIMITIVES_GENERATED);
glEndQuery(GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN);
glGetQueryObjectuiv(generated_query, GL_QUERY_RESULT, &query_result);
- if (query_result != GEOM_OUT_VERTS) {
+ if (query_result != DRAW_COUNT * GEOM_OUT_VERTS) {
printf("GL_PRIMITIVES_GENERATED query failed."
" Expected %d, got %d.\n", GEOM_OUT_VERTS,
query_result);
pass = false;
}
glGetQueryObjectuiv(written_query, GL_QUERY_RESULT, &query_result);
- if (query_result != GEOM_OUT_VERTS) {
+ if (query_result != DRAW_COUNT * GEOM_OUT_VERTS) {
printf("GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN query failed."
" Expected %d, got %d.\n", GEOM_OUT_VERTS,
query_result);
@@ -149,10 +154,12 @@ piglit_init(int argc, char **argv)
/* Check transform feedback data */
readback = glMapBuffer(GL_TRANSFORM_FEEDBACK_BUFFER, GL_READ_ONLY);
- for (i = 0; i < GEOM_OUT_VERTS; i++) {
- if (readback[i] != i) {
+ for (i = 0; i < DRAW_COUNT * GEOM_OUT_VERTS; i++) {
+ GLint expected = i % DRAW_COUNT;
+ GLint got = readback[i];
+ if (got != expected) {
printf("Incorrect data for vertex %d."
- " Expected %d, got %d.", i, i, readback[i]);
+ " Expected %d, got %d.", i, expected, got);
pass = false;
}
}
diff --git a/tests/spec/ext_transform_feedback/max-varyings.c b/tests/spec/ext_transform_feedback/max-varyings.c
index bbce09cce..dfe4b66bc 100644
--- a/tests/spec/ext_transform_feedback/max-varyings.c
+++ b/tests/spec/ext_transform_feedback/max-varyings.c
@@ -204,7 +204,7 @@ init_xfb_varyings(int max_varyings)
/* Initialise arrays of arrays */
for (i = 0; i < AOA_OUTER_DIM; ++i) {
for (j = 0; j < inner_dim; ++j) {
- char *buf = malloc(16);
+ char *buf = malloc(17);
sprintf(buf, "v[%d][%d]", i, j);
xfb_varying_aoa[count++] = buf;
}
diff --git a/tests/spec/ext_transform_feedback/negative-prims.c b/tests/spec/ext_transform_feedback/negative-prims.c
index 7716f61d4..c5b6a5319 100644
--- a/tests/spec/ext_transform_feedback/negative-prims.c
+++ b/tests/spec/ext_transform_feedback/negative-prims.c
@@ -88,7 +88,7 @@ test_one_prim(GLenum tf_prim, int i)
}
} else {
if (error != 0) {
- printf("Unxpected GL error 0x%x when "
+ printf("Unexpected GL error 0x%x when "
"rendering %s during %s transform feedback\n",
error,
prim_name, tf_name);
diff --git a/tests/spec/ext_transform_feedback/order.c b/tests/spec/ext_transform_feedback/order.c
index 62f83b212..647c9b111 100644
--- a/tests/spec/ext_transform_feedback/order.c
+++ b/tests/spec/ext_transform_feedback/order.c
@@ -38,7 +38,7 @@
* correct order by using a vertex shader whose execution time is
* dramatically different for different vertices.
*
- * The test requries two command line arguments:
+ * The test requires two command line arguments:
*
* - drawcall indicates which drawing function should be called. A
* value of "arrays" causes DrawArrays() to be used. A value of
diff --git a/tests/spec/ext_transform_feedback/structs.c b/tests/spec/ext_transform_feedback/structs.c
index d67c3f307..d6a175abf 100644
--- a/tests/spec/ext_transform_feedback/structs.c
+++ b/tests/spec/ext_transform_feedback/structs.c
@@ -38,7 +38,7 @@
* passed to glTransformFeedbackVaryings().
*
* - The intention is for the transform feedback API to behave
- * similary to glGetUniformLocation() and
+ * similarly to glGetUniformLocation() and
* glGetProgramResourceLocation().
*
* This test verifies proper operation of transform feedback varyings
diff --git a/tests/spec/ext_transform_feedback/tessellation.c b/tests/spec/ext_transform_feedback/tessellation.c
index 7200ef917..4a437b954 100644
--- a/tests/spec/ext_transform_feedback/tessellation.c
+++ b/tests/spec/ext_transform_feedback/tessellation.c
@@ -62,7 +62,7 @@
*
* The images are rendered using a fragment shader that attenuates the
* color of back-facing primitives, so that the test will verify that
- * tesellation preserves winding order properly.
+ * tessellation preserves winding order properly.
*
* The test can be run in four different coloring modes:
*
@@ -432,7 +432,7 @@ draw(GLuint prog, bool use_xfb, float y_offset, GLenum mode,
if (use_xfb) {
glBindBuffer(GL_TRANSFORM_FEEDBACK_BUFFER, xfb_buf);
/* Initialize the buffer with 0 so that we will be
- * able to identify membory that was not overwitten by
+ * able to identify membory that was not overwritten by
* the transform feedback.
*/
memset(buffer, 0, sizeof(buffer));
@@ -473,7 +473,8 @@ print_usage_and_exit(char *prog_name)
" monochrome\n"
" smooth\n"
" flat_first\n"
- " flat_last\n", prog_name);
+ " flat_last\n"
+ " wireframe\n", prog_name);
exit(1);
}
diff --git a/tests/spec/gl-1.0/dlist-beginend.c b/tests/spec/gl-1.0/dlist-beginend.c
index eca32c1f3..5f11f98a5 100644
--- a/tests/spec/gl-1.0/dlist-beginend.c
+++ b/tests/spec/gl-1.0/dlist-beginend.c
@@ -312,6 +312,42 @@ test_illegal_begin_mode(void * unused)
return pass ? PIGLIT_PASS : PIGLIT_FAIL;
}
+static enum piglit_result
+test_reproducer_7335(void * unused)
+{
+ GLuint list;
+ bool pass;
+
+ list = glGenLists(1);
+ glNewList(list, GL_COMPILE_AND_EXECUTE);
+ glBegin(GL_QUADS);
+ glColor4fv(green);
+ glVertex2f(-1, -1);
+ glVertex2f( 1, -1);
+ glVertex2f( 1, 1);
+ glVertex2f(-1, 1);
+ glEnd();
+ /* In mesa bug 7335 _mesa_End() incorrectly restores the wrong GL dispatch table.
+ * This causes only the first command (glPushMatrix) of the following commands to
+ * be dispatched (the others are dropped).
+ */
+ glPushMatrix();
+ glPopMatrix();
+ glEndList();
+
+ glCallList(list);
+
+ /* This should cause a GL_STACK_UNDERFLOW, unless the glPopMatrix
+ * was dropped from the display list.
+ */
+ glPopMatrix();
+ pass = piglit_check_gl_error(GL_STACK_UNDERFLOW);
+
+ glDeleteLists(list, 1);
+
+ return pass ? PIGLIT_PASS : PIGLIT_FAIL;
+}
+
static const struct piglit_subtest tests[] = {
{
@@ -356,6 +392,12 @@ static const struct piglit_subtest tests[] = {
test_illegal_begin_mode,
NULL
},
+ {
+ "incorrect dlist with glthread (bug 7335)",
+ "incorrect-dlist-glthread",
+ test_reproducer_7335,
+ NULL
+ },
{ 0 },
};
diff --git a/tests/spec/gl-1.0/logicop.c b/tests/spec/gl-1.0/logicop.c
index 85587596f..8bf927a44 100644
--- a/tests/spec/gl-1.0/logicop.c
+++ b/tests/spec/gl-1.0/logicop.c
@@ -53,7 +53,7 @@ struct test_data {
bool msaa;
};
-static struct test_data datas[] = {
+static struct test_data data[] = {
{ GL_CLEAR, false },
{ GL_SET, false },
{ GL_COPY, false },
@@ -88,20 +88,20 @@ static struct test_data datas[] = {
{ GL_OR_INVERTED, true },
};
-static struct piglit_subtest tests[ARRAY_SIZE(datas) + 1];
+static struct piglit_subtest tests[ARRAY_SIZE(data) + 1];
PIGLIT_GL_TEST_CONFIG_BEGIN
piglit_config = &config;
- for (int i = 0; i < ARRAY_SIZE(datas); i++) {
+ for (int i = 0; i < ARRAY_SIZE(data); i++) {
char *name;
- asprintf(&name, "%s%s", piglit_get_gl_enum_name(datas[i].mode),
- datas[i].msaa ? "_MSAA" : "");
+ asprintf(&name, "%s%s", piglit_get_gl_enum_name(data[i].mode),
+ data[i].msaa ? "_MSAA" : "");
tests[i].name = name;
tests[i].option = name;
tests[i].subtest_func = test_logicop;
- tests[i].data = &datas[i];
+ tests[i].data = &data[i];
}
config.subtests = tests;
diff --git a/tests/spec/gl-1.0/no-op-paths.c b/tests/spec/gl-1.0/no-op-paths.c
index 7c86b7c30..257a696ed 100644
--- a/tests/spec/gl-1.0/no-op-paths.c
+++ b/tests/spec/gl-1.0/no-op-paths.c
@@ -30,7 +30,7 @@
*
*
* Based on the original Glean tpaths.cpp test, this test verifies
- * that basic, trival OpenGL paths work as expected. For example,
+ * that basic, trivial OpenGL paths work as expected. For example,
* glAlphaFunc(GL_GEQUAL, 0.0) should always pass and
* glAlphaFunc(GL_LESS, 0.0) should always fail. We setup trivial
* pass and fail conditions for each of alpha test, blending, color mask,
diff --git a/tests/spec/gl-1.0/rendermode-feedback.c b/tests/spec/gl-1.0/rendermode-feedback.c
index 0f64881f2..2e7325ccf 100644
--- a/tests/spec/gl-1.0/rendermode-feedback.c
+++ b/tests/spec/gl-1.0/rendermode-feedback.c
@@ -94,6 +94,8 @@ struct type {
ARRAY_SIZE(gl_4d_color_texture_values) },
};
+static struct piglit_subtest tests[ARRAY_SIZE(types) + 1];
+
static enum piglit_result run_subtest(void * data);
static const struct piglit_gl_test_config * piglit_config;
@@ -101,13 +103,15 @@ PIGLIT_GL_TEST_CONFIG_BEGIN
piglit_config = &config;
- struct piglit_subtest tests[ARRAY_SIZE(types) + 1] = { 0 };
for (unsigned i = 0; i < ARRAY_SIZE(types); ++i) {
tests[i].name = piglit_get_gl_enum_name(types[i].type);
tests[i].option = tests[i].name;
tests[i].subtest_func = run_subtest;
tests[i].data = (void *)&types[i];
}
+
+ tests[ARRAY_SIZE(types)].name = NULL;
+
config.subtests = tests;
config.supports_gl_compat_version = 10;
@@ -122,7 +126,7 @@ report_failure(struct type *type, float *buffer, int count)
{
int i;
- fprintf(stderr, "Feeback failed for %s:\n",
+ fprintf(stderr, "Feedback failed for %s:\n",
piglit_get_gl_enum_name(type->type));
fprintf(stderr, " Expected: Observed: (%d/%d)\n",
diff --git a/tests/spec/gl-1.0/scissor-bitmap.c b/tests/spec/gl-1.0/scissor-bitmap.c
index 463d40ea4..88a9cffba 100644
--- a/tests/spec/gl-1.0/scissor-bitmap.c
+++ b/tests/spec/gl-1.0/scissor-bitmap.c
@@ -84,7 +84,7 @@ get_bitmap_bit(int x, int y)
}
static GLboolean
-verify_bitmap_pixel(struct probes *probes, int i, int x, int y)
+verify_bitmap_pixel(float *pixels, struct probes *probes, int i, int x, int y)
{
const GLfloat black[4] = {0.0, 0.0, 0.0, 0.0};
int x1 = probes->probes[i].x;
@@ -111,7 +111,9 @@ verify_bitmap_pixel(struct probes *probes, int i, int x, int y)
}
/* Make sure the region is black */
- pass = piglit_probe_pixel_rgb(x, y, expected);
+ pass = piglit_compare_pixels(x, y, expected,
+ pixels + (y * piglit_width + x) * 3,
+ piglit_tolerance, 3);
if (!pass)
printf("glBitmap error in %s (test offset %d,%d)\n",
probes->probes[i].name,
@@ -121,7 +123,7 @@ verify_bitmap_pixel(struct probes *probes, int i, int x, int y)
}
static GLboolean
-verify_bitmap_contents(struct probes *probes, int i)
+verify_bitmap_contents(float *pixels, struct probes *probes, int i)
{
int x, y;
int x1 = probes->probes[i].x;
@@ -137,7 +139,7 @@ verify_bitmap_contents(struct probes *probes, int i)
if (x < 0 || x >= piglit_width)
continue;
- pass &= verify_bitmap_pixel(probes, i, x, y);
+ pass &= verify_bitmap_pixel(pixels, probes, i, x, y);
if (!pass)
return pass;
}
@@ -145,7 +147,6 @@ verify_bitmap_contents(struct probes *probes, int i)
return pass;
}
-
enum piglit_result
piglit_display()
{
@@ -291,9 +292,12 @@ piglit_display()
fdo_bitmap_width, fdo_bitmap_height * 3 / 4,
0, 0);
+ float *pixels = malloc(piglit_width * piglit_height * 3 * sizeof(float));
+ glReadPixels(0, 0, piglit_width, piglit_height, GL_RGB, GL_FLOAT, pixels);
for (i = 0; i < probes.n_probes; i++) {
- pass = pass && verify_bitmap_contents(&probes, i);
+ pass = pass && verify_bitmap_contents(pixels, &probes, i);
}
+ free(pixels);
piglit_present_results();
diff --git a/tests/spec/gl-1.1/drawarrays-vertex-count.c b/tests/spec/gl-1.1/drawarrays-vertex-count.c
index f307bcdd7..49cf8c437 100644
--- a/tests/spec/gl-1.1/drawarrays-vertex-count.c
+++ b/tests/spec/gl-1.1/drawarrays-vertex-count.c
@@ -92,7 +92,7 @@ probe_line_rect(int x1, int y1, int x2, int y2)
black));
}
-/* Sets a range of the color array to a spefific color. */
+/* Sets a range of the color array to a specific color. */
static void
set_colors(float *colors, unsigned int start, unsigned int count,
const float *color)
diff --git a/tests/spec/gl-1.5/get-array-attribs.c b/tests/spec/gl-1.5/get-array-attribs.c
index 6aa3c7832..22a7cbf5a 100644
--- a/tests/spec/gl-1.5/get-array-attribs.c
+++ b/tests/spec/gl-1.5/get-array-attribs.c
@@ -93,7 +93,7 @@ void
piglit_init(int argc, char **argv)
{
bool pass = true;
- GLubyte dummy[100];
+ GLubyte dummy[100] = {0};
glVertexPointer(2, GL_FLOAT, 12, dummy);
glNormalPointer(GL_FLOAT, 0, dummy);
diff --git a/tests/spec/gl-2.0/glsl-link-empty-prog.c b/tests/spec/gl-2.0/glsl-link-empty-prog.c
index 6e57a4345..5cd15b3c7 100644
--- a/tests/spec/gl-2.0/glsl-link-empty-prog.c
+++ b/tests/spec/gl-2.0/glsl-link-empty-prog.c
@@ -25,7 +25,7 @@
*
* Verify behavior when a program object with no shaders attached is used.
* Neither the OpenGL spec nor the GLSL spec are explicit about what happens
- * in this case. However, the correct behavior can be infered from a few bits
+ * in this case. However, the correct behavior can be inferred from a few bits
* in the spec. Section 2.15 of the GL 2.1 spec says:
*
* "When the program object currently in use includes a vertex shader, its
diff --git a/tests/spec/gl-2.0/large-point-fs.c b/tests/spec/gl-2.0/large-point-fs.c
index 27e9c55ab..8903645a3 100644
--- a/tests/spec/gl-2.0/large-point-fs.c
+++ b/tests/spec/gl-2.0/large-point-fs.c
@@ -94,7 +94,7 @@ piglit_display(void)
}
size = MIN2(30, size);
- probeSize = size - 2; /* to accomodate small rasterization errors */
+ probeSize = size - 2; /* to accommodate small rasterization errors */
glUniform4fv(color_scale_uniform, 1, scale);
glUniform4fv(color_bias_uniform, 1, bias);
diff --git a/tests/spec/gl-2.1/pbo.c b/tests/spec/gl-2.1/pbo.c
index 59792cc5f..53be162ff 100644
--- a/tests/spec/gl-2.1/pbo.c
+++ b/tests/spec/gl-2.1/pbo.c
@@ -1071,7 +1071,7 @@ piglit_display(void)
{ "test_tex_sub_image", "", test_tex_sub_image, NULL },
{ "test_polygon_stip", "", test_polygon_stip, NULL },
{ "test_error_handling", "", test_error_handling, NULL },
- { NULL, NULL, NULL, NULL } /* End of list sentinal */
+ { NULL, NULL, NULL, NULL } /* End of list sentinel */
};
result = piglit_run_selected_subtests(funcs, NULL, 0, result);
diff --git a/tests/spec/gl-3.0/api/bindfragdata-link-error.c b/tests/spec/gl-3.0/api/bindfragdata-link-error.c
index 63dbbf237..172b05867 100644
--- a/tests/spec/gl-3.0/api/bindfragdata-link-error.c
+++ b/tests/spec/gl-3.0/api/bindfragdata-link-error.c
@@ -104,7 +104,7 @@ void piglit_init(int argc, char **argv)
/* Page 237 (page 253 of the PDF) of the OpenGL 3.0 spec says:
*
* "LinkProgram will fail if the assigned binding of a varying out
- * variable would cause the GL to reference a non-existant
+ * variable would cause the GL to reference a non-existent
* fragment color number (one greater than or equal to MAX DRAW
* BUFFERS)."
*
@@ -140,7 +140,7 @@ void piglit_init(int argc, char **argv)
* variable is bound to the same number. This type of aliasing is
* not allowed."
*
- * Try this by assiging 'a[0]' and 'v' to the same slot, and also try
+ * Try this by assigning 'a[0]' and 'v' to the same slot, and also try
* assigning 'a[1]' and 'v' to the same slot.
*
* This should not generate a GL error. It should only cause linking
diff --git a/tests/spec/gl-3.0/api/clearbuffer-mixed-format.c b/tests/spec/gl-3.0/api/clearbuffer-mixed-format.c
index 8f5febe3c..2c3966e80 100644
--- a/tests/spec/gl-3.0/api/clearbuffer-mixed-format.c
+++ b/tests/spec/gl-3.0/api/clearbuffer-mixed-format.c
@@ -70,7 +70,7 @@
GLenum type;
const GLvoid *clear_color;
} test_vectors[] = {
- /* GL_RGBA8, GL_RGBA16 clamps the color vaues to [0, 1] */
+ /* GL_RGBA8, GL_RGBA16 clamps the color values to [0, 1] */
{ GL_RGBA8, GL_FLOAT, (const GLvoid *)fcolor[0] },
{ GL_RGBA16, GL_FLOAT, (const GLvoid *)fcolor[1] },
diff --git a/tests/spec/gl-3.0/bound-resource-limits.c b/tests/spec/gl-3.0/bound-resource-limits.c
index 19cc21aa6..f42367020 100644
--- a/tests/spec/gl-3.0/bound-resource-limits.c
+++ b/tests/spec/gl-3.0/bound-resource-limits.c
@@ -462,7 +462,7 @@ setup_vertex_element_buffers(void)
* Setup the vertex buffer objects.
*/
for (i = 0; i < g_maxVertexAttribs - 1; i++) {
- char strTemp[16];
+ char strTemp[17];
if ((i + 1) * MAX_COMPONENTS < NUM_PRIMES) {
attrib[0].x = attrib[1].x =
@@ -845,7 +845,7 @@ piglit_display(void)
for (i = 0; i < g_maxCombinedTextureImageUnits; i++) {
GLuint tex;
GLuint uniformLoc;
- char strTemp[16];
+ char strTemp[19];
glGenTextures(1, &tex);
glActiveTexture(GL_TEXTURE0 + i);
@@ -925,7 +925,7 @@ piglit_display(void)
* Enable the rest of the attributes.
*/
for (i = 0; i < g_maxVertexAttribs - 1; i++) {
- char strTemp[16];
+ char strTemp[18];
snprintf(strTemp, sizeof(strTemp), "InValue%u", i);
attribLoc = glGetAttribLocation(g_program, strTemp);
@@ -1168,14 +1168,12 @@ piglit_init(int argc, char **argv)
*/
if ((g_debugMask & DEBUG_DONT_CLAMP_MAX_VARYINGS) == 0) {
g_maxVaryingFloats = MIN2(g_maxVaryingFloats, 32);
- fprintf(stderr, "Clamped max varying floats to %u.\n",
- g_maxVaryingFloats);
+ printf("Clamped max varying floats to %u.\n", g_maxVaryingFloats);
}
if (g_drawMode == DRAW_IMMEDIATE) {
g_maxVertexAttribs = 1;
- fprintf(stderr,
- "Immediate mode selected, using only one vertex attrib.\n");
+ printf("Immediate mode selected, using only one vertex attrib.\n");
}
/*
diff --git a/tests/spec/gl-3.0/texture-integer.c b/tests/spec/gl-3.0/texture-integer.c
index 587fd00b0..5d34db0a2 100644
--- a/tests/spec/gl-3.0/texture-integer.c
+++ b/tests/spec/gl-3.0/texture-integer.c
@@ -40,6 +40,7 @@ PIGLIT_GL_TEST_CONFIG_END
static const char *TestName = "texture-integer";
static GLint TexWidth = 16, TexHeight = 16;
static GLint BiasUniform = -1, TexUniform = -1;
+static GLuint iProgram, uProgram;
struct format_info
{
@@ -105,10 +106,10 @@ static const struct format_info Formats[] = {
static const char *FragShaderText =
"#version 130 \n"
"uniform vec4 bias; \n"
- "uniform isampler2D tex; \n"
+ "uniform %csampler2D tex; \n"
"void main() \n"
"{ \n"
- " ivec4 t = texture(tex, gl_TexCoord[0].xy); \n"
+ " %cvec4 t = texture(tex, gl_TexCoord[0].xy); \n"
" gl_FragColor = vec4(t) + bias; \n"
"} \n";
@@ -314,6 +315,19 @@ test_format(const struct format_info *info)
;
}
+ if (info->Signed) {
+ glUseProgram(iProgram);
+ BiasUniform = glGetUniformLocation(iProgram, "bias");
+ TexUniform = glGetUniformLocation(iProgram, "tex");
+ } else {
+ glUseProgram(uProgram);
+ BiasUniform = glGetUniformLocation(uProgram, "bias");
+ TexUniform = glGetUniformLocation(uProgram, "tex");
+ }
+
+
+ /* tex unit zero */
+ glUniform1i(TexUniform, 0);
/* compute, set test bias */
bias[0] = expected[0] - value[0];
bias[1] = expected[1] - value[1];
@@ -349,6 +363,8 @@ test_format(const struct format_info *info)
return false;
}
+ glUseProgram(0);
+
piglit_present_results();
free(buf);
@@ -376,18 +392,16 @@ piglit_display(void)
void
piglit_init(int argc, char **argv)
{
- GLuint program;
static GLuint tex;
+ char shaderText[1024];
piglit_require_gl_version(30);
- program = piglit_build_simple_program(NULL, FragShaderText);
- glUseProgram(program);
-
- BiasUniform = glGetUniformLocation(program, "bias");
- TexUniform = glGetUniformLocation(program, "tex");
+ sprintf(shaderText, FragShaderText, 'i', 'i');
+ iProgram = piglit_build_simple_program(NULL, shaderText);
- glUniform1i(TexUniform, 0); /* tex unit zero */
+ sprintf(shaderText, FragShaderText, 'u', 'u');
+ uProgram = piglit_build_simple_program(NULL, shaderText);
glGenTextures(1, &tex);
glBindTexture(GL_TEXTURE_2D, tex);
diff --git a/tests/spec/gl-3.2/adj-prims.c b/tests/spec/gl-3.2/adj-prims.c
index b8c653425..ddeb09f6f 100644
--- a/tests/spec/gl-3.2/adj-prims.c
+++ b/tests/spec/gl-3.2/adj-prims.c
@@ -611,7 +611,7 @@ draw_lines_adj(GLuint vao, unsigned n)
provoking_vertex, 1 + i/4);
set_color(gray);
- // draw preceeding "wing" line
+ // draw preceding "wing" line
glDrawArrays(GL_LINES, i, 2);
// draw trailing "wing" line
glDrawArrays(GL_LINES, i+2, 2);
diff --git a/tests/spec/gl-3.2/layered-rendering/blit.c b/tests/spec/gl-3.2/layered-rendering/blit.c
index db171243c..bde65d497 100644
--- a/tests/spec/gl-3.2/layered-rendering/blit.c
+++ b/tests/spec/gl-3.2/layered-rendering/blit.c
@@ -251,7 +251,7 @@ testFramebufferBlitLayered(int x, int y, bool srcLayered, bool dstLayered)
return false;
}
- /* Check for if any errors have occured */
+ /* Check for if any errors have occurred */
if (!piglit_check_gl_error(GL_NO_ERROR)) {
printf("Error setting up framebuffers for test.\n");
return false;
@@ -286,7 +286,7 @@ testFramebufferBlitLayered(int x, int y, bool srcLayered, bool dstLayered)
glDeleteTextures(1, &srcTex);
glDeleteTextures(1, &dstTex);
- /* Check for if any errors have occured */
+ /* Check for if any errors have occurred */
if (!piglit_check_gl_error(GL_NO_ERROR)) {
printf("Error setting up framebuffers for test.\n");
return false;
@@ -324,7 +324,7 @@ piglit_display(void)
pass = testFramebufferBlitLayered(2 * texWidth, texDepth * texHeight,
false, false) && pass;
- /* Check for if any errors have occured */
+ /* Check for if any errors have occurred */
pass = piglit_check_gl_error(GL_NO_ERROR) && pass;
piglit_present_results();
diff --git a/tests/spec/gl-3.2/layered-rendering/clear-color.c b/tests/spec/gl-3.2/layered-rendering/clear-color.c
index 32572b09c..0071aa5c6 100644
--- a/tests/spec/gl-3.2/layered-rendering/clear-color.c
+++ b/tests/spec/gl-3.2/layered-rendering/clear-color.c
@@ -166,7 +166,7 @@ piglit_display(void)
bool pass = true;
const float clearColor[3] = { 1, 1, 0 };
- /* Clear Defualt Framebuffer */
+ /* Clear Default Framebuffer */
glBindFramebuffer(GL_FRAMEBUFFER, piglit_winsys_fbo);
glClearColor(1,1,0,1);
glClear(GL_COLOR_BUFFER_BIT);
diff --git a/tests/spec/gl-3.2/layered-rendering/clear-depth.c b/tests/spec/gl-3.2/layered-rendering/clear-depth.c
index b58fccec9..9f509656b 100644
--- a/tests/spec/gl-3.2/layered-rendering/clear-depth.c
+++ b/tests/spec/gl-3.2/layered-rendering/clear-depth.c
@@ -180,7 +180,7 @@ piglit_init(int argc, char **argv)
if(!probe_texture_layered_depth(texture[0], 0, 0, 0, 10,
10, 4, expected)) {
- printf("Incorrect depth values recieved with glClear()\n");
+ printf("Incorrect depth values received with glClear()\n");
pass = false;
}
@@ -190,7 +190,7 @@ piglit_init(int argc, char **argv)
if(!probe_texture_layered_depth(texture[1], 0, 0, 0, 10,
10, 4, expected)) {
- printf("Incorrect depth values recieved with glClearBuffer()\n");
+ printf("Incorrect depth values received with glClearBuffer()\n");
pass = false;
}
diff --git a/tests/spec/gl-3.2/layered-rendering/framebuffertexture-defaults.c b/tests/spec/gl-3.2/layered-rendering/framebuffertexture-defaults.c
index 4c9e47b77..486ef8ce3 100644
--- a/tests/spec/gl-3.2/layered-rendering/framebuffertexture-defaults.c
+++ b/tests/spec/gl-3.2/layered-rendering/framebuffertexture-defaults.c
@@ -77,7 +77,7 @@ check_texture_parameters(GLenum objType, int objName, int level, int layer, int
}
if(!piglit_check_gl_error(GL_NO_ERROR)) {
- printf("Error has occured in check_texture_parameters()\n");
+ printf("Error has occurred in check_texture_parameters()\n");
return false;
}
@@ -119,7 +119,7 @@ check_texture_parameters(GLenum objType, int objName, int level, int layer, int
}
if(!piglit_check_gl_error(GL_NO_ERROR)) {
- printf("Error has occured in check_texture_parameters()\n");
+ printf("Error has occurred in check_texture_parameters()\n");
return false;
}
}
diff --git a/tests/spec/gl-3.2/layered-rendering/gl-layer-cube-map.c b/tests/spec/gl-3.2/layered-rendering/gl-layer-cube-map.c
index bd3134a67..12c25c77d 100644
--- a/tests/spec/gl-3.2/layered-rendering/gl-layer-cube-map.c
+++ b/tests/spec/gl-3.2/layered-rendering/gl-layer-cube-map.c
@@ -140,7 +140,7 @@ piglit_init(int argc, char **argv)
/* Check for errors during setup */
if(!check_framebuffer_status(GL_FRAMEBUFFER, GL_FRAMEBUFFER_COMPLETE) ||
!piglit_check_gl_error(GL_NO_ERROR)) {
- printf("Error occured during setup.\n");
+ printf("Error occurred during setup.\n");
piglit_report_result(PIGLIT_FAIL);
}
@@ -165,7 +165,7 @@ piglit_init(int argc, char **argv)
if(!check_framebuffer_status(GL_FRAMEBUFFER,
GL_FRAMEBUFFER_COMPLETE)) {
- printf("Error occured while probing texture\n");
+ printf("Error occurred while probing texture\n");
piglit_report_result(PIGLIT_FAIL);
}
diff --git a/tests/spec/gl-3.3/fb-null-attachment.shader_test b/tests/spec/gl-3.3/fb-null-attachment.shader_test
new file mode 100644
index 000000000..c0edae516
--- /dev/null
+++ b/tests/spec/gl-3.3/fb-null-attachment.shader_test
@@ -0,0 +1,33 @@
+# Verify that a null framebuffer attachment doesn't affect framebuffer size
+#
+# This verifies that drivers aren't clamping framebuffers to a smaller size in the
+# presence of null framebuffer attachments
+
+[require]
+GL >= 3.3
+GLSL >= 3.30
+SIZE 1920 1080
+
+[vertex shader passthrough]
+
+[fragment shader]
+#version 330
+
+out vec4 outcolor;
+
+void main()
+{
+ outcolor = vec4(0.0, 1.0, 0.0, 1.0);
+}
+
+[test]
+texture rgbw 0 (1920, 1080) GL_RGBA8
+texture rgbw 1 (1920, 1080) GL_RGBA8
+
+fb tex 2d 0 -1 1
+
+clear color 0.2 0.2 0.2 0.2
+clear
+draw rect -1 -1 2 2
+
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/spec/gl-4.5/compare-framebuffer-parameter-with-get.c b/tests/spec/gl-4.5/compare-framebuffer-parameter-with-get.c
index 10c9eb907..0151042bb 100644
--- a/tests/spec/gl-4.5/compare-framebuffer-parameter-with-get.c
+++ b/tests/spec/gl-4.5/compare-framebuffer-parameter-with-get.c
@@ -211,7 +211,7 @@ get_framebuffer_name(int index)
}
/*
- * Gets a framebuffer and attachs to it renderbuffer and other stuff,
+ * Gets a framebuffer and attaches to it renderbuffer and other stuff,
* in order to ensure that it is a complete framebuffer.
*
* returns if it was successful.
diff --git a/tests/spec/gles-3.0/CMakeLists.gles3.txt b/tests/spec/gles-3.0/CMakeLists.gles3.txt
index 9f7ffe8ce..b6d6a83c3 100644
--- a/tests/spec/gles-3.0/CMakeLists.gles3.txt
+++ b/tests/spec/gles-3.0/CMakeLists.gles3.txt
@@ -3,10 +3,12 @@ link_libraries(
)
piglit_add_executable (gles-3.0-drawarrays-vertexid drawarrays-vertexid.c)
+piglit_add_executable(clear_stencil_gles3 clear-stencil.c)
piglit_add_executable(minmax_${piglit_target_api} minmax.c)
piglit_add_executable(oes_compressed_etc2_texture-miptree_gles3 oes_compressed_etc2_texture-miptree.c)
piglit_add_executable(texture-immutable-levels_gles3 texture-immutable-levels.c)
piglit_add_executable(read_depth_gles3 read-depth.c)
+piglit_add_executable(read_depth_offset_gles3 read-depth-offset.c)
piglit_add_executable(gles-3.0-transform-feedback-uniform-buffer-object transform-feedback-uniform-buffer-object.c)
piglit_add_executable(gles-3.0-attribute-aliasing attribute-aliasing.c)
diff --git a/tests/spec/gles-3.0/clear-stencil.c b/tests/spec/gles-3.0/clear-stencil.c
new file mode 100644
index 000000000..1379e2220
--- /dev/null
+++ b/tests/spec/gles-3.0/clear-stencil.c
@@ -0,0 +1,231 @@
+/*
+ * Copyright © 2024 Collabora Ltd
+ *
+ * Based on read-depth, which has
+ * Copyright © 2015 Intel Corporation
+ *
+ * SPDX-License-Identifier: MIT
+ */
+
+/** @file clear-stencil.c
+ *
+ * Tests clearing stencil data. Some drivers, particularly for tile
+ * based renderers, may try to keep track of stencil data to optimize
+ * clears. This test will fail if they do it wrong (as the panfrost
+ * driver did at one point).
+ */
+
+#include "piglit-util-gl.h"
+
+#define TEX_WIDTH 4
+#define TEX_HEIGHT 4
+#define TEX_LAYERS 2
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+ config.supports_gl_es_version = 31;
+ config.window_visual = PIGLIT_GL_VISUAL_DEPTH;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+static GLint prog;
+
+const char *vs_source =
+ "#version 310 es\n"
+ "vec4 vertcoord(uint i) {\n"
+ " vec2 base[3] = vec2[3](vec2(-1.0f, -3.0f), vec2(3.0f, 1.0f), vec2(-1.0f, 1.0f));\n"
+ " return vec4(base[i], 0.0f, 1.0f);\n"
+ "}\n"
+
+ "void main()\n"
+ "{\n"
+ " gl_Position = vertcoord(uint(gl_VertexID));\n"
+ " gl_Position.y = -(gl_Position.y);\n"
+ " gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);\n"
+ "}\n";
+
+const char *fs_source =
+ "#version 310 es\n"
+ "precision highp float;\n"
+ "layout(location = 0) out float value;\n"
+
+ "void main()\n"
+ "{\n"
+ " value = 1.0f;\n"
+ "}\n";
+
+/* fill the depth and stencil buffers with some arbitrary (non-zero) data */
+static void
+fill_layer(GLuint tex, int layer)
+{
+ GLuint fb;
+ GLenum zero = GL_ZERO;
+
+ glGenFramebuffers(1, &fb);
+ glBindFramebuffer(GL_FRAMEBUFFER, fb);
+ glFramebufferTextureLayer(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, tex, 0, layer);
+ glDrawBuffers(1, &zero);
+
+ glDisable(GL_SCISSOR_TEST);
+ glDepthMask(GL_TRUE);
+ glStencilMask(255);
+ glClearBufferfi(GL_DEPTH_STENCIL, 0, 0.8, 42);
+ glBindFramebuffer(GL_FRAMEBUFFER, 0);
+ glDeleteFramebuffers(1, &fb);
+}
+
+/* create a multiple layer depth/stencil texture that is cleared to 0 initially */
+static GLuint
+create_depth_stencil_tex(GLenum depth_type)
+{
+ GLuint fbo, tex;
+ int i;
+
+ glGenFramebuffers(1, &fbo);
+ glBindFramebuffer(GL_FRAMEBUFFER, fbo);
+
+ glDepthMask(GL_TRUE);
+ glDisable(GL_STENCIL_TEST);
+ glGenTextures(1, &tex);
+ glBindTexture(GL_TEXTURE_2D_ARRAY, tex);
+ /* create a 2x2x7 texture */
+ glTexStorage3D(GL_TEXTURE_2D_ARRAY, 1, depth_type, TEX_WIDTH, TEX_HEIGHT, TEX_LAYERS);
+ glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+ glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+ glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+ glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+
+ /* clear all the layers */
+ for (i = 0; i < TEX_LAYERS; i++) {
+ glFramebufferTextureLayer(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, tex, 0, i);
+ glDepthMask(GL_TRUE);
+ glStencilMask(255);
+ glClearBufferfi(GL_DEPTH_STENCIL, 0, 0, 0);
+ }
+ glBindFramebuffer(GL_FRAMEBUFFER, 0);
+
+ fill_layer(tex, 0);
+ return tex;
+}
+
+/* create the target texture for rendering, and fill it with 0's */
+static GLuint
+create_target_tex()
+{
+ static GLubyte byte_zeros[TEX_WIDTH*TEX_HEIGHT] = { 0 };
+ static GLfloat float_zeros[4] = { 0.0f, 0.0f, 0.0f, 0.0f };
+ GLuint tex, fbo;
+
+ glGenFramebuffers(1, &fbo);
+ glBindFramebuffer(GL_FRAMEBUFFER, fbo);
+
+ glGenTextures(1, &tex);
+ glBindTexture(GL_TEXTURE_2D, tex);
+ glTexStorage2D(GL_TEXTURE_2D, 1, GL_R8, TEX_WIDTH, TEX_HEIGHT);
+ glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, TEX_WIDTH, TEX_HEIGHT, GL_RED, GL_UNSIGNED_BYTE, byte_zeros);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+
+ glColorMaskiEXT(0, GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
+ glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, tex, 0);
+ glClearBufferfv(GL_COLOR, 0, float_zeros);
+ glBindFramebuffer(GL_FRAMEBUFFER, 0);
+ glDeleteFramebuffers(1, &fbo);
+ return tex;
+}
+
+static bool
+check_pixels(GLuint tex)
+{
+ GLuint fbo;
+ GLubyte pixels[TEX_WIDTH*TEX_HEIGHT];
+ int i;
+
+ memset(pixels, 0xcc, sizeof(pixels));
+ glGenFramebuffers(1, &fbo);
+ glBindFramebuffer(GL_FRAMEBUFFER, fbo);
+ glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, tex, 0);
+ glReadBuffer(GL_COLOR_ATTACHMENT0);
+ glReadPixels(0, 0, TEX_WIDTH, TEX_HEIGHT, GL_RED, GL_UNSIGNED_BYTE, pixels);
+ for (i = 0; i < TEX_WIDTH; i++) {
+ if (pixels[i] != 0xff)
+ return false;
+ }
+ return true;
+}
+
+static bool
+test_format(GLenum depth_format)
+{
+ GLuint fbo;
+ GLuint depth_tex;
+ GLuint out_tex;
+ static GLenum drawto[] = { GL_COLOR_ATTACHMENT0 };
+ bool result;
+
+ glViewport(0, 0, TEX_WIDTH, TEX_HEIGHT);
+ glScissor(0, 0, TEX_WIDTH, TEX_HEIGHT);
+
+ depth_tex = create_depth_stencil_tex(depth_format);
+
+ out_tex = create_target_tex();
+ glGenFramebuffers(1, &fbo);
+ glBindFramebuffer(GL_FRAMEBUFFER, fbo);
+ glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, out_tex, 0);
+ glFramebufferTextureLayer(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, depth_tex, 0, TEX_LAYERS-1);
+ glDrawBuffers(1, drawto);
+ glUseProgram(prog);
+
+ glStencilFuncSeparate(GL_BACK, GL_EQUAL, 0, 255);
+ glStencilFuncSeparate(GL_FRONT, GL_EQUAL, 0, 255);
+ glStencilOpSeparate(GL_BACK, GL_KEEP, GL_KEEP, GL_KEEP);
+ glStencilOpSeparate(GL_FRONT, GL_KEEP, GL_KEEP, GL_KEEP);
+
+ GLuint vert_array;
+ glGenVertexArrays(1, &vert_array);
+ glBindVertexArray(vert_array);
+ glDisable(GL_SCISSOR_TEST);
+ glDepthMask(GL_FALSE);
+ glEnable(GL_STENCIL_TEST);
+ glEnable(GL_SCISSOR_TEST);
+ glDrawArraysInstanced(GL_TRIANGLES, 0, 3, 1);
+ glDisable(GL_SCISSOR_TEST);
+ glBindVertexArray(0);
+ glDeleteVertexArrays(1, &vert_array);
+
+ glBindFramebuffer(GL_FRAMEBUFFER, 0);
+ glDeleteFramebuffers(1, &fbo);
+ result = check_pixels(out_tex);
+
+ glDeleteTextures(1, &out_tex);
+ glDeleteTextures(1, &depth_tex);
+ return result;
+}
+
+const GLenum tests[] = {
+ GL_DEPTH24_STENCIL8,
+ GL_DEPTH32F_STENCIL8,
+};
+
+enum piglit_result
+piglit_display(void)
+{
+ unsigned j;
+
+ /* Loop through formats listed in 'tests'. */
+ for (j = 0; j < ARRAY_SIZE(tests); j++) {
+ if (!test_format(tests[j]))
+ return PIGLIT_FAIL;
+ }
+ return PIGLIT_PASS;
+}
+
+void
+piglit_init(int argc, char **argv)
+{
+ piglit_require_extension("GL_NV_read_depth");
+ prog = piglit_build_simple_program(vs_source, fs_source);
+ glUseProgram(prog);
+}
diff --git a/tests/spec/gles-3.0/read-depth-offset.c b/tests/spec/gles-3.0/read-depth-offset.c
new file mode 100644
index 000000000..970db8d1e
--- /dev/null
+++ b/tests/spec/gles-3.0/read-depth-offset.c
@@ -0,0 +1,252 @@
+/*
+ * Copyright © 2024 Collabora Ltd
+ *
+ * Based on read-depth, which has
+ * Copyright © 2015 Intel Corporation
+ *
+ * SPDX-License-Identifier: MIT
+ */
+
+/** @file read-depth-offset.c
+ *
+ * Tests glPolygonOffset calculations
+ *
+ * Test iterates over table of depth buffer formats and expected types to
+ * read values back from each format. For each format it renders a rectangle at
+ * different depth levels, reads back a pixel and verifies expected depth value.
+ *
+ * The spec is fairly clear on the calculations for floating point depth
+ * buffers, but for fixed point it merely specifies that the value r
+ * used for the minimum resolvable difference is "implementation defined".
+ * But it must be the same for all depth values, so we can at least
+ * check that.
+ */
+
+#include "piglit-util-gl.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+ config.supports_gl_es_version = 30;
+ config.window_visual = PIGLIT_GL_VISUAL_DEPTH;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+static GLint prog;
+
+const char *vs_source =
+ "attribute vec4 vertex;\n"
+ "uniform float depth;\n"
+ "void main()\n"
+ "{\n"
+ " gl_Position = vec4(vertex.xy, depth, 1.0);\n"
+ "}\n";
+
+const char *fs_source =
+ "void main()\n"
+ "{\n"
+ "}\n";
+
+/* this is a fairly arbitrary test for floats being "close" together.
+ we don't want to make too many assumptions about how the GPU hardware
+ does floating point calculations, so we don't even assume IEEE binary
+ compliance
+*/
+static bool
+equals(float a, float b)
+{
+ return fabs(a - b) < 0.00001;
+}
+
+#define DEPTH_BIAS_UNITS 256.0
+
+/*
+ * Calculate the expected depth after offset applied.
+ * We assume the polygon is facing the screen and
+ * that glPolygonOffsetClamp factor is 0.0.
+ * For fixed point formats, the minimum resolvable
+ * difference in depth values is passed as a
+ * pointer; if this value is 0, we do no
+ * offsetting and instead return the raw value read
+ * (so that the caller can calculate what mrd is
+ * being used by the fixed point hardware).
+ */
+
+static GLfloat
+offset_depth(GLenum type, GLfloat inputZ, double mrd)
+{
+ GLfloat near = -1.0;
+ GLfloat far = 1.0;
+ GLfloat zw, offset;
+ double work;
+ int exp;
+
+ zw = inputZ * (far-near)/2.0 + (far+near)/2.0;
+
+ /* for floats, find the minimum resolvable difference near inputZ */
+ if (type == GL_FLOAT) {
+ double mant;
+ work = (double) zw;
+ mant = frexp(work, &exp);
+ if (mant == 0)
+ mrd = 0; /* 0 has no exponent, really */
+ else {
+ mrd = exp2(exp-24);
+ }
+ }
+ offset = (GLfloat)(mrd * DEPTH_BIAS_UNITS);
+
+ zw += offset;
+
+ if (zw < near) zw = near;
+ if (zw > far) zw = far;
+ return zw;
+}
+
+static GLuint
+create_depth_fbo(GLenum depth_type)
+{
+ GLuint fbo, buffer;
+ GLenum status;
+
+ glGenRenderbuffers(1, &buffer);
+ glBindRenderbuffer(GL_RENDERBUFFER, buffer);
+ glRenderbufferStorage(GL_RENDERBUFFER,
+ depth_type, piglit_width, piglit_height);
+
+ glGenFramebuffers(1, &fbo);
+ glBindFramebuffer(GL_FRAMEBUFFER, fbo);
+
+ glFramebufferRenderbuffer(GL_FRAMEBUFFER,
+ GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, buffer);
+
+ status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
+ if (status != GL_FRAMEBUFFER_COMPLETE) {
+ fprintf(stderr, "error creating framebuffer, status 0x%x\n",
+ status);
+ return 0;
+ }
+ return fbo;
+}
+
+static bool
+check_depth(GLenum type, float source_depth, double *mrd_ptr)
+{
+ float expect;
+ GLfloat data;
+ GLuint uint_pixel;
+ double mrd;
+
+ if (type == GL_FLOAT) {
+ glReadPixels(0, 0, 1, 1, GL_DEPTH_COMPONENT, type,
+ (void *) &data);
+ } else {
+ glReadPixels(0, 0, 1, 1, GL_DEPTH_COMPONENT, type,
+ (void *) &uint_pixel);
+ uint_pixel = uint_pixel >> 8;
+ data = (1.0 * ((float) uint_pixel)) / 16777215.0;
+ }
+
+ if (!piglit_check_gl_error(GL_NO_ERROR))
+ return false;
+
+ mrd = *mrd_ptr;
+ expect = offset_depth(type, source_depth, mrd);
+ /* if we haven't computed the minimum resolvable difference yet,
+ then figure it out here */
+ if (type != GL_FLOAT && mrd == 0.0) {
+ double delta = fabs(data - source_depth);
+ mrd = delta / DEPTH_BIAS_UNITS;
+#if 0
+ /* useful for debugging failures, but #if'd out for normal usage */
+ printf("orig: %a read: %a delta: %a mrd: %a\n", source_depth, data, delta, mrd);
+#endif
+ *mrd_ptr = mrd;
+ expect = data; /* no failure on first time through */
+ }
+
+ if (!equals(data, expect)) {
+ if (type == GL_FLOAT && source_depth == 0.0 && fabs(data - source_depth)/DEPTH_BIAS_UNITS < 0.000001 ) {
+ /* floating point 0.0 upsets some hardware, just accept
+ whatever it gave us */
+ } else {
+ fprintf(stderr, "%s Z source: %f expected: %f actual: %f\n",
+ (type == GL_FLOAT) ? "float" : "fixed", source_depth, expect, data);
+ return false;
+ }
+ }
+ return true;
+}
+
+const GLenum tests[] = {
+ GL_DEPTH_COMPONENT16, GL_UNSIGNED_INT_24_8_OES,
+ GL_DEPTH_COMPONENT24, GL_UNSIGNED_INT_24_8_OES,
+ GL_DEPTH_COMPONENT32F, GL_FLOAT,
+};
+
+static bool
+test_format(GLenum depth_format, GLenum read_type)
+{
+ const float step = 0.1;
+ int steps = (int)round(1.0 / step);
+ double mrd = 0.0; /* minimum resolvable difference */
+ float expect = 0.0;
+ int i;
+ bool test_ok;
+
+ GLuint fbo = create_depth_fbo(depth_format);
+ if (!fbo)
+ return PIGLIT_FAIL;
+
+ /* Step from -1.0 to 1.0, linear depth. Render a rectangle at
+ * depth i, read pixel and verify expected depth value.
+ */
+ for (i = -steps; i <= steps; i++) {
+ GLfloat depth = (GLfloat)i / steps;
+ glDepthRangef(-1.0, 1.0);
+ glPolygonOffset(0, DEPTH_BIAS_UNITS);
+ glEnable(GL_POLYGON_OFFSET_FILL);
+
+ glClear(GL_DEPTH_BUFFER_BIT);
+ glUniform1f(glGetUniformLocation(prog, "depth"), depth);
+
+ piglit_draw_rect(-1, -1, 2, 2);
+
+ test_ok = check_depth(read_type, expect, &mrd);
+
+ glPolygonOffset(0, 0);
+ glDisable(GL_POLYGON_OFFSET_FILL);
+ glDepthRangef(0.0, 1.0);
+
+ if (!test_ok)
+ return false;
+
+ expect += step / 2.0;
+ }
+ glDeleteFramebuffers(1, &fbo);
+ return true;
+}
+
+enum piglit_result
+piglit_display(void)
+{
+ unsigned j;
+
+ glEnable(GL_DEPTH_TEST);
+ glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
+
+ /* Loop through formats listed in 'tests'. */
+ for (j = 0; j < ARRAY_SIZE(tests); j += 2) {
+
+ if (!test_format(tests[j], tests[j+1]))
+ return PIGLIT_FAIL;
+ }
+ return PIGLIT_PASS;
+}
+
+void
+piglit_init(int argc, char **argv)
+{
+ piglit_require_extension("GL_NV_read_depth");
+ prog = piglit_build_simple_program(vs_source, fs_source);
+ glUseProgram(prog);
+}
diff --git a/tests/spec/gles-3.0/transform-feedback-uniform-buffer-object.c b/tests/spec/gles-3.0/transform-feedback-uniform-buffer-object.c
index e4a6a00e0..03373d3ed 100644
--- a/tests/spec/gles-3.0/transform-feedback-uniform-buffer-object.c
+++ b/tests/spec/gles-3.0/transform-feedback-uniform-buffer-object.c
@@ -80,8 +80,8 @@ static const char *vs_ubo_src =
"#version 300 es\n"
"uniform int ubo_pass;\n"
"uniform int tile;\n"
- "uniform ubo {\n"
- " int tf_pass[8 * 8 * 6];\n"
+ "layout (std140) uniform ubo {\n"
+ " ivec4 tf_pass[(8 * 8 * 6) / 4];\n"
"};\n"
"in vec4 piglit_vertex;\n"
"flat out vec4 color;\n"
@@ -89,7 +89,10 @@ static const char *vs_ubo_src =
"{\n"
" color = vec4(0.0);\n"
" for (int i = 0; i < tf_pass.length(); ++i)\n"
- " if (ubo_pass != tf_pass[i])\n"
+ " if (ubo_pass != tf_pass[i].x ||\n"
+ " ubo_pass != tf_pass[i].y ||\n"
+ " ubo_pass != tf_pass[i].z ||\n"
+ " ubo_pass != tf_pass[i].w)\n"
" color[ubo_pass] = 1.0;\n"
" gl_Position = piglit_vertex;\n"
"}\n";
diff --git a/tests/spec/glsl-1.10/compiler/declarations/bad-array-type-global.frag b/tests/spec/glsl-1.10/compiler/declarations/bad-array-type-global.frag
index 5d61434c2..7560afcc5 100644
--- a/tests/spec/glsl-1.10/compiler/declarations/bad-array-type-global.frag
+++ b/tests/spec/glsl-1.10/compiler/declarations/bad-array-type-global.frag
@@ -3,7 +3,7 @@
// glsl_version: 1.10
// [end config]
//
-// Compilation should fail becuase the type 'B' is unknown.
+// Compilation should fail because the type 'B' is unknown.
//
// Reproduces Mesa bugzilla #33313.
diff --git a/tests/spec/glsl-1.10/compiler/declarations/bad-array-type-global.vert b/tests/spec/glsl-1.10/compiler/declarations/bad-array-type-global.vert
index b17d381e3..563dff269 100644
--- a/tests/spec/glsl-1.10/compiler/declarations/bad-array-type-global.vert
+++ b/tests/spec/glsl-1.10/compiler/declarations/bad-array-type-global.vert
@@ -3,7 +3,7 @@
// glsl_version: 1.10
// [end config]
//
-// Compilation should fail becuase the type 'B' is unknown.
+// Compilation should fail because the type 'B' is unknown.
//
// Reproduces Mesa bugzilla #33313.
diff --git a/tests/spec/glsl-1.10/compiler/declarations/bad-array-type-parameter.frag b/tests/spec/glsl-1.10/compiler/declarations/bad-array-type-parameter.frag
index 4014880dc..086b98b02 100644
--- a/tests/spec/glsl-1.10/compiler/declarations/bad-array-type-parameter.frag
+++ b/tests/spec/glsl-1.10/compiler/declarations/bad-array-type-parameter.frag
@@ -3,7 +3,7 @@
// glsl_version: 1.10
// [end config]
//
-// Compilation should fail becuase the type 'B' is unknown.
+// Compilation should fail because the type 'B' is unknown.
//
// Reproduces Mesa bugzilla #33313.
diff --git a/tests/spec/glsl-1.10/compiler/declarations/bad-array-type-parameter.vert b/tests/spec/glsl-1.10/compiler/declarations/bad-array-type-parameter.vert
index 1c1148b21..cfdd56661 100644
--- a/tests/spec/glsl-1.10/compiler/declarations/bad-array-type-parameter.vert
+++ b/tests/spec/glsl-1.10/compiler/declarations/bad-array-type-parameter.vert
@@ -3,7 +3,7 @@
// glsl_version: 1.10
// [end config]
//
-// Compilation should fail becuase the type 'B' is unknown.
+// Compilation should fail because the type 'B' is unknown.
//
// Reproduces Mesa bugzilla #33313.
diff --git a/tests/spec/glsl-1.10/compiler/declarations/bad-array-type-struct-member.frag b/tests/spec/glsl-1.10/compiler/declarations/bad-array-type-struct-member.frag
index 4eb111986..b5c681e99 100644
--- a/tests/spec/glsl-1.10/compiler/declarations/bad-array-type-struct-member.frag
+++ b/tests/spec/glsl-1.10/compiler/declarations/bad-array-type-struct-member.frag
@@ -3,7 +3,7 @@
// glsl_version: 1.10
// [end config]
//
-// Compilation should fail becuase the type 'B' is unknown.
+// Compilation should fail because the type 'B' is unknown.
//
// Reproduces Mesa bugzilla #33313.
diff --git a/tests/spec/glsl-1.10/compiler/declarations/bad-array-type-struct-member.vert b/tests/spec/glsl-1.10/compiler/declarations/bad-array-type-struct-member.vert
index effec473b..a6fd78d92 100644
--- a/tests/spec/glsl-1.10/compiler/declarations/bad-array-type-struct-member.vert
+++ b/tests/spec/glsl-1.10/compiler/declarations/bad-array-type-struct-member.vert
@@ -3,7 +3,7 @@
// glsl_version: 1.10
// [end config]
//
-// Compilation should fail becuase the type 'B' is unknown.
+// Compilation should fail because the type 'B' is unknown.
//
// Reproduces Mesa bugzilla #33313.
diff --git a/tests/spec/glsl-1.10/execution/built-in-matrix-state.c b/tests/spec/glsl-1.10/execution/built-in-matrix-state.c
index 83d9b0622..ba5c2a839 100644
--- a/tests/spec/glsl-1.10/execution/built-in-matrix-state.c
+++ b/tests/spec/glsl-1.10/execution/built-in-matrix-state.c
@@ -24,7 +24,7 @@
/**
* @file built-in-matrix-state.c: Access uniform matrix derived state in GLSL
*
- * Set coordiante transformation matrices with the OpenGL API and access them
+ * Set coordinate transformation matrices with the OpenGL API and access them
* and their derived uniforms in a GLSL shader.
*/
diff --git a/tests/spec/glsl-1.10/execution/built-in-uniform-state.c b/tests/spec/glsl-1.10/execution/built-in-uniform-state.c
index 5ab5ee893..7eb4f9911 100644
--- a/tests/spec/glsl-1.10/execution/built-in-uniform-state.c
+++ b/tests/spec/glsl-1.10/execution/built-in-uniform-state.c
@@ -458,19 +458,27 @@ piglit_display(void)
pass;
val[0] = DRAND();
+
+ /* Don't test infinity because shader comparisons with infinity are
+ * undefined.
+ */
+ float fog_scale;
+ do {
+ val[1] = DRAND();
+ val[2] = DRAND();
+ fog_scale = 1 / (val[2] - val[1]);
+ } while (isinf(fog_scale));
+
glFogf(GL_FOG_DENSITY, val[0]);
pass = check_shader_builtin(GL_FLOAT, val, "gl_Fog.density") && pass;
- val[1] = DRAND();
glFogf(GL_FOG_START, val[1]);
pass = check_shader_builtin(GL_FLOAT, &val[1], "gl_Fog.start") &&
pass;
- val[2] = DRAND();
glFogf(GL_FOG_END, val[2]);
pass = check_shader_builtin(GL_FLOAT, &val[2], "gl_Fog.end") && pass;
- const float fog_scale = 1 / (val[2] - val[1]);
pass = check_shader_builtin(GL_FLOAT, &fog_scale, "gl_Fog.scale") &&
pass;
diff --git a/tests/spec/glsl-1.10/execution/builtins/glsl-fs-clamp-abs.shader_test b/tests/spec/glsl-1.10/execution/builtins/glsl-fs-clamp-abs.shader_test
new file mode 100644
index 000000000..1288a99b3
--- /dev/null
+++ b/tests/spec/glsl-1.10/execution/builtins/glsl-fs-clamp-abs.shader_test
@@ -0,0 +1,17 @@
+[require]
+GLSL >= 1.10
+
+[vertex shader passthrough]
+
+[fragment shader]
+uniform vec4 color;
+
+void main()
+{
+ gl_FragColor = clamp(abs(color), 0.0, 1.0);
+}
+
+[test]
+uniform vec4 color -2.5 -1.5 0.4 0.5
+draw rect -1 -1 2 2
+probe all rgba 1.0 1.0 0.4 0.5
diff --git a/tests/spec/glsl-1.10/execution/builtins/glsl-fs-clamp-neg.shader_test b/tests/spec/glsl-1.10/execution/builtins/glsl-fs-clamp-neg.shader_test
new file mode 100644
index 000000000..50bd4b2f4
--- /dev/null
+++ b/tests/spec/glsl-1.10/execution/builtins/glsl-fs-clamp-neg.shader_test
@@ -0,0 +1,17 @@
+[require]
+GLSL >= 1.10
+
+[vertex shader passthrough]
+
+[fragment shader]
+uniform vec4 color;
+
+void main()
+{
+ gl_FragColor = clamp(-color, 0.0, 1.0);
+}
+
+[test]
+uniform vec4 color -2.5 -1.5 0.4 -0.5
+draw rect -1 -1 2 2
+probe all rgba 1.0 1.0 0.0 0.5
diff --git a/tests/spec/glsl-1.10/execution/color-interp-smooth-shademodel-flat.shader_test b/tests/spec/glsl-1.10/execution/color-interp-smooth-shademodel-flat.shader_test
new file mode 100644
index 000000000..2db4ad542
--- /dev/null
+++ b/tests/spec/glsl-1.10/execution/color-interp-smooth-shademodel-flat.shader_test
@@ -0,0 +1,44 @@
+# A color varying qualified with smooth shouldn't be affected by
+# glShadeModel(GL_FLAT). If compiler optimizations are applied that perform
+# color deduplication and compaction, they should not merge color varyings
+# with different qualifiers.
+
+[require]
+GLSL >= 1.30
+
+[vertex shader]
+#version 130
+smooth out vec4 gl_FrontSecondaryColor;
+
+void main()
+{
+ gl_Position = gl_Vertex;
+ vec4 color = vec4(float(gl_VertexID) / 3.0);
+ gl_FrontColor = color;
+ gl_FrontSecondaryColor = color;
+}
+
+[fragment shader]
+#version 130
+uniform int b;
+smooth in vec4 gl_SecondaryColor;
+
+void main()
+{
+ gl_FragColor = b != 0 ? gl_SecondaryColor : gl_Color;
+}
+
+[test]
+shade model flat
+
+uniform int b 0
+draw rect -1 -1 1 1
+
+uniform int b 1
+draw rect 0 -1 1 1
+
+probe rgb 50 50 0.666667 0.666667 0.666667
+probe rgb 100 100 1 1 1
+
+probe rgb 175 50 0.403922 0.403922 0.403922
+probe rgb 225 100 0.803922 0.803922 0.803922
diff --git a/tests/spec/glsl-1.10/execution/copy-propagation/glsl-copy-propagation-loop-2.shader_test b/tests/spec/glsl-1.10/execution/copy-propagation/glsl-copy-propagation-loop-2.shader_test
index cf63d2e2a..6e01e97dd 100644
--- a/tests/spec/glsl-1.10/execution/copy-propagation/glsl-copy-propagation-loop-2.shader_test
+++ b/tests/spec/glsl-1.10/execution/copy-propagation/glsl-copy-propagation-loop-2.shader_test
@@ -11,7 +11,7 @@ void main()
}
[fragment shader]
-/* Tests for what was a crasher bug in glsl_copy_propagation_elements */
+/* Tests for what was a crash bug in glsl_copy_propagation_elements */
varying vec4 color;
void main()
diff --git a/tests/spec/glsl-1.10/execution/copy-propagation/glsl-vs-copy-propagation-1.shader_test b/tests/spec/glsl-1.10/execution/copy-propagation/glsl-vs-copy-propagation-1.shader_test
index 226128737..15633c4e7 100644
--- a/tests/spec/glsl-1.10/execution/copy-propagation/glsl-vs-copy-propagation-1.shader_test
+++ b/tests/spec/glsl-1.10/execution/copy-propagation/glsl-vs-copy-propagation-1.shader_test
@@ -42,3 +42,8 @@ uniform vec4 u 0 1 0 0
uniform int j 1
draw rect -1 -1 2 2
probe all rgba 0 1 1 0
+
+uniform vec4 u 0 1 0 0
+uniform int j 2
+draw rect -1 -1 2 2
+probe all rgba 0 1 0 0
diff --git a/tests/spec/glsl-1.10/execution/discard/glsl-fs-discard-mrt.c b/tests/spec/glsl-1.10/execution/discard/glsl-fs-discard-mrt.c
index a15216523..64861d43e 100644
--- a/tests/spec/glsl-1.10/execution/discard/glsl-fs-discard-mrt.c
+++ b/tests/spec/glsl-1.10/execution/discard/glsl-fs-discard-mrt.c
@@ -180,16 +180,9 @@ piglit_display(void)
void
piglit_init(int argc, char **argv)
{
- GLint max_buffers;
-
piglit_require_GLSL();
piglit_require_extension("GL_ARB_explicit_attrib_location");
piglit_require_extension("GL_EXT_framebuffer_object");
-
- glGetIntegerv(GL_MAX_DRAW_BUFFERS, &max_buffers);
- if (max_buffers == 1) {
- fprintf(stderr, "Test requires 2 draw buffers\n");
- piglit_report_result(PIGLIT_SKIP);
- }
+ piglit_require_minimum_getinteger(GL_MAX_DRAW_BUFFERS, 2);
}
diff --git a/tests/spec/glsl-1.10/execution/fs-nested-loop-unrolled-with-return.shader_test b/tests/spec/glsl-1.10/execution/fs-nested-loop-unrolled-with-return.shader_test
index 1f02e2f95..280ef77fc 100644
--- a/tests/spec/glsl-1.10/execution/fs-nested-loop-unrolled-with-return.shader_test
+++ b/tests/spec/glsl-1.10/execution/fs-nested-loop-unrolled-with-return.shader_test
@@ -17,7 +17,7 @@ void main(void)
uniform int a;
vec4 getColour() {
- /* We use a uniform in the outer loop comparision so it's not immediately
+ /* We use a uniform in the outer loop comparison so it's not immediately
* unrolled.
*/
for(int v124 = 0; v124 != a; v124++) {
diff --git a/tests/spec/glsl-1.10/execution/fs-nested-return-in-loop-nested_in_if.shader_test b/tests/spec/glsl-1.10/execution/fs-nested-return-in-loop-nested_in_if.shader_test
index 5486ca9f4..0718650df 100644
--- a/tests/spec/glsl-1.10/execution/fs-nested-return-in-loop-nested_in_if.shader_test
+++ b/tests/spec/glsl-1.10/execution/fs-nested-return-in-loop-nested_in_if.shader_test
@@ -1,4 +1,4 @@
-# Test return lowering when nested in a loop thats nested in an if.
+# Test return lowering when nested in a loop that's nested in an if.
#
# Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=100303
[require]
diff --git a/tests/spec/glsl-1.10/execution/fs-texture-select.shader_test b/tests/spec/glsl-1.10/execution/fs-texture-select.shader_test
index bedd36586..a0ad4dc2d 100644
--- a/tests/spec/glsl-1.10/execution/fs-texture-select.shader_test
+++ b/tests/spec/glsl-1.10/execution/fs-texture-select.shader_test
@@ -1,5 +1,5 @@
# Even columns fetch from tex0 (black), while odd columns fetch from tex1 (white).
-# The shader inverts the color of even collumns to get make them white,
+# The shader inverts the color of even columns to get make them white,
# so the final image should be completely white.
#
# At the moment, radeonsi miscompiles this shader and only fetches from tex0
diff --git a/tests/spec/glsl-1.10/execution/glsl-override-builtin-2.shader_test b/tests/spec/glsl-1.10/execution/glsl-override-builtin-2.shader_test
index 2a8001ad0..97a4bbdac 100644
--- a/tests/spec/glsl-1.10/execution/glsl-override-builtin-2.shader_test
+++ b/tests/spec/glsl-1.10/execution/glsl-override-builtin-2.shader_test
@@ -1,7 +1,7 @@
[require]
GLSL >= 1.10
-/* built-in function could be overriden, but should not impact
+/* built-in function could be overridden, but should not impact
another shader.
*/
diff --git a/tests/spec/glsl-1.10/execution/variable-indexing/vs-output-array-vec2-index-wr-no-unroll.shader_test b/tests/spec/glsl-1.10/execution/variable-indexing/vs-output-array-vec2-index-wr-no-unroll.shader_test
new file mode 100644
index 000000000..c32debb19
--- /dev/null
+++ b/tests/spec/glsl-1.10/execution/variable-indexing/vs-output-array-vec2-index-wr-no-unroll.shader_test
@@ -0,0 +1,84 @@
+[require]
+GLSL >= 1.10
+
+[vertex shader]
+uniform int index;
+varying vec2 m1[4];
+varying vec2 m2[4];
+
+void main()
+{
+ gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
+
+ m1[0] = vec2(1.0, 1.1);
+ m1[1] = vec2(2.0, 2.1);
+ m1[2] = vec2(3.0, 3.1);
+ m1[3] = vec2(4.0, 4.1);
+ m2[0] = vec2(5.0, 5.1);
+ m2[1] = vec2(6.0, 6.1);
+ m2[2] = vec2(7.0, 7.1);
+ m2[3] = vec2(8.0, 8.1);
+
+ if (index >= 4)
+ m2[index-4] = vec2(0.0, 0.1);
+ else
+ m1[index] = vec2(0.0, 0.1);
+}
+
+[fragment shader]
+uniform int index;
+uniform int start_value;
+varying vec2 m1[4];
+varying vec2 m2[4];
+
+void main()
+{
+ bool pass = true;
+
+ for (int i = start_value; i < 4; i++)
+ pass = pass && m1[i] == (index == i ? vec2(0.0, 0.1) : vec2(1.0, 1.1) + vec2(i));
+
+ for (int i = start_value; i < 4; i++)
+ pass = pass && m2[i] == (index == 4+i ? vec2(0.0, 0.1) : vec2(5.0, 5.1) + vec2(i));
+
+ gl_FragColor = pass ? vec4(0.0, 1.0, 0.0, 1.0) : vec4(1.0, 0.0, 0.0, 1.0);
+}
+
+[test]
+clear color 0.5 0.5 0.5 0.5
+clear
+ortho
+
+uniform int start_value 0
+
+uniform int index 0
+draw rect 5 5 10 10
+probe rgb 10 10 0.0 1.0 0.0
+
+uniform int index 1
+draw rect 30 5 10 10
+probe rgb 35 10 0.0 1.0 0.0
+
+uniform int index 2
+draw rect 55 5 10 10
+probe rgb 60 10 0.0 1.0 0.0
+
+uniform int index 3
+draw rect 80 5 10 10
+probe rgb 85 10 0.0 1.0 0.0
+
+uniform int index 4
+draw rect 105 5 10 10
+probe rgb 110 10 0.0 1.0 0.0
+
+uniform int index 5
+draw rect 130 5 10 10
+probe rgb 135 10 0.0 1.0 0.0
+
+uniform int index 6
+draw rect 155 5 10 10
+probe rgb 160 10 0.0 1.0 0.0
+
+uniform int index 7
+draw rect 180 5 10 10
+probe rgb 185 10 0.0 1.0 0.0
diff --git a/tests/spec/glsl-1.10/execution/vs-loop-complex-no-unroll.shader_test b/tests/spec/glsl-1.10/execution/vs-loop-complex-no-unroll.shader_test
new file mode 100644
index 000000000..247579af8
--- /dev/null
+++ b/tests/spec/glsl-1.10/execution/vs-loop-complex-no-unroll.shader_test
@@ -0,0 +1,68 @@
+# This tests unrolling of a loop with two exit point where the trip count
+# of one of the exits is known and the other unknown (loop_count uniform).
+#
+# Here we test all possible outcomes for the loop and also add some
+# unreachable code to make sure it is not accessible after unrolling.
+[require]
+GLSL >= 1.10
+
+[vertex shader]
+uniform int loop_count;
+uniform int start_value;
+
+void main()
+{
+ gl_Position = gl_Vertex;
+
+ vec4 colour = vec4(1.0, 1.0, 1.0, 1.0);
+ vec4 colour2 = vec4(0.0, 0.0, 0.0, 1.0);
+ for (int i = start_value; i < loop_count; i++) {
+
+ if (i > 1) {
+ colour = vec4(1.0, 0.0, 0.0, 1.0);
+ }
+
+ if (i > 1) {
+ break;
+ }
+
+ colour = vec4(0.0, 1.0, 0.0, 1.0);
+
+ /* This should be unreachable */
+ if (i >= 2) {
+ colour2 = vec4(0.0, 1.0, 0.0, 1.0);
+ }
+ }
+
+ gl_FrontColor = colour + colour2;
+}
+
+[fragment shader]
+void main()
+{
+ gl_FragColor = gl_Color;
+}
+
+[test]
+clear color 0.5 0.5 0.5 0.5
+uniform int start_value 0
+
+uniform int loop_count 4
+draw rect -1 -1 2 2
+probe all rgba 1.0 0.0 0.0 1.0
+
+uniform int loop_count 3
+draw rect -1 -1 2 2
+probe all rgba 1.0 0.0 0.0 1.0
+
+uniform int loop_count 2
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform int loop_count 1
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
+
+uniform int loop_count 0
+draw rect -1 -1 2 2
+probe all rgba 1.0 1.0 1.0 1.0
diff --git a/tests/spec/glsl-1.10/execution/vs-loop-complex-with-else-break.shader_test b/tests/spec/glsl-1.10/execution/vs-loop-complex-with-else-break.shader_test
index 43430071b..ca056a388 100644
--- a/tests/spec/glsl-1.10/execution/vs-loop-complex-with-else-break.shader_test
+++ b/tests/spec/glsl-1.10/execution/vs-loop-complex-with-else-break.shader_test
@@ -1,4 +1,4 @@
-# This tests a bug in the r300 compiler where it was too aggresive
+# This tests a bug in the r300 compiler where it was too aggressive
# with optimizations (copy propagation) of movs in loops.
#
# See: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6467
diff --git a/tests/spec/glsl-1.10/execution/vs-loop-variable-iteration-limit-unroll4.shader_test b/tests/spec/glsl-1.10/execution/vs-loop-variable-iteration-limit-unroll4.shader_test
index 38fdda4ca..d54f55efc 100644
--- a/tests/spec/glsl-1.10/execution/vs-loop-variable-iteration-limit-unroll4.shader_test
+++ b/tests/spec/glsl-1.10/execution/vs-loop-variable-iteration-limit-unroll4.shader_test
@@ -21,7 +21,7 @@ void main()
int x = 0;
/* Here we add a second && and put the known limit i < 4 in parentheses in
- * order to trigger a Mesa bug seen in a Assasins Creed Odyssey shader
+ * order to trigger a Mesa bug seen in a Assassins Creed Odyssey shader
*/
while (x < loop_count && (i < 4 && j < loop_count2)) {
if (x == 0 && i == 0)
diff --git a/tests/spec/glsl-1.10/execution/vs-multiple-shader-fragments-with-global.shader_test b/tests/spec/glsl-1.10/execution/vs-multiple-shader-fragments-with-global.shader_test
new file mode 100644
index 000000000..0a2853a54
--- /dev/null
+++ b/tests/spec/glsl-1.10/execution/vs-multiple-shader-fragments-with-global.shader_test
@@ -0,0 +1,43 @@
+# This test verifies that the compiler properly handles globals used across
+# multiple shaders of the same stage. This test exposes a bug in mesa where it
+# incorrectly assumed w = y; was the only time y was dereferenced and so
+# just set w directly leaving y unassigned.
+
+[require]
+GLSL >= 1.10
+
+[vertex shader]
+uniform float i;
+
+float y;
+float w;
+
+void set_y_and_w()
+{
+ y = i;
+ w = y;
+}
+
+[vertex shader]
+float y;
+float w;
+
+void set_y_and_w();
+
+void main()
+{
+ set_y_and_w();
+ gl_Position = gl_Vertex;
+ gl_FrontColor = vec4(0.0, y, 0.0, w);
+}
+
+[fragment shader]
+void main()
+{
+ gl_FragColor = gl_Color;
+}
+
+[test]
+uniform float i 1.0
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/spec/glsl-1.10/preprocessor/bogus-extension-test.frag b/tests/spec/glsl-1.10/preprocessor/bogus-extension-test.frag
index b4fce4573..3cfe245a3 100644
--- a/tests/spec/glsl-1.10/preprocessor/bogus-extension-test.frag
+++ b/tests/spec/glsl-1.10/preprocessor/bogus-extension-test.frag
@@ -4,7 +4,7 @@
* [end config]
*/
-// Test using a non-existant function. Should not compile.
+// Test using a non-existent function. Should not compile.
#extension GL_FOO_bar: require
void main()
{
diff --git a/tests/spec/glsl-1.10/preprocessor/unary-op-minus-define.shader_test b/tests/spec/glsl-1.10/preprocessor/unary-op-minus-define.shader_test
new file mode 100644
index 000000000..966e55626
--- /dev/null
+++ b/tests/spec/glsl-1.10/preprocessor/unary-op-minus-define.shader_test
@@ -0,0 +1,19 @@
+[require]
+GLSL >= 1.10
+
+[vertex shader passthrough]
+
+[fragment shader]
+#version 110
+
+#define VALUE -1.0
+const float x = -VALUE;
+
+void main()
+{
+ gl_FragColor = vec4(0.0, x, 0.0, 1.0);
+}
+
+[test]
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/spec/glsl-1.20/compiler/structure-and-array-operations/array-size-sequence-in-parenthesis.vert b/tests/spec/glsl-1.20/compiler/structure-and-array-operations/array-size-sequence-in-parenthesis.vert
index 8f3d42f4c..c072f49fa 100644
--- a/tests/spec/glsl-1.20/compiler/structure-and-array-operations/array-size-sequence-in-parenthesis.vert
+++ b/tests/spec/glsl-1.20/compiler/structure-and-array-operations/array-size-sequence-in-parenthesis.vert
@@ -3,7 +3,7 @@
* glsl_version: 1.20
* [end config]
*
- * The body of the GLSL spec is slient on this issue, but the grammar says:
+ * The body of the GLSL spec is silent on this issue, but the grammar says:
*
* expression:
* assignment_expression
diff --git a/tests/spec/glsl-1.20/compiler/structure-and-array-operations/array-size-sequence.vert b/tests/spec/glsl-1.20/compiler/structure-and-array-operations/array-size-sequence.vert
index 9d7e21442..0638084e8 100644
--- a/tests/spec/glsl-1.20/compiler/structure-and-array-operations/array-size-sequence.vert
+++ b/tests/spec/glsl-1.20/compiler/structure-and-array-operations/array-size-sequence.vert
@@ -3,7 +3,7 @@
* glsl_version: 1.20
* [end config]
*
- * The body of the GLSL spec is slient on this issue, but the grammar says:
+ * The body of the GLSL spec is silent on this issue, but the grammar says:
*
* expression:
* assignment_expression
diff --git a/tests/spec/glsl-1.20/execution/array_bounds/glsl-array-bounds-01.shader_test b/tests/spec/glsl-1.20/execution/array_bounds/glsl-array-bounds-01.shader_test
index 2e7c7620c..1ce194d56 100644
--- a/tests/spec/glsl-1.20/execution/array_bounds/glsl-array-bounds-01.shader_test
+++ b/tests/spec/glsl-1.20/execution/array_bounds/glsl-array-bounds-01.shader_test
@@ -32,4 +32,3 @@ clear color 0.0 0.0 0.0 0.0
clear
ortho
draw rect 10 10 10 10
-probe rgb 15 15 0.0 1.0 0.0
diff --git a/tests/spec/glsl-1.20/execution/array_bounds/glsl-array-bounds-02.shader_test b/tests/spec/glsl-1.20/execution/array_bounds/glsl-array-bounds-02.shader_test
index f9c8202cb..cf0ec01da 100644
--- a/tests/spec/glsl-1.20/execution/array_bounds/glsl-array-bounds-02.shader_test
+++ b/tests/spec/glsl-1.20/execution/array_bounds/glsl-array-bounds-02.shader_test
@@ -32,4 +32,3 @@ clear color 0.0 0.0 0.0 0.0
clear
ortho
draw rect 10 10 10 10
-probe rgb 15 15 0.0 1.0 0.0
diff --git a/tests/spec/glsl-1.20/execution/array_bounds/glsl-array-bounds-03.shader_test b/tests/spec/glsl-1.20/execution/array_bounds/glsl-array-bounds-03.shader_test
index 1d7908464..f8f33235f 100644
--- a/tests/spec/glsl-1.20/execution/array_bounds/glsl-array-bounds-03.shader_test
+++ b/tests/spec/glsl-1.20/execution/array_bounds/glsl-array-bounds-03.shader_test
@@ -34,4 +34,3 @@ clear color 0.0 0.0 0.0 0.0
clear
ortho
draw rect 10 10 10 10
-probe rgb 15 15 0.0 1.0 0.0
diff --git a/tests/spec/glsl-1.20/execution/array_bounds/glsl-array-bounds-04.shader_test b/tests/spec/glsl-1.20/execution/array_bounds/glsl-array-bounds-04.shader_test
index 8e21e7ab8..6f58c6721 100644
--- a/tests/spec/glsl-1.20/execution/array_bounds/glsl-array-bounds-04.shader_test
+++ b/tests/spec/glsl-1.20/execution/array_bounds/glsl-array-bounds-04.shader_test
@@ -34,4 +34,3 @@ clear color 0.0 0.0 0.0 0.0
clear
ortho
draw rect 10 10 10 10
-probe rgb 15 15 0.0 1.0 0.0
diff --git a/tests/spec/glsl-1.20/execution/array_bounds/glsl-array-bounds-05.shader_test b/tests/spec/glsl-1.20/execution/array_bounds/glsl-array-bounds-05.shader_test
index b2ec3011c..bb0998b51 100644
--- a/tests/spec/glsl-1.20/execution/array_bounds/glsl-array-bounds-05.shader_test
+++ b/tests/spec/glsl-1.20/execution/array_bounds/glsl-array-bounds-05.shader_test
@@ -32,4 +32,3 @@ clear color 0.0 0.0 0.0 0.0
clear
ortho
draw rect 10 10 10 10
-probe rgb 15 15 0.0 1.0 0.0
diff --git a/tests/spec/glsl-1.20/execution/array_bounds/glsl-array-bounds-06.shader_test b/tests/spec/glsl-1.20/execution/array_bounds/glsl-array-bounds-06.shader_test
index c540ff18a..944e1156a 100644
--- a/tests/spec/glsl-1.20/execution/array_bounds/glsl-array-bounds-06.shader_test
+++ b/tests/spec/glsl-1.20/execution/array_bounds/glsl-array-bounds-06.shader_test
@@ -32,4 +32,3 @@ clear color 0.0 0.0 0.0 0.0
clear
ortho
draw rect 10 10 10 10
-probe rgb 15 15 0.0 1.0 0.0
diff --git a/tests/spec/glsl-1.20/execution/array_bounds/glsl-array-bounds-07.shader_test b/tests/spec/glsl-1.20/execution/array_bounds/glsl-array-bounds-07.shader_test
index 7bc3a0516..ef1d9b720 100644
--- a/tests/spec/glsl-1.20/execution/array_bounds/glsl-array-bounds-07.shader_test
+++ b/tests/spec/glsl-1.20/execution/array_bounds/glsl-array-bounds-07.shader_test
@@ -34,4 +34,3 @@ clear color 0.0 0.0 0.0 0.0
clear
ortho
draw rect 10 10 10 10
-probe rgb 15 15 0.0 1.0 0.0
diff --git a/tests/spec/glsl-1.20/execution/array_bounds/glsl-array-bounds-08.shader_test b/tests/spec/glsl-1.20/execution/array_bounds/glsl-array-bounds-08.shader_test
index 5fddc1062..c08fb1c75 100644
--- a/tests/spec/glsl-1.20/execution/array_bounds/glsl-array-bounds-08.shader_test
+++ b/tests/spec/glsl-1.20/execution/array_bounds/glsl-array-bounds-08.shader_test
@@ -34,4 +34,3 @@ clear color 0.0 0.0 0.0 0.0
clear
ortho
draw rect 10 10 10 10
-probe rgb 15 15 0.0 1.0 0.0
diff --git a/tests/spec/glsl-1.20/execution/clipping/fixed-clip-enables.shader_test b/tests/spec/glsl-1.20/execution/clipping/fixed-clip-enables.shader_test
index 93995a5c1..b9740616a 100644
--- a/tests/spec/glsl-1.20/execution/clipping/fixed-clip-enables.shader_test
+++ b/tests/spec/glsl-1.20/execution/clipping/fixed-clip-enables.shader_test
@@ -8,7 +8,7 @@
#
# To verify that each enable works, the combinations of enables were
# chosen such that:
-# - Every plane is enabled at least once and disbled at least once.
+# - Every plane is enabled at least once and disabled at least once.
# - Every plane is enabled and disabled in a different pattern.
#
# Note: Some implementations have bugs related to improper coordinate
diff --git a/tests/spec/glsl-1.20/execution/clipping/vs-clip-vertex-enables.shader_test b/tests/spec/glsl-1.20/execution/clipping/vs-clip-vertex-enables.shader_test
index b93d16f34..ca645b67b 100644
--- a/tests/spec/glsl-1.20/execution/clipping/vs-clip-vertex-enables.shader_test
+++ b/tests/spec/glsl-1.20/execution/clipping/vs-clip-vertex-enables.shader_test
@@ -5,7 +5,7 @@
#
# To verify that each enable works, the combinations of enables were
# chosen such that:
-# - Every plane is enabled at least once and disbled at least once.
+# - Every plane is enabled at least once and disabled at least once.
# - Every plane is enabled and disabled in a different pattern.
#
# Note: Some implementations have bugs related to improper coordinate
diff --git a/tests/spec/glsl-1.20/execution/fs-deref-literal-array-of-structs-with-multiple-members.shader_test b/tests/spec/glsl-1.20/execution/fs-deref-literal-array-of-structs-with-multiple-members.shader_test
index c7d0e3a54..5ff0626b8 100644
--- a/tests/spec/glsl-1.20/execution/fs-deref-literal-array-of-structs-with-multiple-members.shader_test
+++ b/tests/spec/glsl-1.20/execution/fs-deref-literal-array-of-structs-with-multiple-members.shader_test
@@ -15,7 +15,7 @@ void main()
struct Foo {
int value;
- /* A second member of a differnt size helps ensures we calculate member
+ /* A second member of a different size helps ensures we calculate member
* offsets correctly.
*/
ivec2 value2;
diff --git a/tests/spec/glsl-1.20/recursion/recursion.c b/tests/spec/glsl-1.20/recursion/recursion.c
index 7c3c4dc32..214f565ab 100644
--- a/tests/spec/glsl-1.20/recursion/recursion.c
+++ b/tests/spec/glsl-1.20/recursion/recursion.c
@@ -31,7 +31,7 @@
* present if the static function call graph of the program contains
* cycles."
*
- * This langauge leaves a lot of questions unanswered.
+ * This language leaves a lot of questions unanswered.
*
* - Is the error generated at compile-time or link-time?
*
diff --git a/tests/spec/glsl-1.30/compiler/interpolation-qualifiers/local-smooth-01.frag b/tests/spec/glsl-1.30/compiler/interpolation-qualifiers/local-smooth-01.frag
index 12cf0add7..84a33f397 100644
--- a/tests/spec/glsl-1.30/compiler/interpolation-qualifiers/local-smooth-01.frag
+++ b/tests/spec/glsl-1.30/compiler/interpolation-qualifiers/local-smooth-01.frag
@@ -3,7 +3,7 @@
// glsl_version: 1.30
// [end config]
//
-// Attempt to declare a local varaible with 'smooth'.
+// Attempt to declare a local variable with 'smooth'.
#version 130
diff --git a/tests/spec/glsl-1.30/compiler/storage-qualifiers/function-param-centroid-in-01.frag b/tests/spec/glsl-1.30/compiler/storage-qualifiers/function-param-centroid-in-01.frag
index 7bbab7a68..236d8be25 100644
--- a/tests/spec/glsl-1.30/compiler/storage-qualifiers/function-param-centroid-in-01.frag
+++ b/tests/spec/glsl-1.30/compiler/storage-qualifiers/function-param-centroid-in-01.frag
@@ -3,7 +3,7 @@
// glsl_version: 1.30
// [end config]
//
-// Check that 'centroid in' cannot be used a parameter qualifer.
+// Check that 'centroid in' cannot be used a parameter qualifier.
#version 130
diff --git a/tests/spec/glsl-1.30/compiler/storage-qualifiers/local-centroid-in-01.frag b/tests/spec/glsl-1.30/compiler/storage-qualifiers/local-centroid-in-01.frag
index b860cdd47..7bb2c3a5b 100644
--- a/tests/spec/glsl-1.30/compiler/storage-qualifiers/local-centroid-in-01.frag
+++ b/tests/spec/glsl-1.30/compiler/storage-qualifiers/local-centroid-in-01.frag
@@ -3,7 +3,7 @@
// glsl_version: 1.30
// [end config]
//
-// Check that 'centroid in' cannot be used a local variable qualifer.
+// Check that 'centroid in' cannot be used a local variable qualifier.
#version 130
diff --git a/tests/spec/glsl-1.30/compiler/storage-qualifiers/local-in-01.frag b/tests/spec/glsl-1.30/compiler/storage-qualifiers/local-in-01.frag
index 74c82ef4a..24a0a8679 100644
--- a/tests/spec/glsl-1.30/compiler/storage-qualifiers/local-in-01.frag
+++ b/tests/spec/glsl-1.30/compiler/storage-qualifiers/local-in-01.frag
@@ -3,7 +3,7 @@
// glsl_version: 1.30
// [end config]
//
-// Declare a local varaible with 'in'.
+// Declare a local variable with 'in'.
//
// From section 4.3.4 of the GLSL 1.30 spec:
// Input variables must be declared at global scope.
diff --git a/tests/spec/glsl-1.30/execution/clipping/vs-clip-distance-all-planes-enabled.shader_test b/tests/spec/glsl-1.30/execution/clipping/vs-clip-distance-all-planes-enabled.shader_test
index 37a8216f8..3a9abcc1f 100644
--- a/tests/spec/glsl-1.30/execution/clipping/vs-clip-distance-all-planes-enabled.shader_test
+++ b/tests/spec/glsl-1.30/execution/clipping/vs-clip-distance-all-planes-enabled.shader_test
@@ -16,7 +16,7 @@ void main(void)
{
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
- // Compute 2D cordinates relative to a center point of (0.5,
+ // Compute 2D coordinates relative to a center point of (0.5,
// 0.5).
vec2 coord = gl_Vertex.xy - vec2(0.5, 0.5);
diff --git a/tests/spec/glsl-1.30/execution/clipping/vs-clip-distance-bulk-assign.shader_test b/tests/spec/glsl-1.30/execution/clipping/vs-clip-distance-bulk-assign.shader_test
index 7c921d5bc..542bf6dad 100644
--- a/tests/spec/glsl-1.30/execution/clipping/vs-clip-distance-bulk-assign.shader_test
+++ b/tests/spec/glsl-1.30/execution/clipping/vs-clip-distance-bulk-assign.shader_test
@@ -28,7 +28,7 @@ void main(void)
{
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
- // Compute 2D cordinates relative to a center point of (0.5,
+ // Compute 2D coordinates relative to a center point of (0.5,
// 0.5).
vec2 coord = gl_Vertex.xy - vec2(0.5, 0.5);
diff --git a/tests/spec/glsl-1.30/execution/clipping/vs-clip-distance-enables.shader_test b/tests/spec/glsl-1.30/execution/clipping/vs-clip-distance-enables.shader_test
index 2cb0105b1..c6e63e8af 100644
--- a/tests/spec/glsl-1.30/execution/clipping/vs-clip-distance-enables.shader_test
+++ b/tests/spec/glsl-1.30/execution/clipping/vs-clip-distance-enables.shader_test
@@ -11,7 +11,7 @@
#
# To verify that each enable works, the combinations of enables were
# chosen such that:
-# - Every plane is enabled at least once and disbled at least once.
+# - Every plane is enabled at least once and disabled at least once.
# - Every plane is enabled and disabled in a different pattern.
[require]
diff --git a/tests/spec/glsl-1.30/execution/clipping/vs-clip-distance-in-param.shader_test b/tests/spec/glsl-1.30/execution/clipping/vs-clip-distance-in-param.shader_test
index bbafc296a..561433f01 100644
--- a/tests/spec/glsl-1.30/execution/clipping/vs-clip-distance-in-param.shader_test
+++ b/tests/spec/glsl-1.30/execution/clipping/vs-clip-distance-in-param.shader_test
@@ -37,7 +37,7 @@ void main(void)
{
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
- // Compute 2D cordinates relative to a center point of (0.5,
+ // Compute 2D coordinates relative to a center point of (0.5,
// 0.5).
vec2 coord = gl_Vertex.xy - vec2(0.5, 0.5);
diff --git a/tests/spec/glsl-1.30/execution/clipping/vs-clip-distance-inout-param.shader_test b/tests/spec/glsl-1.30/execution/clipping/vs-clip-distance-inout-param.shader_test
index 075069db1..9be843fa4 100644
--- a/tests/spec/glsl-1.30/execution/clipping/vs-clip-distance-inout-param.shader_test
+++ b/tests/spec/glsl-1.30/execution/clipping/vs-clip-distance-inout-param.shader_test
@@ -35,7 +35,7 @@ void main(void)
{
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
- // Compute 2D cordinates relative to a center point of (0.5,
+ // Compute 2D coordinates relative to a center point of (0.5,
// 0.5).
vec2 coord = gl_Vertex.xy - vec2(0.5, 0.5);
diff --git a/tests/spec/glsl-1.30/execution/clipping/vs-clip-distance-out-param.shader_test b/tests/spec/glsl-1.30/execution/clipping/vs-clip-distance-out-param.shader_test
index fcc4737f0..07e623cad 100644
--- a/tests/spec/glsl-1.30/execution/clipping/vs-clip-distance-out-param.shader_test
+++ b/tests/spec/glsl-1.30/execution/clipping/vs-clip-distance-out-param.shader_test
@@ -35,7 +35,7 @@ void main(void)
{
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
- // Compute 2D cordinates relative to a center point of (0.5,
+ // Compute 2D coordinates relative to a center point of (0.5,
// 0.5).
vec2 coord = gl_Vertex.xy - vec2(0.5, 0.5);
diff --git a/tests/spec/glsl-1.30/execution/clipping/vs-clip-distance-primitives.shader_test b/tests/spec/glsl-1.30/execution/clipping/vs-clip-distance-primitives.shader_test
index 8191b8d9d..46d647200 100644
--- a/tests/spec/glsl-1.30/execution/clipping/vs-clip-distance-primitives.shader_test
+++ b/tests/spec/glsl-1.30/execution/clipping/vs-clip-distance-primitives.shader_test
@@ -44,7 +44,7 @@ uniform vec2 u_offset 0.5 0.5
draw arrays GL_POINTS 0 1
probe rect rgba ( 0, 0, 20, 20) (0, 0, 0, 0)
-uniform vec2 u_offset 20 0.5
+uniform vec2 u_offset 20.5 0.5
draw arrays GL_LINES 0 2
probe rect rgba (20, 0, 20, 20) (0, 0, 0, 0)
@@ -59,7 +59,7 @@ uniform vec2 u_offset 0.5 20.5
draw arrays GL_POINTS 0 1
probe rect rgba ( 0, 20, 1, 1) (1, 0, 0, 1)
-uniform vec2 u_offset 20 20.5
+uniform vec2 u_offset 20.5 20.5
draw arrays GL_LINES 0 2
probe rect rgba (20, 20, 10, 1) (1, 0, 0, 1)
diff --git a/tests/spec/glsl-1.30/execution/clipping/vs-clip-distance-retval.shader_test b/tests/spec/glsl-1.30/execution/clipping/vs-clip-distance-retval.shader_test
index 3dc8dc0c6..8aaf750ca 100644
--- a/tests/spec/glsl-1.30/execution/clipping/vs-clip-distance-retval.shader_test
+++ b/tests/spec/glsl-1.30/execution/clipping/vs-clip-distance-retval.shader_test
@@ -55,7 +55,7 @@ void main(void)
{
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
- // Compute 2D cordinates relative to a center point of (0.5,
+ // Compute 2D coordinates relative to a center point of (0.5,
// 0.5).
vec2 coord = gl_Vertex.xy - vec2(0.5, 0.5);
diff --git a/tests/spec/glsl-1.30/execution/clipping/vs-clip-distance-uint-index.shader_test b/tests/spec/glsl-1.30/execution/clipping/vs-clip-distance-uint-index.shader_test
index 93f0fc2cc..b3da1f85f 100644
--- a/tests/spec/glsl-1.30/execution/clipping/vs-clip-distance-uint-index.shader_test
+++ b/tests/spec/glsl-1.30/execution/clipping/vs-clip-distance-uint-index.shader_test
@@ -20,7 +20,7 @@ void main(void)
{
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
- // Compute 2D cordinates relative to a center point of (0.5,
+ // Compute 2D coordinates relative to a center point of (0.5,
// 0.5).
vec2 coord = gl_Vertex.xy - vec2(0.5, 0.5);
diff --git a/tests/spec/glsl-1.30/execution/interpolation/fs-int-interpolation.shader_test b/tests/spec/glsl-1.30/execution/interpolation/fs-int-interpolation.shader_test
index 076346495..290d1f73d 100644
--- a/tests/spec/glsl-1.30/execution/interpolation/fs-int-interpolation.shader_test
+++ b/tests/spec/glsl-1.30/execution/interpolation/fs-int-interpolation.shader_test
@@ -16,14 +16,15 @@ GLSL >= 1.30
[vertex shader]
#version 130
uniform int test_value;
-/* To prevent linker optimize out test_value. */
-uniform int dummy;
flat out int flat_int;
void main()
{
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
- flat_int = test_value + dummy;
+
+ // introduce a fake dependency on inputs to prevent the compiler from
+ // moving the uniform to the next shader
+ flat_int = gl_Position.x < -10.0 ? 0 : test_value;
}
[fragment shader]
@@ -38,7 +39,6 @@ void main()
}
[test]
-uniform int dummy 0
uniform int test_value 0
draw rect -1 -1 2 2
probe rgba 0 0 0.0 1.0 0.0 1.0
diff --git a/tests/spec/glsl-1.30/execution/interpolation/fs-uint-interpolation.shader_test b/tests/spec/glsl-1.30/execution/interpolation/fs-uint-interpolation.shader_test
index b1f605026..da34d3100 100644
--- a/tests/spec/glsl-1.30/execution/interpolation/fs-uint-interpolation.shader_test
+++ b/tests/spec/glsl-1.30/execution/interpolation/fs-uint-interpolation.shader_test
@@ -16,14 +16,15 @@ GLSL >= 1.30
[vertex shader]
#version 130
uniform uint test_value;
-/* To prevent linker optimize out test_value. */
-uniform uint dummy;
flat out uint flat_uint;
void main()
{
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
- flat_uint = test_value + dummy;
+
+ // introduce a fake dependency on inputs to prevent the compiler from
+ // moving the uniform to the next shader
+ flat_uint = gl_Position.x < -10.0 ? 0u : test_value;
}
[fragment shader]
@@ -38,7 +39,6 @@ void main()
}
[test]
-uniform uint dummy 0
uniform uint test_value 0
draw rect -1 -1 2 2
probe rgba 0 0 0.0 1.0 0.0 1.0
diff --git a/tests/spec/glsl-1.30/execution/range_analysis_fsat_of_nan.shader_test b/tests/spec/glsl-1.30/execution/range_analysis_fsat_of_nan.shader_test
index 56fbcb645..14de330ff 100644
--- a/tests/spec/glsl-1.30/execution/range_analysis_fsat_of_nan.shader_test
+++ b/tests/spec/glsl-1.30/execution/range_analysis_fsat_of_nan.shader_test
@@ -13,7 +13,7 @@ out vec4 piglit_fragcolor;
void main()
{
/* Create a value that, if it were a number, would have to be > 0. Due to
- * possilbe flush-to-zero semantics, pretty much anything involving
+ * possible flush-to-zero semantics, pretty much anything involving
* multiplication or division can be zero. However, gt_zero + ge_zero is
* gt_zero.
*/
diff --git a/tests/spec/glsl-1.30/execution/varying-packing-mixed-types.shader_test b/tests/spec/glsl-1.30/execution/varying-packing-mixed-types.shader_test
index a002fb491..f37e21bda 100644
--- a/tests/spec/glsl-1.30/execution/varying-packing-mixed-types.shader_test
+++ b/tests/spec/glsl-1.30/execution/varying-packing-mixed-types.shader_test
@@ -24,10 +24,13 @@ flat out int ia[gl_MaxVaryingComponents - 2];
void main()
{
gl_Position = gl_Vertex;
- f = f_ref + f_dummy;
- u = u_ref + u_dummy;
+
+ // introduce a fake dependency on inputs to prevent the compiler from
+ // moving ref to the next shader
+ f = gl_Vertex.x < -10.0 ? 0.0 : f_ref;
+ u = gl_Vertex.x < -10.0 ? 0u : u_ref;
for (int i = 0; i < gl_MaxVaryingComponents - 2; i++)
- ia[i] = i_ref + i;
+ ia[i] = gl_Vertex.x < -10.0 ? 0 : i_ref + i;
}
[fragment shader]
@@ -59,7 +62,5 @@ void main()
uniform int i_ref -1000
uniform uint u_ref 0xfedcba98
uniform float f_ref 3.1415926
-uniform float f_dummy 0
-uniform uint u_dummy 0
draw rect -1 -1 2 2
probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/spec/glsl-1.40/uniform_buffer/two-stages.shader_test b/tests/spec/glsl-1.40/uniform_buffer/two-stages.shader_test
new file mode 100644
index 000000000..d0cd41838
--- /dev/null
+++ b/tests/spec/glsl-1.40/uniform_buffer/two-stages.shader_test
@@ -0,0 +1,79 @@
+# Simple UBO test with two stages using the same UBO.
+
+[require]
+GL >= 3.1
+GLSL >= 1.40
+GL_ARB_program_interface_query
+
+[vertex shader]
+
+#version 450
+
+layout (location = 0) in vec4 piglit_vertex;
+layout (location = 1) out vec4 vertexColor;
+
+
+layout (std140, binding = 5) uniform ComponentsBlock
+ {
+ vec4 c1;
+ vec2 c2;
+ } components;
+
+void main()
+{
+ vec4 fail_color = vec4(1.0, 0.0, 0.0, 1.0);
+ vertexColor = vec4(0.0, 1.0, 0.0, 1.0);
+
+ if (components.c1 != vec4(4575.7996643, 14191.6120546, -30199.3084764, -31303.4210269))
+ vertexColor = fail_color;
+
+ if (components.c2 != vec2(-10231.1810483, 11729.6478218))
+ vertexColor = fail_color;
+
+ gl_Position = piglit_vertex;
+}
+
+[fragment shader]
+
+#version 450
+
+layout (location = 0) out vec4 color;
+layout (location = 1) in vec4 vertexColor;
+layout (std140, binding = 5) uniform ComponentsBlock
+ {
+ vec4 c1;
+ vec2 c2;
+ } components;
+
+void main()
+{
+ vec4 fail_color = vec4(1.0, 0.0, 0.0, 1.0);
+ color = vec4(0.0, 1.0, 0.0, 1.0);
+
+ if (components.c1 != vec4(4575.7996643, 14191.6120546, -30199.3084764, -31303.4210269))
+ color = fail_color;
+
+ if (components.c2 != vec2(-10231.1810483, 11729.6478218))
+ color = fail_color;
+
+ if (vertexColor != vec4(0.0, 1.0, 0.0, 1.0))
+ color = fail_color;
+}
+
+[test]
+clear color 1.0 0.0 0.0 0.0
+clear
+
+block binding 5
+block offset 0
+uniform vec4 ComponentsBlock.c1 4575.7996643 14191.6120546 -30199.3084764 -31303.4210269
+block offset 16
+uniform vec2 ComponentsBlock.c2 -10231.1810483 11729.6478218
+
+verify program_interface_query GL_UNIFORM_BLOCK ComponentsBlock GL_NUM_ACTIVE_VARIABLES 2
+verify program_interface_query GL_UNIFORM_BLOCK ComponentsBlock GL_BUFFER_DATA_SIZE 32
+
+verify program_query GL_ACTIVE_UNIFORMS 2
+
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/spec/glsl-1.50/execution/compatibility/clipping/gs-clip-vertex-enables.shader_test b/tests/spec/glsl-1.50/execution/compatibility/clipping/gs-clip-vertex-enables.shader_test
index d5ef9cd98..ba7e63712 100644
--- a/tests/spec/glsl-1.50/execution/compatibility/clipping/gs-clip-vertex-enables.shader_test
+++ b/tests/spec/glsl-1.50/execution/compatibility/clipping/gs-clip-vertex-enables.shader_test
@@ -5,7 +5,7 @@
#
# To verify that each enable works, the combinations of enables were
# chosen such that:
-# - Every plane is enabled at least once and disbled at least once.
+# - Every plane is enabled at least once and disabled at least once.
# - Every plane is enabled and disabled in a different pattern.
#
# Note: Some implementations have bugs related to improper coordinate
diff --git a/tests/spec/glsl-1.50/execution/compatibility/clipping/vs-gs-clip-vertex-enables.shader_test b/tests/spec/glsl-1.50/execution/compatibility/clipping/vs-gs-clip-vertex-enables.shader_test
index 4231e8b26..c427b4461 100644
--- a/tests/spec/glsl-1.50/execution/compatibility/clipping/vs-gs-clip-vertex-enables.shader_test
+++ b/tests/spec/glsl-1.50/execution/compatibility/clipping/vs-gs-clip-vertex-enables.shader_test
@@ -5,7 +5,7 @@
#
# To verify that each enable works, the combinations of enables were
# chosen such that:
-# - Every plane is enabled at least once and disbled at least once.
+# - Every plane is enabled at least once and disabled at least once.
# - Every plane is enabled and disabled in a different pattern.
#
# Note: Some implementations have bugs related to improper coordinate
diff --git a/tests/spec/glsl-1.50/execution/compatibility/vs-gs-texcoord-array.shader_test b/tests/spec/glsl-1.50/execution/compatibility/vs-gs-texcoord-array.shader_test
index fae6cff63..0ff1fe2a9 100644
--- a/tests/spec/glsl-1.50/execution/compatibility/vs-gs-texcoord-array.shader_test
+++ b/tests/spec/glsl-1.50/execution/compatibility/vs-gs-texcoord-array.shader_test
@@ -14,9 +14,11 @@ out gl_PerVertex {
void main()
{
- for (int i = 0; i < n; i++) {
+ int i;
+ for (i = 0; i < n; i++)
gl_TexCoord[i] = vec4(0.5, 0.5, 0.5, 0.5) * float(i);
- }
+ for (; i < gl_TexCoord.length(); i++)
+ gl_TexCoord[i] = vec4(1.0, 1.0, 1.0, 1.0) * float(i);
gl_Position = gl_Vertex;
}
diff --git a/tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-conflicting-case-2.shader_test b/tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-conflicting-case-2.shader_test
index 3350e0fb4..3b3f9e16f 100644
--- a/tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-conflicting-case-2.shader_test
+++ b/tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-conflicting-case-2.shader_test
@@ -17,7 +17,7 @@
* the same set of qualifiers."
*
* Tests the case when all the fragment shaders which use gl_FragCoord,
- * redeclare it with conflicting layout qualifiers. It varifies that
+ * redeclare it with conflicting layout qualifiers. It verifies that
* link error is not effected by the presence of a fragment shader which
* doesn't use gl_FragCoord.
*/
diff --git a/tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-conflicting-case-3.shader_test b/tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-conflicting-case-3.shader_test
index a21f918d5..f7506845d 100644
--- a/tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-conflicting-case-3.shader_test
+++ b/tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-conflicting-case-3.shader_test
@@ -17,7 +17,7 @@
* the same set of qualifiers."
*
* Tests the case when all the fragment shaders which use gl_FragCoord,
- * redeclare it with conflicting layout qualifiers. It varifies that
+ * redeclare it with conflicting layout qualifiers. It verifies that
* link error is generated even if gl_FragCoord is redeclared by the
* last fragment shader attached.
*/
diff --git a/tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-matching-case-2.shader_test b/tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-matching-case-2.shader_test
index f78ec3f15..250c025dc 100644
--- a/tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-matching-case-2.shader_test
+++ b/tests/spec/glsl-1.50/execution/fragcoord-layout-qualifiers-matching-case-2.shader_test
@@ -18,7 +18,7 @@
*
*
* Tests the case when all the fragment shaders which use gl_FragCoord,
- * redeclare it with matching layout qualifiers. The specfic order of
+ * redeclare it with matching layout qualifiers. The specific order of
* attached fragment shaders is important here.
*/
[require]
diff --git a/tests/spec/glsl-1.50/execution/geometry/gs-max-output.cpp b/tests/spec/glsl-1.50/execution/geometry/gs-max-output.cpp
index 6d71b9fe7..96585946e 100644
--- a/tests/spec/glsl-1.50/execution/geometry/gs-max-output.cpp
+++ b/tests/spec/glsl-1.50/execution/geometry/gs-max-output.cpp
@@ -59,7 +59,7 @@ struct testcase {
unsigned num_instances; /* draw instances */
unsigned num_points; /* draw size / count */
unsigned num_invocations; /* GS invocations / instances */
- unsigned num_outputs; /* # vertex ouput per GS invocation */
+ unsigned num_outputs; /* # vertex output per GS invocation */
unsigned num_components; /* # extra components per GS output vertex */
diff --git a/tests/spec/glsl-1.50/execution/geometry/tri-strip-ordering-with-prim-restart.c b/tests/spec/glsl-1.50/execution/geometry/tri-strip-ordering-with-prim-restart.c
index 61bd73e81..a59f17b39 100644
--- a/tests/spec/glsl-1.50/execution/geometry/tri-strip-ordering-with-prim-restart.c
+++ b/tests/spec/glsl-1.50/execution/geometry/tri-strip-ordering-with-prim-restart.c
@@ -39,7 +39,7 @@
* restart to split it into a pair of 3-triangle strips (this ensures
* that triangles in the first strip have the same parity in relation
* to the strip as they have when measured by gl_PrimitiveIDIn;
- * triangles in the second strip hav opposite parity in relation to
+ * triangles in the second strip have opposite parity in relation to
* the strip from what they have when measured by gl_PrimitiveIDIn).
* The vertex IDs of all vertices are collected using transform
* feedback, and checked in C to make sure it matches the expected
diff --git a/tests/spec/glsl-1.50/execution/interface-block-copy-vs-gs-fs.shader_test b/tests/spec/glsl-1.50/execution/interface-block-copy-vs-gs-fs.shader_test
new file mode 100644
index 000000000..1ce537ece
--- /dev/null
+++ b/tests/spec/glsl-1.50/execution/interface-block-copy-vs-gs-fs.shader_test
@@ -0,0 +1,77 @@
+# Test the direct copy of an entire named block
+
+[require]
+GLSL >= 1.50
+
+[vertex shader]
+#version 150
+
+out Data
+{
+ vec3 a;
+ float b;
+} outData;
+
+out vec4 vertex_to_gs;
+
+in vec4 piglit_vertex;
+
+void main()
+{
+ outData.a = vec3(0.0, 0.75, 1.0);
+ outData.b = 0.5;
+
+ vertex_to_gs = piglit_vertex;
+}
+
+[geometry shader]
+#version 150
+
+layout(triangles) in;
+layout(triangle_strip, max_vertices = 3) out;
+
+in vec4 vertex_to_gs[3];
+
+in Data
+{
+ vec3 a;
+ float b;
+} inData[];
+
+out Data
+{
+ vec3 a;
+ float b;
+} outData;
+
+void main()
+{
+ for (int i = 0; i < 3; i++) {
+ gl_Position = vertex_to_gs[i];
+ outData = inData[i];
+ EmitVertex();
+ }
+}
+
+[fragment shader]
+#version 150
+
+out vec4 color;
+
+in Data
+{
+ vec3 a;
+ float b;
+} inData;
+
+void main()
+{
+ color = vec4(inData.b, inData.a);
+}
+
+[test]
+clear color 0.1 0.1 0.1 0.1
+clear
+
+draw rect -1 -1 2 2
+probe all rgb 0.5 0 0.75
diff --git a/tests/spec/glsl-1.50/execution/primitive-id-no-gs-line.shader_test b/tests/spec/glsl-1.50/execution/primitive-id-no-gs-line.shader_test
index b98880d7d..aa5b07f65 100644
--- a/tests/spec/glsl-1.50/execution/primitive-id-no-gs-line.shader_test
+++ b/tests/spec/glsl-1.50/execution/primitive-id-no-gs-line.shader_test
@@ -61,7 +61,7 @@ piglit_vertex/float/2
# shader will draw a different color for failing pixels, and "probe all" will
# detect the problem.
#
-# This won't catch cases where the test doesn't draw anything. Hopefullly
+# This won't catch cases where the test doesn't draw anything. Hopefully
# problems of that nature will have already been caught by other tests.
clear color 0.0 1.0 0.0 1.0
diff --git a/tests/spec/glsl-1.50/execution/primitive-id-no-gs-point.shader_test b/tests/spec/glsl-1.50/execution/primitive-id-no-gs-point.shader_test
index d5ce5de25..5c99d1f7b 100644
--- a/tests/spec/glsl-1.50/execution/primitive-id-no-gs-point.shader_test
+++ b/tests/spec/glsl-1.50/execution/primitive-id-no-gs-point.shader_test
@@ -61,7 +61,7 @@ piglit_vertex/float/2
# shader will draw a different color for failing pixels, and "probe all" will
# detect the problem.
#
-# This won't catch cases where the test doesn't draw anything. Hopefullly
+# This won't catch cases where the test doesn't draw anything. Hopefully
# problems of that nature will have already been caught by other tests.
clear color 0.0 1.0 0.0 1.0
diff --git a/tests/spec/glsl-1.50/execution/varying-struct-basic-gs-fs.shader_test b/tests/spec/glsl-1.50/execution/varying-struct-basic-gs-fs.shader_test
index 5529ff381..358ce9bde 100644
--- a/tests/spec/glsl-1.50/execution/varying-struct-basic-gs-fs.shader_test
+++ b/tests/spec/glsl-1.50/execution/varying-struct-basic-gs-fs.shader_test
@@ -57,24 +57,28 @@ out Foo foo;
void main()
{
+ // introduce a fake dependency on inputs to prevent the compiler from
+ // moving ref to the next shader
+ float refx = pos[0].x < -10.0 ? 0.0 : ref;
+
for(int i = 0; i < 3; i++) {
gl_Position = pos[i];
- foo.a = mat4(ref, ref + 1.0, ref + 2.0, ref + 3.0,
- ref + 4.0, ref + 5.0, ref + 6.0, ref + 7.0,
- ref + 8.0, ref + 9.0, ref + 10.0, ref + 11.0,
- ref + 12.0, ref + 13.0, ref + 14.0, ref + 15.0);
-
- foo.b = mat3(ref + 16.0, ref + 17.0, ref + 18.0,
- ref + 19.0, ref + 20.0, ref + 21.0,
- ref + 22.0, ref + 23.0, ref + 24.0);
-
- foo.c = mat2(ref + 25.0, ref + 26.0,
- ref + 27.0, ref + 28.0);
-
- foo.d = vec4(ref + 29.0, ref + 30.0, ref + 31.0, ref + 32.0);
- foo.e = vec3(ref + 33.0, ref + 34.0, ref + 35.0);
- foo.f = vec2(ref + 36.0, ref + 37.0);
- foo.g = ref + 38.0;
+ foo.a = mat4(refx, refx + 1.0, refx + 2.0, refx + 3.0,
+ refx + 4.0, refx + 5.0, refx + 6.0, refx + 7.0,
+ refx + 8.0, refx + 9.0, refx + 10.0, refx + 11.0,
+ refx + 12.0, refx + 13.0, refx + 14.0, refx + 15.0);
+
+ foo.b = mat3(refx + 16.0, refx + 17.0, refx + 18.0,
+ refx + 19.0, refx + 20.0, refx + 21.0,
+ refx + 22.0, refx + 23.0, refx + 24.0);
+
+ foo.c = mat2(refx + 25.0, refx + 26.0,
+ refx + 27.0, refx + 28.0);
+
+ foo.d = vec4(refx + 29.0, refx + 30.0, refx + 31.0, refx + 32.0);
+ foo.e = vec3(refx + 33.0, refx + 34.0, refx + 35.0);
+ foo.f = vec2(refx + 36.0, refx + 37.0);
+ foo.g = refx + 38.0;
EmitVertex();
}
}
diff --git a/tests/spec/glsl-1.50/execution/varying-struct-basic-vs-fs.shader_test b/tests/spec/glsl-1.50/execution/varying-struct-basic-vs-fs.shader_test
index a80595417..fd470917b 100644
--- a/tests/spec/glsl-1.50/execution/varying-struct-basic-vs-fs.shader_test
+++ b/tests/spec/glsl-1.50/execution/varying-struct-basic-vs-fs.shader_test
@@ -41,22 +41,26 @@ void main()
{
gl_Position = piglit_vertex;
- foo.a = mat4(ref, ref + 1.0, ref + 2.0, ref + 3.0,
- ref + 4.0, ref + 5.0, ref + 6.0, ref + 7.0,
- ref + 8.0, ref + 9.0, ref + 10.0, ref + 11.0,
- ref + 12.0, ref + 13.0, ref + 14.0, ref + 15.0);
-
- foo.b = mat3(ref + 16.0, ref + 17.0, ref + 18.0,
- ref + 19.0, ref + 20.0, ref + 21.0,
- ref + 22.0, ref + 23.0, ref + 24.0);
-
- foo.c = mat2(ref + 25.0, ref + 26.0,
- ref + 27.0, ref + 28.0);
-
- foo.d = vec4(ref + 29.0, ref + 30.0, ref + 31.0, ref + 32.0);
- foo.e = vec3(ref + 33.0, ref + 34.0, ref + 35.0);
- foo.f = vec2(ref + 36.0, ref + 37.0);
- foo.g = ref + 38.0;
+ // introduce a fake dependency on inputs to prevent the compiler from
+ // moving ref to the next shader
+ float refx = piglit_vertex.x < -10.0 ? 0.0 : ref;
+
+ foo.a = mat4(refx, refx + 1.0, refx + 2.0, refx + 3.0,
+ refx + 4.0, refx + 5.0, refx + 6.0, refx + 7.0,
+ refx + 8.0, refx + 9.0, refx + 10.0, refx + 11.0,
+ refx + 12.0, refx + 13.0, refx + 14.0, refx + 15.0);
+
+ foo.b = mat3(refx + 16.0, refx + 17.0, refx + 18.0,
+ refx + 19.0, refx + 20.0, refx + 21.0,
+ refx + 22.0, refx + 23.0, refx + 24.0);
+
+ foo.c = mat2(refx + 25.0, refx + 26.0,
+ refx + 27.0, refx + 28.0);
+
+ foo.d = vec4(refx + 29.0, refx + 30.0, refx + 31.0, refx + 32.0);
+ foo.e = vec3(refx + 33.0, refx + 34.0, refx + 35.0);
+ foo.f = vec2(refx + 36.0, refx + 37.0);
+ foo.g = refx + 38.0;
}
[fragment shader]
diff --git a/tests/spec/glsl-1.50/execution/varying-struct-basic-vs-gs.shader_test b/tests/spec/glsl-1.50/execution/varying-struct-basic-vs-gs.shader_test
index 0a5b9b211..4dbeefcfd 100644
--- a/tests/spec/glsl-1.50/execution/varying-struct-basic-vs-gs.shader_test
+++ b/tests/spec/glsl-1.50/execution/varying-struct-basic-vs-gs.shader_test
@@ -44,22 +44,27 @@ void main()
{
gl_Position = vertex;
pos = vertex;
- foo.a = mat4(ref, ref + 1.0, ref + 2.0, ref + 3.0,
- ref + 4.0, ref + 5.0, ref + 6.0, ref + 7.0,
- ref + 8.0, ref + 9.0, ref + 10.0, ref + 11.0,
- ref + 12.0, ref + 13.0, ref + 14.0, ref + 15.0);
-
- foo.b = mat3(ref + 16.0, ref + 17.0, ref + 18.0,
- ref + 19.0, ref + 20.0, ref + 21.0,
- ref + 22.0, ref + 23.0, ref + 24.0);
-
- foo.c = mat2(ref + 25.0, ref + 26.0,
- ref + 27.0, ref + 28.0);
-
- foo.d = vec4(ref + 29.0, ref + 30.0, ref + 31.0, ref + 32.0);
- foo.e = vec3(ref + 33.0, ref + 34.0, ref + 35.0);
- foo.f = vec2(ref + 36.0, ref + 37.0);
- foo.g = ref + 38.0;
+
+ // introduce a fake dependency on inputs to prevent the compiler from
+ // moving ref to the next shader
+ float refx = vertex.x < -10.0 ? 0.0 : ref;
+
+ foo.a = mat4(refx, refx + 1.0, refx + 2.0, refx + 3.0,
+ refx + 4.0, refx + 5.0, refx + 6.0, refx + 7.0,
+ refx + 8.0, refx + 9.0, refx + 10.0, refx + 11.0,
+ refx + 12.0, refx + 13.0, refx + 14.0, refx + 15.0);
+
+ foo.b = mat3(refx + 16.0, refx + 17.0, refx + 18.0,
+ refx + 19.0, refx + 20.0, refx + 21.0,
+ refx + 22.0, refx + 23.0, refx + 24.0);
+
+ foo.c = mat2(refx + 25.0, refx + 26.0,
+ refx + 27.0, refx + 28.0);
+
+ foo.d = vec4(refx + 29.0, refx + 30.0, refx + 31.0, refx + 32.0);
+ foo.e = vec3(refx + 33.0, refx + 34.0, refx + 35.0);
+ foo.f = vec2(refx + 36.0, refx + 37.0);
+ foo.g = refx + 38.0;
}
[geometry shader]
diff --git a/tests/spec/glsl-1.50/execution/vs-input-arrays.c b/tests/spec/glsl-1.50/execution/vs-input-arrays.c
index d94d0c5f2..07a3b3ab1 100644
--- a/tests/spec/glsl-1.50/execution/vs-input-arrays.c
+++ b/tests/spec/glsl-1.50/execution/vs-input-arrays.c
@@ -40,7 +40,7 @@
* gl_VertexID). VS emits a float, 0 for pass, 1 for fail. This is done because
* bool cannot be sent as a varying, and using flat shading for sending an int
* results in additional vertex info being discarded. FS draws GREEN if it
- * received the expeced 0 from the VS, RED if !0.
+ * received the expected 0 from the VS, RED if !0.
*/
#include "piglit-util-gl.h"
diff --git a/tests/spec/glsl-1.50/execution/vs-named-block-no-modify.c b/tests/spec/glsl-1.50/execution/vs-named-block-no-modify.c
index ed3d21372..38737a251 100644
--- a/tests/spec/glsl-1.50/execution/vs-named-block-no-modify.c
+++ b/tests/spec/glsl-1.50/execution/vs-named-block-no-modify.c
@@ -25,7 +25,7 @@
/**
* \file named-block-no-modify.c
*
- * Test that uniform variables containted within a named uniform block cannot be
+ * Test that uniform variables contained within a named uniform block cannot be
* accessed by the glUniform* commands.
*
* Section 2.11.4 (Uniform Variables) of the GL 3.2 spec says:
diff --git a/tests/spec/glsl-es-1.00/execution/glsl-no-vertex-attribs.shader_test b/tests/spec/glsl-es-1.00/execution/glsl-no-vertex-attribs.shader_test
index 36a6b4c2a..ddcc48a3b 100644
--- a/tests/spec/glsl-es-1.00/execution/glsl-no-vertex-attribs.shader_test
+++ b/tests/spec/glsl-es-1.00/execution/glsl-no-vertex-attribs.shader_test
@@ -1,5 +1,5 @@
#
-# Tests that we can succesfully render a point with OpenGL ES 2.0
+# Tests that we can successfully render a point with OpenGL ES 2.0
# without having any vertex attributes enabled.
#
[require]
diff --git a/tests/spec/glsl-es-1.00/linker/fface-invariant.c b/tests/spec/glsl-es-1.00/linker/fface-invariant.c
index 35ce51549..3759bcd3b 100644
--- a/tests/spec/glsl-es-1.00/linker/fface-invariant.c
+++ b/tests/spec/glsl-es-1.00/linker/fface-invariant.c
@@ -60,16 +60,19 @@ piglit_init(int argc, char **argv)
vs_shader = piglit_compile_shader_text(GL_VERTEX_SHADER, vs_source);
fs_shader = piglit_compile_shader_text_nothrow(GL_FRAGMENT_SHADER,
- fs_source, true);
+ fs_source, false);
/* A compile error is allowed. */
if (!fs_shader)
piglit_report_result(PIGLIT_PASS);
- prog = piglit_link_simple_program(vs_shader, fs_shader);
+ prog = glCreateProgram();
+ glAttachShader(prog, vs_shader);
+ glAttachShader(prog, fs_shader);
+ glLinkProgram(prog);
- /* A link error is allowed. */
- if (!prog)
+ /* A link error is allowed, and must be present if a compile error wasn't thrown. */
+ if (!piglit_link_check_status_quiet(prog))
piglit_report_result(PIGLIT_PASS);
piglit_report_result(PIGLIT_FAIL);
diff --git a/tests/spec/glsl-es-3.00/execution/varying-struct-basic.shader_test b/tests/spec/glsl-es-3.00/execution/varying-struct-basic.shader_test
index 00f1e05eb..b96915c12 100644
--- a/tests/spec/glsl-es-3.00/execution/varying-struct-basic.shader_test
+++ b/tests/spec/glsl-es-3.00/execution/varying-struct-basic.shader_test
@@ -41,22 +41,26 @@ void main()
{
gl_Position = vertex;
- foo.a = mat4(ref, ref + 1.0, ref + 2.0, ref + 3.0,
- ref + 4.0, ref + 5.0, ref + 6.0, ref + 7.0,
- ref + 8.0, ref + 9.0, ref + 10.0, ref + 11.0,
- ref + 12.0, ref + 13.0, ref + 14.0, ref + 15.0);
-
- foo.b = mat3(ref + 16.0, ref + 17.0, ref + 18.0,
- ref + 19.0, ref + 20.0, ref + 21.0,
- ref + 22.0, ref + 23.0, ref + 24.0);
-
- foo.c = mat2(ref + 25.0, ref + 26.0,
- ref + 27.0, ref + 28.0);
-
- foo.d = vec4(ref + 29.0, ref + 30.0, ref + 31.0, ref + 32.0);
- foo.e = vec3(ref + 33.0, ref + 34.0, ref + 35.0);
- foo.f = vec2(ref + 36.0, ref + 37.0);
- foo.g = ref + 38.0;
+ // introduce a fake dependency on inputs to prevent the compiler from
+ // moving ref to the next shader
+ float refx = vertex.x < -10.0 ? 0.0 : ref;
+
+ foo.a = mat4(refx, refx + 1.0, refx + 2.0, refx + 3.0,
+ refx + 4.0, refx + 5.0, refx + 6.0, refx + 7.0,
+ refx + 8.0, refx + 9.0, refx + 10.0, refx + 11.0,
+ refx + 12.0, refx + 13.0, refx + 14.0, refx + 15.0);
+
+ foo.b = mat3(refx + 16.0, refx + 17.0, refx + 18.0,
+ refx + 19.0, refx + 20.0, refx + 21.0,
+ refx + 22.0, refx + 23.0, refx + 24.0);
+
+ foo.c = mat2(refx + 25.0, refx + 26.0,
+ refx + 27.0, refx + 28.0);
+
+ foo.d = vec4(refx + 29.0, refx + 30.0, refx + 31.0, refx + 32.0);
+ foo.e = vec3(refx + 33.0, refx + 34.0, refx + 35.0);
+ foo.f = vec2(refx + 36.0, refx + 37.0);
+ foo.g = refx + 38.0;
}
[fragment shader]
diff --git a/tests/spec/glx_arb_create_context/invalid-attribute.c b/tests/spec/glx_arb_create_context/invalid-attribute.c
index 4e1884c49..27e800402 100644
--- a/tests/spec/glx_arb_create_context/invalid-attribute.c
+++ b/tests/spec/glx_arb_create_context/invalid-attribute.c
@@ -43,7 +43,7 @@ static bool try_attribute(int attribute)
if (ctx != NULL) {
fprintf(stderr,
- "Created OpenGL context with invalud attribute "
+ "Created OpenGL context with invalid attribute "
"0x%08x, but this should have failed.\n",
attribute);
glXDestroyContext(dpy, ctx);
diff --git a/tests/spec/glx_arb_create_context/invalid-gl-version.c b/tests/spec/glx_arb_create_context/invalid-gl-version.c
index 12c253b2c..565fc9bef 100644
--- a/tests/spec/glx_arb_create_context/invalid-gl-version.c
+++ b/tests/spec/glx_arb_create_context/invalid-gl-version.c
@@ -101,7 +101,7 @@ int main(int argc, char **argv)
/* Since the writing of the GLX_ARB_create_context_spec, versions 3.3,
* 4.0, 4.1, and 4.2 have been released. There is no expectation that
- * 3.4 will ever exist becuase it would have to include functionality
+ * 3.4 will ever exist because it would have to include functionality
* not in 4.0, and that would be weird.
*/
pass = try_version(3, 4) && pass;
diff --git a/tests/spec/glx_arb_create_context/invalid-reset-strategy.c b/tests/spec/glx_arb_create_context/invalid-reset-strategy.c
index eed0a8d7f..0a4df9421 100644
--- a/tests/spec/glx_arb_create_context/invalid-reset-strategy.c
+++ b/tests/spec/glx_arb_create_context/invalid-reset-strategy.c
@@ -39,7 +39,7 @@ static bool try_reset_strategy(int reset_strategy)
if (ctx != NULL) {
fprintf(stderr,
"Created OpenGL context with invalid reset "
- "notifiction strategy\n"
+ "notification strategy\n"
"0x%08x, but this should have failed.\n",
reset_strategy);
glXDestroyContext(dpy, ctx);
diff --git a/tests/spec/glx_ext_import_context/common.c b/tests/spec/glx_ext_import_context/common.c
index 8b0be4fcc..35fe95551 100644
--- a/tests/spec/glx_ext_import_context/common.c
+++ b/tests/spec/glx_ext_import_context/common.c
@@ -98,8 +98,7 @@ void GLX_EXT_import_context_setup(void)
if (!piglit_is_extension_in_string(client_extensions,
"GLX_EXT_import_context")) {
- fprintf(stderr,
- "Test requires GLX_EXT_import_context.\n");
+ printf("Test requires GLX_EXT_import_context.\n");
piglit_report_result(PIGLIT_SKIP);
}
} else {
diff --git a/tests/spec/glx_ext_import_context/query-context-info.c b/tests/spec/glx_ext_import_context/query-context-info.c
index 6e187a1fb..dbc1ce259 100644
--- a/tests/spec/glx_ext_import_context/query-context-info.c
+++ b/tests/spec/glx_ext_import_context/query-context-info.c
@@ -105,7 +105,7 @@ int main(int argc, char **argv)
&& pass;
/* Create a second indirect-rendering context, and have it share the
- * first indirect-rendering context. The XID of the share conext for
+ * first indirect-rendering context. The XID of the share context for
* the original context should be unchanged.
*/
ctx = glXCreateContext(dpy, visinfo, indirectCtx, False);
diff --git a/tests/spec/intel_performance_query/issue_2235.c b/tests/spec/intel_performance_query/issue_2235.c
index 71ae568e0..0cb88ee58 100644
--- a/tests/spec/intel_performance_query/issue_2235.c
+++ b/tests/spec/intel_performance_query/issue_2235.c
@@ -41,7 +41,7 @@ int main(int argc, char **argv)
EGLContext ctx1;
EGLint attr[] = {
EGL_CONTEXT_MAJOR_VERSION_KHR, 3,
- EGL_CONTEXT_MINOR_VERSION_KHR, 2,
+ EGL_CONTEXT_MINOR_VERSION_KHR, 0,
EGL_NONE
};
GLuint query, query_handle;
diff --git a/tests/spec/intel_shader_atomic_float_minmax/execution/ssbo-atomicCompSwap-float-NaN.shader_test b/tests/spec/intel_shader_atomic_float_minmax/execution/ssbo-atomicCompSwap-float-NaN.shader_test
index 0ad13b742..6cdffdb2d 100644
--- a/tests/spec/intel_shader_atomic_float_minmax/execution/ssbo-atomicCompSwap-float-NaN.shader_test
+++ b/tests/spec/intel_shader_atomic_float_minmax/execution/ssbo-atomicCompSwap-float-NaN.shader_test
@@ -17,7 +17,7 @@ layout(binding = 0, std430) buffer bufblock {
#define POS_NAN(x) (0x7f800000u | (0x007fffffu & uint(x)))
#define NEG_NAN(x) (0xff800000u | (0x007fffffu & uint(x)))
-uniform uint comparitors[] = uint[](POS_NAN(0x00ffffff),
+uniform uint comparators[] = uint[](POS_NAN(0x00ffffff),
NEG_NAN(0x00ffffff),
POS_NAN(0x00555555),
NEG_NAN(0x00555555),
@@ -38,7 +38,7 @@ void main()
* element will forever be set to float(idx).
*/
atomicCompSwap(value[idx],
- uintBitsToFloat(comparitors[idx]),
+ uintBitsToFloat(comparators[idx]),
42.0);
color = value[idx] == 42.0
diff --git a/tests/spec/intel_shader_atomic_float_minmax/execution/ssbo-atomicMax-float-NaN.shader_test b/tests/spec/intel_shader_atomic_float_minmax/execution/ssbo-atomicMax-float-NaN.shader_test
index 527de10eb..5eda03ae4 100644
--- a/tests/spec/intel_shader_atomic_float_minmax/execution/ssbo-atomicMax-float-NaN.shader_test
+++ b/tests/spec/intel_shader_atomic_float_minmax/execution/ssbo-atomicMax-float-NaN.shader_test
@@ -85,21 +85,21 @@ void main()
uint idx = (y * width) + x;
- uint comparitor;
+ uint comparator;
uint j = y & 7u;
if (j <= 3u)
- comparitor = floatBitsToUint(float(idx));
+ comparator = floatBitsToUint(float(idx));
else if (j == 4u)
- comparitor = make_qnan(idx * 101701u, false);
+ comparator = make_qnan(idx * 101701u, false);
else if (j == 5u)
- comparitor = make_qnan(idx * 89137u, true);
+ comparator = make_qnan(idx * 89137u, true);
else if (j == 6u)
- comparitor = make_snan(idx * 2399u, false);
+ comparator = make_snan(idx * 2399u, false);
else
- comparitor = make_snan(idx * 337u, true);
+ comparator = make_snan(idx * 337u, true);
- float result = atomicMax(value[idx], uintBitsToFloat(comparitor));
+ float result = atomicMax(value[idx], uintBitsToFloat(comparator));
uint k = idx & 7u;
if (k <= 3u)
@@ -128,7 +128,7 @@ void main()
* does not explicitly state
* which.
*/
- if (is_snan(comparitor))
+ if (is_snan(comparator))
expect(is_snan(after));
else
expect(floatBitsToUint(after) == floatBitsToUint(result));
@@ -141,9 +141,9 @@ void main()
* does not explicitly state
* which.
*/
- if (is_snan(comparitor))
- expect(floatBitsToUint(after) == comparitor);
- else if (is_qnan(comparitor))
+ if (is_snan(comparator))
+ expect(floatBitsToUint(after) == comparator);
+ else if (is_qnan(comparator))
expect(is_qnan(after));
else
expect(after == float(idx));
@@ -153,9 +153,9 @@ void main()
* fmax(x, sNaN) => sNaN
* fmax(x, qNaN) => x
*/
- if (is_snan(comparitor))
- expect(floatBitsToUint(after) == comparitor);
- else if (is_qnan(comparitor))
+ if (is_snan(comparator))
+ expect(floatBitsToUint(after) == comparator);
+ else if (is_qnan(comparator))
expect(after == float(idx) - 0.5);
else
expect(after == float(idx));
diff --git a/tests/spec/intel_shader_atomic_float_minmax/execution/ssbo-atomicMin-float-NaN.shader_test b/tests/spec/intel_shader_atomic_float_minmax/execution/ssbo-atomicMin-float-NaN.shader_test
index f34753610..63249c489 100644
--- a/tests/spec/intel_shader_atomic_float_minmax/execution/ssbo-atomicMin-float-NaN.shader_test
+++ b/tests/spec/intel_shader_atomic_float_minmax/execution/ssbo-atomicMin-float-NaN.shader_test
@@ -85,21 +85,21 @@ void main()
uint idx = (y * width) + x;
- uint comparitor;
+ uint comparator;
uint j = y & 7u;
if (j <= 3u)
- comparitor = floatBitsToUint(float(idx));
+ comparator = floatBitsToUint(float(idx));
else if (j == 4u)
- comparitor = make_qnan(idx * 16871u, false);
+ comparator = make_qnan(idx * 16871u, false);
else if (j == 5u)
- comparitor = make_qnan(idx * 9929u, true);
+ comparator = make_qnan(idx * 9929u, true);
else if (j == 6u)
- comparitor = make_snan(idx * 8243u, false);
+ comparator = make_snan(idx * 8243u, false);
else
- comparitor = make_snan(idx * 4621u, true);
+ comparator = make_snan(idx * 4621u, true);
- float result = atomicMin(value[idx], uintBitsToFloat(comparitor));
+ float result = atomicMin(value[idx], uintBitsToFloat(comparator));
uint k = idx & 7u;
if (k <= 3u)
@@ -128,7 +128,7 @@ void main()
* does not explicitly state
* which.
*/
- if (is_snan(comparitor))
+ if (is_snan(comparator))
expect(is_snan(after));
else
expect(floatBitsToUint(after) == floatBitsToUint(result));
@@ -141,9 +141,9 @@ void main()
* does not explicitly state
* which.
*/
- if (is_snan(comparitor))
- expect(floatBitsToUint(after) == comparitor);
- else if (is_qnan(comparitor))
+ if (is_snan(comparator))
+ expect(floatBitsToUint(after) == comparator);
+ else if (is_qnan(comparator))
expect(is_qnan(after));
else
expect(after == float(idx));
@@ -153,9 +153,9 @@ void main()
* fmin(x, sNaN) => sNaN
* fmin(x, qNaN) => x
*/
- if (is_snan(comparitor))
- expect(floatBitsToUint(after) == comparitor);
- else if (is_qnan(comparitor))
+ if (is_snan(comparator))
+ expect(floatBitsToUint(after) == comparator);
+ else if (is_qnan(comparator))
expect(after == float(idx) + 0.5);
else
expect(after == float(idx));
diff --git a/tests/spec/khr_debug/debug-push-pop-group.c b/tests/spec/khr_debug/debug-push-pop-group.c
index d4c08cd09..1ac4ef48a 100644
--- a/tests/spec/khr_debug/debug-push-pop-group.c
+++ b/tests/spec/khr_debug/debug-push-pop-group.c
@@ -287,7 +287,7 @@ static bool test_push_pop_debug_group()
pass = false;
}
- /* double check that TestMessage3 didnt sneak into the log */
+ /* double check that TestMessage3 didn't sneak into the log */
nextMessage = 0;
for (i = 0; i < count; i++) {
if (strstr(messageLog+nextMessage, TestMessage3) != NULL) {
diff --git a/tests/spec/khr_texture_compression_astc/khr_compressed_astc-miptree.c b/tests/spec/khr_texture_compression_astc/khr_compressed_astc-miptree.c
index 2fdfb28ca..a5d61ac3f 100644
--- a/tests/spec/khr_texture_compression_astc/khr_compressed_astc-miptree.c
+++ b/tests/spec/khr_texture_compression_astc/khr_compressed_astc-miptree.c
@@ -277,7 +277,7 @@ test_miptrees(void* input_type)
int block_dims;
if (is_srgb_test)
- /* Loosen up the tolerence for sRGB tests. This will allow testing
+ /* Loosen up the tolerance for sRGB tests. This will allow testing
* sRGB formats which have known precision issues in void extent
* blocks. See khronos bug#11294 for details.
*/
diff --git a/tests/spec/khr_texture_compression_astc/khr_compressed_astc-sliced-3d-miptree.c b/tests/spec/khr_texture_compression_astc/khr_compressed_astc-sliced-3d-miptree.c
index 3926db785..d8f7caec7 100644
--- a/tests/spec/khr_texture_compression_astc/khr_compressed_astc-sliced-3d-miptree.c
+++ b/tests/spec/khr_texture_compression_astc/khr_compressed_astc-sliced-3d-miptree.c
@@ -266,7 +266,7 @@ test_miptrees(void* input_type)
"GL_KHR_texture_compression_astc_sliced_3d");
if (is_srgb_test)
- /* Loosen up the tolerence for sRGB tests. This will allow testing
+ /* Loosen up the tolerance for sRGB tests. This will allow testing
* sRGB formats which have known precision issues in void extent
* blocks. See khronos bug#11294 for details.
*/
diff --git a/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-ldexp.shader_test b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-ldexp.shader_test
index 3e6e69260..dededed5c 100644
--- a/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-ldexp.shader_test
+++ b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/fs-ldexp.shader_test
@@ -65,11 +65,6 @@ uniform ivec4 given_exponent 125 125 -128 -128
draw rect -1 -1 2 2
probe all rgba 0.0 1.0 0.0 1.0
-# Test underflow generates zero with sign of x.
-uniform vec4 expected_float 0.0 -0.0 0.0 -0.0
-uniform vec4 given_float 0.0 -0.0 0.5 -0.5
-uniform ivec4 given_exponent -127 -127 -127 -127
-draw rect -1 -1 2 2
-probe all rgba 0.0 1.0 0.0 1.0
+# Underflow may flush to zero or not, so can't test that with this shader.
# Overflow is undefined according to the GLSL spec, so nothing to test.
diff --git a/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-ldexp.shader_test b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-ldexp.shader_test
index c01891cb7..c010ffb75 100644
--- a/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-ldexp.shader_test
+++ b/tests/spec/mesa_shader_integer_functions/execution/built-in-functions/vs-ldexp.shader_test
@@ -75,11 +75,6 @@ uniform ivec4 given_exponent 125 125 -128 -128
draw rect -1 -1 2 2
probe all rgba 0.0 1.0 0.0 1.0
-# Test underflow generates zero with sign of x.
-uniform vec4 expected_float 0.0 -0.0 0.0 -0.0
-uniform vec4 given_float 0.0 -0.0 0.5 -0.5
-uniform ivec4 given_exponent -127 -127 -127 -127
-draw rect -1 -1 2 2
-probe all rgba 0.0 1.0 0.0 1.0
+# Underflow may flush to zero or not, so can't test that with this shader.
# Overflow is undefined according to the GLSL spec, so nothing to test.
diff --git a/tests/spec/nv_conditional_render/begin-while-active.c b/tests/spec/nv_conditional_render/begin-while-active.c
index f80409a5d..6644dc9d7 100644
--- a/tests/spec/nv_conditional_render/begin-while-active.c
+++ b/tests/spec/nv_conditional_render/begin-while-active.c
@@ -36,7 +36,7 @@
* an <id> of zero, if the active query object name for <target>
* is non-zero, if <id> is the active query object name for any
* query type, or if <id> is the active query object for
- * condtional rendering (Section 2.X), the error INVALID
+ * conditional rendering (Section 2.X), the error INVALID
* OPERATION is generated."
*/
diff --git a/tests/spec/nv_copy_image/formats.c b/tests/spec/nv_copy_image/formats.c
index dbee0d9f4..351083c14 100644
--- a/tests/spec/nv_copy_image/formats.c
+++ b/tests/spec/nv_copy_image/formats.c
@@ -328,7 +328,7 @@ piglit_init(int argc, char **argv)
if (src_format_arg) {
/* Since we know the source format, we know the number of
- * bits per texel, so we can restrict the ammount of random
+ * bits per texel, so we can restrict the amount of random
* data we generate.
*/
Bpp = src_format_arg->bytes;
@@ -456,7 +456,7 @@ setup_test_data(const struct texture_format *src_format,
for (j = 0; j < samples; ++j) {
src_image = src_data + (j * image_size);
res_image = res_data + (j * image_size);
- /* Copy the center TEX_SIZE/2 x TEX_SIZE/2 pixels froms
+ /* Copy the center TEX_SIZE/2 x TEX_SIZE/2 pixels forms
* src_data to res_data
*/
memcpy_rect(src_image, stride, TEX_SIZE/4, TEX_SIZE/4,
diff --git a/tests/spec/nv_copy_image/simple.c b/tests/spec/nv_copy_image/simple.c
index c5ca72968..7afd191b2 100644
--- a/tests/spec/nv_copy_image/simple.c
+++ b/tests/spec/nv_copy_image/simple.c
@@ -41,7 +41,10 @@ PIGLIT_GL_TEST_CONFIG_BEGIN
PIGLIT_GL_TEST_CONFIG_END
-static const float green[3] = {0.0, 1.0, 0.0};
+/* Note that the act of clearing and copying with the red and reddish colors
+ * helps to demonstrate bugs on some drivers.
+ */
+static const float red[3] = {1.0, 0.0, 0.0};
static const float reddish[3] = {0.5, 0.0, 0.0};
static const float blue[3] = {0.0, 0.0, 1.0};
@@ -157,7 +160,7 @@ piglit_display(void)
image_init(&images[0], images[0].target, GL_RGB);
image_init(&images[1], images[1].target, GL_RGB);
- image_fill(&images[0], green);
+ image_fill(&images[0], red);
image_fill(&images[1], reddish);
glCopyImageSubDataNV(images[0].name, images[0].target, 0, 0, 0, 0,
@@ -165,9 +168,9 @@ piglit_display(void)
32, 32, 1);
pass &= piglit_check_gl_error(GL_NO_ERROR);
- /* We should now have a green square on red */
+ /* We should now have a bright red square on a darker one */
glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, images[1].fbo);
- pass &= piglit_probe_rect_rgb(17, 11, 32, 32, green);
+ pass &= piglit_probe_rect_rgb(17, 11, 32, 32, red);
pass &= piglit_probe_rect_rgb(0, 0, 64, 11, reddish);
pass &= piglit_probe_rect_rgb(0, 11, 17, 32, reddish);
pass &= piglit_probe_rect_rgb(49, 11, 15, 32, reddish);
@@ -182,9 +185,9 @@ piglit_display(void)
32, 32, 1);
pass &= piglit_check_gl_error(GL_NO_ERROR);
- /* This should be a green square on blue (no red!) */
+ /* This should be a red square on blue */
glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, images[0].fbo);
- pass &= piglit_probe_rect_rgb(0, 32, 32, 32, green);
+ pass &= piglit_probe_rect_rgb(0, 32, 32, 32, red);
pass &= piglit_probe_rect_rgb(0, 0, 64, 32, blue);
pass &= piglit_probe_rect_rgb(32, 32, 32, 32, blue);
@@ -193,11 +196,11 @@ piglit_display(void)
32, 32, 1);
pass &= piglit_check_gl_error(GL_NO_ERROR);
- /* This should be a blue/green checkerboard */
+ /* This should be a blue/red checkerboard */
glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, images[0].fbo);
pass &= piglit_probe_rect_rgb(0, 0, 32, 32, blue);
- pass &= piglit_probe_rect_rgb(0, 32, 32, 32, green);
- pass &= piglit_probe_rect_rgb(32, 0, 32, 32, green);
+ pass &= piglit_probe_rect_rgb(0, 32, 32, 32, red);
+ pass &= piglit_probe_rect_rgb(32, 0, 32, 32, red);
pass &= piglit_probe_rect_rgb(32, 32, 32, 32, blue);
if (!piglit_automatic) {
diff --git a/tests/spec/nv_texture_env_combine4/combine.c b/tests/spec/nv_texture_env_combine4/combine.c
index 0f2fdbd0c..9a5c03fc7 100644
--- a/tests/spec/nv_texture_env_combine4/combine.c
+++ b/tests/spec/nv_texture_env_combine4/combine.c
@@ -27,7 +27,7 @@
/**
* @file combine.c: Test GL_NV_texture_env_combine4
- * Author: Brian Paul (brianp@valinux.com) Januar 2009
+ * Author: Brian Paul (brianp@valinux.com) January 2009
*
* Generate some random combiner state and colors, compute the expected
* color, then render with the combiner state and compare the results.
diff --git a/tests/spec/oes_texture_compression_astc/oes_compressed_astc-miptree-3d.c b/tests/spec/oes_texture_compression_astc/oes_compressed_astc-miptree-3d.c
index 84e661135..8b3750918 100644
--- a/tests/spec/oes_texture_compression_astc/oes_compressed_astc-miptree-3d.c
+++ b/tests/spec/oes_texture_compression_astc/oes_compressed_astc-miptree-3d.c
@@ -248,7 +248,7 @@ test_miptrees(void* input_type)
int block_dims = 0, slice;;
if (is_srgb_test)
- /* Loosen up the tolerence for sRGB tests. This will allow testing
+ /* Loosen up the tolerance for sRGB tests. This will allow testing
* sRGB formats which have known precision issues in void extent
* blocks. See khronos bug#11294 for details.
*/
diff --git a/tests/spec/oes_viewport_array/viewport-gs-writes-out-of-range.shader_test b/tests/spec/oes_viewport_array/viewport-gs-writes-out-of-range.shader_test
deleted file mode 100644
index ea00b3f94..000000000
--- a/tests/spec/oes_viewport_array/viewport-gs-writes-out-of-range.shader_test
+++ /dev/null
@@ -1,71 +0,0 @@
-[require]
-GL ES >= 3.1
-GLSL ES >= 3.10
-GL_OES_geometry_shader
-GL_OES_viewport_array
-
-#
-# Ensure that the fragment stage reads the same value for gl_ViewportIndex as was
-# written by the geometry stage.
-#
-# This test covers the case where the value written is out of range.
-#
-
-[vertex shader passthrough]
-
-[geometry shader]
-#version 310 es
-#extension GL_OES_geometry_shader: require
-#extension GL_OES_viewport_array: require
-
-layout(triangles) in;
-layout(triangle_strip, max_vertices=9) out;
-
-const int vps[] = int[]( -1, 16, 2048 );
-flat out int vp_written;
-
-void main()
-{
- for (int vp = 0; vp < vps.length(); vp++) {
-
- for (int i = 0; i < 3; i++) {
- gl_Position = gl_in[i].gl_Position;
- vp_written = vps[vp];
- gl_ViewportIndex = vps[vp];
- EmitVertex();
- }
-
- EndPrimitive();
- }
-}
-
-[fragment shader]
-#version 310 es
-#extension GL_OES_viewport_array: require
-precision highp int;
-precision highp float;
-
-flat in int vp_written;
-
-layout(binding = 0) uniform atomic_uint mismatches;
-
-out vec4 color;
-
-void main()
-{
- if (vp_written != gl_ViewportIndex)
- atomicCounterIncrement(mismatches);
-
- color = vec4(0);
-}
-
-[test]
-texture junk 2DArray 0 ( 64 , 64 , 1 )
-fb tex layered 0
-
-atomic counters 1
-
-
-draw rect -1 -1 2 2
-
-probe atomic counter 0 == 0
diff --git a/tests/texturing/CMakeLists.gl.txt b/tests/texturing/CMakeLists.gl.txt
index 02b572c79..c56eeaf46 100644
--- a/tests/texturing/CMakeLists.gl.txt
+++ b/tests/texturing/CMakeLists.gl.txt
@@ -77,6 +77,7 @@ piglit_add_executable (texdepth texdepth.c)
piglit_add_executable (teximage-errors teximage-errors.c)
piglit_add_executable (texrect-many texrect-many.c)
piglit_add_executable (texredefine texredefine.c)
+piglit_add_executable (texsubimage-sync texsubimage-sync.c)
piglit_add_executable (texture-packed-formats texture-packed-formats.c)
piglit_add_executable (texwrap texwrap.c)
piglit_add_executable (depth-tex-modes depth-tex-modes.c depth-tex-modes-common.c)
diff --git a/tests/texturing/compressedteximage.c b/tests/texturing/compressedteximage.c
index 45ae695b2..47328634b 100644
--- a/tests/texturing/compressedteximage.c
+++ b/tests/texturing/compressedteximage.c
@@ -117,8 +117,9 @@ display_mipmaps(int x, int y)
int i;
glEnable(GL_TEXTURE_2D);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_NEAREST);
- /* Disply all the mipmap levels */
+ /* Display all the mipmap levels */
for (i = SIZE; i > 0; i /= 2) {
piglit_draw_rect_tex(x, y, i, i,
0, 0, 1, 1);
diff --git a/tests/texturing/copyteximage.c b/tests/texturing/copyteximage.c
index 3e8d81e4a..b12e936f7 100644
--- a/tests/texturing/copyteximage.c
+++ b/tests/texturing/copyteximage.c
@@ -396,7 +396,7 @@ test_target_and_format(GLint x, GLint y, GLenum target, GLenum format,
}
/* To avoid failures not related to this test case,
- * loosen up the tolerence for compressed texture
+ * loosen up the tolerance for compressed texture
* formats
*/
if (is_compressed_format(format))
@@ -544,7 +544,7 @@ test_target_and_format(GLint x, GLint y, GLenum target, GLenum format,
break;
}
- /* If a GLSL program is in use, then the preceeding code should not
+ /* If a GLSL program is in use, then the preceding code should not
* have called glEnable(target). In that case, this code should not
* disable it. For some targets, like GL_TEXTURE_1D_ARRAY,
* glDisable(target) will generate an error.
diff --git a/tests/texturing/fxt1-teximage.c b/tests/texturing/fxt1-teximage.c
index 6a09e036a..e6e636146 100644
--- a/tests/texturing/fxt1-teximage.c
+++ b/tests/texturing/fxt1-teximage.c
@@ -59,7 +59,7 @@ display_mipmaps(int start_x, int start_y)
glEnable(GL_TEXTURE_2D);
- /* Disply all the mipmap levels */
+ /* Display all the mipmap levels */
for (i = SIZE; i > 0; i /= 2) {
glBegin(GL_QUADS);
glTexCoord2f(0.0, 0.0); glVertex2f(start_x + 0, start_y + 0);
diff --git a/tests/texturing/gen-compressed-teximage.c b/tests/texturing/gen-compressed-teximage.c
index ec307e30c..2bee9da22 100644
--- a/tests/texturing/gen-compressed-teximage.c
+++ b/tests/texturing/gen-compressed-teximage.c
@@ -55,7 +55,7 @@ static void display_mipmaps(int start_x, int start_y)
{
int i;
- /* Disply all the mipmap levels */
+ /* Display all the mipmap levels */
for (i = SIZE; i > 0; i /= 2) {
glBegin(GL_QUADS);
glTexCoord2f(0.0, 0.0); glVertex2f(start_x + 0, start_y + 0);
diff --git a/tests/texturing/gen-nonzero-unit.c b/tests/texturing/gen-nonzero-unit.c
index cfb017a9a..db69c3f78 100644
--- a/tests/texturing/gen-nonzero-unit.c
+++ b/tests/texturing/gen-nonzero-unit.c
@@ -60,7 +60,7 @@ static void display_mipmaps(int start_x, int start_y)
{
int i;
- /* Disply all the mipmap levels */
+ /* Display all the mipmap levels */
for (i = SIZE; i > 0; i /= 2) {
glBegin(GL_QUADS);
glTexCoord2f(0.0, 0.0); glVertex2f(start_x + 0, start_y + 0);
diff --git a/tests/texturing/gen-teximage.c b/tests/texturing/gen-teximage.c
index 996681f34..d5a77ec5b 100644
--- a/tests/texturing/gen-teximage.c
+++ b/tests/texturing/gen-teximage.c
@@ -55,7 +55,7 @@ static void display_mipmaps(int start_x, int start_y)
{
int i;
- /* Disply all the mipmap levels */
+ /* Display all the mipmap levels */
for (i = SIZE; i > 0; i /= 2) {
glBegin(GL_QUADS);
glTexCoord2f(0.0, 0.0); glVertex2f(start_x + 0, start_y + 0);
diff --git a/tests/texturing/gen-texsubimage.c b/tests/texturing/gen-texsubimage.c
index facf83e63..b9528e0d9 100644
--- a/tests/texturing/gen-texsubimage.c
+++ b/tests/texturing/gen-texsubimage.c
@@ -50,7 +50,7 @@ static void display_mipmaps(int start_x, int start_y)
{
int i;
- /* Disply all the mipmap levels */
+ /* Display all the mipmap levels */
for (i = 256; i > 0; i /= 2) {
glBegin(GL_QUADS);
glTexCoord2f(0.0, 0.0); glVertex2f(start_x + 0, start_y + 0);
diff --git a/tests/texturing/getteximage-targets.c b/tests/texturing/getteximage-targets.c
index 88bc70296..ea3f195c1 100644
--- a/tests/texturing/getteximage-targets.c
+++ b/tests/texturing/getteximage-targets.c
@@ -59,7 +59,7 @@ init_layer_data(GLubyte *layer_data, int num_layers)
int b = (z + 1) * 255 / (num_layers - 1);
int a = x ^ y ^ z;
- /* each 4x4 block constains only one color (for S3TC) */
+ /* each 4x4 block contains only one color (for S3TC) */
for (i = 0; i < 4; i++) {
for (j = 0; j < 4; j++) {
data[((y + j) * IMAGE_WIDTH + x
diff --git a/tests/texturing/rg-teximage-common.c b/tests/texturing/rg-teximage-common.c
index 8efa2b5fd..fadb75d47 100644
--- a/tests/texturing/rg-teximage-common.c
+++ b/tests/texturing/rg-teximage-common.c
@@ -27,7 +27,7 @@
*
* Specify an RGBA image with a RED internal format. Read the image back as
* RGBA. Verify the red components read back match the source image and the
- * green, blue, and alpha components are 0, 0, and 1, repsectively.
+ * green, blue, and alpha components are 0, 0, and 1, respectively.
*
* \author Ian Romanick <ian.d.romanick@intel.com>
*/
diff --git a/tests/texturing/s3tc-errors.c b/tests/texturing/s3tc-errors.c
index a356ea214..6c87a7991 100644
--- a/tests/texturing/s3tc-errors.c
+++ b/tests/texturing/s3tc-errors.c
@@ -404,7 +404,7 @@ test_format(int width, int height, GLfloat *image, GLenum requested_format)
pass = piglit_check_gl_error(GL_INVALID_OPERATION) && pass;
- /* Try CompressedTexImage of size zero - should not be an erorr */
+ /* Try CompressedTexImage of size zero - should not be an error */
w = 0;
h = 0;
glCompressedTexImage2D(GL_TEXTURE_2D, 0, format, w, h, 0,
diff --git a/tests/texturing/s3tc-teximage.c b/tests/texturing/s3tc-teximage.c
index 1b65f6ce1..91101b63b 100644
--- a/tests/texturing/s3tc-teximage.c
+++ b/tests/texturing/s3tc-teximage.c
@@ -96,7 +96,7 @@ display_mipmaps(int start_x, int start_y)
glEnable(GL_TEXTURE_2D);
#endif
- /* Disply all the mipmap levels */
+ /* Display all the mipmap levels */
for (i = SIZE; i > 0; i /= 2) {
piglit_draw_rect_tex(start_x, start_y, i, i,
0.0f, 0.0f, 1.0f, 1.0f);
diff --git a/tests/texturing/s3tc-texsubimage.c b/tests/texturing/s3tc-texsubimage.c
index 7f05b1080..3150b02c2 100644
--- a/tests/texturing/s3tc-texsubimage.c
+++ b/tests/texturing/s3tc-texsubimage.c
@@ -96,7 +96,7 @@ display_mipmaps(int start_x, int start_y)
glEnable(GL_TEXTURE_2D);
#endif
- /* Disply all the mipmap levels */
+ /* Display all the mipmap levels */
for (i = SIZE; i > 0; i /= 2) {
piglit_draw_rect_tex(start_x, start_y, i, i,
0.0f, 0.0f, 1.0f, 1.0f);
diff --git a/tests/texturing/shaders/texelFetch.c b/tests/texturing/shaders/texelFetch.c
index 2495005ee..c0b5a02f1 100644
--- a/tests/texturing/shaders/texelFetch.c
+++ b/tests/texturing/shaders/texelFetch.c
@@ -40,7 +40,7 @@
* - Non-power-of-two textures
*
* Draws a series of "rectangles" which display each miplevel and array slice,
- * at full size. They are layed out as follows:
+ * at full size. They are laid out as follows:
*
* miplevel 3 + + + + +
*
diff --git a/tests/texturing/shaders/textureGather.c b/tests/texturing/shaders/textureGather.c
index fc1bd9f3c..18ac96261 100644
--- a/tests/texturing/shaders/textureGather.c
+++ b/tests/texturing/shaders/textureGather.c
@@ -315,7 +315,7 @@ do_requires(void)
}
/* if we are trying to specify the component from the shader,
- * or use non-constant offsets, or use shadow comparitor, or
+ * or use non-constant offsets, or use shadow comparator, or
* use gsampler2DRect, check that we have ARB_gpu_shader5
*/
if (comp_select != -1 || use_offsets || use_nonconst || comptype == SHADOW_T || sampler == SAMPLER_2DRECT)
diff --git a/tests/texturing/tex3d-npot.c b/tests/texturing/tex3d-npot.c
index e62b5766d..da16bff0d 100644
--- a/tests/texturing/tex3d-npot.c
+++ b/tests/texturing/tex3d-npot.c
@@ -82,7 +82,6 @@ render_and_check(int w, int h, int d, GLenum format, float q,
int layer;
GLubyte *readback;
const GLubyte *texp;
- GLubyte *readp;
int ncomp = 0;
glClearColor(0.0, 0.0, 0.0, 0.0);
@@ -109,22 +108,16 @@ render_and_check(int w, int h, int d, GLenum format, float q,
}
}
- readback = (unsigned char*)malloc(w*h*d*4);
- x = y = 0;
- for(layer = 0; layer < d; ++layer) {
- glReadPixels(x, y, w, h, GL_RGBA, GL_UNSIGNED_BYTE, readback+layer*w*h*4);
- x += w;
- if (x+w >= piglit_width) {
- y += h;
- x = 0;
- }
- }
+ /* Read back the bounding box of the screen we drew to in a single readpixels */
+ readback = (unsigned char*)malloc(piglit_width * (y + h) * 4);
+ glReadPixels(0, 0, piglit_width, y + h, GL_RGBA, GL_UNSIGNED_BYTE, readback);
texp = data;
- readp = readback;
ncomp = nrcomponents(format);
+ int screen_x = 0, screen_y = 0;
for(z = 0; z < d; ++z) {
for(y = 0; y < h; ++y) {
+ GLubyte *readp = readback + ((screen_y + y) * piglit_width + screen_x) * 4;
for(x = 0; x < w; ++x, readp += 4, texp += ncomp) {
unsigned char expected[4];
int i;
@@ -142,6 +135,12 @@ render_and_check(int w, int h, int d, GLenum format, float q,
}
}
}
+
+ screen_x += w;
+ if (screen_x + w >= piglit_width) {
+ screen_y += h;
+ screen_x = 0;
+ }
}
free(readback);
diff --git a/tests/texturing/texdepth.c b/tests/texturing/texdepth.c
index fc4be15a3..0f59926f0 100644
--- a/tests/texturing/texdepth.c
+++ b/tests/texturing/texdepth.c
@@ -305,13 +305,13 @@ static struct test_step Tests[] = {
{ test_AmbientShadow, GL_GEQUAL, "Ambient + ARB_shadow: GL_GEQUAL" },
{ test_AmbientShadow, GL_GREATER, "Ambient + EXT_shadow_func: GL_GREATER" },
{ test_AmbientShadow, GL_ALWAYS, "Ambient + EXT_shadow_func: GL_ALWAYS" },
- { test_Homogenous, GL_NEVER, "homogenous: GL_NEVER" },
- { test_Homogenous, GL_LESS, "homogenous: GL_LESS" },
- { test_Homogenous, GL_LEQUAL, "homogenous: GL_LEQUAL" },
+ { test_Homogenous, GL_NEVER, "homogeneous: GL_NEVER" },
+ { test_Homogenous, GL_LESS, "homogeneous: GL_LESS" },
+ { test_Homogenous, GL_LEQUAL, "homogeneous: GL_LEQUAL" },
/* don't test GL_EQUAL and GL_NOTEQUAL: they're bound to be unreliable due to precision problems */
- { test_Homogenous, GL_GEQUAL, "homogenous: GL_GEQUAL" },
- { test_Homogenous, GL_GREATER, "homogenous: GL_GREATER" },
- { test_Homogenous, GL_ALWAYS, "homogenous: GL_ALWAYS" },
+ { test_Homogenous, GL_GEQUAL, "homogeneous: GL_GEQUAL" },
+ { test_Homogenous, GL_GREATER, "homogeneous: GL_GREATER" },
+ { test_Homogenous, GL_ALWAYS, "homogeneous: GL_ALWAYS" },
};
#define NumTests (ARRAY_SIZE(Tests))
diff --git a/tests/texturing/teximage-colors.c b/tests/texturing/teximage-colors.c
index 1b2794785..cfa8f124e 100644
--- a/tests/texturing/teximage-colors.c
+++ b/tests/texturing/teximage-colors.c
@@ -588,8 +588,8 @@ piglit_init(int argc, char **argv)
tolerance[3] = 0.1;
break;
case GL_LUMINANCE6_ALPHA2: /* broken but everybody uses 8+8 bits */
- case GL_LUMINANCE4: /* broken but presumably noone uses just 4 bits */
- case GL_ALPHA4: /* broken but presumably noone uses just 4 bits */
+ case GL_LUMINANCE4: /* broken but presumably no one uses just 4 bits */
+ case GL_ALPHA4: /* broken but presumably no one uses just 4 bits */
case GL_RGBA2: /* broken (4444) but everybody uses more bits anyway */
default:
break;
@@ -863,10 +863,10 @@ test_exact()
int j;
for (j = 0; j < texture_size; ++j) {
for (i = 0; i < tex_width * channels; i++) {
- GLshort datas = ((GLshort *)data)[i];
+ GLshort data_s = ((GLshort *)data)[i];
GLshort obss = ((GLshort *)observed)[i];
- if (!(datas == obss ||
- (datas == -32768 && obss == -32767))) {
+ if (!(data_s == obss ||
+ (data_s == -32768 && obss == -32767))) {
pass = GL_FALSE;
}
}
diff --git a/tests/texturing/texsubimage-sync.c b/tests/texturing/texsubimage-sync.c
new file mode 100644
index 000000000..3bff88503
--- /dev/null
+++ b/tests/texturing/texsubimage-sync.c
@@ -0,0 +1,102 @@
+/*
+ * Copyright © 2024 Collabora Ltd
+ * SPDX-License-Identifier: MIT
+ *
+ * Test for clear before render in texture preparation
+ * If the texture is small and we use memcpy in
+ * TexSubImage2D then that can complete before the clear,
+ * which means that if the driver doesn't synchronize the
+ * GPU and CPU properly the clear can overwrite the texture data.
+ */
+
+#include "piglit-util-gl.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+ config.supports_gl_compat_version = 30;
+
+ config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGBA;
+ config.khr_no_error_support = PIGLIT_NO_ERRORS;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+static GLuint
+create_texture(GLsizei w, GLsizei h)
+{
+ GLuint tex, fbo;
+ GLint i;
+ static GLfloat red[] = { 1.0, 0, 0, 1.0 };
+
+ /* prepare a blob filled with green and max alpha */
+ GLubyte *colorblob = calloc(4, w * h);
+ for (i = 1; i < w*h*4; i += 2) {
+ colorblob[i] = 0xff;
+ }
+
+ /* get a framebuffer for the texture */
+ glGenFramebuffers(1, &fbo);
+ glBindFramebuffer(GL_FRAMEBUFFER, fbo);
+
+ /* create texture */
+ glGenTextures(1, &tex);
+ glBindTexture(GL_TEXTURE_2D, tex);
+ glTexStorage2D(GL_TEXTURE_2D, 1, GL_RGBA8, w, h);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+
+ /* use ClearBuffer to fill with red (likely on the GPU) */
+ glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, tex, 0);
+ glClearBufferfv(GL_COLOR, 0, red);
+ glBindFramebuffer(GL_FRAMEBUFFER, 0);
+ glDeleteFramebuffers(1, &fbo);
+
+ /* now fill with green via TexSubImage2D (possibly on the CPU) */
+ glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, w, h, GL_RGBA, GL_UNSIGNED_BYTE, colorblob);
+ glBindTexture(GL_TEXTURE_2D, 0);
+
+ free(colorblob);
+
+ return tex;
+}
+
+enum piglit_result
+piglit_display(void)
+{
+ static const GLfloat green[3] = {0.0, 1.0, 0.0};
+ GLboolean pass = GL_TRUE;
+ GLuint tex;
+
+ /* clear frame buffer */
+ glClearColor(0.0, 0.0, 0.0, 0.0);
+ glClear(GL_COLOR_BUFFER_BIT);
+
+ /* create a small texture */
+ tex = create_texture(4, 4);
+
+ /* draw with it */
+ glBindTexture(GL_TEXTURE_2D, tex);
+ glEnable(GL_TEXTURE_2D);
+ piglit_draw_rect_tex(0, 0, piglit_width, piglit_height, 0, 0, 1, 1);
+
+ /* check for expected values */
+ pass = pass && piglit_probe_rect_rgb(0, 0, piglit_width, piglit_height, green);
+
+ /* show on screen */
+ piglit_present_results();
+ return pass ? PIGLIT_PASS : PIGLIT_FAIL;
+}
+
+void
+piglit_init(int argc, char **argv)
+{
+ glDisable(GL_DITHER);
+
+ glMatrixMode( GL_PROJECTION );
+ glPushMatrix();
+ glLoadIdentity();
+ glOrtho( 0, piglit_width, 0, piglit_height, -1, 1 );
+
+ glMatrixMode( GL_MODELVIEW );
+ glPushMatrix();
+ glLoadIdentity();
+}
diff --git a/tests/texturing/texsubimage.c b/tests/texturing/texsubimage.c
index b00b2dcd7..ce8ff89be 100644
--- a/tests/texturing/texsubimage.c
+++ b/tests/texturing/texsubimage.c
@@ -90,6 +90,18 @@ static const struct test_desc texsubimage_test_sets[] = {
"GL_EXT_texture_compression_latc",
GL_UNSIGNED_NORMALIZED,
{"GL_EXT_texture_compression_latc"}
+ }, {
+ arb_texture_compression_bptc_unorm,
+ ARRAY_SIZE(arb_texture_compression_bptc_unorm),
+ "GL_ARB_texture_compression_bptc-unorm",
+ GL_UNSIGNED_NORMALIZED,
+ {"GL_ARB_texture_compression_bptc"}
+ }, {
+ arb_texture_compression_bptc_float,
+ ARRAY_SIZE(arb_texture_compression_bptc_float),
+ "GL_ARB_texture_compression_bptc-float",
+ GL_FLOAT,
+ {"GL_ARB_texture_compression_bptc"}
}
};
diff --git a/tests/util/config.h.in b/tests/util/config.h.in
index 8ed5af170..437eb9141 100644
--- a/tests/util/config.h.in
+++ b/tests/util/config.h.in
@@ -16,3 +16,4 @@
#cmakedefine HAVE_SYS_RESOURCE_H 1
#cmakedefine HAVE_UNISTD_H 1
#cmakedefine HAVE_ENDIAN_H 1
+#cmakedefine HAVE_LIBGEN_H 1
diff --git a/tests/util/minmax-test.c b/tests/util/minmax-test.c
index ae9a0f98a..8e3aa4d29 100644
--- a/tests/util/minmax-test.c
+++ b/tests/util/minmax-test.c
@@ -278,7 +278,7 @@ void piglit_test_max_float(GLenum token, GLfloat max)
piglit_test_float(token, max, true);
}
-/** Tests tha the range referneced by the token covers at least low-high. */
+/** Tests that the range referenced by the token covers at least low-high. */
void piglit_test_range_float(GLenum token, GLfloat low, GLfloat high)
{
const char *name = piglit_get_gl_enum_name(token);
diff --git a/tests/util/piglit-dispatch.c b/tests/util/piglit-dispatch.c
index 90a6dba27..f600961f0 100644
--- a/tests/util/piglit-dispatch.c
+++ b/tests/util/piglit-dispatch.c
@@ -212,7 +212,7 @@ static int compare_function_names(const void *x, const void *y)
* regardless of whether desktop GL or GLES is in use.
*
* - Synonymous function names (e.g. glMapBuffer and glMapBufferARB)
- * may be used interchangably; the correct function is automatically
+ * may be used interchangeably; the correct function is automatically
* chosen based on the GL version and extension string.
*
* - If the requested function is not supported by the implementation,
diff --git a/tests/util/piglit-fbo.cpp b/tests/util/piglit-fbo.cpp
index df403d717..d21cdeb6a 100644
--- a/tests/util/piglit-fbo.cpp
+++ b/tests/util/piglit-fbo.cpp
@@ -26,7 +26,7 @@
*
* This file defines the functions which can be utilized to develop
* new piglit test cases. These functions initialize a framebuffer
- * object based on paramaters passed.
+ * object based on parameters passed.
*/
#include "piglit-fbo.h"
using namespace piglit_util_fbo;
diff --git a/tests/util/piglit-framework-cl-api.h b/tests/util/piglit-framework-cl-api.h
index c94e5f031..fe4257b51 100644
--- a/tests/util/piglit-framework-cl-api.h
+++ b/tests/util/piglit-framework-cl-api.h
@@ -87,7 +87,7 @@ piglit_cl_test_run_t piglit_cl_api_test_run;
* This macro must be used to create an API test configuration
* instance and must be followed by \c PIGLIT_CL_TEST_API_CONFIG_END macro.
*
- * In beetween \c PIGLIT_CL_API_TEST_CONFIG_BEGIN and
+ * In between \c PIGLIT_CL_API_TEST_CONFIG_BEGIN and
* \c PIGLIT_CL_API_TEST_CONFIG_END macros you can set the test
* configuration values.
*
diff --git a/tests/util/piglit-framework-cl-custom.h b/tests/util/piglit-framework-cl-custom.h
index d6b2b38c1..18e275ec8 100644
--- a/tests/util/piglit-framework-cl-custom.h
+++ b/tests/util/piglit-framework-cl-custom.h
@@ -73,7 +73,7 @@ piglit_cl_test_run_t piglit_cl_custom_test_run;
* This macro must be used to create an CUSTOM test configuration
* instance and must be followed by \c PIGLIT_CL_TEST_CUSTOM_CONFIG_END macro.
*
- * In beetween \c PIGLIT_CL_CUSTOM_TEST_CONFIG_BEGIN and
+ * In between \c PIGLIT_CL_CUSTOM_TEST_CONFIG_BEGIN and
* \c PIGLIT_CL_CUSTOM_TEST_CONFIG_END macros you can set the test
* configuration values.
*
diff --git a/tests/util/piglit-framework-cl-program.h b/tests/util/piglit-framework-cl-program.h
index 98d321acc..fd06ca68f 100644
--- a/tests/util/piglit-framework-cl-program.h
+++ b/tests/util/piglit-framework-cl-program.h
@@ -103,7 +103,7 @@ piglit_cl_test_run_t piglit_cl_program_test_run;
* This macro must be used to create a PROGRAM test configuration
* instance and must be followed by \c PIGLIT_CL_TEST_PROGRAM_CONFIG_END macro.
*
- * In beetween \c PIGLIT_CL_PROGRAM_TEST_CONFIG_BEGIN and
+ * In between \c PIGLIT_CL_PROGRAM_TEST_CONFIG_BEGIN and
* \c PIGLIT_CL_PROGRAM_TEST_CONFIG_END macros you can set the test
* configuration values.
*
diff --git a/tests/util/piglit-framework-cl.h b/tests/util/piglit-framework-cl.h
index f63883cbc..8967627c8 100644
--- a/tests/util/piglit-framework-cl.h
+++ b/tests/util/piglit-framework-cl.h
@@ -149,7 +149,7 @@ piglit_cl_get_test_config(const int argc,
* that is used to retrieve the test configuration, set default
* values to it and implement main function.
*
- * In beetween \c PIGLIT_CL_TEST_CONFIG_BEGIN and
+ * In between \c PIGLIT_CL_TEST_CONFIG_BEGIN and
* \c PIGLIT_CL_TEST_CONFIG_END macros you can set values of fields
* defined in \c test_config_struct_t type.
*
@@ -218,7 +218,7 @@ piglit_cl_get_test_config(const int argc,
* It defines the first part \c test_config_struct_t type with first bytes
* set to \c piglit_cl_text_config_header.
*
- * In beetween \c PIGLIT_CL_DEFINE_TEST_CONFIG_BEGIN and
+ * In between \c PIGLIT_CL_DEFINE_TEST_CONFIG_BEGIN and
* \c PIGLIT_CL_DEFINE_TEST_CONFIG_END macros you can define additional
* fields used by the tests.
*
@@ -352,7 +352,7 @@ piglit_cl_get_device_arg(const int argc,
cl_device_id* device_id);
/**
- * \brief Check if the given local work demensions are supported on this device.
+ * \brief Check if the given local work dimensions are supported on this device.
* @param device_id Device to check
* @param local_work_size Local work dimensions
* @return \c true if the local work dimensions are supported,
diff --git a/tests/util/piglit-framework-gl.c b/tests/util/piglit-framework-gl.c
index f91dfc27d..f1ad0477f 100644
--- a/tests/util/piglit-framework-gl.c
+++ b/tests/util/piglit-framework-gl.c
@@ -224,7 +224,7 @@ piglit_gl_test_run(int argc, char *argv[],
}
atexit(destroy);
- gl_fw->run_test(gl_fw, argc, argv);
+ gl_fw->run_test(&gl_fw, argc, argv);
assert(false);
}
diff --git a/tests/util/piglit-framework-gl.h b/tests/util/piglit-framework-gl.h
index a4ecddbe7..074421574 100644
--- a/tests/util/piglit-framework-gl.h
+++ b/tests/util/piglit-framework-gl.h
@@ -203,7 +203,7 @@ struct piglit_gl_test_config {
/**
* Names of subtests supplied on the command line.
*
- * The paramaters passed to each -subtest command line option is
+ * The parameters passed to each -subtest command line option is
* stored here in the order of appearance on the command line.
*/
const char **selected_subtests;
diff --git a/tests/util/piglit-framework-gl/README.txt b/tests/util/piglit-framework-gl/README.txt
index b7aa15dee..1941f65d7 100644
--- a/tests/util/piglit-framework-gl/README.txt
+++ b/tests/util/piglit-framework-gl/README.txt
@@ -27,7 +27,7 @@ this framework if it is ran without the -fbo argument.
-----------------------
This framework, after creating a window, uses it only for making the GL
-context current and attemtps to prevent it from appearing on the screen. For
+context current and attempts to prevent it from appearing on the screen. For
rendering, it instead creates an FBO and sets it as the read and draw buffer.
If you configure Piglit to build with Waffle, each test will usually attempt
diff --git a/tests/util/piglit-framework-gl/piglit_drm_dma_buf.c b/tests/util/piglit-framework-gl/piglit_drm_dma_buf.c
index 135567f36..3a3135275 100644
--- a/tests/util/piglit-framework-gl/piglit_drm_dma_buf.c
+++ b/tests/util/piglit-framework-gl/piglit_drm_dma_buf.c
@@ -23,7 +23,7 @@
#include "piglit-util-gl.h"
#include "piglit_drm_dma_buf.h"
-#include "drm_fourcc.h"
+#include "drm-uapi/drm_fourcc.h"
#ifdef PIGLIT_HAS_GBM_BO_MAP
#include <gbm.h>
#endif
@@ -132,6 +132,7 @@ piglit_gbm_buf_create(unsigned w, unsigned h, unsigned fourcc,
unsigned cpp = 0, src_stride;
unsigned buf_w = w;
unsigned buf_h = h;
+ unsigned n_planes = 0;
if (!gbm || h % 2 || w % 2)
return false;
@@ -141,14 +142,18 @@ piglit_gbm_buf_create(unsigned w, unsigned h, unsigned fourcc,
format = GBM_FORMAT_R8;
cpp = 1;
src_stride = cpp * w;
+ n_planes = 1;
break;
case DRM_FORMAT_GR88:
case DRM_FORMAT_RG88:
case DRM_FORMAT_YUYV:
+ case DRM_FORMAT_YVYU:
case DRM_FORMAT_UYVY:
+ case DRM_FORMAT_VYUY:
format = GBM_FORMAT_GR88;
cpp = 2;
src_stride = cpp * w;
+ n_planes = 1;
break;
case DRM_FORMAT_XRGB8888:
case DRM_FORMAT_XBGR8888:
@@ -163,11 +168,13 @@ piglit_gbm_buf_create(unsigned w, unsigned h, unsigned fourcc,
format = GBM_BO_FORMAT_ARGB8888;
cpp = 4;
src_stride = cpp * w;
+ n_planes = 1;
break;
case DRM_FORMAT_Y410:
format = GBM_FORMAT_ABGR2101010;
cpp = 4;
src_stride = cpp * w;
+ n_planes = 1;
break;
case DRM_FORMAT_Y412:
case DRM_FORMAT_Y416:
@@ -175,6 +182,7 @@ piglit_gbm_buf_create(unsigned w, unsigned h, unsigned fourcc,
buf_w = w * 2;
cpp = 8;
src_stride = cpp * w;
+ n_planes = 1;
break;
case DRM_FORMAT_Y210:
case DRM_FORMAT_Y212:
@@ -182,6 +190,7 @@ piglit_gbm_buf_create(unsigned w, unsigned h, unsigned fourcc,
format = GBM_BO_FORMAT_ARGB8888;
cpp = 4;
src_stride = cpp * w;
+ n_planes = 1;
break;
/* For YUV formats, the U/V planes might have a greater relative
@@ -196,11 +205,13 @@ piglit_gbm_buf_create(unsigned w, unsigned h, unsigned fourcc,
* for U/V.
*/
case DRM_FORMAT_NV12:
+ case DRM_FORMAT_NV21:
format = GBM_FORMAT_GR88;
buf_w = w / 2;
buf_h = h * 3 / 2;
src_stride = w;
cpp = 1;
+ n_planes = 2;
break;
case DRM_FORMAT_P010:
case DRM_FORMAT_P012:
@@ -209,6 +220,7 @@ piglit_gbm_buf_create(unsigned w, unsigned h, unsigned fourcc,
buf_h = h * 3 / 2;
cpp = 2;
src_stride = cpp * w;
+ n_planes = 2;
break;
case DRM_FORMAT_YUV420:
case DRM_FORMAT_YVU420:
@@ -217,6 +229,7 @@ piglit_gbm_buf_create(unsigned w, unsigned h, unsigned fourcc,
buf_h = h * 2; /* U/V not interleaved */
src_stride = w;
cpp = 1;
+ n_planes = 3;
break;
default:
fprintf(stderr, "invalid fourcc: %.4s\n", (char *)&fourcc);
@@ -238,6 +251,7 @@ piglit_gbm_buf_create(unsigned w, unsigned h, unsigned fourcc,
buf->w = w;
buf->h = h;
+ buf->n_planes = n_planes;
buf->offset[0] = gbm_bo_get_offset(bo, 0);
buf->stride[0] = gbm_bo_get_stride_for_plane(bo, 0);
buf->fd = -1;
@@ -251,6 +265,7 @@ piglit_gbm_buf_create(unsigned w, unsigned h, unsigned fourcc,
switch (fourcc) {
case DRM_FORMAT_NV12:
+ case DRM_FORMAT_NV21:
case DRM_FORMAT_P010:
case DRM_FORMAT_P012:
case DRM_FORMAT_P016:
@@ -396,6 +411,110 @@ piglit_drm_get_driver(void)
return NULL;
}
+static bool
+drm_create_dma_buf_modifiers(unsigned w, unsigned h, unsigned fourcc,
+ uint64_t modifier, const unsigned char *src_data,
+ struct piglit_dma_buf *buf)
+{
+ unsigned i;
+ struct gbm_bo *bo;
+ uint32_t dst_stride;
+ struct gbm_device *gbm = piglit_gbm_get();
+ void *dst_data;
+ void *map_data = NULL;
+ unsigned cpp = 0, src_stride;
+
+ if (!gbm)
+ return false;
+
+ switch (fourcc) {
+ case DRM_FORMAT_R8:
+ cpp = 1;
+ break;
+ case DRM_FORMAT_R16:
+ cpp = 2;
+ break;
+ case DRM_FORMAT_XBGR8888:
+ case DRM_FORMAT_XRGB8888:
+ case DRM_FORMAT_ABGR8888:
+ case DRM_FORMAT_ARGB8888:
+ cpp = 4;
+ break;
+ default:
+ fprintf(stderr, "invalid fourcc: %.4s\n", (char *)&fourcc);
+ return false;
+ }
+
+ bo = gbm_bo_create_with_modifiers(gbm, w, h, fourcc, &modifier, 1);
+ if (!bo)
+ return false;
+
+ dst_data = gbm_bo_map(bo, 0, 0, w, h, GBM_BO_TRANSFER_WRITE,
+ &dst_stride, &map_data);
+ if (!dst_data) {
+ fprintf(stderr, "Failed to map GBM bo\n");
+ gbm_bo_destroy(bo);
+ return false;
+ }
+
+ src_stride = cpp * w;
+
+ buf->w = w;
+ buf->h = h;
+
+ buf->n_planes = gbm_bo_get_plane_count(bo);
+ assert(buf->n_planes <= ARRAY_SIZE(buf->offset));
+ for (int i = 0; i < buf->n_planes; i++) {
+ buf->offset[i] = gbm_bo_get_offset(bo, i);
+ buf->stride[i] = gbm_bo_get_stride_for_plane(bo, i);
+ }
+
+ buf->fd = -1;
+ buf->priv = bo;
+
+ for (i = 0; i < h; ++i) {
+ memcpy((char *)dst_data + i * dst_stride,
+ src_data + i * src_stride,
+ w * cpp);
+ }
+
+ gbm_bo_unmap(bo, map_data);
+
+
+ return true;
+}
+enum piglit_result
+piglit_drm_create_dma_buf_modifiers(unsigned w, unsigned h, unsigned fourcc,
+ uint64_t modifier, const void *src_data,
+ struct piglit_dma_buf **buf)
+{
+ struct piglit_dma_buf *drm_buf;
+ const struct piglit_drm_driver *drv = piglit_drm_get_driver();
+
+ if (!drv)
+ return PIGLIT_SKIP;
+
+ drm_buf = calloc(sizeof(struct piglit_dma_buf), 1);
+ if (!drm_buf)
+ return PIGLIT_FAIL;
+
+ if (!drm_create_dma_buf_modifiers(w, h, fourcc, modifier, src_data,
+ drm_buf)) {
+ free(drm_buf);
+ return PIGLIT_FAIL;
+ }
+
+ if (!drv->export(drm_buf)) {
+ free(drm_buf);
+ return PIGLIT_FAIL;
+ }
+
+ *buf = drm_buf;
+
+ return PIGLIT_PASS;
+}
+
+
enum piglit_result
piglit_drm_create_dma_buf(unsigned w, unsigned h, unsigned fourcc,
const void *src_data, struct piglit_dma_buf **buf)
diff --git a/tests/util/piglit-framework-gl/piglit_drm_dma_buf.h b/tests/util/piglit-framework-gl/piglit_drm_dma_buf.h
index 13c60b808..b0db74f67 100644
--- a/tests/util/piglit-framework-gl/piglit_drm_dma_buf.h
+++ b/tests/util/piglit-framework-gl/piglit_drm_dma_buf.h
@@ -23,11 +23,14 @@
#ifndef PIGLIT_DRM_DMA_BUF_H
#define PIGLIT_DRM_DMA_BUF_H
-#include "drm_fourcc.h"
+#include <stdint.h>
+
+#include "drm-uapi/drm_fourcc.h"
struct piglit_dma_buf {
unsigned w;
unsigned h;
+ unsigned n_planes;
unsigned offset[3];
unsigned stride[3];
int fd;
@@ -37,6 +40,10 @@ struct piglit_dma_buf {
enum piglit_result
piglit_drm_create_dma_buf(unsigned w, unsigned h, unsigned fourcc,
const void *src_data, struct piglit_dma_buf **buf);
+enum piglit_result
+piglit_drm_create_dma_buf_modifiers(unsigned w, unsigned h, unsigned fourcc,
+ uint64_t modifier, const void *src_data,
+ struct piglit_dma_buf **buf);
void
piglit_drm_destroy_dma_buf(struct piglit_dma_buf *buf);
diff --git a/tests/util/piglit-framework-gl/piglit_fbo_framework.c b/tests/util/piglit-framework-gl/piglit_fbo_framework.c
index 706475380..f02985d84 100644
--- a/tests/util/piglit-framework-gl/piglit_fbo_framework.c
+++ b/tests/util/piglit-framework-gl/piglit_fbo_framework.c
@@ -41,15 +41,19 @@ destroy(struct piglit_gl_framework *gl_fw)
}
static void
-run_test(struct piglit_gl_framework *gl_fw,
+run_test(struct piglit_gl_framework **pgl_fw,
int argc, char *argv[])
{
+ assert(pgl_fw);
enum piglit_result result = PIGLIT_PASS;
+ struct piglit_gl_framework *gl_fw = *pgl_fw;
if (gl_fw->test_config->init)
gl_fw->test_config->init(argc, argv);
if (gl_fw->test_config->display)
result = gl_fw->test_config->display();
+ destroy(gl_fw);
+ *pgl_fw = NULL;
piglit_report_result(result);
}
diff --git a/tests/util/piglit-framework-gl/piglit_gl_framework.h b/tests/util/piglit-framework-gl/piglit_gl_framework.h
index aad565e06..be766ee3c 100644
--- a/tests/util/piglit-framework-gl/piglit_gl_framework.h
+++ b/tests/util/piglit-framework-gl/piglit_gl_framework.h
@@ -40,7 +40,7 @@ struct piglit_gl_framework {
* Does not return.
*/
void
- (*run_test)(struct piglit_gl_framework *gl_fw,
+ (*run_test)(struct piglit_gl_framework **pgl_fw,
int argc, char *argv[]);
/**
diff --git a/tests/util/piglit-framework-gl/piglit_glut_framework.c b/tests/util/piglit-framework-gl/piglit_glut_framework.c
index 8ac2f657b..2f4219798 100644
--- a/tests/util/piglit-framework-gl/piglit_glut_framework.c
+++ b/tests/util/piglit-framework-gl/piglit_glut_framework.c
@@ -276,7 +276,7 @@ init_glut(void)
}
static void
-run_test(struct piglit_gl_framework *gl_fw,
+run_test(struct piglit_gl_framework **pgl_fw,
int argc, char *argv[])
{
const struct piglit_gl_test_config *test_config = glut_fw.gl_fw.test_config;
diff --git a/tests/util/piglit-framework-gl/piglit_wfl_framework.c b/tests/util/piglit-framework-gl/piglit_wfl_framework.c
index 6ec172897..272a993eb 100644
--- a/tests/util/piglit-framework-gl/piglit_wfl_framework.c
+++ b/tests/util/piglit-framework-gl/piglit_wfl_framework.c
@@ -477,16 +477,24 @@ make_context_current_singlepass(struct piglit_wfl_framework *wfl_fw,
wfl_fw->config = waffle_config_choose(wfl_fw->display, attrib_list);
free(attrib_list);
if (!wfl_fw->config) {
- wfl_log_error("waffle_config_choose");
- fprintf(stderr, "piglit: error: Failed to create "
+ /* Log this a little more quietly, as we expect this failure for
+ * BAD_MATCH from trying to create (for example) ES1 contexts
+ * when they're unsupported.
+ */
+ wfl_log_error_stdout("waffle_config_choose");
+ fprintf(stdout, "piglit: error: Failed to create "
"waffle_config for %s\n", ctx_desc);
goto fail;
}
wfl_fw->context = waffle_context_create(wfl_fw->config, NULL);
if (!wfl_fw->context) {
- wfl_log_error("waffle_context_create");
- fprintf(stderr, "piglit: error: Failed to create "
+ /* Log this a little more quietly, as we expect this failure for
+ * BAD_MATCH from trying to create unsupported context versions,
+ * and stderr means it gets spammed to deqp-runner stderr.
+ */
+ wfl_log_error_stdout("waffle_context_create");
+ fprintf(stdout, "piglit: error: Failed to create "
"waffle_context for %s\n", ctx_desc);
goto fail;
}
diff --git a/tests/util/piglit-framework-gl/piglit_wgl_framework.c b/tests/util/piglit-framework-gl/piglit_wgl_framework.c
index b583df777..5a7273d79 100644
--- a/tests/util/piglit-framework-gl/piglit_wgl_framework.c
+++ b/tests/util/piglit-framework-gl/piglit_wgl_framework.c
@@ -36,55 +36,53 @@ process_next_event(struct piglit_winsys_framework *winsys_fw)
BOOL bRet;
MSG msg;
- bRet = GetMessage(&msg, NULL, 0, 0);
- /* bRet will be negative on error, zero on WM_QUIT, positive for other messages */
- if (bRet < 0) {
- exit(EXIT_FAILURE);
- }
+ bRet = PeekMessage(&msg, NULL, 0, 0, PM_REMOVE);
- if (0) {
- fprintf(stderr, "message = 0x%04x, wParam = 0x%04x\n", msg.message, msg.wParam);
- }
+ if (bRet) {
+ if (0) {
+ fprintf(stderr, "message = 0x%04x, wParam = 0x%04x\n", msg.message, msg.wParam);
+ }
- switch (msg.message) {
- case WM_PAINT:
- winsys_fw->need_redisplay = true;
- break;
- case WM_SIZE:
- if (winsys_fw->user_reshape_func) {
- RECT rect;
- if (GetClientRect(msg.hwnd, &rect)) {
- int width = rect.right - rect.left;
- int height = rect.bottom - rect.top;
- winsys_fw->user_reshape_func(width, height);
+ switch (msg.message) {
+ case WM_PAINT:
+ winsys_fw->need_redisplay = true;
+ break;
+ case WM_SIZE:
+ if (winsys_fw->user_reshape_func) {
+ RECT rect;
+ if (GetClientRect(msg.hwnd, &rect)) {
+ int width = rect.right - rect.left;
+ int height = rect.bottom - rect.top;
+ winsys_fw->user_reshape_func(width, height);
+ }
}
- }
- winsys_fw->need_redisplay = true;
- break;
- case WM_CHAR:
- if (winsys_fw->user_keyboard_func) {
- winsys_fw->user_keyboard_func(msg.wParam, 0, 0);
- }
- winsys_fw->need_redisplay = true;
- break;
- case WM_SYSCOMMAND:
- if (msg.wParam == SC_CLOSE) {
+ winsys_fw->need_redisplay = true;
+ break;
+ case WM_CHAR:
+ if (winsys_fw->user_keyboard_func) {
+ winsys_fw->user_keyboard_func(msg.wParam, 0, 0);
+ }
+ winsys_fw->need_redisplay = true;
+ break;
+ case WM_SYSCOMMAND:
+ if (msg.wParam == SC_CLOSE) {
+ PostQuitMessage(EXIT_SUCCESS);
+ }
+ break;
+ case WM_CLOSE:
+ /* XXX: we never see this message here in practice, only WM_SYSCOMMAND::SC_CLOSE above */
PostQuitMessage(EXIT_SUCCESS);
+ break;
+ case WM_QUIT:
+ /* TODO: cleanup/teardown things */
+ exit(msg.wParam);
+ default:
+ break;
}
- break;
- case WM_CLOSE:
- /* XXX: we never see this message here in practice, only WM_SYSCOMMAND::SC_CLOSE above */
- PostQuitMessage(EXIT_SUCCESS);
- break;
- case WM_QUIT:
- /* TODO: cleanup/teardown things */
- exit(msg.wParam);
- default:
- break;
- }
- TranslateMessage(&msg);
- DispatchMessage(&msg);
+ TranslateMessage(&msg);
+ DispatchMessage(&msg);
+ }
if (winsys_fw->need_redisplay) {
enum piglit_result result = PIGLIT_PASS;
@@ -140,6 +138,8 @@ piglit_wgl_framework_create(const struct piglit_gl_test_config *test_config)
winsys_fw->enter_event_loop = enter_event_loop;
gl_fw->destroy = destroy;
+ winsys_fw->need_redisplay = true;
+
return gl_fw;
fail:
diff --git a/tests/util/piglit-framework-gl/piglit_winsys_framework.c b/tests/util/piglit-framework-gl/piglit_winsys_framework.c
index 8c99ed7a4..7a06e33da 100644
--- a/tests/util/piglit-framework-gl/piglit_winsys_framework.c
+++ b/tests/util/piglit-framework-gl/piglit_winsys_framework.c
@@ -50,9 +50,11 @@ swap_buffers(struct piglit_gl_framework *gl_fw)
}
static void
-run_test(struct piglit_gl_framework *gl_fw,
+run_test(struct piglit_gl_framework **pgl_fw,
int argc, char *argv[])
{
+ assert(pgl_fw);
+ struct piglit_gl_framework *gl_fw = *pgl_fw;
struct piglit_winsys_framework *winsys_fw = piglit_winsys_framework(gl_fw);
bool no_window = false;
const char *env_no_window = getenv("PIGLIT_NO_WINDOW");
diff --git a/tests/util/piglit-framework-gl/piglit_wl_framework.c b/tests/util/piglit-framework-gl/piglit_wl_framework.c
index f0583a67b..79b21d4d5 100644
--- a/tests/util/piglit-framework-gl/piglit_wl_framework.c
+++ b/tests/util/piglit-framework-gl/piglit_wl_framework.c
@@ -237,7 +237,7 @@ enter_event_loop(struct piglit_winsys_framework *winsys_fw)
enum piglit_result result = PIGLIT_PASS;
/* The Wayland window fails to appear on the first call to
- * swapBuffers (which occured in display_cb above). This is
+ * swapBuffers (which occurred in display_cb above). This is
* likely due to swapBuffers being called before receiving an
* expose event. Until piglit has proper Wayland support,
* redraw as a workaround.
diff --git a/tests/util/piglit-glx-util.c b/tests/util/piglit-glx-util.c
index b81feb977..78d1c64d6 100644
--- a/tests/util/piglit-glx-util.c
+++ b/tests/util/piglit-glx-util.c
@@ -163,7 +163,7 @@ void
piglit_require_glx_extension(Display *dpy, const char *name)
{
if (!piglit_is_glx_extension_supported(dpy, name)) {
- fprintf(stderr, "Test requires %s\n", name);
+ printf("Test requires %s\n", name);
piglit_report_result(PIGLIT_SKIP);
}
}
@@ -181,8 +181,8 @@ piglit_require_glx_version(Display *dpy, int major, int minor)
}
if (glxMajor != major || glxMinor < minor) {
- fprintf(stderr, "Test requires GLX %d.%d. Got %d.%d.\n",
- major, minor, glxMajor, glxMinor);
+ printf("Test requires GLX %d.%d. Got %d.%d.\n",
+ major, minor, glxMajor, glxMinor);
piglit_report_result(PIGLIT_SKIP);
}
}
@@ -511,7 +511,7 @@ piglit_glx_error_string(int err)
}
/**
- * Get the procedure adddresses for a group of function names
+ * Get the procedure addresses for a group of function names
*
* \note
* If any call to \c glXGetProcAddress fails, this function will call
diff --git a/tests/util/piglit-matrix.c b/tests/util/piglit-matrix.c
index 3c295e622..dd073b75a 100644
--- a/tests/util/piglit-matrix.c
+++ b/tests/util/piglit-matrix.c
@@ -234,7 +234,7 @@ piglit_rotation_matrix(float mat[16], float angle, float x, float y, float z)
* ...etc. Because of those relations and the standard trigonometric
* relations, it is pssible to reduce the transforms down to what
* is used below. It may be that any primary axis chosen will give the
- * same results (modulo a sign convention) using thie method.
+ * same results (modulo a sign convention) using this method.
*
* Particularly nice is to notice that all divisions that might
* have caused trouble when parallel to certain planes or
@@ -381,7 +381,7 @@ piglit_matrix_mul_vector(float out[4],
/**
- * Transfrom NDC coordinate to window coordinate using a viewport.
+ * Transform NDC coordinate to window coordinate using a viewport.
*/
void
piglit_ndc_to_window(float win[3],
diff --git a/tests/util/piglit-shader.c b/tests/util/piglit-shader.c
index 4fd68d21e..1787eb180 100644
--- a/tests/util/piglit-shader.c
+++ b/tests/util/piglit-shader.c
@@ -499,6 +499,7 @@ piglit_assemble_spirv(GLenum target,
getenv("PIGLIT_SPIRV_AS_BINARY"),
"--target-env", "opengl4.5",
"-o", "-",
+ "-",
NULL
};
diff --git a/tests/util/piglit-subprocess.c b/tests/util/piglit-subprocess.c
index 8cde2fee4..27bb0827b 100644
--- a/tests/util/piglit-subprocess.c
+++ b/tests/util/piglit-subprocess.c
@@ -193,6 +193,40 @@ piglit_subprocess(char * const *arguments,
#else /* _WIN32 */
+static bool
+stream_data(HANDLE to_child,
+ HANDLE from_child,
+ size_t input_size,
+ const uint8_t *input,
+ size_t *output_size,
+ uint8_t **output)
+{
+ DWORD bytes = 0;
+ if (!WriteFile(to_child, input, (DWORD)input_size, &bytes, NULL)) {
+ fprintf(stderr, "failed to write to child stdin\n");
+ return false;
+ }
+ CloseHandle(to_child);
+
+ size_t buf_size = 128;
+
+ *output = malloc(buf_size);
+ *output_size = 0;
+
+ while (true) {
+ if (buf_size - *output_size < 128) {
+ buf_size *=2;
+ *output = realloc(*output, buf_size);
+ }
+ if (ReadFile(from_child, *output + *output_size, buf_size - *output_size, &bytes, NULL) && bytes) {
+ *output_size += bytes;
+ } else {
+ CloseHandle(from_child);
+ return true;
+ }
+ }
+}
+
bool
piglit_subprocess(char * const *arguments,
size_t input_size,
@@ -200,8 +234,97 @@ piglit_subprocess(char * const *arguments,
size_t *output_size,
uint8_t **output)
{
- fprintf(stderr, "piglit_subprocess is not implemented on Windows\n");
- return false;
+ char *app_name = arguments[0];
+ char cmdline[1024];
+ char *append_loc = cmdline;
+ for (char * const *arg = arguments; *arg != NULL; ++arg) {
+ bool has_space = strchr(*arg, ' ') != NULL;
+ bool has_quotes = strchr(*arg, '"') != NULL;
+ int ret = sprintf(append_loc,
+ has_space && !has_quotes ? "%s\"%s\"" : "%s%s",
+ arg == arguments ? "" : " ",
+ *arg);
+ if (ret < 0) {
+ fprintf(stderr, "failed to construct command line\n");
+ return false;
+ }
+ append_loc += ret;
+ }
+
+ HANDLE stdin_read = NULL;
+ HANDLE stdin_write = NULL;
+ HANDLE stdout_read = NULL;
+ HANDLE stdout_write = NULL;
+
+ SECURITY_ATTRIBUTES sattr;
+ sattr.nLength = sizeof(SECURITY_ATTRIBUTES);
+ sattr.bInheritHandle = TRUE;
+ sattr.lpSecurityDescriptor = NULL;
+ bool success = false;
+
+ PROCESS_INFORMATION pinfo = { 0 };
+ STARTUPINFO startup_info = { 0 };
+ startup_info.cb = sizeof(STARTUPINFO);
+
+ if (!CreatePipe(&stdin_read, &stdin_write, &sattr, 0) ||
+ !CreatePipe(&stdout_read, &stdout_write, &sattr, 0) ||
+ /* Child process doesn't need to write to stdin or read from stdout */
+ !SetHandleInformation(stdin_write, HANDLE_FLAG_INHERIT, 0) ||
+ !SetHandleInformation(stdout_read, HANDLE_FLAG_INHERIT, 0)) {
+ fprintf(stderr, "CreatePipe or SetHandleInformation failed\n");
+ goto cleanup;
+ }
+
+ startup_info.hStdInput = stdin_read;
+ startup_info.hStdOutput = stdout_write;
+ startup_info.hStdError = NULL;
+ startup_info.dwFlags = STARTF_USESTDHANDLES;
+ if (!CreateProcessA(
+ app_name,
+ cmdline,
+ NULL, /* Security attributes */
+ NULL, /* Thread attributes */
+ TRUE, /* Inherit handles */
+ 0, /* Creation flags */
+ NULL, /* Environment (use parent) */
+ NULL, /* Working directory (use parent) */
+ &startup_info,
+ &pinfo
+ )) {
+ fprintf(stderr, "CreateProcess failed\n");
+ goto cleanup;
+ }
+
+ /* Close unneeded handles */
+ CloseHandle(pinfo.hThread);
+ CloseHandle(stdin_read);
+ stdin_read = NULL;
+ CloseHandle(stdout_write);
+ stdout_write = NULL;
+
+ success = stream_data(stdin_write, stdout_read, input_size, input, output_size, output);
+ stdin_write = NULL;
+ stdout_read = NULL;
+ WaitForSingleObject(pinfo.hProcess, INFINITE);
+ DWORD exit_code;
+ if (!GetExitCodeProcess(pinfo.hProcess, &exit_code) || exit_code != 0) {
+ if (success)
+ free(*output);
+ success = false;
+ }
+
+cleanup:
+ if (stdin_read)
+ CloseHandle(stdin_read);
+ if (stdin_write)
+ CloseHandle(stdin_write);
+ if (stdout_read)
+ CloseHandle(stdout_read);
+ if (stdout_write)
+ CloseHandle(stdout_write);
+ if (pinfo.hProcess)
+ CloseHandle(pinfo.hProcess);
+ return success;
}
#endif /* _WIN32 */
diff --git a/tests/util/piglit-util-cl.c b/tests/util/piglit-util-cl.c
index 42a5e72f9..7804afb85 100644
--- a/tests/util/piglit-util-cl.c
+++ b/tests/util/piglit-util-cl.c
@@ -146,7 +146,7 @@ bool piglit_cl_probe_double(double value, double expect, uint64_t ulp)
diff = fabs(value - expect);
if(diff > tolerance || isnan(value)) {
- printf("Expecting %f (0x%" PRIx64") with tolerance %f (%lu ulps), but got %f (0x%" PRIx64")\n",
+ printf("Expecting %f (0x%" PRIx64") with tolerance %f (%" PRIu64"), but got %f (0x%" PRIx64")\n",
e.f, e.u, tolerance, ulp, v.f, v.u);
return false;
}
@@ -218,7 +218,7 @@ piglit_cl_get_platform_version(cl_platform_id platform)
int scanf_count;
int major;
int minor;
-
+
/*
* Returned format:
* OpenCL<space><major_version.minor_version><space><platform-specific information>
@@ -409,7 +409,7 @@ piglit_cl_get_info(void* fn_ptr, void* obj, cl_uint param)
if(errNo == CL_SUCCESS) {
param_ptr = calloc(param_size, sizeof(char));
-
+
/* retrieve param */
if(fn_ptr == clGetPlatformInfo) {
errNo = clGetPlatformInfo(*(cl_platform_id*)obj, param,
@@ -519,7 +519,7 @@ piglit_cl_get_program_build_info(cl_program program, cl_device_id device,
.program = program,
.device = device
};
-
+
return piglit_cl_get_info(clGetProgramBuildInfo, &args, param);
}
@@ -535,7 +535,7 @@ piglit_cl_get_kernel_work_group_info(cl_kernel kernel, cl_device_id device,
.kernel = kernel,
.device = device
};
-
+
return piglit_cl_get_info(clGetKernelWorkGroupInfo, &args, param);
}
@@ -676,7 +676,7 @@ piglit_cl_get_device_ids(cl_platform_id platform_id, cl_device_type device_type,
piglit_cl_get_error_name(errNo));
return 0;
}
-
+
/* get device list */
if(device_ids != NULL && num_device_ids > 0) {
*device_ids = malloc(num_device_ids * sizeof(cl_device_id));
@@ -749,7 +749,7 @@ piglit_cl_create_context(cl_platform_id platform_id,
return NULL;
}
- /* create and assing command queues */
+ /* create and assign command queues */
context->command_queues = malloc(num_devices * sizeof(cl_command_queue));
for(i = 0; i < num_devices; i++) {
context->command_queues[i] = clCreateCommandQueue(context->cl_ctx,
@@ -817,7 +817,7 @@ piglit_cl_build_program_with_source_extended(piglit_cl_context context,
piglit_cl_get_error_name(errNo));
return NULL;
}
-
+
errNo = clBuildProgram(program,
context->num_devices,
context->device_ids,
@@ -844,7 +844,7 @@ piglit_cl_build_program_with_source_extended(piglit_cl_context context,
char* log = piglit_cl_get_program_build_info(program,
context->device_ids[i],
CL_PROGRAM_BUILD_LOG);
-
+
printf("Build log for device %s:\n -------- \n%s\n -------- \n",
device_name,
log);
@@ -877,7 +877,7 @@ piglit_cl_fail_build_program_with_source(piglit_cl_context context,
cl_program
piglit_cl_build_program_with_binary_extended(piglit_cl_context context,
- size_t* lenghts,
+ size_t* lengths,
unsigned char** binaries,
const char* options, bool fail)
{
@@ -889,7 +889,7 @@ piglit_cl_build_program_with_binary_extended(piglit_cl_context context,
program = clCreateProgramWithBinary(context->cl_ctx,
context->num_devices,
context->device_ids,
- lenghts,
+ lengths,
(const unsigned char**)binaries,
binary_status,
&errNo);
@@ -904,11 +904,11 @@ piglit_cl_build_program_with_binary_extended(piglit_cl_context context,
for(i = 0; i < context->num_devices; i++) {
char* device_name = piglit_cl_get_device_info(context->device_ids[i],
CL_DEVICE_NAME);
-
+
printf("Error for %s: %s\n",
device_name,
piglit_cl_get_error_name(binary_status[i]));
-
+
free(device_name);
}
@@ -916,7 +916,7 @@ piglit_cl_build_program_with_binary_extended(piglit_cl_context context,
return NULL;
}
free(binary_status);
-
+
errNo = clBuildProgram(program,
context->num_devices,
context->device_ids,
@@ -940,11 +940,11 @@ piglit_cl_build_program_with_binary_extended(piglit_cl_context context,
char* log = piglit_cl_get_program_build_info(program,
context->device_ids[i],
CL_PROGRAM_BUILD_LOG);
-
+
printf("Build log for device %s:\n -------- \n%s\n -------- \n",
device_name,
log);
-
+
free(device_name);
free(log);
}
@@ -957,22 +957,22 @@ piglit_cl_build_program_with_binary_extended(piglit_cl_context context,
}
cl_program
-piglit_cl_build_program_with_binary(piglit_cl_context context, size_t* lenghts,
+piglit_cl_build_program_with_binary(piglit_cl_context context, size_t* lengths,
unsigned char** binaries,
const char* options)
{
- return piglit_cl_build_program_with_binary_extended(context, lenghts,
+ return piglit_cl_build_program_with_binary_extended(context, lengths,
binaries, options,
false);
}
cl_program
piglit_cl_fail_build_program_with_binary(piglit_cl_context context,
- size_t* lenghts,
+ size_t* lengths,
unsigned char** binaries,
const char* options)
{
- return piglit_cl_build_program_with_binary_extended(context, lenghts,
+ return piglit_cl_build_program_with_binary_extended(context, lengths,
binaries, options,
true);
}
diff --git a/tests/util/piglit-util-cl.h b/tests/util/piglit-util-cl.h
index afec6609a..af5b80561 100644
--- a/tests/util/piglit-util-cl.h
+++ b/tests/util/piglit-util-cl.h
@@ -447,14 +447,14 @@ piglit_cl_fail_build_program_with_source(piglit_cl_context context,
* \c piglit_cl_context.
*
* @param context Context on which to create and build program.
- * @param lenghts Lenghts of binaries in \c binaries.
+ * @param lengths Lengths of binaries in \c binaries.
* @param binaries Array of pointers to binaries.
* @param options NULL-terminated string that describes build options.
* @return Built program or NULL on fail.
*/
cl_program
piglit_cl_build_program_with_binary(piglit_cl_context context,
- size_t* lenghts,
+ size_t* lengths,
unsigned char** binaries,
const char* options);
@@ -465,14 +465,14 @@ piglit_cl_build_program_with_binary(piglit_cl_context context,
* in \c piglit_cl_context.
*
* @param context Context on which to create and build program.
- * @param lenghts Lenghts of binaries in \c binaries.
+ * @param lengths Lengths of binaries in \c binaries.
* @param binaries Array of pointers to binaries.
* @param options NULL-terminated string that describes build options.
* @return Unsuccessfully built program or NULL on fail.
*/
cl_program
piglit_cl_fail_build_program_with_binary(piglit_cl_context context,
- size_t* lenghts,
+ size_t* lengths,
unsigned char** binaries,
const char* options);
@@ -497,7 +497,7 @@ piglit_cl_create_buffer(piglit_cl_context context,
* @param offset Offset in buffer.
* @param cb Size of data in bytes.
* @param ptr Pointer to data to be written to buffer.
- * @return \c true on succes, \c false otherwise.
+ * @return \c true on success, \c false otherwise.
*/
bool
piglit_cl_write_buffer(cl_command_queue command_queue,
@@ -515,7 +515,7 @@ piglit_cl_write_buffer(cl_command_queue command_queue,
* @param command_queue Command queue to enqueue operation on.
* @param buffer Memory buffer to write to.
* @param ptr Pointer to data to be written to buffer.
- * @return \c true on succes, \c false otherwise.
+ * @return \c true on success, \c false otherwise.
*/
bool
piglit_cl_write_whole_buffer(cl_command_queue command_queue,
@@ -530,7 +530,7 @@ piglit_cl_write_whole_buffer(cl_command_queue command_queue,
* @param offset Offset in buffer.
* @param cb Size of data in bytes.
* @param ptr Pointer to data to be written from buffer.
- * @return \c true on succes, \c false otherwise.
+ * @return \c true on success, \c false otherwise.
*/
bool
piglit_cl_read_buffer(cl_command_queue command_queue,
@@ -548,7 +548,7 @@ piglit_cl_read_buffer(cl_command_queue command_queue,
* @param command_queue Command queue to enqueue operation on.
* @param buffer Memory buffer to read from.
* @param ptr Pointer to data to be written from buffer.
- * @return \c true on succes, \c false otherwise.
+ * @return \c true on success, \c false otherwise.
*/
bool
piglit_cl_read_whole_buffer(cl_command_queue command_queue,
@@ -614,7 +614,7 @@ piglit_cl_create_image(piglit_cl_context context,
* @param origin (x, y, z) offset in pixels.
* @param region (width, height, depht) size in pixels.
* @param ptr Pointer to data to be written to image.
- * @return \c true on succes, \c false otherwise.
+ * @return \c true on success, \c false otherwise.
*/
bool
piglit_cl_write_image(cl_command_queue command_queue,
@@ -632,7 +632,7 @@ piglit_cl_write_image(cl_command_queue command_queue,
* @param command_queue Command queue to enqueue operation on.
* @param image Image to write to.
* @param ptr Pointer to data to be written to image.
- * @return \c true on succes, \c false otherwise.
+ * @return \c true on success, \c false otherwise.
*/
bool
piglit_cl_write_whole_image(cl_command_queue command_queue,
@@ -647,7 +647,7 @@ piglit_cl_write_whole_image(cl_command_queue command_queue,
* @param origin (x, y, z) offset in pixels.
* @param region (width, height, depht) size in pixels.
* @param ptr Pointer to data read from image.
- * @return \c true on succes, \c false otherwise.
+ * @return \c true on success, \c false otherwise.
*/
bool
piglit_cl_read_image(cl_command_queue command_queue,
@@ -665,7 +665,7 @@ piglit_cl_read_image(cl_command_queue command_queue,
* @param command_queue Command queue to enqueue operation on.
* @param image Image to read from.
* @param ptr Pointer to data read from image.
- * @return \c true on succes, \c false otherwise.
+ * @return \c true on success, \c false otherwise.
*/
bool
piglit_cl_read_whole_image(cl_command_queue command_queue,
@@ -704,7 +704,7 @@ piglit_cl_create_kernel(cl_program program, const char* kernel_name);
* @param arg_index Argument index.
* @param size Size of argument.
* @param arg_value Pointer to argument value.
- * @return \c true on succes, \c false otherwise.
+ * @return \c true on success, \c false otherwise.
*/
bool
piglit_cl_set_kernel_arg(cl_kernel kernel,
@@ -718,7 +718,7 @@ piglit_cl_set_kernel_arg(cl_kernel kernel,
* @param kernel Kernel for which to set an buffer argument.
* @param arg_index Argument index.
* @param buffer Buffer to be set as argument.
- * @return \c true on succes, \c false otherwise.
+ * @return \c true on success, \c false otherwise.
*/
bool
piglit_cl_set_kernel_buffer_arg(cl_kernel kernel,
@@ -735,7 +735,7 @@ piglit_cl_set_kernel_buffer_arg(cl_kernel kernel,
* @param global_work_size Global work sizes.
* @param local_work_size Local work sizes.
* @param ev Location to store execution event.
- * @return \c true on succes, \c false otherwise.
+ * @return \c true on success, \c false otherwise.
*/
bool
piglit_cl_enqueue_ND_range_kernel(cl_command_queue command_queue,
@@ -755,7 +755,7 @@ piglit_cl_enqueue_ND_range_kernel(cl_command_queue command_queue,
* @param global_offset Global offset.
* @param global_work_size Global work sizes.
* @param local_work_size Local work sizes.
- * @return \c true on succes, \c false otherwise.
+ * @return \c true on success, \c false otherwise.
*/
bool
piglit_cl_execute_ND_range_kernel(cl_command_queue command_queue,
@@ -770,7 +770,7 @@ piglit_cl_execute_ND_range_kernel(cl_command_queue command_queue,
*
* @param command_queue Command queue to enqueue operation on.
* @param kernel Kernel to be enqueued.
- * @return \c true on succes, \c false otherwise.
+ * @return \c true on success, \c false otherwise.
*/
bool
piglit_cl_enqueue_task(cl_command_queue command_queue, cl_kernel kernel);
@@ -780,7 +780,7 @@ piglit_cl_enqueue_task(cl_command_queue command_queue, cl_kernel kernel);
*
* @param command_queue Command queue to enqueue operation on.
* @param kernel Kernel to be enqueued.
- * @return \c true on succes, \c false otherwise.
+ * @return \c true on success, \c false otherwise.
*/
bool
piglit_cl_execute_task(cl_command_queue command_queue, cl_kernel kernel);
diff --git a/tests/util/piglit-util-gl.c b/tests/util/piglit-util-gl.c
index 4c4c2ba4f..03e6dde05 100644
--- a/tests/util/piglit-util-gl.c
+++ b/tests/util/piglit-util-gl.c
@@ -154,12 +154,13 @@ void piglit_require_not_extension(const char *name)
}
}
-void piglit_require_draw_buffers(int count)
+void piglit_require_minimum_getinteger(GLenum pname, GLint req)
{
- GLint max_targets;
- glGetIntegerv(GL_MAX_DRAW_BUFFERS, &max_targets);
- if (max_targets < 2) {
- printf("Test requires GL_MAX_DRAW_BUFFERS >= %d\n", count);
+ GLint value = 0;
+ glGetIntegerv(pname, &value);
+ if (value < req) {
+ printf("Test requires %s >= %d, driver reports %d\n",
+ piglit_get_gl_enum_name(pname), req, value);
piglit_report_result(PIGLIT_SKIP);
}
}
@@ -306,7 +307,7 @@ piglit_set_tolerance_for_bits(int rbits, int gbits, int bbits, int abits)
}
}
-typedef union { GLfloat f; GLint i; } fi_type;
+typedef union { GLfloat f; GLint i; GLuint ui; } fi_type;
/**
* Convert a 4-byte float to a 2-byte half float.
@@ -395,6 +396,40 @@ piglit_half_from_float(float val)
return result;
}
+/**
+ * Convert a 2-byte half float to a 4-byte float.
+ * Based on code from:
+ * http://www.opengl.org/discussion_boards/ubb/Forum3/HTML/008786.html
+ *
+ * Taken from Mesa.
+ */
+float
+piglit_float_from_half(unsigned short val)
+{
+ fi_type infnan;
+ fi_type magic;
+ fi_type f32;
+
+ infnan.ui = 0x8f << 23;
+ infnan.f = 65536.0f;
+ magic.ui = 0xef << 23;
+
+ /* Exponent / Mantissa */
+ f32.ui = (val & 0x7fff) << 13;
+
+ /* Adjust */
+ f32.f *= magic.f;
+ /* XXX: The magic mul relies on denorms being available */
+
+ /* Inf / NaN */
+ if (f32.f >= infnan.f)
+ f32.ui |= 0xff << 23;
+
+ /* Sign */
+ f32.ui |= (uint32_t)(val & 0x8000) << 16;
+
+ return f32.f;
+}
/**
* Return block size info for a specific texture compression format.
@@ -464,7 +499,7 @@ piglit_get_compressed_block_size(GLenum format,
/**
- * Compute size (in bytes) neede to store an image in the given compressed
+ * Compute size (in bytes) needed to store an image in the given compressed
* format.
*/
unsigned
@@ -517,7 +552,7 @@ piglit_escape_exit_key(unsigned char key, int x, int y)
}
/**
- * Convenience function to configure an abitrary orthogonal projection matrix
+ * Convenience function to configure an arbitrary orthogonal projection matrix
*/
void
piglit_gen_ortho_projection(double left, double right, double bottom,
@@ -1477,6 +1512,14 @@ piglit_probe_rect_rgba(int x, int y, int w, int h, const float *expected)
return probe_rect(x, y, w, h, 4, expected, 0, 0, false);
}
+int piglit_probe_rect_rgb_varying(int x, int y, int w, int h,
+ const float* expected, size_t stride)
+{
+ assert(stride % sizeof(float) == 0);
+ return probe_rect(x, y, w, h, 3, expected,
+ 3, stride / sizeof(float), false);
+}
+
int piglit_probe_rect_rgba_varying(int x, int y, int w, int h,
const float* expected, size_t stride)
{
@@ -3203,6 +3246,52 @@ piglit_array_texture(GLenum target, GLenum internalformat,
return tex;
}
+/* utility functions for testing format */
+static bool
+is_format_sint(const GLenum format)
+{
+ switch (format) {
+ case GL_R8I:
+ case GL_R16I:
+ case GL_R32I:
+ case GL_RG8I:
+ case GL_RG16I:
+ case GL_RG32I:
+ case GL_RGB8I:
+ case GL_RGB16I:
+ case GL_RGB32I:
+ case GL_RGBA8I:
+ case GL_RGBA16I:
+ case GL_RGBA32I:
+ return true;
+ default:
+ return false;
+ }
+}
+
+static bool
+is_format_uint(const GLenum format)
+{
+ switch (format) {
+ case GL_R8UI:
+ case GL_R16UI:
+ case GL_R32UI:
+ case GL_RG8UI:
+ case GL_RG16UI:
+ case GL_RG32UI:
+ case GL_RGB8UI:
+ case GL_RGB16UI:
+ case GL_RGB32UI:
+ case GL_RGBA8UI:
+ case GL_RGBA16UI:
+ case GL_RGBA32UI:
+ return true;
+ default:
+ return false;
+ }
+}
+
+
static const char multisample_texture_vs_source[] =
"#version 130\n"
"in vec2 vertex;\n"
@@ -3214,17 +3303,18 @@ static const char multisample_texture_vs_source[] =
" gl_Position = vec4(pos, 0, 1);\n"
"}\n";
-static const char multisample_texture_fs_source[] =
+static const char multisample_texture_fs_template[] =
"#version 130\n"
"#extension GL_ARB_sample_shading : enable\n"
"in vec2 tex_coords;\n"
-"uniform sampler2DArray tex;\n"
+"uniform %ssampler2DArray tex;\n"
"uniform int tex_depth;\n"
"uniform int z;\n"
+"out %svec4 fragColor;\n"
"void main()\n"
"{\n"
" int layer = (gl_SampleID * tex_depth) + z;\n"
-" gl_FragColor = texture(tex, vec3(tex_coords, layer));\n"
+" fragColor = texture(tex, vec3(tex_coords, layer));\n"
"}\n";
/**
@@ -3250,18 +3340,26 @@ static const char multisample_texture_fs_source[] =
* \param samples the number of samples
* \param format format of the pixel data
* \param type type of the pixel data
- * \param data pixel data with whitch to fill the texture
+ * \param data pixel data with which to fill the texture
*
* \return the new texture object id
*/
+
+/*
+ * depending on the output format, the shader must write either
+ * a vec4, ivec4, or uvec4. This enum select amongst those.
+ */
+enum { MS_OUT_VEC4 = 0, MS_OUT_IVEC4, MS_OUT_UVEC4, MS_OUT_COUNT };
+static char *vec_char[MS_OUT_COUNT] = { "", "i", "u" };
+
GLuint
piglit_multisample_texture(GLenum target, GLuint tex, GLenum internalFormat,
unsigned width, unsigned height,
unsigned depth, unsigned samples,
GLenum format, GLenum type, const void *data)
{
- static GLuint prog = 0;
- static GLint tex_loc, tex_depth_loc, z_loc;
+ static GLuint prog[MS_OUT_COUNT] = {0};
+ static GLint tex_loc[MS_OUT_COUNT], tex_depth_loc[MS_OUT_COUNT], z_loc[MS_OUT_COUNT];
static GLuint fbo, array_tex, ms_tex;
static const float verts[] = {
0.0, 0.0,
@@ -3272,6 +3370,7 @@ piglit_multisample_texture(GLenum target, GLuint tex, GLenum internalFormat,
0.0, 0.0
};
unsigned z;
+ unsigned out_fmt;
struct {
GLint active_tex;
@@ -3294,21 +3393,34 @@ piglit_multisample_texture(GLenum target, GLuint tex, GLenum internalFormat,
return 0;
}
- if (prog == 0) {
+ /* pick which kind of output we need; integer output formats must be
+ * written as integer, not float, or else undefined behavior is triggered
+ */
+ if (is_format_uint(internalFormat)) {
+ out_fmt = MS_OUT_UVEC4;
+ } else if (is_format_sint(internalFormat)) {
+ out_fmt = MS_OUT_IVEC4;
+ } else {
+ out_fmt = MS_OUT_VEC4;
+ }
+ if (prog[out_fmt] == 0) {
+ static char fs_temp[1024];
+ snprintf(fs_temp, sizeof(fs_temp), multisample_texture_fs_template,
+ vec_char[out_fmt], vec_char[out_fmt]);
/* First-run setup */
- prog = piglit_build_simple_program_unlinked(
+ prog[out_fmt] = piglit_build_simple_program_unlinked(
multisample_texture_vs_source,
- multisample_texture_fs_source);
- glBindAttribLocation(prog, 0, "vertex");
- glLinkProgram(prog);
- if (!piglit_link_check_status(prog)) {
- prog = 0;
+ fs_temp);
+ glBindAttribLocation(prog[out_fmt], 0, "vertex");
+ glLinkProgram(prog[out_fmt]);
+ if (!piglit_link_check_status(prog[out_fmt])) {
+ prog[out_fmt] = 0;
return 0;
}
- tex_loc = glGetUniformLocation(prog, "tex");
- tex_depth_loc = glGetUniformLocation(prog, "tex_depth");
- z_loc = glGetUniformLocation(prog, "z");
+ tex_loc[out_fmt] = glGetUniformLocation(prog[out_fmt], "tex");
+ tex_depth_loc[out_fmt] = glGetUniformLocation(prog[out_fmt], "tex_depth");
+ z_loc[out_fmt] = glGetUniformLocation(prog[out_fmt], "z");
glGenFramebuffers(1, &fbo);
glGenTextures(1, &array_tex);
@@ -3352,15 +3464,15 @@ piglit_multisample_texture(GLenum target, GLuint tex, GLenum internalFormat,
glClampColor(GL_CLAMP_FRAGMENT_COLOR, GL_FALSE);
- glUseProgram(prog);
- glUniform1i(tex_loc, backup.active_tex - GL_TEXTURE0);
- glUniform1i(tex_depth_loc, depth);
+ glUseProgram(prog[out_fmt]);
+ glUniform1i(tex_loc[out_fmt], backup.active_tex - GL_TEXTURE0);
+ glUniform1i(tex_depth_loc[out_fmt], depth);
glEnableVertexAttribArray(0);
glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 0, verts);
if (target == GL_TEXTURE_2D_MULTISAMPLE) {
- glUniform1i(z_loc, 0);
+ glUniform1i(z_loc[out_fmt], 0);
glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER,
GL_COLOR_ATTACHMENT0,
target, ms_tex, 0);
@@ -3371,7 +3483,7 @@ piglit_multisample_texture(GLenum target, GLuint tex, GLenum internalFormat,
glDrawArrays(GL_TRIANGLES, 0, 6);
} else {
for (z = 0; z < depth; ++z) {
- glUniform1i(z_loc, z);
+ glUniform1i(z_loc[out_fmt], z);
glFramebufferTextureLayer(GL_DRAW_FRAMEBUFFER,
GL_COLOR_ATTACHMENT0,
ms_tex, 0, z);
diff --git a/tests/util/piglit-util-gl.h b/tests/util/piglit-util-gl.h
index 59bdc6aa3..d76eb18df 100644
--- a/tests/util/piglit-util-gl.h
+++ b/tests/util/piglit-util-gl.h
@@ -133,14 +133,14 @@ piglit_check_gl_error_(GLenum expected_error, const char *file, unsigned line);
/**
* \brief Drain all GL errors.
*
- * Repeatly call glGetError and discard errors until it returns GL_NO_ERROR.
+ * Repeatedly call glGetError and discard errors until it returns GL_NO_ERROR.
*/
void piglit_reset_gl_error(void);
void piglit_require_gl_version(int required_version_times_10);
void piglit_require_extension(const char *name);
void piglit_require_not_extension(const char *name);
-void piglit_require_draw_buffers(int count);
+void piglit_require_minimum_getinteger(GLenum pname, GLint req);
unsigned piglit_num_components(GLenum format);
bool piglit_get_luminance_intensity_bits(GLenum internalformat, int *bits);
int piglit_probe_pixel_rgb_silent(int x, int y, const float* expected, float *out_probe);
@@ -151,6 +151,8 @@ int piglit_probe_rect_r_ubyte(int x, int y, int w, int h, GLubyte expected);
int piglit_probe_rect_rgb(int x, int y, int w, int h, const float* expected);
int piglit_probe_rect_rgb_silent(int x, int y, int w, int h, const float *expected);
int piglit_probe_rect_rgba(int x, int y, int w, int h, const float* expected);
+int piglit_probe_rect_rgb_varying(int x, int y, int w, int h,
+ const float* expected, size_t stride);
int piglit_probe_rect_rgba_varying(int x, int y, int w, int h,
const float* expected, size_t stride);
int piglit_probe_rect_rgba_int(int x, int y, int w, int h, const int* expected);
@@ -258,6 +260,7 @@ void piglit_draw_rect_from_arrays(const void *verts, const void *tex,
bool use_patches, unsigned instance_count);
unsigned short piglit_half_from_float(float val);
+float piglit_float_from_half(unsigned short val);
/**
* Wrapper for piglit_half_from_float() which allows using an exact
diff --git a/tests/util/piglit-util-waffle.c b/tests/util/piglit-util-waffle.c
index 29b4cb281..139500d9c 100644
--- a/tests/util/piglit-util-waffle.c
+++ b/tests/util/piglit-util-waffle.c
@@ -28,19 +28,20 @@
#include "piglit-util-waffle.h"
static void
-wfl_log(const char *tag, const char *func_name)
+wfl_log(FILE *out, const char *tag, const char *func_name)
{
const struct waffle_error_info *info = waffle_error_get_info();
assert(tag != NULL);
assert(info->code != WAFFLE_NO_ERROR);
- fflush(stdout);
- fprintf(stderr, "piglit: %s: %s failed due to %s",
+ if (out != stdout)
+ fflush(stdout);
+ fprintf(out, "piglit: %s: %s failed due to %s",
tag, func_name, waffle_error_to_string(info->code));
if (info->message_length > 0)
- fprintf(stderr, ": %s", info->message);
- fprintf(stderr, "\n");
+ fprintf(out, ": %s", info->message);
+ fprintf(out, "\n");
}
void
@@ -64,13 +65,19 @@ wfl_log_debug(const char *func_name)
}
if (debug == 1)
- wfl_log("debug", func_name);
+ wfl_log(stderr, "debug", func_name);
}
void
wfl_log_error(const char *func_name)
{
- wfl_log("error", func_name);
+ wfl_log(stderr, "error", func_name);
+}
+
+void
+wfl_log_error_stdout(const char *func_name)
+{
+ wfl_log(stdout, "error", func_name);
}
void
diff --git a/tests/util/piglit-util-waffle.h b/tests/util/piglit-util-waffle.h
index 897cfff00..50037eb3e 100644
--- a/tests/util/piglit-util-waffle.h
+++ b/tests/util/piglit-util-waffle.h
@@ -42,6 +42,14 @@ void
wfl_log_error(const char *func_name);
/**
+ * \brief Print the current Waffle error to stdout.
+ *
+ * The \a func_name is the name of most recently called Waffle function.
+ */
+void
+wfl_log_error_stdout(const char *func_name);
+
+/**
* \brief Print the current Waffle error if PIGLIT_DEBUG=1.
*
* The \a func_name is the name of most recently called Waffle function.
diff --git a/tests/util/piglit-util.c b/tests/util/piglit-util.c
index bf2c9f93e..48d08e82e 100644
--- a/tests/util/piglit-util.c
+++ b/tests/util/piglit-util.c
@@ -128,7 +128,7 @@ int asprintf(char **strp, const char *fmt, ...)
*
* The null-terminated string \a separators is a list of characters at
* which to perform the splits. For example, if separators is " ,", then
- * the function will split the string at each occurence of ' ' and ','.
+ * the function will split the string at each occurrence of ' ' and ','.
*/
const char**
piglit_split_string_to_array(const char *string, const char *separators)
diff --git a/tests/util/piglit-util.h b/tests/util/piglit-util.h
index 4d3606c70..de999980b 100644
--- a/tests/util/piglit-util.h
+++ b/tests/util/piglit-util.h
@@ -52,8 +52,8 @@ extern "C" {
#include <math.h>
#include <float.h>
-#if defined(__APPLE__) || defined(__MINGW32__)
-# include "libgen.h" // for basename
+#ifdef HAVE_LIBGEN_H
+# include <libgen.h> // for basename
#elif defined(_MSC_VER)
static inline char *
diff --git a/tests/util/piglit_ktx.c b/tests/util/piglit_ktx.c
index 9050a6f23..b69c9390a 100644
--- a/tests/util/piglit_ktx.c
+++ b/tests/util/piglit_ktx.c
@@ -630,9 +630,6 @@ piglit_ktx_load_noncubeface(struct piglit_ktx *self,
const struct piglit_ktx_image *img = &self->images[image];
int level = image;
- glTexParameteri(info->target, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- glTexParameteri(info->target, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
-
switch (info->target) {
case GL_TEXTURE_1D:
if (piglit_is_gles())
@@ -814,6 +811,17 @@ piglit_ktx_load_texture(struct piglit_ktx *self,
}
glBindTexture(info->target, *tex_name);
+
+ /* Set the max miplevel according to what's in the KTX file. For
+ * mipmapped textures missing some miplevels (i.e., the last miplevel
+ * is not a single pixel), this allows the textures to be considered
+ * "mipmap complete" for sampling operations. Setting this parameter
+ * also can act as an allocation hint to the driver, and thus help
+ * mipmapped textures in general.
+ */
+ glTexParameteri(info->target, GL_TEXTURE_MAX_LEVEL,
+ info->num_miplevels - 1);
+
my_gl_error = glGetError();
if (my_gl_error)
goto fail;
diff --git a/tests/util/piglit_ktx.h b/tests/util/piglit_ktx.h
index d15042357..689d8144c 100644
--- a/tests/util/piglit_ktx.h
+++ b/tests/util/piglit_ktx.h
@@ -52,7 +52,7 @@ struct piglit_ktx_info {
/**
* \brief GL texture target.
*
- * This is the `target` agument passed to glTexImage() It is
+ * This is the `target` argument passed to glTexImage() It is
* completely determined by pixel_size, array_length, and num_faces.
* Valid values are
* - GL_TEXTURE_1D
@@ -99,7 +99,7 @@ struct piglit_ktx_info {
* gl_internal_format. For non-compressed textures,
* gl_base_internal_format is the same as gl_internal_format.
*
- * (I (chadv) dont' understand what purpose this field serves, But
+ * (I (chadv) don't understand what purpose this field serves, But
* the KTX spec requires it in the header).
*/
uint32_t gl_base_internal_format;
diff --git a/tests/wayland/CMakeLists.no_api.txt b/tests/wayland/CMakeLists.no_api.txt
new file mode 100644
index 000000000..538924c4a
--- /dev/null
+++ b/tests/wayland/CMakeLists.no_api.txt
@@ -0,0 +1,28 @@
+link_libraries (
+ ${WAYLAND_LDFLAGS}
+ ${WAYLAND_LIBRARIES}
+ ${LIBDRM_LDFLAGS}
+ piglitutil
+)
+
+include_directories(
+ ${WAYLAND_INCLUDE_DIRS}
+ ${LIBDRM_INCLUDE_DIRS}
+ ${CMAKE_CURRENT_BINARY_DIR}
+)
+
+set(WaylandDmaBuf_PATH "${WaylandProtocols_DATADIR}/unstable/linux-dmabuf/linux-dmabuf-unstable-v1.xml")
+
+add_custom_command(PRE_BUILD
+ OUTPUT linux-dmabuf-unstable-v1-protocol.c
+ COMMAND WaylandScannerExe private-code ${WaylandDmaBuf_PATH} linux-dmabuf-unstable-v1-protocol.c)
+add_custom_command(PRE_BUILD
+ OUTPUT linux-dmabuf-unstable-v1-client-protocol.h
+ COMMAND WaylandScannerExe client-header ${WaylandDmaBuf_PATH} linux-dmabuf-unstable-v1-client-protocol.h)
+
+if(PIGLIT_HAS_DRM_GET_DEVICE_BY_DEVID)
+ piglit_add_executable(wayland-dmabuf-target
+ wayland-dmabuf-target.c
+ linux-dmabuf-unstable-v1-protocol.c
+ linux-dmabuf-unstable-v1-client-protocol.h)
+endif(PIGLIT_HAS_DRM_GET_DEVICE_BY_DEVID)
diff --git a/tests/wayland/CMakeLists.txt b/tests/wayland/CMakeLists.txt
new file mode 100644
index 000000000..144a306f4
--- /dev/null
+++ b/tests/wayland/CMakeLists.txt
@@ -0,0 +1 @@
+piglit_include_target_api()
diff --git a/tests/wayland/wayland-dmabuf-target.c b/tests/wayland/wayland-dmabuf-target.c
new file mode 100644
index 000000000..fb5f5e403
--- /dev/null
+++ b/tests/wayland/wayland-dmabuf-target.c
@@ -0,0 +1,243 @@
+/*
+ * Copyright 2021 Eric Engestrom
+ * Copyright 2023 Collabora, Ltd.
+ * SPDX-License-Identifier: MIT
+ */
+
+#include <assert.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <stdbool.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
+#include <xf86drm.h>
+#include <wayland-client.h>
+#include "linux-dmabuf-unstable-v1-client-protocol.h"
+
+#include "piglit-util.h"
+
+
+#define MIN(a, b) ((a) < (b) ? (a) : (b))
+
+struct wayland_display_target {
+ unsigned int roundtrips_needed;
+ struct wl_display *dpy;
+ struct wl_registry *registry;
+ struct zwp_linux_dmabuf_v1 *dmabuf;
+ struct zwp_linux_dmabuf_feedback_v1 *feedback;
+ bool feedback_done;
+ char *primary_driver_name;
+};
+
+
+static int
+open_drm_by_devid(dev_t devid)
+{
+ drmDevice *device;
+ int ret = -1;
+ int err;
+
+ err = drmGetDeviceFromDevId(devid, 0, &device);
+ if (err != 0) {
+ printf("libdrm reports no devices for our devid\n");
+ piglit_report_result(PIGLIT_FAIL);
+ }
+
+ if (device->available_nodes & (1 << DRM_NODE_RENDER))
+ ret = open(device->nodes[DRM_NODE_RENDER], O_RDWR);
+ if (ret == -1 && device->available_nodes & (1 << DRM_NODE_PRIMARY))
+ ret = open(device->nodes[DRM_NODE_PRIMARY], O_RDWR);
+ if (ret == -1) {
+ printf("Couldn't open any libdrm devices for our devid\n");
+ piglit_report_result(PIGLIT_FAIL);
+ }
+
+ drmFreeDevice(&device);
+
+ return ret;
+}
+
+
+static void
+feedback_handle_done(void *_data, struct zwp_linux_dmabuf_feedback_v1 *feedback)
+{
+ struct wayland_display_target *data = _data;
+
+ /* We've got all our feedback events now, so we can remove the roundtrip we
+ * added when binding the interface */
+ data->feedback_done = true;
+}
+
+static void
+feedback_handle_format_table(void *_data,
+ struct zwp_linux_dmabuf_feedback_v1 *feedback,
+ int fd, uint32_t size)
+{
+ /* We don't need the format table for anything */
+ close(fd);
+}
+
+static void
+feedback_handle_main_device(void *_data,
+ struct zwp_linux_dmabuf_feedback_v1 *feedback,
+ struct wl_array *dev_array)
+{
+ struct wayland_display_target *data = _data;
+ drmVersionPtr version;
+ dev_t dev;
+ int fd;
+
+ /* This is basically a malformed compositor */
+ if (dev_array->size != sizeof(dev)) {
+ printf("Expected main_device size to be %zu (dev_t), but it was %zu\n",
+ sizeof(dev), dev_array->size);
+ piglit_report_result(PIGLIT_FAIL);
+ }
+
+ memcpy(&dev, dev_array->data, sizeof(dev));
+ fd = open_drm_by_devid(dev);
+ if (fd < 0) {
+ printf("Couldn't open DRM device for main_device\n");
+ piglit_report_result(PIGLIT_FAIL);
+ }
+
+ version = drmGetVersion(fd);
+ if (!version || !version->name_len || !version->name) {
+ printf("drmGetVersion failed\n");
+ piglit_report_result(PIGLIT_FAIL);
+ }
+
+ data->primary_driver_name = malloc(version->name_len + 1);
+ assert(data->primary_driver_name);
+ memcpy(data->primary_driver_name, version->name, version->name_len);
+ data->primary_driver_name[version->name_len] = '\0';
+
+ drmFreeVersion(version);
+ close(fd);
+}
+
+static void
+feedback_handle_tranche_done(void *_data,
+ struct zwp_linux_dmabuf_feedback_v1 *feedback)
+{
+ /* We don't care about the content of the format/modifier tranches */
+}
+
+static void
+feedback_handle_tranche_target_device(void *_data,
+ struct zwp_linux_dmabuf_feedback_v1 *feedback,
+ struct wl_array *dev_arr)
+{
+ /* We don't care about per-tranche target devices (e.g. scanout) */
+}
+
+static void
+feedback_handle_tranche_formats(void *_data,
+ struct zwp_linux_dmabuf_feedback_v1 *feedback,
+ struct wl_array *indices)
+{
+ /* We don't care about per-tranche formats */
+}
+
+static void
+feedback_handle_tranche_flags(void *_data,
+ struct zwp_linux_dmabuf_feedback_v1 *feedback,
+ uint32_t flags)
+{
+ /* We don't care about per-tranche flags */
+}
+
+static const struct zwp_linux_dmabuf_feedback_v1_listener feedback_listener = {
+ feedback_handle_done,
+ feedback_handle_format_table,
+ feedback_handle_main_device,
+ feedback_handle_tranche_done,
+ feedback_handle_tranche_target_device,
+ feedback_handle_tranche_formats,
+ feedback_handle_tranche_flags,
+};
+
+static void
+registry_handle_global(void *_data, struct wl_registry *registry,
+ uint32_t name, const char *interface, uint32_t version)
+{
+ struct wayland_display_target *data = _data;
+
+ if (strcmp(interface, "zwp_linux_dmabuf_v1") == 0 && version >= 4) {
+ data->dmabuf = wl_registry_bind(data->registry, name,
+ &zwp_linux_dmabuf_v1_interface,
+ MIN(version, 4));
+ data->feedback = zwp_linux_dmabuf_v1_get_default_feedback(data->dmabuf);
+ zwp_linux_dmabuf_feedback_v1_add_listener(data->feedback,
+ &feedback_listener,
+ data);
+ /* Need another roundtrip to collect the feedback events */
+ data->roundtrips_needed++;
+ }
+}
+
+static void
+registry_handle_remove(void *_data, struct wl_registry *registry, uint32_t name)
+{
+}
+
+static const struct wl_registry_listener registry_listener = {
+ registry_handle_global,
+ registry_handle_remove
+};
+
+
+int
+main(void)
+{
+ const char *expected_driver_name = NULL;
+ struct wayland_display_target data;
+
+ memset(&data, 0, sizeof(data));
+
+ expected_driver_name = getenv("PIGLIT_WAYLAND_EXPECTED_DRIVER");
+ if (!expected_driver_name) {
+ printf("$PIGLIT_WAYLAND_EXPECTED_DRIVER must be set to run this test\n");
+ piglit_report_result(PIGLIT_SKIP);
+ }
+
+ /* Connect to $WAYLAND_DISPLAY or $WAYLAND_SOCKET */
+ data.dpy = wl_display_connect(NULL);
+ if (!data.dpy) {
+ printf("Could not connect to Wayland display\n");
+ piglit_report_result(PIGLIT_SKIP);
+ }
+
+ /* The registry advertises the available interfaces */
+ data.registry = wl_display_get_registry(data.dpy);
+ assert(data.registry);
+ wl_registry_add_listener(data.registry, &registry_listener, &data);
+
+ /* Listen for the wl_registry advertisements to get supported interfaces */
+ wl_display_roundtrip(data.dpy);
+
+ if (!data.dmabuf) {
+ printf("zwp_linux_dmabuf_v1 is not available\n");
+ piglit_report_result(PIGLIT_SKIP);
+ }
+
+ /* Wait until we receive the zwp_linux_dmabuf_feedback_v1.done event */
+ while (!data.feedback_done)
+ wl_display_roundtrip(data.dpy);
+
+ if (!data.primary_driver_name ||
+ strcmp(data.primary_driver_name, expected_driver_name) != 0) {
+ printf("Got driver name %s, wanted %s\n", data.primary_driver_name,
+ expected_driver_name);
+ piglit_report_result(PIGLIT_FAIL);
+ }
+
+ free(data.primary_driver_name);
+ zwp_linux_dmabuf_feedback_v1_destroy(data.feedback);
+ zwp_linux_dmabuf_v1_destroy(data.dmabuf);
+ wl_registry_destroy(data.registry);
+ wl_display_disconnect(data.dpy);
+
+ piglit_report_result(PIGLIT_PASS);
+}