mirror of
https://github.com/godotengine/godot-angle-static.git
synced 2026-01-03 14:09:33 +03:00
Revert "Cleanup multiview support"
This reverts commit 9a7c0b88ba.
Reason for revert: Suspected cause of crash on Canary
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: I5e0706cbf26ea820b51400124ddbf2624b738f17
> Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4660046
> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
> Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com>
Bug: chromium:1462504
Bug: chromium:1462505
Bug: chromium:1462506
Bug: chromium:1462478
Bug: chromium:1462531
Change-Id: Ie0e76b1c6823db19f68bb67fdfc8abc00cc62f88
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4666209
Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
This commit is contained in:
committed by
Angle LUCI CQ
parent
25f3eafcd3
commit
f0deadab14
@@ -73,7 +73,7 @@ struct CompiledShaderState
|
||||
gl::BlendEquationBitSet advancedBlendEquations;
|
||||
SpecConstUsageBits specConstUsageBits;
|
||||
|
||||
// GL_OVR_multiview / GL_OVR_multiview2
|
||||
// ANGLE_multiview.
|
||||
int numViews;
|
||||
|
||||
// Geometry Shader
|
||||
|
||||
@@ -393,10 +393,6 @@ 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:
|
||||
|
||||
@@ -823,11 +823,6 @@ void OutputHLSL::header(TInfoSinkBase &out,
|
||||
}
|
||||
}
|
||||
|
||||
if (mUsesViewID)
|
||||
{
|
||||
out << "static uint ViewID_OVR = 0;\n";
|
||||
}
|
||||
|
||||
if (mUsesFragDepth)
|
||||
{
|
||||
out << "static float gl_Depth = 0.0;\n";
|
||||
@@ -919,9 +914,16 @@ 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 = 4;
|
||||
unsigned int registerIndex = 5;
|
||||
mResourcesHLSL->samplerMetadataUniforms(out, registerIndex);
|
||||
// Sampler metadata struct must be two 4-vec, 32 bytes.
|
||||
registerIndex += mResourcesHLSL->getSamplerCount() * 2;
|
||||
@@ -1041,17 +1043,12 @@ void OutputHLSL::header(TInfoSinkBase &out,
|
||||
|
||||
if (mUsesInstanceID)
|
||||
{
|
||||
out << "static int gl_InstanceID;\n";
|
||||
}
|
||||
|
||||
if (mUsesViewID)
|
||||
{
|
||||
out << "static uint ViewID_OVR;\n";
|
||||
out << "static int gl_InstanceID;";
|
||||
}
|
||||
|
||||
if (mUsesVertexID)
|
||||
{
|
||||
out << "static int gl_VertexID;\n";
|
||||
out << "static int gl_VertexID;";
|
||||
}
|
||||
|
||||
out << "\n"
|
||||
@@ -1088,8 +1085,15 @@ void OutputHLSL::header(TInfoSinkBase &out,
|
||||
out << " float2 dx_ViewCoords : packoffset(c2);\n";
|
||||
out << " float2 dx_ViewScale : packoffset(c3);\n";
|
||||
|
||||
out << " float clipControlOrigin : packoffset(c3.z);\n";
|
||||
out << " float clipControlZeroToOne : packoffset(c3.w);\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";
|
||||
|
||||
if (mOutputType == SH_HLSL_4_1_OUTPUT)
|
||||
{
|
||||
@@ -1098,12 +1102,12 @@ void OutputHLSL::header(TInfoSinkBase &out,
|
||||
|
||||
if (mUsesVertexID)
|
||||
{
|
||||
out << " uint dx_VertexID : packoffset(c4.x);\n";
|
||||
out << " uint dx_VertexID : packoffset(c4.y);\n";
|
||||
}
|
||||
|
||||
if (mClipDistanceSize)
|
||||
{
|
||||
out << " uint clipDistancesEnabled : packoffset(c4.y);\n";
|
||||
out << " uint clipDistancesEnabled : packoffset(c4.z);\n";
|
||||
}
|
||||
|
||||
out << "};\n"
|
||||
@@ -1239,7 +1243,7 @@ void OutputHLSL::header(TInfoSinkBase &out,
|
||||
|
||||
if (mHasMultiviewExtensionEnabled)
|
||||
{
|
||||
out << "#define GL_MULTIVIEW_ENABLED\n";
|
||||
out << "#define GL_ANGLE_MULTIVIEW_ENABLED\n";
|
||||
}
|
||||
|
||||
if (mUsesVertexID)
|
||||
@@ -1395,17 +1399,16 @@ 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;
|
||||
|
||||
@@ -75,7 +75,7 @@ void InitializeViewIDAndInstanceID(const TVariable *viewID,
|
||||
initializers->push_back(viewIDInitializer);
|
||||
}
|
||||
|
||||
// Write int(ViewID_OVR) to gl_Layer. The assignment is
|
||||
// Adds a branch to write int(ViewID_OVR) to either gl_ViewportIndex or gl_Layer. The branch is
|
||||
// added to the end of the initializers' sequence.
|
||||
void SelectViewIndexInVertexShader(const TVariable *viewID,
|
||||
const TVariable *multiviewBaseViewLayerIndex,
|
||||
@@ -88,6 +88,14 @@ 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());
|
||||
|
||||
@@ -95,7 +103,22 @@ void SelectViewIndexInVertexShader(const TVariable *viewID,
|
||||
TIntermBinary *sumOfViewIDAndBaseViewIndex = new TIntermBinary(
|
||||
EOpAdd, viewIDAsInt->deepCopy(), new TIntermSymbol(multiviewBaseViewLayerIndex));
|
||||
|
||||
initializers->push_back(new TIntermBinary(EOpAssign, layerSymbol, sumOfViewIDAndBaseViewIndex));
|
||||
// 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);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
@@ -110,9 +133,10 @@ 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, EvqViewIDOVR),
|
||||
SymbolType::AngleInternal);
|
||||
new TVariable(symbolTable, kViewIDVariableName,
|
||||
new TType(EbtUInt, EbpHigh, viewIDQualifier), SymbolType::AngleInternal);
|
||||
|
||||
DeclareGlobalVariable(root, viewID);
|
||||
if (!ReplaceVariable(compiler, root, BuiltInVariable::gl_ViewID_OVR(), viewID))
|
||||
@@ -137,7 +161,7 @@ bool DeclareAndInitBuiltinsForInstancedMultiview(TCompiler *compiler,
|
||||
InitializeViewIDAndInstanceID(viewID, instanceID, numberOfViews, *symbolTable,
|
||||
&initializers);
|
||||
|
||||
// The AST transformation which adds the expression to select the layer index should
|
||||
// The AST transformation which adds the expression to select the viewport 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
|
||||
@@ -145,7 +169,7 @@ bool DeclareAndInitBuiltinsForInstancedMultiview(TCompiler *compiler,
|
||||
ASSERT(!selectView || IsOutputGLSL(shaderOutput) || IsOutputESSL(shaderOutput));
|
||||
if (selectView)
|
||||
{
|
||||
// Add a uniform to pass the base view index.
|
||||
// Add a uniform to switch between side-by-side and layered rendering.
|
||||
const TType *baseLayerIndexVariableType =
|
||||
StaticType::Get<EbtInt, EbpHigh, EvqUniform, 1, 1>();
|
||||
const TVariable *multiviewBaseViewLayerIndex =
|
||||
@@ -153,7 +177,8 @@ bool DeclareAndInitBuiltinsForInstancedMultiview(TCompiler *compiler,
|
||||
baseLayerIndexVariableType, SymbolType::AngleInternal);
|
||||
DeclareGlobalVariable(root, multiviewBaseViewLayerIndex);
|
||||
|
||||
// Setting a value to gl_Layer should happen after ViewID_OVR's initialization.
|
||||
// Setting a value to gl_ViewportIndex or gl_Layer should happen after ViewID_OVR's
|
||||
// initialization.
|
||||
SelectViewIndexInVertexShader(viewID, multiviewBaseViewLayerIndex, &initializers,
|
||||
*symbolTable);
|
||||
}
|
||||
|
||||
@@ -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 with the same qualifier.
|
||||
// declare it as a flat varying.
|
||||
//
|
||||
// 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,9 +15,13 @@
|
||||
// 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
|
||||
// gl_Layer = int(ViewID_OVR) + multiviewBaseViewLayerIndex;
|
||||
// is added after ViewID and InstanceID are initialized. Also, multiviewBaseViewLayerIndex is added
|
||||
// as a uniform.
|
||||
// "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.
|
||||
//
|
||||
|
||||
#ifndef COMPILER_TRANSLATOR_TREEOPS_DECLAREANDINITBUILTINSFORINSTANCEDMULTIVIEW_H_
|
||||
|
||||
@@ -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 multiview implementation.
|
||||
// Maximum number of views which are supported by the implementation of ANGLE_multiview.
|
||||
IMPLEMENTATION_ANGLE_MULTIVIEW_MAX_VIEWS = 4,
|
||||
|
||||
// These are the maximums the implementation can support
|
||||
|
||||
@@ -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 = "OVR_multiview or OVR_multiview2 are not available.";
|
||||
MSG kMultiviewNotAvailable = "ANGLE_multiview is 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.";
|
||||
|
||||
@@ -386,7 +386,7 @@ class ProgramState final : angle::NonCopyable
|
||||
bool mSeparable;
|
||||
rx::SpecConstUsageBits mSpecConstUsageBits;
|
||||
|
||||
// GL_OVR_multiview / GL_OVR_multiview2
|
||||
// ANGLE_multiview.
|
||||
int mNumViews;
|
||||
|
||||
// GL_ANGLE_multi_draw
|
||||
|
||||
@@ -563,6 +563,12 @@ 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";
|
||||
@@ -719,10 +725,16 @@ void DynamicHLSL::generateShaderLinkHLSL(const gl::Context *context,
|
||||
{
|
||||
vertexGenerateOutput << " output.gl_ViewID_OVR = ViewID_OVR;\n";
|
||||
}
|
||||
if (programMetadata.hasMultiviewEnabled() && programMetadata.canSelectViewInVertexShader())
|
||||
if (programMetadata.hasANGLEMultiviewEnabled() && programMetadata.canSelectViewInVertexShader())
|
||||
{
|
||||
ASSERT(vertexBuiltins.glLayer.enabled);
|
||||
vertexGenerateOutput << " output.gl_Layer = ViewID_OVR;\n";
|
||||
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";
|
||||
}
|
||||
|
||||
// On D3D9 or D3D11 Feature Level 9, we need to emulate large viewports using dx_ViewAdjust.
|
||||
@@ -1206,7 +1218,7 @@ void DynamicHLSL::generateShaderLinkHLSL(const gl::Context *context,
|
||||
|
||||
std::string DynamicHLSL::generateGeometryShaderPreamble(const VaryingPacking &varyingPacking,
|
||||
const BuiltinVaryingsD3D &builtinsD3D,
|
||||
const bool hasMultiviewEnabled,
|
||||
const bool hasANGLEMultiviewEnabled,
|
||||
const bool selectViewInVS) const
|
||||
{
|
||||
ASSERT(mRenderer->getMajorShaderModel() >= 4);
|
||||
@@ -1233,15 +1245,18 @@ std::string DynamicHLSL::generateGeometryShaderPreamble(const VaryingPacking &va
|
||||
preambleStream << " output.gl_PointSize = input.gl_PointSize;\n";
|
||||
}
|
||||
|
||||
if (hasMultiviewEnabled)
|
||||
if (hasANGLEMultiviewEnabled)
|
||||
{
|
||||
preambleStream << " output.gl_ViewID_OVR = input.gl_ViewID_OVR;\n";
|
||||
if (selectViewInVS)
|
||||
{
|
||||
ASSERT(builtinsD3D[gl::ShaderType::Geometry].glLayer.enabled);
|
||||
ASSERT(builtinsD3D[gl::ShaderType::Geometry].glViewportIndex.enabled &&
|
||||
builtinsD3D[gl::ShaderType::Geometry].glLayer.enabled);
|
||||
|
||||
// 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";
|
||||
// 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";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1268,14 +1283,26 @@ std::string DynamicHLSL::generateGeometryShaderPreamble(const VaryingPacking &va
|
||||
<< "#endif // ANGLE_POINT_SPRITE_SHADER\n"
|
||||
<< "}\n";
|
||||
|
||||
if (hasMultiviewEnabled && !selectViewInVS)
|
||||
if (hasANGLEMultiviewEnabled && !selectViewInVS)
|
||||
{
|
||||
ASSERT(builtinsD3D[gl::ShaderType::Geometry].glLayer.enabled);
|
||||
ASSERT(builtinsD3D[gl::ShaderType::Geometry].glViewportIndex.enabled &&
|
||||
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"
|
||||
<< " output.gl_Layer = input.gl_ViewID_OVR;\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"
|
||||
<< "}\n";
|
||||
}
|
||||
|
||||
@@ -1286,7 +1313,7 @@ std::string DynamicHLSL::generateGeometryShaderHLSL(const gl::Caps &caps,
|
||||
gl::PrimitiveMode primitiveType,
|
||||
const gl::ProgramState &programData,
|
||||
const bool useViewScale,
|
||||
const bool hasMultiviewEnabled,
|
||||
const bool hasANGLEMultiviewEnabled,
|
||||
const bool selectViewInVS,
|
||||
const bool pointSpriteEmulation,
|
||||
const std::string &preambleString) const
|
||||
@@ -1345,7 +1372,7 @@ std::string DynamicHLSL::generateGeometryShaderHLSL(const gl::Caps &caps,
|
||||
break;
|
||||
}
|
||||
|
||||
if (pointSprites || hasMultiviewEnabled)
|
||||
if (pointSprites || hasANGLEMultiviewEnabled)
|
||||
{
|
||||
shaderStream << "cbuffer DriverConstants : register(b0)\n"
|
||||
"{\n";
|
||||
@@ -1359,6 +1386,13 @@ 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";
|
||||
}
|
||||
|
||||
@@ -1416,7 +1450,7 @@ std::string DynamicHLSL::generateGeometryShaderHLSL(const gl::Caps &caps,
|
||||
{
|
||||
shaderStream << " copyVertex(output, input[" << vertexIndex
|
||||
<< "], input[lastVertexIndex]);\n";
|
||||
if (hasMultiviewEnabled && !selectViewInVS)
|
||||
if (hasANGLEMultiviewEnabled && !selectViewInVS)
|
||||
{
|
||||
shaderStream << " selectView(output, input[" << vertexIndex << "]);\n";
|
||||
}
|
||||
@@ -1741,15 +1775,27 @@ void BuiltinVaryingsD3D::updateBuiltins(gl::ShaderType shaderType,
|
||||
}
|
||||
}
|
||||
|
||||
if (metadata.hasMultiviewEnabled())
|
||||
if (metadata.hasANGLEMultiviewEnabled())
|
||||
{
|
||||
// Although it is possible to compute gl_ViewID_OVR from the value of
|
||||
// SV_RenderTargetArrayIndex, it is easier and cleaner to always pass it as a varying.
|
||||
// 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.
|
||||
builtins->glViewIDOVR.enable(userSemantic, reservedSemanticIndex++);
|
||||
|
||||
if ((shaderType == gl::ShaderType::Vertex && metadata.canSelectViewInVertexShader()) ||
|
||||
shaderType == gl::ShaderType::Geometry)
|
||||
if (shaderType == gl::ShaderType::Vertex)
|
||||
{
|
||||
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");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -181,14 +181,14 @@ class DynamicHLSL : angle::NonCopyable
|
||||
|
||||
std::string generateGeometryShaderPreamble(const gl::VaryingPacking &varyingPacking,
|
||||
const BuiltinVaryingsD3D &builtinsD3D,
|
||||
const bool hasMultiviewEnabled,
|
||||
const bool hasANGLEMultiviewEnabled,
|
||||
const bool selectViewInVS) const;
|
||||
|
||||
std::string generateGeometryShaderHLSL(const gl::Caps &caps,
|
||||
gl::PrimitiveMode primitiveType,
|
||||
const gl::ProgramState &programData,
|
||||
const bool useViewScale,
|
||||
const bool hasMultiviewEnabled,
|
||||
const bool hasANGLEMultiviewEnabled,
|
||||
const bool selectViewInVS,
|
||||
const bool pointSpriteEmulation,
|
||||
const std::string &preambleString) const;
|
||||
|
||||
@@ -470,10 +470,10 @@ bool ProgramD3DMetadata::usesViewScale() const
|
||||
return mUsesViewScale;
|
||||
}
|
||||
|
||||
bool ProgramD3DMetadata::hasMultiviewEnabled() const
|
||||
bool ProgramD3DMetadata::hasANGLEMultiviewEnabled() const
|
||||
{
|
||||
const rx::ShaderD3D *shader = mAttachedShaders[gl::ShaderType::Vertex];
|
||||
return (shader && shader->hasMultiviewEnabled());
|
||||
return (shader && shader->hasANGLEMultiviewEnabled());
|
||||
}
|
||||
|
||||
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 (mHasMultiviewEnabled && !mRenderer->canSelectViewInVertexShader())
|
||||
if (mHasANGLEMultiviewEnabled && !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(&mHasMultiviewEnabled);
|
||||
stream->readBool(&mHasANGLEMultiviewEnabled);
|
||||
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(mHasMultiviewEnabled);
|
||||
stream->writeBool(mHasANGLEMultiviewEnabled);
|
||||
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(), mHasMultiviewEnabled,
|
||||
mRenderer->canSelectViewInVertexShader(), usesGeometryShaderForPointSpriteEmulation(),
|
||||
mGeometryShaderPreamble);
|
||||
caps, geometryShaderType, mState, mRenderer->presentPathFastEnabled(),
|
||||
mHasANGLEMultiviewEnabled, 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();
|
||||
mHasMultiviewEnabled = metadata.hasMultiviewEnabled();
|
||||
mFragDepthUsage = metadata.getFragDepthUsage();
|
||||
mUsesSampleMask = metadata.usesSampleMask();
|
||||
mUsesVertexID = metadata.usesVertexID();
|
||||
mUsesViewID = metadata.usesViewID();
|
||||
mHasANGLEMultiviewEnabled = metadata.hasANGLEMultiviewEnabled();
|
||||
|
||||
// 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, mHasMultiviewEnabled,
|
||||
varyingPacking, builtins, mHasANGLEMultiviewEnabled,
|
||||
metadata.canSelectViewInVertexShader());
|
||||
}
|
||||
|
||||
@@ -3082,11 +3082,11 @@ void ProgramD3D::reset()
|
||||
mShaderHLSL[shaderType].clear();
|
||||
}
|
||||
|
||||
mFragDepthUsage = FragDepthUsage::Unused;
|
||||
mUsesSampleMask = false;
|
||||
mHasMultiviewEnabled = false;
|
||||
mUsesVertexID = false;
|
||||
mUsesViewID = false;
|
||||
mFragDepthUsage = FragDepthUsage::Unused;
|
||||
mUsesSampleMask = false;
|
||||
mHasANGLEMultiviewEnabled = false;
|
||||
mUsesVertexID = false;
|
||||
mUsesViewID = false;
|
||||
mPixelShaderKey.clear();
|
||||
mUsesPointSize = false;
|
||||
mUsesFlatInterpolation = false;
|
||||
|
||||
@@ -158,7 +158,7 @@ class ProgramD3DMetadata final : angle::NonCopyable
|
||||
bool usesPointSize() const;
|
||||
bool usesInsertedPointCoordValue() const;
|
||||
bool usesViewScale() const;
|
||||
bool hasMultiviewEnabled() const;
|
||||
bool hasANGLEMultiviewEnabled() const;
|
||||
bool usesVertexID() const;
|
||||
bool usesViewID() const;
|
||||
bool canSelectViewInVertexShader() const;
|
||||
@@ -556,7 +556,7 @@ class ProgramD3D : public ProgramImpl
|
||||
|
||||
FragDepthUsage mFragDepthUsage;
|
||||
bool mUsesSampleMask;
|
||||
bool mHasMultiviewEnabled;
|
||||
bool mHasANGLEMultiviewEnabled;
|
||||
bool mUsesVertexID;
|
||||
bool mUsesViewID;
|
||||
std::vector<PixelShaderOutputVariable> mPixelShaderKey;
|
||||
|
||||
@@ -128,7 +128,7 @@ void ShaderD3D::uncompile()
|
||||
mUsesSampleMaskIn = false;
|
||||
mUsesSampleMask = false;
|
||||
mUsesDepthRange = false;
|
||||
mHasMultiviewEnabled = false;
|
||||
mHasANGLEMultiviewEnabled = false;
|
||||
mUsesVertexID = false;
|
||||
mUsesViewID = false;
|
||||
mUsesDiscardRewriting = false;
|
||||
@@ -316,12 +316,13 @@ 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;
|
||||
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;
|
||||
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;
|
||||
mUsesDiscardRewriting =
|
||||
translatedSource.find("ANGLE_USES_DISCARD_REWRITING") != std::string::npos;
|
||||
mUsesNestedBreak = translatedSource.find("ANGLE_USES_NESTED_BREAK") != std::string::npos;
|
||||
|
||||
@@ -97,7 +97,7 @@ class ShaderD3D : public ShaderImpl
|
||||
bool usesSamplePosition() const { return mUsesSamplePosition; }
|
||||
bool usesSampleMaskIn() const { return mUsesSampleMaskIn; }
|
||||
bool usesSampleMask() const { return mUsesSampleMask; }
|
||||
bool hasMultiviewEnabled() const { return mHasMultiviewEnabled; }
|
||||
bool hasANGLEMultiviewEnabled() const { return mHasANGLEMultiviewEnabled; }
|
||||
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 mHasMultiviewEnabled;
|
||||
bool mHasANGLEMultiviewEnabled;
|
||||
bool mUsesVertexID;
|
||||
bool mUsesViewID;
|
||||
bool mUsesDiscardRewriting;
|
||||
|
||||
@@ -434,6 +434,14 @@ 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,
|
||||
@@ -485,6 +493,8 @@ 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];
|
||||
@@ -1106,6 +1116,10 @@ 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:
|
||||
@@ -1230,6 +1244,21 @@ 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,
|
||||
|
||||
@@ -39,6 +39,7 @@ 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,
|
||||
@@ -70,6 +71,7 @@ class ShaderConstants11 : angle::NonCopyable
|
||||
viewAdjust{.0f},
|
||||
viewCoords{.0f},
|
||||
viewScale{.0f},
|
||||
multiviewWriteToViewportIndex{.0f},
|
||||
clipControlOrigin{-1.0f},
|
||||
clipControlZeroToOne{.0f},
|
||||
firstVertex{0},
|
||||
@@ -81,6 +83,10 @@ 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
|
||||
@@ -93,7 +99,7 @@ class ShaderConstants11 : angle::NonCopyable
|
||||
uint32_t clipDistancesEnabled;
|
||||
|
||||
// Added here to manually pad the struct to 16 byte boundary
|
||||
float padding[2];
|
||||
float padding[1];
|
||||
};
|
||||
static_assert(sizeof(Vertex) % 16u == 0,
|
||||
"D3D11 constant buffers must be multiples of 16 bytes");
|
||||
@@ -105,7 +111,9 @@ class ShaderConstants11 : angle::NonCopyable
|
||||
viewCoords{.0f},
|
||||
depthFront{.0f},
|
||||
fragCoordOffset{.0f},
|
||||
viewScale{.0f}
|
||||
viewScale{.0f},
|
||||
multiviewWriteToViewportIndex{.0f},
|
||||
padding{.0f}
|
||||
{}
|
||||
|
||||
float depthRange[4];
|
||||
@@ -113,6 +121,13 @@ 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");
|
||||
|
||||
@@ -385,6 +400,8 @@ 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> ¤tValues);
|
||||
@@ -630,6 +647,7 @@ class StateManager11 final : angle::NonCopyable
|
||||
std::vector<const TranslatedAttribute *> mCurrentAttributes;
|
||||
Optional<GLint> mLastFirstVertex;
|
||||
|
||||
// ANGLE_multiview.
|
||||
bool mIsMultiviewEnabled;
|
||||
|
||||
bool mIndependentBlendStates;
|
||||
|
||||
@@ -1342,7 +1342,7 @@ unsigned int GetMaxViewportAndScissorRectanglesPerPipeline(D3D_FEATURE_LEVEL fea
|
||||
|
||||
bool IsMultiviewSupported(D3D_FEATURE_LEVEL featureLevel)
|
||||
{
|
||||
// The multiview extensions can always be supported in D3D11 through geometry shaders.
|
||||
// The ANGLE_multiview extension can always be supported in D3D11 through geometry shaders.
|
||||
switch (featureLevel)
|
||||
{
|
||||
case D3D_FEATURE_LEVEL_11_1:
|
||||
|
||||
@@ -1059,6 +1059,15 @@ 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());
|
||||
|
||||
@@ -110,6 +110,7 @@ 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,
|
||||
|
||||
@@ -3916,11 +3916,11 @@ bool ValidateCopyTexImageParametersBase(const Context *context,
|
||||
return false;
|
||||
}
|
||||
|
||||
// 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.
|
||||
// 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.
|
||||
if (readFramebuffer->readDisallowedByMultiview())
|
||||
{
|
||||
context->validationError(entryPoint, GL_INVALID_FRAMEBUFFER_OPERATION,
|
||||
|
||||
@@ -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 the name. The number of occurrences of ViewID_OVR in the AST should be the sum
|
||||
// by either name or qualifier. 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,8 +528,12 @@ 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"), EvqViewIDOVR);
|
||||
ImmutableString("ViewID_OVR"), EvqFlatOut);
|
||||
mASTRoot->traverse(&viewIDByNameAndQualifier);
|
||||
EXPECT_EQ(6u, viewIDByNameAndQualifier.getNumberOfOccurrences());
|
||||
}
|
||||
@@ -588,8 +592,8 @@ TEST_F(OVRMultiview2VertexShaderOutputCodeTest, StrippedOVRMultiviewDirective)
|
||||
EXPECT_TRUE(foundInESSLCode("GL_OVR_multiview2"));
|
||||
}
|
||||
|
||||
// Test that ViewID_OVR has a proper qualifier in an ESSL 3.00 fragment shader.
|
||||
TEST_F(OVRMultiview2FragmentShaderTest, ViewIDDeclaredAsViewID)
|
||||
// Test that ViewID_OVR is declared as a flat input variable in an ESSL 3.00 fragment shader.
|
||||
TEST_F(OVRMultiview2FragmentShaderTest, ViewIDDeclaredAsFlatInput)
|
||||
{
|
||||
const std::string &shaderString =
|
||||
"#version 300 es\n"
|
||||
@@ -599,7 +603,7 @@ TEST_F(OVRMultiview2FragmentShaderTest, ViewIDDeclaredAsViewID)
|
||||
"}\n";
|
||||
mCompileOptions.initializeBuiltinsForInstancedMultiview = true;
|
||||
compileAssumeSuccess(shaderString);
|
||||
VariableOccursNTimes(mASTRoot, ImmutableString("ViewID_OVR"), EvqViewIDOVR, 1u);
|
||||
VariableOccursNTimes(mASTRoot, ImmutableString("ViewID_OVR"), EvqFlatIn, 1u);
|
||||
}
|
||||
|
||||
// Test that GL_OVR_multiview is not defined by the preprocessor for WebGL spec shader;
|
||||
@@ -724,6 +728,25 @@ 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)
|
||||
|
||||
@@ -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 the name. The number of occurrences of ViewID_OVR in the AST should be the sum
|
||||
// by either name or qualifier. 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,8 +544,12 @@ 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"), EvqViewIDOVR);
|
||||
ImmutableString("ViewID_OVR"), EvqFlatOut);
|
||||
mASTRoot->traverse(&viewIDByNameAndQualifier);
|
||||
EXPECT_EQ(6u, viewIDByNameAndQualifier.getNumberOfOccurrences());
|
||||
}
|
||||
@@ -606,8 +610,8 @@ TEST_F(OVRMultiviewVertexShaderOutputCodeTest, StrippedOVRMultiviewDirective)
|
||||
EXPECT_TRUE(foundInESSLCode("GL_OVR_multiview"));
|
||||
}
|
||||
|
||||
// Test that ViewID_OVR has a proper qualifier in an ESSL 3.00 fragment shader.
|
||||
TEST_F(OVRMultiviewFragmentShaderTest, ViewIDDeclaredAsViewID)
|
||||
// Test that ViewID_OVR is declared as a flat input variable in an ESSL 3.00 fragment shader.
|
||||
TEST_F(OVRMultiviewFragmentShaderTest, ViewIDDeclaredAsFlatInput)
|
||||
{
|
||||
const std::string &shaderString =
|
||||
"#version 300 es\n"
|
||||
@@ -617,7 +621,7 @@ TEST_F(OVRMultiviewFragmentShaderTest, ViewIDDeclaredAsViewID)
|
||||
"}\n";
|
||||
mCompileOptions.initializeBuiltinsForInstancedMultiview = true;
|
||||
compileAssumeSuccess(shaderString);
|
||||
VariableOccursNTimes(mASTRoot, ImmutableString("ViewID_OVR"), EvqViewIDOVR, 1u);
|
||||
VariableOccursNTimes(mASTRoot, ImmutableString("ViewID_OVR"), EvqFlatIn, 1u);
|
||||
}
|
||||
|
||||
// The test checks that the GL_NV_viewport_array2 extension is emitted in a vertex shader if the
|
||||
@@ -707,6 +711,25 @@ 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)
|
||||
|
||||
@@ -1585,6 +1585,8 @@ 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 =
|
||||
@@ -1972,6 +1974,8 @@ 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.
|
||||
|
||||
Reference in New Issue
Block a user