[v2 1/3] wined3d: Implement return instruction.

Józef Kucia joseph.kucia at gmail.com
Sun Nov 20 18:46:12 CST 2016


On Fri, Nov 18, 2016 at 6:46 AM, Andrew Wesie <awesie at gmail.com> wrote:
> --- a/dlls/wined3d/shader.c
> +++ b/dlls/wined3d/shader.c
> @@ -2028,6 +2028,7 @@ void shader_generate_main(const struct wined3d_shader *shader, struct wined3d_st
>      struct wined3d_shader_tex_mx tex_mx;
>      struct wined3d_shader_context ctx;
>      const DWORD *ptr = byte_code;
> +    enum WINED3D_SHADER_INSTRUCTION_HANDLER last_opcode = WINED3DSIH_TABLE_SIZE;
>
>      /* Initialize current parsing state. */
>      tex_mx.current_row = 0;
> @@ -2062,6 +2063,16 @@ void shader_generate_main(const struct wined3d_shader *shader, struct wined3d_st
>
>          /* Call appropriate function for output target */
>          device->shader_backend->shader_handle_instruction(&ins);
> +        last_opcode = ins.handler_idx;
> +    }
> +
> +    if (last_opcode != WINED3DSIH_RET)
> +    {
> +        /* Force a return instruction at the end of function body. */
> +        memset(&ins, 0, sizeof(ins));
> +        ins.ctx = &ctx;
> +        ins.handler_idx = WINED3DSIH_RET;
> +        device->shader_backend->shader_handle_instruction(&ins);
>      }
>  }

Would it make sense to always generate a shader epilogue for shader
model <= 3, and handle the RET instruction in a special way for shader
model >= 4?



More information about the wine-devel mailing list