Home | History | Annotate | Download | only in shaders
      1 case per_patch_array_of_structs
      2 	version 310 es
      3 	desc "per-patch variable type is array of structs"
      4 	expect compile_or_link_fail
      5 	require extension { "GL_OES_tessellation_shader" | "GL_EXT_tessellation_shader" } in { tessellation_control, tessellation_evaluation }
      6 	vertex ""
      7 		#version 310 es
      8 		${VERTEX_DECLARATIONS}
      9 		void main()
     10 		{
     11 			${VERTEX_OUTPUT}
     12 		}
     13 	""
     14 	tessellation_control ""
     15 		#version 310 es
     16 		${TESSELLATION_CONTROL_DECLARATIONS}
     17 		struct S
     18 		{
     19 			highp float a;
     20 			highp vec2 b;
     21 		};
     22 		patch out S patchVariable[2]; // array of structures is illegal
     23 		void main()
     24 		{
     25 			patchVariable[0].a = gl_in[0].gl_Position.x;
     26 			patchVariable[0].b = gl_in[0].gl_Position.yz;
     27 			patchVariable[1].a = gl_in[0].gl_Position.z;
     28 			patchVariable[1].b = gl_in[0].gl_Position.wx;
     29 			${TESSELLATION_CONTROL_OUTPUT}
     30 		}
     31 	""
     32 	tessellation_evaluation ""
     33 		#version 310 es
     34 		${TESSELLATION_EVALUATION_DECLARATIONS}
     35 		struct S
     36 		{
     37 			highp float a;
     38 			highp vec2 b;
     39 		};
     40 		patch in S patchVariable[2]; // array of structures is illegal
     41 		out mediump float te_out;
     42 		void main()
     43 		{
     44 			te_out = patchVariable[0].a + patchVariable[1].b.y;
     45 			${TESSELLATION_EVALUATION_OUTPUT}
     46 		}
     47 	""
     48 	fragment ""
     49 		#version 310 es
     50 		precision mediump float;
     51 		${FRAGMENT_DECLARATIONS}
     52 		in mediump float te_out;
     53 		void main()
     54 		{
     55 			${FRAG_COLOR} = vec4(te_out);
     56 		}
     57 	""
     58 end
     59 
     60 case per_patch_structs_containing_arrays
     61 	version 310 es
     62 	desc "per-patch variable type is struct containing array"
     63 	expect compile_or_link_fail
     64 	require extension { "GL_OES_tessellation_shader" | "GL_EXT_tessellation_shader" } in { tessellation_control, tessellation_evaluation }
     65 	vertex ""
     66 		#version 310 es
     67 		${VERTEX_DECLARATIONS}
     68 		void main()
     69 		{
     70 			${VERTEX_OUTPUT}
     71 		}
     72 	""
     73 	tessellation_control ""
     74 		#version 310 es
     75 		${TESSELLATION_CONTROL_DECLARATIONS}
     76 		struct S
     77 		{
     78 			highp float a;
     79 			highp float b[2];
     80 		};
     81 		patch out S patchVariable; // output structure containing array is illegal
     82 		void main()
     83 		{
     84 			patchVariable.a = gl_in[0].gl_Position.x;
     85 			patchVariable.b[0] = gl_in[0].gl_Position.y;
     86 			patchVariable.b[1] = gl_in[0].gl_Position.w;
     87 			${TESSELLATION_CONTROL_OUTPUT}
     88 		}
     89 	""
     90 	tessellation_evaluation ""
     91 		#version 310 es
     92 		${TESSELLATION_EVALUATION_DECLARATIONS}
     93 		struct S
     94 		{
     95 			highp float a;
     96 			highp float b[2];
     97 		};
     98 		patch in S patchVariable; // output structure containing array is illegal
     99 		out mediump float te_out;
    100 		void main()
    101 		{
    102 			te_out = patchVariable.a + patchVariable.b[1];
    103 			${TESSELLATION_EVALUATION_OUTPUT}
    104 		}
    105 	""
    106 	fragment ""
    107 		#version 310 es
    108 		precision mediump float;
    109 		${FRAGMENT_DECLARATIONS}
    110 		in mediump float te_out;
    111 		void main()
    112 		{
    113 			${FRAG_COLOR} = vec4(te_out);
    114 		}
    115 	""
    116 end
    117