icculus / mojoshader

Use Direct3D shaders with other 3D rendering APIs.
https://icculus.org/mojoshader/
zlib License
150 stars 37 forks source link

Fixing SM1 shaders on SPIR-V after TEX* opcodes changes #33

Closed krolli closed 4 years ago

krolli commented 4 years ago

I ran into two problems:

  1. SPIR-V emittor relies on input attributes implied by ps_1_3 (and below) TEX* opcodes, but those have been recently removed, causing SPIR-V emittor to produce invalid binaries. However, once that was fixed, I noticed that some shaders were declaring these implicit input multiple times. Which brings me to ...
  2. Only TEX opcode had its implicit input attribute removed. However, other TEX* opcodes (TEXBEM, etc.) have not only been still adding theirs, they were also re-adding those from TEX.

Both problems are fixed by the PR, but it might be worth discussing problem 2. with Ryan, as I'm only guessing his intention was to remove these implicit attributes everywhere.

flibitijibibo commented 4 years ago

Commit in question: https://github.com/FNA-XNA/MojoShader/commit/1d735fd921a9d3f7fa3e038d0ea159b2efd9eb09

Will send this for review...

icculus commented 4 years ago

These patches look good to me; feel free to push them upstream!

flibitijibibo commented 4 years ago

Applied to upstream: https://hg.icculus.org/icculus/mojoshader/rev/02d36217591b