Skip to content

fix: canvas raw shader access#34

Open
CosmaVergari wants to merge 1 commit into
solid-tv:mainfrom
CosmaVergari:fix/canvas-raw-shader-support
Open

fix: canvas raw shader access#34
CosmaVergari wants to merge 1 commit into
solid-tv:mainfrom
CosmaVergari:fix/canvas-raw-shader-support

Conversation

@CosmaVergari

Copy link
Copy Markdown

Problem: Raw canvas shaders still go through the convertToShader function when being set on each node. However raw shaders already contain all the info for the shader to be rendered in the shader prop.
This is due to an error in the logic flow for Canvas (in WebGL it is correctly managed).

Solution: Apply the same logic that is used in WebGL, that is: when dealing with a raw canvas shader (props.shader.render is defined) do not call convertToShader.

Comment thread src/core/elementNode.ts
if (
SHADERS_ENABLED &&
props.shader &&
!('program' in props.shader || 'render' in props.shader) // If not a raw shader

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we just look for render? Do we need both program and render?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that "render" is added in the Canvas shader node and "program" in the WebGL shader node, so we should check for the presence of any of the two

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.

2 participants