Commit ef2fda72 by Luc Ferron Committed by Commit Bot

Vulkan: Fix issue in GlslWrapper and maxVaryingVectors calculation (2nd try)

The layout needed to also have a component qualifier so that the registerColumn wouldn't be ignored. Bug: angleproject:2460 Bug: angleproject:2483 Change-Id: I3adcd6208aca4afebd45311ded93d00087b60a99 Reviewed-on: https://chromium-review.googlesource.com/1016680 Commit-Queue: Luc Ferron <lucferron@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org>
parent 5804dc8e
......@@ -108,11 +108,12 @@ gl::LinkResult GlslangWrapper::linkProgram(const gl::Context *glContext,
}
// Assign varying locations.
// TODO(jmadill): This might need to be redone.
for (const auto &varyingReg : resources.varyingPacking.getRegisterList())
{
const auto &varying = *varyingReg.packedVarying;
std::string locationString = "location = " + Str(varyingReg.registerRow);
std::string locationString = "location = " + Str(varyingReg.registerRow) +
", component = " + Str(varyingReg.registerColumn);
InsertLayoutSpecifierString(&vertexSource, varying.varying->name, locationString);
InsertLayoutSpecifierString(&fragmentSource, varying.varying->name, locationString);
}
......
......@@ -121,10 +121,13 @@ void GenerateCaps(const VkPhysicalDeviceProperties &physicalDeviceProperties,
outCaps->maxVertexTextureImageUnits =
physicalDeviceProperties.limits.maxPerStageDescriptorSamplers;
// The max vertex output components includes the reserved varyings like gl_PointSize,
// gl_PointCoord, gl_Position, and gl_FragColor. On a vertex shader, you can only have
// gl_PointCoord and gl_Position, and on a fragment shader you can have gl_PointSize and
// gl_FragColor, so the reserved varying count is always 2 at most.
// The max vertex output components should not include gl_Position.
// The gles2.0 section 2.10 states that "gl_Position is not a varying variable and does
// not count against this limit.", but the Vulkan spec has no such mention in its Built-in
// vars section. It is implicit that we need to actually reserve it for Vulkan in that case.
// TODO(lucferron): AMD has a weird behavior when we edge toward the maximum number of varyings
// and can often crash. Reserving an additional varying just for them bringing the total to 2.
// http://anglebug.com/2483
constexpr GLint kReservedVaryingCount = 2;
outCaps->maxVaryingVectors =
(physicalDeviceProperties.limits.maxVertexOutputComponents / 4) - kReservedVaryingCount;
......
......@@ -1255,10 +1255,6 @@ TEST_P(GLSLTest, MaxVaryingsSpecialCases)
// rather than total register use.
TEST_P(GLSLTest, MaxMinusTwoVaryingVec2PlusOneSpecialVariable)
{
// TODO(lucferron): Root cause and fix it. Looks like a location is used twice (loc = 31).
// http://anglebug.com/2460
ANGLE_SKIP_TEST_IF(IsVulkan());
GLint maxVaryings = 0;
glGetIntegerv(GL_MAX_VARYING_VECTORS, &maxVaryings);
......@@ -1285,11 +1281,6 @@ TEST_P(GLSLTest, MaxVaryingVec3Array)
// Only fails on D3D9 because of packing limitations.
TEST_P(GLSLTest, MaxVaryingVec3AndOneFloat)
{
// TODO(lucferron): Root cause and fix it.
// ERROR: 0:62: 'location' : overlapping use of location x
// http://anglebug.com/2460
ANGLE_SKIP_TEST_IF(IsVulkan());
GLint maxVaryings = 0;
glGetIntegerv(GL_MAX_VARYING_VECTORS, &maxVaryings);
......@@ -1299,11 +1290,6 @@ TEST_P(GLSLTest, MaxVaryingVec3AndOneFloat)
// Only fails on D3D9 because of packing limitations.
TEST_P(GLSLTest, MaxVaryingVec3ArrayAndOneFloatArray)
{
// TODO(lucferron): Root cause and fix it.
// ERROR: 0:62: 'location' : overlapping use of location x
// http://anglebug.com/2460
ANGLE_SKIP_TEST_IF(IsVulkan());
GLint maxVaryings = 0;
glGetIntegerv(GL_MAX_VARYING_VECTORS, &maxVaryings);
......@@ -1313,11 +1299,6 @@ TEST_P(GLSLTest, MaxVaryingVec3ArrayAndOneFloatArray)
// Only fails on D3D9 because of packing limitations.
TEST_P(GLSLTest, TwiceMaxVaryingVec2)
{
// TODO(lucferron): Root cause and fix it.
// ERROR: 0:62: 'location' : overlapping use of location x
// http://anglebug.com/2460
ANGLE_SKIP_TEST_IF(IsVulkan());
// TODO(geofflang): Figure out why this fails on NVIDIA's GLES driver
ANGLE_SKIP_TEST_IF(IsNVIDIA() && IsOpenGLES());
......@@ -1334,11 +1315,6 @@ TEST_P(GLSLTest, TwiceMaxVaryingVec2)
// Disabled because of a failure in D3D9
TEST_P(GLSLTest, MaxVaryingVec2Arrays)
{
// TODO(lucferron): Root cause and fix it.
// ERROR: 0:62: 'location' : overlapping use of location x
// http://anglebug.com/2460
ANGLE_SKIP_TEST_IF(IsVulkan());
ANGLE_SKIP_TEST_IF(IsD3DSM3());
// TODO(geofflang): Figure out why this fails on NVIDIA's GLES driver
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment