Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Basic framework for support of the OES_standard_derivatives. #72

Closed
wants to merge 2 commits into from
Closed

Basic framework for support of the OES_standard_derivatives. #72

wants to merge 2 commits into from

Conversation

bhouston
Copy link

So I've done a bit of the work to support the OES_standard_derivates extension, but it is not complete. I am missing how to integrate it with ANGLE. I notice in the angle code base there is extensions.standardDerivates but I do not see how it is set:

image

I would appreciate some guidance or some existing example code to follow. Maybe I should be looking at the Chromium source code?

If we could figure out how to do this glue to ANGLE we can likely support a ton of extensions quite quickly.

Thanks for any help.

@@ -890,6 +894,9 @@ gl.getExtension = function getExtension (name) {
ext = new STACKGL_resize_drawingbuffer()
ext.resize = this.resize.bind(this)
break
case 'OES_standard_derivatives':
ext = new OES_standard_derivatives()
break;
Copy link
Member

Choose a reason for hiding this comment

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

Extra semicolon

@mikolalysenko
Copy link
Member

In order to enable the extension we'll need to stick the following preprocessor directive in the head of each shader:

#extension GL_OES_standard_derivatives : enable

I think the right way to do this would be to have the WebGL context track a list of all shader extensions, then when it is enabled prepend it to all future created shaders when enabled. We should also use the #line directive to make sure that source maps don't get screwed up. So in shaderSource we'd do something like prepend the lines:

#extension GL_OES_standard_derivatives : enable
// ... and any other extensions ...
#line 1

@bhouston
Copy link
Author

bhouston commented Jun 20, 2016

I know that if you want to use this in WebGL, you need to start your share with:

#extension GL_OES_standard_derivatives : enable

I sort of figured that this WebGL glsl directive was converted automatically into OpenGL via the ANGLE project? Or am I mistaken. I guess I keep expecting it to work easily because ANGLE already supports this extension (as well as quite a few others.)

@mikolalysenko
Copy link
Member

Yeah, disregard that last remark, I was confused. I think you should just be able to query the extension from ANGLE and load it directly. Can't dig into it right now, my attention is split a bit.

@bhouston
Copy link
Author

@mikolalysenko, Okay I understand. Let me know if you wanted compensation for your time to help make this library better. We can offer some.

@mhirsch
Copy link

mhirsch commented Jun 15, 2017

What's the status of this? Does it work? Can it be merged? Wouldn't this approach work for other extensions?

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.

3 participants