Skip to content

Commit ebafa44

Browse files
committed
Reformat README, remove os/platform restriction in package.json
1 parent 7a2f6b1 commit ebafa44

File tree

2 files changed

+47
-66
lines changed

2 files changed

+47
-66
lines changed

README.md

Lines changed: 47 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
# rollup-plugin-glsl-optimize
22
[![NPM Package][npm]][npm-url]
33
[![Changelog][changelog]][changelog-url]
4-
![Node Version][node-version]
5-
![Types][types]\
6-
[![Maintainability][cc-maintainability]][cc-maintainability-url]
7-
[![Coverage Status][coverage]][coverage-url]
4+
[![Node Version][node-version]](#)
5+
[![Types][types]](#)
6+
[![Maintainability][cc-maintainability]][cc-maintainability-url]\
87
[![Dependencies][dependencies]][dependencies-url]
9-
[![Dev Dependencies][dev-dependencies]][dev-dependencies-url]\
8+
[![Dev Dependencies][dev-dependencies]][dev-dependencies-url]
9+
[![Coverage Status][coverage]][coverage-url]
1010
[![Node.js CI][ci]][ci-url]
11-
[![NPM Publish][npm-publish]][npm-publish-url]
12-
[![Tool Binaries][tool-binaries]][tool-binaries-url]
1311

1412
Import GLSL source files as strings. Pre-processed, validated and optimized with [Khronos Group SPIRV-Tools](https://github.com/KhronosGroup/SPIRV-Tools).
1513

@@ -19,23 +17,50 @@ Primary use-case is processing WebGL2 / GLSL ES 300 shaders.
1917
import frag from './shaders/myShader.frag';
2018
console.log(frag);
2119
```
20+
21+
## Features
22+
23+
### GLSL Optimizer
24+
*For WebGL2 / GLSL ES >= 300*
25+
26+
With ``optimize: true`` (default) shaders will be compiled to SPIR-V (opengl semantics) and optimized for performance using the [Khronos SPIR-V Tools Optimizer](https://github.com/KhronosGroup/SPIRV-Tools) before being cross-compiled back to GLSL.
27+
28+
### Shader Preprocessor
29+
Shaders are preprocessed and validated using the [Khronos Glslang Validator](https://github.com/KhronosGroup/glslang).
30+
31+
Macros are run at build time with support for C-style ``#include`` directives: \*
32+
33+
```glsl
34+
#version 300 es
35+
#include "postProcessingShared.glsl"
36+
#include "dofCircle.glsl"
37+
38+
void main() {
39+
outColor = CircleDof(UVAndScreenPos, Color, ColorCoc);
40+
}
41+
```
42+
*\* Via the ``GL_GOOGLE_include_directive`` extension. But an ``#extension`` directive is not required nor recommended in your final inlined code.*
43+
44+
### Supports glslify
45+
Specify ``glslify: true`` to process shader sources with [glslify](https://github.com/glslify/glslify) (a node.js-style module system for GLSL).
46+
47+
*And install glslify in your devDependencies with ``npm i -D glslify``*
48+
2249
## Installation
2350

2451
```sh
2552
npm i rollup-plugin-glsl-optimize -D
2653
```
2754

28-
### Khronos tool binaries
29-
This plugin uses binaries from the [Khronos Glslang Validator](https://github.com/KhronosGroup/glslang), [Khronos SPIRV-Tools Optimizer](https://github.com/KhronosGroup/SPIRV-Tools) and [Khronos SPIRV Cross compiler](https://github.com/KhronosGroup/SPIRV-Cross).
55+
### Khronos tools
56+
This plugin uses the [Khronos Glslang Validator](https://github.com/KhronosGroup/glslang), [Khronos SPIRV-Tools Optimizer](https://github.com/KhronosGroup/SPIRV-Tools) and [Khronos SPIRV Cross compiler](https://github.com/KhronosGroup/SPIRV-Cross).
3057

31-
They are automatically installed for:
58+
Binaries are automatically installed for:
3259
* Windows 64bit (MSVC 2017)
3360
* MacOS x86_64 (clang)
3461
* Ubuntu Trusty / Debian Buster amd64 (clang)
35-
* Untested: Other amd64 Linux distros, arm64 MacOS
36-
3762

38-
Paths can also be manually provided / overridden with the ``GLSLANG_VALIDATOR``, ``GLSLANG_OPTIMIZER``, ``GLSLANG_CROSS`` environment variables.
63+
*Paths can be manually provided / overridden with the ``GLSLANG_VALIDATOR``, ``GLSLANG_OPTIMIZER``, ``GLSLANG_CROSS`` environment variables.*
3964

4065
## Usage
4166
```js
@@ -50,40 +75,6 @@ export default {
5075
};
5176
```
5277

53-
## Features
54-
55-
### Preprocessing and Validation
56-
Shaders are pre-processed and validated using the [Khronos Glslang Validator](https://github.com/KhronosGroup/glslang).
57-
58-
Macros are run at build time with support for C-style ``#include`` directives: \*
59-
60-
```glsl
61-
#version 300 es
62-
63-
#include "postProcessingShared.glsl"
64-
#include "dofCircle.glsl"
65-
66-
void main() {
67-
outColor = CircleDof(UVAndScreenPos, Color, ColorCoc);
68-
}
69-
```
70-
*\* Via the ``GL_GOOGLE_include_directive`` extension. But an ``#extension`` directive is not required nor recommended in your final inlined code.*
71-
72-
### Optimization
73-
**Requires WebGL2 / GLSL ES >= 300**
74-
75-
With ``optimize: true`` (default) shaders will also be compiled to SPIR-V (opengl semantics) and optimized for performance using the [Khronos SPIR-V Tools Optimizer](https://github.com/KhronosGroup/SPIRV-Tools) before being cross-compiled back to GLSL.
76-
77-
#### Known Issues / Caveats
78-
* ``lowp`` precision qualifier - emitted as ``mediump`` \*
79-
80-
*\* Since SPIR-V has a single ``RelaxedPrecision`` decoration for 16-32bit precision. However most implementations now treat ``mediump`` and ``lowp`` equivalently, hence the lack of need for it in SPIR-V.*
81-
82-
### Support for glslify
83-
Specify ``glslify: true`` to process shader sources with [glslify](https://github.com/glslify/glslify) (a node.js-style module system for GLSL) prior to all preprocessing, validation and optimization.
84-
85-
*Install glslify in your devDependencies with ``npm i -D glslify``*
86-
8778
## Shader stages
8879

8980
The following shader stages are supported by the Khronos tools and recognized by file extension:
@@ -124,27 +115,25 @@ The following shader stages are supported by the Khronos tools and recognized by
124115
## Changelog
125116
Available in [CHANGES.md](CHANGES.md).
126117

127-
## License
128-
129-
Released under the [MIT license](LICENSE).
118+
#### Caveats & Known Issues
119+
* This plugin handles glsl and glsify by itself. Use with conflicting plugins (e.g. rollup-plugin-glsl, rollup-plugin-glslify) will cause unpredictable results.
120+
* Optimizer: ``lowp`` precision qualifier - emitted as ``mediump``\
121+
*SPIR-V has a single ``RelaxedPrecision`` decoration for 16-32bit precision. However most implementations now treat ``mediump`` and ``lowp`` equivalently, hence the lack of need for it in SPIR-V.*
130122

131-
*Khronos tool binaries (built by the upstream projects) are distributed and installed with this plugin under the terms of the Apache License Version 2.0. See the corresponding LICENSE files in the ``bin`` folder.*
123+
## License
132124

133-
## See also
125+
Released under the [MIT license](LICENSE).\
126+
*Thanks to Vincent Wochnik ([rollup-plugin-glsl](https://github.com/vwochnik/rollup-plugin-glsl)) for the whitespace minification code.*
134127

135-
* [rollup-plugin-glsl](https://github.com/vwochnik/rollup-plugin-glsl)
128+
Khronos tool binaries (built by the upstream projects) are distributed and installed with this plugin under the terms of the Apache License Version 2.0. See the corresponding LICENSE files in the ``bin`` folder.
136129

137130
[ci]: https://github.com/docd27/rollup-plugin-glsl-optimize/actions/workflows/node-ci.yml/badge.svg
138131
[ci-url]: https://github.com/docd27/rollup-plugin-glsl-optimize/actions/workflows/node-ci.yml
139-
[tool-binaries]: https://github.com/docd27/rollup-plugin-glsl-optimize/actions/workflows/khronos-binaries.yml/badge.svg
140-
[tool-binaries-url]: https://github.com/docd27/rollup-plugin-glsl-optimize/actions/workflows/khronos-binaries.yml
141-
[npm-publish]: https://github.com/docd27/rollup-plugin-glsl-optimize/actions/workflows/npm-publish.yml/badge.svg
142-
[npm-publish-url]: https://github.com/docd27/rollup-plugin-glsl-optimize/actions/workflows/npm-publish.yml
143132
[npm]: https://img.shields.io/npm/v/rollup-plugin-glsl-optimize.svg
144133
[npm-url]: https://www.npmjs.com/package/rollup-plugin-glsl-optimize
145134
[node-version]: https://img.shields.io/node/v/rollup-plugin-glsl-optimize
146135
[types]: https://img.shields.io/npm/types/rollup-plugin-glsl-optimize
147-
[changelog]: https://img.shields.io/static/v1?label=SemVer&message=Changelog&style=flat&color=blue&logo=github
136+
[changelog]: https://img.shields.io/static/v1?label=changelog&message=SemVer&style=flat&color=blue
148137
[changelog-url]: https://github.com/docd27/rollup-plugin-glsl-optimize/blob/master/CHANGES.md
149138
[dependencies]: https://img.shields.io/david/docd27/rollup-plugin-glsl-optimize.svg
150139
[dependencies-url]: https://david-dm.org/docd27/rollup-plugin-glsl-optimize

package.json

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,6 @@
3131
"engines": {
3232
"node": ">=14"
3333
},
34-
"os": [
35-
"win32",
36-
"linux",
37-
"darwin"
38-
],
39-
"cpu": [
40-
"x64"
41-
],
4234
"main": "dist/index.js",
4335
"types": "dist/index.d.ts",
4436
"type": "module",

0 commit comments

Comments
 (0)