Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for GL_EXT_shader_framebuffer_fetch #72

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
2 changes: 1 addition & 1 deletion DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ vars = {
'glslang_revision': '7d65f09b83112c1ec9e29313cb9913ed2b850aa0',

# Current revision of spirv-cross, the Khronos SPIRV cross compiler.
'spirv_cross_revision': 'f38cbeb814c73510b85697adbe5e894f9eac978f',
'spirv_cross_revision': '0e5078dc0cfb84767b0470150d9e46fc8ffdfd36',

# Current revision fo the SPIRV-Headers Vulkan support library.
'spirv_headers_revision': 'f8bf11a0253a32375c32cad92c841237b96696c0',
Expand Down
3 changes: 3 additions & 0 deletions include/GLSLANG/ShaderLang.h
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,9 @@ using ShHandle = void *;
namespace sh
{

// EXT_shader_framebuffer_fetch and EXT_shader_framebuffer_fetch_non_coherent
extern const char kInputAttachmentName[];

//
// Driver must call this first, once, before doing any other compiler operations.
// If the function succeeds, the return value is true, else false.
Expand Down
3 changes: 3 additions & 0 deletions include/GLSLANG/ShaderVars.h
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,9 @@ struct ShaderVariable
bool readonly;
bool writeonly;

// From EXT_shader_framebuffer_fetch
bool isFragmentInOut;

// OutputVariable
// From EXT_blend_func_extended.
int index;
Expand Down
36 changes: 36 additions & 0 deletions ios/xcode/OpenGLES.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,20 @@
/* End PBXAggregateTarget section */

/* Begin PBXBuildFile section */
03A9001C2779A35500ACAD83 /* ReplaceForShaderFramebufferFetch.h in Headers */ = {isa = PBXBuildFile; fileRef = 03A9001A2779A35500ACAD83 /* ReplaceForShaderFramebufferFetch.h */; };
03A9001D2779A35500ACAD83 /* ReplaceForShaderFramebufferFetch.h in Headers */ = {isa = PBXBuildFile; fileRef = 03A9001A2779A35500ACAD83 /* ReplaceForShaderFramebufferFetch.h */; };
03A9001E2779A35500ACAD83 /* ReplaceForShaderFramebufferFetch.h in Headers */ = {isa = PBXBuildFile; fileRef = 03A9001A2779A35500ACAD83 /* ReplaceForShaderFramebufferFetch.h */; };
03A9001F2779A35500ACAD83 /* ReplaceForShaderFramebufferFetch.h in Headers */ = {isa = PBXBuildFile; fileRef = 03A9001A2779A35500ACAD83 /* ReplaceForShaderFramebufferFetch.h */; };
03A900242779A37400ACAD83 /* ReplaceForShaderFramebufferFetch.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 03A9001B2779A35500ACAD83 /* ReplaceForShaderFramebufferFetch.cpp */; };
03A900252779A37600ACAD83 /* ReplaceForShaderFramebufferFetch.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 03A9001B2779A35500ACAD83 /* ReplaceForShaderFramebufferFetch.cpp */; };
03A900262779A37900ACAD83 /* ReplaceForShaderFramebufferFetch.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 03A9001B2779A35500ACAD83 /* ReplaceForShaderFramebufferFetch.cpp */; };
03A9002D2779A43400ACAD83 /* RunAtTheBeginningOfShader.h in Headers */ = {isa = PBXBuildFile; fileRef = 03A900282779A43400ACAD83 /* RunAtTheBeginningOfShader.h */; };
03A9002E2779A43400ACAD83 /* RunAtTheBeginningOfShader.h in Headers */ = {isa = PBXBuildFile; fileRef = 03A900282779A43400ACAD83 /* RunAtTheBeginningOfShader.h */; };
03A9002F2779A43400ACAD83 /* RunAtTheBeginningOfShader.h in Headers */ = {isa = PBXBuildFile; fileRef = 03A900282779A43400ACAD83 /* RunAtTheBeginningOfShader.h */; };
03A900302779A43400ACAD83 /* RunAtTheBeginningOfShader.h in Headers */ = {isa = PBXBuildFile; fileRef = 03A900282779A43400ACAD83 /* RunAtTheBeginningOfShader.h */; };
03A900312779A43C00ACAD83 /* RunAtTheBeginningOfShader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 03A900272779A43400ACAD83 /* RunAtTheBeginningOfShader.cpp */; };
03A900322779A43F00ACAD83 /* RunAtTheBeginningOfShader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 03A900272779A43400ACAD83 /* RunAtTheBeginningOfShader.cpp */; };
03A900332779A44100ACAD83 /* RunAtTheBeginningOfShader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 03A900272779A43400ACAD83 /* RunAtTheBeginningOfShader.cpp */; };
0A03A9B5244C84EE00E5E114 /* Matrix.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0AA20002234734F400E0B98C /* Matrix.cpp */; };
0A03A9B6244C84EE00E5E114 /* egl_loader_autogen.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0AA2015723474EBF00E0B98C /* egl_loader_autogen.cpp */; };
0A03A9B7244C84EE00E5E114 /* Timer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0A9B83E6234CCE1B008BF16F /* Timer.cpp */; };
Expand Down Expand Up @@ -3977,6 +3991,10 @@
/* End PBXCopyFilesBuildPhase section */

/* Begin PBXFileReference section */
03A9001A2779A35500ACAD83 /* ReplaceForShaderFramebufferFetch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ReplaceForShaderFramebufferFetch.h; sourceTree = "<group>"; };
03A9001B2779A35500ACAD83 /* ReplaceForShaderFramebufferFetch.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ReplaceForShaderFramebufferFetch.cpp; sourceTree = "<group>"; };
03A900272779A43400ACAD83 /* RunAtTheBeginningOfShader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RunAtTheBeginningOfShader.cpp; sourceTree = "<group>"; };
03A900282779A43400ACAD83 /* RunAtTheBeginningOfShader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RunAtTheBeginningOfShader.h; sourceTree = "<group>"; };
0A03A9C7244C84EE00E5E114 /* libangle_util_tvos.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libangle_util_tvos.a; sourceTree = BUILT_PRODUCTS_DIR; };
0A03A9E5244C850000E5E114 /* libangle_common_tvos.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libangle_common_tvos.a; sourceTree = BUILT_PRODUCTS_DIR; };
0A0546CD242C1DD200FC05D0 /* TransformFeedbackMtl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TransformFeedbackMtl.h; path = ../../src/libANGLE/renderer/metal/TransformFeedbackMtl.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -5903,6 +5921,8 @@
0A60537F234651CB005CEA98 /* FindMain.h */,
0A605380234651CB005CEA98 /* FindMain.cpp */,
0A605381234651CB005CEA98 /* IntermNodePatternMatcher.h */,
03A900272779A43400ACAD83 /* RunAtTheBeginningOfShader.cpp */,
03A900282779A43400ACAD83 /* RunAtTheBeginningOfShader.h */,
0A605382234651CB005CEA98 /* RunAtTheEndOfShader.cpp */,
0A7C2E10244390B000B75BA0 /* ReplaceClipDistanceVariable.cpp */,
0A7C2E11244390B000B75BA0 /* ReplaceClipDistanceVariable.h */,
Expand Down Expand Up @@ -5969,6 +5989,8 @@
0A60541A234651CB005CEA98 /* RemoveSwitchFallThrough.h */,
0A6053F1234651CB005CEA98 /* RemoveUnreferencedVariables.cpp */,
0A605425234651CB005CEA98 /* RemoveUnreferencedVariables.h */,
03A9001B2779A35500ACAD83 /* ReplaceForShaderFramebufferFetch.cpp */,
03A9001A2779A35500ACAD83 /* ReplaceForShaderFramebufferFetch.h */,
0A9B840D234CD587008BF16F /* RewriteAtomicCounters.cpp */,
0A9B8405234CD586008BF16F /* RewriteAtomicCounters.h */,
0A60542B234651CB005CEA98 /* RewriteAtomicFunctionExpressions.cpp */,
Expand Down Expand Up @@ -7420,6 +7442,7 @@
0A605581234651CC005CEA98 /* OutputVulkanGLSL.h in Headers */,
0A605F32234667CC005CEA98 /* validationGL12_autogen.h in Headers */,
0A605591234651CC005CEA98 /* IsASTDepthBelowLimit.h in Headers */,
03A9002D2779A43400ACAD83 /* RunAtTheBeginningOfShader.h in Headers */,
0A6054BB234651CB005CEA98 /* length_limits.h in Headers */,
0A60553F234651CC005CEA98 /* RemoveInvariantDeclaration.h in Headers */,
0A605F44234667CC005CEA98 /* Context_gl_1_1_autogen.h in Headers */,
Expand Down Expand Up @@ -7461,6 +7484,7 @@
0A605FBF234667CE005CEA98 /* Context_gles_1_0_autogen.h in Headers */,
0A605F5C234667CD005CEA98 /* validationEGL.h in Headers */,
0A605F89234667CD005CEA98 /* Display.h in Headers */,
03A9001C2779A35500ACAD83 /* ReplaceForShaderFramebufferFetch.h in Headers */,
0A605B9D234667C5005CEA98 /* Context_gles_3_0_autogen.h in Headers */,
0A605B8E234667C5005CEA98 /* Error.h in Headers */,
0A605524234651CC005CEA98 /* ClampFragDepth.h in Headers */,
Expand Down Expand Up @@ -7726,6 +7750,7 @@
0A90F7E324065C0C005BA9A8 /* OutputVulkanGLSL.h in Headers */,
0A90F7E424065C0C005BA9A8 /* validationGL12_autogen.h in Headers */,
0A90F7E524065C0C005BA9A8 /* IsASTDepthBelowLimit.h in Headers */,
03A9002E2779A43400ACAD83 /* RunAtTheBeginningOfShader.h in Headers */,
0A90F7E624065C0C005BA9A8 /* length_limits.h in Headers */,
0A90F7E724065C0C005BA9A8 /* RemoveInvariantDeclaration.h in Headers */,
0A90F7E824065C0C005BA9A8 /* Context_gl_1_1_autogen.h in Headers */,
Expand Down Expand Up @@ -7767,6 +7792,7 @@
0A90F80D24065C0C005BA9A8 /* Context_gles_1_0_autogen.h in Headers */,
0A90F80E24065C0C005BA9A8 /* validationEGL.h in Headers */,
0A90F80F24065C0C005BA9A8 /* Display.h in Headers */,
03A9001D2779A35500ACAD83 /* ReplaceForShaderFramebufferFetch.h in Headers */,
0A90F81024065C0C005BA9A8 /* Context_gles_3_0_autogen.h in Headers */,
0A90F81124065C0C005BA9A8 /* Error.h in Headers */,
0A90F81224065C0C005BA9A8 /* ClampFragDepth.h in Headers */,
Expand Down Expand Up @@ -8046,6 +8072,7 @@
0AA2FDBA2347260000E0B98C /* OutputVulkanGLSL.h in Headers */,
0AA2FDBB2347260000E0B98C /* validationGL12_autogen.h in Headers */,
0AA2FDBC2347260000E0B98C /* IsASTDepthBelowLimit.h in Headers */,
03A900302779A43400ACAD83 /* RunAtTheBeginningOfShader.h in Headers */,
0AA2FDBD2347260000E0B98C /* length_limits.h in Headers */,
0AA2FDBE2347260000E0B98C /* RemoveInvariantDeclaration.h in Headers */,
0AA2FDBF2347260000E0B98C /* Context_gl_1_1_autogen.h in Headers */,
Expand Down Expand Up @@ -8087,6 +8114,7 @@
0AA2FDE82347260000E0B98C /* Context_gles_1_0_autogen.h in Headers */,
0AA2FDE92347260000E0B98C /* validationEGL.h in Headers */,
0AA2FDEA2347260000E0B98C /* Display.h in Headers */,
03A9001F2779A35500ACAD83 /* ReplaceForShaderFramebufferFetch.h in Headers */,
0AA2FDEB2347260000E0B98C /* Context_gles_3_0_autogen.h in Headers */,
0AA2FDEC2347260000E0B98C /* Error.h in Headers */,
0AA2FDED2347260000E0B98C /* ClampFragDepth.h in Headers */,
Expand Down Expand Up @@ -8352,6 +8380,7 @@
0AF957C1244C7CD700F59740 /* OutputVulkanGLSL.h in Headers */,
0AF957C2244C7CD700F59740 /* validationGL12_autogen.h in Headers */,
0AF957C3244C7CD700F59740 /* IsASTDepthBelowLimit.h in Headers */,
03A9002F2779A43400ACAD83 /* RunAtTheBeginningOfShader.h in Headers */,
0AF957C4244C7CD700F59740 /* length_limits.h in Headers */,
0AF957C5244C7CD700F59740 /* RemoveInvariantDeclaration.h in Headers */,
0AF957C6244C7CD700F59740 /* Context_gl_1_1_autogen.h in Headers */,
Expand Down Expand Up @@ -8393,6 +8422,7 @@
0AF957EB244C7CD700F59740 /* Context_gles_1_0_autogen.h in Headers */,
0AF957EC244C7CD700F59740 /* validationEGL.h in Headers */,
0AF957ED244C7CD700F59740 /* Display.h in Headers */,
03A9001E2779A35500ACAD83 /* ReplaceForShaderFramebufferFetch.h in Headers */,
0AF957EE244C7CD700F59740 /* Context_gles_3_0_autogen.h in Headers */,
0AF957EF244C7CD700F59740 /* Error.h in Headers */,
0AF957F0244C7CD700F59740 /* ClampFragDepth.h in Headers */,
Expand Down Expand Up @@ -10816,6 +10846,7 @@
0A936E80244CEFA800B3497E /* WorkerThread.cpp in Sources */,
0A936E81244CEFA800B3497E /* VectorizeVectorScalarArithmetic.cpp in Sources */,
0A936E82244CEFA800B3497E /* ClampPointSize.cpp in Sources */,
03A900242779A37400ACAD83 /* ReplaceForShaderFramebufferFetch.cpp in Sources */,
0A936E83244CEFA800B3497E /* IntermNode_util.cpp in Sources */,
0A936E84244CEFA800B3497E /* Stream.cpp in Sources */,
0A936E85244CEFA800B3497E /* ImmutableString_autogen.cpp in Sources */,
Expand Down Expand Up @@ -10934,6 +10965,7 @@
0A936EFF244CEFA800B3497E /* OutputGLSLBase.cpp in Sources */,
0A936F00244CEFA800B3497E /* load_functions_table_autogen.cpp in Sources */,
0A936F02244CEFA800B3497E /* FindSymbolNode.cpp in Sources */,
03A900312779A43C00ACAD83 /* RunAtTheBeginningOfShader.cpp in Sources */,
0A936F04244CEFA800B3497E /* validationES.cpp in Sources */,
0A936F05244CEFA800B3497E /* ValidateSwitch.cpp in Sources */,
0A936F06244CEFA800B3497E /* EmulateMultiDrawShaderBuiltins.cpp in Sources */,
Expand Down Expand Up @@ -11028,6 +11060,7 @@
0A936F83244CF03700B3497E /* UnfoldShortCircuitToIf.cpp in Sources */,
0A936F84244CF03700B3497E /* EmulateGLFragColorBroadcast.cpp in Sources */,
0A936F85244CF03700B3497E /* SplitSequenceOperator.cpp in Sources */,
03A900252779A37600ACAD83 /* ReplaceForShaderFramebufferFetch.cpp in Sources */,
0A936F86244CF03700B3497E /* InitializeVariables.cpp in Sources */,
0A936F87244CF03700B3497E /* queryconversions.cpp in Sources */,
0A936F8A244CF03700B3497E /* renderer_utils.cpp in Sources */,
Expand All @@ -11039,6 +11072,7 @@
0A936F90244CF03700B3497E /* validationEGL.cpp in Sources */,
0A936F91244CF03700B3497E /* DiagnosticsBase.cpp in Sources */,
0A936F92244CF03700B3497E /* FoldExpressions.cpp in Sources */,
03A900322779A43F00ACAD83 /* RunAtTheBeginningOfShader.cpp in Sources */,
0A936F93244CF03700B3497E /* queryutils.cpp in Sources */,
0A936F94244CF03700B3497E /* Platform.cpp in Sources */,
0A936F96244CF03700B3497E /* IntermNode.cpp in Sources */,
Expand Down Expand Up @@ -11276,6 +11310,7 @@
0A9370B2244CF04900B3497E /* WorkerThread.cpp in Sources */,
0A9370B3244CF04900B3497E /* VectorizeVectorScalarArithmetic.cpp in Sources */,
0A9370B4244CF04900B3497E /* ClampPointSize.cpp in Sources */,
03A900262779A37900ACAD83 /* ReplaceForShaderFramebufferFetch.cpp in Sources */,
0A9370B5244CF04900B3497E /* IntermNode_util.cpp in Sources */,
0A9370B6244CF04900B3497E /* Stream.cpp in Sources */,
0A9370B7244CF04900B3497E /* ImmutableString_autogen.cpp in Sources */,
Expand Down Expand Up @@ -11394,6 +11429,7 @@
0A937131244CF04900B3497E /* OutputGLSLBase.cpp in Sources */,
0A937132244CF04900B3497E /* load_functions_table_autogen.cpp in Sources */,
0A937134244CF04900B3497E /* FindSymbolNode.cpp in Sources */,
03A900332779A44100ACAD83 /* RunAtTheBeginningOfShader.cpp in Sources */,
0A937136244CF04900B3497E /* validationES.cpp in Sources */,
0A937137244CF04900B3497E /* ValidateSwitch.cpp in Sources */,
0A937138244CF04900B3497E /* EmulateMultiDrawShaderBuiltins.cpp in Sources */,
Expand Down
2 changes: 1 addition & 1 deletion ios/xcode/fetchDependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ git_pull()
}

glslang_revision="7d65f09b83112c1ec9e29313cb9913ed2b850aa0"
spirv_cross_revision="f38cbeb814c73510b85697adbe5e894f9eac978f"
spirv_cross_revision="0e5078dc0cfb84767b0470150d9e46fc8ffdfd36"
jsoncpp_revision="48246a099549ab325c01f69f24a34fc72e5c42e4"
jsoncpp_src_revision="645250b6690785be60ab6780ce4b58698d884d11"

Expand Down
4 changes: 4 additions & 0 deletions src/compiler.gni
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,8 @@ angle_translator_sources = [
"src/compiler/translator/tree_ops/RemovePow.h",
"src/compiler/translator/tree_ops/RemoveUnreferencedVariables.cpp",
"src/compiler/translator/tree_ops/RemoveUnreferencedVariables.h",
"src/compiler/translator/tree_ops/ReplaceForShaderFramebufferFetch.cpp",
"src/compiler/translator/tree_ops/ReplaceForShaderFramebufferFetch.h",
"src/compiler/translator/tree_ops/RewriteAtomicCounters.cpp",
"src/compiler/translator/tree_ops/RewriteAtomicCounters.h",
"src/compiler/translator/tree_ops/RewriteAtomicFunctionExpressions.cpp",
Expand Down Expand Up @@ -219,6 +221,8 @@ angle_translator_sources = [
"src/compiler/translator/tree_util/ReplaceClipDistanceVariable.h",
"src/compiler/translator/tree_util/ReplaceShadowingVariables.cpp",
"src/compiler/translator/tree_util/ReplaceShadowingVariables.h",
"src/compiler/translator/tree_util/RunAtTheBeginningOfShader.cpp",
"src/compiler/translator/tree_util/RunAtTheBeginningOfShader.h",
"src/compiler/translator/tree_util/RunAtTheEndOfShader.cpp",
"src/compiler/translator/tree_util/RunAtTheEndOfShader.h",
"src/compiler/translator/tree_util/Visit.h",
Expand Down
16 changes: 13 additions & 3 deletions src/compiler/translator/BaseTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -920,6 +920,8 @@ enum TQualifier
EvqVertexOut, // Vertex shader output
EvqFragmentIn, // Fragment shader input

EvqFragmentInOut, // EXT_shader_framebuffer_fetch qualifier

// parameters
EvqIn,
EvqOut,
Expand Down Expand Up @@ -1081,7 +1083,7 @@ struct TLayoutQualifier
matrixPacking == EmpUnspecified && blockStorage == EbsUnspecified &&
!localSize.isAnyValueSet() && imageInternalFormat == EiifUnspecified &&
primitiveType == EptUndefined && invocations == 0 && maxVertices == -1 &&
index == -1;
index == -1 && inputAttachmentIndex == -1 && noncoherent == false;
}

bool isCombinationValid() const
Expand All @@ -1090,14 +1092,16 @@ struct TLayoutQualifier
bool numViewsSet = (numViews != -1);
bool geometryShaderSpecified =
(primitiveType != EptUndefined) || (invocations != 0) || (maxVertices != -1);
bool subpassInputSpecified = (inputAttachmentIndex != -1);
bool otherLayoutQualifiersSpecified =
(location != -1 || binding != -1 || index != -1 || matrixPacking != EmpUnspecified ||
blockStorage != EbsUnspecified || imageInternalFormat != EiifUnspecified);

// we can have either the work group size specified, or number of views,
// or yuv layout qualifier, or the other layout qualifiers.
return (workSizeSpecified ? 1 : 0) + (numViewsSet ? 1 : 0) + (yuv ? 1 : 0) +
(otherLayoutQualifiersSpecified ? 1 : 0) + (geometryShaderSpecified ? 1 : 0) <=
(otherLayoutQualifiersSpecified ? 1 : 0) + (geometryShaderSpecified ? 1 : 0) +
(subpassInputSpecified ? 1 : 0) + (noncoherent ? 1 : 0) <=
1;
}

Expand Down Expand Up @@ -1134,6 +1138,10 @@ struct TLayoutQualifier
// EXT_blend_func_extended fragment output layout qualifier
int index;

// EXT_shader_framebuffer_fetch layout qualifiers.
int inputAttachmentIndex;
bool noncoherent;

private:
explicit constexpr TLayoutQualifier(int /*placeholder*/)
: location(-1),
Expand All @@ -1149,7 +1157,9 @@ struct TLayoutQualifier
primitiveType(EptUndefined),
invocations(0),
maxVertices(-1),
index(-1)
index(-1),
inputAttachmentIndex(-1),
noncoherent(false)
{}
};

Expand Down
Loading