Reland "Cleanup multiview support"

This is a reland of commit 9a7c0b88ba

Original change's description:
> Cleanup multiview support
>
> * Removed remaining mentions of ANGLE_multiview
>
> * Removed AST transformations used only in
>   the side-by-side multiview implementation
>
> * Changed the type of the internal ViewID_OVR
>   variable to use the dedicated qualifier
>
> * Removed side-by-side multiview support
>   from the D3D11 renderer
>
> * Removed an unused helper for side-by-side
>   multiview support from the OpenGL renderer
>
> * Removed obsoleted test suppressions

Fixed: angleproject:3341
Change-Id: I3ce9304c79c0873462c73e8cf02b85f7a1aaf874
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4669604
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com>
This commit is contained in:
Alexey Knyazev
2023-06-29 00:00:00 +00:00
committed by Angle LUCI CQ
parent 8b680c93c2
commit b57d5638dc
23 changed files with 110 additions and 292 deletions

View File

@@ -73,7 +73,7 @@ struct CompiledShaderState
gl::BlendEquationBitSet advancedBlendEquations;
SpecConstUsageBits specConstUsageBits;
// ANGLE_multiview.
// GL_OVR_multiview / GL_OVR_multiview2
int numViews;
// Geometry Shader

View File

@@ -393,6 +393,10 @@ const char *TOutputGLSLBase::mapQualifierToString(TQualifier qualifier)
switch (qualifier)
{
// When emulated, gl_ViewID_OVR uses flat qualifiers.
case EvqViewIDOVR:
return mShaderType == GL_FRAGMENT_SHADER ? "flat in" : "flat out";
// gl_ClipDistance / gl_CullDistance require different qualifiers based on shader type.
case EvqClipDistance:
case EvqCullDistance:

View File

@@ -823,6 +823,11 @@ void OutputHLSL::header(TInfoSinkBase &out,
}
}
if (mUsesViewID)
{
out << "static uint ViewID_OVR = 0;\n";
}
if (mUsesFragDepth)
{
out << "static float gl_Depth = 0.0;\n";
@@ -914,16 +919,9 @@ void OutputHLSL::header(TInfoSinkBase &out,
out << " float2 dx_ViewScale : packoffset(c3.z);\n";
}
if (mHasMultiviewExtensionEnabled)
{
// We have to add a value which we can use to keep track of which multi-view code
// path is to be selected in the GS.
out << " float multiviewSelectViewportIndex : packoffset(c4.x);\n";
}
if (mOutputType == SH_HLSL_4_1_OUTPUT)
{
unsigned int registerIndex = 5;
unsigned int registerIndex = 4;
mResourcesHLSL->samplerMetadataUniforms(out, registerIndex);
// Sampler metadata struct must be two 4-vec, 32 bytes.
registerIndex += mResourcesHLSL->getSamplerCount() * 2;
@@ -1043,12 +1041,17 @@ void OutputHLSL::header(TInfoSinkBase &out,
if (mUsesInstanceID)
{
out << "static int gl_InstanceID;";
out << "static int gl_InstanceID;\n";
}
if (mUsesViewID)
{
out << "static uint ViewID_OVR;\n";
}
if (mUsesVertexID)
{
out << "static int gl_VertexID;";
out << "static int gl_VertexID;\n";
}
out << "\n"
@@ -1085,15 +1088,8 @@ void OutputHLSL::header(TInfoSinkBase &out,
out << " float2 dx_ViewCoords : packoffset(c2);\n";
out << " float2 dx_ViewScale : packoffset(c3);\n";
if (mHasMultiviewExtensionEnabled)
{
// We have to add a value which we can use to keep track of which multi-view code
// path is to be selected in the GS.
out << " float multiviewSelectViewportIndex : packoffset(c3.z);\n";
}
out << " float clipControlOrigin : packoffset(c3.w);\n";
out << " float clipControlZeroToOne : packoffset(c4);\n";
out << " float clipControlOrigin : packoffset(c3.z);\n";
out << " float clipControlZeroToOne : packoffset(c3.w);\n";
if (mOutputType == SH_HLSL_4_1_OUTPUT)
{
@@ -1102,12 +1098,12 @@ void OutputHLSL::header(TInfoSinkBase &out,
if (mUsesVertexID)
{
out << " uint dx_VertexID : packoffset(c4.y);\n";
out << " uint dx_VertexID : packoffset(c4.x);\n";
}
if (mClipDistanceSize)
{
out << " uint clipDistancesEnabled : packoffset(c4.z);\n";
out << " uint clipDistancesEnabled : packoffset(c4.y);\n";
}
out << "};\n"
@@ -1243,7 +1239,7 @@ void OutputHLSL::header(TInfoSinkBase &out,
if (mHasMultiviewExtensionEnabled)
{
out << "#define GL_ANGLE_MULTIVIEW_ENABLED\n";
out << "#define GL_MULTIVIEW_ENABLED\n";
}
if (mUsesVertexID)
@@ -1399,16 +1395,17 @@ void OutputHLSL::visitSymbol(TIntermSymbol *node)
{
mReferencedVaryings[uniqueId.get()] = &variable;
out << DecorateVariableIfNeeded(variable);
if (variable.symbolType() == SymbolType::AngleInternal && name == "ViewID_OVR")
{
mUsesViewID = true;
}
}
else if (qualifier == EvqFragmentOut)
{
mReferencedOutputVariables[uniqueId.get()] = &variable;
out << "out_" << name;
}
else if (qualifier == EvqViewIDOVR)
{
out << name;
mUsesViewID = true;
}
else if (qualifier == EvqClipDistance)
{
out << name;

View File

@@ -75,7 +75,7 @@ void InitializeViewIDAndInstanceID(const TVariable *viewID,
initializers->push_back(viewIDInitializer);
}
// Adds a branch to write int(ViewID_OVR) to either gl_ViewportIndex or gl_Layer. The branch is
// Write int(ViewID_OVR) to gl_Layer. The assignment is
// added to the end of the initializers' sequence.
void SelectViewIndexInVertexShader(const TVariable *viewID,
const TVariable *multiviewBaseViewLayerIndex,
@@ -88,14 +88,6 @@ void SelectViewIndexInVertexShader(const TVariable *viewID,
TIntermAggregate *viewIDAsInt = TIntermAggregate::CreateConstructor(
TType(EbtInt, EbpHigh, EvqTemporary), &viewIDSymbolCastArguments);
// Create a gl_ViewportIndex node.
TIntermSymbol *viewportIndexSymbol = new TIntermSymbol(BuiltInVariable::gl_ViewportIndex());
// Create a { gl_ViewportIndex = int(ViewID_OVR) } node.
TIntermBlock *viewportIndexInitializerInBlock = new TIntermBlock();
viewportIndexInitializerInBlock->appendStatement(
new TIntermBinary(EOpAssign, viewportIndexSymbol, viewIDAsInt));
// Create a gl_Layer node.
TIntermSymbol *layerSymbol = new TIntermSymbol(BuiltInVariable::gl_LayerVS());
@@ -103,22 +95,7 @@ void SelectViewIndexInVertexShader(const TVariable *viewID,
TIntermBinary *sumOfViewIDAndBaseViewIndex = new TIntermBinary(
EOpAdd, viewIDAsInt->deepCopy(), new TIntermSymbol(multiviewBaseViewLayerIndex));
// Create a { gl_Layer = int(ViewID_OVR) + multiviewBaseViewLayerIndex } node.
TIntermBlock *layerInitializerInBlock = new TIntermBlock();
layerInitializerInBlock->appendStatement(
new TIntermBinary(EOpAssign, layerSymbol, sumOfViewIDAndBaseViewIndex));
// Create a node to compare whether the base view index uniform is less than zero.
TIntermBinary *multiviewBaseViewLayerIndexZeroComparison =
new TIntermBinary(EOpLessThan, new TIntermSymbol(multiviewBaseViewLayerIndex),
CreateZeroNode(TType(EbtInt, EbpHigh, EvqConst)));
// Create an if-else statement to select the code path.
TIntermIfElse *multiviewBranch =
new TIntermIfElse(multiviewBaseViewLayerIndexZeroComparison,
viewportIndexInitializerInBlock, layerInitializerInBlock);
initializers->push_back(multiviewBranch);
initializers->push_back(new TIntermBinary(EOpAssign, layerSymbol, sumOfViewIDAndBaseViewIndex));
}
} // namespace
@@ -133,10 +110,9 @@ bool DeclareAndInitBuiltinsForInstancedMultiview(TCompiler *compiler,
{
ASSERT(shaderType == GL_VERTEX_SHADER || shaderType == GL_FRAGMENT_SHADER);
TQualifier viewIDQualifier = (shaderType == GL_VERTEX_SHADER) ? EvqFlatOut : EvqFlatIn;
const TVariable *viewID =
new TVariable(symbolTable, kViewIDVariableName,
new TType(EbtUInt, EbpHigh, viewIDQualifier), SymbolType::AngleInternal);
new TVariable(symbolTable, kViewIDVariableName, new TType(EbtUInt, EbpHigh, EvqViewIDOVR),
SymbolType::AngleInternal);
DeclareGlobalVariable(root, viewID);
if (!ReplaceVariable(compiler, root, BuiltInVariable::gl_ViewID_OVR(), viewID))
@@ -161,7 +137,7 @@ bool DeclareAndInitBuiltinsForInstancedMultiview(TCompiler *compiler,
InitializeViewIDAndInstanceID(viewID, instanceID, numberOfViews, *symbolTable,
&initializers);
// The AST transformation which adds the expression to select the viewport index should
// The AST transformation which adds the expression to select the layer index should
// be done only for the GLSL and ESSL output.
const bool selectView = compileOptions.selectViewInNvGLSLVertexShader;
// Assert that if the view is selected in the vertex shader, then the output is
@@ -169,7 +145,7 @@ bool DeclareAndInitBuiltinsForInstancedMultiview(TCompiler *compiler,
ASSERT(!selectView || IsOutputGLSL(shaderOutput) || IsOutputESSL(shaderOutput));
if (selectView)
{
// Add a uniform to switch between side-by-side and layered rendering.
// Add a uniform to pass the base view index.
const TType *baseLayerIndexVariableType =
StaticType::Get<EbtInt, EbpHigh, EvqUniform, 1, 1>();
const TVariable *multiviewBaseViewLayerIndex =
@@ -177,8 +153,7 @@ bool DeclareAndInitBuiltinsForInstancedMultiview(TCompiler *compiler,
baseLayerIndexVariableType, SymbolType::AngleInternal);
DeclareGlobalVariable(root, multiviewBaseViewLayerIndex);
// Setting a value to gl_ViewportIndex or gl_Layer should happen after ViewID_OVR's
// initialization.
// Setting a value to gl_Layer should happen after ViewID_OVR's initialization.
SelectViewIndexInVertexShader(viewID, multiviewBaseViewLayerIndex, &initializers,
*symbolTable);
}

View File

@@ -6,7 +6,7 @@
// Regardless of the shader type, the following AST transformations are applied:
// - Add declaration of View_ID_OVR.
// - Replace every occurrence of gl_ViewID_OVR with ViewID_OVR, mark ViewID_OVR as internal and
// declare it as a flat varying.
// declare it with the same qualifier.
//
// If the shader type is a vertex shader, the following AST transformations are applied:
// - Replace every occurrence of gl_InstanceID with InstanceID, mark InstanceID as internal and set
@@ -15,13 +15,9 @@
// should be executed before any variables get collected so that usage of gl_InstanceID is recorded.
// - If the output is ESSL or GLSL and the selectViewInNvGLSLVertexShader option is
// enabled, the expression
// "if (multiviewBaseViewLayerIndex < 0) {
// gl_ViewportIndex = int(ViewID_OVR);
// } else {
// gl_Layer = int(ViewID_OVR) + multiviewBaseViewLayerIndex;
// }"
// is added after ViewID and InstanceID are initialized. Also, MultiviewRenderPath is added as a
// uniform.
// gl_Layer = int(ViewID_OVR) + multiviewBaseViewLayerIndex;
// is added after ViewID and InstanceID are initialized. Also, multiviewBaseViewLayerIndex is added
// as a uniform.
//
#ifndef COMPILER_TRANSLATOR_TREEOPS_DECLAREANDINITBUILTINSFORINSTANCEDMULTIVIEW_H_

View File

@@ -57,7 +57,7 @@ enum
IMPLEMENTATION_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS = 4,
IMPLEMENTATION_MAX_TRANSFORM_FEEDBACK_BUFFERS = 4,
// Maximum number of views which are supported by the implementation of ANGLE_multiview.
// Maximum number of views which are supported by the multiview implementation.
IMPLEMENTATION_ANGLE_MULTIVIEW_MAX_VIEWS = 4,
// These are the maximums the implementation can support

View File

@@ -434,7 +434,7 @@ MSG kMultisampleTextureExtensionOrES31Required = "GL_ANGLE_texture_multisample o
MSG kMultisampleTextureExtensionOrGetTexLevelParameterExtensionOrES31Required = "GL_ANGLE_texture_multisample, GL_ANGLE_get_tex_level_parameter or GLES 3.1 required.";
MSG kMultiviewActive = "The number of views in the active draw framebuffer is greater than 1.";
MSG kMultiviewMismatch = "The number of views in the active program and draw framebuffer does not match.";
MSG kMultiviewNotAvailable = "ANGLE_multiview is not available.";
MSG kMultiviewNotAvailable = "OVR_multiview or OVR_multiview2 are not available.";
MSG kMultiviewReadFramebuffer = "The active read framebuffer object has multiview attachments.";
MSG kMultiviewTimerQuery = "There is an active query for target GL_TIME_ELAPSED_EXT when the number of views in the active draw framebuffer is greater than 1.";
MSG kMultiviewTransformFeedback = "There is an active transform feedback object when the number of views in the active draw framebuffer is greater than 1.";

View File

@@ -386,7 +386,7 @@ class ProgramState final : angle::NonCopyable
bool mSeparable;
rx::SpecConstUsageBits mSpecConstUsageBits;
// ANGLE_multiview.
// GL_OVR_multiview / GL_OVR_multiview2
int mNumViews;
// GL_ANGLE_multi_draw

View File

@@ -563,12 +563,6 @@ void DynamicHLSL::generateVaryingLinkHLSL(const VaryingPacking &varyingPacking,
// in pixel shader inputs even when they are in vertex/geometry shader outputs, and the pixel
// shader input struct must be a prefix of the vertex/geometry shader output struct.
if (builtins.glViewportIndex.enabled)
{
hlslStream << " nointerpolation uint gl_ViewportIndex : "
<< builtins.glViewportIndex.str() << ";\n";
}
if (builtins.glLayer.enabled)
{
hlslStream << " nointerpolation uint gl_Layer : " << builtins.glLayer.str() << ";\n";
@@ -725,16 +719,10 @@ void DynamicHLSL::generateShaderLinkHLSL(const gl::Context *context,
{
vertexGenerateOutput << " output.gl_ViewID_OVR = ViewID_OVR;\n";
}
if (programMetadata.hasANGLEMultiviewEnabled() && programMetadata.canSelectViewInVertexShader())
if (programMetadata.hasMultiviewEnabled() && programMetadata.canSelectViewInVertexShader())
{
ASSERT(vertexBuiltins.glViewportIndex.enabled && vertexBuiltins.glLayer.enabled);
vertexGenerateOutput << " if (multiviewSelectViewportIndex)\n"
<< " {\n"
<< " output.gl_ViewportIndex = ViewID_OVR;\n"
<< " } else {\n"
<< " output.gl_ViewportIndex = 0;\n"
<< " output.gl_Layer = ViewID_OVR;\n"
<< " }\n";
ASSERT(vertexBuiltins.glLayer.enabled);
vertexGenerateOutput << " output.gl_Layer = ViewID_OVR;\n";
}
// On D3D9 or D3D11 Feature Level 9, we need to emulate large viewports using dx_ViewAdjust.
@@ -1218,7 +1206,7 @@ void DynamicHLSL::generateShaderLinkHLSL(const gl::Context *context,
std::string DynamicHLSL::generateGeometryShaderPreamble(const VaryingPacking &varyingPacking,
const BuiltinVaryingsD3D &builtinsD3D,
const bool hasANGLEMultiviewEnabled,
const bool hasMultiviewEnabled,
const bool selectViewInVS) const
{
ASSERT(mRenderer->getMajorShaderModel() >= 4);
@@ -1245,18 +1233,15 @@ std::string DynamicHLSL::generateGeometryShaderPreamble(const VaryingPacking &va
preambleStream << " output.gl_PointSize = input.gl_PointSize;\n";
}
if (hasANGLEMultiviewEnabled)
if (hasMultiviewEnabled)
{
preambleStream << " output.gl_ViewID_OVR = input.gl_ViewID_OVR;\n";
if (selectViewInVS)
{
ASSERT(builtinsD3D[gl::ShaderType::Geometry].glViewportIndex.enabled &&
builtinsD3D[gl::ShaderType::Geometry].glLayer.enabled);
ASSERT(builtinsD3D[gl::ShaderType::Geometry].glLayer.enabled);
// If the view is already selected in the VS, then we just pass the gl_ViewportIndex and
// gl_Layer to the output.
preambleStream << " output.gl_ViewportIndex = input.gl_ViewportIndex;\n"
<< " output.gl_Layer = input.gl_Layer;\n";
// If the view is already selected in the VS, then we just pass gl_Layer to the output.
preambleStream << " output.gl_Layer = input.gl_Layer;\n";
}
}
@@ -1283,26 +1268,14 @@ std::string DynamicHLSL::generateGeometryShaderPreamble(const VaryingPacking &va
<< "#endif // ANGLE_POINT_SPRITE_SHADER\n"
<< "}\n";
if (hasANGLEMultiviewEnabled && !selectViewInVS)
if (hasMultiviewEnabled && !selectViewInVS)
{
ASSERT(builtinsD3D[gl::ShaderType::Geometry].glViewportIndex.enabled &&
builtinsD3D[gl::ShaderType::Geometry].glLayer.enabled);
ASSERT(builtinsD3D[gl::ShaderType::Geometry].glLayer.enabled);
// According to the HLSL reference, using SV_RenderTargetArrayIndex is only valid if the
// render target is an array resource. Because of this we do not write to gl_Layer if we are
// taking the side-by-side code path. We still select the viewport index in the layered code
// path as that is always valid. See:
// https://msdn.microsoft.com/en-us/library/windows/desktop/bb509647(v=vs.85).aspx
preambleStream << "\n"
<< "void selectView(inout GS_OUTPUT output, GS_INPUT input)\n"
<< "{\n"
<< " if (multiviewSelectViewportIndex)\n"
<< " {\n"
<< " output.gl_ViewportIndex = input.gl_ViewID_OVR;\n"
<< " } else {\n"
<< " output.gl_ViewportIndex = 0;\n"
<< " output.gl_Layer = input.gl_ViewID_OVR;\n"
<< " }\n"
<< " output.gl_Layer = input.gl_ViewID_OVR;\n"
<< "}\n";
}
@@ -1313,7 +1286,7 @@ std::string DynamicHLSL::generateGeometryShaderHLSL(const gl::Caps &caps,
gl::PrimitiveMode primitiveType,
const gl::ProgramState &programData,
const bool useViewScale,
const bool hasANGLEMultiviewEnabled,
const bool hasMultiviewEnabled,
const bool selectViewInVS,
const bool pointSpriteEmulation,
const std::string &preambleString) const
@@ -1372,7 +1345,7 @@ std::string DynamicHLSL::generateGeometryShaderHLSL(const gl::Caps &caps,
break;
}
if (pointSprites || hasANGLEMultiviewEnabled)
if (pointSprites || hasMultiviewEnabled)
{
shaderStream << "cbuffer DriverConstants : register(b0)\n"
"{\n";
@@ -1386,13 +1359,6 @@ std::string DynamicHLSL::generateGeometryShaderHLSL(const gl::Caps &caps,
}
}
if (hasANGLEMultiviewEnabled)
{
// We have to add a value which we can use to keep track of which multi-view code path
// is to be selected in the GS.
shaderStream << " float multiviewSelectViewportIndex : packoffset(c4.x);\n";
}
shaderStream << "};\n\n";
}
@@ -1450,7 +1416,7 @@ std::string DynamicHLSL::generateGeometryShaderHLSL(const gl::Caps &caps,
{
shaderStream << " copyVertex(output, input[" << vertexIndex
<< "], input[lastVertexIndex]);\n";
if (hasANGLEMultiviewEnabled && !selectViewInVS)
if (hasMultiviewEnabled && !selectViewInVS)
{
shaderStream << " selectView(output, input[" << vertexIndex << "]);\n";
}
@@ -1775,27 +1741,15 @@ void BuiltinVaryingsD3D::updateBuiltins(gl::ShaderType shaderType,
}
}
if (metadata.hasANGLEMultiviewEnabled())
if (metadata.hasMultiviewEnabled())
{
// Although it is possible to compute gl_ViewID_OVR from the value of
// SV_ViewportArrayIndex or SV_RenderTargetArrayIndex and the multi-view state in the
// driver constant buffer, it is easier and cleaner to always pass it as a varying.
// SV_RenderTargetArrayIndex, it is easier and cleaner to always pass it as a varying.
builtins->glViewIDOVR.enable(userSemantic, reservedSemanticIndex++);
if (shaderType == gl::ShaderType::Vertex)
if ((shaderType == gl::ShaderType::Vertex && metadata.canSelectViewInVertexShader()) ||
shaderType == gl::ShaderType::Geometry)
{
if (metadata.canSelectViewInVertexShader())
{
builtins->glViewportIndex.enableSystem("SV_ViewportArrayIndex");
builtins->glLayer.enableSystem("SV_RenderTargetArrayIndex");
}
}
if (shaderType == gl::ShaderType::Geometry)
{
// gl_Layer and gl_ViewportIndex are necessary so that we can write to either based on
// the multiview state in the driver constant buffer.
builtins->glViewportIndex.enableSystem("SV_ViewportArrayIndex");
builtins->glLayer.enableSystem("SV_RenderTargetArrayIndex");
}
}

View File

@@ -181,14 +181,14 @@ class DynamicHLSL : angle::NonCopyable
std::string generateGeometryShaderPreamble(const gl::VaryingPacking &varyingPacking,
const BuiltinVaryingsD3D &builtinsD3D,
const bool hasANGLEMultiviewEnabled,
const bool hasMultiviewEnabled,
const bool selectViewInVS) const;
std::string generateGeometryShaderHLSL(const gl::Caps &caps,
gl::PrimitiveMode primitiveType,
const gl::ProgramState &programData,
const bool useViewScale,
const bool hasANGLEMultiviewEnabled,
const bool hasMultiviewEnabled,
const bool selectViewInVS,
const bool pointSpriteEmulation,
const std::string &preambleString) const;

View File

@@ -470,10 +470,10 @@ bool ProgramD3DMetadata::usesViewScale() const
return mUsesViewScale;
}
bool ProgramD3DMetadata::hasANGLEMultiviewEnabled() const
bool ProgramD3DMetadata::hasMultiviewEnabled() const
{
const rx::ShaderD3D *shader = mAttachedShaders[gl::ShaderType::Vertex];
return (shader && shader->hasANGLEMultiviewEnabled());
return (shader && shader->hasMultiviewEnabled());
}
bool ProgramD3DMetadata::usesVertexID() const
@@ -748,7 +748,7 @@ bool ProgramD3D::usesGetDimensionsIgnoresBaseLevel() const
bool ProgramD3D::usesGeometryShader(const gl::State &state, const gl::PrimitiveMode drawMode) const
{
if (mHasANGLEMultiviewEnabled && !mRenderer->canSelectViewInVertexShader())
if (mHasMultiviewEnabled && !mRenderer->canSelectViewInVertexShader())
{
return true;
}
@@ -1157,7 +1157,7 @@ std::unique_ptr<rx::LinkEvent> ProgramD3D::load(const gl::Context *context,
stream->readEnum(&mFragDepthUsage);
stream->readBool(&mUsesSampleMask);
stream->readBool(&mHasANGLEMultiviewEnabled);
stream->readBool(&mHasMultiviewEnabled);
stream->readBool(&mUsesVertexID);
stream->readBool(&mUsesViewID);
stream->readBool(&mUsesPointSize);
@@ -1455,7 +1455,7 @@ void ProgramD3D::save(const gl::Context *context, gl::BinaryOutputStream *stream
stream->writeEnum(mFragDepthUsage);
stream->writeBool(mUsesSampleMask);
stream->writeBool(mHasANGLEMultiviewEnabled);
stream->writeBool(mHasMultiviewEnabled);
stream->writeBool(mUsesVertexID);
stream->writeBool(mUsesViewID);
stream->writeBool(mUsesPointSize);
@@ -1688,9 +1688,9 @@ angle::Result ProgramD3D::getGeometryExecutableForPrimitiveType(d3d::Context *co
}
const gl::Caps &caps = state.getCaps();
std::string geometryHLSL = mDynamicHLSL->generateGeometryShaderHLSL(
caps, geometryShaderType, mState, mRenderer->presentPathFastEnabled(),
mHasANGLEMultiviewEnabled, mRenderer->canSelectViewInVertexShader(),
usesGeometryShaderForPointSpriteEmulation(), mGeometryShaderPreamble);
caps, geometryShaderType, mState, mRenderer->presentPathFastEnabled(), mHasMultiviewEnabled,
mRenderer->canSelectViewInVertexShader(), usesGeometryShaderForPointSpriteEmulation(),
mGeometryShaderPreamble);
gl::InfoLog tempInfoLog;
gl::InfoLog *currentInfoLog = infoLog ? infoLog : &tempInfoLog;
@@ -2185,11 +2185,11 @@ std::unique_ptr<LinkEvent> ProgramD3D::link(const gl::Context *context,
const ShaderD3D *vertexShader = shadersD3D[gl::ShaderType::Vertex];
mUsesPointSize = vertexShader && vertexShader->usesPointSize();
mDynamicHLSL->getPixelShaderOutputKey(data, mState, metadata, &mPixelShaderKey);
mFragDepthUsage = metadata.getFragDepthUsage();
mUsesSampleMask = metadata.usesSampleMask();
mUsesVertexID = metadata.usesVertexID();
mUsesViewID = metadata.usesViewID();
mHasANGLEMultiviewEnabled = metadata.hasANGLEMultiviewEnabled();
mFragDepthUsage = metadata.getFragDepthUsage();
mUsesSampleMask = metadata.usesSampleMask();
mUsesVertexID = metadata.usesVertexID();
mUsesViewID = metadata.usesViewID();
mHasMultiviewEnabled = metadata.hasMultiviewEnabled();
// Cache if we use flat shading
mUsesFlatInterpolation = FindFlatInterpolationVarying(context, mState.getAttachedShaders());
@@ -2197,7 +2197,7 @@ std::unique_ptr<LinkEvent> ProgramD3D::link(const gl::Context *context,
if (mRenderer->getMajorShaderModel() >= 4)
{
mGeometryShaderPreamble = mDynamicHLSL->generateGeometryShaderPreamble(
varyingPacking, builtins, mHasANGLEMultiviewEnabled,
varyingPacking, builtins, mHasMultiviewEnabled,
metadata.canSelectViewInVertexShader());
}
@@ -3082,11 +3082,11 @@ void ProgramD3D::reset()
mShaderHLSL[shaderType].clear();
}
mFragDepthUsage = FragDepthUsage::Unused;
mUsesSampleMask = false;
mHasANGLEMultiviewEnabled = false;
mUsesVertexID = false;
mUsesViewID = false;
mFragDepthUsage = FragDepthUsage::Unused;
mUsesSampleMask = false;
mHasMultiviewEnabled = false;
mUsesVertexID = false;
mUsesViewID = false;
mPixelShaderKey.clear();
mUsesPointSize = false;
mUsesFlatInterpolation = false;

View File

@@ -158,7 +158,7 @@ class ProgramD3DMetadata final : angle::NonCopyable
bool usesPointSize() const;
bool usesInsertedPointCoordValue() const;
bool usesViewScale() const;
bool hasANGLEMultiviewEnabled() const;
bool hasMultiviewEnabled() const;
bool usesVertexID() const;
bool usesViewID() const;
bool canSelectViewInVertexShader() const;
@@ -556,7 +556,7 @@ class ProgramD3D : public ProgramImpl
FragDepthUsage mFragDepthUsage;
bool mUsesSampleMask;
bool mHasANGLEMultiviewEnabled;
bool mHasMultiviewEnabled;
bool mUsesVertexID;
bool mUsesViewID;
std::vector<PixelShaderOutputVariable> mPixelShaderKey;

View File

@@ -128,7 +128,7 @@ void ShaderD3D::uncompile()
mUsesSampleMaskIn = false;
mUsesSampleMask = false;
mUsesDepthRange = false;
mHasANGLEMultiviewEnabled = false;
mHasMultiviewEnabled = false;
mUsesVertexID = false;
mUsesViewID = false;
mUsesDiscardRewriting = false;
@@ -316,13 +316,12 @@ std::shared_ptr<WaitableCompileEvent> ShaderD3D::compile(const gl::Context *cont
mUsesSampleMask = translatedSource.find("GL_USES_SAMPLE_MASK_OUT") != std::string::npos;
mUsesHelperInvocation =
translatedSource.find("GL_USES_HELPER_INVOCATION") != std::string::npos;
mUsesPointSize = translatedSource.find("GL_USES_POINT_SIZE") != std::string::npos;
mUsesPointCoord = translatedSource.find("GL_USES_POINT_COORD") != std::string::npos;
mUsesDepthRange = translatedSource.find("GL_USES_DEPTH_RANGE") != std::string::npos;
mHasANGLEMultiviewEnabled =
translatedSource.find("GL_ANGLE_MULTIVIEW_ENABLED") != std::string::npos;
mUsesVertexID = translatedSource.find("GL_USES_VERTEX_ID") != std::string::npos;
mUsesViewID = translatedSource.find("GL_USES_VIEW_ID") != std::string::npos;
mUsesPointSize = translatedSource.find("GL_USES_POINT_SIZE") != std::string::npos;
mUsesPointCoord = translatedSource.find("GL_USES_POINT_COORD") != std::string::npos;
mUsesDepthRange = translatedSource.find("GL_USES_DEPTH_RANGE") != std::string::npos;
mHasMultiviewEnabled = translatedSource.find("GL_MULTIVIEW_ENABLED") != std::string::npos;
mUsesVertexID = translatedSource.find("GL_USES_VERTEX_ID") != std::string::npos;
mUsesViewID = translatedSource.find("GL_USES_VIEW_ID") != std::string::npos;
mUsesDiscardRewriting =
translatedSource.find("ANGLE_USES_DISCARD_REWRITING") != std::string::npos;
mUsesNestedBreak = translatedSource.find("ANGLE_USES_NESTED_BREAK") != std::string::npos;

View File

@@ -97,7 +97,7 @@ class ShaderD3D : public ShaderImpl
bool usesSamplePosition() const { return mUsesSamplePosition; }
bool usesSampleMaskIn() const { return mUsesSampleMaskIn; }
bool usesSampleMask() const { return mUsesSampleMask; }
bool hasANGLEMultiviewEnabled() const { return mHasANGLEMultiviewEnabled; }
bool hasMultiviewEnabled() const { return mHasMultiviewEnabled; }
FragDepthUsage getFragDepthUsage() const { return mFragDepthUsage; }
uint8_t getClipDistanceArraySize() const { return mClipDistanceSize; }
uint8_t getCullDistanceArraySize() const { return mCullDistanceSize; }
@@ -119,7 +119,7 @@ class ShaderD3D : public ShaderImpl
bool mUsesSamplePosition;
bool mUsesSampleMaskIn;
bool mUsesSampleMask;
bool mHasANGLEMultiviewEnabled;
bool mHasMultiviewEnabled;
bool mUsesVertexID;
bool mUsesViewID;
bool mUsesDiscardRewriting;

View File

@@ -434,14 +434,6 @@ void ShaderConstants11::setComputeWorkGroups(GLuint numGroupsX,
mShaderConstantsDirty.set(gl::ShaderType::Compute);
}
void ShaderConstants11::setMultiviewWriteToViewportIndex(GLfloat index)
{
mVertex.multiviewWriteToViewportIndex = index;
mPixel.multiviewWriteToViewportIndex = index;
mShaderConstantsDirty.set(gl::ShaderType::Vertex);
mShaderConstantsDirty.set(gl::ShaderType::Fragment);
}
void ShaderConstants11::onViewportChange(const gl::Rectangle &glViewport,
const D3D11_VIEWPORT &dxViewport,
const gl::Offset &glFragCoordOffset,
@@ -493,8 +485,6 @@ void ShaderConstants11::onViewportChange(const gl::Rectangle &glViewport,
mPixel.viewScale[0] = 1.0f;
mPixel.viewScale[1] = presentPathFast ? 1.0f : -1.0f;
// Updates to the multiviewWriteToViewportIndex member are to be handled whenever the draw
// framebuffer's layout is changed.
mVertex.viewScale[0] = mPixel.viewScale[0];
mVertex.viewScale[1] = mPixel.viewScale[1];
@@ -1116,10 +1106,6 @@ void StateManager11::syncState(const gl::Context *context,
break;
case gl::state::DIRTY_BIT_DRAW_FRAMEBUFFER_BINDING:
invalidateRenderTarget();
if (mIsMultiviewEnabled)
{
handleMultiviewDrawFramebufferChange(context);
}
mFramebuffer11 = GetImplAs<Framebuffer11>(state.getDrawFramebuffer());
break;
case gl::state::DIRTY_BIT_VERTEX_ARRAY_BINDING:
@@ -1244,21 +1230,6 @@ void StateManager11::syncState(const gl::Context *context,
// TODO(jmadill): Input layout and vertex buffer state.
}
void StateManager11::handleMultiviewDrawFramebufferChange(const gl::Context *context)
{
const auto &glState = context->getState();
const gl::Framebuffer *drawFramebuffer = glState.getDrawFramebuffer();
ASSERT(drawFramebuffer != nullptr);
if (drawFramebuffer->isMultiview())
{
// Because the base view index is applied as an offset to the 2D texture array when the
// RTV is created, we just have to pass a boolean to select which code path is to be
// used.
mShaderConstants.setMultiviewWriteToViewportIndex(0.0f);
}
}
angle::Result StateManager11::syncBlendState(const gl::Context *context,
const gl::BlendStateExt &blendStateExt,
const gl::ColorF &blendColor,

View File

@@ -39,7 +39,6 @@ class ShaderConstants11 : angle::NonCopyable
void markDirty();
void setComputeWorkGroups(GLuint numGroupsX, GLuint numGroupsY, GLuint numGroupsZ);
void setMultiviewWriteToViewportIndex(GLfloat index);
void onViewportChange(const gl::Rectangle &glViewport,
const D3D11_VIEWPORT &dxViewport,
const gl::Offset &glFragCoordOffset,
@@ -71,7 +70,6 @@ class ShaderConstants11 : angle::NonCopyable
viewAdjust{.0f},
viewCoords{.0f},
viewScale{.0f},
multiviewWriteToViewportIndex{.0f},
clipControlOrigin{-1.0f},
clipControlZeroToOne{.0f},
firstVertex{0},
@@ -83,10 +81,6 @@ class ShaderConstants11 : angle::NonCopyable
float viewAdjust[4];
float viewCoords[4];
float viewScale[2];
// multiviewWriteToViewportIndex is used to select either the side-by-side or layered
// code-path in the GS. It's value, if set, is either 0.0f or 1.0f. The value is updated
// whenever a multi-view draw framebuffer is made active.
float multiviewWriteToViewportIndex;
// EXT_clip_control
// Multiplied with Y coordinate: -1.0 for GL_LOWER_LEFT_EXT, 1.0f for GL_UPPER_LEFT_EXT
@@ -99,7 +93,7 @@ class ShaderConstants11 : angle::NonCopyable
uint32_t clipDistancesEnabled;
// Added here to manually pad the struct to 16 byte boundary
float padding[1];
float padding[2];
};
static_assert(sizeof(Vertex) % 16u == 0,
"D3D11 constant buffers must be multiples of 16 bytes");
@@ -111,9 +105,7 @@ class ShaderConstants11 : angle::NonCopyable
viewCoords{.0f},
depthFront{.0f},
fragCoordOffset{.0f},
viewScale{.0f},
multiviewWriteToViewportIndex{.0f},
padding{.0f}
viewScale{.0f}
{}
float depthRange[4];
@@ -121,13 +113,6 @@ class ShaderConstants11 : angle::NonCopyable
float depthFront[4];
float fragCoordOffset[2];
float viewScale[2];
// multiviewWriteToViewportIndex is used to select either the side-by-side or layered
// code-path in the GS. It's value, if set, is either 0.0f or 1.0f. The value is updated
// whenever a multi-view draw framebuffer is made active.
float multiviewWriteToViewportIndex;
// Added here to manually pad the struct.
float padding[3];
};
static_assert(sizeof(Pixel) % 16u == 0, "D3D11 constant buffers must be multiples of 16 bytes");
@@ -400,8 +385,6 @@ class StateManager11 final : angle::NonCopyable
const gl::ImageUnit &imageUnit,
UAVList *uavList);
void handleMultiviewDrawFramebufferChange(const gl::Context *context);
angle::Result syncCurrentValueAttribs(
const gl::Context *context,
const std::vector<gl::VertexAttribCurrentValueData> &currentValues);
@@ -647,7 +630,6 @@ class StateManager11 final : angle::NonCopyable
std::vector<const TranslatedAttribute *> mCurrentAttributes;
Optional<GLint> mLastFirstVertex;
// ANGLE_multiview.
bool mIsMultiviewEnabled;
bool mIndependentBlendStates;

View File

@@ -1342,7 +1342,7 @@ unsigned int GetMaxViewportAndScissorRectanglesPerPipeline(D3D_FEATURE_LEVEL fea
bool IsMultiviewSupported(D3D_FEATURE_LEVEL featureLevel)
{
// The ANGLE_multiview extension can always be supported in D3D11 through geometry shaders.
// The multiview extensions can always be supported in D3D11 through geometry shaders.
switch (featureLevel)
{
case D3D_FEATURE_LEVEL_11_1:

View File

@@ -1059,15 +1059,6 @@ void ProgramGL::updateEnabledClipDistances(uint8_t enabledClipDistancesPacked) c
enabledClipDistancesPacked);
}
void ProgramGL::enableSideBySideRenderingPath() const
{
ASSERT(mState.usesMultiview());
ASSERT(mMultiviewBaseViewLayerIndexUniformLocation != -1);
ASSERT(mFunctions->programUniform1i != nullptr);
mFunctions->programUniform1i(mProgramID, mMultiviewBaseViewLayerIndexUniformLocation, -1);
}
void ProgramGL::enableLayeredRenderingPath(int baseViewIndex) const
{
ASSERT(mState.usesMultiview());

View File

@@ -110,7 +110,6 @@ class ProgramGL : public ProgramImpl
void updateEnabledClipDistances(uint8_t enabledClipDistancesPacked) const;
void enableSideBySideRenderingPath() const;
void enableLayeredRenderingPath(int baseViewIndex) const;
angle::Result syncState(const gl::Context *context,

View File

@@ -3916,11 +3916,11 @@ bool ValidateCopyTexImageParametersBase(const Context *context,
return false;
}
// ANGLE_multiview spec, Revision 1:
// Calling CopyTexSubImage3D, CopyTexImage2D, or CopyTexSubImage2D will result in an
// INVALID_FRAMEBUFFER_OPERATION error if the multi-view layout of the current read framebuffer
// is FRAMEBUFFER_MULTIVIEW_SIDE_BY_SIDE_ANGLE or the number of views in the current read
// framebuffer is more than one.
// OVR_multiview spec:
// INVALID_FRAMEBUFFER_OPERATION is generated by commands that read from the
// framebuffer such as BlitFramebuffer, ReadPixels, CopyTexImage*, and
// CopyTexSubImage*, if the number of views in the current read framebuffer
// is greater than 1.
if (readFramebuffer->readDisallowedByMultiview())
{
context->validationError(entryPoint, GL_INVALID_FRAMEBUFFER_OPERATION,

View File

@@ -506,7 +506,7 @@ TEST_F(OVRMultiview2VertexShaderTest, GLInstanceIDIsRenamed)
}
// Test that gl_ViewID_OVR gets correctly replaced by ViewID_OVR. gl_ViewID_OVR should not be found
// by either name or qualifier. The number of occurrences of ViewID_OVR in the AST should be the sum
// by the name. The number of occurrences of ViewID_OVR in the AST should be the sum
// of two and the number of occurrences of gl_ViewID_OVR before any renaming.
TEST_F(OVRMultiview2VertexShaderTest, GLViewIDIsRenamed)
{
@@ -528,12 +528,8 @@ TEST_F(OVRMultiview2VertexShaderTest, GLViewIDIsRenamed)
mASTRoot->traverse(&glViewIDOVRByName);
EXPECT_EQ(0u, glViewIDOVRByName.getNumberOfOccurrences());
SymbolOccurrenceCounterByQualifier glViewIDOVRByQualifier(EvqViewIDOVR);
mASTRoot->traverse(&glViewIDOVRByQualifier);
EXPECT_EQ(0u, glViewIDOVRByQualifier.getNumberOfOccurrences());
SymbolOccurrenceCounterByNameAndQualifier viewIDByNameAndQualifier(
ImmutableString("ViewID_OVR"), EvqFlatOut);
ImmutableString("ViewID_OVR"), EvqViewIDOVR);
mASTRoot->traverse(&viewIDByNameAndQualifier);
EXPECT_EQ(6u, viewIDByNameAndQualifier.getNumberOfOccurrences());
}
@@ -592,8 +588,8 @@ TEST_F(OVRMultiview2VertexShaderOutputCodeTest, StrippedOVRMultiviewDirective)
EXPECT_TRUE(foundInESSLCode("GL_OVR_multiview2"));
}
// Test that ViewID_OVR is declared as a flat input variable in an ESSL 3.00 fragment shader.
TEST_F(OVRMultiview2FragmentShaderTest, ViewIDDeclaredAsFlatInput)
// Test that ViewID_OVR has a proper qualifier in an ESSL 3.00 fragment shader.
TEST_F(OVRMultiview2FragmentShaderTest, ViewIDDeclaredAsViewID)
{
const std::string &shaderString =
"#version 300 es\n"
@@ -603,7 +599,7 @@ TEST_F(OVRMultiview2FragmentShaderTest, ViewIDDeclaredAsFlatInput)
"}\n";
mCompileOptions.initializeBuiltinsForInstancedMultiview = true;
compileAssumeSuccess(shaderString);
VariableOccursNTimes(mASTRoot, ImmutableString("ViewID_OVR"), EvqFlatIn, 1u);
VariableOccursNTimes(mASTRoot, ImmutableString("ViewID_OVR"), EvqViewIDOVR, 1u);
}
// Test that GL_OVR_multiview is not defined by the preprocessor for WebGL spec shader;
@@ -728,25 +724,6 @@ TEST_F(OVRMultiview2ComputeShaderOutputCodeTest, ViewportArray2IsNotEmitted)
EXPECT_FALSE(foundInESSLCode("#extension GL_NV_viewport_array2"));
}
// The test checks that the viewport index is selected after the initialization of ViewID_OVR for
// GLSL and ESSL ouputs.
TEST_F(OVRMultiview2VertexShaderOutputCodeTest, GlViewportIndexIsSet)
{
const std::string &shaderString =
"#version 300 es\n"
"#extension GL_OVR_multiview2 : require\n"
"layout(num_views = 3) in;\n"
"void main()\n"
"{\n"
"}\n";
compile(shaderString, mMultiviewCompileOptions);
std::vector<const char *> expectedStrings = {"ViewID_OVR = (uint(gl_InstanceID) % 3u)",
"gl_ViewportIndex = int(ViewID_OVR)"};
EXPECT_TRUE(foundInCodeInOrder(SH_ESSL_OUTPUT, expectedStrings));
EXPECT_TRUE(foundInCodeInOrder(SH_GLSL_COMPATIBILITY_OUTPUT, expectedStrings));
}
// The test checks that the layer is selected after the initialization of ViewID_OVR for
// GLSL and ESSL ouputs.
TEST_F(OVRMultiview2VertexShaderOutputCodeTest, GlLayerIsSet)

View File

@@ -522,7 +522,7 @@ TEST_F(OVRMultiviewVertexShaderTest, GLInstanceIDIsRenamed)
}
// Test that gl_ViewID_OVR gets correctly replaced by ViewID_OVR. gl_ViewID_OVR should not be found
// by either name or qualifier. The number of occurrences of ViewID_OVR in the AST should be the sum
// by the name. The number of occurrences of ViewID_OVR in the AST should be the sum
// of two and the number of occurrences of gl_ViewID_OVR before any renaming.
TEST_F(OVRMultiviewVertexShaderTest, GLViewIDIsRenamed)
{
@@ -544,12 +544,8 @@ TEST_F(OVRMultiviewVertexShaderTest, GLViewIDIsRenamed)
mASTRoot->traverse(&glViewIDOVRByName);
EXPECT_EQ(0u, glViewIDOVRByName.getNumberOfOccurrences());
SymbolOccurrenceCounterByQualifier glViewIDOVRByQualifier(EvqViewIDOVR);
mASTRoot->traverse(&glViewIDOVRByQualifier);
EXPECT_EQ(0u, glViewIDOVRByQualifier.getNumberOfOccurrences());
SymbolOccurrenceCounterByNameAndQualifier viewIDByNameAndQualifier(
ImmutableString("ViewID_OVR"), EvqFlatOut);
ImmutableString("ViewID_OVR"), EvqViewIDOVR);
mASTRoot->traverse(&viewIDByNameAndQualifier);
EXPECT_EQ(6u, viewIDByNameAndQualifier.getNumberOfOccurrences());
}
@@ -610,8 +606,8 @@ TEST_F(OVRMultiviewVertexShaderOutputCodeTest, StrippedOVRMultiviewDirective)
EXPECT_TRUE(foundInESSLCode("GL_OVR_multiview"));
}
// Test that ViewID_OVR is declared as a flat input variable in an ESSL 3.00 fragment shader.
TEST_F(OVRMultiviewFragmentShaderTest, ViewIDDeclaredAsFlatInput)
// Test that ViewID_OVR has a proper qualifier in an ESSL 3.00 fragment shader.
TEST_F(OVRMultiviewFragmentShaderTest, ViewIDDeclaredAsViewID)
{
const std::string &shaderString =
"#version 300 es\n"
@@ -621,7 +617,7 @@ TEST_F(OVRMultiviewFragmentShaderTest, ViewIDDeclaredAsFlatInput)
"}\n";
mCompileOptions.initializeBuiltinsForInstancedMultiview = true;
compileAssumeSuccess(shaderString);
VariableOccursNTimes(mASTRoot, ImmutableString("ViewID_OVR"), EvqFlatIn, 1u);
VariableOccursNTimes(mASTRoot, ImmutableString("ViewID_OVR"), EvqViewIDOVR, 1u);
}
// The test checks that the GL_NV_viewport_array2 extension is emitted in a vertex shader if the
@@ -711,25 +707,6 @@ TEST_F(OVRMultiviewComputeShaderOutputCodeTest, ViewportArray2IsNotEmitted)
EXPECT_FALSE(foundInESSLCode("#extension GL_NV_viewport_array2"));
}
// The test checks that the viewport index is selected after the initialization of ViewID_OVR for
// GLSL and ESSL ouputs.
TEST_F(OVRMultiviewVertexShaderOutputCodeTest, GlViewportIndexIsSet)
{
const std::string &shaderString =
"#version 300 es\n"
"#extension GL_OVR_multiview : require\n"
"layout(num_views = 3) in;\n"
"void main()\n"
"{\n"
"}\n";
compile(shaderString, mMultiviewCompileOptions);
std::vector<const char *> expectedStrings = {"ViewID_OVR = (uint(gl_InstanceID) % 3u)",
"gl_ViewportIndex = int(ViewID_OVR)"};
EXPECT_TRUE(foundInCodeInOrder(SH_ESSL_OUTPUT, expectedStrings));
EXPECT_TRUE(foundInCodeInOrder(SH_GLSL_COMPATIBILITY_OUTPUT, expectedStrings));
}
// The test checks that the layer is selected after the initialization of ViewID_OVR for
// GLSL and ESSL ouputs.
TEST_F(OVRMultiviewVertexShaderOutputCodeTest, GlLayerIsSet)

View File

@@ -1585,8 +1585,6 @@ TEST_P(MultiviewRenderPrimitiveTest, Points)
return;
}
// Test failing on P400 graphics card (anglebug.com/2228)
ANGLE_SKIP_TEST_IF(IsWindows() && IsD3D11() && IsNVIDIA());
ANGLE_SKIP_TEST_IF(IsARM64() && IsWindows() && IsD3D());
const std::string VS =
@@ -1974,8 +1972,6 @@ TEST_P(MultiviewRenderTest, DivisorUpdatedOnProgramChange)
return;
}
// Test failing on P400 graphics card (anglebug.com/2228)
ANGLE_SKIP_TEST_IF(IsWindows() && IsD3D11() && IsNVIDIA());
ANGLE_SKIP_TEST_IF(IsARM64() && IsWindows() && IsD3D());
// Looks like an incorrect D3D debug layer message is generated on Windows / AMD.