Merge remote-tracking branch 'ms/dxil-v1.0' into integration
This commit is contained in:
Коммит
c18ed9133e
21
LICENSE-MIT
21
LICENSE-MIT
|
@ -1,21 +0,0 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2016 Microsoft
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
|
@ -87,9 +87,9 @@ You can find documentation for this project in the `docs` directory. These conta
|
|||
|
||||
## License
|
||||
|
||||
DirectX Shader Compiler is distributed under the terms of the MIT license.
|
||||
DirectX Shader Compiler is distributed under the terms of the University of Illinois Open Source License.
|
||||
|
||||
See LICENSE-MIT and COPYRIGHT for details.
|
||||
See LICENSE.txt and ThirdPartyNotices.txt for details.
|
||||
|
||||
## Code of Conduct
|
||||
|
||||
|
|
|
@ -1,13 +1,3 @@
|
|||
DirectX Shader Compiler is copyright 2016, Microsoft Corporation.
|
||||
|
||||
Licensed under the MIT license (see LICENSE-MIT). All files in the project
|
||||
carrying such notice may not be copied, modified, or distributed except
|
||||
according to those terms.
|
||||
|
||||
DirectX Shader Compiler includes packages written by third parties. The
|
||||
following third party packages are included, and carry their own copyright
|
||||
notices and license terms:
|
||||
|
||||
* LLVM
|
||||
|
||||
==============================================================================
|
|
@ -242,18 +242,19 @@ tree. The standard header looks like this:
|
|||
.. code-block:: c++
|
||||
|
||||
//===-- llvm/Instruction.h - Instruction class definition -------*- C++ -*-===//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// Instruction.h //
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved. //
|
||||
// Licensed under the MIT license. See COPYRIGHT in the project root for //
|
||||
// full license information. //
|
||||
// //
|
||||
// \file //
|
||||
// This file contains the declaration of the Instruction class, which is the //
|
||||
// base class for all of the VM instructions. //
|
||||
// //
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
///
|
||||
/// \file
|
||||
/// This file contains the declaration of the Instruction class, which is the
|
||||
/// base class for all of the VM instructions.
|
||||
///
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
A few things to note about this particular format: The "``-*- C++ -*-``" string
|
||||
on the first line is there to tell Emacs that the source file is a C++ file, not
|
||||
|
|
|
@ -2176,6 +2176,7 @@ INSTR.SAMPLERMODEFORSAMPLE sample/_l/_d/_cl_s/gather instruction requ
|
|||
INSTR.SAMPLERMODEFORSAMPLEC sample_c_*/gather_c instructions require sampler declared in comparison mode
|
||||
INSTR.STRUCTBITCAST Bitcast on struct types is not allowed
|
||||
INSTR.TEXTUREOFFSET offset texture instructions must take offset which can resolve to integer literal in the range -8 to 7
|
||||
INSTR.TGSMRACECOND Race condition writing to shared memory detected, consider making this write conditional
|
||||
INSTR.UNDEFRESULTFORGETDIMENSION GetDimensions used undef dimension %0 on %1
|
||||
INSTR.WRITEMASKFORTYPEDUAVSTORE store on typed uav must write to all four components of the UAV
|
||||
INSTR.WRITEMASKMATCHVALUEFORUAVSTORE uav store write mask must match store value mask, write mask is %0 and store value mask is %1
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// //
|
||||
// DXIL.h //
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved. //
|
||||
// Licensed under the MIT license. See COPYRIGHT in the project root for //
|
||||
// full license information. //
|
||||
// This file is distributed under the University of Illinois Open Source //
|
||||
// License. See LICENSE.TXT for details. //
|
||||
// //
|
||||
// Main public header for DXIL. //
|
||||
// //
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// //
|
||||
// DxilCBuffer.h //
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved. //
|
||||
// Licensed under the MIT license. See COPYRIGHT in the project root for //
|
||||
// full license information. //
|
||||
// This file is distributed under the University of Illinois Open Source //
|
||||
// License. See LICENSE.TXT for details. //
|
||||
// //
|
||||
// Representation of HLSL constant buffer (cbuffer). //
|
||||
// //
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// //
|
||||
// DxilCompType.h //
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved. //
|
||||
// Licensed under the MIT license. See COPYRIGHT in the project root for //
|
||||
// full license information. //
|
||||
// This file is distributed under the University of Illinois Open Source //
|
||||
// License. See LICENSE.TXT for details. //
|
||||
// //
|
||||
// Represenation of HLSL component type. //
|
||||
// //
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// //
|
||||
// DxilConstants.h //
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved. //
|
||||
// Licensed under the MIT license. See COPYRIGHT in the project root for //
|
||||
// full license information. //
|
||||
// This file is distributed under the University of Illinois Open Source //
|
||||
// License. See LICENSE.TXT for details. //
|
||||
// //
|
||||
// Essential DXIL constants. //
|
||||
// //
|
||||
|
@ -624,6 +624,11 @@ namespace DXIL {
|
|||
// DomainLocation.
|
||||
const unsigned kDomainLocationColOpIdx = 1;
|
||||
|
||||
// BufferLoad.
|
||||
const unsigned kBufferLoadHandleOpIdx = 1;
|
||||
const unsigned kBufferLoadCoord0OpIdx = 2;
|
||||
const unsigned kBufferLoadCoord1OpIdx = 3;
|
||||
|
||||
// BufferStore.
|
||||
const unsigned kBufferStoreHandleOpIdx = 1;
|
||||
const unsigned kBufferStoreCoord0OpIdx = 2;
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// //
|
||||
// DxilContainer.h //
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved. //
|
||||
// Licensed under the MIT license. See COPYRIGHT in the project root for //
|
||||
// full license information. //
|
||||
// This file is distributed under the University of Illinois Open Source //
|
||||
// License. See LICENSE.TXT for details. //
|
||||
// //
|
||||
// Provides declarations for the DXIL container format. //
|
||||
// //
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// //
|
||||
// DxilGenerationPass.h //
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved. //
|
||||
// Licensed under the MIT license. See COPYRIGHT in the project root for //
|
||||
// full license information. //
|
||||
// This file is distributed under the University of Illinois Open Source //
|
||||
// License. See LICENSE.TXT for details. //
|
||||
// //
|
||||
// This file provides a DXIL Generation pass. //
|
||||
// //
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// //
|
||||
// DxilInstructions.h //
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved. //
|
||||
// Licensed under the MIT license. See COPYRIGHT in the project root for //
|
||||
// full license information. //
|
||||
// This file is distributed under the University of Illinois Open Source //
|
||||
// License. See LICENSE.TXT for details. //
|
||||
// //
|
||||
// This file provides a library of instruction helper classes. //
|
||||
// MUCH WORK YET TO BE DONE - EXPECT THIS WILL CHANGE - GENERATED FILE //
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// //
|
||||
// DxilInterpolationMode.h //
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved. //
|
||||
// Licensed under the MIT license. See COPYRIGHT in the project root for //
|
||||
// full license information. //
|
||||
// This file is distributed under the University of Illinois Open Source //
|
||||
// License. See LICENSE.TXT for details. //
|
||||
// //
|
||||
// Representation of HLSL interpolation mode. //
|
||||
// //
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// //
|
||||
// DxilMetadataHelper.h //
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved. //
|
||||
// Licensed under the MIT license. See COPYRIGHT in the project root for //
|
||||
// full license information. //
|
||||
// This file is distributed under the University of Illinois Open Source //
|
||||
// License. See LICENSE.TXT for details. //
|
||||
// //
|
||||
// Helper to serialize/desialize metadata for DxilModule. //
|
||||
// //
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// //
|
||||
// DxilModule.h //
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved. //
|
||||
// Licensed under the MIT license. See COPYRIGHT in the project root for //
|
||||
// full license information. //
|
||||
// This file is distributed under the University of Illinois Open Source //
|
||||
// License. See LICENSE.TXT for details. //
|
||||
// //
|
||||
// The main class to work with DXIL, similar to LLVM module. //
|
||||
// //
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// //
|
||||
// DxilOperations.h //
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved. //
|
||||
// Licensed under the MIT license. See COPYRIGHT in the project root for //
|
||||
// full license information. //
|
||||
// This file is distributed under the University of Illinois Open Source //
|
||||
// License. See LICENSE.TXT for details. //
|
||||
// //
|
||||
// Implementation of DXIL operation tables. //
|
||||
// //
|
||||
|
@ -37,6 +37,7 @@ public:
|
|||
OP(llvm::LLVMContext &Ctx, llvm::Module *pModule);
|
||||
|
||||
llvm::Function *GetOpFunc(OpCode OpCode, llvm::Type *pOverloadType);
|
||||
llvm::Type *GetOverloadType(OpCode OpCode, llvm::Function *F);
|
||||
llvm::LLVMContext &GetCtx() { return m_Ctx; }
|
||||
llvm::Type *GetHandleType() const;
|
||||
llvm::Type *GetDimensionsType() const;
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// //
|
||||
// DxilPipelineStateValidation.h //
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved. //
|
||||
// Licensed under the MIT license. See COPYRIGHT in the project root for //
|
||||
// full license information. //
|
||||
// This file is distributed under the University of Illinois Open Source //
|
||||
// License. See LICENSE.TXT for details. //
|
||||
// //
|
||||
// Defines data used by the D3D runtime for PSO validation. //
|
||||
// //
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// //
|
||||
// DxilResource.h //
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved. //
|
||||
// Licensed under the MIT license. See COPYRIGHT in the project root for //
|
||||
// full license information. //
|
||||
// This file is distributed under the University of Illinois Open Source //
|
||||
// License. See LICENSE.TXT for details. //
|
||||
// //
|
||||
// Representation of HLSL SRVs and UAVs. //
|
||||
// //
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// //
|
||||
// DxilResourceBase.h //
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved. //
|
||||
// Licensed under the MIT license. See COPYRIGHT in the project root for //
|
||||
// full license information. //
|
||||
// This file is distributed under the University of Illinois Open Source //
|
||||
// License. See LICENSE.TXT for details. //
|
||||
// //
|
||||
// Base class to represent DXIL SRVs, UAVs, CBuffers, and Samplers. //
|
||||
// //
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// //
|
||||
// DxilRootSignature.h //
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved. //
|
||||
// Licensed under the MIT license. See COPYRIGHT in the project root for //
|
||||
// full license information. //
|
||||
// This file is distributed under the University of Illinois Open Source //
|
||||
// License. See LICENSE.TXT for details. //
|
||||
// //
|
||||
// HLSL root signature parsing. //
|
||||
// //
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// //
|
||||
// DxilSampler.h //
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved. //
|
||||
// Licensed under the MIT license. See COPYRIGHT in the project root for //
|
||||
// full license information. //
|
||||
// This file is distributed under the University of Illinois Open Source //
|
||||
// License. See LICENSE.TXT for details. //
|
||||
// //
|
||||
// Representation of HLSL sampler state. //
|
||||
// //
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// //
|
||||
// DxilSemantic.h //
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved. //
|
||||
// Licensed under the MIT license. See COPYRIGHT in the project root for //
|
||||
// full license information. //
|
||||
// This file is distributed under the University of Illinois Open Source //
|
||||
// License. See LICENSE.TXT for details. //
|
||||
// //
|
||||
// Representation of HLSL parameter semantics. //
|
||||
// //
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// //
|
||||
// DxilShaderModel.h //
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved. //
|
||||
// Licensed under the MIT license. See COPYRIGHT in the project root for //
|
||||
// full license information. //
|
||||
// This file is distributed under the University of Illinois Open Source //
|
||||
// License. See LICENSE.TXT for details. //
|
||||
// //
|
||||
// Representation of HLSL shader models. //
|
||||
// //
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// //
|
||||
// DxilSigPoint.h //
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved. //
|
||||
// Licensed under the MIT license. See COPYRIGHT in the project root for //
|
||||
// full license information. //
|
||||
// This file is distributed under the University of Illinois Open Source //
|
||||
// License. See LICENSE.TXT for details. //
|
||||
// //
|
||||
// Representation of HLSL signature points. //
|
||||
// //
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// //
|
||||
// DxilSignature.h //
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved. //
|
||||
// Licensed under the MIT license. See COPYRIGHT in the project root for //
|
||||
// full license information. //
|
||||
// This file is distributed under the University of Illinois Open Source //
|
||||
// License. See LICENSE.TXT for details. //
|
||||
// //
|
||||
// Representation of HLSL shader signature. //
|
||||
// //
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// //
|
||||
// DxilSignatureAllocation.h //
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved. //
|
||||
// Licensed under the MIT license. See COPYRIGHT in the project root for //
|
||||
// full license information. //
|
||||
// This file is distributed under the University of Illinois Open Source //
|
||||
// License. See LICENSE.TXT for details. //
|
||||
// //
|
||||
// Classes used for allocating signature elements. //
|
||||
// //
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// //
|
||||
// DxilSignatureElement.h //
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved. //
|
||||
// Licensed under the MIT license. See COPYRIGHT in the project root for //
|
||||
// full license information. //
|
||||
// This file is distributed under the University of Illinois Open Source //
|
||||
// License. See LICENSE.TXT for details. //
|
||||
// //
|
||||
// Representation of HLSL signature element. //
|
||||
// //
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// //
|
||||
// DxilSpanAllocator.h //
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved. //
|
||||
// Licensed under the MIT license. See COPYRIGHT in the project root for //
|
||||
// full license information. //
|
||||
// This file is distributed under the University of Illinois Open Source //
|
||||
// License. See LICENSE.TXT for details. //
|
||||
// //
|
||||
// Allocator for resources or other things that span a range of space //
|
||||
// //
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// //
|
||||
// DxilTypeSystem.h //
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved. //
|
||||
// Licensed under the MIT license. See COPYRIGHT in the project root for //
|
||||
// full license information. //
|
||||
// This file is distributed under the University of Illinois Open Source //
|
||||
// License. See LICENSE.TXT for details. //
|
||||
// //
|
||||
// DXIL extension to LLVM type system. //
|
||||
// //
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// //
|
||||
// DxilValidation.h //
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved. //
|
||||
// Licensed under the MIT license. See COPYRIGHT in the project root for //
|
||||
// full license information. //
|
||||
// This file is distributed under the University of Illinois Open Source //
|
||||
// License. See LICENSE.TXT for details. //
|
||||
// //
|
||||
// This file provides support for validating DXIL shaders. //
|
||||
// //
|
||||
|
@ -96,6 +96,7 @@ enum class ValidationRule : unsigned {
|
|||
InstrSamplerModeForSample, // sample/_l/_d/_cl_s/gather instruction requires sampler declared in default mode
|
||||
InstrSamplerModeForSampleC, // sample_c_*/gather_c instructions require sampler declared in comparison mode
|
||||
InstrStructBitCast, // Bitcast on struct types is not allowed
|
||||
InstrTGSMRaceCond, // Race condition writing to shared memory detected, consider making this write conditional
|
||||
InstrTextureOffset, // offset texture instructions must take offset which can resolve to integer literal in the range -8 to 7
|
||||
InstrUndefResultForGetDimension, // GetDimensions used undef dimension %0 on %1
|
||||
InstrWriteMaskForTypedUAVStore, // store on typed uav must write to all four components of the UAV
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// //
|
||||
// HLMatrixLowerHelper.h //
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved. //
|
||||
// Licensed under the MIT license. See COPYRIGHT in the project root for //
|
||||
// full license information. //
|
||||
// This file is distributed under the University of Illinois Open Source //
|
||||
// License. See LICENSE.TXT for details. //
|
||||
// //
|
||||
// This file provides helper functions to lower high level matrix. //
|
||||
// //
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// //
|
||||
// HLMatrixLowerPass.h //
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved. //
|
||||
// Licensed under the MIT license. See COPYRIGHT in the project root for //
|
||||
// full license information. //
|
||||
// This file is distributed under the University of Illinois Open Source //
|
||||
// License. See LICENSE.TXT for details. //
|
||||
// //
|
||||
// This file provides a high level matrix lower pass. //
|
||||
// //
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// //
|
||||
// HLModule.h //
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved. //
|
||||
// Licensed under the MIT license. See COPYRIGHT in the project root for //
|
||||
// full license information. //
|
||||
// This file is distributed under the University of Illinois Open Source //
|
||||
// License. See LICENSE.TXT for details. //
|
||||
// //
|
||||
// HighLevel DX IR module. //
|
||||
// //
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// //
|
||||
// HLOperationLower.h //
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved. //
|
||||
// Licensed under the MIT license. See COPYRIGHT in the project root for //
|
||||
// full license information. //
|
||||
// This file is distributed under the University of Illinois Open Source //
|
||||
// License. See LICENSE.TXT for details. //
|
||||
// //
|
||||
// Lower functions to lower HL operations to DXIL operations. //
|
||||
// //
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// //
|
||||
// HLOperationLowerExtension.h //
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved. //
|
||||
// Licensed under the MIT license. See COPYRIGHT in the project root for //
|
||||
// full license information. //
|
||||
// This file is distributed under the University of Illinois Open Source //
|
||||
// License. See LICENSE.TXT for details. //
|
||||
// //
|
||||
// Functions to lower HL operations coming from HLSL extensions to DXIL //
|
||||
// operations. //
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// //
|
||||
// HLOperations.h //
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved. //
|
||||
// Licensed under the MIT license. See COPYRIGHT in the project root for //
|
||||
// full license information. //
|
||||
// This file is distributed under the University of Illinois Open Source //
|
||||
// License. See LICENSE.TXT for details. //
|
||||
// //
|
||||
// Implentation of High Level DXIL operations. //
|
||||
// //
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// //
|
||||
// HLResource.h //
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved. //
|
||||
// Licensed under the MIT license. See COPYRIGHT in the project root for //
|
||||
// full license information. //
|
||||
// This file is distributed under the University of Illinois Open Source //
|
||||
// License. See LICENSE.TXT for details. //
|
||||
// //
|
||||
// Representation of HLSL SRVs and UAVs in high-level DX IR. //
|
||||
// //
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// //
|
||||
// HLSLExtensionsCodegenHelper.h //
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved. //
|
||||
// Licensed under the MIT license. See COPYRIGHT in the project root for //
|
||||
// full license information. //
|
||||
// This file is distributed under the University of Illinois Open Source //
|
||||
// License. See LICENSE.TXT for details. //
|
||||
// //
|
||||
// Codegen support for hlsl extensions. //
|
||||
// //
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// //
|
||||
// ReducibilityAnalysis.h //
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved. //
|
||||
// Licensed under the MIT license. See COPYRIGHT in the project root for //
|
||||
// full license information. //
|
||||
// This file is distributed under the University of Illinois Open Source //
|
||||
// License. See LICENSE.TXT for details. //
|
||||
// //
|
||||
// Implements reducibility analysis pass. //
|
||||
// //
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// //
|
||||
// HlslIntrinsicOp.h //
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved. //
|
||||
// Licensed under the MIT license. See COPYRIGHT in the project root for //
|
||||
// full license information. //
|
||||
// This file is distributed under the University of Illinois Open Source //
|
||||
// License. See LICENSE.TXT for details. //
|
||||
// //
|
||||
// Enumeration for HLSL intrinsics operations. //
|
||||
// //
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Copyright (C) Microsoft Corporation. All rights reserved.
|
||||
# Licensed under the MIT license. See COPYRIGHT in the project root for full license information.
|
||||
# This file is distributed under the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
# TableGen HLSL options.
|
||||
set(LLVM_TARGET_DEFINITIONS HLSLOptions.td)
|
||||
tablegen(LLVM HLSLOptions.inc -gen-opt-parser-defs)
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// //
|
||||
// DxcLangExtensionsHelper.h //
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved. //
|
||||
// Licensed under the MIT license. See COPYRIGHT in the project root for //
|
||||
// full license information. //
|
||||
// This file is distributed under the University of Illinois Open Source //
|
||||
// License. See LICENSE.TXT for details. //
|
||||
// //
|
||||
// Provides a helper class to implement language extensions to HLSL. //
|
||||
// //
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// //
|
||||
// ErrorCodes.h //
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved. //
|
||||
// Licensed under the MIT license. See COPYRIGHT in the project root for //
|
||||
// full license information. //
|
||||
// This file is distributed under the University of Illinois Open Source //
|
||||
// License. See LICENSE.TXT for details. //
|
||||
// //
|
||||
// Provides error code values for the DirectX compiler and tools. //
|
||||
// //
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// //
|
||||
// FileIOHelper.h //
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved. //
|
||||
// Licensed under the MIT license. See COPYRIGHT in the project root for //
|
||||
// full license information. //
|
||||
// This file is distributed under the University of Illinois Open Source //
|
||||
// License. See LICENSE.TXT for details. //
|
||||
// //
|
||||
// Provides utitlity functions to work with files. //
|
||||
// //
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// //
|
||||
// Global.h //
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved. //
|
||||
// Licensed under the MIT license. See COPYRIGHT in the project root for //
|
||||
// full license information. //
|
||||
// This file is distributed under the University of Illinois Open Source //
|
||||
// License. See LICENSE.TXT for details. //
|
||||
// //
|
||||
// Provides important declarations global to all DX Compiler code. //
|
||||
// //
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// //
|
||||
// HLSLOptions.h //
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved. //
|
||||
// Licensed under the MIT license. See COPYRIGHT in the project root for //
|
||||
// full license information. //
|
||||
// This file is distributed under the University of Illinois Open Source //
|
||||
// License. See LICENSE.TXT for details. //
|
||||
// //
|
||||
// Support for command-line-style option parsing. //
|
||||
// //
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
// //
|
||||
// HLSLOptions.td //
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved. //
|
||||
// Licensed under the MIT license. See COPYRIGHT in the project root for //
|
||||
// full license information. //
|
||||
// This file is distributed under the University of Illinois Open Source //
|
||||
// License. See LICENSE.TXT for details. //
|
||||
// //
|
||||
// This file defines the options accepted by HLSL. //
|
||||
// //
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// //
|
||||
// Unicode.h //
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved. //
|
||||
// Licensed under the MIT license. See COPYRIGHT in the project root for //
|
||||
// full license information. //
|
||||
// This file is distributed under the University of Illinois Open Source //
|
||||
// License. See LICENSE.TXT for details. //
|
||||
// //
|
||||
// Provides utitlity functions to work with Unicode and other encodings. //
|
||||
// //
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
// //
|
||||
// WinIncludes.h //
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved. //
|
||||
// Licensed under the MIT license. See COPYRIGHT in the project root for //
|
||||
// full license information. //
|
||||
// This file is distributed under the University of Illinois Open Source //
|
||||
// License. See LICENSE.TXT for details. //
|
||||
// //
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// //
|
||||
// dxcapi.impl.h //
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved. //
|
||||
// Licensed under the MIT license. See COPYRIGHT in the project root for //
|
||||
// full license information. //
|
||||
// This file is distributed under the University of Illinois Open Source //
|
||||
// License. See LICENSE.TXT for details. //
|
||||
// //
|
||||
// Provides support for DXC API implementations. //
|
||||
// //
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// //
|
||||
// dxcapi.use.h //
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved. //
|
||||
// Licensed under the MIT license. See COPYRIGHT in the project root for //
|
||||
// full license information. //
|
||||
// This file is distributed under the University of Illinois Open Source //
|
||||
// License. See LICENSE.TXT for details. //
|
||||
// //
|
||||
// Provides support for DXC API users. //
|
||||
// //
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
// //
|
||||
// exception.h //
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved. //
|
||||
// Licensed under the MIT license. See COPYRIGHT in the project root for //
|
||||
// full license information. //
|
||||
// This file is distributed under the University of Illinois Open Source //
|
||||
// License. See LICENSE.TXT for details. //
|
||||
// //
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// //
|
||||
// microcom.h //
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved. //
|
||||
// Licensed under the MIT license. See COPYRIGHT in the project root for //
|
||||
// full license information. //
|
||||
// This file is distributed under the University of Illinois Open Source //
|
||||
// License. See LICENSE.TXT for details. //
|
||||
// //
|
||||
// Provides support for basic COM-like constructs. //
|
||||
// //
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Copyright (C) Microsoft Corporation. All rights reserved.
|
||||
# Licensed under the MIT license. See COPYRIGHT in the project root for full license information.
|
||||
# This file is distributed under the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
# Generate ETW instrumentation.
|
||||
|
||||
# Create the header in a temporary file and only update when necessary,
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// //
|
||||
// dxcapi.h //
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved. //
|
||||
// Licensed under the MIT license. See COPYRIGHT in the project root for //
|
||||
// full license information. //
|
||||
// This file is distributed under the University of Illinois Open Source //
|
||||
// License. See LICENSE.TXT for details. //
|
||||
// //
|
||||
// Provides declarations for the DirectX Compiler API entry point. //
|
||||
// //
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// //
|
||||
// dxcapi.internal.h //
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved. //
|
||||
// Licensed under the MIT license. See COPYRIGHT in the project root for //
|
||||
// full license information. //
|
||||
// This file is distributed under the University of Illinois Open Source //
|
||||
// License. See LICENSE.TXT for details. //
|
||||
// //
|
||||
// Provides non-public declarations for the DirectX Compiler component. //
|
||||
// //
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// //
|
||||
// dxcisense.h //
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved. //
|
||||
// Licensed under the MIT license. See COPYRIGHT in the project root for //
|
||||
// full license information. //
|
||||
// This file is distributed under the University of Illinois Open Source //
|
||||
// License. See LICENSE.TXT for details. //
|
||||
// //
|
||||
// Provides declarations for the DirectX Compiler IntelliSense component. //
|
||||
// //
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// //
|
||||
// dxctools.h //
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved. //
|
||||
// Licensed under the MIT license. See COPYRIGHT in the project root for //
|
||||
// full license information. //
|
||||
// This file is distributed under the University of Illinois Open Source //
|
||||
// License. See LICENSE.TXT for details. //
|
||||
// //
|
||||
// Provides declarations for the DirectX Compiler tooling components. //
|
||||
// //
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// //
|
||||
// MSFileSystem.h //
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved. //
|
||||
// Licensed under the MIT license. See COPYRIGHT in the project root for //
|
||||
// full license information. //
|
||||
// This file is distributed under the University of Illinois Open Source //
|
||||
// License. See LICENSE.TXT for details. //
|
||||
// //
|
||||
// Provides error code values for the DirectX compiler. //
|
||||
// //
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
// //
|
||||
// OacrIgnoreCond.h //
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved. //
|
||||
// Licensed under the MIT license. See COPYRIGHT in the project root for //
|
||||
// full license information. //
|
||||
// This file is distributed under the University of Illinois Open Source //
|
||||
// License. See LICENSE.TXT for details. //
|
||||
// //
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// //
|
||||
// assert.h //
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved. //
|
||||
// Licensed under the MIT license. See COPYRIGHT in the project root for //
|
||||
// full license information. //
|
||||
// This file is distributed under the University of Illinois Open Source //
|
||||
// License. See LICENSE.TXT for details. //
|
||||
// //
|
||||
// Defines custom assert macro for clang/llvm. //
|
||||
// //
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Copyright (C) Microsoft Corporation. All rights reserved.
|
||||
# Licensed under the MIT license. See COPYRIGHT in the project root for full license information.
|
||||
# This file is distributed under the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
add_llvm_library(LLVMDxcSupport
|
||||
dxcapi.use.cpp
|
||||
FileIOHelper.cpp
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// //
|
||||
// FileIOHelper.cpp //
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved. //
|
||||
// Licensed under the MIT license. See COPYRIGHT in the project root for //
|
||||
// full license information. //
|
||||
// This file is distributed under the University of Illinois Open Source //
|
||||
// License. See LICENSE.TXT for details. //
|
||||
// //
|
||||
|
||||
// //
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// //
|
||||
// Global.cpp //
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved. //
|
||||
// Licensed under the MIT license. See COPYRIGHT in the project root for //
|
||||
// full license information. //
|
||||
// This file is distributed under the University of Illinois Open Source //
|
||||
// License. See LICENSE.TXT for details. //
|
||||
// //
|
||||
|
||||
// //
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
// //
|
||||
// HLSLOptions.cpp //
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved. //
|
||||
// Licensed under the MIT license. See COPYRIGHT in the project root for //
|
||||
// full license information. //
|
||||
// This file is distributed under the University of Illinois Open Source //
|
||||
// License. See LICENSE.TXT for details. //
|
||||
// //
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// //
|
||||
// Unicode.cpp //
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved. //
|
||||
// Licensed under the MIT license. See COPYRIGHT in the project root for //
|
||||
// full license information. //
|
||||
// This file is distributed under the University of Illinois Open Source //
|
||||
// License. See LICENSE.TXT for details. //
|
||||
// //
|
||||
// Provides utitlity functions to work with Unicode and other encodings. //
|
||||
// //
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// //
|
||||
// dxcapi.use.cpp //
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved. //
|
||||
// Licensed under the MIT license. See COPYRIGHT in the project root for //
|
||||
// full license information. //
|
||||
// This file is distributed under the University of Illinois Open Source //
|
||||
// License. See LICENSE.TXT for details. //
|
||||
// //
|
||||
// Provides support for DXC API users. //
|
||||
// //
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Copyright (C) Microsoft Corporation. All rights reserved.
|
||||
# Licensed under the MIT license. See COPYRIGHT in the project root for full license information.
|
||||
# This file is distributed under the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
add_llvm_library(LLVMHLSL
|
||||
DxilCBuffer.cpp
|
||||
DxilCompType.cpp
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// //
|
||||
// DxcOptimizer.cpp //
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved. //
|
||||
// Licensed under the MIT license. See COPYRIGHT in the project root for //
|
||||
// full license information. //
|
||||
// This file is distributed under the University of Illinois Open Source //
|
||||
// License. See LICENSE.TXT for details. //
|
||||
// //
|
||||
// Provides an IDxcOptimizer implementation. //
|
||||
// //
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// //
|
||||
// DxilCBuffer.cpp //
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved. //
|
||||
// Licensed under the MIT license. See COPYRIGHT in the project root for //
|
||||
// full license information. //
|
||||
// This file is distributed under the University of Illinois Open Source //
|
||||
// License. See LICENSE.TXT for details. //
|
||||
// //
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// //
|
||||
// DxilCompType.cpp //
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved. //
|
||||
// Licensed under the MIT license. See COPYRIGHT in the project root for //
|
||||
// full license information. //
|
||||
// This file is distributed under the University of Illinois Open Source //
|
||||
// License. See LICENSE.TXT for details. //
|
||||
// //
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// //
|
||||
// DxilCondenseResources.cpp //
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved. //
|
||||
// Licensed under the MIT license. See COPYRIGHT in the project root for //
|
||||
// full license information. //
|
||||
// This file is distributed under the University of Illinois Open Source //
|
||||
// License. See LICENSE.TXT for details. //
|
||||
// //
|
||||
// Provides a pass to make resource IDs zero-based and dense. //
|
||||
// //
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// //
|
||||
// DxilContainer.cpp //
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved. //
|
||||
// Licensed under the MIT license. See COPYRIGHT in the project root for //
|
||||
// full license information. //
|
||||
// This file is distributed under the University of Illinois Open Source //
|
||||
// License. See LICENSE.TXT for details. //
|
||||
// //
|
||||
// Provides support for manipulating DXIL container structures. //
|
||||
// //
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// //
|
||||
// DxilContainerAssembler.cpp //
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved. //
|
||||
// Licensed under the MIT license. See COPYRIGHT in the project root for //
|
||||
// full license information. //
|
||||
// This file is distributed under the University of Illinois Open Source //
|
||||
// License. See LICENSE.TXT for details. //
|
||||
// //
|
||||
// Provides support for serializing a module into DXIL container structures. //
|
||||
// //
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// //
|
||||
// DxilContainerReflection.cpp //
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved. //
|
||||
// Licensed under the MIT license. See COPYRIGHT in the project root for //
|
||||
// full license information. //
|
||||
// This file is distributed under the University of Illinois Open Source //
|
||||
// License. See LICENSE.TXT for details. //
|
||||
// //
|
||||
// Provides support for reading DXIL container structures. //
|
||||
// //
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// //
|
||||
// DxilGenerationPass.cpp //
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved. //
|
||||
// Licensed under the MIT license. See COPYRIGHT in the project root for //
|
||||
// full license information. //
|
||||
// This file is distributed under the University of Illinois Open Source //
|
||||
// License. See LICENSE.TXT for details. //
|
||||
// //
|
||||
// DxilGenerationPass implementation. //
|
||||
// //
|
||||
|
@ -1199,7 +1199,6 @@ void DxilGenerationPass::GenerateDxilInputsOutputs(bool bInput) {
|
|||
if (!GV->getType()->isPointerTy()) {
|
||||
DXASSERT(bInput, "direct parameter must be input");
|
||||
Value *vertexID = undefVertexIdx;
|
||||
Constant *OpArg = hlslOP->GetU32Const((unsigned)opcode);
|
||||
Value *args[] = {OpArg, ID, /*rowIdx*/constZero, /*colIdx*/nullptr, vertexID};
|
||||
replaceDirectInputParameter(GV, dxilFunc, cols, args, bI1Cast, hlslOP, EntryBuilder);
|
||||
continue;
|
||||
|
@ -1222,7 +1221,6 @@ void DxilGenerationPass::GenerateDxilInputsOutputs(bool bInput) {
|
|||
}
|
||||
|
||||
if (LoadInst *ldInst = dyn_cast<LoadInst>(info.user)) {
|
||||
Constant *OpArg = hlslOP->GetU32Const((unsigned)opcode);
|
||||
Value *args[] = {OpArg, ID, idxVal, info.vectorIdx, vertexID};
|
||||
replaceLdWithLdInput(dxilFunc, ldInst, cols, args, bI1Cast, hlslOP);
|
||||
}
|
||||
|
@ -1230,10 +1228,47 @@ void DxilGenerationPass::GenerateDxilInputsOutputs(bool bInput) {
|
|||
if (bInput) {
|
||||
DXASSERT_LOCALVAR(bIsInout, bIsInout, "input should not have store use.");
|
||||
} else {
|
||||
DXASSERT(!info.vectorIdx,
|
||||
"not implement vector indexing on output yet.");
|
||||
if (!info.vectorIdx) {
|
||||
replaceStWithStOutput(dxilFunc, stInst, opcode, ID, idxVal, cols,
|
||||
bI1Cast, hlslOP);
|
||||
} else {
|
||||
Value *V = stInst->getValueOperand();
|
||||
Type *Ty = V->getType();
|
||||
DXASSERT(Ty == Ty->getScalarType() && !Ty->isAggregateType(),
|
||||
"only support scalar here");
|
||||
|
||||
if (ConstantInt *ColIdx = dyn_cast<ConstantInt>(info.vectorIdx)) {
|
||||
IRBuilder<> Builder(stInst);
|
||||
Value *args[] = {OpArg, ID, idxVal, ColIdx, V};
|
||||
GenerateStOutput(dxilFunc, args, Builder, bI1Cast);
|
||||
} else {
|
||||
BasicBlock *BB = stInst->getParent();
|
||||
BasicBlock *EndBB = BB->splitBasicBlock(stInst);
|
||||
|
||||
TerminatorInst *TI = BB->getTerminator();
|
||||
IRBuilder<> SwitchBuilder(TI);
|
||||
LLVMContext &Ctx = m_pHLModule->GetCtx();
|
||||
SwitchInst *Switch =
|
||||
SwitchBuilder.CreateSwitch(info.vectorIdx, EndBB, cols);
|
||||
TI->eraseFromParent();
|
||||
|
||||
Function *F = EndBB->getParent();
|
||||
for (unsigned i = 0; i < cols; i++) {
|
||||
BasicBlock *CaseBB = BasicBlock::Create(Ctx, "case", F, EndBB);
|
||||
Switch->addCase(SwitchBuilder.getInt32(i), CaseBB);
|
||||
IRBuilder<> CaseBuilder(CaseBB);
|
||||
|
||||
ConstantInt *CaseIdx = SwitchBuilder.getInt8(i);
|
||||
|
||||
Value *args[] = {OpArg, ID, idxVal, CaseIdx, V};
|
||||
GenerateStOutput(dxilFunc, args, CaseBuilder, bI1Cast);
|
||||
|
||||
CaseBuilder.CreateBr(EndBB);
|
||||
}
|
||||
}
|
||||
// remove stInst
|
||||
stInst->eraseFromParent();
|
||||
}
|
||||
}
|
||||
} else if (CallInst *CI = dyn_cast<CallInst>(info.user)) {
|
||||
HLOpcodeGroup group = GetHLOpcodeGroupByName(CI->getCalledFunction());
|
||||
|
@ -2054,7 +2089,10 @@ void DxilGenerationPass::GenerateDxilCBufferHandles(std::unordered_map<Instructi
|
|||
for (auto U : GV->users()) {
|
||||
// Must CBufferSubscript.
|
||||
CallInst *CI = cast<CallInst>((U));
|
||||
IRBuilder<> Builder(CI);
|
||||
// Put createHandle to entry block.
|
||||
auto InsertPt =
|
||||
CI->getParent()->getParent()->getEntryBlock().getFirstInsertionPt();
|
||||
IRBuilder<> Builder(InsertPt);
|
||||
|
||||
CallInst *handle = Builder.CreateCall(createHandle, args, handleName);
|
||||
if (m_HasDbgInfo) {
|
||||
|
@ -2068,8 +2106,17 @@ void DxilGenerationPass::GenerateDxilCBufferHandles(std::unordered_map<Instructi
|
|||
// Must CBufferSubscript.
|
||||
CallInst *CI = cast<CallInst>(U);
|
||||
IRBuilder<> Builder(CI);
|
||||
Value *CBIndex = CI->getArgOperand(HLOperandIndex::kSubscriptIndexOpIdx);
|
||||
args[DXIL::OperandIndex::kCreateHandleResIndexOpIdx] =
|
||||
CI->getArgOperand(HLOperandIndex::kSubscriptIndexOpIdx);
|
||||
CBIndex;
|
||||
if (isa<ConstantInt>(CBIndex)) {
|
||||
// Put createHandle to entry block for const index.
|
||||
auto InsertPt = CI->getParent()
|
||||
->getParent()
|
||||
->getEntryBlock()
|
||||
.getFirstInsertionPt();
|
||||
Builder.SetInsertPoint(InsertPt);
|
||||
}
|
||||
CallInst *handle = Builder.CreateCall(createHandle, args, handleName);
|
||||
handleMap[CI] = handle;
|
||||
}
|
||||
|
@ -2712,6 +2759,9 @@ static void PropagatePreciseAttributeOnOperand(Value *V, DxilTypeSystem &typeSys
|
|||
|
||||
// Clear fast math.
|
||||
I->copyFastMathFlags(FastMathFlags());
|
||||
// Fast math not work on call, use metadata.
|
||||
if (CallInst *CI = dyn_cast<CallInst>(I))
|
||||
HLModule::MarkPreciseAttributeWithMetadata(CI);
|
||||
PropagatePreciseAttribute(I, typeSys);
|
||||
}
|
||||
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// //
|
||||
// DxilInterpolationMode.cpp //
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved. //
|
||||
// Licensed under the MIT license. See COPYRIGHT in the project root for //
|
||||
// full license information. //
|
||||
// This file is distributed under the University of Illinois Open Source //
|
||||
// License. See LICENSE.TXT for details. //
|
||||
// //
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// //
|
||||
// DxilMetadataHelper.cpp //
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved. //
|
||||
// Licensed under the MIT license. See COPYRIGHT in the project root for //
|
||||
// full license information. //
|
||||
// This file is distributed under the University of Illinois Open Source //
|
||||
// License. See LICENSE.TXT for details. //
|
||||
// //
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// //
|
||||
// DxilModule.cpp //
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved. //
|
||||
// Licensed under the MIT license. See COPYRIGHT in the project root for //
|
||||
// full license information. //
|
||||
// This file is distributed under the University of Illinois Open Source //
|
||||
// License. See LICENSE.TXT for details. //
|
||||
// //
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// //
|
||||
// DxilOperations.cpp //
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved. //
|
||||
// Licensed under the MIT license. See COPYRIGHT in the project root for //
|
||||
// full license information. //
|
||||
// This file is distributed under the University of Illinois Open Source //
|
||||
// License. See LICENSE.TXT for details. //
|
||||
// //
|
||||
// Implementation of DXIL operation tables. //
|
||||
// //
|
||||
|
@ -684,6 +684,111 @@ Function *OP::GetOpFunc(OpCode OpCode, Type *pOverloadType) {
|
|||
return F;
|
||||
}
|
||||
|
||||
llvm::Type *OP::GetOverloadType(OpCode OpCode, llvm::Function *F) {
|
||||
DXASSERT(F, "not work on nullptr");
|
||||
Type *Ty = F->getReturnType();
|
||||
FunctionType *FT = F->getFunctionType();
|
||||
/* <py::lines('OPCODE-OLOAD-TYPES')>hctdb_instrhelp.get_funcs_oload_type()</py>*/
|
||||
switch (OpCode) { // return OpCode
|
||||
// OPCODE-OLOAD-TYPES:BEGIN
|
||||
case OpCode::IsNaN:
|
||||
case OpCode::IsInf:
|
||||
case OpCode::IsFinite:
|
||||
case OpCode::IsNormal:
|
||||
case OpCode::Countbits:
|
||||
case OpCode::FirstbitLo:
|
||||
case OpCode::FirstbitHi:
|
||||
case OpCode::FirstbitSHi:
|
||||
case OpCode::IMul:
|
||||
case OpCode::UMul:
|
||||
case OpCode::UDiv:
|
||||
case OpCode::IAddc:
|
||||
case OpCode::UAddc:
|
||||
case OpCode::ISubc:
|
||||
case OpCode::USubc:
|
||||
case OpCode::WaveActiveAllEqual:
|
||||
return FT->getParamType(1);
|
||||
case OpCode::TempRegStore:
|
||||
return FT->getParamType(2);
|
||||
case OpCode::MinPrecXRegStore:
|
||||
case OpCode::StoreOutput:
|
||||
case OpCode::BufferStore:
|
||||
case OpCode::StorePatchConstant:
|
||||
return FT->getParamType(4);
|
||||
case OpCode::TextureStore:
|
||||
return FT->getParamType(5);
|
||||
case OpCode::MakeDouble:
|
||||
case OpCode::SplitDouble:
|
||||
return Type::getDoubleTy(m_Ctx);
|
||||
case OpCode::CheckAccessFullyMapped:
|
||||
case OpCode::AtomicBinOp:
|
||||
case OpCode::AtomicCompareExchange:
|
||||
case OpCode::SampleIndex:
|
||||
case OpCode::Coverage:
|
||||
case OpCode::InnerCoverage:
|
||||
case OpCode::ThreadId:
|
||||
case OpCode::GroupId:
|
||||
case OpCode::ThreadIdInGroup:
|
||||
case OpCode::FlattenedThreadIdInGroup:
|
||||
case OpCode::GSInstanceID:
|
||||
case OpCode::OutputControlPointID:
|
||||
case OpCode::PrimitiveID:
|
||||
return IntegerType::get(m_Ctx, 32);
|
||||
case OpCode::CalculateLOD:
|
||||
case OpCode::DomainLocation:
|
||||
return Type::getFloatTy(m_Ctx);
|
||||
case OpCode::CreateHandle:
|
||||
case OpCode::BufferUpdateCounter:
|
||||
case OpCode::GetDimensions:
|
||||
case OpCode::Texture2DMSGetSamplePosition:
|
||||
case OpCode::RenderTargetGetSamplePosition:
|
||||
case OpCode::RenderTargetGetSampleCount:
|
||||
case OpCode::Barrier:
|
||||
case OpCode::Discard:
|
||||
case OpCode::EmitStream:
|
||||
case OpCode::CutStream:
|
||||
case OpCode::EmitThenCutStream:
|
||||
case OpCode::CycleCounterLegacy:
|
||||
case OpCode::WaveIsFirstLane:
|
||||
case OpCode::WaveGetLaneIndex:
|
||||
case OpCode::WaveGetLaneCount:
|
||||
case OpCode::WaveAnyTrue:
|
||||
case OpCode::WaveAllTrue:
|
||||
case OpCode::WaveActiveBallot:
|
||||
case OpCode::BitcastI16toF16:
|
||||
case OpCode::BitcastF16toI16:
|
||||
case OpCode::BitcastI32toF32:
|
||||
case OpCode::BitcastF32toI32:
|
||||
case OpCode::BitcastI64toF64:
|
||||
case OpCode::BitcastF64toI64:
|
||||
case OpCode::LegacyF32ToF16:
|
||||
case OpCode::LegacyF16ToF32:
|
||||
case OpCode::LegacyDoubleToFloat:
|
||||
case OpCode::LegacyDoubleToSInt32:
|
||||
case OpCode::LegacyDoubleToUInt32:
|
||||
case OpCode::WaveAllBitCount:
|
||||
case OpCode::WavePrefixBitCount:
|
||||
return Type::getVoidTy(m_Ctx);
|
||||
case OpCode::CBufferLoadLegacy:
|
||||
case OpCode::Sample:
|
||||
case OpCode::SampleBias:
|
||||
case OpCode::SampleLevel:
|
||||
case OpCode::SampleGrad:
|
||||
case OpCode::SampleCmp:
|
||||
case OpCode::SampleCmpLevelZero:
|
||||
case OpCode::TextureLoad:
|
||||
case OpCode::BufferLoad:
|
||||
case OpCode::TextureGather:
|
||||
case OpCode::TextureGatherCmp:
|
||||
{
|
||||
StructType *ST = cast<StructType>(Ty);
|
||||
return ST->getElementType(0);
|
||||
}
|
||||
// OPCODE-OLOAD-TYPES:END
|
||||
default: return Ty;
|
||||
}
|
||||
}
|
||||
|
||||
Type *OP::GetHandleType() const {
|
||||
return m_pHandleType;
|
||||
}
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// //
|
||||
// DxilResource.cpp //
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved. //
|
||||
// Licensed under the MIT license. See COPYRIGHT in the project root for //
|
||||
// full license information. //
|
||||
// This file is distributed under the University of Illinois Open Source //
|
||||
// License. See LICENSE.TXT for details. //
|
||||
// //
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// //
|
||||
// DxilResourceBase.cpp //
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved. //
|
||||
// Licensed under the MIT license. See COPYRIGHT in the project root for //
|
||||
// full license information. //
|
||||
// This file is distributed under the University of Illinois Open Source //
|
||||
// License. See LICENSE.TXT for details. //
|
||||
// //
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// //
|
||||
// DxilRootSignature.cpp //
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved. //
|
||||
// Licensed under the MIT license. See COPYRIGHT in the project root for //
|
||||
// full license information. //
|
||||
// This file is distributed under the University of Illinois Open Source //
|
||||
// License. See LICENSE.TXT for details. //
|
||||
// //
|
||||
// Provides support for manipulating root signature structures. //
|
||||
// //
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// //
|
||||
// DxilSampler.cpp //
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved. //
|
||||
// Licensed under the MIT license. See COPYRIGHT in the project root for //
|
||||
// full license information. //
|
||||
// This file is distributed under the University of Illinois Open Source //
|
||||
// License. See LICENSE.TXT for details. //
|
||||
// //
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// //
|
||||
// DxilSemantic.cpp //
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved. //
|
||||
// Licensed under the MIT license. See COPYRIGHT in the project root for //
|
||||
// full license information. //
|
||||
// This file is distributed under the University of Illinois Open Source //
|
||||
// License. See LICENSE.TXT for details. //
|
||||
// //
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// //
|
||||
// DxilShaderModel.cpp //
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved. //
|
||||
// Licensed under the MIT license. See COPYRIGHT in the project root for //
|
||||
// full license information. //
|
||||
// This file is distributed under the University of Illinois Open Source //
|
||||
// License. See LICENSE.TXT for details. //
|
||||
// //
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// //
|
||||
// DxilSigPoint.cpp //
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved. //
|
||||
// Licensed under the MIT license. See COPYRIGHT in the project root for //
|
||||
// full license information. //
|
||||
// This file is distributed under the University of Illinois Open Source //
|
||||
// License. See LICENSE.TXT for details. //
|
||||
// //
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// //
|
||||
// DxilSignature.cpp //
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved. //
|
||||
// Licensed under the MIT license. See COPYRIGHT in the project root for //
|
||||
// full license information. //
|
||||
// This file is distributed under the University of Illinois Open Source //
|
||||
// License. See LICENSE.TXT for details. //
|
||||
// //
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// //
|
||||
// DxilSignature.cpp //
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved. //
|
||||
// Licensed under the MIT license. See COPYRIGHT in the project root for //
|
||||
// full license information. //
|
||||
// This file is distributed under the University of Illinois Open Source //
|
||||
// License. See LICENSE.TXT for details. //
|
||||
// //
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// //
|
||||
// DxilSignatureElement.cpp //
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved. //
|
||||
// Licensed under the MIT license. See COPYRIGHT in the project root for //
|
||||
// full license information. //
|
||||
// This file is distributed under the University of Illinois Open Source //
|
||||
// License. See LICENSE.TXT for details. //
|
||||
// //
|
||||
// Representation of HLSL signature element. //
|
||||
// //
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// //
|
||||
// DxilTypeSystem.cpp //
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved. //
|
||||
// Licensed under the MIT license. See COPYRIGHT in the project root for //
|
||||
// full license information. //
|
||||
// This file is distributed under the University of Illinois Open Source //
|
||||
// License. See LICENSE.TXT for details. //
|
||||
// //
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// //
|
||||
// DxilValidation.cpp //
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved. //
|
||||
// Licensed under the MIT license. See COPYRIGHT in the project root for //
|
||||
// full license information. //
|
||||
// This file is distributed under the University of Illinois Open Source //
|
||||
// License. See LICENSE.TXT for details. //
|
||||
// //
|
||||
// This file provides support for validating DXIL shaders. //
|
||||
// //
|
||||
|
@ -25,6 +25,7 @@
|
|||
#include "llvm/IR/LLVMContext.h"
|
||||
#include "llvm/IR/Module.h"
|
||||
#include "llvm/IR/Type.h"
|
||||
#include "llvm/IR/Operator.h"
|
||||
#include "llvm/IR/Instructions.h"
|
||||
#include "llvm/IR/InstIterator.h"
|
||||
#include "llvm/IR/Constants.h"
|
||||
|
@ -36,6 +37,7 @@
|
|||
#include <unordered_set>
|
||||
#include "llvm/Analysis/LoopInfo.h"
|
||||
#include "llvm/IR/Dominators.h"
|
||||
#include "llvm/Analysis/PostDominators.h"
|
||||
#include "dxc/HLSL/DxilSpanAllocator.h"
|
||||
#include "dxc/HLSL/DxilSignatureAllocator.h"
|
||||
#include <algorithm>
|
||||
|
@ -158,6 +160,7 @@ const char *hlsl::GetValidationRuleText(ValidationRule value) {
|
|||
case hlsl::ValidationRule::InstrCBufferClassForCBufferHandle: return "Expect Cbuffer for CBufferLoad handle";
|
||||
case hlsl::ValidationRule::InstrFailToResloveTGSMPointer: return "TGSM pointers must originate from an unambiguous TGSM global variable.";
|
||||
case hlsl::ValidationRule::InstrExtractValue: return "ExtractValue should only be used on dxil struct types and cmpxchg";
|
||||
case hlsl::ValidationRule::InstrTGSMRaceCond: return "Race condition writing to shared memory detected, consider making this write conditional";
|
||||
case hlsl::ValidationRule::TypesNoVector: return "Vector type '%0' is not allowed";
|
||||
case hlsl::ValidationRule::TypesDefined: return "Type '%0' is not defined on DXIL primitives";
|
||||
case hlsl::ValidationRule::TypesIntWidth: return "Int type '%0' has an invalid width";
|
||||
|
@ -1774,76 +1777,6 @@ static void ValidateDxilOperationCallInProfile(CallInst *CI,
|
|||
|
||||
}
|
||||
|
||||
static Type *GetOverloadTyForDxilOperation(CallInst *CI, DXIL::OpCode opcode) {
|
||||
Type *Ty = CI->getType();
|
||||
if (Ty->isVoidTy()) {
|
||||
switch (opcode) {
|
||||
case DXIL::OpCode::StoreOutput:
|
||||
case DXIL::OpCode::StorePatchConstant:
|
||||
if (CI->getNumArgOperands() < DXIL::OperandIndex::kStoreOutputValOpIdx) {
|
||||
// Will emit error later when cannot find valid dxil function.
|
||||
return CI->getType();
|
||||
}
|
||||
return CI->getArgOperand(DXIL::OperandIndex::kStoreOutputValOpIdx)->getType();
|
||||
case DXIL::OpCode::BufferStore:
|
||||
return CI->getArgOperand(DXIL::OperandIndex::kBufferStoreVal0OpIdx)->getType();
|
||||
case DXIL::OpCode::TextureStore:
|
||||
return CI->getArgOperand(DXIL::OperandIndex::kTextureStoreVal0OpIdx)->getType();
|
||||
default:
|
||||
return Ty;
|
||||
}
|
||||
} else if (Ty->isAggregateType()) {
|
||||
switch (opcode) {
|
||||
case DXIL::OpCode::CreateHandle:
|
||||
case DXIL::OpCode::GetDimensions:
|
||||
case DXIL::OpCode::Texture2DMSGetSamplePosition:
|
||||
case DXIL::OpCode::RenderTargetGetSamplePosition:
|
||||
return Type::getVoidTy(CI->getContext());
|
||||
case DXIL::OpCode::CBufferLoadLegacy:
|
||||
case DXIL::OpCode::BufferLoad:
|
||||
case DXIL::OpCode::TextureLoad:
|
||||
case DXIL::OpCode::Sample:
|
||||
case DXIL::OpCode::SampleBias:
|
||||
case DXIL::OpCode::SampleCmp:
|
||||
case DXIL::OpCode::SampleCmpLevelZero:
|
||||
case DXIL::OpCode::SampleGrad:
|
||||
case DXIL::OpCode::SampleLevel:
|
||||
case DXIL::OpCode::TextureGather:
|
||||
case DXIL::OpCode::TextureGatherCmp:
|
||||
{
|
||||
StructType *ST = cast<StructType>(CI->getType());
|
||||
return ST->getElementType(0);
|
||||
}
|
||||
case DXIL::OpCode::SplitDouble:
|
||||
return CI->getArgOperand(DXIL::OperandIndex::kUnarySrc0OpIdx)->getType();
|
||||
default:
|
||||
return Ty;
|
||||
}
|
||||
} else
|
||||
switch (opcode) {
|
||||
case DXIL::OpCode::BufferUpdateCounter:
|
||||
case DXIL::OpCode::RenderTargetGetSampleCount:
|
||||
return Type::getVoidTy(CI->getContext());
|
||||
case DXIL::OpCode::CheckAccessFullyMapped:
|
||||
return Type::getInt32Ty(CI->getContext());
|
||||
case DXIL::OpCode::IsFinite:
|
||||
case DXIL::OpCode::IsInf:
|
||||
case DXIL::OpCode::IsNaN:
|
||||
case DXIL::OpCode::IsNormal:
|
||||
return CI->getArgOperand(DXIL::OperandIndex::kUnarySrc0OpIdx)->getType();
|
||||
case DXIL::OpCode::WaveActiveAllEqual:
|
||||
// TODO: build this whole function from hctdb.py
|
||||
return CI->getArgOperand(1)->getType()->getScalarType();
|
||||
case DXIL::OpCode::Countbits:
|
||||
case DXIL::OpCode::FirstbitLo:
|
||||
case DXIL::OpCode::FirstbitHi:
|
||||
case DXIL::OpCode::FirstbitSHi:
|
||||
return CI->getArgOperand(DXIL::OperandIndex::kUnarySrc0OpIdx)->getType()->getScalarType();
|
||||
default:
|
||||
return Ty;
|
||||
}
|
||||
}
|
||||
|
||||
static bool IsDxilFunction(llvm::Function *F) {
|
||||
unsigned argSize = F->getArgumentList().size();
|
||||
if (argSize < 1) {
|
||||
|
@ -1896,7 +1829,7 @@ static void ValidateExternalFunction(Function *F, ValidationContext &ValCtx) {
|
|||
dxilFunc = hlslOP->GetOpFunc(dxilOpcode, voidTy);
|
||||
}
|
||||
else {
|
||||
Type *Ty = GetOverloadTyForDxilOperation(CI, dxilOpcode);
|
||||
Type *Ty = hlslOP->GetOverloadType(dxilOpcode, CI->getCalledFunction());
|
||||
try {
|
||||
if (!hlslOP->IsOverloadLegal(dxilOpcode, Ty)) {
|
||||
ValCtx.EmitInstrError(CI, ValidationRule::InstrOload);
|
||||
|
@ -2001,8 +1934,10 @@ static bool ValidateType(Type *Ty, ValidationContext &ValCtx) {
|
|||
StringRef Name = ST->getName();
|
||||
if (Name.startswith("dx.")) {
|
||||
hlsl::OP *hlslOP = ValCtx.DxilMod.GetOP();
|
||||
if (IsDxilBuiltinStructType(ST, hlslOP))
|
||||
return true;
|
||||
if (IsDxilBuiltinStructType(ST, hlslOP)) {
|
||||
ValCtx.EmitTypeError(Ty, ValidationRule::InstrDxilStructUser);
|
||||
result = false;
|
||||
}
|
||||
|
||||
ValCtx.EmitTypeError(Ty, ValidationRule::DeclDxilNsReserved);
|
||||
result = false;
|
||||
|
@ -2619,15 +2554,59 @@ static void ValidateGlobalVariable(GlobalVariable &GV,
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
CollectFixAddressAccess(Value *V, std::vector<Instruction *> &fixAddrTGSMList) {
|
||||
for (User *U : V->users()) {
|
||||
if (GEPOperator *GEP = dyn_cast<GEPOperator>(U)) {
|
||||
if (isa<ConstantExpr>(GEP) || GEP->hasAllConstantIndices()) {
|
||||
CollectFixAddressAccess(GEP, fixAddrTGSMList);
|
||||
}
|
||||
} else if (isa<StoreInst>(U)) {
|
||||
fixAddrTGSMList.emplace_back(cast<Instruction>(U));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
ValidateTGSMRaceCondition(std::vector<Instruction *> &fixAddrTGSMList,
|
||||
ValidationContext &ValCtx) {
|
||||
std::unordered_set<Function *> fixAddrTGSMFuncSet;
|
||||
for (Instruction *I : fixAddrTGSMList) {
|
||||
BasicBlock *BB = I->getParent();
|
||||
fixAddrTGSMFuncSet.insert(BB->getParent());
|
||||
}
|
||||
|
||||
for (auto &F : ValCtx.DxilMod.GetModule()->functions()) {
|
||||
if (F.isDeclaration() || !fixAddrTGSMFuncSet.count(&F))
|
||||
continue;
|
||||
|
||||
PostDominatorTree PDT;
|
||||
PDT.runOnFunction(F);
|
||||
|
||||
BasicBlock *Entry = &F.getEntryBlock();
|
||||
|
||||
for (Instruction *I : fixAddrTGSMList) {
|
||||
BasicBlock *BB = I->getParent();
|
||||
if (BB->getParent() == &F) {
|
||||
if (PDT.dominates(BB, Entry)) {
|
||||
ValCtx.EmitInstrError(I, ValidationRule::InstrTGSMRaceCond);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void ValidateGlobalVariables(ValidationContext &ValCtx) {
|
||||
DxilModule &M = ValCtx.DxilMod;
|
||||
|
||||
unsigned TGSMSize = 0;
|
||||
std::vector<Instruction*> fixAddrTGSMList;
|
||||
const DataLayout &DL = M.GetModule()->getDataLayout();
|
||||
for (GlobalVariable &GV : M.GetModule()->globals()) {
|
||||
ValidateGlobalVariable(GV, ValCtx);
|
||||
if (GV.getType()->getAddressSpace() == DXIL::kTGSMAddrSpace) {
|
||||
TGSMSize += DL.getTypeAllocSize(GV.getType()->getElementType());
|
||||
CollectFixAddressAccess(&GV, fixAddrTGSMList);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2636,6 +2615,9 @@ static void ValidateGlobalVariables(ValidationContext &ValCtx) {
|
|||
{std::to_string(TGSMSize).c_str(),
|
||||
std::to_string(DXIL::kMaxTGSMSize).c_str()});
|
||||
}
|
||||
if (!fixAddrTGSMList.empty()) {
|
||||
ValidateTGSMRaceCondition(fixAddrTGSMList, ValCtx);
|
||||
}
|
||||
}
|
||||
|
||||
static void ValidateValidatorVersion(ValidationContext &ValCtx) {
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// //
|
||||
// HLMatrixLowerPass.cpp //
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved. //
|
||||
// Licensed under the MIT license. See COPYRIGHT in the project root for //
|
||||
// full license information. //
|
||||
// This file is distributed under the University of Illinois Open Source //
|
||||
// License. See LICENSE.TXT for details. //
|
||||
// //
|
||||
// HLMatrixLowerPass implementation. //
|
||||
// //
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// //
|
||||
// HLModule.cpp //
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved. //
|
||||
// Licensed under the MIT license. See COPYRIGHT in the project root for //
|
||||
// full license information. //
|
||||
// This file is distributed under the University of Illinois Open Source //
|
||||
// License. See LICENSE.TXT for details. //
|
||||
// //
|
||||
// HighLevel DX IR module. //
|
||||
// //
|
||||
|
@ -985,7 +985,8 @@ bool HLModule::HasPreciseAttributeWithMetadata(Instruction *I) {
|
|||
void HLModule::MarkPreciseAttributeWithMetadata(Instruction *I) {
|
||||
LLVMContext &Ctx = I->getContext();
|
||||
MDNode *preciseNode = MDNode::get(
|
||||
Ctx, {MDString::get(Ctx, DxilMDHelper::kDxilPreciseAttributeMDName)});
|
||||
Ctx,
|
||||
{ConstantAsMetadata::get(ConstantInt::get(Type::getInt32Ty(Ctx), 1))});
|
||||
|
||||
I->setMetadata(DxilMDHelper::kDxilPreciseAttributeMDName, preciseNode);
|
||||
}
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// //
|
||||
// HLOperationLower.cpp //
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved. //
|
||||
// Licensed under the MIT license. See COPYRIGHT in the project root for //
|
||||
// full license information. //
|
||||
// This file is distributed under the University of Illinois Open Source //
|
||||
// License. See LICENSE.TXT for details. //
|
||||
// //
|
||||
// Lower functions to lower HL operations to DXIL operations. //
|
||||
// //
|
||||
|
@ -354,6 +354,54 @@ Value *TranslateD3DColorToUByte4(CallInst *CI, IntrinsicOp IOP,
|
|||
return Builder.CreateBitCast(byte4, CI->getType());
|
||||
}
|
||||
|
||||
Value *TranslateAddUint64(CallInst *CI, IntrinsicOp IOP,
|
||||
OP::OpCode opcode,
|
||||
HLOperationLowerHelper &helper, HLObjectOperationLowerHelper *pObjHelper, bool &Translated) {
|
||||
hlsl::OP *hlslOP = &helper.hlslOP;
|
||||
IRBuilder<> Builder(CI);
|
||||
Value *val = CI->getArgOperand(HLOperandIndex::kUnaryOpSrc0Idx);
|
||||
Type *Ty = val->getType();
|
||||
VectorType *VT = dyn_cast<VectorType>(Ty);
|
||||
if (!VT) {
|
||||
CI->getContext().emitError(
|
||||
CI, "AddUint64 can only be applied to uint2 and uint4 operands");
|
||||
return UndefValue::get(Ty);
|
||||
}
|
||||
|
||||
unsigned size = VT->getNumElements();
|
||||
if (size != 2 && size != 4) {
|
||||
CI->getContext().emitError(
|
||||
CI, "AddUint64 can only be applied to uint2 and uint4 operands");
|
||||
return UndefValue::get(Ty);
|
||||
}
|
||||
Value *op0 = CI->getArgOperand(HLOperandIndex::kBinaryOpSrc0Idx);
|
||||
Value *op1 = CI->getArgOperand(HLOperandIndex::kBinaryOpSrc1Idx);
|
||||
|
||||
Value *RetVal = UndefValue::get(Ty);
|
||||
|
||||
Function *AddC = hlslOP->GetOpFunc(DXIL::OpCode::UAddc, helper.i32Ty);
|
||||
Value *opArg = Builder.getInt32(static_cast<unsigned>(DXIL::OpCode::UAddc));
|
||||
for (unsigned i=0; i<size; i+=2) {
|
||||
Value *low0 = Builder.CreateExtractElement(op0, i);
|
||||
Value *low1 = Builder.CreateExtractElement(op1, i);
|
||||
Value *lowWithC = Builder.CreateCall(AddC, { opArg, low0, low1});
|
||||
Value *low = Builder.CreateExtractValue(lowWithC, 0);
|
||||
RetVal = Builder.CreateInsertElement(RetVal, low, i);
|
||||
|
||||
Value *carry = Builder.CreateExtractValue(lowWithC, 1);
|
||||
// Ext i1 to i32
|
||||
carry = Builder.CreateZExt(carry, helper.i32Ty);
|
||||
|
||||
Value *hi0 = Builder.CreateExtractElement(op0, i+1);
|
||||
Value *hi1 = Builder.CreateExtractElement(op1, i+1);
|
||||
Value *hi = Builder.CreateAdd(hi0, hi1);
|
||||
hi = Builder.CreateAdd(hi, carry);
|
||||
RetVal = Builder.CreateInsertElement(RetVal, hi, i+1);
|
||||
}
|
||||
return RetVal;
|
||||
}
|
||||
|
||||
|
||||
CallInst *ValidateLoadInput(Value *V) {
|
||||
// Must be load input.
|
||||
CallInst *CI = cast<CallInst>(V);
|
||||
|
@ -3041,14 +3089,14 @@ void TranslateAtomicCmpXChg(AtomicHelper &helper, IRBuilder<> &Builder,
|
|||
_Analysis_assume_(vectorNumElements <= 3);
|
||||
for (unsigned i = 0; i < vectorNumElements; i++) {
|
||||
Value *Elt = Builder.CreateExtractElement(addr, i);
|
||||
args[DXIL::OperandIndex::kAtomicBinOpCoord0OpIdx + i] = Elt;
|
||||
args[DXIL::OperandIndex::kAtomicCmpExchangeCoord0OpIdx + i] = Elt;
|
||||
}
|
||||
} else
|
||||
args[DXIL::OperandIndex::kAtomicBinOpCoord0OpIdx] = addr;
|
||||
args[DXIL::OperandIndex::kAtomicCmpExchangeCoord0OpIdx] = addr;
|
||||
|
||||
// Set offset for structured buffer.
|
||||
if (helper.offset)
|
||||
args[DXIL::OperandIndex::kAtomicBinOpCoord1OpIdx] = helper.offset;
|
||||
args[DXIL::OperandIndex::kAtomicCmpExchangeCoord1OpIdx] = helper.offset;
|
||||
|
||||
Value *origVal = Builder.CreateCall(dxilAtomic, args);
|
||||
if (helper.originalValue) {
|
||||
|
@ -3637,7 +3685,7 @@ Value *StreamOutputLower(CallInst *CI, IntrinsicOp IOP, DXIL::OpCode opcode,
|
|||
}
|
||||
|
||||
IntrinsicLower gLowerTable[static_cast<unsigned>(IntrinsicOp::Num_Intrinsics)] = {
|
||||
{IntrinsicOp::IOP_AddUint64, EmptyLower, DXIL::OpCode::NumOpCodes},
|
||||
{IntrinsicOp::IOP_AddUint64, TranslateAddUint64, DXIL::OpCode::UAddc},
|
||||
{IntrinsicOp::IOP_AllMemoryBarrier, TrivialBarrier, DXIL::OpCode::Barrier},
|
||||
{IntrinsicOp::IOP_AllMemoryBarrierWithGroupSync, TrivialBarrier, DXIL::OpCode::Barrier},
|
||||
{IntrinsicOp::IOP_CheckAccessFullyMapped, TrivialUnaryOperation, DXIL::OpCode::CheckAccessFullyMapped},
|
||||
|
@ -5629,10 +5677,43 @@ void TranslateHLSubscript(CallInst *CI, HLSubscriptOpcode opcode,
|
|||
Value *handle = pObjHelper->handleMap[ptrInst];
|
||||
DXIL::ResourceKind RK = pObjHelper->GetRK(ptrInst->getType());
|
||||
Translated = true;
|
||||
if (RK == DxilResource::Kind::StructuredBuffer)
|
||||
TranslateStructBufSubscript(CI, handle, /*status*/ nullptr, hlslOP, helper.legacyDataLayout);
|
||||
else
|
||||
Type *ObjTy = ptrInst->getType();
|
||||
Type *RetTy = ObjTy->getStructElementType(0);
|
||||
if (RK == DxilResource::Kind::StructuredBuffer) {
|
||||
TranslateStructBufSubscript(CI, handle, /*status*/ nullptr, hlslOP,
|
||||
helper.legacyDataLayout);
|
||||
} else if (RetTy->isAggregateType() &&
|
||||
RK == DxilResource::Kind::TypedBuffer) {
|
||||
TranslateStructBufSubscript(CI, handle, /*status*/ nullptr, hlslOP,
|
||||
helper.legacyDataLayout);
|
||||
// Clear offset for typed buf.
|
||||
for (auto User : handle->users()) {
|
||||
CallInst *CI = cast<CallInst>(User);
|
||||
switch (hlslOP->GetDxilOpFuncCallInst(CI)) {
|
||||
case DXIL::OpCode::BufferLoad: {
|
||||
CI->setArgOperand(DXIL::OperandIndex::kBufferLoadCoord1OpIdx,
|
||||
UndefValue::get(helper.i32Ty));
|
||||
} break;
|
||||
case DXIL::OpCode::BufferStore: {
|
||||
CI->setArgOperand(DXIL::OperandIndex::kBufferStoreCoord1OpIdx,
|
||||
UndefValue::get(helper.i32Ty));
|
||||
} break;
|
||||
case DXIL::OpCode::AtomicBinOp: {
|
||||
CI->setArgOperand(DXIL::OperandIndex::kAtomicBinOpCoord1OpIdx,
|
||||
UndefValue::get(helper.i32Ty));
|
||||
} break;
|
||||
case DXIL::OpCode::AtomicCompareExchange: {
|
||||
CI->setArgOperand(DXIL::OperandIndex::kAtomicCmpExchangeCoord1OpIdx,
|
||||
UndefValue::get(helper.i32Ty));
|
||||
} break;
|
||||
default:
|
||||
DXASSERT(0, "Invalid operation on resource handle");
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
TranslateDefaultSubscript(CI, helper, pObjHelper, Translated);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// //
|
||||
// HLOperationLowerExtension.cpp //
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved. //
|
||||
// Licensed under the MIT license. See COPYRIGHT in the project root for //
|
||||
// full license information. //
|
||||
// This file is distributed under the University of Illinois Open Source //
|
||||
// License. See LICENSE.TXT for details. //
|
||||
// //
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// //
|
||||
// HLOperations.cpp //
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved. //
|
||||
// Licensed under the MIT license. See COPYRIGHT in the project root for //
|
||||
// full license information. //
|
||||
// This file is distributed under the University of Illinois Open Source //
|
||||
// License. See LICENSE.TXT for details. //
|
||||
// //
|
||||
// Implementation of DXIL operations. //
|
||||
// //
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// //
|
||||
// HLResource.cpp //
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved. //
|
||||
// Licensed under the MIT license. See COPYRIGHT in the project root for //
|
||||
// full license information. //
|
||||
// This file is distributed under the University of Illinois Open Source //
|
||||
// License. See LICENSE.TXT for details. //
|
||||
// //
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
; Copyright (C) Microsoft Corporation. All rights reserved.
|
||||
; Licensed under the MIT license. See COPYRIGHT in the project root for full license information.
|
||||
; This file is distributed under the University of Illinois Open Source License. See LICENSE.TXT for details.
|
||||
;
|
||||
; This is an LLVMBuild description file for the components in this subdirectory.
|
||||
;
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// //
|
||||
// ReducibilityAnalysis.cpp //
|
||||
// Copyright (C) Microsoft Corporation. All rights reserved. //
|
||||
// Licensed under the MIT license. See COPYRIGHT in the project root for //
|
||||
// full license information. //
|
||||
// This file is distributed under the University of Illinois Open Source //
|
||||
// License. See LICENSE.TXT for details. //
|
||||
// //
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче