<feed xmlns='http://www.w3.org/2005/Atom'>
<title>slang.git/source/core/slang-com-ptr.h, 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>2018-06-22T17:09:01+00:00</updated>
<entry>
<title>Expose macros/functionality for defining interfaces  (#604)</title>
<updated>2018-06-22T17:09:01+00:00</updated>
<author>
<name>jsmall-nvidia</name>
<email>jsmall@nvidia.com</email>
</author>
<published>2018-06-22T17:09:01+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=d0c9571be3a2167a9f019310aca8f7cd326972c0'/>
<id>urn:sha1:d0c9571be3a2167a9f019310aca8f7cd326972c0</id>
<content type='text'>
* Added Result definitions to the slang.h

* Removed slang-result.h and added slang-com-helper.h

* Move slang-com-ptr.h to be publically available.

* Add SLANG_IUNKNOWN macros to simplify implementing interfaces.
Use the SLANG_IUNKNOWN macros to in slang.c

* Removed slang-defines.h added outstanding defines to slang.h
</content>
</entry>
<entry>
<title>Add support for "blobs" and a file-system callback (#596)</title>
<updated>2018-06-14T18:56:31+00:00</updated>
<author>
<name>Tim Foley</name>
<email>tfoleyNV@users.noreply.github.com</email>
</author>
<published>2018-06-14T18:56:31+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=e66d66b88e1c6ef8499708952fcbe3ba873f6e4c'/>
<id>urn:sha1:e66d66b88e1c6ef8499708952fcbe3ba873f6e4c</id>
<content type='text'>
* Add support for "blobs" and a file-system callback

The most obvious change here is that the Slang header now includes a few COM-style interfaces that can be used for communication between the application and compiler. In order to support the declaration of COM-like interfaces, several platform-detection macros were lifted out of `slang-defines.h` and into the public `slang.h` header. As it exists right now, this change makes the Slang API C++-only, but a C-compatible version can be defined later with the help of lots of macros (and/or something like an IDL compiler).

The two big interfaces introduced are:

* The `ISlangBlob` interface, which is compatible with `ID3DBlob`, `IDxcBlob`, etc. This is used to pass ownership of source/compiled code across the API boundary without copies. New versions of various entry points have been added to allow passing blobs: e.g., `spAddTranslationUnitSourceBlob` and `spGetEntryPointCodeBlob`.

* The `ISlangFileSystem` interface, which is used to allow applications to intercept any attempt by the Slang compiler to load a file (input source files, include files, etc.). This is *not* the same as the `IDxcIncludeHandler` interface, because it assumes UTF-8 encoded path names, instead of the 16-bit encoding that dxc/Windows prefer. It is also not very similar to `ID3DInclude` as used by fxc, because this callback interface is *not* responsible for handling the search through include paths, etc. - it is just a file-system abstraction layer.

Internally, a few different parts of the compiler were changed to either store data in blob form all the time, or to be able to synthesize a blob on-demand. Because our internal `String` type is a reference-counted copy-on-write type, using a `SlangStringBlob` to hold string data should achieve transfer of ownership back to the application without extraneous copies. There is plenty of room to clean up the architecture of some of these internal pieces if they *know* that their data will end up in a blob.

The existing Slang testing doesn't touch any of the APIs introduced here, so they can only confirm that existing functionality hasn't been broken. The new ability to return code blobs has been tested by integration of that feature into Falcor, but there has been zero testing of the ability to pass *in* source code as blobs, and the ability to hook file loading. Future changes will need to add test coverage for the new features.

* fixup: define SLANG_NO_THROW for non-Windows builds

* fixup: header copy-paste error caught by clang/gcc

* Cleanup: return reference-counted objects via output parameters

Returning a reference-counted object through the API as a raw pointer creates challenges.
The "obvious" answer is that the returned pointer should have an added reference (it is returned at "+1"), and the caller is responsible for releasing that reference. This makes sense when using raw pointers on the calling side:

```c++
IFoo* foo = spGetFoo(...);
...
foo-&gt;Release();
```

However, as soon as smart pointers start getting involved (to handle releasing reference counts when we are done with things), the picture gets more complicated:

```c++
MySmartPtr&lt;IFoo&gt; foo = spGetFoo(...);
...
```

The intention of code like that is that `foo` gets released when the smart pointer goes out of scope, but this probably doesn't happen with most smart pointer implementations. If the `MySmartPtr` constructor that takes a raw pointer retains it, then the destructor will only release *that* reference, and so the object will leak.

It is possible that the user will have a smart pointer type where the constructor that takes a raw pointer doesn't retain it, but in general such types introduce the potential for errors of their own, and no matter what the Slang API shouldn't go in assuming any particular policy.

This change makes it so that any reference-counted objects that are logically returned from a call are returned through output pointers. This design makes the leak-free cases easy (enough) to implement with raw pointers or smart pointers:

```c++
// raw pointer
IFoo* foo = nullptr;
spGetFoo(..., &amp;foo);
...
foo-&gt;Release();

// smart pointer
MySmartPtr&lt;IFoo&gt; foo;
spGetFoo(..., foo.writeableRef());
...
```

The only assumption here is that any COM smart-pointer type needs to provide an operation like `writableRef` that is suitable for using that pointer as an output parameter. Given that COM *loves* output parameters, this seems like a safe assumption (at the very least, anybody who interacts with COM would be used to this convention).

Future changes might introduce inline convenience methods for various operations that return results more directly, possibly by introducing a minimal smart-pointer type in the `slang.h` header (without prescribing that clients must use it...).

* fixup: another error caught by gcc/clang
</content>
</entry>
<entry>
<title>Feature/dx12 (#469)</title>
<updated>2018-04-02T23:59:33+00:00</updated>
<author>
<name>jsmall-nvidia</name>
<email>jsmall@nvidia.com</email>
</author>
<published>2018-04-02T23:59:33+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=38d5ef4764e9271ce2360f42b0759a236cddd9fe'/>
<id>urn:sha1:38d5ef4764e9271ce2360f42b0759a236cddd9fe</id>
<content type='text'>
* Fix signed/unsigned comparison warning.

* Split out d3d functions that will work across dx11 and 12.

* Improve slang-test/README.md around command line options.

* Make Guid comparison honor alignment for comparisons, such that mechanism work on architectures that can only do aligned accesses.

* Initial setup of D3D12 Renderer, with presentFrame and clearFrame.

* More support for D3D12

* Added FreeList
* Added D3D12CircularResourceHeap
* First attempt at createBuffer

* First pass at map/unmap.

* First pass binding vertex/constant buffers, and setting up InputLayout. Note that memory is not kept in scope on binding yet.

* First pass of D3DDescriptorHeap

* Small tidy up in render-d3d11. Added D3DDescriptorHeap to project.

* First pass at D3D12 bind state.

* Fix typos in D3D12Resource

* Tidy up Dx11 render binding a little to match more with Dx12 style.

* First pass at Dx12 BindingState

* Handling of the command list d3d12. Support for submitGpuWork and waitForGpu.

* First attempt at Dx12 capture of backbuffer to file.

* First attempt at D3D12 binding for graphics.

* D3D12 setup viewport etc - does now render triangle in render0.hlsl.

* First pass at support for compute on D3D12Renderer

* Use spaces over tabs in D3DUtil

* Tabs to spaces in D3D12DescriptorHeap

* Convert tab-&gt;spaces on render-d3d12.cpp
</content>
</entry>
<entry>
<title>Renderer resource mangement for render-test (#453)</title>
<updated>2018-03-26T19:34:01+00:00</updated>
<author>
<name>jsmall-nvidia</name>
<email>jsmall@nvidia.com</email>
</author>
<published>2018-03-26T19:34:01+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=74bf38b36d9074a83a53d3baf885d8886c0b3752'/>
<id>urn:sha1:74bf38b36d9074a83a53d3baf885d8886c0b3752</id>
<content type='text'>
* First pass at resource based renderer using RefObject.

* Correct handling of array of buffer pointers to Dx11.

* Fix bug with setting viewOut incorrectly in createInputTexture.

* More support for allowing com like interfaces.

* Added and tidied Slang::Result - adding interface specific results
* Guid added comparison support, and made base interface IComUnknown - with lowerCamel methods
</content>
</entry>
<entry>
<title>First pass impls on ComPtr and reorganise Renderer (#450)</title>
<updated>2018-03-21T18:28:43+00:00</updated>
<author>
<name>jsmall-nvidia</name>
<email>jsmall@nvidia.com</email>
</author>
<published>2018-03-21T18:28:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=d421988f91d0d6fda78b9aea4cba763f9c662ffe'/>
<id>urn:sha1:d421988f91d0d6fda78b9aea4cba763f9c662ffe</id>
<content type='text'>
* Fixed some small typos in api-users-guide.md

* Fix some small typos in slang-test/main.cpp, render-test/render-d3d11.cpp

* Remove exit() calls from test code. Added Slang::Result, which works in the same way as COM HRESULT.

* FIx bug introduced when moving to Slang::Result - handling E_INVALIDARG on Dx11.

* Fix the testing of feature levels on Dx11 renderer.

* First attempt at README.md for slang-test.

* Tidied up the slang-test README.md file.

* Fix some small typos in tools/slang-test/main.cpp

* Fix spaces -&gt; tabs problems.
Fix some small types.

* Refactor Renderer implementations such that:
* Class definition does not contain long implementation/s
* Removed unused globals
* Ordered implementation after class definition
* Made renderer specific classes child classes, and use Impl postfix to differentiate
* Converted tabs into spaces

* First pass at Slang::ComPtr. Added slang-defines.h which sets up some fairly commonly used defines such as SLANG_FORCE_INLINE, compiler detection, os detection, and some other cross platform features.
</content>
</entry>
</feed>
