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

Matteo Bruni matteo.mystral at gmail.com
Tue Nov 22 18:38:49 CST 2016


2016-11-22 11:56 GMT+01:00 Józef Kucia <joseph.kucia at gmail.com>:
> On Tue, Nov 22, 2016 at 2:00 AM, Matteo Bruni <matteo.mystral at gmail.com> wrote:
>>> 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?
>>
>> Notice that the RET instruction is also used for returning from
>> subroutines. Now, I don't know that anyone has ever used subroutines
>> in d3d shaders (especially for SM <= 3) but probably the correct thing
>> to do is to only generate an additional shader epilogue for RETs
>> called from the main function. That means keeping track of whether we
>> are in the main shader or in a subroutine (maybe by extending /
>> renaming struct wined3d_shader_loop_state) and only generating the
>> epilogue for RETs called from the main shader.
>
> Yeah, but generating a shader epilogue always in
> shader_glsl_generate_pshader() and shader_glsl_generate_vshader(),
> i.e. the current behavior should work fine for shader model <= 3. We
> will probably need to revisit this code when implementing tessellation
> shaders or SM4 subroutines.

Sure, generating the epilogue in the generation functions for SM <= 3
is fine with me. Still it seems sensible to implement the SM4 RET
correctly right away. Unless I'm missing something, you can set an
"in_subroutine" flag in the LABEL callback (you never need to unset it
afterwards actually, since the main shader is always at the start and
before any subroutine) and that should mostly do the trick.



More information about the wine-devel mailing list