https://github.com/shader-slang/slang
Revision 935b629448fedc187243bfe88d4149bf30d89c05 authored by Tim Foley on 23 January 2019, 17:13:03 UTC, committed by GitHub on 23 January 2019, 17:13:03 UTC
There was a bug in the logic for emitting initial IR, such that it was neglecting to emit "methods" (member functions) unless they were also referenced by a non-member (global) function, or were needed to satisfy an interface requirement. This would only matter for `import`ed modules, since for non-`import`ed code, anything relevant would be referenced by the entry point so that the problem would never surface.

This change fixes the underlying problem by adding a step to the IR lowering pass called `ensureAllDeclsRec` that makes sure that not only global-scope declarations, but also anything nested under a `struct` type gets emitted to the initial IR module.

There are also a few unrelated fixes in this PR, which are things I ran into while making the fix:

* Deleted support for the (long gone) `IRDeclRef` type in our `slang.natvis` file

* Added support for visualizing the value of IR string and integer literals when they appear in the debugger

* Fixed IR dumping logic to not skip emitting `struct` and `interface` instructions. Switching those to inherit from `IRType` accidentally affected how they get printed in IR dumps by default.

* Fixed up the IR linking logic so that it correctly takes `[export]` decorations into account, so that an exported definition will always be taken over any other (unless the latter is more specialized for the target). I initially implemented this in an attempt to fix the original issue, but found it wasn't a fix for the root cause. It is still a better approach than what was implemented previously, so I'm leaving it in place.
1 parent a08a314
Raw File
Tip revision: 935b629448fedc187243bfe88d4149bf30d89c05 authored by Tim Foley on 23 January 2019, 17:13:03 UTC
Fix IR emit logic for methods in `struct` types (#791)
Tip revision: 935b629
appveyor.yml
# Our solution file is currently set up for VS2015
image: Visual Studio 2015

init:
  # Construct a version number suitable for using as a release name
  - ps: >-
      if ($env:APPVEYOR_REPO_TAG -eq "true")
      {
        $env:SLANG_VERSION = "$($env:APPVEYOR_REPO_TAG_NAME.TrimStart("v"))"
      }
      else
      {
        $env:SLANG_VERSION = "dev-$($env:APPVEYOR_REPO_COMMIT.Substring(0, 7))"
      }

# The project uses a submodule for the "glslang" dependency,
# so we need to make sure to pull that before building.
install:
  - git submodule update --init --recursive

# We want to build the full matrix of platforms and configurations
# that we support on Windows.
#
# Put Release|x64 first since that is the target which runs the most tests.
platform:
  - x64
  - Win32

configuration:
  - Release
  - Debug

# In the interests of time, go ahead and immediately fail a build
# if any job fails, rather than keep on building to discover the
# full set of failures.
matrix:
  fast_finish: true

# MSBUILD should ideally be able to find our solution file
# automatically, but it seems to get confused, so we specify
# the file name to use here.
build:
  project: slang.sln
  parallel: true
  verbosity: minimal

# Testing

# We only run tests on the Release build for now, just to speed
# up the build process.
#
# TODO: We should really define different levels of tests, and
# at least run some "smoke" tests across all builds.

test_script:
  - ps: |
      if ($env:CONFIGURATION -eq "Debug")
      {
        $testCategory = "smoke"
      }
      elseif($env:PLATFORM -eq "x64")
      {
        $testCategory = "full"
      }
      else
      {
        $testCategory = "quick"
      }
      .\test.bat -platform %PLATFORM% -configuration %CONFIGURATION% -appveyor -category $testCategory

# Package up the stuff we want to deploy into a single .zip file

after_build:
  - ps: |
      if ($env:PLATFORM -eq "x64")
      {
        $env:SLANG_DEPLOY_PLATFORM = "win64"
      }
      else
      {
        $env:SLANG_DEPLOY_PLATFORM = "win32"
      }
      $env:SLANG_BINARY_ARCHIVE = "slang-$($env:SLANG_VERSION)-$($env:SLANG_DEPLOY_PLATFORM).zip"

      7z a "$env:SLANG_BINARY_ARCHIVE" slang.h
      7z a "$env:SLANG_BINARY_ARCHIVE" slang-com-helper.h
      7z a "$env:SLANG_BINARY_ARCHIVE" slang-com-ptr.h
      7z a "$env:SLANG_BINARY_ARCHIVE" bin\*\*\slang.dll
      7z a "$env:SLANG_BINARY_ARCHIVE" bin\*\*\slang.lib
      7z a "$env:SLANG_BINARY_ARCHIVE" bin\*\*\slang-glslang.dll
      7z a "$env:SLANG_BINARY_ARCHIVE" bin\*\*\slangc.exe
      7z a "$env:SLANG_BINARY_ARCHIVE" docs\*.md

      $env:SLANG_SOURCE_ARCHIVE = "slang-$($env:SLANG_VERSION)-source.zip"
      
      7z a "$env:SLANG_SOURCE_ARCHIVE" slang.h
      7z a "$env:SLANG_SOURCE_ARCHIVE" slang-com-helper.h
      7z a "$env:SLANG_SOURCE_ARCHIVE" slang-com-ptr.h
      7z a "$env:SLANG_SOURCE_ARCHIVE" source\*\*.h
      7z a "$env:SLANG_SOURCE_ARCHIVE" source\*\*.cpp
      7z a "$env:SLANG_SOURCE_ARCHIVE" docs\*.md
      7z a "$env:SLANG_SOURCE_ARCHIVE" README.md
      7z a "$env:SLANG_SOURCE_ARCHIVE" LICENSE

# Register the created .zip file as an artifact with AppVeyor

artifacts:
  - path: $(SLANG_BINARY_ARCHIVE)
    name: binary_archive
  - path: $(SLANG_SOURCE_ARCHIVE)
    name: source_archive

# On a successful build of a tag, push archices to GitHub releases

deploy:
  release: v$(SLANG_VERSION)
  description: 'Slang $(SLANG_VERSION)'
  provider: GitHub
  auth_token:
    secure: +FukP7TA9F+fofZRZnu2FSqPcrQ1u4r8r4pl+/83owiY6M1R4ykg+8RcSzXi2f63
  artifact: 'binary_archive,source_archive'
  draft: false
  prerelease: false
  force_update: true # TODO: consider if we can avoid this
  on:
    configuration: Release
    appveyor_repo_tag: true        # deploy on tag push only
back to top