From patchwork Sun Jul 5 12:25:43 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: 'Timothy Arceri' via Patchwork Forward X-Patchwork-Id: 50669 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f200.google.com (mail-wi0-f200.google.com [209.85.212.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id ADE20229FC for ; Sun, 5 Jul 2015 12:25:58 +0000 (UTC) Received: by widjy10 with SMTP id jy10sf44045194wid.3 for ; Sun, 05 Jul 2015 05:25:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:delivered-to:from:to:date :message-id:subject:precedence:list-id:list-unsubscribe:list-archive :list-post:list-help:list-subscribe:mime-version:content-type :content-transfer-encoding:errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list:reply-to; bh=/JYdRPvpszseF5djmsvKbwl7J+w0VtjaO8Syn2ol9gk=; b=YrNUsG7LF7IYNToZRGEspb7vuSZ3FR/F0rif2sJLFbe95ISUMfMIRmkyn8Klak44CY Wh4GBBZn3h90pmpr/JlyBxE+/jCQgEAVLBTDgtRQ7B33hmDr/kb1oBsZ8ec4l4R2CvjG Xs9gebxoVdgHhPFUi2uqmut6iu/DpbgqdUqnoeAWThjuDLJbTMF2hrPKTdZ/mbfmBmBH qh59JBYNyY30XfENbHTdrL/QtXNPnrXBjR9lytX2B0tQO5fWqGzbe/KDZr3wFXkPUWNZ o44Pg7dfcFdSQLnX9gLBP6FQq4AT9VZ0vjNOEbHUmz9ItrxmDB/73ewqEy7ra5RvRYKg g3YQ== X-Gm-Message-State: ALoCoQnnBHd4GSDrcMh89gJEUr2Oe9cDaxmxjy4UgUjOAt3jwl6qv/Bqjf+/e46j6gGtxeM+DU6V X-Received: by 10.113.11.3 with SMTP id ee3mr27800716lbd.9.1436099157633; Sun, 05 Jul 2015 05:25:57 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.205.6 with SMTP id lc6ls628747lac.80.gmail; Sun, 05 Jul 2015 05:25:57 -0700 (PDT) X-Received: by 10.152.5.98 with SMTP id r2mr44155893lar.8.1436099157443; Sun, 05 Jul 2015 05:25:57 -0700 (PDT) Received: from mail-la0-x230.google.com (mail-la0-x230.google.com. [2a00:1450:4010:c03::230]) by mx.google.com with ESMTPS id pf2si12499034lbc.2.2015.07.05.05.25.57 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 05 Jul 2015 05:25:57 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c03::230 as permitted sender) client-ip=2a00:1450:4010:c03::230; Received: by lagc2 with SMTP id c2so126511391lag.3 for ; Sun, 05 Jul 2015 05:25:57 -0700 (PDT) X-Received: by 10.152.6.69 with SMTP id y5mr43921729lay.72.1436099157209; Sun, 05 Jul 2015 05:25:57 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.108.230 with SMTP id hn6csp1126173lbb; Sun, 5 Jul 2015 05:25:55 -0700 (PDT) X-Received: by 10.68.87.5 with SMTP id t5mr93399410pbz.137.1436099154953; Sun, 05 Jul 2015 05:25:54 -0700 (PDT) Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTP id wk5si23936409pab.37.2015.07.05.05.25.54; Sun, 05 Jul 2015 05:25:54 -0700 (PDT) Received-SPF: pass (google.com: domain of piglit-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A2F046E3B2; Sun, 5 Jul 2015 05:25:53 -0700 (PDT) X-Original-To: piglit@lists.freedesktop.org Delivered-To: piglit@lists.freedesktop.org Received: from nm3.bullet.mail.gq1.yahoo.com (nm3.bullet.mail.gq1.yahoo.com [98.136.218.68]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5187A6E3B2 for ; Sun, 5 Jul 2015 05:25:52 -0700 (PDT) Received: from [98.137.12.63] by nm3.bullet.mail.gq1.yahoo.com with NNFMP; 05 Jul 2015 12:25:51 -0000 Received: from [208.71.42.209] by tm8.bullet.mail.gq1.yahoo.com with NNFMP; 05 Jul 2015 12:25:51 -0000 Received: from [127.0.0.1] by smtp220.mail.gq1.yahoo.com with NNFMP; 05 Jul 2015 12:25:51 -0000 X-Yahoo-Newman-Id: 381828.23713.bm@smtp220.mail.gq1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: d03qlJYVM1lmLsqw02WDYOPFFiE_huznsRA32VzE8CQ6wlr MqactRJiF9OjdLg7k3bsGgBUjfbUORZWfyYWsXFK872rIotlCDiFuDRa4MW_ Wvjd4fVmb6wCmfHya.Y.i5bPGMBT1ekgJV1z8lFHeX.PPzbm_Hts6RCJsgCf EOdTuuXLdRrKH1Uv1Cvap6f.1GvciSBWLC3MQkd0kAheoKYSo3..dS8eba3j K0MBWIO4krueHe7MiFGcE6F0aArKZdZ4Rk6JnOzVD7M_C3Zze2sFX1NP4doJ 5Oj3kF2Lr7qYLVUertqrvUxQIB8MAbqwsfXFDQ.U.OD7vlcdNf_CEeF3aCdy fuyJIfaRAFqIVkyUOMTP2AdbTgNE9Rq5T9hv_0OQrleAtSUIxOONn10FfCPg ZwhAIucqVH2iWfo5eJ3L7o9_JrZzWcWFjidu.zcFN_vOaZjKFA5SKcXBNu7x tmUxryQUPLlcbvzFrd.aqykFlJPEvWC.6RtDGySSqP6By.FOp5SJ73nCxlRe w0stnlFloHqwU3t.lfIqFwFVlCVOj2F8nZ4E- X-Yahoo-SMTP: 9BNlx.aswBAkr0D8mG_whiOP1dyU From: "'Timothy Arceri' via Patchwork Forward" To: piglit@lists.freedesktop.org Date: Sun, 5 Jul 2015 22:25:43 +1000 Message-Id: <1436099143-14454-1-git-send-email-t_arceri@yahoo.com.au> X-Mailer: git-send-email 2.4.3 Subject: [Piglit] [PATCH V2] arb_separate_shader_objects: extend active sampler conflict to test arrays X-BeenThere: piglit@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Errors-To: piglit-bounces@lists.freedesktop.org Sender: "Piglit" X-Original-Sender: patch@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c03::230 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org; dkim=neutral (body hash did not verify) header.i=@yahoo.com.au; dmarc=fail (p=NONE dis=NONE) header.from=yahoo.com.au Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 X-Original-From: Timothy Arceri Reply-To: Timothy Arceri V2: dont try to work around mesa limitations by initialising uniforms that might be optimised out --- .../active-sampler-conflict.c | 167 +++++++++++++++------ 1 file changed, 123 insertions(+), 44 deletions(-) diff --git a/tests/spec/arb_separate_shader_objects/active-sampler-conflict.c b/tests/spec/arb_separate_shader_objects/active-sampler-conflict.c index 5388449..a03b74d 100644 --- a/tests/spec/arb_separate_shader_objects/active-sampler-conflict.c +++ b/tests/spec/arb_separate_shader_objects/active-sampler-conflict.c @@ -81,56 +81,108 @@ static const char *fs_code = "}\n" ; +static const char *fs_arrays_code = + "#version 130\n" + "#extension GL_ARB_separate_shader_objects: require\n" + "\n" + "out vec4 out_color;\n" + "\n" + "uniform sampler2D s2[2];\n" + "uniform sampler3D s3[2];\n" + "\n" + "void main()\n" + "{\n" + " out_color = texture(s2[1], vec2(0)) + texture(s3[1], vec3(0));\n" + "}\n" + ; + +static const char *fs_arrays_of_arrays_code = + "#version 130\n" + "#extension GL_ARB_separate_shader_objects: require\n" + "#extension GL_ARB_arrays_of_arrays: require\n" + "\n" + "out vec4 out_color;\n" + "\n" + "uniform sampler2D s2[2][2];\n" + "uniform sampler3D s3[2][2];\n" + "\n" + "void main()\n" + "{\n" + " out_color = texture(s2[1][1], vec2(0)) + texture(s3[1][1], vec3(0));\n" + "}\n" + ; + static const float vert[2] = { 0.0, 0.0 }; -void piglit_init(int argc, char **argv) +static bool +setup_program(GLuint *prog, GLuint *pipe, GLuint *vao, + GLuint *bo, const char **fs_code) { - GLuint prog; - GLint s2_loc; - GLint s3_loc; - GLuint pipe; - GLuint vao; - GLuint bo; bool pass = true; - piglit_require_extension("GL_ARB_separate_shader_objects"); - - prog = glCreateShaderProgramv(GL_FRAGMENT_SHADER, 1, - (const GLchar *const *) &fs_code); - piglit_link_check_status(prog); - - s2_loc = glGetUniformLocation(prog, "s2"); - if (s2_loc == -1) { - fprintf(stderr, "Failed to get uniform location for s2.\n"); - pass = false; - } - - s3_loc = glGetUniformLocation(prog, "s3"); - if (s3_loc == -1) { - fprintf(stderr, "Failed to get uniform location for s3.\n"); - pass = false; - } + *prog = glCreateShaderProgramv(GL_FRAGMENT_SHADER, 1, + (const GLchar *const *) fs_code); + piglit_link_check_status(*prog); - glGenProgramPipelines(1, &pipe); - glUseProgramStages(pipe, + glGenProgramPipelines(1, pipe); + glUseProgramStages(*pipe, GL_FRAGMENT_SHADER_BIT, - prog); - glActiveShaderProgram(pipe, prog); - glBindProgramPipeline(pipe); + *prog); + glActiveShaderProgram(*pipe, *prog); + glBindProgramPipeline(*pipe); - glGenVertexArrays(1, &vao); - glBindVertexArray(vao); + glGenVertexArrays(1, vao); + glBindVertexArray(*vao); /* Configure a vertex array object and buffer object that will * be used for drawing later. */ - glGenBuffers(1, &bo); - glBindBuffer(GL_ARRAY_BUFFER, bo); + glGenBuffers(1, bo); + glBindBuffer(GL_ARRAY_BUFFER, *bo); glBufferData(GL_ARRAY_BUFFER, sizeof(vert), vert, GL_STATIC_DRAW); - pass = piglit_check_gl_error(GL_NO_ERROR) && pass; + return piglit_check_gl_error(GL_NO_ERROR) && pass; +} + +static void +cleanup(GLuint prog, GLuint *pipe, GLuint *vao, GLuint *bo) +{ + glBindProgramPipeline(0); + glDeleteProgram(prog); + glDeleteProgramPipelines(1, pipe); + + glBindBuffer(GL_ARRAY_BUFFER, 0); + glBindVertexArray(0); + + glDeleteBuffers(1, bo); + glDeleteVertexArrays(1, vao); +} + +static bool +get_uniform_location(GLuint prog, GLint *loc, char *uni_name) +{ + bool pass = true; + *loc = glGetUniformLocation(prog, uni_name); + if (*loc == -1) { + fprintf(stderr, "Failed to get uniform location for %s.\n", + uni_name); + pass = false; + } + return pass; +} + +static bool +test_sampler_conflict(GLuint prog, GLuint pipe, + char *s2_uni_name, char *s3_uni_name) +{ + GLint s2_loc; + GLint s3_loc; + bool pass = true; + + pass = get_uniform_location(prog, &s2_loc, s2_uni_name); + pass = get_uniform_location(prog, &s3_loc, s3_uni_name); /* First, try an invalid configuration. */ @@ -187,17 +239,44 @@ void piglit_init(int argc, char **argv) pass = piglit_check_gl_error(GL_NO_ERROR) && pass; - /* Clean up. - */ - glBindProgramPipeline(0); - glDeleteProgram(prog); - glDeleteProgramPipelines(1, &pipe); - - glBindBuffer(GL_ARRAY_BUFFER, 0); - glBindVertexArray(0); + return pass; +} + +void piglit_init(int argc, char **argv) +{ + GLuint prog; + GLuint pipe; + GLuint vao; + GLuint bo; + GLint s_loc; + char *s2_uni_name = "s2"; + char *s3_uni_name = "s3"; + char *s2_uni_array_name = "s2[1]"; + char *s3_uni_array_name = "s3[1]"; + bool pass; + + piglit_require_extension("GL_ARB_separate_shader_objects"); + + pass = setup_program(&prog, &pipe, &vao, &bo, &fs_code); + pass = test_sampler_conflict(prog, pipe, + s2_uni_name, s3_uni_name) && pass; + cleanup(prog, &pipe, &vao, &bo); + + pass = setup_program(&prog, &pipe, &vao, &bo, &fs_arrays_code); + pass = test_sampler_conflict(prog, pipe, s2_uni_array_name, + s3_uni_array_name) && pass; + cleanup(prog, &pipe, &vao, &bo); - glDeleteBuffers(1, &bo); - glDeleteVertexArrays(1, &vao); + if (piglit_is_extension_supported("GL_ARB_arrays_of_arrays")) { + char *s2_uni_aoa_name = "s2[1][1]"; + char *s3_uni_aoa_name = "s3[1][1]"; + + pass = setup_program(&prog, &pipe, &vao, &bo, + &fs_arrays_of_arrays_code); + pass = test_sampler_conflict(prog, pipe, s2_uni_aoa_name, + s3_uni_aoa_name) && pass; + cleanup(prog, &pipe, &vao, &bo); + } piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL); }