Hash :
4021932f
Author :
Date :
2016-12-09T09:50:51
translator: Add ES3.1 multisample texture support. Implement shader objects, [iu]sampler2DMS, textureSize(gsampler2DMS). as well as texelFetch(gsampler2DMS,P,sample) for the glsl. BUG=angleproject:1590 TEST=angle_unittests TEST=angle_end2end_tests Change-Id: I781023f7bec34ad0264af69f34bb182b50bd1fbd Reviewed-on: https://chromium-review.googlesource.com/423175 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: Jamie Madill <jmadill@chromium.org>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
//
// Copyright (c) 2016 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// SamplerMultisample_test.cpp:
// Tests compiling shaders that use gsampler2DMS types
//
#include "angle_gl.h"
#include "gtest/gtest.h"
#include "GLSLANG/ShaderLang.h"
#include "tests/test_utils/ShaderCompileTreeTest.h"
using namespace sh;
class SamplerMultisampleTest : public ShaderCompileTreeTest
{
public:
SamplerMultisampleTest() {}
protected:
::GLenum getShaderType() const override { return GL_FRAGMENT_SHADER; }
ShShaderSpec getShaderSpec() const override { return SH_GLES3_1_SPEC; }
};
// checks whether compiler has parsed the gsampler2DMS, texelfetch qualifiers correctly
TEST_F(SamplerMultisampleTest, TexelFetchSampler2DMSQualifier)
{
const std::string &shaderString =
"#version 310 es\n"
"precision highp float;\n"
"uniform highp sampler2DMS s;\n"
"uniform highp isampler2DMS is;\n"
"uniform highp usampler2DMS us;\n"
""
"void main() {\n"
" vec4 tex1 = texelFetch(s, ivec2(0, 0), 0);\n"
" ivec4 tex2 = texelFetch(is, ivec2(0, 0), 0);\n"
" uvec4 tex3 = texelFetch(us, ivec2(0, 0), 0);\n"
"}\n";
if (!compile(shaderString))
{
FAIL() << "Shader compilation failed, expecting success:\n" << mInfoLog;
}
}
// checks whether compiler has parsed the gsampler2DMS, texturesize qualifiers correctly
TEST_F(SamplerMultisampleTest, TextureSizeSampler2DMSQualifier)
{
const std::string &shaderString =
"#version 310 es\n"
"precision highp float;\n"
"uniform highp sampler2DMS s;\n"
"uniform highp isampler2DMS is;\n"
"uniform highp usampler2DMS us;\n"
""
"void main() {\n"
" ivec2 size = textureSize(s);\n"
" size = textureSize(is);\n"
" size = textureSize(us);\n"
"}\n";
if (!compile(shaderString))
{
FAIL() << "Shader compilation failed, expecting success:\n" << mInfoLog;
}
}
// checks gsampler2DMS has no default precision
TEST_F(SamplerMultisampleTest, NoPrecisionSampler2DMS)
{
const std::string &shaderString =
"#version 310 es\n"
"precision highp float;\n"
"uniform sampler2DMS s;\n"
"uniform isampler2DMS is;\n"
"uniform usampler2DMS us;\n"
""
"void main() {}\n";
if (compile(shaderString))
{
FAIL() << "Shader compilation succeeded, expecting failure:\n" << mInfoLog;
}
}