Skip to content

[FXC] Shader Model 3 allows TEXKILL with input register #2

Open
@flibitijibibo

Description

@flibitijibibo

This is a follow-up issue for FNA-XNA/FNA#124.

From that issue...

The problem gets introduced when clip() is done directly on an input value, such as the TEXCOORD5 value in the very first pixel shader, which produces something like this:

        pixelshader = 
            asm {
            //
            // Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
                ps_3_0
                dcl_color v0
                dcl_texcoord5 v1
                texkill v1
                mov oC0, v0
            
            // approximately 2 instruction slots used
            };

The problem is that texkill against an input register is forbidden according to Microsoft's own documentation on the texkill instruction. In fact, if I change the shader model to 2.0 instead of 3.0, I get this...

        pixelshader = 
            asm {
            //
            // Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
                ps_2_0
                dcl v0
                dcl t5
                texkill t5
                mov oC0, v0
            
            // approximately 2 instruction slots used
            };

This is what we're actually expecting! So either the documentation we're looking at is outdated and only references SM2 or the SM3 compiler has a problem with this shader.

CC @mklingen

Metadata

Metadata

Assignees

No one assigned

    Labels

    invalidThis doesn't seem right

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions