Browse Source

[spirv] Rename -fvk-invert-w to -fvk-use-dx-position-w (#1448)

Lei Zhang 7 years ago
parent
commit
f40667e931

+ 5 - 4
docs/SPIR-V.rst

@@ -2719,10 +2719,11 @@ codegen for Vulkan:
 - ``-fvk-invert-y``: Negates (additively inverts) SV_Position.y before writing
 - ``-fvk-invert-y``: Negates (additively inverts) SV_Position.y before writing
   to stage output. Used to accommodate the difference between Vulkan's
   to stage output. Used to accommodate the difference between Vulkan's
   coordinate system and DirectX's. Only allowed in VS/DS/GS.
   coordinate system and DirectX's. Only allowed in VS/DS/GS.
-- ``-fvk-invert-w``: Reciprocates (multiplicatively inverts) SV_Position.w after
-  reading from stage input. Used to accommodate the difference between Vulkan
-  DirectX: the w component of SV_Position in PS is stored as 1/w in Vulkan.
-  Only recognized in PS; applying to other stages is no-op.
+- ``-fvk-use-dx-position-w``: Reciprocates (multiplicatively inverts)
+  SV_Position.w after reading from stage input. Used to accommodate the
+  difference between Vulkan DirectX: the w component of SV_Position in PS is
+  stored as 1/w in Vulkan. Only recognized in PS; applying to other stages
+  is no-op.
 - ``-fvk-stage-io-order={alpha|decl}``: Assigns the stage input/output variable
 - ``-fvk-stage-io-order={alpha|decl}``: Assigns the stage input/output variable
   location number according to alphabetical order or declaration order. See
   location number according to alphabetical order or declaration order. See
   `HLSL semantic and Vulkan Location`_ for more details.
   `HLSL semantic and Vulkan Location`_ for more details.

+ 1 - 1
include/dxc/Support/HLSLOptions.h

@@ -162,7 +162,7 @@ public:
 #ifdef ENABLE_SPIRV_CODEGEN
 #ifdef ENABLE_SPIRV_CODEGEN
   bool GenSPIRV;                           // OPT_spirv
   bool GenSPIRV;                           // OPT_spirv
   bool VkInvertY;                          // OPT_fvk_invert_y
   bool VkInvertY;                          // OPT_fvk_invert_y
-  bool VkInvertW;                          // OPT_fvk_invert_w
+  bool VkInvertW;                          // OPT_fvk_use_dx_position_w
   bool VkUseGlLayout;                      // OPT_fvk_use_gl_layout
   bool VkUseGlLayout;                      // OPT_fvk_use_gl_layout
   bool VkUseDxLayout;                      // OPT_fvk_use_dx_layout
   bool VkUseDxLayout;                      // OPT_fvk_use_dx_layout
   bool SpvEnableReflect;                   // OPT_fspv_reflect
   bool SpvEnableReflect;                   // OPT_fspv_reflect

+ 1 - 1
include/dxc/Support/HLSLOptions.td

@@ -248,7 +248,7 @@ def fvk_u_shift : MultiArg<["-"], "fvk-u-shift", 2>, MetaVarName<"<shift> <space
   HelpText<"Specify Vulkan binding number shift for u-type register">;
   HelpText<"Specify Vulkan binding number shift for u-type register">;
 def fvk_invert_y: Flag<["-"], "fvk-invert-y">, Group<spirv_Group>, Flags<[CoreOption, DriverOption]>,
 def fvk_invert_y: Flag<["-"], "fvk-invert-y">, Group<spirv_Group>, Flags<[CoreOption, DriverOption]>,
   HelpText<"Negate SV_Position.y before writing to stage output in VS/DS/GS to accommodate Vulkan's coordinate system">;
   HelpText<"Negate SV_Position.y before writing to stage output in VS/DS/GS to accommodate Vulkan's coordinate system">;
-def fvk_invert_w: Flag<["-"], "fvk-invert-w">, Group<spirv_Group>, Flags<[CoreOption, DriverOption]>,
+def fvk_use_dx_position_w: Flag<["-"], "fvk-use-dx-position-w">, Group<spirv_Group>, Flags<[CoreOption, DriverOption]>,
   HelpText<"Reciprocate SV_Position.w after reading from stage input in PS to accommodate the difference between Vulkan and DirectX">;
   HelpText<"Reciprocate SV_Position.w after reading from stage input in PS to accommodate the difference between Vulkan and DirectX">;
 def fvk_use_gl_layout: Flag<["-"], "fvk-use-gl-layout">, Group<spirv_Group>, Flags<[CoreOption, DriverOption]>,
 def fvk_use_gl_layout: Flag<["-"], "fvk-use-gl-layout">, Group<spirv_Group>, Flags<[CoreOption, DriverOption]>,
   HelpText<"Use strict OpenGL std140/std430 memory layout for Vulkan resources">;
   HelpText<"Use strict OpenGL std140/std430 memory layout for Vulkan resources">;

+ 2 - 2
lib/DxcSupport/HLSLOptions.cpp

@@ -505,7 +505,7 @@ int ReadDxcOpts(const OptTable *optionTable, unsigned flagsToInclude,
 #ifdef ENABLE_SPIRV_CODEGEN
 #ifdef ENABLE_SPIRV_CODEGEN
   const bool genSpirv = opts.GenSPIRV = Args.hasFlag(OPT_spirv, OPT_INVALID, false);
   const bool genSpirv = opts.GenSPIRV = Args.hasFlag(OPT_spirv, OPT_INVALID, false);
   opts.VkInvertY = Args.hasFlag(OPT_fvk_invert_y, OPT_INVALID, false);
   opts.VkInvertY = Args.hasFlag(OPT_fvk_invert_y, OPT_INVALID, false);
-  opts.VkInvertW = Args.hasFlag(OPT_fvk_invert_w, OPT_INVALID, false);
+  opts.VkInvertW = Args.hasFlag(OPT_fvk_use_dx_position_w, OPT_INVALID, false);
   opts.VkUseGlLayout = Args.hasFlag(OPT_fvk_use_gl_layout, OPT_INVALID, false);
   opts.VkUseGlLayout = Args.hasFlag(OPT_fvk_use_gl_layout, OPT_INVALID, false);
   opts.VkUseDxLayout = Args.hasFlag(OPT_fvk_use_dx_layout, OPT_INVALID, false);
   opts.VkUseDxLayout = Args.hasFlag(OPT_fvk_use_dx_layout, OPT_INVALID, false);
   opts.SpvEnableReflect = Args.hasFlag(OPT_fspv_reflect, OPT_INVALID, false);
   opts.SpvEnableReflect = Args.hasFlag(OPT_fspv_reflect, OPT_INVALID, false);
@@ -571,7 +571,7 @@ int ReadDxcOpts(const OptTable *optionTable, unsigned flagsToInclude,
 #else
 #else
   if (Args.hasFlag(OPT_spirv, OPT_INVALID, false) ||
   if (Args.hasFlag(OPT_spirv, OPT_INVALID, false) ||
       Args.hasFlag(OPT_fvk_invert_y, OPT_INVALID, false) ||
       Args.hasFlag(OPT_fvk_invert_y, OPT_INVALID, false) ||
-      Args.hasFlag(OPT_fvk_invert_w, OPT_INVALID, false) ||
+      Args.hasFlag(OPT_fvk_use_dx_position_w, OPT_INVALID, false) ||
       Args.hasFlag(OPT_fvk_use_gl_layout, OPT_INVALID, false) ||
       Args.hasFlag(OPT_fvk_use_gl_layout, OPT_INVALID, false) ||
       Args.hasFlag(OPT_fvk_use_dx_layout, OPT_INVALID, false) ||
       Args.hasFlag(OPT_fvk_use_dx_layout, OPT_INVALID, false) ||
       Args.hasFlag(OPT_fspv_reflect, OPT_INVALID, false) ||
       Args.hasFlag(OPT_fspv_reflect, OPT_INVALID, false) ||

+ 2 - 2
tools/clang/test/CodeGenSPIRV/vk.cloption.invert-w.ds.hlsl

@@ -1,4 +1,4 @@
-// Run: %dxc -T ds_6_0 -E main -fvk-invert-w
+// Run: %dxc -T ds_6_0 -E main -fvk-use-dx-position-w
 
 
 // HS PCF output
 // HS PCF output
 struct HsPcfOut {
 struct HsPcfOut {
@@ -24,6 +24,6 @@ DsCpOut main(OutputPatch<DsCpIn, 3> patch,
   return dsOut;
   return dsOut;
 }
 }
 
 
-// Make sure -fvk-invert-w is ignored for non-PS stages
+// Make sure -fvk-use-dx-position-w is ignored for non-PS stages
 // CHECK:     OpLoad %_arr_v4float_uint_3 %gl_Position
 // CHECK:     OpLoad %_arr_v4float_uint_3 %gl_Position
 // CHECK-NOT: OpCompositeInsert %v4float {{%\d+}} {{%\d+}} 3
 // CHECK-NOT: OpCompositeInsert %v4float {{%\d+}} {{%\d+}} 3

+ 1 - 1
tools/clang/test/CodeGenSPIRV/vk.cloption.invert-w.ps.hlsl

@@ -1,4 +1,4 @@
-// Run: %dxc -T ps_6_0 -E main -fvk-invert-w
+// Run: %dxc -T ps_6_0 -E main -fvk-use-dx-position-w
 
 
 float4 main(float4 pos: SV_Position) : SV_Target {
 float4 main(float4 pos: SV_Position) : SV_Target {
     return pos;
     return pos;