src/libANGLE/MemoryShaderCache.cpp


Log

Author Commit Date CI Message
Geoff Lang 166b72c9 2024-09-30T19:07:26 GL_ANGLE_blob_cache implementation. Bug: chromium:370538323 Change-Id: Ic51a951e78b48b315e36f518bcc39ff2d54660a6 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5900761 Reviewed-by: Cody Northrop <cnorthrop@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
Geoff Lang fcf3a1c0 2024-07-02T16:33:28 GL: Allow shader compilation with cached translated source Write the translated shader source when serializing shaders. This does not increase the size of the shader cache because Vulkan only uses the compiledBinary field. Spawn a ShaderTranslateTask for loading shaders so the GL backend can compile the shader on the native driver. Bug: angleproject:350779978 Change-Id: I14413a7ca2a0d99653a1082f2c8b4a94cf58626a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5672740 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
Shahbaz Youssefi 8346addb 2024-02-06T15:40:31 Contain X11 includes and free usage of common terms This change undoes workarounds where some terms were avoided so there is no clash with X11 (such as Success, Bool and None). In particular, this helps us make sure we never include the X11 headers in such an unconstrained manner as to clash with our code. Bug: angleproject:8520 Change-Id: I53d9657c5a33164064d2c80a206b96fd52f607f1 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5273491 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Liza Burakova <liza@chromium.org>
Shahbaz Youssefi 91c981c5 2024-01-11T22:37:48 Robust shader compile after shader binary is rejected If ANGLE finds a shader binary in the cache, it populates the compiled shader state. If the deserialization rejects the blob, the compiled shader state was not reset. After the rejection, ANGLE proceeds to redo the shader compilation, in which case it risks bugs as it tries to accumulate info on top of the previous half-complete shader state. Note that currently there are no errors if the shader state is not reset before compilation, so this change is merely a precaution. Bug: angleproject:8471 Change-Id: I2e08ecc2e5d940c88a32b5a05dca8afe8d8d897c Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5189154 Reviewed-by: mohan maiya <m.maiya@samsung.com> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Charlie Lao <cclao@google.com>
Geoff Lang 2a6336ed 2023-11-29T13:35:57 Don't construct a compiler instance on shader cache hits. We can avoid constructing a shader compiler instance and then destroying it when we get shader cache hits. The resources and output type are available from the root gl::Compiler object. Bug: angleproject:8434 Change-Id: I2de43db34dc1b86265aa648b1275e32814487ff4 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5073292 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Shahbaz Youssefi dd8432b5 2023-11-14T14:39:45 Remove angle::Result::Incomplete from shader/program paths angle::Result is not an error code, and having Incomplete made it very unclear what the purpose of this class is. A follow up will remove it entirely. Bug: angleproject:8414 Change-Id: Ica8271b9f7d8868671c7658161e50a53ef23c681 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5028091 Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Geoff Lang 7cacb537 2023-09-26T11:27:49 Limit the uncompressed data size when decompressing blobs. If the data in the blob cache is invalid for any reason, ANGLE will take the last 32 bits of it an interpret it as a size for decompressing the blob. Add some reasonal upper bounds on the decompressed data size so that if the data is invalid it will simply fail decompression instead of allocating giant buffers. Bug: chromium:1485277 Change-Id: Ifb807f5ea836b692f37734b20789f5daefcca5c9 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4887599 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
Mohan Maiya ab334105 2023-01-23T10:09:56 BuiltInResourcesString is no longer a part of shader cache key The stringified version of `ShBuiltInResources` is poorly maintained and has a large overhead while computing hashes. Instead use the `ShBuiltInResources` blob directly. The shader object now computes and caches its key, refactor MemoryProgramCache to query the shader object for its key instead of recomputing it. Tests: EGLProgramCacheControlTest* Bug: angleproject:7833 Change-Id: I67a22f9460cee10ab0f7571df7d6525b476a5a78 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4185759 Commit-Queue: mohan maiya <m.maiya@samsung.com> Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Mohan Maiya cc34aa73 2022-12-19T14:03:27 Move BinaryStream to common and expose ShaderState to compiler This is a refactor change in preparation for adding support for glShaderBinary. Move BinaryStream to common so that it is accessible by both libANGLE and the Compiler. Extract members that hold the result of compilation from ShaderState and move into new CompiledShaderState struct. Move helper functions & classes relevant to ShaderVar serialization to the CompiledShaderState header. Tests: EGLBlobCacheTest* Bug: angleproject:7833 Change-Id: I7ec575247eccb3afbc6ab6bfa24d36e69d4576f5 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4080998 Reviewed-by: Charlie Lao <cclao@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: mohan maiya <m.maiya@samsung.com>
Eddie Hatfield ba4b6913 2022-08-23T09:34:27 Fix data race in BlobCache * Re-enable shader cache feature * Improve BlobCache thread-safety test * Improve EGLProgramCacheControlTest to not check the size of the BlobCache, since the shader cache interferes with this. * Include the arguments to ConstructCompiler() and Compile() in the key hash for the shader cache. Bug: angleproject:7036 Change-Id: Ied4e11f9160552f2f9358d99b5656315239ba856 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3851161 Reviewed-by: Cody Northrop <cnorthrop@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Eddie Hatfield <eddiehatfield@google.com>
Tom Anderson 3e9d8f43 2022-08-23T20:00:20 Fix build with -Wextra-semi Change-Id: Ibda56f1c3ad3e2851997cba93de5bc32b4606300 Bug: chromium:1355871 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3851180 Auto-Submit: Thomas Anderson <thomasanderson@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Nico Weber <thakis@chromium.org>
Eddie Hatfield 955adb77 2022-08-12T10:14:48 Cache compiled shader By storing the compiled shader in the blob cache, the time to recompile the same shader is reduced. Based on work by <hckim.kim@samsung.com> Bug: angleproject:7036 Change-Id: I884ae40e715c49a9ccd12903012e8327811e3557 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3808235 Commit-Queue: Cody Northrop <cnorthrop@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Cody Northrop <cnorthrop@google.com>