Use environment variable HLSL_AGILITYSDK_DIR which you can point to
extracted contents of an AgilitySDK.
Automatically copy binaries to appropriate location when set.
Look for MinTe binary set from TAEF. If found, set a local TAEF binary
location.
If this is set when running execution tests, copy MinTe there, and if the
HLSL_AGILITYSDK_DIR was set, also copy agility SDK binaries under the
.\D3D12\ subdir there, so the test can automatically pick it up.
Add hctbins.cmd to copy extra bins necessary for running things out of
the ...\bin or ...\test directories such as HLSLHost.exe. This includes
AgilitySDK bins if set.
Update FindTAEF.cmake to set binary dir based on HLSL_TAEF_DIR
Since we don't actually support a single project building to multiple
architectures, we look for te.exe in x86 OR x64 subdir.
Whichever one is set in hctstart.cmd should be the one that will be used.
Default D3D12SDKPath to ".\D3D12"
Autodetect version when not specified or "/p:D3DSDKVersion=1"
If D3DSDKVersion specified, fail if it can't use Agility SDK.
Because the LPCSTR set to shader stages in ShaderOp are used as a key,
the string pointer has to match an entry. Normally this works because
all strings are added to a string map and the pointer from this is used
for all LPCSTR pointers.
ExecutionTest groups were trying to override the entries by searching each
entry point for the desired name, then setting the stage to the string
pointer of that entry, so the pointer would match.
Another way is to just use insert() on the string map, which is what all
the other code uses (during loading from XML, for instance).
This change adds ShaderOp::GetString() to make it convenient to get the
appropriate string pointer for whatever string you have, so you may simply
set this pointer to the shader stage, without iterating through all shaders,
looking for the matching name.
This adds a check to detect when an entry name is set for a stage, but that
entry name doesn't match any shader in the ShaderOp.
It also updates the code in ExecutionTest to use this pattern instead, so
future tests won't copy the old pattern.
One additional advantage to this pattern is error detection: if you used
the old pattern, you could end up not finding the entry, setting nullptr to
the stage, then what you run might be a different stage than you thought,
without any error or indication otherwise. Many tests expect the same
results written from different stages, so if the wrong stage produced the
results, the test would not detect this. Now you will get a failure during
execution in this case.
* Define tier 1.1 locally for builds against older SDK
* Disable warning about use of value cast to enum in case.
This is necessary because different SDK headers include or exclude this tier, and we want to match the value either way.
This never got enabled in dxcapi.cpp in spite of all the code to support
it being in place. This enables the creation of the interface and
enables the tests that were disabled for want of it.
As an incidental, correctly defines the REGDB_E_CLASSNOTREG which made
the lack of this interface on Linux hard to diagnose.
- Skip Sampler for gpuHandle
- Key m_DescriptorData map off descriptor name instead of resource name (potential many-to-one for descriptor to resource).
- Fix uninitialized structs used in SetupRenderTarget
- Fix explicit Viewport detection to use > 0 (since uninit might end up with some large negative number, preventing all PS invocations in a way that wouldn't trigger any debug layer spew - hard to track down). This check had caused a long-standing regression in HLSLHost.
- Fix Sampler enum naming convention to be consistent with other string names for XML.
- Fix issue preventing UINT32 values from being parsed from XML (making it more difficult to fill in texture data, like 8-bit unorm formats).
KW(CBV_SRV_UAV_HEAP_DIRECTLY_INDEXED) was included when parsing keywords
starting with 'S' as well as 'C'. It should not have been included under
'S'. This change is minor cleanup, since it would never match that string
in this location. So this makes no behavioral change.
REGDB_E_CLASSNOTREG was defined to 1, which is a success code for HRESULT.
This value is returned when trying to create an unsupported object with DxcCreateInstance.
Since create appears to have succeeded, it would lead to a deref of a null pointer - segfault.
Uniquely detect low 16-bit usage properly for tbuffer, while detecting the case where full 32-bits are used that map to two 16-bit fields, requiring both fields to be marked.
Include handler is only meant to handle file requests. However, if DebugCompilationDir is not set, CGDebugInfo::getCurrentDirname() will try to get the current working directory, and on (*nix) it will expand $PWD, then perform status() on that. With a virtualized file system backed only by an include handler, you can't get thet status of files or directories, so failing the directory detection, it will attempt to open the file, which results in a call to get the file contents of the current working directory from the include handler.
The approach here is just to return DebugCompilationDir on HLSL, even if empty.
This prevents it from trying to fill it in automatically, cutting
off the path normally causing this problem.
A valid vertex shader output variable with SV_Position semantics may be
constructed from any HLSL BuiltinType that translates to a 32-bit
floating point type in the SPIR-V backend, so relax the requirements to
allow the use of additonal types (such as half4) when
-enable-16bit-types is false.
Fixes#4262
This change allows you to supply a root signature with a shader using the [RootSignature("...")] attribute, and will use that if no root signature was defined in the XML.
It will use the root signature from the first shader it encounters that has one.
* [SM6.7] QuadAny/All execution test (1/2)
This adds a first set of execution tests for QuadAny and QuadAll to test
compute, mesh, and amplification shaders. A separate execution test will
be coming for pixel shaders.
* Fixing QuadAny/All fallback expansion
The initial implementation missed one of the required bitwise
operations.
* Updating test case to reduce scope to compute only
This gets the test passing for SM 6.0 using the fallback implementation.
* Fixing mangled extra code
SM check will fail for too-high SM that a test requires if the device doesn't support it. No need ot gate the highest recognized SM based on the SDK header version.
Shader Model 6.7 is still a work in progress.
Thanks to multiple contributors at Microsoft for this work.
Added support for additional advanced texture operations, including:
Raw Gather, Programmable Offsets, SampleCmpLevel, and RWTexture2DMSAA.
Added new QuadAny/QuadAll intrinsics to help with writing quad-uniform control flow.
Added [WaveOpsIncludeHelperLanes] pixel shader entry attribute, changing the
behavior of wave ops to treat helper lanes as active lanes.
In many cases, systems where wchar was represented as 32-bits were being
referred to by types and variables affixed with "utf16" or similar. To
avoid confusion, this renames all such places to "wide".
In a few cases, the conversion were explicitly 16-bit, which wasn't the
intent.
HLSL 2017's enum and enum class compile to a type without an integer base.
So in this case we'll call it an unknown type for the purposes of PIX debug instrumentation.
Further work will be required to return the enumerants to PIX and to record an actual value during shader debug instrumentation.
* Refactor HLSLVersion to enum
This change converts HLSLVersion to an enum type `hlsl::LangStd`. Most
of the change is a mechanical appending `hlsl::LangStd::v` to the
integers we previously compared for version checks.
Additionally this change does the following:
* Adds a parseHLSLVersion function to unify parsing code
* Parsing code is converted to an llvm::StringSwitch over the possible
values instead of converting to integer
* Added enum value for `vLatest` so that changing the latest version is
done in one place
* Added enum value for `v202x` which parses from 202x to allow new
language features a place to land
* Updates based on PR feedback
During parsing, some properties about attributes are determined by
matching the identifier used in the source with the attribute spelling
in Attr.td. The assumption here was that attributes are all
case-sensitive. But HLSL attributes are not case-sensitive, and even
though code that matches these attributes to kind and determines
whether the attribute is valid has been adjusted to handle
case-insensitivity, the code that looks up properties had not.
One impact was that identifier arguments were not being recognized and
stored in the attributes properly (attributeHasIdentifierArg).
This change makes normalizeAttrName use lower() to force lowercase for
the incoming attribute name before it gets used in the StringSwitch.
normalizeAttrName now must return std::string instead of StringRef
since it's potentially changing the string, not just slicing it.
It would seem better to use the AttributeList::Kind in a switch instead
of matching the string used, but that would be a much more significant
change.
Note: for attributes to work now, all spellings for valid attributes
must be lower case in Attr.td (fortunately they currently are).
When replacing constant users, those users could be in functions other than the one being worked on.
The code would happily replace uses of the constant with instructions that weren't in the same function.
This would lead to bizarre consequences due to corrupt IR down the line.
This change prevents that from happenning.
* Adding /setprivate, /setrootsignature, and /Qstrip_priv to compile API calls
* Adding setprivate to initial container serialization, change warning to error
* Removed unused variable
* Adding private data blob last, because no gaurantee of aligned size
* Add error messages for conflicting private options
Since all other blob parts are expected to be aligned, make sure we always add private data at the end of the container.
Update DxcContainerBuilder to keep private data at the end as well.
- Maintain compatibility for validator version < 1.7.
- DxilContainerWriter_impl verifies size alignment for all parts, unless created with bUnaligned=true, used for backward compatibility.
- DxilValidation uses NewProgramSignatureWriter(), so bUnaligned is based on validator version in module.
* Pass compiler options to preprocessor
If we don't pass the compiler options to the preprocessor the
preprocessor doesn't get initialized correctly.
Without this change the preprocessor step identifies the shader model
version as 0.0, pipeline stage as invalid, and language version as the
default.
* Remove arugment duplication
NRVO can drop type attributes not captured into QualType, like glc. HLSL does not need NRVO, and it only poses problems in various areas, so this change turns it off globally for HLSL.
The test required an additional fix to resource return resprops merging, provided by Xiang.
Co-authored-by: Xiang Li <xiagli@microsoft.com>
These changes add a couple of new fields to the shader-access-tracking pass. The new fields are the shader kind and the instruction ordinal (from the dxil-annotate-with-virtual-regs pass). This will allow PIX to report richer feedback to the user about out-of-bounds access.
This revision adds out-of-bounds checking for SM6.6-style dynamic resources and samplers, a feature heretofore missing in PIX.
Fortunately, there was a bit spare (InstructionOrdinalndicator) that allows PIX to detect the new fields and thereby continue to operate with older versions of dxcompiler, a frequent customer scenario.