Commit 0986f1cc by Luc Ferron Committed by Commit Bot

Vulkan: Implement depth_range dirty bit and enable tests

- Additional fix in GlslWrapper.cpp to remove the @@ markers for unused attributes. - Enables 28 dEQP gles2 tests in functional.depth_range.* Bug: angleproject:2454 Change-Id: I1a6f72d846b476ba681140d4b242208d24e18b95 Reviewed-on: https://chromium-review.googlesource.com/1014262 Commit-Queue: Luc Ferron <lucferron@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarCorentin Wallez <cwallez@chromium.org>
parent f1d3c20c
...@@ -390,7 +390,7 @@ void ContextVk::syncState(const gl::Context *context, const gl::State::DirtyBits ...@@ -390,7 +390,7 @@ void ContextVk::syncState(const gl::Context *context, const gl::State::DirtyBits
glState.getFarPlane()); glState.getFarPlane());
break; break;
case gl::State::DIRTY_BIT_DEPTH_RANGE: case gl::State::DIRTY_BIT_DEPTH_RANGE:
WARN() << "DIRTY_BIT_DEPTH_RANGE unimplemented"; mPipelineDesc->updateDepthRange(glState.getNearPlane(), glState.getFarPlane());
break; break;
case gl::State::DIRTY_BIT_BLEND_ENABLED: case gl::State::DIRTY_BIT_BLEND_ENABLED:
mPipelineDesc->updateBlendEnabled(glState.isBlendEnabled()); mPipelineDesc->updateBlendEnabled(glState.isBlendEnabled());
......
...@@ -120,19 +120,31 @@ gl::LinkResult GlslangWrapper::linkProgram(const gl::Context *glContext, ...@@ -120,19 +120,31 @@ gl::LinkResult GlslangWrapper::linkProgram(const gl::Context *glContext,
// Parse attribute locations and replace them in the vertex shader. // Parse attribute locations and replace them in the vertex shader.
// See corresponding code in OutputVulkanGLSL.cpp. // See corresponding code in OutputVulkanGLSL.cpp.
// TODO(jmadill): Also do the same for ESSL 3 fragment outputs. // TODO(jmadill): Also do the same for ESSL 3 fragment outputs.
for (const auto &attribute : programState.getAttributes()) for (const sh::Attribute &attribute : programState.getAttributes())
{ {
if (!attribute.active) // Warning: If we endup supporting ES 3.0 shaders and up, Program::linkAttributes is going
{ // to bring us all attributes in this list instead of only the active ones.
InsertQualifierSpecifierString(&vertexSource, attribute.name, ""); ASSERT(attribute.active);
continue;
}
std::string locationString = "location = " + Str(attribute.location); std::string locationString = "location = " + Str(attribute.location);
InsertLayoutSpecifierString(&vertexSource, attribute.name, locationString); InsertLayoutSpecifierString(&vertexSource, attribute.name, locationString);
InsertQualifierSpecifierString(&vertexSource, attribute.name, "in"); InsertQualifierSpecifierString(&vertexSource, attribute.name, "in");
} }
// The attributes in the programState could have been filled with active attributes only
// depending on the shader version. If there is inactive attributes left, we have to remove
// their @@ QUALIFIER and @@ LAYOUT markers.
for (const sh::Attribute &attribute : glVertexShader->getAllAttributes(glContext))
{
if (attribute.active)
{
continue;
}
InsertLayoutSpecifierString(&vertexSource, attribute.name, "");
InsertQualifierSpecifierString(&vertexSource, attribute.name, "");
}
// Assign varying locations. // Assign varying locations.
for (const gl::PackedVaryingRegister &varyingReg : resources.varyingPacking.getRegisterList()) for (const gl::PackedVaryingRegister &varyingReg : resources.varyingPacking.getRegisterList())
{ {
......
...@@ -647,8 +647,15 @@ void PipelineDesc::updateViewport(const gl::Rectangle &viewport, float nearPlane ...@@ -647,8 +647,15 @@ void PipelineDesc::updateViewport(const gl::Rectangle &viewport, float nearPlane
mViewport.y = static_cast<float>(viewport.y); mViewport.y = static_cast<float>(viewport.y);
mViewport.width = static_cast<float>(viewport.width); mViewport.width = static_cast<float>(viewport.width);
mViewport.height = static_cast<float>(viewport.height); mViewport.height = static_cast<float>(viewport.height);
mViewport.minDepth = nearPlane; updateDepthRange(nearPlane, farPlane);
mViewport.maxDepth = farPlane; }
void PipelineDesc::updateDepthRange(float nearPlane, float farPlane)
{
// GLES2.0 Section 2.12.1: Each of n and f are clamped to lie within [0, 1], as are all
// arguments of type clampf.
mViewport.minDepth = gl::clamp01(nearPlane);
mViewport.maxDepth = gl::clamp01(farPlane);
} }
void PipelineDesc::updateVertexInputInfo(const VertexInputBindings &bindings, void PipelineDesc::updateVertexInputInfo(const VertexInputBindings &bindings,
......
...@@ -269,6 +269,7 @@ class PipelineDesc final ...@@ -269,6 +269,7 @@ class PipelineDesc final
Pipeline *pipelineOut) const; Pipeline *pipelineOut) const;
void updateViewport(const gl::Rectangle &viewport, float nearPlane, float farPlane); void updateViewport(const gl::Rectangle &viewport, float nearPlane, float farPlane);
void updateDepthRange(float nearPlane, float farPlane);
// Shader stage info // Shader stage info
const ShaderStageInfo &getShaderStageInfo() const; const ShaderStageInfo &getShaderStageInfo() const;
......
...@@ -320,7 +320,6 @@ ...@@ -320,7 +320,6 @@
2161 VULKAN : dEQP-GLES2.functional.uniform_api.value.assigned.unused_uniforms.* = SKIP 2161 VULKAN : dEQP-GLES2.functional.uniform_api.value.assigned.unused_uniforms.* = SKIP
2161 VULKAN : dEQP-GLES2.functional.uniform_api.random.* = SKIP 2161 VULKAN : dEQP-GLES2.functional.uniform_api.random.* = SKIP
2161 VULKAN : dEQP-GLES2.functional.read_pixels.* = SKIP 2161 VULKAN : dEQP-GLES2.functional.read_pixels.* = SKIP
2161 VULKAN : dEQP-GLES2.functional.depth_range.* = SKIP
2161 VULKAN : dEQP-GLES2.functional.dither.* = SKIP 2161 VULKAN : dEQP-GLES2.functional.dither.* = SKIP
2161 VULKAN : dEQP-GLES2.functional.state_query.* = SKIP 2161 VULKAN : dEQP-GLES2.functional.state_query.* = SKIP
2161 VULKAN : dEQP-GLES2.functional.clipping.* = SKIP 2161 VULKAN : dEQP-GLES2.functional.clipping.* = SKIP
......
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