src/compiler/translator/tree_ops


Log

Author Commit Date CI Message
Shahbaz Youssefi 770242db 2024-11-20T17:03:07 Translator: Remove the `gimage1D` base type This is a desktop GL type, whose removal was left out of b16d105fc6. Bug: angleproject:370937467 Change-Id: I0bda5453b95ddf924ba0583de346902b333603a6 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6037776 Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Kimmo Kinnunen 7ba69645 2024-11-14T10:07:31 Fix unnamed outs w/ initializeUninitializedLocals Fix translator initializeUninitializedLocals pass for anonymous out parameters. The parameters should be initialized to zero, similar to named but unassigned parameters. Initialization would be skipped on GLSL output, assert on Metal. Functions need to be replaced if their parameter names change. In case the function had a prototype declaration, that has to be replaced too. All calls to old functions must be replaced with calls to new function. Bug: angleproject:378584780 Change-Id: I9a990fa3840f6e26cd30f35bf6c99d9a8816f272 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6020245 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Auto-Submit: Kimmo Kinnunen <kkinnunen@apple.com> Commit-Queue: Kimmo Kinnunen <kkinnunen@apple.com>
Kimmo Kinnunen 03c75d35 2024-11-14T14:24:44 Remove SeparateStructFromFunctionDeclarations Move SeparateStructFromFunctionDeclarations to SeparateDeclarations It is logical part of the separate declarations step. Bug: angleproject:378966971 Change-Id: Ie102a1d936f7b444f5f9f2ac2fe8dc6c10027782 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6022857 Auto-Submit: Kimmo Kinnunen <kkinnunen@apple.com> Commit-Queue: Kimmo Kinnunen <kkinnunen@apple.com> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Kimmo Kinnunen df61fc7f 2024-11-14T13:31:24 Avoid reordering structs when separating from func Avoid reordering structs when separating struct declarations and function declarations. Consider: struct S1 { ... }; struct S2 { S1 a; } f(); SeparateStructFromFunctionDeclarations would insert the S2 to the beginning of the containg block, so before S1 definition. Fix by not inserting the structs to the parent block. Instead, return the nodes from multi-replacement, so that the struct definition is inserted at the site of the replaced function. Bug: angleproject:378966971 Change-Id: I47582660610c1fcb28a9b5bd592ac020b5c48e34 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6022856 Commit-Queue: Kimmo Kinnunen <kkinnunen@apple.com> Auto-Submit: Kimmo Kinnunen <kkinnunen@apple.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Kimmo Kinnunen b03f0148 2024-11-01T10:26:04 Metal: interpolateAtOffset fails validation Fix validation error Found function prototype with an invalid qualifier. The offset parameter was created with "global" qualifier. Bug: angleproject:376718268 Change-Id: I6f314a42fe1d35d54bb673cfa7d58eba526c9ea5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5979778 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Auto-Submit: Kimmo Kinnunen <kkinnunen@apple.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Kimmo Kinnunen bf29a047 2024-10-28T11:07:57 Metal: Remove uniform struct decl separation code Remove uniform specific struct declaration separation and anonymous struct naming code. This is already done by SeparateDeclarations. Removes code for NameEmbeddedUniformStructsMetal. Does not remove SeparateStructFromUniformDeclarations code as it is used for SPIRV. Bug: angleproject:375937551 Change-Id: I943d96897d97b23fd0f54155dc215a4490f63937 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5972994 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Kimmo Kinnunen <kkinnunen@apple.com>
Kimmo Kinnunen 4397ff2f 2024-10-25T16:55:30 Metal: SeparateCompoundStructDeclarations fails validation Consider GLSL: struct S { int i; } s; s=s; SeparateCompoundStructDeclarations would rewrite this to: struct S { int i; }; S s'; s=s; The interm rewrite would rewrite the specification and declaration of s, but not the use sites. The use sites would use the old type, and thus something that was not in the tree anymore. This would fail the validation. This kind of bug was previously fixed for SeparateDeclarations in commit 18fa02bebf901dd8501de3176f6052ae4ce984be. Fix by adding the logic to SeparateDeclarations, as it is already doing almost the exact task, separating `struct S { ..} a, b`. The separation is tested in GLSLTests.StructInShader and various other draw tests. These pass with MSL, but these would also fail validation if that was enabled. Bug: angleproject:375523825 Change-Id: I1697103d0ba47616dbd3159f36f9e71cb2831c4b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5964899 Auto-Submit: Kimmo Kinnunen <kkinnunen@apple.com> Commit-Queue: Kimmo Kinnunen <kkinnunen@apple.com> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Shahbaz Youssefi 08c1724f 2024-10-11T14:29:00 Vulkan: Support GL_ARM_shader_framebuffer_fetch_depth_stencil Bug: angleproject:352364582 Change-Id: I63fd78314fa7ebccbf366c252e309a9c0f09c8c1 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5938150 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Kimmo Kinnunen 12584049 2024-10-21T14:04:55 Make SimplifyLoopConditions testable Add ShCompileOptions::simplifyLoopConditions, so that tests can turn it on. Later edits to simplify loop condition logic are simpler to review when the testing related edits are landed separately. Test the feature by having ESSL as the input and ESSL as the natural output, to reflect how AST changes. To make the test expectations more deterministic across code changes, change SymbolTable::kLastBuiltInId to SymbolTable::kFirstUserDefinedSymbolId. This is simpler as no code needs to know exact last built in id, so we can just ensure that the user defined symbol ids do not clash with the builtin ids. Bug: angleproject:374585769 Change-Id: Iea0efb8ac2878691d0fd5ff5cfe9a49ac754515d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5946724 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Kimmo Kinnunen <kkinnunen@apple.com>
Shahbaz Youssefi 47c66901 2024-10-21T12:47:22 Vulkan: Set gl_Layer to 0 if the framebuffer is not layered Bug: angleproject:372390039 Change-Id: I29067c9488e06f6dd2e90f207fecb843267fb77c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5949263 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi a8138547 2024-10-09T23:33:24 Translator: Support GL_ARM_shader_framebuffer_fetch_depth_stencil Bug: angleproject:352364582 Change-Id: I46ce6d75a76bdf04a9e8feea1a480e8a0badba2a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5924140 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Reviewed-by: Charlie Lao <cclao@google.com>
Shahbaz Youssefi b16d105f 2024-10-03T10:25:32 Remove Desktop GL front-end support For Desktop GL applications, please use Zink! Bug: angleproject:370937467 Change-Id: Ie734634bb62a2e98c80e1b32d8b3d34624da3c04 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5905428 Reviewed-by: Geoff Lang <geofflang@chromium.org>
Geoff Lang fe8c0390 2024-09-25T19:00:34 WGSL: Run SeparateCompoundStructDeclarations to name structs Borrow SeparateCompoundStructDeclarations from the Metal backend to separate struct definitions and name nameless structs. Refactor id generation into a callback. Bug: angleproject:42267100 Change-Id: I8ed6f13113a5d5e450d30ce187ce1df52e572000 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5889089 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Matthew Denton <mpdenton@chromium.org>
Chris Dalton 966739ac 2024-09-19T23:49:06 Drop PLS support for EXT_shader_pixel_local_storage Supporting this backend drastically increased the complexity of the codebase, with little return. We don't support memoryless attachments on the web anyway, and since this extension requires us to literally draw the load/store operations, input attachments on Vulkan perform better. Once this implemention is completely removed, we will delete the PLS allow list, which isn't required for the other PLS implementations. Bug: angleproject:7279 Change-Id: Ibb036d36cbd33467e7a94398ce171cda7349e4f4 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5874412 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Kenneth Russell <kbr@chromium.org> Commit-Queue: Chris Dalton <chris@rive.app>
Kimmo Kinnunen 11724133 2024-08-06T12:02:54 Metal: Separate vars with normal types Separate compound expressions separates expressions as temporary values. Previously creating a temporary variable would copy the entire type. Qualifiers and interface block info but shouldn't ever be applied to temporary variables. This would lead to assertions during MSL output. Fix by copying the type and unsetting qualifiers and interface block info. Bug: angleproject:357622691 Change-Id: Id868cd3eaabe3710121d6c9a565304e282ddb69f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5762605 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Auto-Submit: Kimmo Kinnunen <kkinnunen@apple.com> Reviewed-by: Kenneth Russell <kbr@chromium.org> Commit-Queue: Kimmo Kinnunen <kkinnunen@apple.com>
Shahbaz Youssefi 67d8d8c8 2024-07-29T13:44:37 WebGL: Reject shaders with infinite loops Bug: chromium:350528343 Change-Id: I1b2fc152cf285b0e69c4c294351c1cf2389cc234 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5746714 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Kenneth Russell <kbr@chromium.org> Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 346ba328 2024-07-30T11:42:12 Vulkan: Simplify pulling samplers out of structs The RewriteStructSampler transformation moves samplers out of structs, for example turning this struct: struct Original { sampler2D s1; vec4 f1; sampler2D s2; sampler2D s3; vec4 f2; }; into: struct Modified { vec4 f1; vec4 f2; }; This required modifying the struct-field selection nodes to remap the field indices, causing some complication. Instead, this change makes the struct definition reorder the fields as such right during parse: struct Original { vec4 f1; vec4 f2; sampler2D s1; sampler2D s2; sampler2D s3; }; As a result, the field-selection indices for non-sampler fields don't get changed when the struct is replaced with `Modified`. Bug: angleproject:42262842 Bug: angleproject:349994211 Change-Id: I76986eab780689e9887b094e3c70b87887a8ec92 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5748789 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com>
Shahbaz Youssefi 451d78d9 2024-07-25T11:56:25 Prune trivial infinite loops in WebGL contexts Bug: chromium:350528343 Change-Id: I4be19c1ffe41fc86889b49b4a0e29d8bc9c940ec Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5738743 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 568caaa0 2024-07-23T15:07:59 Prune switch(constant) with no matching case Bug: chromium:350528343 Change-Id: Iabb475b230f22086de482bbdcf2fa00b0d986622 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5735815 Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Shahbaz Youssefi 7691cea7 2024-07-22T13:46:14 Vulkan: Remove seamful cubemap emulation Practically, the Vulkan backend is never expected to run on ES2 hardware. It _may_ for WebGL, but seamful cubemap emulation was disabled for webgl anyway. Bug: angleproject:354729454 Change-Id: Iafa20fbdbe232c4df4c777b12e7698ef7a87cf24 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5730143 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Reviewed-by: Charlie Lao <cclao@google.com>
Roman Lavrov df90bbc5 2024-07-12T18:04:53 Refactoring: move angle::HashMap and HashSet to own header Underlying abseil includes pull in a large set of headers Bug: angleproject:42266508 Change-Id: Icee47143a8a59bb0795a054b67c0aa4ddcfca4d4 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5704137 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi d193d51b 2024-06-17T22:46:08 Replace issue ids post migration to new issue tracker This change replaces anglebug.com/NNNN links. Bug: None Change-Id: I8ac3aec8d2a8a844b3d7b99fc0a6b2be8da31761 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5637912 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
ericali 6164ee69 2024-06-11T15:28:06 Assertion during validateAST for mutli variables struct. When ForceInitShaderVariables is enabled, the init output variable will be rewritten based on symbol table. While SeparateDeclarations will replace the struct declaration from AST and create a new one beforehand. This proposed fix is to find output variable by loop through AST instead of symbol table to fix assertion during validateAST that the mType is different. Skipping this new added test for vulkan pixel 4 due to driver issue. Bug: angleproject:42267047 Change-Id: Id5c6ef8c4ed7bd5fcc6174ebbdd32e0605ac5cd5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5613231 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Auto-Submit: Erica Li <lerica@apple.com>
Alexey Knyazev 82ddb33b 2024-05-10T00:00:00 Metal: Do not separate vector and matrix constants Do not create temporary variables for already folded constant vector and matrix values. This reduces register usage and partially fixes MSL compilation errors caused by matrices present in constant initializers. Bug: angleproject:8691 Change-Id: Iedfabadd9b7bcb2e6e1e08a5ad39f48305365747 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5533925 Reviewed-by: Kimmo Kinnunen <kkinnunen@apple.com> Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Erica Li 3b650ffa 2024-03-19T09:53:06 Metal: Assert while using gl_VertexID as ivec Metal [vertex_id] is uint while gl_VertexID is int. Replacing gl_VertexID with gl_VertexIDMetal without rewrites of the expressions would cause invalid expressions. Fix by casting uint kgl_VertexIDMetal to int kgl_VertexID instead of replacing variable during compile. Bug: angleproject:8597 Change-Id: I76acdb2a0ab5982aa05181175925b3359068e901 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5376498 Reviewed-by: Alexey Knyazev <lexa.knyazev@gmail.com> Auto-Submit: Kimmo Kinnunen <kkinnunen@apple.com> Commit-Queue: Kenneth Russell <kbr@chromium.org> Reviewed-by: Kenneth Russell <kbr@chromium.org>
Geoff Lang e996d187 2024-03-19T13:29:24 Use TIntermRebuild for SeparateStructFromFunctionDeclarations This now handles the case of nested function calls to functions that define a struct in the return type all resolving to the correct re-written function. Bug: chromium:329271490 Change-Id: I43904e09ec9c284c1b51c09b2caaab253f7b29b9 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5376613 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 96f44329 2024-03-25T14:16:10 Revert "Remove few redundant ImmutableString to std::string conversions" This reverts commit ebb94b807f184f2d36cb0843c429667cd80e0675. Reason for revert: Needs a different implementation of std::string::size() to pass C++17 compilers. Original change's description: > Remove few redundant ImmutableString to std::string conversions > > Maybe removes few strlen calls. > > Bug: angleproject:8614 > Change-Id: I4fbb5f6abb8e8d21ff44a34975bab379127a0a11 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5372715 > Auto-Submit: Kimmo Kinnunen <kkinnunen@apple.com> > Commit-Queue: Geoff Lang <geofflang@chromium.org> > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > Reviewed-by: Geoff Lang <geofflang@chromium.org> Bug: angleproject:8614 Change-Id: I1a635b74674a2e1b635972bb4372c43340527a2f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5391900 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Yuly Novikov <ynovikov@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
Kimmo Kinnunen ebb94b80 2024-03-16T09:11:51 Remove few redundant ImmutableString to std::string conversions Maybe removes few strlen calls. Bug: angleproject:8614 Change-Id: I4fbb5f6abb8e8d21ff44a34975bab379127a0a11 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5372715 Auto-Submit: Kimmo Kinnunen <kkinnunen@apple.com> Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Kimmo Kinnunen 18fa02be 2024-03-12T10:23:55 Rewrite exprs using separated decl variables Rewrite expressions that use the rewritten struct declaration variables. Declaration that specfies a struct and defines multiple variables will get its variable declarations separated. The type of the variable changes when a struct specifier is removed for the second and rest of the variable declarations. The type of the variable changes also when a anonymous struct is named. The expressions that used the separated variables used the old struct as their types. Fix by using TIntermRebuild. Upon creating a new symbol node referencing the new type, the rebuilder will instantiate also all the needed intermediate nodes, which then get the correct struct type. For consistency, fix the case of anonymous struct -> named struct transform naming the variables similar to named struct separation. Consider base case: struct S { .. } a, b; -> struct S { .. } a; S b; Compare against case: struct { .. } a, b; Before, inconsistency: struct s1 { .. }; s1 a; s1 b; After, fixed: struct s1 { .. } a; s1 b; Bug: angleproject:8590 Change-Id: Iffb0ef4441d6021e076b04485b808b26a7fa4dcb Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5365201 Auto-Submit: Kimmo Kinnunen <kkinnunen@apple.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Kimmo Kinnunen <kkinnunen@apple.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Kimmo Kinnunen f7de39b6 2024-03-09T10:27:47 Make IntermRebuild available for all backends Move IntermRebuild from MSL to general translator code. Bug: angleproject:8590 Change-Id: Ie14651d09fbc320b27b94e48eb12d4ca8c79c68c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5358815 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Auto-Submit: Kimmo Kinnunen <kkinnunen@apple.com> Commit-Queue: Kimmo Kinnunen <kkinnunen@apple.com>
Kimmo Kinnunen 90ae6cbe 2024-03-07T15:51:41 Avoid assert at main prototype when monomorphizing Use the same condition as for main function definition. Bug: angleproject:8594 Change-Id: I66e4af61015607660437745042976fdc577308ca Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5352247 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Auto-Submit: Kimmo Kinnunen <kkinnunen@apple.com>
Kimmo Kinnunen 4e9fbb36 2024-03-06T15:06:07 Metal: Remove AccessField(.., ImmutableString) The variant is incorrect, as ImmutableString does not describe the field name completely. Names belong to different namespaces denoted by SymbolType. Bug: angleproject:8558 Change-Id: I8332f574dfa8439d02af119fd858a6f5acdec73d Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5349698 Commit-Queue: Kenneth Russell <kbr@chromium.org> Auto-Submit: Kimmo Kinnunen <kkinnunen@apple.com> Reviewed-by: Kenneth Russell <kbr@chromium.org>
Dan Glastonbury 5a4bfd61 2024-01-12T17:15:39 Metal: Separate struct definition from function return The EmitMetal pass in shader translator does not handle writing the defintion of a structure that is declared in the return type of a function, such as: struct Foo { float val; } foo() { ... } This change adds a new pass, SeparateStructFromFunctionDeclarations, to separate the definition and declaration of struct variables in function prototypes into two statements, such as: struct Foo { float val; } foo(); struct Bar { int val; } bar() { ... } void main() { ... } Foo foo() { ... } into: struct Foo { float val; }; Foo foo(); struct Bar { int val; }; Bar bar() { ... } void main() { ... } Foo foo() { ... } Fixed: angleproject:8302 Change-Id: Id8b6ba256d3c8375dd889facd70e4715261c1ca3 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5191644 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Kimmo Kinnunen 2b1ef00a 2024-02-20T15:45:34 Metal: Fix validation for anonymous struct arrays Fix validation failure for accessing an element of array of anonymous struct. SeparateCompoundStructDeclarations would create new Structures to name unnamed structures. The Structure instance of the array index accessor node was incorrect, it was the old Structure. Use same pattern as in SeparateStructFromUniformDeclarations. Bug: angleproject:8551 Change-Id: I04684e5ad99cc2b9038a0cc21c7eefcc6cf247df Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5310074 Commit-Queue: Kimmo Kinnunen <kkinnunen@apple.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Kenneth Russell <kbr@chromium.org> Auto-Submit: Kimmo Kinnunen <kkinnunen@apple.com>
Kimmo Kinnunen 197beb4d 2024-02-13T15:47:32 Metal: Crash if for loop body is optimized away Loops might have their bodies optimized away. For case like `for(;;) if(false);` the constant pruning happens at parse phase. The else branch (e.e. no else branch, nullptr) would be selected as the body. Some code treated the body as optional, some code treated it as required. Define it as required, and remove all conditional code related to the loop body. Bug: angleproject:8532 Change-Id: Ic35f1bf78e63ceb2cee7b96ba99e788efc282e6f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5291554 Auto-Submit: Kimmo Kinnunen <kkinnunen@apple.com> Commit-Queue: Kimmo Kinnunen <kkinnunen@apple.com> Reviewed-by: Kenneth Russell <kbr@chromium.org>
Shahbaz Youssefi c6fbf93d 2024-01-19T09:57:12 Vulkan: Fix input attachments leaking into uniform list To communicate the existence of input attachments added to the shader, the translator was adding `ShaderVariable`s for each to the list of uniforms exported from the shader. This was incorrect, as this list is visible to the application through `glGetActiveUniform`. Additionally, this was unnecessarily causing these uniforms to go through program link. Reserving SPIR-V ids for these uniforms, all that is needed from the translator is the mere existence of these input attachments. This change removes the addition of uniforms, and instead exports a bitset. Elsewhere, that bitset is consulted and reserved SPIR-V ids are used. Bug: b/320563594 Bug: angleproject:5792 Change-Id: Id93846cbc3996248f391fd2d5a65af1e48d6d46e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5215089 Reviewed-by: mohan maiya <m.maiya@samsung.com> Reviewed-by: Charlie Lao <cclao@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Alexey Knyazev 950d054a 2024-01-11T00:00:00 Metal: Do not defer global const initializers Since MSL supports constant global variables, they should not be included in the DeferGlobalInitializers operation. This reduces temporary register usage and thus makes shaders that use large const arrays more compatible with Apple GPUs. Fixed: angleproject:8479 Change-Id: If1cd17a0a194173e60e6b5152297054fc384c0b2 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5189165 Reviewed-by: Kimmo Kinnunen <kkinnunen@apple.com> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com>
Alexey Knyazev 473dd389 2024-01-04T00:00:00 Metal: Fix out/inout parameter aliasing Ensured that MSL-internal structs are included in the parameter aliasing checks. Fixed the following tests: dEQP-GLES2.functional.shaders.function .global_variable_aliasing_fragment .global_variable_aliasing_vertex dEQP-GLES3.functional.shaders.function .global_variable_aliasing_fragment .global_variable_aliasing_vertex Fixed: angleproject:7145 Change-Id: Ia1e40e72a69e2f91b480ef5fbb75ff0f0a1a772a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5176988 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Kenneth Russell <kbr@chromium.org> Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com>
Alexey Knyazev 3c8501b3 2023-12-21T00:00:00 Metal: Handle embedded uniform struct arrays Preserve arrayness type information when replacing uniform declarations. Fixed: angleproject:6525 Change-Id: I09ea79ffa5bf74e06503985d4f90ccbe0bf25570 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5150729 Reviewed-by: Kenneth Russell <kbr@chromium.org> Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com>
Chris Forbes a1cd2198 2023-12-04T11:42:13 Fix yuv_2_rgb and rgb_2_yuv GLSL function emulation The color conversions themselves were already correct, but Y was assumed to be full range, and u,v assumed to be centered on zero. This change folds the range expansion and chroma bias into the transforms. In order to accomplish the bias the matrices are extended to be mat4x3, and the provided color value is extended to a vec4 with w=1. Various other methods are possible (and potentially more efficient if the standard is not a constant) but just folding everything into the matrices is the most straightforward. Test: atest CtsNativeHardwareTestCases Bug: b/308437613 Change-Id: I33f797450c9ad9e758100eb8530d86548939f4ed Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5082558 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Charlie Lao 90767546 2023-12-01T12:27:15 Vulkan: Add test for __samplerExternal2DY2YEXT then swizzle Added a correctness test SourceYUVTextureTargetExternalRGBSampleYUVSampleWithSwizzle for applying swizzle after sampler. Also removed some bug workaround for VVL and drivers since they are fixed now. Bug: b/309480316 Change-Id: If82b2251745a96335b535c67b6e0c0847268b25b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5080497 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: mohan maiya <m.maiya@samsung.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Sergey Kataev 75e13e68 2023-11-29T22:19:46 Metal should not inline non-const global initialisers Bug: angleproject:8403 Change-Id: Iaa6126d7043931a16104ea84c5f7e737017dabc3 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5076256 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Sergey Kataev <sergeyka@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Alexey Knyazev edcfab40 2023-11-23T00:00:00 Metal: Implement textureCubeGrad transformation for AGX Wrapped all affected built-in function calls with helpers that transform derivative values. Fixed all *.texturegrad.* dEQP failures on Apple silicon. Fixed: angleproject:7021 Fixed: angleproject:8433 Change-Id: I16b023840ad267ab72d31fde3cb0fa7048e5310c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5071254 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com>
Alexey Knyazev e8923a62 2023-11-14T00:00:00 Clamp gl_PointSize to both bounds Ensure that point size values smaller than ALIASED_POINT_SIZE_RANGE[0] are clamped as the spec requires. Fixed: angleproject:8416 Change-Id: I3cfd2b1d3c1f34788d062ff4ca4b809ce3b5aaa9 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5033198 Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Charlie Lao 32f209b8 2023-11-03T09:57:00 Vulkan: Fix __samplerExternal2DY2YEXTtnd combined with swizzle Pixel camera app is hitting assertion due to swizzle applied to swizzle. This CL adds ReswizzleYUVOpsTraverser::visitSwizzle() method and detects there is a swizzle on YUV sampler and apply YUV swizzle first and then original swizzle and then fold two swizzle into one. This CL added a test to reproduce the bug. This CL also makes ShCompileOptions in ShaderExtensionTest class a class member instead of local variable so that subclass can modify for testing or debugging purpose. Bug: b/309480316 Change-Id: I72353fbad8dcacd77ca17a9f44e84485f4656a34 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5001614 Reviewed-by: Chris Forbes <chrisforbes@google.com> Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Charlie Lao acb0ae09 2023-10-27T13:38:09 Vulkan: Swizzle YUV output from GL component order to vulkan Since OpenGL and vulkan has different YUV component ordering, we need to swizzle the component form GL to vulkan when we write YUV data to output variable. The computation in shader will still carry out in OpenGL order. This CL swizzles component for the YUV output variable. Bug: b/223456677 Change-Id: Ie34bbc723bf3723ac65f7931aeab086c92610271 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4985622 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Chris Forbes <chrisforbes@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Chris Forbes 9e5f5188 2023-10-24T18:43:12 Reswizzle results of YUV sampling operations Change-Id: Id6eee9e0d9e2b80d48c80f27bc8e670a5621d263 Test: ImageTestES3.* 24 -> 15 failures Bug: b/223456677 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4970337 Commit-Queue: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com>
Shahbaz Youssefi 1cab871c 2023-09-27T22:11:25 GL: Fix ScalarizeVecAndMatConstructorArgs vs precision If the constructor being expanded has no precision (such as if it's entirely made up of constants and bools), the workaround didn't produce a precision for the helper function, leading to GLES compilation errors. Bug: chromium:1420130 Bug: angleproject:8361 Change-Id: I0de312dfd1bfbf45317db4fb88d685a843052817 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4898697 Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Alexey Knyazev 49c4d87a 2023-08-21T00:00:00 Apply fragment color broadcasting to secondary outputs When GL_EXT_draw_buffers is enabled, gl_FragColor is replaced with gl_FragData. Apply the same transformation to gl_SecondaryFragColorEXT if it is statically used to avoid compiler failures. Bug: angleproject:1085 Change-Id: If154cd20a8e14a92da520847a9c4508971a45fef Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4900641 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com>
Jonah Ryan-Davis 1ab5d01d 2023-08-29T13:31:07 Metal: Fix dropped out arguments from functions with many args. RewriteOutArgs has an early-exit if it spots a potentially aliased arg. It's also responsible for marking out args as references, which caused an issue in Google Earth. Removing the early-exit fixes both issues. Bug: chromium:1474736 Change-Id: Ib68dd3f3e2e0a1e773e4e09edcdfa3a4bdfc1ef2 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4823006 Commit-Queue: Jonah Ryan-Davis <jonahr@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 711db275 2023-08-23T11:06:42 Translator: remove usage of contains() It's not available pre-C++20 Bug: angleproject:8311 Change-Id: I41940b5f8e6a90bc0224852aefe54643f2be9cb5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4806924 Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Commit-Queue: Yuly Novikov <ynovikov@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Jonah Ryan-Davis 280e79e1 2023-08-10T14:08:00 Rescope globals only used in one function to function-local. We can demote global variables when they are only used in one function. This has performance implications on Metal. Bug: angleproject:8311 Change-Id: Id666e6b167be771c14768cd73efa61fdacd897d4 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4771215 Commit-Queue: Jonah Ryan-Davis <jonahr@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Mohan Maiya 05ea1147 2023-07-14T16:49:24 Vulkan: Bugfix in gl_FragData array redeclaration Both OpenGL ES and Vulkan spec allows implementations to limit the number of output attachments when dual-source blending is enabled. Account for this limit when setting gl_FragData array length by re-declaring the gl_FragData array size to match maxFragmentDualSrcAttachments value. Bug: angleproject:5537 Test: EXTBlendFuncExtendedDrawTest.FragData/ES2_Vulkan Change-Id: I5a462344f4c4faf850f56e9c5d4c392370d3d010 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4688396 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: mohan maiya <m.maiya@samsung.com>
Shahbaz Youssefi 9b63700b 2023-07-11T10:25:40 Translator: Reorganize files This change makes the translator files more organized by: - Grouping files that are specific to a certain output under their own directory, - Moving transformations under tree_ops - Removing Direct from metal translation now that that SPIR-V Cross path is removed Bug: angleproject:6394 Change-Id: Iaf5bb8d5604b84748dece029821b1f77b2813967 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4678780 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Shahbaz Youssefi f0653461 2023-07-11T10:13:09 Translator: Fix metal-only build Bug: angleproject:6306 Change-Id: I068dc93528b7583ddc84836ac73b52adcde890f3 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4677722 Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi f5ad056b 2023-07-10T22:13:34 GL: Fix ScalarizeVecAndMatConstructorArgs and move to gl/ This transformation was buggy and was disabled. Originally, it was intended to be used everywhere. It is now needed for a GL driver workaround. This change reimplements this transformation and uses it as a GL workaround. Bug: chromium:1420130 Change-Id: I42d63fa5844bcf683ac41e61925aa637e033ca2e Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4676634 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Shahbaz Youssefi 0312c76f 2023-07-10T15:12:52 Translator: Move metal-only transformation to its own dir Bug: angleproject:6306 Change-Id: I5ff453f03cccd1c4bcec59e21a18fc6049598383 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4675654 Reviewed-by: Yuly Novikov <ynovikov@chromium.org> Commit-Queue: Yuly Novikov <ynovikov@chromium.org> Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org>
Alexey Knyazev b57d5638 2023-06-29T00:00:00 Reland "Cleanup multiview support" This is a reland of commit 9a7c0b88ba68e328d3f5f7991a6df0ab5de92311 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>
Shahbaz Youssefi f0deadab 2023-07-06T15:19:03 Revert "Cleanup multiview support" This reverts commit 9a7c0b88ba68e328d3f5f7991a6df0ab5de92311. 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>
Alexey Knyazev 9a7c0b88 2023-06-29T00:00:00 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>
Shahbaz Youssefi 24f4007b 2023-06-08T00:41:55 Vulkan: Use SPIR-V ids instead of names in the transformer This change removes the SPIR-V transformer's reliance on type and variable names. As a result: - String hashing is removed from the info map data structure and the SPIR-V transformer - The ID discovery class is entirely removed - Internal variable names have become a detail of the compiler alone (and are no longer exposed as part of the compiler interface) - Some front-end name tracking is removed ("parentStructMappedName", etc) This change also properly cleans up xfb emulation types that were previously left over. This change allows the SPIR-V compiler to emit user strings as-is instead of prefixing them with `u_` leading to more readable debug shaders. Additionally, it will make it possible not to emit debug info at all. Both of these changes will be done in follow ups. Bug: angleproject:7220 Change-Id: Iaa127496209a27aaae2e0d14c41b22fffb0b72a2 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4600610 Reviewed-by: Roman Lavrov <romanl@google.com> Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi e394cb46 2023-06-10T23:12:35 Vulkan: Refactor framebuffer fetch shader emulation This change fixes simultaneous usage of EXT_shader_framebuffer_fetch and ARM_shader_framebuffer_fetch, which previously declared two identical input attachment variables. The code is additionally greatly simplified. Bug: angleproject:8196 Bug: angleproject:8197 Bug: angleproject:8198 Change-Id: Iaaa2a5539a95727e67001a4da1d45092c9db4f2c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4615187 Reviewed-by: Yuxin Hu <yuxinhu@google.com> Reviewed-by: mohan maiya <m.maiya@samsung.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 10380f4b 2023-06-06T11:52:08 Vulkan: Output SPIR-V ids from compiler In this change, the shader interface variables are given SPIR-V ids by the compiler before SPIR-V generation. Those ids are made available through the ShaderVariable interface. The transformer does not yet rely on this information. A follow up change will rework the backend's name->info map and the transformer to directly use ids instead of names. Bug: angleproject:7220 Change-Id: Ic0a62681d4bcf3ed171c39c3ecd83e438ea068c8 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4600609 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Roman Lavrov <romanl@google.com> Reviewed-by: Yuxin Hu <yuxinhu@google.com>
Shahbaz Youssefi 76b0e7f3 2023-06-01T11:25:54 Vulkan: Use reserved SPIR-V ids for internal variables With this change, the SPIR-V transformer does not need to discover these ids through name matching. Ultimately, user variables would also be identified by their SPIR-V ids (instead of name), removing the Vulkan backend's reliance on strings. Bug: angleproject:7220 Change-Id: I241c3247b89a28f9eed28f23c06b7c8b7fbbeaa0 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4583133 Reviewed-by: Yuxin Hu <yuxinhu@google.com> Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Stephen White e60f64dd 2023-05-31T17:02:22 D3D11: fix for atomic assigned to an SSBO. When assigning the previous value of an atomic op to an SSBO, we do not want to use the "direct assignment" path, since we can't pass the SSBO expression as an argument to Interlocked*(). Instead, we change the RewriteAtomicFunctionExpressions transform not to defer assignments until HLSL output if the LHS is an SSBO expression, and to do its usual creation of a temporary for the previous value of the atomic op. In OutputHLSL, we skip the direct assignment path if the LHS is an SSBO expression. Bug: angleproject:8182 Change-Id: I0707f4f69757119fe5c8f8e7a12bd26025ec74e6 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4573827 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Stephen White <senorblanco@chromium.org>
Shahbaz Youssefi 02e7f967 2023-05-25T14:54:49 Translator: Remove the "variables" option Variable collection is invariably enabled by the front-end as well as other major users of ANGLE such as Firefox. All translator backends except GLSL force-enable variable collection either way. This change removes this compile option and enables variable collection unconditionally. The flag itself remains in ShCompileOptions until references to it are removed from Chromium. Bug: chromium:1447314 Change-Id: I4d3b30c1bfbd345c5ad269abc62c0a6a59de2f56 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4568524 Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Alexey Knyazev bdbcf763 2023-05-24T00:00:00 Compile ClampFragDepth on all backends Bug: angleproject:3970 Change-Id: I498f8c101e5939156eba6a071278f6ea912fee70 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4561897 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Kimmo Kinnunen 20b6624a 2023-04-17T13:55:09 Metal: Support compiling on iOS without EAGL Makes EAGL and CGL compilation exclusive to each other. Catalyst would compile with both on ARM64, but only use EAGL. Remove use of GLSL generation in MSL. Generating GLSL for MSL compute and geometry shaders do not make sense. Remove compilation of RewriteRowMajorMatrices for Metal. It was removed from Metal in: b23bf47c9e999532a684beab9ac901552420b0b8 Reland "Metal: rewrite default uniforms and uniform blocks" Remove use of ANGLE_ENABLE_APPLE_WORKAROUNDS and gn variable angle_enable_apple_translator_workarounds. The workarounds are just unconditional business-as-usual implementation of ANGLE when ANGLE is compile for PLATFORM_APPLE. Fixed: angleproject:8129 Change-Id: I3af249708803fba816e2a7c92c35dddb84ce6946 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4428875 Auto-Submit: Kimmo Kinnunen <kkinnunen@apple.com> Reviewed-by: Kyle Piddington <kpiddington@apple.com> Commit-Queue: Kimmo Kinnunen <kkinnunen@apple.com> Reviewed-by: Dan Glastonbury <djg@apple.com> Reviewed-by: Kenneth Russell <kbr@chromium.org>
Shahbaz Youssefi c26011b8 2023-04-11T15:16:29 Vulkan: Make advanced blend alpha div workaround permanent This workaround turned out to affect pretty much every driver, and numerous GL implementations were found to work around it similarly to ANGLE. It seems like this workaround may only be necessary for colorburn and colordodge, but for now ANGLE applies it to all modes. Bug: b/274528004 Bug: b/277777623 Change-Id: Id555c981a9775f949a3022b7e92c755accea7cea Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4416158 Reviewed-by: Yuxin Hu <yuxinhu@google.com> Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 336bfd60 2023-03-30T00:16:40 GL: Fix the RewriteRepeatedAssignToSwizzled workaround This transformation splits chained assignments where the LHS is assigning to a swizzle. However, instead of retaining the assignment operator (like *=, += etc), it was accidentally unconditionally using `=`. Bug: chromium:1394345 Change-Id: Icaef159e1fb57e720e08d4b4f6603f08d9cd2bfe Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4381648 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yuxin Hu <yuxinhu@google.com>
Shahbaz Youssefi 57dd0e5f 2023-03-27T13:05:36 Translator: Initialize out arguments too for WebGL Local variables were initialized for WebGL, but not `out` arguments. However, `out` arguments completely overwrite the passed-in variable at call site, so they should also be zeroed out. Bug: chromium:1425685 Change-Id: Ib2f61a962eea74c4933aafa4d5ad377189cec578 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4375137 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Kenneth Russell <kbr@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Alexey Knyazev ad52f12e 2023-03-21T00:00:00 Implement EXT_conservative_depth Added translator frontend and GLSL backend support for gl_FragDepth redeclaration and layout qualifiers. Added mappings to DepthGreater, DepthLess, and DepthUnchanged SPIR-V execution modes. Bug: angleproject:8046 Change-Id: I23f19ff54380741107970a44055ea269eef179f6 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4355028 Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi facd07ec 2023-02-14T14:11:00 Vulkan: Prune all statements without side effect Bug: chromium:1417461 Bug: angleproject:6061 Change-Id: I6e2b74589021ee60c99448e43ee3eb7f06796ede Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4250278 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi 9d84ad7d 2023-02-14T10:47:54 Translator: Fix sampler-in-struct when struct is unused Standalone symbols as statements are also pruned. For example in the below: ``` x; g(); ``` The line that only contains `x;` is pruned. In particular, this was causing a bug with sampler-in-struct processing where the code ASSERTs that if an instance of the struct is visited during traversal, that it's already processed as part of an index chain (like s.member), but in the above situation that is not true. Bug: chromium:1416152 Change-Id: I49e9a5826fc4d8c1fef1fa6f1d38c65f33f8acfd Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4247584 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Yuxin Hu <yuxinhu@google.com>
Kyle Piddington b23bf47c 2023-01-25T18:50:40 Reland "Metal: rewrite default uniforms and uniform blocks" Instead of rewriting uniforms in shaders to match std140 layout, re-pack incoming uniform blocks' std140 packed variables to match Metal's layout. This change intorduces a new BlockLayoutEncoder for Metal types The block encoder handles packing typically larger GL types (bools) into smaller types, and adding support for more compressed matrix types. Since we no longer need to do shader-time packing and unpacking of data from std140 padded structs, complicated shader transformations have been removed. This patch greatly reduces register pressure, especially when working with shaders with arrays of previously expanded types. (Vec3's) Reland: Fix an issue where the default uniform block's final size was not aligned to the default uniform block's alignment requirements, causing crashes with the debug layer enabled. Bug: angleproject:7137 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3733524 Commit-Queue: Kyle Piddington <kpiddington@apple.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Kenneth Russell <kbr@chromium.org> Change-Id: I89d3b817675486fde73b91b0be0f4c25986d4ba5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4209867
Kimmo Kinnunen 360cd0d1 2023-01-31T12:32:15 Include debug.h in various treeops headers Avoids compile failure if the UNREACHABLE is used due to compile flags. Bug: angleproject:7987 Change-Id: I4655b345648b6b56faaa42030fb8997184c6b7e8 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4205890 Commit-Queue: Kimmo Kinnunen <kkinnunen@apple.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Kenneth Russell <kbr@chromium.org> Auto-Submit: Kimmo Kinnunen <kkinnunen@apple.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Kenneth Russell fb948319 2023-01-31T18:16:41 Revert "Metal: rewrite default uniforms and uniform blocks" This reverts commit b8bfe6f6c04a6cf4fac81f0363ad23a0b92b22f2. Reason for revert: potential cause of crashes/timeouts in crbug.com/1411755 Original change's description: > Metal: rewrite default uniforms and uniform blocks > > Instead of rewriting uniforms in shaders to match std140 layout, > re-pack incoming uniform blocks' std140 packed variables to match > Metal's layout. > > This change intorduces a new BlockLayoutEncoder for Metal types > The block encoder handles packing typically larger GL types (bools) > into smaller types, and adding support for more compressed matrix types. > > Since we no longer need to do shader-time packing and unpacking of data > from std140 padded structs, complicated shader transformations have been > removed. This patch greatly reduces register pressure, especially when > working with shaders with arrays of previously expanded types. (Vec3's) > > Bug: angleproject:7137 > Change-Id: Icd1da8c7a383f3354313a58618fc1bf6656726b4 > Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3733524 > Commit-Queue: Kyle Piddington <kpiddington@apple.com> > Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> > Reviewed-by: Kenneth Russell <kbr@chromium.org> Bug: angleproject:7137 Bug: chromium:1411755 Change-Id: I1b6a62d7eb542c3e7ef4b84858ab2683abb66f8b No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4210448 Commit-Queue: Kenneth Russell <kbr@chromium.org> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Kyle Piddington b8bfe6f6 2023-01-25T18:50:40 Metal: rewrite default uniforms and uniform blocks Instead of rewriting uniforms in shaders to match std140 layout, re-pack incoming uniform blocks' std140 packed variables to match Metal's layout. This change intorduces a new BlockLayoutEncoder for Metal types The block encoder handles packing typically larger GL types (bools) into smaller types, and adding support for more compressed matrix types. Since we no longer need to do shader-time packing and unpacking of data from std140 padded structs, complicated shader transformations have been removed. This patch greatly reduces register pressure, especially when working with shaders with arrays of previously expanded types. (Vec3's) Bug: angleproject:7137 Change-Id: Icd1da8c7a383f3354313a58618fc1bf6656726b4 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3733524 Commit-Queue: Kyle Piddington <kpiddington@apple.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Kenneth Russell <kbr@chromium.org>
Sean Risser b96d1955 2023-01-20T16:06:34 Implement GL_ARM_shader_framebuffer_fetch GL_ARM_shader_framebuffer_fetch allows fragment shaders to read gl_LastFragColorARM. The extension is similar to GL_EXT_shader_framebuffer_fetch, but is more limited in its capabilities. GL_ARM_shader_framebuffer_fetch was removed from HasFramebufferFetch() because it acts differently from GL_EXT_shader_framebuffer_fetch in significant enough ways that it should not be included in that single-use function. Tests: FramebufferFetchES31.*_ARM Bug: b/242419750 Bug: angleproject:7882 Change-Id: Id3a25c8ee50ca3e2a4c30a2261f507b0b53511ec Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4083108 Commit-Queue: Sean Risser <srisser@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Cody Northrop <cnorthrop@google.com> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Alexey Knyazev 91a5635a 2022-12-16T00:00:00 Support arbitrary clip and cull distance array sizes Removed limitSimultaneousClipAndCullDistanceUsage cap. Enhanced HLSL translator to support all valid combinations of clip and cull distances. Validate that these arrays are sized explicitly or by using only constant indices; adjusted link program error message. Enhanced tests to cover all possible combinations of implicit and explicit array sizes for both built-ins. Bug: angleproject:4452 Change-Id: I704db6dc3c8951e5ba482a3e4dad09e5b0182f9c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4111645 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com>
Alexey Knyazev 0103213e 2022-12-05T00:00:00 GL: Support clip and cull distance redeclarations * Fixed gl_PerVertex qualifier string. * Updated ValidateClipCullDistanceTraverser to output redeclared array sizes and maximum constant indices. * Made DeclarePerVertexBlocks available for non-Vulkan outputs. * Updated DeclarePerVertexBlocks to remove gl_ClipDistance and gl_CullDistance redeclarations. * Enabled DeclarePerVertexBlocks for ESSL output when gl_ClipDistance or gl_CullDistance are redeclared. * Updated ESSL output to use 3.10 shading language version, when the context has GL_EXT_clip_cull_distance enabled. * Updated ESSL output to enable GL_EXT_shader_io_blocks when gl_ClipDistance or gl_CullDistance are redeclared. * Updated extension exposure conditions. * Fixed typos in ParseContext. Bug: angleproject:7763 Change-Id: Ib87368a1953ad546a407d634d8b00f71cf92c40c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4083705 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Alexey Knyazev <lexa.knyazev@gmail.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Chris Dalton 8ee1b89f 2022-11-04T13:10:37 Refactor pixel local storage options The various different PLS options were getting scattered and unruly. We are also in need of more backend-specific PLS options that would be difficult to add as-is. This CL refactors them into a single "ShPixelLocalStorageOptions" struct that gets initialized all in one place, and shared between the compiler and the backends. Bug: angleproject:7279 Change-Id: Ic58dccb8d1ba350a0b6cc5848ce15bd687e30fad Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4006715 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Chris Dalton <chris@rive.app>
Chris Dalton a4db9477 2022-10-06T10:35:39 Implement pixel local storage with metal::read_write textures Metal's programmable blending feature isn't available on non-Apple Silicon, so on these devices we have to polyfill pixel local storage using read_write textures, which can also be coherent if raster_order_groups are supported. This change leverages the existing PLS transformation to images, and implements just enough shader image functionality in Metal to support the pixel local storage usecase. Missing shader image features are marked with UNIMPLEMENTED(). Bug: angleproject:7279 Bug: angleproject:7792 Bug: angleproject:7794 Bug: angleproject:7797 Bug: angleproject:7803 Change-Id: Ia96a714693d352d57351a1bae4f45437dde000e4 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3993363 Reviewed-by: Kenneth Russell <kbr@chromium.org> Reviewed-by: Quyen Le <lehoangquyen@chromium.org> Commit-Queue: Chris Dalton <chris@rive.app> Reviewed-by: Kyle Piddington <kpiddington@apple.com>
Shahbaz Youssefi fa37af38 2022-07-12T22:47:22 Translator: Support SSO's built-in redeclaration EXT_separate_shader_objects requires that gl_Position and gl_PointSize be redeclared in the vertex shader. This is not adopted by GLES3.2, but is nevertheless required to be supported if the shader enables this extension explicitly. Bug: angleproject:6590 Change-Id: I3428851ff9f00fb63573e4322bb62fe04bf0a095 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3757918 Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Reviewed-by: Cody Northrop <cnorthrop@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Chris Dalton 5e95a4d9 2022-10-07T00:52:38 Add an EXT_shader_pixel_local_storage impl of PLS Translates ANGLE_shader_pixel_local_storage shaders directly to EXT_shader_pixel_local_storage. Polyfills load/store operations using internal fullscreen draws. Since the ANGLE extension needs the ability to preserve all active PLS planes to textures, we can only support this extension when the backend context also has access to ES 3.1 shader images. Bug: angleproject:7279 Bug: angleproject:7771 Change-Id: Id348bde412efcc081ff29ee05ec59ad652f77569 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3966075 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Sungyong Choi c6390143 2022-10-12T09:57:55 Vulkan: Make compatible with GCC Resolves below warnings occurred with GCC build. 1) deperecated-copy Overriding an assignment operator without a copy constructor caused the deprecated-copy warnings. 2) unused-function 3) parenthesis Warnings occurred due to missing parenthesis around some logical expressions, add them to quiet the warnings. 4) unused variable 5) 'maybe-unused' attribute ignored Introduces 'ANGLE_MAYBE_UNUSED_PRIVATE_FIELD' macro to avoid 'attribute ignored' warning which is only occurred with GCC because GCC doesn't warn about 'unused non static data member' whereas Clang has Wno-unused-private-field. Signed-off-by: Sungyong Choi <sywow.choi@samsung.com> Bug: angleproject:7764 Change-Id: I8e7410a5ed8cb9b8f8b3202073d779fea63d6b75 Reviewed-by: Jeff Vigil <j.vigil@samsung.com> Reviewed-by: Mohan Maiya <m.maiya@samsung.com> Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3963830 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Chris Dalton b5514bb2 2022-09-21T20:47:00 Support pixel local storage on ES 3.0 Now that the application-facing API is implemented, we don't have to rely on ES 3.1 anymore. Expose and test the extension on ES 3.0. Bug: angleproject:7279 Change-Id: I5635620b9088201c20bafd283813092a329225d6 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3915327 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Chris Dalton <chris@rive.app> Reviewed-by: Kenneth Russell <kbr@chromium.org> Commit-Queue: Chris Dalton <chris@rive.app>
Chris Dalton a7dc51f2 2022-10-01T08:49:11 Add a framebuffer fetch implementation of PLS The framebuffer fetch implementation works by attaching PLS backing textures to the framebuffer, and then rewriting PLS uniforms as "inout" fragment variables. The compiler's existing machinery takes it from there and makes it work on GL and Vulkan, and soon Metal. EXT_shader_framebuffer_fetch is now the preferred backend for pixel local storage, but we also use EXT_shader_framebuffer_fetch_non_coherent if shader images can't be coherent. This is especially interesting for Vulkan, since noncoherent framebuffer fetch is possible without any extensions. Bug: angleproject:7279 Bug: angleproject:7683 Bug: angleproject:7684 Bug: angleproject:7724 Change-Id: I33f3b2c6df9a5709969d9165c448ea71b096c9e1 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3900142 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Kenneth Russell <kbr@chromium.org> Commit-Queue: Chris Dalton <chris@rive.app>
Shahbaz Youssefi 583fd03e 2022-09-29T16:28:05 Translator: Fix ClampIndirectIndices vs. unsized arrays A deepCopy() was missing from this code path, which led to an AST validation error. However, clamping indices for unsized arrays is not strictly correct. For example, an out of bounds write with robustness is expected to be dropped, not overwrite the last element. Since robustness already covers storage blocks, this clamping is no longer done. Bug: angleproject:7712 Change-Id: I96dd18ef47cd453f19391bdccbd4372c24854ade Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3924863 Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com>
Chris Dalton 493bab09 2022-09-15T14:20:41 Add an ShPixelLocalStorageType enum Adds ShPixelLocalStorageType to ShCompileOptionsPLS and adds a getNativePixelLocalStorageType() call to ContextImpl. For now this enum only tells the translater whether PLS formats needs to be packed into r32 images, but it will soon also be able to select framebuffer fetch, native pixel local storage, and other PLS implementations. Bug: angleproject:7279 Change-Id: Ifbd419b20550b8711ae3044782177806796216f1 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3900498 Commit-Queue: Chris Dalton <chris@rive.app> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Solti 0af9aa03 2022-08-30T22:24:21 use proper TPrecision when creating TType Overview Using "EbpUndefined" when create the inputAttachmentType(TType) causes the maximum precision in SPIR-V. The maximum precision is not required and may degrade performance. This CL makes the creation using a proper precision based on declared variables. Tests ===== confirm the precision in SPIRV ===== - Using genshin_impact trace to verify - Using RenderDoc - Executable Path: com.android.angle.test/#DefaultActivity - Intent Argument: -e org.chromium.native_test.NativeTest.StdoutFile /sdcard/chromium_tests_root/out.txt -e org.chromium.native_test.NativeTest.CommandLineFlags "--gtest_filter=TracePerfTest.Run/vulkan_genshin_impact" - Capture frame 9 with the drivers built with and without CL. - Magically found one vkCmdDrawIndexed(396, 1) that "TextureViewer" has "ANGLEInputAttachment" as inputs. In "Pipeline State", the "FS" uses shader module 9556 - then compare the shader module 9556 sources from the 2 drivers. Confirmed the differences: - GLSL (SPIRV-Cross): https://screenshot.googleplex.com/A8gWMGR2EmnZwHv.png - SPIR-V (RenderDoc): https://screenshot.googleplex.com/5yqKc4pWL3qLaEj.png Bug: angleproject:7281 Change-Id: I86b315ddf057325638e58d5a0d7f8b203d8b74f8 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3866573 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Solti Ho <solti@google.com> Reviewed-by: Yuxin Hu <yuxinhu@google.com>
Chris Dalton 9d41585e 2022-08-12T14:20:34 Make PLS coherent on D3D 11.3 Adds a new internal memory qualifier to the compiler called "rasterOrdered", which we set in RewritePixelLocalStorage.cpp when D3D 11.3 Rasterizer Order Views are supported. The HLSL translator then generates RasterizerOrderedTexture2D<> instead of RWTexture2D<> when this qualifier is set. Bug: angleproject:7279 Change-Id: I39b8c3279b7bff93b7e57272e8fb84d9c0312616 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3830288 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Chris Dalton <chris@rive.app>
Chris Dalton 4a636cdd 2022-07-20T22:44:30 Require all PLS formats to consume exactly 4 bytes of storage D3D 11.0 UAVs only support R32_FLOAT, R32_UINT, R32_SINT formats. EXT_shader_pixel_local_storage explicitly states that all PLS variables consume exactly 4 bytes. ESSL images can only have both read and write access if their format is r32f, r32i, r32ui. (We were able to circumvent this via aliasing, but it was a huge source of bugs.) There is a large precedent for only supporting 4 bytes of storage in the capabilities we use for PLS, so this CL removes support for all PLS storage formats that are not 4 bytes. It also implements an "R32" mode for PLS, that does manual packing and unpacking of r32* image formats. If the application wants larger formats, it can always define multiple PLS planes and piece them together. Next up we ought to be able to support rg16* types with more packing/unpacking. With aliasing gone, and with a bit of tweaking, the PLS tests now pass on the Pixel 4 GLES bot. Bug: angleproject:7279 Bug: angleproject:7388 Bug: angleproject:7524 Bug: angleproject:7527 Change-Id: I6b8f62c2428ade6cb5413e33360d734e55dda0eb Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3782579 Reviewed-by: Stephen White <senorblanco@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Chris Dalton <chris@rive.app>
Chris Dalton fa3d7d5c 2022-08-05T00:57:40 Make PLS coherent on Vulkan Uses the VK_EXT_fragment_shader_interlock extension to make the shader image implementation of PLS coherent on Vulkan. This extension is supported on AMD, Apple, NVIDIA, and Intel. Bug: angleproject:7279 Change-Id: Ic0253eb20932eb6be0b1f433ba454e48b57be2f5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3813816 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Chris Dalton <chris@rive.app> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Shahbaz Youssefi 6f80f0f0 2022-08-06T02:29:19 Translator: Clean up the compile flag passing interface Historically, compile flags were sent to the translator as a bitmask. Recently, we were getting close to running out of bits. Additionally, direct-to-metal work had started to introduce constants to be passed to the translator, which were misplaced in ShBuiltInResources and Caps. Recent work on Pixel Local Storage adds even more constants, aggravating the situation. In this change, the interface to passing compile flags is reworked. A struct is passed (instead of a bitmask) that has one bit for each flag. This can be indefinitely extended. Additionally, the constants needed by metal and PLS are also placed in this struct. In turn, the backends can set these options directly, and don't have to hack them into Caps to further get hacked into ShBuiltInResources. Bug: angleproject:7559 Change-Id: If93f1e1b8818ad3a0ac708ab04ab93b4b397d114 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3812562 Reviewed-by: Geoff Lang <geofflang@chromium.org> Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Commit-Queue: Amirali Abdolrashidi <abdolrashidi@google.com> Auto-Submit: Shahbaz Youssefi <syoussefi@chromium.org>
Chris Dalton 861149c7 2022-08-03T15:43:29 Make PLS coherent on desktop OpenGL Implements ANGLE_shader_pixel_local_storage_coherent using fragment shader synchronization extensions: NV_fragment_shader_interlock INTEL_fragment_shader_ordering ARB_fragment_shader_interlock With these extensions combined, we get coherency all 3 big desktop vendors: NVIDIA, Intel, and AMD. Bug: angleproject:7279 Change-Id: Ie20b251fb772898e89994b799640f1f2806581eb Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3773990 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
Chris Dalton d57ce815 2022-07-16T16:33:08 Use "readwrite" PLS images when possible We actually only need readonly/writeonly aliases on ESSL, non r32f/r32ui. For all other cases, this change updates the compiler to emit a single readwrite image. We also optimize this image with the "restrict" qualifier since PLS specifically disallows aliasing. Removing the aliased load and store also eliminates our issue with an Intel driver bug, and all the PLS tests now pass without any workarounds. Bug: angleproject:7279 Bug: angleproject:7398 Change-Id: I350b239793647da33add96509b8f4b1bbef02245 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3767537 Commit-Queue: Chris Dalton <chris@rive.app> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Kenneth Russell <kbr@chromium.org>
Chris Dalton 77aa34ae 2022-07-16T13:08:00 Add support for PLS as function arguments Bug: angleproject:7279 Change-Id: I89d5c02148cbdbbd02dc4840ffada2c96c2a849b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3767534 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Chris Dalton <chris@rive.app>
Chris Dalton c460c299 2022-06-21T11:20:45 Implement GLSL additions for ANGLE_shader_pixel_local_storage Specs out, implements, and thoroughly tests the GLSL additions for ANGLE_shader_pixel_local_storage. Adds a simple transformation that rewrites PLS directly into shader images. Updates the existing PLS tests to use the newly built-in PLS features and ensures they continue passing. For now, applications call glBindImageTexture to configure their pixel local storage. The OpenGL ES API side of this extension will follow shortly. Bug: angleproject:7279 Change-Id: I141183069b5cbfcca01cbb77b5b36d3e5f834bf5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3761876 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Chris Dalton <chris@rive.app> Reviewed-by: Kenneth Russell <kbr@chromium.org>
Shahbaz Youssefi 5f7e0e50 2022-07-15T21:58:11 Translator: Remove early fragment tests transformation We no longer add early_fragment_tests as an optimization. Bug: angleproject:7347 Change-Id: Ic12d8491a4d24d546b6b19257cd63c71074ba3a6 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3769546 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Amirali Abdolrashidi <abdolrashidi@google.com> Commit-Queue: Amirali Abdolrashidi <abdolrashidi@google.com>