2906 Commits
Author SHA1 Message Date
Alula 8c538f734e Use non-ARB blend functions (Mali GPU fix) 2020-10-07 15:03:50 +02:00
bors[bot]andAlex Butler 64baf60ed1 Merge #3029
3029: [pre-ll] Remove derivative r=kvark a=alexheretic

* Remove crate derivative.
* Fix some warnings: `&Error` -> `&dyn Error`.

After reading about master branch speeding up compile times by removing _derivative_ I wondered if it would help the pre-ll code too. Tbf I can see derivative is quite helpful for the `PhantomData` types where regular `#[derive(...)]` falls down. But it isn't _that_ hard to write out the impls.

It impacts clean builds more than I would expect _(linux, rust 1.38, ryzen 2700x)_.

### Before
```sh
$ hyperfine --max-runs 3 'cargo clean; cargo build --example cube' 
Benchmark #1: cargo clean; cargo build --example cube
  Time (mean ± σ):     34.765 s ±  0.126 s    [User: 248.966 s, System: 12.062 s]
  Range (min … max):   34.666 s … 34.906 s    3 runs
```
### After
```sh
$ hyperfine --max-runs 3 'cargo clean; cargo build --example cube'
Benchmark #1: cargo clean; cargo build --example cube
  Time (mean ± σ):     28.158 s ±  0.343 s    [User: 250.888 s, System: 12.067 s]
  Range (min … max):   27.819 s … 28.504 s    3 runs
```

PR checklist:
- [x] tested examples with the following backends: gl


Co-authored-by: Alex Butler <alexheretic@gmail.com>
2019-10-02 16:33:42 +00:00
Alex Butler dc020b5c70 Remove derivative usage
* Fix warning: `&Error` -> `&dyn Error`
2019-10-02 14:59:55 +01:00
bors[bot]andAlex Butler 403e93cc5b Merge #2979
2979: [pre-ll] Remove `core` alias in gfx_device_gl r=kvark a=alexheretic

Fixes `gfx_device_gl` to compile on recent nightlies, see #2964. I only removed the alias usage in this crate as it was the one that seems to cause issues.

PR checklist:
- [x] tested examples with the following backends: gl


Co-authored-by: Alex Butler <alexheretic@gmail.com>
2019-08-28 04:53:20 +00:00
Alex Butler 19abe85301 travis: Use xvfb service instead of before_install 2019-08-26 22:04:00 +01:00
Alex Butler d142e11e1f gfx_device_gl: Remove as core alias 2019-08-25 09:10:40 +01:00
Adrijaned f9d72995bb Updated Getting started to reflect ll rewrite (#2953) 2019-08-13 15:22:52 -04:00
bors[bot]andMichael Tang e813a7149b Merge #2942
2942: [pre-ll] dx11: handle structs in cbuffers r=kvark a=tangmi

If one puts a struct as a member of a constant buffer, `gfx` crashes trying to divide by zero.

When a shader variable type is a `D3D_SVC_STRUCT`, it is an array when the `Elements` field is > 0 and a struct when the `Members` field is > 0.

This changeset makes it so we calculate the struct of an array variable only when it is an array.

Co-authored-by: Michael Tang <tangmi@uw.edu>
2019-08-07 01:34:14 +00:00
Michael Tang 937e0d1952 fix: avoid divide-by-zero when the member of a cbuffer is a struct (vtype_desc.Elements == 0) 2019-08-06 17:18:19 -07:00
bors[bot]andMichael Tang 009243e52e Merge #2747
2747: [pre-ll] Support HLSL semantic indexes r=kvark a=tangmi

Fixes #2748
PR checklist:
- [x] tested examples with the following backends: DX11

This changeset adds support for HLSL semantic indices.

Users should now be able to specify a semantic with an index (such as `"TEXCOORD1"`) in their pipeline. If one does not include the index, an index of `0` is assumed (as HLSL assumes).

Introduces a struct that can be converted to and from a packed String.

Here are some sample mappings:
- `"TEXCOORD"` -> `VertexSemantic { name: "TEXCOORD", index: 0 }` -> `"TEXCOORD0"`
- `"TEXCOORD0"` <-> `VertexSemantic { name: "TEXCOORD", index: 0 }`
- `"TEXCOORD10"` <-> `VertexSemantic { name: "TEXCOORD", index: 10 }`

On link_input, we will try linking against the semantic name and index together (e.g. `"TEXCOORD0"`) and also just the semantic name (e.g. `"TEXCOORD"`) if the semantic index is 0, in the case that the user did not explicitly provide the semantic index, esp. for GLSL compatibility).

Co-authored-by: Michael Tang <tangmi@uw.edu>
2019-06-21 03:56:53 +00:00
Michael Tang 6447922154 Support semantic indexes in input layout creation. 2019-06-20 17:20:55 -07:00
bors[bot]andMichael Tang dc7e7a2534 Merge #2760
2760: [pre-ll] DX11 add ID3D11InfoQueue in debug builds r=kvark a=tangmi

Fixes #issue

PR checklist:
- [x] tested examples with the following backends: dx11

This adds debug output from the ID3D11InfoQueue (e.g. it'll send a message whenever a method is called incorrectly and sometimes call out which arguments are wrong). This code could also be adapted for `gfx-hal`'s dx11 backend to aid in the development experience there.

Co-authored-by: Michael Tang <tangmi@uw.edu>
2019-06-03 18:17:08 +00:00
Michael Tang 65c6b10c82 Create an ID3D11InfoQueue in debug and pump the messages on device cleanup
Use log facade with the correct severity

Use named types
2019-06-02 23:22:26 -07:00
bors[bot]andAlex Butler d565c19a11 Merge #2733
2733: [pre-ll] Add BC1 (DXT1), BC3 (DXT5) S3TC texture formats r=alexheretic a=alexheretic

Adds compressed BC1 & BC3 image formats for gfx_device_gl/opengl. Image data is expected to be already compressed.

New formats:
* `SurfaceType::BC1_R8_G8_B8` (DXT1)
* `SurfaceType::BC3_R8_G8_B8_A8` (DXT5)

Each supports rgb & srgb.

Resolves #2688

## Motive
I've been investigating texture compression to reduce VRAM usage in my game Robo Instructus. For this end I wanted more efficient 8-bit channel rgb & rgba storage with good opengl driver & hardware support.

S3TC is old and the best supported compression available (see https://opengl.gpuinfo.org/listcompressedformats.php). Patent issues are now history (see https://en.wikipedia.org/wiki/S3_Texture_Compression). For testing I used [GPUOpen-Tools/Compressonator](https://github.com/GPUOpen-Tools/Compressonator) for encoding, which is quite fast and seems to have decent quality.

* `BC1_R8_G8_B8` offers 8:1 compression over `R8_G8_B8_A8`
* `BC3_R8_G8_B8_A8` offers 4:1 compression over `R8_G8_B8_A8`

I didn't include BC2/DXT3, or BC7 as I don't plan to use it. However, support for this format can be trivially added on top of this change.

## No ETC2?
I did investigate ETC2 compression too which is newer yet features wide support. However, I found actual _hardware_ support for ETC2 on the desktop is much more limited that it may appear. It was a bit of a downer to see no VRAM usage reduction on my polaris RX480 when using ETC2 compressed textures. ETC2 formats also didn't seem to work without the `GL_ARB_texture_storage`/immutable storage code paths, whereas I've tested the BC1 & BC3 formats working either way. That can probably be addressed, but I didn't.

For the above reasons I decided against using ETC2 in the game & adding it here. Note though; similarly to BC2, this change will make it simpler to support ETC2 formats in future if desired.

## Issues
### OpenGL Extensions
~This code requires S3TC extensions added to `gfx_gl`. The changes there are ready to go if this PR is wanted. The gfx_gl dependency line needs to be changed:~
~https://github.com/gfx-rs/gfx_gl/pull/38~
Extensions now available in gfx_gl `0.6`.

### API support
Robo Instructus is an OpenGL 3.3 game so I'm not personally interested in other API support for these formats at the moment. Also considering pre-ll code is in support mode, and unsupported formats already seem common I thought it wasn't a big deal not supporting other APIs.

### Naming
I went with Vulkan naming style ie prefix with BC1. Maybe you guys have a better idea of what you'd like to name the formats. I'm not hugely fussed here.

### Format documentation
~It would be nice to have documentation for the new formats. Mentioning there various other pseudonyms & API support will probably help people wondering what BC1 does & means. However, the `impl_formats!` macro prevents easy documentation.~ I've added this. Other formats can now be fairly easily documented too.

Co-authored-by: Alex Butler <alexheretic@gmail.com>
2019-04-22 22:35:42 +00:00
bors[bot]andMichael Tang c14656a0d0 Merge #2736
2736: [pre-ll] Add emscripten build failure workaround r=kvark a=tangmi

Fixes #2721.

PR checklist:
- [x] tested examples with the following backends: macOS/GL
- [x] `rustfmt` run on changed code


Co-authored-by: Michael Tang <tangmi@uw.edu>
2019-04-22 21:44:09 +00:00
bors[bot]andAlex Butler ed22ab96d9 Merge #2742
2742: [pre-ll] Update glutin -> 0.21 r=kvark a=alexheretic

Update to the latest quite breaking glutin api changes.

PR checklist:
- [x] tested examples with the following backends: gl


Co-authored-by: Alex Butler <alexheretic@gmail.com>
2019-04-22 19:59:05 +00:00
Alex Butler 9878d14c99 Update gfx_gl -> 0.6 2019-04-22 14:55:44 +01:00
Alex Butler 6da47888ab Disable travis Windows caching
Caching on Windows is slow & can cause timeout failures
2019-04-22 14:55:43 +01:00
Alex Butler 68c2a0157c Add documentation for BC1, BC3 formats 2019-04-22 14:55:43 +01:00
Alex Butler f36c54e26e Add BC1 (DXT1), BC3 (DXT5) S3TC texture formats
Compressed image formats supported in gfx_device_gl
2019-04-22 14:55:43 +01:00
Alex Butler a5f1e38f7d Disable travis Windows caching
Caching on Windows is slow & can cause timeout failures
2019-04-22 11:53:01 +01:00
Alex Butler 8b47ae0e1e Update glutin -> 0.21 2019-04-20 22:11:35 +01:00
bors[bot]andMichael Tang a427c50d0f Merge #2745
2745: [pre-ll] initialize device r=msiglreith a=tangmi

Fixes #2727
PR checklist:
- [x] tested examples with the following backends: DX11
- [ ] `rustfmt` run on changed code


Co-authored-by: Michael Tang <tangmi@uw.edu>
2019-04-19 11:00:32 +00:00
Michael Tang 4c538690f7 Merge branch 'pre-ll' into pre-ll-initialize-device 2019-04-15 18:26:52 -07:00
Michael Tang f739564a51 Initialize device from existing device and context 2019-04-15 18:14:43 -07:00