Граф коммитов

3519 Коммитов

Автор SHA1 Сообщение Дата
Helena Kotas 0a07209e4c
Minor hcttest.cmd fix - add quotes in if condition in case HLSL_TAEF_DIR is empty (#4300) 2022-02-25 17:09:58 -08:00
Chris B 4e3755aa7b
Extending QuadAnyAll test for MS and AS (#4287) 2022-02-25 14:11:43 -06:00
Tex Riddell 6f766ed828
New HLSL_AGILITYSDK_DIR and HLSLHost dependency copying help. (#4297)
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.
2022-02-24 14:04:52 -08:00
Tex Riddell 9668399976
ExecutionTest: Autofill Path/Version for AgilitySDK (#4277)
Default D3D12SDKPath to ".\D3D12"
Autodetect version when not specified or "/p:D3DSDKVersion=1"

If D3DSDKVersion specified, fail if it can't use Agility SDK.
2022-02-23 13:41:21 -08:00
Tex Riddell b66846d073
Exec tests: change string entry setting pattern (#4296)
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.
2022-02-23 11:49:52 -08:00
Tex Riddell 4329ce93df
DxExp: Fix raytracing tier (#4267)
* 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.
2022-02-22 23:35:44 -08:00
Tex Riddell ec33cbf722
Missing break in CreateHandleFromHeap case caused unwanted shader flags (#4292)
hasWriteableMSAATextures and hasAdvancedTextureOps were being set if you
used CreateHandleFromHeap because of a missing break.
2022-02-22 23:34:19 -08:00
Greg Roth 31ece23b14
Enable Container Builder on *nix (#4244)
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.
2022-02-22 11:00:55 -08:00
Tex Riddell 152a76216c
ShaderOpTest: Fixes for sampler, HLSLHost, and texture init (#4282)
- 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).
2022-02-22 10:27:07 -08:00
Tex Riddell bd14c14a50
Fix extra case in root signature parsing (#4280)
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.
2022-02-22 10:05:26 -08:00
Tex Riddell 3889cc3fdf
[linux] Fix incorrect REGDB_E_CLASSNOTREG value (#4241)
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.
2022-02-22 09:33:51 -08:00
Tex Riddell 162de5b019
Uniquely detect low 16-bit usage properly for tbuffer (#4250)
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.
2022-02-22 09:33:24 -08:00
Tex Riddell 868f339d88
Return empty string from CGDebugInfo::getCurrentDirname() (#4265)
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.
2022-02-22 09:27:55 -08:00
Natalie Chouinard 3fcd83e43b
[spirv] Relax SV_Position type requirements (#4275)
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
2022-02-22 11:58:44 -05:00
Tex Riddell 3f8e22cec1
Only set ResMayNotAlias flag when on DXIL 1.7 (#4276)
Avoid failure in existing driver on unrecognized raw flags.
2022-02-19 01:23:29 -08:00
Tex Riddell 768255cad2
ShaderOpTest: Add sampler parsing and desc support (#4281) 2022-02-18 23:00:11 -08:00
Tex Riddell 71b195856a
ShaderOpTest: Optionally create root signature from shader instead of XML (#4278)
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.
2022-02-18 18:12:41 -08:00
Tex Riddell 9900c4d051
ShaderOpTest: Use DXC to compile root signature instead of FXC (#4279) 2022-02-18 17:59:50 -08:00
Adam Yang 2ec23bcaea
Delete dbg.declare in scopes where the alloca is unused (#4272) 2022-02-17 16:59:44 -08:00
Natalie Chouinard 8a2c92b5a9
[spirv] Replace some uses of std::string (#4274)
Replace uses of std::string with llvm::StringRef in SpirvBuilder.
2022-02-17 13:24:35 -05:00
Natalie Chouinard 2d5f1863a6
[dxil2spv] Add stage IO variables (#4271) 2022-02-17 10:10:00 -05:00
Chris B a4b864751c
[SM6.7] QuadAny/All execution test (1/2) (#4264)
* [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
2022-02-16 22:25:44 -06:00
Xiang Li e98f8cbc8b
Support resource array in UpdateStructTypeForLegacyLayout on lib profile. (#4266) 2022-02-16 10:33:47 -08:00
Tex Riddell 851d1fbed6
Enable Agility SDK from execution test arguments. (#4269)
Don't free D3D12 module just after setting modes that will be lost if unloaded.
2022-02-16 09:40:21 -08:00
Tex Riddell 037b47ca4a
Highest SM need not be gated by SDk headers. (#4268)
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.
2022-02-16 09:39:00 -08:00
Jaebaek Seo 2322f53773
[spirv] change __spirv definition to __spirv__ (#4270)
We implicitly defined `__spirv` when SPIR-V code gen is enabled and
`-spirv` command line option is given. This commit changes it to
__spirv__.
2022-02-16 12:29:38 -05:00
Helena Kotas 9f60094d90
User Windows SDK version from VSDevCmd for all platforms (#4259) 2022-02-15 14:07:46 -08:00
Xiang Li d9a790e252
WriteSemanticDefines before clang codeGen to update codeGen option (#4261)
* WriteSemanticDefines before clang codeGen to update codeGen option based on HLSLOptimizationToggles.
2022-02-15 13:29:13 -08:00
Tex Riddell b338314f6e
Implement Shader Model 6.7 (#4260)
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.
2022-02-15 11:38:42 -08:00
Greg Fischer 74a1543493
[spirv] Generate correct Shader.DebugInfo for runtime arrays. (#4258)
This is a common construct for bindless shaders.
2022-02-15 11:14:18 -05:00
Greg Roth 75224d820f
Rename UTF16 to Wide (#4242)
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.
2022-02-14 15:24:40 -05:00
Natalie Chouinard 20ccd72e80
[spirv] Append template params to UserTypeGOOGLE (#4248) 2022-02-14 15:00:01 -05:00
Natalie Chouinard 6633191b0b
[spirv] Update SPIRV-Tools and SPIRV-Headers submodules (#4253) 2022-02-14 09:58:43 -05:00
Jeff Noyle 7f7278b4e2
PIX: avoid crash on enumerated types without int base type (#4254)
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.
2022-02-13 19:24:23 -08:00
Jeff Noyle d66bdf94c2
PIX: Shader debugging instrumentation for HS+DS (#4251)
* CP

* PIX: Debug instrumentation for HS/DS

* Tests

Co-authored-by: Jeff Noyle <jeffno@ntdev.microsoft.com>
2022-02-11 17:00:21 -08:00
Chris B cb5bb213d8
Refactor HLSLVersion to enum (#4238)
* 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
2022-02-10 20:41:55 -06:00
Xiang Li 4452103355
Change getPassName return type to StringRef. (#4247) 2022-02-10 14:14:43 -08:00
Adam Yang 8348ff8d9e
Taught DxilEraseDeadRegion to handle more general loops. (#4246) 2022-02-09 18:13:27 -08:00
Tex Riddell 56e05cd55e
Fix bug with HLSL case-insensitive attribute parsing (#4014)
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).
2022-02-09 17:19:36 -08:00
Tex Riddell 87945629df
Fix ReplaceMemcpy IR corruption on constant user replacement. (#4245)
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.
2022-02-09 12:01:13 -08:00
Grace Jennings 979cc4a276
Support -setprivate, -setrootsignature, and -Qstrip_priv to compile API (#4230)
* 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
2022-02-08 13:36:55 -08:00
Tex Riddell 0c49f28ebd
Allow unaligned private data size, by keeping it at end of container. (#4239)
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.
2022-02-08 12:14:41 -08:00
Tex Riddell 9d03a00fd7
Fix DxilProgramSignature size alignment. (#4237)
- 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.
2022-02-07 15:41:54 -08:00
Chris B c95c076f52
Pass compiler options to preprocessor (#4234)
* 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
2022-02-07 16:08:01 -06:00
David Peixotto 5dc2ef659e
Fix non-deterministic output when overriding semantic defines (#4235) 2022-02-05 20:17:43 -08:00
Tex Riddell 48ab04dba3
Globally disable NRVO for HLSL; Merge resprops for resource return (#4232)
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>
2022-02-04 15:41:47 -08:00
Xiang Li 662a62a8de
Change type of Sentinel to PHINode since it will be PHINode. (#4228) 2022-02-03 13:35:18 -08:00
Natalie Chouinard e4cf4867f7
[dxil2spv] Add CompilerInstance object (#4229)
Use CompilerInstance for managing diagnostics.
2022-02-03 15:59:10 -05:00
Jeff Noyle 86fc60a7fb
PIX: return more info from shader-access-tracking (#4224)
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.
2022-02-02 13:22:05 -08:00
Jaebaek Seo 13a9c7de74
[spirv] add predefined macro '__spirv' (#4225) 2022-02-02 10:47:48 -05:00