https://github.com/shader-slang/slang
Revision 1f4b49596f710e8009d1cc996574049c4afc3627 authored by Tim Foley on 19 November 2018, 17:08:26 UTC, committed by GitHub on 19 November 2018, 17:08:26 UTC
The `Texture2D.Load()` operation takes a `uint3` of coordinates, with the `.xy` part holding the texel coordinates and the `.z` part holding a mip level.
In contrast, the `RWTexture2D.Load()` operation only takes a `uint2`.
This isn't clearly specified on MSDN, so Slang failed to get the declaration right.

This change fixes it so that we only add the extra coordinate for the mip level on non-multisample, read-only texture types (the previous code only checked for multisample-ness).
I also changed the logic that outputs swizzles to extract the coordinates and mip level so that it only applies when there is a mip level being passed through (this code should never actually be applied, though, because we shouldn't be generating `texelFetch` for RW texures anyway...).

One final change that sneask in here is making the `offset` parameter for one of the load-with-offset cases correctly use the base coordinate count for the texture type (e.g., 2D even for `Texture2DArray`). That is an unrelated fix, but I thought I'd sneak it in here rather than do a separate PR.
1 parent 7e0c5ad
Raw File
Tip revision: 1f4b49596f710e8009d1cc996574049c4afc3627 authored by Tim Foley on 19 November 2018, 17:08:26 UTC
Fix declaration of RWTexture*.Load() operations (#722)
Tip revision: 1f4b495
.editorconfig
# This file sets up basic text editor behavior
# using EditorConfig: http://EditorConfig.org.
#
# Some editors will import and use the settings from
# this file automatically, while others need a plugin.

# Editors are supposed to search upwards from a source
# file to find configuration settings until they see
# a "root" file. This file should be a root:
#
root = true

# Shared configuration for all C/C++ and Slang code
#
[*.{c,cpp,h,slang}]

# Use UTF-8 encoding
#
charset = utf-8

# Indent using 4 spaces.
#
indent_style = space
indent_size = 4

# Insert a newline at the end of the file
# if one is missing (this used to be officially
# required by C, but it is also just a tidyness thing)
#
insert_final_newline = true

# Remove any extra whitespace characters at the
# end of a line. This is just for tidyness, to
# minimize the chances of introducing whitspace
# diffs that are hard to spot.
#
trim_trailing_whitespace = true
back to top