Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EX2 and LG2 only operate on scalar values #27

Open
neobrain opened this issue Aug 14, 2015 · 1 comment
Open

EX2 and LG2 only operate on scalar values #27

neobrain opened this issue Aug 14, 2015 · 1 comment

Comments

@neobrain
Copy link
Owner

Supposedly something like EX2 r0.y, r0.xyzw will not actually store the result in r0.y. This was reported in an IRC discussion in #3dsdev on efnet on August 14, 2015. The reason remains to be investigated, but chances are nihstro should provide a diagnostic of some sorts in this case.

; Example PICA200 vertex shader

; Uniforms
.fvec projection[4]

; Constants
.constf myconst(0.0, 1.0, -1.0, -0.5)
.alias  zeros myconst.xxxx ; Vector full of zeros
.alias  ones  myconst.yyyy ; Vector full of ones

; Outputs
.out outpos position
.out outclr color

; Inputs (defined as aliases for convenience)
.alias inpos v0

.proc main
    ; Force the w component of inpos to be 1.0
    mov r0.xyz, inpos.xyz
    ex2 r0.y, r0
    mov r0.w,   ones

    ; outpos = projectionMatrix * inpos
    dp4 outpos.x, projection[0], r0
    dp4 outpos.y, projection[1], r0
    dp4 outpos.z, projection[2], r0
    dp4 outpos.w, projection[3], r0

    ; outclr = solid white color
    mov outclr, ones

    ; We're finished
    end
.end
@neobrain
Copy link
Owner Author

After some further investigation by the person who reported this behavior initially, it seems that EX2 only computes the base-2-expontential of the first component of the source operand, and writes the result to all enabled output components.

It has been suggested , albeit not verified, that LG2 has a similar quirk.

@neobrain neobrain changed the title Investigate EX2 behavior with regards to the output mask EX2 and LG2 only operate on scalar values Oct 3, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant