<feed xmlns='http://www.w3.org/2005/Atom'>
<title>slang.git/tools/gfx/window.cpp, branch master</title>
<subtitle>Making it easier to work with shaders</subtitle>
<id>https://git.yummers.dev/slang.git/atom?h=master</id>
<link rel='self' href='https://git.yummers.dev/slang.git/atom?h=master'/>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/'/>
<updated>2019-09-13T19:59:15+00:00</updated>
<entry>
<title>Refactor render-test to make cross platform (#1053)</title>
<updated>2019-09-13T19:59:15+00:00</updated>
<author>
<name>jsmall-nvidia</name>
<email>jsmall@nvidia.com</email>
</author>
<published>2019-09-13T19:59:15+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=c2e5d2468ad6a38cdb8a067da0678302f6cc6066'/>
<id>urn:sha1:c2e5d2468ad6a38cdb8a067da0678302f6cc6066</id>
<content type='text'>
* First pass of render-test refactor.

* Make window construction a function that can choose an implementation.

* Remove OpenGL as currently has windows dependency.

* Disable Vulkan as Renderer impl has dependency on windows.

* Pass Window in as parameter of 'update'.

* Add win-window.cpp as was missing.

* Fix warning on windows about signs during comparison.
</content>
</entry>
<entry>
<title>Fix a 64-bit issue in our Windows UI code (#887)</title>
<updated>2019-03-08T16:43:49+00:00</updated>
<author>
<name>Tim Foley</name>
<email>tfoleyNV@users.noreply.github.com</email>
</author>
<published>2019-03-08T16:43:49+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=4aab9cc79e7b0496ec447bad67225dc1c3486bef'/>
<id>urn:sha1:4aab9cc79e7b0496ec447bad67225dc1c3486bef</id>
<content type='text'>
Fixes issue #874

The problem here was that a pointer was being cast to `LONG` so that it could be used with the `SetWindowLongPtr` API, but that API actually expects a `LONG_PTR`. Since `LONG` is a 32-bit type on 64-bit Windows, the pointer we stored was getting truncated, leading to crashes.

I'm kind of surprised this wasn't biting more of our applications (e.g., the render tests).</content>
</entry>
<entry>
<title>Feature/premake linux (#689)</title>
<updated>2018-10-25T15:24:16+00:00</updated>
<author>
<name>jsmall-nvidia</name>
<email>jsmall@nvidia.com</email>
</author>
<published>2018-10-25T15:24:16+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=4f0415e338862ffec50c2d47eddea958255b504e'/>
<id>urn:sha1:4f0415e338862ffec50c2d47eddea958255b504e</id>
<content type='text'>
* Premake work in progress for linux.

* Added dump function.

* Remove examples on linux
Small warning fix.

* * Don't build render-test on linux
* Removed work around virtual destructor warning, and just used virtual dtor for simplicity
* Git ignore obj directories

* Fix premake working on windows.

* * Fix sprintf_s functions
* Make generates arg parsing more robust

* Added FloatIntUnion to avoid type punning/strong aliasing issues, and repeated union definitions.

* Work around problems building on linux with getClass claiming a strict aliasing issue.

* Fix for targetBlock appearing potentiall used unintialized to gcc.

* Linux slang link options -fPIC to make dll.

* Add -fPIC to build options on linux.

* Add -ldl for linux on slang.

* Fixes to try and get premake working with .so on linux.

* Make core compile with -fPIC

* Try to fix linux linking with --no-as-needed before -ldl

* Add rpath back.

* Remove render-gl from linux build.

* Re-add location for linux.

* Don't include &lt;malloc.h&gt; except on windows.

* Remove unused line to fix warning on osx.

* Remove ambiguity on OSX for operator &lt;&lt;.

* Fixing ambiguity with operator overloading and Int types for OSX.

* Fix ambiguity around UInt and operator

* Fix ambiguity of UInt conversion for OSX.

* Added UnambiguousInt and UnambiguousUInt to make it easier to work around OSX integer coercion for UInt/Int types.
</content>
</entry>
<entry>
<title>Hotfix/fixing warnings (#636)</title>
<updated>2018-09-17T13:18:57+00:00</updated>
<author>
<name>jsmall-nvidia</name>
<email>jsmall@nvidia.com</email>
</author>
<published>2018-09-17T13:18:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=24ad492a98dc99abfbf7523b50bbdb13274c097e'/>
<id>urn:sha1:24ad492a98dc99abfbf7523b50bbdb13274c097e</id>
<content type='text'>
* * Remove dispose from IRInst
* Use MemoryArena instead of MemoryPool
* Make all IRInst not require Dtor - by having ref counted array store ptrs that need freeing

* Increase block size - typically compilation is 2Mb of IR space(!)

* Fix issues around StringRepresentation::equal because null has special meaning.

* Don't bother to construct as String to compare StringRepresentation, just used UnownedStringSlice.

* Added fromLiteral support to UnownedStringSlice and use instead of strlen version.

* Use more conventional way to test StringRepresentation against a String.

* Fix gcc/clang template problem with cast.

* Fix warnings.
</content>
</entry>
<entry>
<title>Improve model-viewer support for lights (#626)</title>
<updated>2018-08-11T05:21:44+00:00</updated>
<author>
<name>Tim Foley</name>
<email>tfoleyNV@users.noreply.github.com</email>
</author>
<published>2018-08-11T05:21:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=56d8a752d84e984afab20de5980edf10fe6c06f5'/>
<id>urn:sha1:56d8a752d84e984afab20de5980edf10fe6c06f5</id>
<content type='text'>
* Improve model-viewer support for lights

The main visible change here is that the model-viewer example supports
multiple light sources, with a basic UI for adding new light sources to
the scene, and for manipulating the ones that are there.

Along the way I also refactored the `IMaterial` decomposition to be a
bit less naive, while still only including a completely naive
Blinn-Phong implementation.

I also went ahead and spruced up the `cube.obj` file so that it has
multiple materials, although it is still a completely uninteresting
asset.

* Fixup: Windows SDK version
</content>
</entry>
<entry>
<title>Add basic support for "Dear IMGUI" (#625)</title>
<updated>2018-08-06T22:52:38+00:00</updated>
<author>
<name>Tim Foley</name>
<email>tfoleyNV@users.noreply.github.com</email>
</author>
<published>2018-08-06T22:52:38+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=73ff6907d723003d30e400f661876e7960de574f'/>
<id>urn:sha1:73ff6907d723003d30e400f661876e7960de574f</id>
<content type='text'>
This isn't being made visible just yet, but it will allow us to have a simple UI for loading models into the model-viewer example.

In order to support rendering with IMGUI I had to add the following to the `Renderer` layer:

* viewports
* scissor rects
* blend support

These are really only fully implemented for D3D11, but adding them to the other back-ends should be a reasonably small task.</content>
</entry>
<entry>
<title>Major overhaul of Renderer abstraction, to support a new example (#624)</title>
<updated>2018-08-03T15:39:28+00:00</updated>
<author>
<name>Tim Foley</name>
<email>tfoleyNV@users.noreply.github.com</email>
</author>
<published>2018-08-03T15:39:28+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=68d705f6c805c9b4d31b386e065762e6db13ad18'/>
<id>urn:sha1:68d705f6c805c9b4d31b386e065762e6db13ad18</id>
<content type='text'>
The original goal here was to bring up a second example program: `model-viewer`.
While the existing `hello-world` example is enough to get somebody up to speed with the basics of the Slang API (as a drop-in replacement for `D3DCompile` or similar), it doesn't really show any of the big-picture stuff that Slang is meant to enable.
There wasn't any use of D3D12/Vulkan descriptor tables/sets, and there wasn't any use of interfaces, generics, or `ParameterBlock`s in the shader code.

The `model-viewer` example addresses these issues. Its shader code involves generics, interfaces, and multiple `ParameterBlock`s, and the host-side code demonstrates a few key things for working with Slang:

* There is an application-level abstraction for parameter blocks, that combines the graphics-API descriptor set object with Slang type information

* There is a shader cache layer used to look up an appropriate variant of a rendering effect by using parameter block types to "plug in" global type variables

* There is a clear separation between the phases of compilation: a first phase that does semantic checking and enables reflection-based allocation of graphics API objects, followed by one or more code generation passes for specialized kernels.

This example is certainly not perfect, and it will need to be revamped more going forward. In particular:

* The output picture is ugly as sin. We need a plan for how to get this to load better content, perhaps even popping up an error message to note that the required input data isn't present in the basic repository.

* The shader code is too simplistic. There isn't any real material variety, and the `IMaterial` abstraction is completely wrong.

* The use of parameter blocks is facile because there are no resource parameters right now. Fixing that will likely expose issues around interfacing with Slang's reflection API.

* The whole example exposes the issue that Slang's current APIs aren't really designed for the benefit of two-phase compilation (since our many client application has been stuck on one-phase compilation).

* Global type parameters are actually a Bad Idea that we only did for compatibility with existing codebases. We should not be showing them off in an example of the Right Way to use Slang, but the language support for type parameters on entry points is still not complete.

Of course, the majority of the changes here are *not* inside the example applications, and instead involve a major overhaul of the `Renderer` abstraction that is used for both tests and examples. The main thrust of the change is to make the abstraction layer be closer to the D3D12/Vulkan model than to a D3D11-style model. This is important for the `model-viewer` example, since it aspires to show how Slang can be incorporated into a renderer that targets a modern API. The most important bit is actually the use of descriptor sets and "pipeline layouts" a la Vulkan, since without these Slang's `ParameterBlock` abstraction won't make a lot of sense.

Implementation of the abstraction for the various APIs has very much been on an as-needed basis. The current implementation is just enough for the two examples to work, plus enough to get all the tests to pass in both debug and release builds on Windows.

A big missing feature in the API abstraction right now is memory lifetime management. The code had been trending toward something D3D11-like where a constant buffer could be mapped per-frame with the implementation doing behind-the-scenes allocation for targets like D3D12/Vulkan. I'd like to shift more toward a model of just exposing "transient" allocations that are only valid for one frame, because these are more representation of how an efficient renderer for next-generation APIs will work. That transition isn't actually complete, though, so there are problems with the existing examples where `hello-world` is actually scribbling into memory that the GPU might still be using, while `model-viewer` is doing full-on heavy-weight allocations on a per-frame basis with no real concern for the performance implications.

All together, there are a lot of things here that need more work, but this branch has been way too long-lived already, and so I'd like to get this checked in as long as all the tests pass.</content>
</entry>
</feed>
