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
.travis.yml
# .travis.yml
#
# This is the configuration file to drive Travis CI for Slang.

language: cpp

env:
  - SLANG_TEST_FLAGS=-travis

# Build and test (clang, gcc) x (debug, release)
#
# We customize the set of tests run per-target to
# avoid having the build take too long.
matrix:
  include:
    - os: linux
      compiler: gcc
      env:
        - CONFIGURATION=debug
        - SLANG_TEST_CATEGORY=smoke
    - os: linux
      compiler: clang
      env:
        - CONFIGURATION=debug
        - SLANG_TEST_CATEGORY=smoke
    - os: linux
      compiler: clang
      env:
        - CONFIGURATION=release
        - SLANG_TEST_CATEGORY=smoke
    - os: linux
      compiler: gcc
      env:
        - CONFIGURATION=release
        - SLANG_TEST_CATEGORY=full
        - SLANG_DEPLOY=true

# Travis wants to default to a build script that invokes
# `./configure && make && make test` which is appropriate
# for autoconf, but I don't want to get into that mess..
#
script: make && make test

before_deploy: |
  export SLANG_OS_NAME=${TRAVIS_OS_NAME}
  export SLANG_ARCH_NAME=`uname -p`
  export SLANG_TAG=${TRAVIS_TAG#v}
  export SLANG_BINARY_ARCHIVE=slang-${SLANG_TAG}-${SLANG_OS_NAME}-${SLANG_ARCH_NAME}.zip
  zip -r ${SLANG_BINARY_ARCHIVE} bin/*/*/slangc bin/*/*/libslang.so bin/*/*/libslang-glslang.so docs/*.md README.md LICENSE slang.h slang-com-helper.h slang-com-ptr.h

# We are going to deploy to GitHub Releases
# on a successful build from a tag, but only
# on the one target in the build matrix that set
# `SLANG_DEPLOY`
deploy:
  provider: releases
  api_key: "$GITHUB_RELEASE_TOKEN"
  file: "$SLANG_BINARY_ARCHIVE"
  skip_cleanup: true
  on:
    condition: "$SLANG_DEPLOY =  true"
    tags: true
back to top