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

samplerExternalOES support, "Inline" code added to shader output #38

Open
Wunkolo opened this issue Nov 21, 2018 · 1 comment
Open

samplerExternalOES support, "Inline" code added to shader output #38

Wunkolo opened this issue Nov 21, 2018 · 1 comment

Comments

@Wunkolo
Copy link

Wunkolo commented Nov 21, 2018

This is a pretty popularly used feature for any shader that reads from a video/external texture and is pretty essential for mobile performance. Unity seems to have "abandoned" glsl support and those of us targeting multiple platforms are forced to pick one or the other(CG/HLSL or GLSL) or double the maintenance by maintaining both.

Since HLSLcc reads directly from DirectX bytecode, I do not think it is possible to propagate a samplerExternalOES resource type into the sampler declarations directly from shader source code, though maybe an "awkward" solution is by naming a variable a certain way to get it to emit the GLSL code or utilizing something like D3D10_SB_OPCODE_CUSTOMDATA or some other metadata structure to propagate certain text data from Unity's CG/HLSL shaders directly into the emitted GLSL code(kind of like an inline assembly of sorts so that from a unity shader I can put some text between a preprocessor of sorts which puts metadata into a CUSTOMDATA block for HLSLcc to handle and emit specialized code for metal or glsl and such).

@GiantSox
Copy link

I would love this. I'm struggling to figure out a way to unify our ShaderLab/CG shaders with our GLSL shaders. I'm willing to go as far as doing a build-time find-and-replace on the generated GLSL shader to insert the samplerExternalOES text but it doesn't seem like Unity provides an API for accessing the generated code.

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

2 participants