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

686 Коммитов

Автор SHA1 Сообщение Дата
Adam Yang c0676c7ca1
Handling dbg.value pointer case in O1. (#4375) 2022-04-05 12:07:07 -07:00
Natalie Chouinard 68dd2877d7
[SPIR-V] Allow Vulkan 1.1 with SPIR-V 1.4 as a target environment (#4364)
Since we check for the "SPIR-V 1.4 (under Vulkan 1.1 semantics)"
minimum target environment for ray tracing extension use, this change
allows it to be now configured as a target-env via command line options.
Some out of date documentation target environments is also updated,
and improvements are made to version checking to use enums rather
than string comparisons.

Fixes #4313
2022-03-31 16:11:00 -04:00
Jaebaek Seo ad4ebb7d51
[spirv] support signature packing (#4361)
Currently, DXC assigns new locations for each stage variable. When there
are lots of stage variables, the number of locations we use can exceed the
maximum location limit. This commit uses `Component` decoration to pack
signature and reduce the number of locations DXC uses.
2022-03-31 15:38:33 -04:00
Grace Jennings b420332e68
Added a DXC_OUT_REMARKS output kind for display include process (#4336)
* Added a DXC_OUT_REMARKS kind that prints to stdout in dxc.
Moving -Vi and -H displayed include process from warnings to DXC_OUT_REMARKS.

* Adding a Compiler Test to check DXC_OUT_REMARKS output text
2022-03-23 13:28:16 -07:00
Jeff Noyle 90152bd9a7
Pix hull shader debug (#4342)
A couple of minor changes to support PIX shader debugging for hull shaders generated by the 11on12 mapping layer for DXBC originals.

Co-authored-by: Jeff Noyle <jeffno@ntdev.microsoft.com>
2022-03-23 08:51:48 -07:00
Greg Roth 14bc8dab53
Implement Integer Sampling (#4329)
Add support for integer sampling as part of advanced texture ops in
Shader Model 6.7. This includes adding static border colors and allowing
integer resource types to be used by all Sample* operations through
Sema, Dxil generation, and validation when 6.7 is available.

Adds root signature compilation and filecheck testing.
2022-03-15 19:05:00 -07:00
Chris B fb873d0a14
Clean up debug preprocessor macros (#4305)
* Clean up debug preprocessor macros

This change removes the `DBG` macro value in favor of `NDEBUG`, and
also converts many uses of `_DEBUG` with `NDEBUG`.

_DEBUG is set by MSVC when debug information generation is enabled.
NDEBUG is set by CMake debug configurations and by LLVM on all
configurations when `LLVM_ENABLE_ASSERTIONS` is set.

Aligning with LLVM's NDEBUG usage allows a consistent pattern
throughout the codebase.

* Address PR feedback
2022-03-02 14:55:24 -06: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
Adam Yang 2ec23bcaea
Delete dbg.declare in scopes where the alloca is unused (#4272) 2022-02-17 16:59:44 -08:00
Xiang Li e98f8cbc8b
Support resource array in UpdateStructTypeForLegacyLayout on lib profile. (#4266) 2022-02-16 10:33:47 -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 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
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
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
Xiang Li 392d5b5f3f
Merge resource props for global resource. (#4211)
* Merge resource props for global resource.
2022-01-31 17:23:06 -08:00
Adam Yang dc5eac8d0d
Remove redundant dbg.value instructions (#4182) 2022-01-24 20:22:55 -08:00
Jaebaek Seo 29874c9247
[spirv] support vk::ext_execution_mode_id(..) (#4190)
As a part of HLSL version of GL_EXT_spirv_intrinsics, this commit adds
`vk::ext_execution_mode_id(..)` intrinsic function. In addition, it allows users
to enable capabilites and extensions via `vk::ext_execution_mode[_id](..)`
using `[[vk::ext_capability(..)]]` and `[[vk::ext_extension(..)]]`.

Related to #3919
2022-01-21 14:08:45 -05:00
Greg Roth 437ae1e5b6
Re-enable a swath of DXIL tests for *nix builds (#3888)
These were disabled at a point that the DXC CI didn't reject builds for
failing on Linux, now that they do, we can enable these tests sure in
the knowledge that any changes to them that break on Linux will be
detected and fixed quickly

Fixed *nix error code return. The previous caused an infinite loop of retries.
This definition more accurately identifies the error that has occurred as not
benefiting from repeated attempts

Skip tests and filechecker elements that entirely depend on reflection or
linker interfaces that aren't implemented on *nix yet.

Correct capitalization in a few places to satisfy a case-sensitive filesystem

Detect directories from test include handler. *nix virtual filesystem will try to
load the file using the include handler when performing stat() on a directory.
The test include handler is pretty basic and would provide the next file, leaving
it without a file to offer when the real include came along.
By detecting a name that looks like a dir and returning failure, it
correctly indicates that the file isn't found by the handler and saves
the virtual file for when its needed.

Don't mark non-debug builds as such. The DEBUG define determines which
tests get run. Some of which depend on consistencies that can only be relied
upon in debug builds. So DEBUG is disabled for all non-debug builds.

Correct free of new() memory. Incidental regex allocations were changed for
HLSL to use the global new() operator, but were still freed using the standard
free(), but replacing the default free() with regex_free() allows the default new()
operator to be paired with the default delete() operator

Correct misnamed test flag. The *nix flag was mistakenly called InputFile instead
of InputPath. By renaming it, the ManualFile test can target a specific HLSL file.

Fix misused ArrayRef in legacy GV replacement. The replacement of the GV with
the legacy form used in libraries collected the arguments into an arrayref without
an array to ref, which caused garbage in release builds. Also moved to using end
vars for loops where the elements can get deleted during the loop.

Fix *nix conversion to utf8. When an unknown codepage is found, it tries to convert
to utf16, but that isn't' actually helpful for *nix for a shader codepage derived from
the BOM, which is correctly identified as utf32
2022-01-20 13:53:47 -08:00
Adam Yang 13553274a8
Added debug option to print-after specific passes (#4196) 2022-01-20 00:53:46 -08:00
Jaebaek Seo 833aee5446
[spirv] use OpDemoteToHelperInvocation for discard in vk1.3 (#4162)
In Vulkan1.3/SPIR-V1.6, we default OpDemoteToHelperInvocation
instruction for the discard statement. Unlike previous Vulkan versions,
we do not need to enable SPV_EXT_demote_to_helper_invocation extension.

This commit enables `-fspv-target-env=vulkan1.3` flag, but supporting
Vulkan1.3/SPIR-V1.6 is still WIP.
2022-01-05 09:59:01 -05:00
Jaebaek Seo ff270c74b8
Enable printing dependencies of compilation target (#4017)
This commit adds `-M, -MF, -MD` options to print dependencies of
compilation target.

For example, when a HLSL file X includes Y, Z, W files,

$ ./bin/dxc -M -T ps_6_0 -E main X

will print:
X
Y
Z
W

The first line i.e., X is the name of the main compilation target.
Following lines are dependencies for X.

`-MF<file_path>` and `-MD` are the same as the ones supported by Clang.
See https://clang.llvm.org/docs/ClangCommandLineReference.html#dependency-file-generation
2021-12-21 13:42:30 -05:00
Grace Jennings 44b1f00caa
Extend encoding option to specify source encoding (#4109)
Extended current encoding option to also set a default encoding for source files. Includes support for UTF-8 and UTF-16 encoded sources with and without BOMs. The default encoding will be used for the main source file when there is no BOM and the DxcBuffer encoding is not specified. The default encoding will be used for included source files with no BOM.
2021-12-06 11:40:23 -08:00
Joshua Batista d424d2012c
Made nologo option hidden (#4127) 2021-12-06 11:31:41 -08:00
Adam Yang 2f5dec316b
All source files in PDBs interpreted as UTF8 (#4111) 2021-12-02 12:43:48 -08:00
Preston Hamlin 4b4b52ac0c
Fix TextureGatherCmp operand typo (#4075) 2021-11-18 13:12:54 -08:00
JiaoluAMD 552b11b43d
[SPIRV] Add support vk::ext_execution_mode (#4086)
Add support
* vk::ext_execution_mode
* [[vk::ext_storage_class(uint storage_class)]]

This is part of PRs for the
https://github.com/microsoft/DirectXShaderCompiler/issues/3919
2021-11-18 10:21:41 -05:00
Yuriy O'Donnell f836555907
[spirv] Add Vk::RawBufferLoad intrinsic (#4069)
* Only support raw buffer (i.e. HLSL ByteAddressBuffer) style loads of single uint-s
* Always use 4 byte alignment for loads (same as HLSL ByteAddressBuffer)
* Add PhysicalStorageBufferAddresses capability and KHR_physical_storage_buffer extension when needed
* Promote memory addressing model to PhysicalStorageBuffer64 when needed
* Add custom alignment support to SpirvLoad
* Add createUnaryOp() overload that takes SpirvType
* Add getPhysicalStorageBufferType()
* Add documentation and a test case for the new intrinsic
2021-11-17 15:41:54 -05:00
Xiang Li 7c04a557dd
Support phi on dynamic resource. (#4052)
* Support phi on dynamic resource.
2021-11-05 12:43:54 -07:00
Chris B 6ee2b1c9c6
Add back HlslIntrinsicOp.h (#4062)
This header is also packaged up as part of the interface for handling
DXIL, so it needs to live in-tree.
2021-11-04 19:44:55 -05:00
Chris B 39d6e7fc55
Require Windows 7 Everywhere (#4057)
Some of the LLVM APIs were expecting Windows XP support, while other
places in the code were going with whatever your SDK configured.
This should get things consistent and avoid mismatches in the Windows
headers.
2021-11-03 10:58:04 -05:00
Chris B 6cf0a6f7df
Automate generating of intrinsic code (#4001)
* Automate generating of intrinsic code

This change removes generated code for HLSL and DXIL intrinsics and
sets up the build system so that it will generate the code and
automatically regenerate it on changes to any of the generation scripts
or input files.

* Covering the last few generated files

* Move namespace priting into hctgen

I somehow missed that the open namespace was in manual code and the
close was in the generated code...

* Fix pix passes generator

* Work around missing autocrlf on Windows checkout

*shakes fist* AppVeyor...

* Actually pass through --force-lf
2021-11-02 13:43:47 -05:00
Adam Yang ce6d208234
Added -binding-table-define (#4044) 2021-11-01 18:46:13 -07:00
Greg Fischer 4652250d54
Add Shader.DebugInfo.100 support for DebugSourceContinued (#4030) 2021-10-27 12:28:01 -04:00
Greg Fischer 5f35caa480
[spirv] Add support for NonSemantic.Shader.DebugInfo.100 generation (#4006)
This commit generally only adds those instructions that intersect with
OpenCL.DebugInfo.100, although it does also add generation of
new DebugFunctionDefinition to tie DebugFunction to function.

Co-authored-by: baldurk <baldurk@baldurk.org>
2021-10-19 14:40:59 -04:00
Xiang Li e39defba07
Add rewrite pass to create global cb. (#4000)
* Add rewrite pass to create global cb.
2021-10-15 14:41:25 -07:00
Adam Yang 029634871a
-Zs now appears next to Zi in the help text (#3996) 2021-10-11 16:45:17 -07:00
Adam Yang 6a3ae13ff4
Od fixes sep2021 (#3990) 2021-10-05 03:28:21 -07:00
Jeff Noyle d23ede6fc5
PIX: Changes to run PIX passes on libraries. Also add raygen shader debugging prolog (#3985)
These changes are a result of prototype work in PIX to support shader debugging for DXR,, which was an exercise to figure out how to support libraries in general in PIX. These changes are the result. It's all about iterating over all the library functions, rather than "the" entry point function.
In addition, to have something concrete to submit to a driver, there's the addition of codegen for the shader debugging "prolog", which chooses at runtime whether or not to emit instrumentation data for a given shader invocation based on its (in this case) thread id. This last is not yet ready for production in PIX, in that it is necessary but not sufficient to enable DXR shader debugging.
2021-10-04 15:37:50 -07:00
Greg Roth c26f369b5c
Enable -HV 2021 (#3982)
Enables the associated feature flags when 2021 is selected. Also adds a
feature flag for bitfields.

Add to all feature tests a variant that uses -HV 2021

Made some small changes to a template test that relied on vector
operands with binary logical operators
2021-09-29 19:00:44 -07:00
Chris B 8a1e9700e2
[NFC] Add additional helper methods for DXT::ResourceKind (#3975)
* Added `IsAnyTextureArray`, `IsAnyTextureCube`, and `IsArrayKind`
helper
methods.
* Added test case for all non-trival `Is...(ResouceKind)` methods
2021-09-29 15:17:47 -05:00
Greg Roth f008085313
Merge pull request #3968 from microsoft/merge-hlsl2021-master
Merge hlsl2021 master
2021-09-23 10:51:09 -06:00
Tex Riddell 538c203a5b
Fix bugs in signature reflection, add signatures to dumper and tests (#3961)
- Fix Barycentric system value translation
- Increment Register for array elements
- Add signature dumping to D3DReflectionDumper, plus other minor fixes
- Dump PatchConstantParameters when mesh shader
2021-09-21 14:13:00 -07:00
Greg Roth 693103f39d Merge remote-tracking branch 'origin/master' into hlsl-2021 2021-09-17 14:39:31 -07:00
Jaebaek Seo 555f813c4f
[spirv] add -fspv-reduce-load-size option (#3931)
Since loading a big object takes the memory pressure, reduction of the
load size can have some performance benefit. In particular, it is
useful for mobile GPUs. `-fspv-reduce-load-size` removes
OpLoad/OpCompositeExtract of struct/array types by running spirv-opt
--reduce-load-size pass.

Fixes #3889
2021-09-07 23:32:16 -04:00
Xiang Li 5ae4b02c38
Fix issue when updateCounter for dynamic resource, also remove createHandleForLib on handle type when not a library. (#3935) 2021-09-07 10:24:42 -07:00
Adam Yang 2bc41323ff
Added binding table file to specify resource binding (#3843) 2021-08-26 11:56:36 -07:00
Jaebaek Seo 7793f5d3c1
Initial support of operator overloading (#3859) 2021-08-26 12:26:12 -04:00