=?UTF-8?Q?J=C3=B3zef=20Kucia=20?=: vkd3d-shader: Simplify DepthReplacing execution mode handling.

Alexandre Julliard julliard at winehq.org
Fri Oct 19 15:35:33 CDT 2018


Module: vkd3d
Branch: master
Commit: 299f126f7ae82bcbf03cc32789557b78ffd03ccb
URL:    https://source.winehq.org/git/vkd3d.git/?a=commit;h=299f126f7ae82bcbf03cc32789557b78ffd03ccb

Author: Józef Kucia <jkucia at codeweavers.com>
Date:   Fri Oct 19 16:55:50 2018 +0200

vkd3d-shader: Simplify DepthReplacing execution mode handling.

Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 libs/vkd3d-shader/spirv.c | 36 +-----------------------------------
 1 file changed, 1 insertion(+), 35 deletions(-)

diff --git a/libs/vkd3d-shader/spirv.c b/libs/vkd3d-shader/spirv.c
index 63ef7c2..8508741 100644
--- a/libs/vkd3d-shader/spirv.c
+++ b/libs/vkd3d-shader/spirv.c
@@ -248,14 +248,6 @@ struct vkd3d_spirv_builder
 
     struct vkd3d_spirv_stream execution_mode_stream; /* execution mode instructions */
 
-    union
-    {
-        struct
-        {
-            bool depth_replacing;
-        } fragment;
-    } u;
-
     struct vkd3d_spirv_stream original_function_stream;
     struct vkd3d_spirv_stream insertion_stream;
     size_t insertion_location;
@@ -332,13 +324,6 @@ static void vkd3d_spirv_set_execution_model(struct vkd3d_spirv_builder *builder,
     }
 }
 
-static void vkd3d_spirv_enable_depth_replacing(struct vkd3d_spirv_builder *builder)
-{
-    assert(builder->execution_model == SpvExecutionModelFragment);
-
-    builder->u.fragment.depth_replacing = true;
-}
-
 static uint32_t vkd3d_spirv_opcode_word(SpvOp op, unsigned int word_count)
 {
     assert(!(op & ~SpvOpCodeMask));
@@ -1568,24 +1553,6 @@ static void vkd3d_spirv_builder_free(struct vkd3d_spirv_builder *builder)
     vkd3d_free(builder->iface);
 }
 
-static void vkd3d_spirv_build_additional_execution_modes(struct vkd3d_spirv_builder *builder,
-        struct vkd3d_spirv_stream *stream)
-{
-    const uint32_t function_id = builder->main_function_id;
-
-    switch (builder->execution_model)
-    {
-        case SpvExecutionModelFragment:
-            if (builder->u.fragment.depth_replacing)
-                vkd3d_spirv_build_op_execution_mode(stream, function_id,
-                        SpvExecutionModeDepthReplacing, NULL, 0);
-            break;
-
-        default:
-            break;
-    }
-}
-
 static bool vkd3d_spirv_compile_module(struct vkd3d_spirv_builder *builder,
         struct vkd3d_shader_code *spirv)
 {
@@ -1627,7 +1594,6 @@ static bool vkd3d_spirv_compile_module(struct vkd3d_spirv_builder *builder,
 
     /* execution mode declarations */
     vkd3d_spirv_stream_append(&stream, &builder->execution_mode_stream);
-    vkd3d_spirv_build_additional_execution_modes(builder, &stream);
 
     vkd3d_spirv_stream_append(&stream, &builder->debug_stream);
     vkd3d_spirv_stream_append(&stream, &builder->annotation_stream);
@@ -2922,7 +2888,7 @@ static void vkd3d_dxbc_compiler_decorate_builtin(struct vkd3d_dxbc_compiler *com
                 builtin = SpvBuiltInFragCoord;
             break;
         case SpvBuiltInFragDepth:
-            vkd3d_spirv_enable_depth_replacing(builder);
+            vkd3d_dxbc_compiler_emit_execution_mode(compiler, SpvExecutionModeDepthReplacing, NULL, 0);
             break;
         case SpvBuiltInLayer:
             vkd3d_spirv_enable_capability(builder, SpvCapabilityGeometry);




More information about the wine-cvs mailing list