Skip to content

fix(graphics): cache the shader's COMPILE_STATUS to avoid blocking call#254

Merged
yorkie merged 2 commits intomainfrom
fix/webgl-get-shader-params
Aug 28, 2025
Merged

fix(graphics): cache the shader's COMPILE_STATUS to avoid blocking call#254
yorkie merged 2 commits intomainfrom
fix/webgl-get-shader-params

Conversation

@yorkie
Copy link
Copy Markdown
Collaborator

@yorkie yorkie commented Aug 28, 2025

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:

  • Refactored GetShaderParamCommandBufferResponse to use dedicated deleteStatus and compileStatus fields instead of a single integer value, clarifying the response structure for shader parameter queries.
  • Updated the OpenGL renderer (RHI_OpenGL) to populate both deleteStatus and compileStatus in the response, replacing the previous approach of returning a single integer value.

Client-side caching and API updates:

  • Enhanced the WebGLShader class to cache deleteStatus and compileStatus using std::optional, and added getter/setter methods for these parameters, enabling more efficient and reliable access to shader status on the client side.
  • Modified WebGLContext::getShaderParameter to 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.

@yorkie yorkie merged commit 6f1b41d into main Aug 28, 2025
2 checks passed
@yorkie yorkie deleted the fix/webgl-get-shader-params branch August 28, 2025 10:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant