fix(graphics): cache the shader's COMPILE_STATUS to avoid blocking call#254
Merged
fix(graphics): cache the shader's COMPILE_STATUS to avoid blocking call#254
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request refactors how shader parameters are retrieved and managed in the WebGL client and command buffer communication. The main improvement is the transition from returning a generic integer value for shader parameters to using explicit fields for compile and delete statuses, with corresponding updates to the client-side caching and API. This change enhances code clarity and reliability by making shader parameter handling more type-safe and maintainable.
Shader parameter handling improvements:
GetShaderParamCommandBufferResponseto use dedicateddeleteStatusandcompileStatusfields instead of a single integervalue, clarifying the response structure for shader parameter queries.RHI_OpenGL) to populate bothdeleteStatusandcompileStatusin the response, replacing the previous approach of returning a single integer value.Client-side caching and API updates:
WebGLShaderclass to cachedeleteStatusandcompileStatususingstd::optional, and added getter/setter methods for these parameters, enabling more efficient and reliable access to shader status on the client side.WebGLContext::getShaderParameterto first check cached values for shader type, compile status, and delete status before sending a command buffer request, improving performance and reliability. The method now throws a runtime error for unsupported parameters.