mob-sakai / SoftMaskForUGUI

Enhance Unity UI (uGUI) with advanced soft-masking features to create more visually appealing effects!
https://github.com/mob-sakai/SoftMaskForUGUI
MIT License
1.91k stars 257 forks source link

Unity 2020.3.22 Editor + Vulkan API = SoftMaskable shader error #129

Closed dmitry-lebedev closed 2 years ago

dmitry-lebedev commented 2 years ago

This part of code from SoftMask.cginc produces shader error in Editor if Vulkan API is selected.

Code:

       #if SOFTMASK_EDITOR
    alpha *= step(0, view.x) * step(view.x, 1) * step(0, view.y) * step(view.y, 1);
    #endif

Error:

Shader error in 'Hidden/UI/Default (SoftMaskable)': Program 'frag', error X8000: D3D11 Internal Compiler Error: Invalid Bytecode: Incompatible min precision type for operand #1 of opcode #76 (counts are 1-based). Expected int or uint. at line 49 (on vulkan)

Solution:

Update this part code with float usage, instead of fixed2. For example

        #if SOFTMASK_EDITOR
    float2 tview = float2(view.x, view.y);
    alpha *= step(0, tview.x) * step(tview.x, 1) * step(0, tview.y) * step(tview.y, 1);
    #endif
nindim commented 2 years ago

This is linked to this bug: https://github.com/mob-sakai/SoftMaskForUGUI/issues/131

I have also proposed an alternative solution here: https://github.com/mob-sakai/SoftMaskForUGUI/issues/131#issuecomment-1002696415