A missing `else` made it possible for a resource variable with a
corresponding counter variable that was defined with both
vk::binding and :register, each indicating a different descriptor
set to have the main variable assigned the set indicated by
vk::binding while the counter went to the set indicated by the register
Adds a new test for this and other such conditions.
A number of warnings unique to release buildsi persist. Some of these
same errors were fixed earlier for debug builds.
DXASSERT_LOCALVAR still took a variadic macro on release builds.
Fixes 85 clang warnings
Expressions used only as conditionals for asserts were not properly
dummied out with (void) cast.
Fixes 7 clang warnings
Variables used only in asserts dummied out.
Fixes 27 clang warnings
Potential uninitilized uses of variables assigned in switches/ifs.
fixes 5 clang warnings
put braces around empty else statements
11 gcc warnings
- add OP::GetMinShaderModelAndMask to compute mask and min SM
- account for ops that can be translated during linking
- update PS ops that could be allowed in library functions
- update min SM with newer optional feature flags
This will give users a way to know the commit from which a DXC
library/binary was built from, so that they can compare different
libraries/binaries and report bugs easily.
dxc.exe now also prints the commit info using this new interface
method. It uses the following format:
(dev;<commit-count>-<commit-hash>)
Accessing sub-elements in (RW)Buffer with adjacent array subscript
operators was falsely translated into an OpAccessChain with two
indices. Instead, we need to perform OpImage* on the (RW)Buffer
object and then do single-index OpAccessChain.
* Propagate /no-warnings flag
* With these changes, warnings are not shown when /no-warnings flag is used and they get printed when /no-warnings flag is not used. The exact behavior is mirrored when a user decides to output warnings and errors to an output file by using /Fe flag.
In this CL, we have introduced the "WinAdapter.h" header file.
This file includes declarations and definitions that will enable compilation of the code base on non-Windows platforms. These include:
* Disabling SAL annotations for non-Windows platforms.
* Defining some Windows-specifc macros that are not defined on other platforms.
* Defining Windows-specific types that are used throughout the codebase for non-Windows platforms.
This file is currently not complete. As we go forward, we will add more classes/structs/type definitions to this file for specific purposes. The contents of this file is completely disabled (#ifdef'd away) for Windows, and do not affect Windows compilation in any way. For the most part, this is our way of enabling compilation of the codebase on non-Windows platforms without making invasive changes to the existing cpp files, and without hindering any future development. Moreover, I have added the #include of this file for all the locations that will need it for successful Linux compilation.
ModuleBuilder had a catch-all function to apply decorations not
taking additional parameters, however, every single call to this
has an explicit decoration parameter. The switch only slows things
down and doesn't help with code length or anything else. The switch
is missing the other decorations that have custom functions, which
produce warnings. Rather than add a default: case, I've provided
custom decorate functions for each decoration.
Removes unused variables and functions from code between HLSL
change comments in LLVM code or else in HLSL or SPIRV original
source files along with any code correspondingly rendered unused
or originally in service of these ultimately unused elements.
Each of these produces a warning in clang, gcc, or both.
Fixes around 458 clang warnings and 461 gcc warnings.
A persistent and occasionally confusing warning is produced on
Windows release builds because of a conditional expression that only
contains an assert. On a release build, this amounts to nothing but
a semicolon, which produces the warning.
This folds the conditional into the previously explicit assert so
it is included or excluded entirely regardless of build type.
Fix Half:
- Override printing policy based on HLSL instead of enabling
LangOptions::Half, which enables keyword and changes behavior.
Fix entry props/sigs/UseMinPrecision:
- Make sure entry/signature data is available once SetShaderModel() is
called for shader targets (not for library).
- Add bUseMinPrecision flag to SetShaderModel() since the global switch
is needed at that point.
- Remove SetUseMinPrecision() since it should be set in SetShaderModel()
and should not be changed.
- Modify DxilModule loading to initialize UseMinPrecision flag correctly
for entry signatures, and fix signature copy constructor.
- Remove DxilModule level entry property duplicates, use the
DxilFunctionProps instead, except where useful (GS stream mask),
and make sure these are always available/in-sync.
- Fix various code accessing properties that don't match target
- Fix various ordering issues causing bugs in properties
- Don't duplicate functions to strip them of parameters when they have
already been stripped (linker hits this).
Also: Fix per-thread file system in opt.exe for testing
- Make sure entry/signature data is available once SetShaderModel() is
called for shader targets (not for library).
- Add bUseMinPrecision flag to SetShaderModel() since the global switch
is needed at that point.
- Remove SetUseMinPrecision() since it should be set in SetShaderModel()
and should not be changed.
- Modify DxilModule loading to initialize UseMinPrecision flag correctly
for entry signatures, and fix signature copy constructor.
- Remove DxilModule level entry property duplicates, use the
DxilFunctionProps instead, except where useful (GS stream mask),
and make sure these are always available/in-sync.
- Fix various code accessing properties that don't match target
- Fix various ordering issues causing bugs in properties
- Don't duplicate functions to strip them of parameters when they have
already been stripped (linker hits this).
Finalize OpCode changes for Dxil 1.3 / SM 6.3
- Rename CreateHandleFromResourceStructForLib to CreateHandleForLib
- Add PrimitiveIndex
- Add final NumOp[Codes|Classes]_Dxil_1_3 values
- Fix legal shader stage set for PrimitiveID
When switching over an enum value, the ideal is to include a case
for every possibly value. Where possible, that's what this change
does to silence warnings and also to provide space to properly
handle every possible input and throw a warning should a new one
be added. In some cases, it's not practical to list every input.
In these cases, putting a default that doesn't change the behavior,
but let's the compiler know that the behavior is intended.
Fixes 133 clang and 8108(!) gcc warnings.
hctstart.cmd and hctbuild.cmd now support ARM64 builds.
Note that building ARM64 build on x86/x64 machine needs a location
of x86/x64 version of TableGen tools (clang-tblgen and llvm-tblgen).
Before starting ARM64 build set the BUILD_TBLGEN_PATH to point to
the TableGen binaries or use the -tblgen option on hctbuild.cmd.
Also had to rearrange control flow around the cmake --build call
in hctbuild.cmd due to a flaky batch behavior around brackets.
Regardless of the order of variables placed in a constructor
member initializer list, the variables are initialized in the
order they are listed in the class or struct. This can cause
issues where the assignment of one variable depends on the other.
For this reason, a warning is produced if the member variables
are listed in a different order. This change moves the member
initializer lists into the order they were being initialized.
Fixes 23 clang and 24 gcc warnings.
Initialization of members of a larger aggregate type may benefit
from braces to clarify which variables are expected to go where.
At the same time, scalars should not be so segregated. This places
or removes such braces wherever appropriate.
Fixes 144 clang warnings
LLVM includes cross-platform thread local storage methods for
saving, retrieving, and deleting thread-specific objects. Using
these methods is superior to the thread_local storage qualifier
because the former works on Apple, Linux, and Windows. It also
uses the same mechanism as the previous Windows implementation
used without compiler idiosyncracies.
Placement new is needed in DxcInitThreadMalloc because operator
new requires the TLS malloc to be in place.
pParameters and pStaticSamplers were both marked const in spite of
the qualifier being cast off at nearly every usage. So they lose
their const. If you're the target of memcpy or memset, you are
not const.
Fixes 12 gcc and 12 clang warnings
Various comparisons produce warnings because the values differ in
signedness. This either changes the type of one of the parameters
or else it casts one. This includes adding casts to all of the
defined return error values. Which is more than was needed, but
consistent with some existing values anyway.
Fixes 11 clang and 12 gcc warnings.
Eliminate a few greater than or equal comparisons of unsigned
values which are always true. The most aggressive of this is
the exclusion of a function that has become a no-op because of
HLSL initialization of a key variable that had some invalid
comparisons because of the same const value.
Fixes 4 clang and 7 gcc warnings.
Additionally casts a few parameters to the proper type to silence
warnings about confusing or problem casts. This includes printing
functions, array indices, and deletes of void pointers. The latter
of which might have caused problems.
Fixes 6 clang 6 gcc warnings.
One incidental change that silences a warning about security for
using a string variable as the format for printf. Since it just
outputs the string, fputs is more appropriate anyway. Also
directed to stderr as more appropriate for debug info.
Integration fixes.
- Remove unused constructor from FunctionTableReader
- Remove hlsl::Exception dependency from DxilRuntimeReflection.inl
- Fix field size sizeof(RuntimeDataFunctionInfo) in legacy loader
- Add __cdecl to raw_ostream::operator<<(...) for ios_base change
- Move string constant definitions to from CGHLSLMS to DxilModule, since
they are required by HLSL.lib, and that shouldn't depend on clang CodeGen.
Primarily if not exclusively due to the massive carveouts of the
original LLVM source base as part of the HLSL adaptation, many
variables and functions are left unused. In keeping with the
practice of commenting or ifdef-ing out unused portions of this
code and marking every such exclusion as an HLSL change, this adds
few comments and moves a lot of preprocessor conditionals around to
encompass the portions left unused as a consequence of the earlier
exclusions.
Fixes 450 clang and 442 gcc warnings.
Found as part of a project to eliminate warnings, but this is an
actual bug. An HLSL change adds the possibility of a Dxil and an
HLSL module to the base LLVM Module as well as the ability to
retrieve a reference to them when the are present. This reference
retrieval was mistakenly used to determine if the module was
present in spite of the fact that references are never null. Worse
the reference is from a dereferenced pointer, so if it wasn't there,
it would cause a null dereference. The module interface had methods
to query the presence of these submodules, but they weren't used.
fixes 4 clang warnings and possibly some mysterious crashes
The same warning for a different cause is encountered where an
address is taken of a value passed by reference and compared to
null, which can never be true.
Fixes 1 clang warning.
Defaults in switch statments can mask warnings that might
indicate that a new enum value was added and corresponding changes
to a switch statement that relies on that enum are missed. For this
reason, clang reports when switch statements that fully define case
statements for all possible enum values contain default: statements.
However, this is a warning of a potential problem that might arise
from future changes to the code rather than anything that might be
wrong now. Additionally, while unlikely that an enum switch might
be presented with a value that isn't valid for that enum, it isn't
impossible. So rather than respect this warning, we will silence it.
It's not included by default. LLVM wanted it. We don't, so it's
removed. This makes the earlier external cmake change unnecessary.
Ignores 34 clang warnings
A surprising number of if statements declare variables in their
parentheses. Usually, these variables are used afterward. When they
are not, gcc produces a warning. clang does not.
Fixes gcc warnings.
Clang and gcc complain when AND and OR logical operations are both
used in a single conditional because of the possibility of mistakes
when depending solely on operator precedence. In fact, this change
fixes a few clear errors mostly in asserts that would never fire.
Fixes 13 clang and 22 gcc warnings.
Additionally, when two if statements are followed by an else, there
may be some ambiguity in terms of which if the else applies to. It
is the closest one, the second in the case of two, but it is another
area of potential mistakes. Adding braces around the code intended
as the block of the first if conditional clarifies this.
fixed 8 clang and 8 gcc warnings.
Clang complains sometimes when assignments take place in a
conditional without additional parenthesis around it. It can
indicate when what was meant to be an equal comparison is replaced
with an assignment.
fixes 2 clang warnings.
clang-spirv-tests uses a lot of external projects that keep
themselves clean with different standards of warnings flags.
This alters the appropriate cmake files to disable flags that
the DXC build enables.
Fixes 72 gcc and 166 clang warnings.
Additionally catch some sign mismatch comparisons in tests
built as part of clang-spirv-tests.
Fixes 2 gcc and 2 clang warnings, but one of them has multiple sources
So it's kind of a lot more.