A customer couldn't recompile their large shader with -Od for debugging in PIX.
-The symbol manager would quit early, so now it continues to discover other variables
-The value-to-declare pass was adding an incorrect debug location, which tripped up the verifier.
Previously, this fragment iterator would attempt to figure out offsets for each struct fragment by itself. This was error-prone and unnecessary: the debug info already has this information.
In particular, the old code didn't handle natural alignment and the possible dead space between fragments that this might create.
Unfortunately the debug info is pretty hard to parse: things with the "member" tag are a few layers of type above the basic type that they actually represent, and contained structs' members have offsets relative to the start of that contained struct, not to the start of the whole struct. Both of these necessitate a recursive approach.
Subsequent work: run these tests with and without -enable-16bit-types and with different optimization levels. The latter is blocked behind bugs in the dbg.value-to-declare pass.
Three classes of fixes:
First a couple of trivial fixes in the DxcPix storage class, for >1-d arrays and embedded types.
Second, the addition of a new fragment iterator (now renamed "member iterator") that knows how to traverse the full structure of a struct, enabling the DxcPix* code to know bit offset and size for contained types.
Third, fixes to the numbering pass to know how to find alloca offsets via the various GetElementPtr statements that result when addressing struct members.
Lastly, a whole bunch of unit tests. Cuz this was really hard.
Remaining to do, as noted in the tests: the presence of a pointer-to-pointer type like floatNxM results in dbg.declare instructions not being emitted for structs. These tests (and perhaps some of the code) will need to be revisited if/when this is fixed.
This is a direct implementation of a new API for PIX that shortcuts the large and unwieldy (and not-really-working-well) DIA equivalent to find the set of instructions that correspond to a given source location.
* Adds the DxcPixDxilDebugInfo interface and friends.
* Modifies the entrypoints to require InParam/OutParam for pointers, as well as CheckNotNull them
* Removes S_FALSE for happier Jeff
* Fixes broken test
* returns E_POINTER for nullptrs
* Returns S_FALSE from UnAlias for non-aliasing types.
* fails GetName for arrays
* Addresses CR comments
* HLSL test infrastucture and other refactoring
Refactor common test infrastructure code into HLSLTestLib
Enable invocation of fxc and other executables via // RUN: commands in test files
Add latest d3dx12.h to include/dxc/Support and remove two other outdated copies
Improve DXIL container header validation on load
New helper classes DxilContainerReader and FixedSizeMemoryStream
Move LoadSubobjectsFromRDAT to DxilSubobjects.cpp
Co-authored-by: Greg Roth <grroth@microsoft.com>
* Add missing UTF8 for source and output filenames
- These need to be converted back to UTF-16 after argument processing for
a couple APIs and CA2W constructors were missing CP_UTF8 for the input
encoding from the utf-8 argument strings.
* Add CP_UTF8 to more CW2A and CA2W uses
* Integrate changes from internal.
- dxcapi v2
- new dxc options
- DxilValueCache
- PDB and NoOpt improvements
- noop / llvm::donothing() support
* Update dxrfallbacklayer for dxcapi internal changes
* Reorder diag block based on whether pDiag is set first.
* llvm::donothing() requires dxil 1.6 / SM 6.6 for now, lib as well.
* Fixes for spir-v, non-VC compiler and non-Windows builds
- DEFINE_CROSS_PLATFORM_UUIDOF for new interfaces
- add SAL annotations
- turn output argument validation for -P into warning
- handle warnings without concatenating them to main output
- update spirv preprocessing and compilation paths
- return E_NOTIMPL from IDxcUtils::CreateReflection
- cleanup: DxcContainerBuilder back to uft8, DxcTestUtils: remove comment
* Fix some warnings from clang/gcc.
* Fix unicode conversion problems on linux, where sizeof(wchar_t) == 4
Note this is an intermediate fix.
On linux, what we are calling utf16 is actually a wide string
that's probably utf32. This change fixes issues introduced by
the new interface changes so things are consistent and pass tests.
A future fix should correct the encodings so they are correctly labeled
on platforms where wchar_t doesn't mean UTF16.
* Return false for IsBufferNullTerminated when CP_ACP.
One test for Disassembler was crashing because it created a pinned blob
with a size of 1 << 31 + 1 without actual memory backing this. The
IsBufferNullTerminated would attempt to see if this was null terminated,
causing AV.
This change also removes CP_UTF8 from this test when it was creating
binary blobs, not UTF8 text blobs.
1) avoids leaking exceptions during symbol initialization
2) returns E_FAIL when the scope for a local variable is not found
3) uses getInlinedAtScope when searching for the local variable's scopes.
* Modifies DxilDia's to use factories instead of lambdas for creating symbols
DxilDia used to hold a vector of lambdas -- constructors -- for the symbols
it knew about. When the user requested a symbol, said constructor was to be
invoked, creating a brand new symbol.
C++ lambdas can be hard to debug (i.e., how does one inspect the lambda's
state?), so the library is modified to hold a vector of factories -- i.e.,
objects with fields and a CreateSymbol method.
* fixes typo when creating Typedef symbols
* caches the VarInfo when creating the LocalVariable factories
In the general case, bit_pieces might be only for part of a register or register range. For example a half in a VGPR or a SGPRx4 for which we only have debug info for the first register.