ComputeBuffers in OpenGLES 3.1 Shader

Hi everyone,

I’m curious about something. I’m using structured buffers to send data in a vert/frag shader wrapped in a DX11 api check.

With the new experimental OpenGL stuff I was hoping that those might “just work” like compute shaders. This is sadly not the case.

Has anyone else tried this? From what I understand about OpenGL(which isn’t a lot), there isn’t an exact cross over for DX StructuredBuffers, but is there something else that Unity’s compute buffers will work with?

Update!

It turns out using surface shaders are what’s failing, not the structured buffer conversion:

This works just fine:

            CGPROGRAM
            #include "UnityCG.cginc"
            #pragma vertex vert
            #pragma fragment frag
            #pragma target 5.0

            StructuredBuffer<float4> Buffer_A;

This does not:

CGPROGRAM

       
        #include "UnityCG.cginc"
       
        #pragma surface surf StandardSpecular vertex:vert
        #pragma target 5.0

        StructuredBuffer<float4> Buffer_A;

it fails at the line StructuredBuffer with “Syntax Error”