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

Replace glslify with brfs #236

Merged
merged 2 commits into from
Nov 30, 2016
Merged

Replace glslify with brfs #236

merged 2 commits into from
Nov 30, 2016

Conversation

balthazar
Copy link
Contributor

Improve DX by enabling hot reload of vertex and fragments shaders.
Ease usage outside of Browserify.

Improve DX by enabling hot reload of vertex and fragments shaders.
Ease usage outside of Browserify.

Related to #231.
Copy link
Collaborator

@ibgreen ibgreen left a comment

Choose a reason for hiding this comment

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

Looks great, thanks for taking this on!

Let's just be consistent with how we import things across layers before we merge.

@@ -13,5 +13,5 @@ TODO
_docs
examples/winds/data/*.html
node_modules
npm-debug.log
*.log*
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: Maybe this wildcard is a little bit too general?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hum yeah npm-debug.log sometimes gets suffixed with numbers, maybe *.log.* would be better.


const glslify = require('glslify');
import {Layer, assembleShaders} from '../../../../../../index';
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: Why are we moving this import line down? I think we should follow a logical ordering when including files (e.g. our own code first, then our own modules, then standard modules).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I find it interesting to separate vendors modules from project source files, this way we know for sure what belongs is a dependency or not. Might be obvious right now because of the relative url but I would like to use absolute one in a near future, so I'm just laying to fondations.

import {Model, Program, Geometry, glGetDebugInfo} from 'luma.gl';

const glslify = require('glslify');
import {Layer, assembleShaders} from 'deck.gl';
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: Maybe have deck.gl before luma.gl? Higher level to lower level import order.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

luma.gl being a dependency of deck.gl, I find it more logic to put luma first.


const glslify = require('glslify');
import {Layer} from '../../../lib';
Copy link
Collaborator

Choose a reason for hiding this comment

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

These are imported differently in other layers (using single import line), let's be consistent.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Any example? Don't see it.

Copy link
Collaborator

Choose a reason for hiding this comment

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

The second file in this diff...

import {join} from 'path';
import earcut from 'earcut';

import {Layer} from '../../../lib';
Copy link
Collaborator

Choose a reason for hiding this comment

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

Ditto, order and combine imports

import {GL, Model, Geometry} from 'luma.gl';
import {join} from 'path';
import {readFileSync} from 'fs';

import {Layer} from '../../../lib';
Copy link
Collaborator

Choose a reason for hiding this comment

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

order and combine imports

import {join} from 'path';
import earcut from 'earcut';

import {Layer} from '../../../lib';
Copy link
Collaborator

Choose a reason for hiding this comment

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

Ditto

@yocontra
Copy link
Contributor

yocontra commented Nov 29, 2016

Wouldn't an alternate approach be to prebuild and tell webpack users to rely on the prebuilt version? That seems to be common (mapbox-gl-js does this).

Unrelated, but if glslify is kept in then you can use this https://github.com/hughsk/glslify-optimize

@balthazar
Copy link
Contributor Author

@contra The issue was that even if relying on the builded and minified version of deck.gl, glslify was still around and causing errors. Besides, having hot-reload of shaders is still not possible with the current glslify and is an big benefit.

I can look into integrating the mapbox-glsl-optimizer though, it looks promising, thanks!

@balthazar balthazar force-pushed the deprecate-glslify branch 2 times, most recently from 516e5ef to fff5fbb Compare November 29, 2016 23:20
Copy link
Collaborator

@ibgreen ibgreen left a comment

Choose a reason for hiding this comment

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

Looking good. Thanks.

@ibgreen ibgreen merged commit 31204d8 into master Nov 30, 2016
@ibgreen ibgreen deleted the deprecate-glslify branch November 30, 2016 00:01
@gnavvy
Copy link
Contributor

gnavvy commented Nov 30, 2016

The __dirname fails to get the correct path with npm linked modules. (shader files cannot be loaded in such case), checking now, please do not publish the new patch version just yet. @ibgreen @apercu

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants