Re: [Piglit] [PATCH] arb_gl_spirv: simple test, use correct reference colors
On Thu, Dec 6, 2018 at 11:22 AM Alejandro Piñeiro wrote: > > It was using the same color for the base color, drawing color and > expected color. > > As we are here, we also remove the debug names, as the test should > work without names. > --- > .../execution/vs-ps-simple.shader_test| 23 +-- > 1 file changed, 6 insertions(+), 17 deletions(-) Reviewed-by: Józef Kucia > > diff --git a/tests/spec/arb_gl_spirv/execution/vs-ps-simple.shader_test > b/tests/spec/arb_gl_spirv/execution/vs-ps-simple.shader_test > index 88e38540f..dcaf01eba 100644 > --- a/tests/spec/arb_gl_spirv/execution/vs-ps-simple.shader_test > +++ b/tests/spec/arb_gl_spirv/execution/vs-ps-simple.shader_test > @@ -10,7 +10,7 @@ GLSL >= 4.50 > ; Automatically generated from the GLSL by shader_test_spirv.py. DO NOT EDIT > ; SPIR-V > ; Version: 1.0 > -; Generator: Khronos Glslang Reference Front End; 4 > +; Generator: Khronos Glslang Reference Front End; 7 > ; Bound: 24 > ; Schema: 0 > OpCapability Shader > @@ -18,16 +18,7 @@ GLSL >= 4.50 > OpMemoryModel Logical GLSL450 > OpEntryPoint Vertex %main "main" %_ %piglit_vertex > %gl_VertexID %gl_InstanceID > OpSource GLSL 450 > - OpName %main "main" > - OpName %gl_PerVertex "gl_PerVertex" > - OpMemberName %gl_PerVertex 0 "gl_Position" > - OpMemberName %gl_PerVertex 1 "gl_PointSize" > - OpMemberName %gl_PerVertex 2 "gl_ClipDistance" > - OpMemberName %gl_PerVertex 3 "gl_CullDistance" > OpName %_ "" > - OpName %piglit_vertex "piglit_vertex" > - OpName %gl_VertexID "gl_VertexID" > - OpName %gl_InstanceID "gl_InstanceID" > OpMemberDecorate %gl_PerVertex 0 BuiltIn Position > OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize > OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance > @@ -75,7 +66,7 @@ void main() { > ; Automatically generated from the GLSL by shader_test_spirv.py. DO NOT EDIT > ; SPIR-V > ; Version: 1.0 > -; Generator: Khronos Glslang Reference Front End; 4 > +; Generator: Khronos Glslang Reference Front End; 7 > ; Bound: 13 > ; Schema: 0 > OpCapability Shader > @@ -84,8 +75,6 @@ void main() { > OpEntryPoint Fragment %main "main" %outcolor > OpExecutionMode %main OriginLowerLeft > OpSource GLSL 450 > - OpName %main "main" > - OpName %outcolor "outcolor" > OpDecorate %outcolor Location 0 > %void = OpTypeVoid >%3 = OpTypeFunction %void > @@ -93,9 +82,9 @@ void main() { > %v4float = OpTypeVector %float 4 > %_ptr_Output_v4float = OpTypePointer Output %v4float > %outcolor = OpVariable %_ptr_Output_v4float Output > -%float_1 = OpConstant %float 1 > %float_0 = OpConstant %float 0 > - %12 = OpConstantComposite %v4float %float_1 %float_0 %float_0 > %float_0 > +%float_1 = OpConstant %float 1 > + %12 = OpConstantComposite %v4float %float_0 %float_1 %float_0 > %float_1 > %main = OpFunction %void None %3 >%5 = OpLabel > OpStore %outcolor %12 > @@ -108,7 +97,7 @@ void main() { > layout(location = 0) out vec4 outcolor; > > void main() { > -outcolor = vec4(1.0, 0.0, 0.0, 0.0); > +outcolor = vec4(0.0, 1.0, 0.0, 1.0); > } > > [test] > @@ -116,4 +105,4 @@ clear color 1.0 0.0 0.0 0.0 > clear > > draw rect -1 -1 2 2 > -probe all rgba 1.0 0.0 0.0 0.0 > +probe all rgba 0.0 1.0 0.0 1.0 > -- > 2.19.1 > > ___ > Piglit mailing list > Piglit@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/piglit ___ Piglit mailing list Piglit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/piglit
Re: [Piglit] [PATCH crucible] Add a test for bug 108909
On Tue, Dec 4, 2018 at 3:46 PM Lionel Landwerlin wrote: > > Signed-off-by: Lionel Landwerlin > --- > Makefile.am| 1 + > src/tests/bug/108909.c | 106 + > 2 files changed, 107 insertions(+) > create mode 100644 src/tests/bug/108909.c > > diff --git a/Makefile.am b/Makefile.am > index b35e329..528650a 100644 > --- a/Makefile.am > +++ b/Makefile.am > @@ -74,6 +74,7 @@ bin_crucible_SOURCES = \ > src/qonos/qonos.c \ > src/qonos/qonos_pipeline.c \ > src/tests/bug/104809.c \ > + src/tests/bug/108909.c \ > src/tests/bench/copy-buffer.c \ > src/tests/example/basic.c \ > src/tests/example/images.c \ > diff --git a/src/tests/bug/108909.c b/src/tests/bug/108909.c > new file mode 100644 > index 000..1faadbf > --- /dev/null > +++ b/src/tests/bug/108909.c > @@ -0,0 +1,106 @@ > +// 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 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 > +#include > +#include "tapi/t.h" > +#include "util/misc.h" > + > +/* This is a test for https://bugs.freedesktop.org/show_bug.cgi?id=108909 > + * > + * Ensure ordering of operations for between 3d pipeline and command > + * streamer on Intel HW. > + */ > + > +static void > +test(void) > +{ > +const uint64_t initialData[] = { > +0xdeaddeadbeef, > +0xdeaddeadbeef, > +0xdeaddeadbeef, > +0xdeaddeadbeef, > +}; > +VkBuffer dataBuffer = qoCreateBuffer(t_device, > + .size = sizeof(initialData), > + .usage = > VK_BUFFER_USAGE_TRANSFER_SRC_BIT); > +VkDeviceMemory dataMem = qoAllocBufferMemory(t_device, dataBuffer, > + .properties = > VK_MEMORY_PROPERTY_HOST_COHERENT_BIT | > + > VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT); > +memcpy(qoMapMemory(t_device, dataMem, /*offset*/ 0, > + sizeof(initialData), /*flags*/ 0), > + initialData, > + sizeof(initialData)); > +qoBindBufferMemory(t_device, dataBuffer, dataMem, /*offset*/ 0); > + > +VkBuffer resultBuffer = qoCreateBuffer(t_device, > +.size = sizeof(initialData), > +.usage = > VK_BUFFER_USAGE_TRANSFER_DST_BIT); > +VkDeviceMemory resultMem = qoAllocBufferMemory(t_device, resultBuffer, > + .properties = > VK_MEMORY_PROPERTY_HOST_COHERENT_BIT | > + > VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT); > +qoBindBufferMemory(t_device, resultBuffer, resultMem, /*offset*/ 0); > + > +VkQueryPool pool = qoCreateQueryPool(t_device, > + .queryType = > VK_QUERY_TYPE_TIMESTAMP, > + .queryCount = > ARRAY_LENGTH(initialData)); > + > + > +/* vkCmdCopyQueryPoolResults should be ordered with regard to > vkCmdCopyBuffer. */ > +VkCommandBuffer cmdBuffer = qoAllocateCommandBuffer(t_device, > t_cmd_pool); > +qoBeginCommandBuffer(cmdBuffer); > +vkCmdWriteTimestamp(cmdBuffer, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, pool, > 0); > +vkCmdWriteTimestamp(cmdBuffer, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, pool, > 1); > +vkCmdCopyBuffer(cmdBuffer, dataBuffer, resultBuffer, > +1, &(VkBufferCopy){ .srcOffset = 0, .dstOffset = 0, > .size = sizeof(initialData) }); > +vkCmdWriteTimestamp(cmdBuffer, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, pool, > 2); > +vkCmdWriteTimestamp(cmdBuffer, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, pool, > 3); > +vkCmdCopyQueryPoolResults(cmdBuffer, pool, /*firstQuery*/ 0, > /*queryCount*/ 4, > +
Re: [Piglit] [PATCH] arb_gl_spirv: add test for uniform blocks with the same structure
On Sat, Nov 24, 2018 at 9:17 AM apinheiro wrote: > Then do you think that your test is still needed? An alternative, as we > didn't add any compute shader using ubo/ssbo, would be rename and update > the description of your test (something like "compute shader using ubo"). No, my test shouldn't be needed when we have another test which also reproduced the Nvidia driver bug. > > Also if you are interested to get those tests integrated, you can just > take a look an review them, wink wink I'll try to find time to review, at least, some of those tests. ___ Piglit mailing list Piglit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/piglit
Re: [Piglit] [PATCH] arb_gl_spirv: add test for uniform blocks with the same structure
On Thu, Nov 22, 2018 at 11:21 AM apinheiro wrote: > some weeks ago I sent a series with ubo/ssbo tests (still pending review) > > https://lists.freedesktop.org/archives/piglit/2018-September/025116.html > > All those has the name stripped. Could you try them and see if any of > them triggers the NVIDIA bug you found? arb_gl_spirv @ execution @ ubo @ matrix @ column-vs-row.shader_test triggers the NVIDIA bug. BTW, where can I find the "shader_test_spirv.py" script? Thanks, Józef ___ Piglit mailing list Piglit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH] arb_gl_spirv: add test for uniform blocks with the same structure
This test reproduces a bug in Nvidia drivers: error: binding mismatch between shaders for UBO (named __defaultname) error: struct type mismatch between shaders for uniform (named __defaultname) error: binding mismatch between shaders for UBO (named __defaultname) error: struct type mismatch between shaders for uniform (named __defaultname) error: binding mismatch between shaders for UBO (named __defaultname) error: struct type mismatch between shaders for uniform (named __defaultname) error: binding mismatch between shaders for UBO (named __defaultname) error: struct type mismatch between shaders for uniform (named __defaultname) The same issue is also present when SPIR-V debug names for uniform blocks are the same. --- .../unnamed-uniform-blocks.shader_test| 67 +++ 1 file changed, 67 insertions(+) create mode 100644 tests/spec/arb_gl_spirv/linker/uniform/unnamed-uniform-blocks.shader_test diff --git a/tests/spec/arb_gl_spirv/linker/uniform/unnamed-uniform-blocks.shader_test b/tests/spec/arb_gl_spirv/linker/uniform/unnamed-uniform-blocks.shader_test new file mode 100644 index ..9dba7d44c37d --- /dev/null +++ b/tests/spec/arb_gl_spirv/linker/uniform/unnamed-uniform-blocks.shader_test @@ -0,0 +1,67 @@ +# Test unnamed uniform blocks with the same structure + +[require] +SPIRV YES +GL >= 3.3 +GLSL >= 4.50 + +[compute shader spirv] +; SPIR-V +; Version: 1.0 +; Generator: Khronos Glslang Reference Front End; 7 +; Bound: 33 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "GLSL.std.450" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %4 "main" + OpExecutionMode %4 LocalSize 1 1 1 + OpDecorate %9 Location 2 + OpDecorate %9 DescriptorSet 0 + OpDecorate %_arr_v4uint_uint_4 ArrayStride 16 + OpMemberDecorate %_struct_18 0 Offset 0 + OpDecorate %_struct_18 Block + OpDecorate %20 DescriptorSet 0 + OpDecorate %20 Binding 0 + OpDecorate %_arr_v4uint_uint_4_0 ArrayStride 16 + OpMemberDecorate %_struct_26 0 Offset 0 + OpDecorate %_struct_26 Block + OpDecorate %28 DescriptorSet 0 + OpDecorate %28 Binding 1 + %void = OpTypeVoid + %3 = OpTypeFunction %void + %uint = OpTypeInt 32 0 + %7 = OpTypeImage %uint 2D 0 0 0 2 Rgba32ui +%_ptr_UniformConstant_7 = OpTypePointer UniformConstant %7 + %9 = OpVariable %_ptr_UniformConstant_7 UniformConstant +%int = OpTypeInt 32 1 + %v2int = OpTypeVector %int 2 + %int_0 = OpConstant %int 0 + %14 = OpConstantComposite %v2int %int_0 %int_0 + %v4uint = OpTypeVector %uint 4 + %uint_4 = OpConstant %uint 4 +%_arr_v4uint_uint_4 = OpTypeArray %v4uint %uint_4 + %_struct_18 = OpTypeStruct %_arr_v4uint_uint_4 +%_ptr_Uniform__struct_18 = OpTypePointer Uniform %_struct_18 + %20 = OpVariable %_ptr_Uniform__struct_18 Uniform + %uint_0 = OpConstant %uint 0 +%_ptr_Uniform_uint = OpTypePointer Uniform %uint +%_arr_v4uint_uint_4_0 = OpTypeArray %v4uint %uint_4 + %_struct_26 = OpTypeStruct %_arr_v4uint_uint_4_0 +%_ptr_Uniform__struct_26 = OpTypePointer Uniform %_struct_26 + %28 = OpVariable %_ptr_Uniform__struct_26 Uniform + %4 = OpFunction %void None %3 + %5 = OpLabel + %10 = OpLoad %7 %9 + %23 = OpAccessChain %_ptr_Uniform_uint %20 %int_0 %int_0 %uint_0 + %24 = OpLoad %uint %23 + %29 = OpAccessChain %_ptr_Uniform_uint %28 %int_0 %int_0 %uint_0 + %30 = OpLoad %uint %29 + %31 = OpIAdd %uint %24 %30 + %32 = OpCompositeConstruct %v4uint %31 %31 %31 %31 + OpImageWrite %10 %14 %32 + OpReturn + OpFunctionEnd + +[test] +link success -- 2.18.1 ___ Piglit mailing list Piglit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH] glsl-1.50: Add test for geometry shader with unused outputs
Reproduces a GPU hang on radeonsi. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107857 Signed-off-by: Józef Kucia --- .../geometry/gs-point-unused-outputs.shader_test | 40 ++ 1 file changed, 40 insertions(+) create mode 100644 tests/spec/glsl-1.50/execution/geometry/gs-point-unused-outputs.shader_test diff --git a/tests/spec/glsl-1.50/execution/geometry/gs-point-unused-outputs.shader_test b/tests/spec/glsl-1.50/execution/geometry/gs-point-unused-outputs.shader_test new file mode 100644 index ..4001e9749575 --- /dev/null +++ b/tests/spec/glsl-1.50/execution/geometry/gs-point-unused-outputs.shader_test @@ -0,0 +1,40 @@ +[require] +GLSL >= 1.50 + +[vertex shader] +#version 150 + +in vec4 pos; +out vec4 color; + +void main() { + gl_Position = pos; + color = vec4(1, 1, 1, 1); +} + +[geometry shader] +#version 150 + +layout (points) in; +layout (points, max_vertices = 1) out; + +in vec4 color[]; +out vec4 out_position; +out vec4 out_color; + +void main() { + out_position = gl_in[0].gl_Position; + out_color = color[0]; + EmitVertex(); +} + +[vertex data] +pos/float/4 +1.0 1.0 1.0 1.0 +1.0 1.0 1.0 1.0 + +[test] +clear color 1 1 1 1 +clear + +draw arrays GL_POINTS 0 2 -- 2.16.4 ___ Piglit mailing list Piglit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH] arb_viewport_array: add test for fractional viewport coordinates
In Direct3D 11, negative fractional viewport coordinates shift the bottom right corner by a whole integer. Some OpenGL drivers seem to implement Direct3D 11 behavior. The test fails on i965 and Nvidia binary driver. It succeeds on radeonsi. --- The test exercises a bug in i965. I don't have commit access. --- tests/opengl.py| 1 + tests/spec/arb_viewport_array/CMakeLists.gl.txt| 1 + .../spec/arb_viewport_array/fractional_viewport.c | 94 ++ 3 files changed, 96 insertions(+) create mode 100644 tests/spec/arb_viewport_array/fractional_viewport.c diff --git a/tests/opengl.py b/tests/opengl.py index 347e8c5d4009..7605fe5d990d 100644 --- a/tests/opengl.py +++ b/tests/opengl.py @@ -2693,6 +2693,7 @@ with profile.test_list.group_manager( g(['arb_viewport_array-render-depthrange'], 'render-depthrange') g(['arb_viewport_array-render-scissor'], 'render-scissor') g(['arb_viewport_array-clear'], 'clear') +g(['arb_viewport_array-fractional-viewport'], 'fractional-viewport') with profile.test_list.group_manager( PiglitGLTest, diff --git a/tests/spec/arb_viewport_array/CMakeLists.gl.txt b/tests/spec/arb_viewport_array/CMakeLists.gl.txt index 85715774c674..5abb23d3e6bf 100644 --- a/tests/spec/arb_viewport_array/CMakeLists.gl.txt +++ b/tests/spec/arb_viewport_array/CMakeLists.gl.txt @@ -20,5 +20,6 @@ piglit_add_executable(arb_viewport_array-render-viewport render_viewport.c) piglit_add_executable(arb_viewport_array-render-viewport-2 render_viewport_2.c) piglit_add_executable(arb_viewport_array-render-depthrange render_depthrange.c) piglit_add_executable(arb_viewport_array-render-scissor render_scissor.c) +piglit_add_executable(arb_viewport_array-fractional-viewport fractional_viewport.c) # vim: ft=cmake: diff --git a/tests/spec/arb_viewport_array/fractional_viewport.c b/tests/spec/arb_viewport_array/fractional_viewport.c new file mode 100644 index ..1c4a9da941f2 --- /dev/null +++ b/tests/spec/arb_viewport_array/fractional_viewport.c @@ -0,0 +1,94 @@ +/* + * Copyright (c) 2018 Józef Kucia <joseph.ku...@gmail.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. + * + */ + +/** + * Tests rendering with negative fractional viewport coordinates. + */ +#include "piglit-util-gl.h" + +PIGLIT_GL_TEST_CONFIG_BEGIN + + config.supports_gl_compat_version = 33; + config.supports_gl_core_version = 33; + + config.window_visual = PIGLIT_GL_VISUAL_RGBA | PIGLIT_GL_VISUAL_DOUBLE; + config.khr_no_error_support = PIGLIT_NO_ERRORS; + +PIGLIT_GL_TEST_CONFIG_END + +static const char *vs = + "#version 150\n" + "in vec4 piglit_vertex;\n" + "void main() { \n" + " gl_Position = piglit_vertex;\n" + "}\n"; + +static const char *fs = + "#version 150\n" + "out vec4 color;\n" + "void main() {\n" + " color = uvec4(0.0f, 1.0f, 0.0f, 1.0f);\n" + "}\n"; + +static bool +draw_fractional_viewport(void) +{ + static const float green[] = {0.0f, 1.0f, 0.0f, 1.0f}; + + glViewport(0, 0, piglit_width, piglit_height); /* for glClear() */ + glClear(GL_COLOR_BUFFER_BIT); + + glViewportIndexedf(0, -0.4f, -0.4f, piglit_width, piglit_height); + piglit_draw_rect(-1, -1, 2, 2); + return piglit_probe_rect_rgba(0, 0, piglit_width, piglit_height, green); +} + +enum piglit_result +piglit_display(void) +{ + bool pass = true; + + pass = draw_fractional_viewport(); + pass = piglit_check_gl_error(GL_NO_ERROR) && pass; + piglit_present_results(); + return pass ? PIGLIT_PASS : PIGLIT_FAIL; +} + +void +piglit_init(int argc, char **argv) +{ + GLuint program; +
[Piglit] [Crucible] [PATCH 2/2] Add test for separate bind points
Currently fails with Anv. Passes with Nvidia. --- Makefile.am | 2 + src/tests/func/bind-points.c | 415 +++ 2 files changed, 417 insertions(+) create mode 100644 src/tests/func/bind-points.c diff --git a/Makefile.am b/Makefile.am index 0478868..e99a636 100644 --- a/Makefile.am +++ b/Makefile.am @@ -88,6 +88,7 @@ bin_crucible_SOURCES = \ src/tests/func/gs/basic.c \ src/tests/func/query/timestamp.c \ src/tests/func/first.c \ + src/tests/func/bind-points.c \ src/tests/func/compute.c \ src/tests/func/compute-local-id.c \ src/tests/func/compute-num-workgroups.c \ @@ -125,6 +126,7 @@ BUILT_SOURCES = \ src/tests/func/draw-indexed-spirv.h \ src/tests/func/gs/basic-spirv.h \ src/tests/func/first-spirv.h \ + src/tests/func/bind-points-spirv.h \ src/tests/func/compute-spirv.h \ src/tests/func/compute-local-id-spirv.h \ src/tests/func/compute-num-workgroups-spirv.h \ diff --git a/src/tests/func/bind-points.c b/src/tests/func/bind-points.c new file mode 100644 index 000..7e2b1d0 --- /dev/null +++ b/src/tests/func/bind-points.c @@ -0,0 +1,415 @@ +// 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. + +#include "tapi/t.h" + +#include "bind-points-spirv.h" + +static void +test_bind_points(void) +{ +VkResult result; + +VkDescriptorSetLayout compute_set_layout; +compute_set_layout = qoCreateDescriptorSetLayout(t_device, +.bindingCount = 2, +.pBindings = (VkDescriptorSetLayoutBinding[]) { +{ +.binding = 0, +.descriptorType = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, +.descriptorCount = 1, +.stageFlags = VK_SHADER_STAGE_COMPUTE_BIT, +.pImmutableSamplers = NULL, +}, +{ +.binding = 1, +.descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, +.descriptorCount = 1, +.stageFlags = VK_SHADER_STAGE_COMPUTE_BIT, +.pImmutableSamplers = NULL, +}, +}); + +VkPipelineLayout compute_pipeline_layout = qoCreatePipelineLayout(t_device, +.setLayoutCount = 1, +.pSetLayouts = _set_layout); + +VkShaderModule cs = qoCreateShaderModuleGLSL(t_device, COMPUTE, +layout(set = 0, binding = 0) uniform block1 { +vec4 data[3]; +} u; +layout(set = 0, binding = 1, std430) buffer block2 { +vec4 data[]; +} ssbo; + +layout (local_size_x = 1) in; +void main() +{ +for (uint i = 0; i < 3; ++i) +ssbo.data[i] = u.data[i]; +} +); + +VkPipeline compute_pipeline; +result = vkCreateComputePipelines(t_device, t_pipeline_cache, 1, +&(VkComputePipelineCreateInfo) { +.sType = VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO, +.pNext = NULL, +.stage = { +.sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO, +.stage = VK_SHADER_STAGE_COMPUTE_BIT, +.module = cs, +.pName = "main", +}, +.flags = 0, +.layout = compute_pipeline_layout, +}, NULL, _pipeline); +t_assert(result == VK_SUCCESS); + +VkDescriptorSetLayout graphics_set_layout; +graphics_set_layout = qoCreateDescriptorSetLayout(t_device, +.bindingCount = 2, +.pBindings = (VkDescriptorSetLayoutBinding[]) { +{ +.binding = 0, +.descriptorType = VK_DESCRIPTOR_TYPE_SAMPLER, +.descriptorCount = 1, +.stageFlags = VK_SHADER_STAGE_FRAGMENT_BIT, +.pImmutableSamplers = NULL, +}, +{ +
[Piglit] [Crucible] [PATCH 1/2] func.compute.num-workgroups.basic: Properly begin recording commands
Fixes crash on Nvidia. --- src/tests/func/compute-num-workgroups.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/tests/func/compute-num-workgroups.c b/src/tests/func/compute-num-workgroups.c index 35cae17..1ad45fc 100644 --- a/src/tests/func/compute-num-workgroups.c +++ b/src/tests/func/compute-num-workgroups.c @@ -136,6 +136,7 @@ dispatch_and_wait(CTX *ctx) qoQueueWaitIdle(t_queue); vkResetCommandBuffer(t_cmd_buffer, 0); +qoBeginCommandBuffer(t_cmd_buffer); } static void -- 2.13.5 ___ Piglit mailing list Piglit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/piglit
Re: [Piglit] [Crucible] [PATCH 2/2] qonos: Create empty layouts for graphics pipelines
On Sat, Sep 9, 2017 at 9:15 PM, Józef Kucia <joseph.ku...@gmail.com> wrote: > The layout must be a valid VkPipelineLayout handle. > --- > src/qonos/qonos_pipeline.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/src/qonos/qonos_pipeline.c b/src/qonos/qonos_pipeline.c > index c95a937..f7600a4 100644 > --- a/src/qonos/qonos_pipeline.c > +++ b/src/qonos/qonos_pipeline.c > @@ -264,6 +264,9 @@ qoCreateGraphicsPipeline(VkDevice device, > }; > } > > +if (!pipeline_info.layout) > +pipeline_info.layout = qoCreatePipelineLayout(device); > + > result = vkCreateGraphicsPipelines(device, pipeline_cache, > 1, _info, NULL, ); > > -- This fixes some validation errors in a few tests. It is invalid to use VK_NULL_HANDLE as the pipeline layout. An empty pipeline layout is what we want to use when shaders do not need push constants and descriptors. I do not have commit access. If someone review this change, please push the series for me. ___ Piglit mailing list Piglit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [Crucible] [PATCH 1/2] build: Do not overwrite user variables
Allows passing CPPFLAGS, CFLAGS and CXXFLAGS to configure. --- I am not sure if this is the best place to submit patches for Crucible. --- Makefile.am | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile.am b/Makefile.am index 656ee22..0478868 100644 --- a/Makefile.am +++ b/Makefile.am @@ -21,7 +21,7 @@ export CRUCIBLE_TOP := $(srcdir) -CPPFLAGS = \ +AM_CPPFLAGS = \ $(MESA_CPPFLAGS) \ -D_DEFAULT_SOURCE \ -D_GNU_SOURCE \ @@ -37,13 +37,13 @@ common_CFLAGS = -Wall -O0 -g3 \ $(LIBXML2_CFLAGS) \ $(NULL) -CFLAGS = -std=gnu11 \ +AM_CFLAGS = -std=gnu11 \ $(common_CFLAGS) \ -Werror=implicit-function-declaration \ -Werror=implicit-int \ -Werror=missing-prototypes -CXXFLAGS = -std=c++11 $(common_CFLAGS) +AM_CXXFLAGS = -std=c++11 $(common_CFLAGS) noinst_PROGRAMS = \ bin/crucible -- 2.13.5 ___ Piglit mailing list Piglit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/piglit
Re: [Piglit] [PATCH] glsl-1.50: add linker test for unused in out blocks
On Tue, May 30, 2017 at 4:23 PM, Józef Kucia <joseph.ku...@gmail.com> wrote: > This test exposes a Mesa GLSL linker bug. The test fails with the > following error message: > > error: Input block `blk' is not an output of the previous stage > > Section 4.3.4 (Inputs) of the GLSL 1.50 spec says: > > "Only the input variables that are actually read need to be written > by the previous stage; it is allowed to have superfluous > declarations of input variables." > --- > .../interstage-multiple-shader-objects.shader_test | 38 > ++ > 1 file changed, 38 insertions(+) > create mode 100644 > tests/spec/glsl-1.50/linker/interstage-multiple-shader-objects.shader_test Ping. Could someone take a look? ___ Piglit mailing list Piglit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/piglit
Re: [Piglit] [PATCH v5] pbo: Change the value expected from GetPixelMap. This fixes tests/spec/gl-2.1/pbo on Windows Intel driver.
You should fix the commit message. The subject should be shorter. Additional comments can be put in a longer description after the short summary line. See, e.g. https://www.mesa3d.org/submittingpatches.html for guidelines. On Thu, Jun 8, 2017 at 5:32 PM, Sandra Koroniewskawrote: > --- > tests/spec/gl-2.1/pbo.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/tests/spec/gl-2.1/pbo.c b/tests/spec/gl-2.1/pbo.c > index bb4c0352c..313afcc93 100644 > --- a/tests/spec/gl-2.1/pbo.c > +++ b/tests/spec/gl-2.1/pbo.c > @@ -353,7 +353,7 @@ test_pixel_map(void) > } > > for (i = 0; i < max; i++) { > - if (pbo_mem[i] != (255 - i)) { > + if (pbo_mem[i] != (max- i - 1)) { Parentheses shouldn't be needed. Also, please put a space between operators. > REPORT_FAILURE("get PixelMap failed"); > return PIGLIT_FAIL; > } Other than that, the patch looks good to me. ___ Piglit mailing list Piglit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/piglit
Re: [Piglit] [PATCH v3] pbo: delete unmapping the GL_PIXEL_UNPACK_BUFFER before using it and correct the data expected form glGetMapusv This fixes tests/spec/gl-2.1/pbo on Windows Intel driver. Accord
On Thu, Jun 1, 2017 at 1:11 PM, sandra koroniewskawrote: > Hi, > this change fixes a real problem for me (a crash on an Intel driver). > I don't know if I understand this right, but for glPixelMap there is written > in a spec (core 2.1, page 117): "If a pixel unpack buffer is bound (as > indicated by a non-zero value of PIXEL UNPACK BUFFER BINDING), values is an > offset into the pixel unpack buffer; otherwise, values is a pointer to > client memory" > > There is a call after glUnmapBuffer: > glPixelMapusv(GL_PIXEL_MAP_R_TO_R, max, NULL); > > So I understand that this "NULL" is an offset into the pixel unpack buffer, > because it doesn't look like a pointer to client memory. But when I unmap > it, the pointer is invalid, so there is a crash in this function. > Tell me if I'm wrong, but I'm not sure if pbo_mem is not used. PIXEL UNPACK BUFFER BINDING is changed using glBindBuffer() command. glUnmapBuffer() does not modify buffer bindings. ___ Piglit mailing list Piglit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/piglit
Re: [Piglit] [PATCH] glsl-1.50: add linker test for unused in out blocks
On Wed, May 31, 2017 at 9:42 PM, Ian Romanick <i...@freedesktop.org> wrote: > On 05/30/2017 07:23 AM, Józef Kucia wrote: >> This test exposes a Mesa GLSL linker bug. The test fails with the > > Is there a bugzilla for this issue? Was this encountered in a app or ... ? I filed a bug report for this issue today. It's bug 101247 [1]. >> following error message: >> >> error: Input block `blk' is not an output of the previous stage >> >> Section 4.3.4 (Inputs) of the GLSL 1.50 spec says: >> >> "Only the input variables that are actually read need to be written >> by the previous stage; it is allowed to have superfluous >> declarations of input variables." > > There are some additional rules for separate shader objects programs, > and it sounds like we may be applying them too broadly. > >> --- >> .../interstage-multiple-shader-objects.shader_test | 38 >> ++ >> 1 file changed, 38 insertions(+) >> create mode 100644 >> tests/spec/glsl-1.50/linker/interstage-multiple-shader-objects.shader_test >> >> diff --git >> a/tests/spec/glsl-1.50/linker/interstage-multiple-shader-objects.shader_test >> b/tests/spec/glsl-1.50/linker/interstage-multiple-shader-objects.shader_test >> new file mode 100644 >> index 000..66a46d5 >> --- /dev/null >> +++ >> b/tests/spec/glsl-1.50/linker/interstage-multiple-shader-objects.shader_test >> @@ -0,0 +1,38 @@ >> +# Exercises a Mesa GLSL linker bug. >> +# >> +# Note that the output block is not used and it is not declared in the main >> +# shader object. >> + >> +[require] >> +GLSL >= 1.50 >> + >> +[vertex shader] >> +out blk { >> + vec4 foo; >> +} inst; >> + >> +void set_output(vec4 v) >> +{ >> + gl_Position = v; >> +} >> + >> +[vertex shader] > > Are there supposed to be two vertex shaders? Is that necessary to > reproduce the link failure? Two vertex shaders are necessary to reproduce the link failure. My understanding of the issue is that when an output block is declared in a shader object other than the one with the main() function, and the output block is unused then there won't be any trace of the original block declaration in the linked shader produced by link_intrastage_shaders(). The linker fails while trying to find the matching output block in the linked shader. However, a stronger test case is probably also a valid GLSL program. My understanding of the GL spec suggests that a similar GLSL program should link even if the matching output block is not declared in a vertex shader at all, because there is no static use of the input block in the fragment shader. [1] - https://bugs.freedesktop.org/show_bug.cgi?id=101247 ___ Piglit mailing list Piglit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH] glsl-1.50: add linker test for unused in out blocks
This test exposes a Mesa GLSL linker bug. The test fails with the following error message: error: Input block `blk' is not an output of the previous stage Section 4.3.4 (Inputs) of the GLSL 1.50 spec says: "Only the input variables that are actually read need to be written by the previous stage; it is allowed to have superfluous declarations of input variables." --- .../interstage-multiple-shader-objects.shader_test | 38 ++ 1 file changed, 38 insertions(+) create mode 100644 tests/spec/glsl-1.50/linker/interstage-multiple-shader-objects.shader_test diff --git a/tests/spec/glsl-1.50/linker/interstage-multiple-shader-objects.shader_test b/tests/spec/glsl-1.50/linker/interstage-multiple-shader-objects.shader_test new file mode 100644 index 000..66a46d5 --- /dev/null +++ b/tests/spec/glsl-1.50/linker/interstage-multiple-shader-objects.shader_test @@ -0,0 +1,38 @@ +# Exercises a Mesa GLSL linker bug. +# +# Note that the output block is not used and it is not declared in the main +# shader object. + +[require] +GLSL >= 1.50 + +[vertex shader] +out blk { + vec4 foo; +} inst; + +void set_output(vec4 v) +{ + gl_Position = v; +} + +[vertex shader] +void set_output(vec4 v); + +void main() +{ + set_output(vec4(1.0)); +} + +[fragment shader] +in blk { + vec4 foo; +} inst; + +void main() +{ + gl_FragColor = vec4(1.0); +} + +[test] +link success -- 2.10.2 ___ Piglit mailing list Piglit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH] arb_texture_view: add simple test for rendering to R32UI texture view
This test exposes a Radeonsi driver bug. The test works on Nvidia binary driver and Mesa Intel (Broadwell). It fails on Radeonsi with Cape Verde GPU. --- tests/all.py | 1 + tests/spec/arb_texture_view/CMakeLists.gl.txt | 1 + tests/spec/arb_texture_view/rendering-r32ui.c | 101 ++ 3 files changed, 103 insertions(+) create mode 100644 tests/spec/arb_texture_view/rendering-r32ui.c diff --git a/tests/all.py b/tests/all.py index 38aabc1..f0a7c05 100644 --- a/tests/all.py +++ b/tests/all.py @@ -2613,6 +2613,7 @@ with profile.test_list.group_manager( g(['arb_texture_view-rendering-levels'], 'rendering-levels') g(['arb_texture_view-rendering-layers'], 'rendering-layers') g(['arb_texture_view-rendering-formats'], 'rendering-formats') +g(['arb_texture_view-rendering-r32ui'], 'rendering-r32ui') g(['arb_texture_view-lifetime-format'], 'lifetime-format') g(['arb_texture_view-getteximage-srgb'], 'getteximage-srgb') g(['arb_texture_view-texsubimage-levels'], 'texsubimage-levels') diff --git a/tests/spec/arb_texture_view/CMakeLists.gl.txt b/tests/spec/arb_texture_view/CMakeLists.gl.txt index 47b3320..39330da 100644 --- a/tests/spec/arb_texture_view/CMakeLists.gl.txt +++ b/tests/spec/arb_texture_view/CMakeLists.gl.txt @@ -23,6 +23,7 @@ piglit_add_executable(arb_texture_view-queries queries.c) piglit_add_executable(arb_texture_view-rendering-formats rendering-formats.c) piglit_add_executable(arb_texture_view-rendering-layers rendering_layers.c common.c) piglit_add_executable(arb_texture_view-rendering-levels rendering_levels.c common.c) +piglit_add_executable(arb_texture_view-rendering-r32ui rendering-r32ui.c) piglit_add_executable(arb_texture_view-rendering-target rendering_target.c common.c) piglit_add_executable(arb_texture_view-sampling-2d-array-as-2d-layer sampling-2d-array-as-2d-layer.c) piglit_add_executable(arb_texture_view-sampling-2d-array-as-cubemap-array sampling-2d-array-as-cubemap-array.c) diff --git a/tests/spec/arb_texture_view/rendering-r32ui.c b/tests/spec/arb_texture_view/rendering-r32ui.c new file mode 100644 index 000..4a4037b --- /dev/null +++ b/tests/spec/arb_texture_view/rendering-r32ui.c @@ -0,0 +1,101 @@ +/* + * Copyright (c) 2017 Józef Kucia <joseph.ku...@gmail.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. + */ + +/** + * \file rendering-r32ui.c + * Exercises a Radeonsi bug. + */ + +#include "piglit-util-gl.h" + +PIGLIT_GL_TEST_CONFIG_BEGIN + +config.supports_gl_compat_version = 30; +config.window_visual = PIGLIT_GL_VISUAL_RGBA | PIGLIT_GL_VISUAL_DOUBLE; + +PIGLIT_GL_TEST_CONFIG_END + +static const char *vs = + "#version 130\n" + "void main() { \n" + " gl_Position = gl_Vertex;\n" + "}\n"; + +static const char *ps = + "#version 130\n" + "out uvec4 color;\n" + "void main() {\n" + " color = uvec4(0xff, 0, 0, 0);\n" + "}\n"; + +#define TEX_SIZE 64 + +enum piglit_result +piglit_display(void) +{ + return PIGLIT_FAIL; +} + +void +piglit_init(int argc, char **argv) +{ + GLuint tex, view, framebuffer, prog; + GLuint data[TEX_SIZE * TEX_SIZE]; + bool pass = true; + + piglit_require_gl_version(30); + piglit_require_extension("GL_ARB_texture_view"); + + glGenTextures(1, ); + glBindTexture(GL_TEXTURE_2D, tex); + glTexStorage2D(GL_TEXTURE_2D, 1, GL_R32F, TEX_SIZE, TEX_SIZE); + + glGenTextures(1, ); + glTextureView(view, GL_TEXTURE_2D, tex, GL_R32UI, 0, 1, 0, 1); + + glGenFramebuffers(1, ); + glBindFramebuffer(GL_FRAMEBUFFER, framebuffer); + glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, + GL_TEXTURE
Re: [Piglit] [PATCH v3] pbo: delete unmapping the GL_PIXEL_UNPACK_BUFFER before using it and correct the data expected form glGetMapusv This fixes tests/spec/gl-2.1/pbo on Windows Intel driver. Accord
Hi Sandra, On Thu, May 25, 2017 at 4:38 PM, sandra koroniewskawrote: > Hi Józef, > sorry for responding here, but I didn't manage to send the corrections in > response to your previous mail. Thanks for your answer. The fragment of your > previous mail is: > > When it comes to unmapping the buffer, I don't know if I'm thinking right, > but I read in OpenGL 4.5 spec that "Unmapping a mapped buffer object > invalidates the pointer to its data store" and glUnmapBuffer is using a > pointer to GL_PIXEL_UNPACK_BUFFER. In this case, glUnmapBuffer() invalidates the "pbo_mem" pointer which was returned by the previous call to glMapBuffer(). After the call to glUnmapBuffer() the "pbo_mem" pointer is not used so I don't see a reason to remove this glUnmapBuffer() call. The glPixelMapusv() calls in the test use a buffer bound to GL_PIXEL_UNPACK_BUFFER, but the buffer doesn't have to be mapped. Does your change fix a real problem for you? Thanks, Józef ___ Piglit mailing list Piglit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/piglit
Re: [Piglit] [PATCH] pbo: delete unmapping the GL_PIXEL_UNPACK_BUFFER before using it and correct the data expected form glGetMapusv
On Fri, May 5, 2017 at 1:45 PM, Sandra Koroniewskawrote: > This fixes tests/spec/gl-2.1/pbo on Windows Intel driver. According to OpenGL > 2.1 spec, page 38 "Unmapping a mapped buffer > object invalidates the pointers to its data store and sets the object’s > BUFFER MAPPED state to FALSE and its BUFFER MAP POINTER state to NULL." and > to page 251 about GetPixelMap "If a pixel pack buffer is bound (as indicated > by a non-zero value of > PIXEL PACK BUFFER BINDING), data is an offset into the pixel pack buffer; > otherwise, > data is a pointer to client memory". > --- > tests/spec/gl-2.1/pbo.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/tests/spec/gl-2.1/pbo.c b/tests/spec/gl-2.1/pbo.c > index bb4c0352c..1b561f7cb 100644 > --- a/tests/spec/gl-2.1/pbo.c > +++ b/tests/spec/gl-2.1/pbo.c > @@ -305,7 +305,6 @@ test_pixel_map(void) > pbo_mem[i] = max - i - 1; > > if (use_unpack) { > - glUnmapBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB); This change is suspicious. The buffer was mapped to fill it with values above, and it can be safely unmapped at this point. Why do you need this change? > glPixelMapusv(GL_PIXEL_MAP_R_TO_R, max, NULL); > glPixelMapusv(GL_PIXEL_MAP_G_TO_G, max, NULL); > glPixelMapusv(GL_PIXEL_MAP_B_TO_B, max, NULL); > @@ -353,7 +352,7 @@ test_pixel_map(void) > } > > for (i = 0; i < max; i++) { > - if (pbo_mem[i] != (255 - i)) { > +if (pbo_mem[i] != (max - i - 1)) { Please use tabs instead of spaces. Otherwise, this seems to be a correct fix. I guess that the previous version of the test passes with some drivers probably because "max" is equal to 256. ___ Piglit mailing list Piglit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/piglit
[Piglit] [PATCH v2] glx: add test for drawing to GL_FRONT between glxMakeCurrent()
Based on the glx-fbo-binding test. v2: - do not declare "piglit_width" and "piglit_height" - use piglit_get_gl_enum_name() Signed-off-by: Józef Kucia <joseph.ku...@gmail.com> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99116 --- I do not have commit access. --- tests/all.py| 1 + tests/glx/CMakeLists.gl.txt | 1 + tests/glx/glx-multi-context-front.c | 113 3 files changed, 115 insertions(+) create mode 100644 tests/glx/glx-multi-context-front.c diff --git a/tests/all.py b/tests/all.py index 3cd3b47..6255ddf 100644 --- a/tests/all.py +++ b/tests/all.py @@ -662,6 +662,7 @@ with profile.test_list.group_manager( g(['glx-fbconfig-compliance'], run_concurrent=False) g(['glx-fbconfig-bad'], run_concurrent=False) g(['glx-fbo-binding'], run_concurrent=False) +g(['glx-multi-context-front'], run_concurrent=False) g(['glx-multi-context-ib-1'], run_concurrent=False) g(['glx-multithread'], run_concurrent=False) g(['glx-multithread-texture'], run_concurrent=False) diff --git a/tests/glx/CMakeLists.gl.txt b/tests/glx/CMakeLists.gl.txt index ec5fc73..1e1c684 100644 --- a/tests/glx/CMakeLists.gl.txt +++ b/tests/glx/CMakeLists.gl.txt @@ -30,6 +30,7 @@ IF(PIGLIT_BUILD_GLX_TESTS) piglit_add_executable (glx-destroycontext-1 glx-destroycontext-1.c) piglit_add_executable (glx-destroycontext-2 glx-destroycontext-2.c) piglit_add_executable (glx-dont-care-mask glx-dont-care-mask.c) + piglit_add_executable (glx-multi-context-front glx-multi-context-front.c) piglit_add_executable (glx-multi-context-ib-1 glx-multi-context-ib-1.c) piglit_add_executable (glx-multithread glx-multithread.c) target_link_libraries(glx-multithread pthread) diff --git a/tests/glx/glx-multi-context-front.c b/tests/glx/glx-multi-context-front.c new file mode 100644 index 000..4f76f3c --- /dev/null +++ b/tests/glx/glx-multi-context-front.c @@ -0,0 +1,113 @@ +/* + * Copyright (c) 2011 VMware, Inc. + * Copyright (c) 2017 Józef Kucia <joseph.ku...@gmail.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. + */ + +/** + * Test clearing GL_FRONT across glXMakeCurrent calls. + * + * Reproduces bug in st/mesa front buffer allocation logic. + */ + +#include "piglit-util-gl.h" +#include "piglit-glx-util.h" + +static const char *test_name = "glx-multi-context-front"; +static const float green[4] = { 0.0f, 1.0f, 0.0f, 0.0f }; + +static Window Windows[2]; +static GLXContext ctx; + + +enum piglit_result +draw(Display *dpy) +{ + bool pass = true; + GLint buffer; + + glXMakeCurrent(dpy, Windows[0], ctx); + + glXMakeCurrent(dpy, Windows[1], ctx); + glDrawBuffer(GL_FRONT); + + glXMakeCurrent(dpy, Windows[0], ctx); + glGetIntegerv(GL_DRAW_BUFFER, ); + if (buffer != GL_FRONT) { + printf("%s: Got unexpected draw buffer %s\n", + test_name, piglit_get_gl_enum_name(buffer)); + pass = false; + } + glXMakeCurrent(dpy, Windows[1], ctx); + glGetIntegerv(GL_DRAW_BUFFER, ); + if (buffer != GL_FRONT) { + printf("%s: Got unexpected draw buffer %s\n", + test_name, piglit_get_gl_enum_name(buffer)); + pass = false; + } + + glClearColor(green[0], green[1], green[2], green[3]); + glClear(GL_COLOR_BUFFER_BIT); + + glReadBuffer(GL_FRONT); + pass &= piglit_probe_rect_rgb(0, 0, piglit_width, piglit_height, + green); + + return pass ? PIGLIT_PASS : PIGLIT_FAIL; +} + + +int +main(int argc, char **argv) +{ + Display *dpy; + XVisualInfo *visinfo; + int i; + + for (i = 1; i < a
[Piglit] [PATCH] glx: add test for drawing to GL_FRONT between glxMakeCurrent()
Based on the glx-fbo-binding test. Signed-off-by: Józef Kucia <joseph.ku...@gmail.com> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99116 --- tests/all.py| 1 + tests/glx/CMakeLists.gl.txt | 1 + tests/glx/glx-multi-context-front.c | 114 3 files changed, 116 insertions(+) create mode 100644 tests/glx/glx-multi-context-front.c diff --git a/tests/all.py b/tests/all.py index 3cd3b47..6255ddf 100644 --- a/tests/all.py +++ b/tests/all.py @@ -662,6 +662,7 @@ with profile.test_list.group_manager( g(['glx-fbconfig-compliance'], run_concurrent=False) g(['glx-fbconfig-bad'], run_concurrent=False) g(['glx-fbo-binding'], run_concurrent=False) +g(['glx-multi-context-front'], run_concurrent=False) g(['glx-multi-context-ib-1'], run_concurrent=False) g(['glx-multithread'], run_concurrent=False) g(['glx-multithread-texture'], run_concurrent=False) diff --git a/tests/glx/CMakeLists.gl.txt b/tests/glx/CMakeLists.gl.txt index ec5fc73..1e1c684 100644 --- a/tests/glx/CMakeLists.gl.txt +++ b/tests/glx/CMakeLists.gl.txt @@ -30,6 +30,7 @@ IF(PIGLIT_BUILD_GLX_TESTS) piglit_add_executable (glx-destroycontext-1 glx-destroycontext-1.c) piglit_add_executable (glx-destroycontext-2 glx-destroycontext-2.c) piglit_add_executable (glx-dont-care-mask glx-dont-care-mask.c) + piglit_add_executable (glx-multi-context-front glx-multi-context-front.c) piglit_add_executable (glx-multi-context-ib-1 glx-multi-context-ib-1.c) piglit_add_executable (glx-multithread glx-multithread.c) target_link_libraries(glx-multithread pthread) diff --git a/tests/glx/glx-multi-context-front.c b/tests/glx/glx-multi-context-front.c new file mode 100644 index 000..74cd48b --- /dev/null +++ b/tests/glx/glx-multi-context-front.c @@ -0,0 +1,114 @@ +/* + * Copyright (c) 2011 VMware, Inc. + * Copyright (c) 2017 Józef Kucia <joseph.ku...@gmail.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. + */ + +/** + * Test clearing GL_FRONT across glXMakeCurrent calls. + * + * Reproduces bug in st/mesa front buffer allocation logic. + */ + +#include "piglit-util-gl.h" +#include "piglit-glx-util.h" + +int piglit_width = 50, piglit_height = 50; +static const char *test_name = "glx-multi-context-front"; +static const float green[4] = { 0.0f, 1.0f, 0.0f, 0.0f }; + +static Window Windows[2]; +static GLXContext ctx; + + +enum piglit_result +draw(Display *dpy) +{ + bool pass = true; + GLint buffer; + + glXMakeCurrent(dpy, Windows[0], ctx); + + glXMakeCurrent(dpy, Windows[1], ctx); + glDrawBuffer(GL_FRONT); + + glXMakeCurrent(dpy, Windows[0], ctx); + glGetIntegerv(GL_DRAW_BUFFER, ); + if (buffer != GL_FRONT) { + printf("%s: Got unexpected draw buffer %#x\n", + test_name, buffer); + pass = false; + } + glXMakeCurrent(dpy, Windows[1], ctx); + glGetIntegerv(GL_DRAW_BUFFER, ); + if (buffer != GL_FRONT) { + printf("%s: Got unexpected draw buffer %#x\n", + test_name, buffer); + pass = false; + } + + glClearColor(green[0], green[1], green[2], green[3]); + glClear(GL_COLOR_BUFFER_BIT); + + glReadBuffer(GL_FRONT); + pass &= piglit_probe_rect_rgb(0, 0, piglit_width, piglit_height, + green); + + return pass ? PIGLIT_PASS : PIGLIT_FAIL; +} + + +int +main(int argc, char **argv) +{ + Display *dpy; + XVisualInfo *visinfo; + int i; + + for (i = 1; i < argc; i++) { + if (strcmp(argv[i], "-auto") == 0) { + piglit_automatic = 1; + break; +