<feed xmlns='http://www.w3.org/2005/Atom'>
<title>slang.git/tools/gfx/render-d3d12.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>String/List closer to conventions, and use Index type (#959)</title>
<updated>2019-04-29T21:03:46+00:00</updated>
<author>
<name>jsmall-nvidia</name>
<email>jsmall@nvidia.com</email>
</author>
<published>2019-04-29T21:03:46+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=4880789e3003441732cca4471091563f36531635'/>
<id>urn:sha1:4880789e3003441732cca4471091563f36531635</id>
<content type='text'>
* List made members m_
Tweaked types to closer match conventions.

* Use asserts for checking conditions on List.
Other small improvements.

* List&lt;T&gt;.Count() -&gt; getSize()

* List&lt;T&gt;
Add -&gt; add
First -&gt; getFirst
Last -&gt; getLast
RemoveLast -&gt; removeLast
ReleaseBuffer -&gt; detachBuffer
GetArrayView -&gt; getArrayView

* List&lt;T&gt;::
AddRange -&gt; addRange
Capacity -&gt; getCapacity
Insert -&gt; insert
InsertRange -&gt; insertRange
AddRange -&gt; addRange
RemoveRange -&gt; removeRange
RemoveAt -&gt; removeAt
Remove -&gt; remove
Reverse -&gt; reverse
FastRemove -&gt; fastRemove
FastRemoveAt -&gt; fastRemoveAt
Clear -&gt; clear

* List&lt;T&gt;
FreeBuffer -&gt; _deallocateBuffer
Free -&gt; clearAndDeallocate
SwapWith -&gt; swapWith

* List&lt;T&gt;
SetSize -&gt; setSize
Reserve -&gt; reserve
GrowToSize growToSize

* UnsafeShrinkToSize -&gt; unsafeShrinkToSize
Compress -&gt; compress
FindLast -&gt; findLastIndex
FindLast -&gt; findLastIndex
Simplify Contains

* List&lt;T&gt;
Removed m_allocator (wasn't used)
Swap -&gt; swapElements
Sort -&gt; sort
Contains -&gt; contains
ForEach -&gt; forEach
QuickSort -&gt; quickSort
InsertionSort -&gt; insertionSort
BinarySearch -&gt; binarySearch

Max -&gt; calcMax
Min -&gt; calcMin

* Initializer::Initialize -&gt; initialize
List&lt;T&gt;::
Allocate -&gt; _allocate
Init -&gt; _init
IndexOf -&gt; indexOf

* * Put #include &lt;assert.h&gt; in common.h, and remove unneeded inclusions
* Small refactor of ArrayView - remove stride as not used

* getSize -&gt; getCount
setSize -&gt; setCount
unsafeShrinkToSize-&gt;unsafeShrinkToCount
growToSize -&gt; growToCount
m_size -&gt; m_count

* Some tidy up around Allocator.

* Use Index type on List.

* Refactor of IntSet.
First tentative look at using Index.

* Made Index an Int
Did preliminary fixes.
Made String use Index.

* Partial refactor of String.

* String::Buffer -&gt; getBuffer
ToWString -&gt; toWString

* Small improvements to String.
String::
Buffer() -&gt; getBuffer()
Equals() -&gt; equals

* Try to use Index where appropriate.

* Fix warnings on windows x86 builds.
</content>
</entry>
<entry>
<title>Adapter selection for Renderer (#923)</title>
<updated>2019-03-25T15:48:10+00:00</updated>
<author>
<name>jsmall-nvidia</name>
<email>jsmall@nvidia.com</email>
</author>
<published>2019-03-25T15:48:10+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=2f4029a753f72833c30c4e6bad28c06b20540384'/>
<id>urn:sha1:2f4029a753f72833c30c4e6bad28c06b20540384</id>
<content type='text'>
* * Make adapter used selectable on the command line
* Added 'adapter' to Renderer::Desc with dx11, dx12, vk honoring it
* GL will check that the renderer matches, but cannot select a specific device
* Share functionality on dx adapter selection in D3DUtil

Note - that on tests that use OpenGL and the adapter doesn't match it will ignore the test (and display a message that the appropriate device couldn't be started)

* Small function name improvement.

* Variable rename to match type.

* Fix typo in Dx12 device selection.

* * Add checking if an adapter is warp
* Improve some comments
</content>
</entry>
<entry>
<title>Hotfix/dx12 cubemap lookup (#921)</title>
<updated>2019-03-21T18:18:11+00:00</updated>
<author>
<name>jsmall-nvidia</name>
<email>jsmall@nvidia.com</email>
</author>
<published>2019-03-21T18:18:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=5bdc3ef07373be62363deb64dedd4163589430b6'/>
<id>urn:sha1:5bdc3ef07373be62363deb64dedd4163589430b6</id>
<content type='text'>
* Disable Dx12 half tests. The half-calc test runs, but is not actually doing any half maths. If the code is changed such that it is, the device fails when the shader is used. This can be seen by looking at dxil-asm.

* Fix using software driver for dx12 even when hardware is requested.

* * Refactor Dx12 _createAdapter such that it doesn't have side effects and stores desc information
* Disable half on dx12 software renderer because it crashes

* * Disable erroneous warnings from dx12
* Test for adapter creation
* Identify warp specifically

* Structured buffer test now works on dx12.

* Fix intemittent crash on dx12.
Due to if a resource was initialized with data, the actual resource constructed might be larger, for alignment issues. This led to a memcpy potentially copying from after the allocated source data and therefore a crash. Now only copies the non aligned amount of data.

* * Rename the test to use - style
* Disable TextureCube lookup in tests, as does not produce the correct result in dx12 (will fix in future PR)

* Updated hlsl.meta.slang.h that has rcp for glsl.

* * Fix bug where the SRV description was incorrect for cubemaps on dx12
* Re-enable cube map access in dx12 tests
* Slightly re-organize texture upload on dx12 to not repeatidly create and destroy upload resource for array/cube scenarios
</content>
</entry>
<entry>
<title>Hotfix/dx12 tests use hardware (#920)</title>
<updated>2019-03-21T16:06:29+00:00</updated>
<author>
<name>jsmall-nvidia</name>
<email>jsmall@nvidia.com</email>
</author>
<published>2019-03-21T16:06:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=4e359e109d665490909ae4a1ca980b7d766c8eff'/>
<id>urn:sha1:4e359e109d665490909ae4a1ca980b7d766c8eff</id>
<content type='text'>
* Disable Dx12 half tests. The half-calc test runs, but is not actually doing any half maths. If the code is changed such that it is, the device fails when the shader is used. This can be seen by looking at dxil-asm.

* Fix using software driver for dx12 even when hardware is requested.

* * Refactor Dx12 _createAdapter such that it doesn't have side effects and stores desc information
* Disable half on dx12 software renderer because it crashes

* * Disable erroneous warnings from dx12
* Test for adapter creation
* Identify warp specifically

* Structured buffer test now works on dx12.

* Fix intemittent crash on dx12.
Due to if a resource was initialized with data, the actual resource constructed might be larger, for alignment issues. This led to a memcpy potentially copying from after the allocated source data and therefore a crash. Now only copies the non aligned amount of data.

* * Rename the test to use - style
* Disable TextureCube lookup in tests, as does not produce the correct result in dx12 (will fix in future PR)

* Updated hlsl.meta.slang.h that has rcp for glsl.
</content>
</entry>
<entry>
<title>Fix intemittent crash on dx12. (#919)</title>
<updated>2019-03-21T15:54:35+00:00</updated>
<author>
<name>jsmall-nvidia</name>
<email>jsmall@nvidia.com</email>
</author>
<published>2019-03-21T15:54:35+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=0e5b8ded11a2d425c2d3b2d5ed24ec6d8471ad87'/>
<id>urn:sha1:0e5b8ded11a2d425c2d3b2d5ed24ec6d8471ad87</id>
<content type='text'>
Due to if a resource was initialized with data, the actual resource constructed might be larger, for alignment issues. This led to a memcpy potentially copying from after the allocated source data and therefore a crash. Now only copies the non aligned amount of data.</content>
</entry>
<entry>
<title>First pass support for half on vk (#912)</title>
<updated>2019-03-18T22:19:26+00:00</updated>
<author>
<name>jsmall-nvidia</name>
<email>jsmall@nvidia.com</email>
</author>
<published>2019-03-18T22:19:26+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=71885de27c973a73b7d020f5ebbe86e16b86d7e4'/>
<id>urn:sha1:71885de27c973a73b7d020f5ebbe86e16b86d7e4</id>
<content type='text'>
* Look at getting half to work on vk.

* Alter half test so can always produce consistent test results.

* First pass working half on vk.

* Improve comments for vulkan extensions around half.

* Upgraded vulkan headers to v1.1.103

https://github.com/KhronosGroup/Vulkan-Headers

* * Add getFeatures on Render interface
* Vulkan renderer determines at startup if it can support half
* Parse render-features on render-test

* Small changes to half-calc.slang test.

* Structured buffer half access works as expected for Vk, but isn't for dx12, so disable for now.

* Require the half feature for renderers for the half-structured-buffer.slang test.

* * Added ToolReturnCode to be more rigerous about how a return code is passed back from a tool
* Added support for a tool being able to pass back an 'ignored' result.
* Used enum codes to indicate meanings
* Made spawnAndWait return a ToolReturnCode

* Ignore tests that don't have required render-feature

* Fix macro line continuation usage.

* Check dx12 has half support.

* Checking for half on dx12 - if CheckFeatureSupport fails, don't fail renderer initialization.

* Fix typo.
</content>
</entry>
<entry>
<title>Confirm layout for structured buffer of matrices, and related fixes (#889)</title>
<updated>2019-03-08T22:59:47+00:00</updated>
<author>
<name>Tim Foley</name>
<email>tfoleyNV@users.noreply.github.com</email>
</author>
<published>2019-03-08T22:59:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=281c67b8d92899f462695fe75a26467743a497e8'/>
<id>urn:sha1:281c67b8d92899f462695fe75a26467743a497e8</id>
<content type='text'>
* Fix up handling of NumElements for D3D buffer views

For everything but structured buffers we'd been setting this to the size in bytes, but that isn't really valid at all.
The `NumElements` member in the view descs is supposed to be the number of buffer elements, so it would be capped at the byte size divided by the element size.

This change fixes the computation of `NumElements` to take the size of the format into account for non-structured views.
For the "raw" case, we use a size of 4 bytes since that matches the `DXGI_FORMAT_R32_TYPELESS` format we use (which seems to be required for raw buffers).

I also added support for the raw case for SRVs where it didn't seem to be supported before (not that any of our tests cover it).

* Fix handling of size padding for D3D11 buffers

The existing code was enforcing a 256-byte-aligned size for all buffers, but this can cause problems for a structured buffer.
A structured buffer must have a size that is a multiple of the stride, so a structured buffer with a 48-byte stride and a 96-byte size would get rounded up to 256 bytes, which is not an integer multiple of 48.

This change makes it so that we only apply the padding to constant buffers.
According to MSDN, constant buffers only require padding to a 16-byte aligned size, and no other restrictions are listed for D3D11, but it is difficult to know whether those constrains are exhaustive.

I've left in the 256-byte padding for now (rather than switch to 16-byte), even though I suspect that was only needed as a band-aid for the `NumElements` issue fixed by another commit.

* Fix an IR generation bug when indxing into a strutured buffer element

The problem here arises when we have a structured buffer of matrices (an array type would likely trigger it too):

```hlsl
RWStructuredBuffer&lt;float3x4&gt; gMatrices;
```

and then we index into it directly, rather than copying to a temporary:

```hlsl
// CRASH:
float v = gMatrices[i][j][k];

// OKAY:
float3x4 m = gMatrices[i];
float v = m[j][k];
```

The underlying issue is that our IR lowering pass tries to defer the decision about whether to use a `get` vs. `set` vs. `ref` accessor for a subscript until as late as possible (this is to deal with the fact that sometimes D3D can provide a `ref` accessor where GLSL can only provide a `get` or `set`).

We probably need to overhaul that aspect of IR codegen sooner or later, but this change uses some of the existing machinery to try to force the `gMatrices[i]` subexpression to take the form of a pointer when doing sub-indexing like this. This fixes the present case, and hopefully shouldn't break anything else that used to work (because the subroutines I'm using to coerce the `gMatrices[i]` expression should be idempotent on the cases that were already implemented).

* Add a test case to confirm fxc/dxc layout for structured buffers of matrices

Even when row-major layout is requested globally, fxc and dxc seem to lay out a `StructuredBuffer&lt;float3x4&gt;` with column-major layout on the elements.
This commit adds a test that confirms that behavior.

This commit does not try to implement a fix for the issue (either fixing Slang's layout reflection information to be correct for what fxc/dxc do in practice, or fixing Slang's HLSL output to work around the fxc/dxc behavior), but just documents the status quo.
If/when we decide how we'd like to handle the issue long-term, this test can/should be updated to match the decision we make.

* fixup: build breakage on clang/gcc

This is one of those cases where the Microsoft compiler is letting through some stuff that isn't technically valid C++ ("delayed template parsing").
Fixed by just moving some declarations to earlier in the file.
</content>
</entry>
<entry>
<title>Hotfix/device check review (#862)</title>
<updated>2019-02-27T14:14:11+00:00</updated>
<author>
<name>jsmall-nvidia</name>
<email>jsmall@nvidia.com</email>
</author>
<published>2019-02-27T14:14:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=15ed4527a28e757ae2617905188ebf19f16cb0a1'/>
<id>urn:sha1:15ed4527a28e757ae2617905188ebf19f16cb0a1</id>
<content type='text'>
* Fix typo on return type.

* * Inverted order of FlagCombiner (to make more 'nested for' like)
* On Dx12 just use D3D_FEATURE_LEVEL_11_0
* Fix typo on dll name
</content>
</entry>
<entry>
<title>Dx11 &amp; Dx12 device startup (#861)</title>
<updated>2019-02-26T17:25:02+00:00</updated>
<author>
<name>jsmall-nvidia</name>
<email>jsmall@nvidia.com</email>
</author>
<published>2019-02-26T17:25:02+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=d9b73266ab46c9b4ba3b0d25d369e30143ac398f'/>
<id>urn:sha1:d9b73266ab46c9b4ba3b0d25d369e30143ac398f</id>
<content type='text'>
* Added CombinationUtil to produce combinations of flags
Used in Dx11 device creation making it fall back to release driver if debug driver is not found

* Made dx12 renderer startup similar to dx11 - testing multiple configs.

* Small improvements in naming.

* * Moved functionality to gfx from core
* Use FlagCombiner to simplify construction, and can be iterated over, without need for array
* Share DeviceCheckFlags

* Improve comments.

* Re-add the comment about combinations tested to set up dx11 device.

* More comment improvements.
</content>
</entry>
</feed>
