Lines Matching refs:glsl_strbufs
180 struct vrend_glsl_strbufs glsl_strbufs; member
607 static void emit_indent(struct vrend_glsl_strbufs *glsl_strbufs) in emit_indent() argument
609 if (glsl_strbufs->indent_level > 0) { in emit_indent()
611 int indent_level = MIN2(glsl_strbufs->indent_level, 15); in emit_indent()
615 strbuf_append(&glsl_strbufs->glsl_main, buf); in emit_indent()
619 static void emit_buf(struct vrend_glsl_strbufs *glsl_strbufs, const char *buf) in emit_buf() argument
621 emit_indent(glsl_strbufs); in emit_buf()
622 strbuf_append(&glsl_strbufs->glsl_main, buf); in emit_buf()
625 static void indent_buf(struct vrend_glsl_strbufs *glsl_strbufs) in indent_buf() argument
627 glsl_strbufs->indent_level++; in indent_buf()
630 static void outdent_buf(struct vrend_glsl_strbufs *glsl_strbufs) in outdent_buf() argument
632 if (glsl_strbufs->indent_level <= 0) { in outdent_buf()
633 strbuf_set_error(&glsl_strbufs->glsl_main); in outdent_buf()
636 glsl_strbufs->indent_level--; in outdent_buf()
639 static void set_buf_error(struct vrend_glsl_strbufs *glsl_strbufs) in set_buf_error() argument
641 strbuf_set_error(&glsl_strbufs->glsl_main); in set_buf_error()
645 static void emit_buff(struct vrend_glsl_strbufs *glsl_strbufs, const char *fmt, ...) in emit_buff() argument
649 emit_indent(glsl_strbufs); in emit_buff()
650 strbuf_vappendf(&glsl_strbufs->glsl_main, fmt, va); in emit_buff()
654 static void emit_hdr(struct vrend_glsl_strbufs *glsl_strbufs, const char *buf) in emit_hdr() argument
656 strbuf_append(&glsl_strbufs->glsl_hdr, buf); in emit_hdr()
659 static void set_hdr_error(struct vrend_glsl_strbufs *glsl_strbufs) in set_hdr_error() argument
661 strbuf_set_error(&glsl_strbufs->glsl_hdr); in set_hdr_error()
665 static void emit_hdrf(struct vrend_glsl_strbufs *glsl_strbufs, const char *fmt, ...) in emit_hdrf() argument
669 strbuf_vappendf(&glsl_strbufs->glsl_hdr, fmt, va); in emit_hdrf()
673 static void emit_ver_ext(struct vrend_glsl_strbufs *glsl_strbufs, const char *buf) in emit_ver_ext() argument
675 strbuf_append(&glsl_strbufs->glsl_ver_ext, buf); in emit_ver_ext()
679 static void emit_ver_extf(struct vrend_glsl_strbufs *glsl_strbufs, const char *fmt, ...) in emit_ver_extf() argument
683 strbuf_vappendf(&glsl_strbufs->glsl_ver_ext, fmt, va); in emit_ver_extf()
1756 struct vrend_glsl_strbufs *glsl_strbufs) in emit_cbuf_writes() argument
1761 emit_buff(glsl_strbufs, "fsout_c%d = fsout_c0;\n", i); in emit_cbuf_writes()
1765 static void emit_a8_swizzle(struct vrend_glsl_strbufs *glsl_strbufs) in emit_a8_swizzle() argument
1767 emit_buf(glsl_strbufs, "fsout_c0.x = fsout_c0.w;\n"); in emit_a8_swizzle()
1782 struct vrend_glsl_strbufs *glsl_strbufs) in emit_alpha_test() argument
1809 set_buf_error(glsl_strbufs); in emit_alpha_test()
1813 emit_buff(glsl_strbufs, "if (!(%s)) {\n\tdiscard;\n}\n", comp_buf); in emit_alpha_test()
1816 static void emit_pstipple_pass(struct vrend_glsl_strbufs *glsl_strbufs) in emit_pstipple_pass() argument
1818 …emit_buf(glsl_strbufs, "stip_temp = texture(pstipple_sampler, vec2(gl_FragCoord.x / 32.0, gl_FragC… in emit_pstipple_pass()
1819 emit_buf(glsl_strbufs, "if (stip_temp > 0.0) {\n\tdiscard;\n}\n"); in emit_pstipple_pass()
1823 struct vrend_glsl_strbufs *glsl_strbufs) in emit_color_select() argument
1829 emit_buf(glsl_strbufs, "realcolor0 = gl_FrontFacing ? ex_c0 : ex_bc0;\n"); in emit_color_select()
1832 emit_buf(glsl_strbufs, "realcolor1 = gl_FrontFacing ? ex_c1 : ex_bc1;\n"); in emit_color_select()
1835 static void emit_prescale(struct vrend_glsl_strbufs *glsl_strbufs) in emit_prescale() argument
1837 emit_buf(glsl_strbufs, "gl_Position.y = gl_Position.y * winsys_adjust_y;\n"); in emit_prescale()
1906 struct vrend_glsl_strbufs *glsl_strbufs, in emit_so_movs() argument
1915 set_buf_error(glsl_strbufs); in emit_so_movs()
1968 … emit_buff(glsl_strbufs, "tfout%d = %s(clip_dist_temp[%d]%s);\n", i, outtype, output->sid, in emit_so_movs()
1971 emit_buff(glsl_strbufs, "tfout%d = %s(clip_dist_temp[%d]%s);\n", i, outtype, in emit_so_movs()
1980 emit_buff(glsl_strbufs, "tfout%d = %s(%s);\n", i, outtype, out_var); in emit_so_movs()
1992 struct vrend_glsl_strbufs *glsl_strbufs) in emit_clip_dist_movs() argument
2003 …emit_buff(glsl_strbufs, "%sgl_ClipDistance[%d] = dot(%s, clipp[%d]);\n", prefix, i, ctx->has_clipv… in emit_clip_dist_movs()
2027 emit_buff(glsl_strbufs, "%sgl_%sDistance[%d] = clip_dist_temp[%d].%c;\n", prefix, clip_cull, in emit_clip_dist_movs()
2032 #define emit_arit_op2(op) emit_buff(&ctx->glsl_strbufs, "%s = %s(%s((%s %s %s))%s);\n", dsts[0], ge…
2033 #define emit_op1(op) emit_buff(&ctx->glsl_strbufs, "%s = %s(%s(%s(%s))%s);\n", dsts[0], get_string(…
2034 #define emit_compare(op) emit_buff(&ctx->glsl_strbufs, "%s = %s(%s((%s(%s(%s), %s(%s))))%s);\n", ds…
2036 #define emit_ucompare(op) emit_buff(&ctx->glsl_strbufs, "%s = %s(uintBitsToFloat(%s(%s(%s(%s), %s(%…
2039 struct vrend_glsl_strbufs *glsl_strbufs, in handle_vertex_proc_exit() argument
2043 emit_so_movs(ctx, glsl_strbufs, has_clipvertex_so); in handle_vertex_proc_exit()
2045 emit_clip_dist_movs(ctx, glsl_strbufs); in handle_vertex_proc_exit()
2048 emit_prescale(glsl_strbufs); in handle_vertex_proc_exit()
2052 struct vrend_glsl_strbufs *glsl_strbufs) in emit_fragment_logicop() argument
2168 emit_buff(glsl_strbufs, "fsout_c%d = %s;\n", i, full_op[i]); in emit_fragment_logicop()
2171 … emit_buff(glsl_strbufs, "fsout_c%d = vec4((%s) & %d) / %f;\n", i, full_op[i], mask[i], scale[i]); in emit_fragment_logicop()
2177 struct vrend_glsl_strbufs *glsl_strbufs) in emit_cbuf_swizzle() argument
2181 emit_buff(glsl_strbufs, "fsout_c%d = fsout_c%d.zyxw;\n", i, i); in emit_cbuf_swizzle()
2187 struct vrend_glsl_strbufs *glsl_strbufs) in handle_fragment_proc_exit() argument
2190 emit_pstipple_pass(glsl_strbufs); in handle_fragment_proc_exit()
2193 emit_a8_swizzle(glsl_strbufs); in handle_fragment_proc_exit()
2196 emit_alpha_test(ctx, glsl_strbufs); in handle_fragment_proc_exit()
2200 emit_fragment_logicop(ctx, glsl_strbufs); in handle_fragment_proc_exit()
2203 emit_cbuf_swizzle(ctx, glsl_strbufs); in handle_fragment_proc_exit()
2206 emit_cbuf_writes(ctx, glsl_strbufs); in handle_fragment_proc_exit()
2217 set_buf_error(&ctx->glsl_strbufs); in set_texture_reqs()
2274 emit_buff(&ctx->glsl_strbufs, "%s%s = %s(textureQueryLevels(%s));\n", dst, in emit_txq()
2321 emit_buff(&ctx->glsl_strbufs, "%s%s = %s(textureSize(%s%s))%s;\n", dst, in emit_txq()
2343 set_buf_error(&ctx->glsl_strbufs); in emit_txqs()
2347 emit_buff(&ctx->glsl_strbufs, "%s = %s(textureSamples(%s));\n", dst, in emit_txqs()
2715 set_buf_error(&ctx->glsl_strbufs); in translate_tex()
2720 set_buf_error(&ctx->glsl_strbufs); in translate_tex()
2766 … emit_buff(&ctx->glsl_strbufs, "%s = %s(%s(texelFetch%s(%s, ivec2(%s(%s%s), 0)%s%s)%s));\n", in translate_tex()
2773 … emit_buff(&ctx->glsl_strbufs, "%s = %s(%s(texelFetch%s(%s, ivec3(%s(%s%s), 0).xzy%s%s)%s));\n", in translate_tex()
2779 emit_buff(&ctx->glsl_strbufs, "%s = %s(%s(texelFetch%s(%s, %s(%s%s), 0%s)%s));\n", in translate_tex()
2786 emit_buff(&ctx->glsl_strbufs, "%s = %s(%s(texelFetch%s(%s, %s(%s%s)%s%s)%s));\n", in translate_tex()
2795 emit_buff(&ctx->glsl_strbufs, "%s = texture2DRect(%s, %s.xy)%s;\n", in translate_tex()
2798 emit_buff(&ctx->glsl_strbufs, "%s = shadow2DRect(%s, %s.xyz)%s;\n", in translate_tex()
2809 …emit_buff(&ctx->glsl_strbufs, "%s = %s(%s(vec4(vec4(texture%s(%s, vec4(%s%s.xzw, 0).xwyz %s%s)) * … in translate_tex()
2816 …emit_buff(&ctx->glsl_strbufs, "%s = %s(%s(vec4(vec4(texture%s(%s, vec3(%s%s.xz, 0).xzy %s%s)) * %s… in translate_tex()
2823 …emit_buff(&ctx->glsl_strbufs, "%s = %s(%s(vec4(vec4(texture%s(%s, vec4(%s%s, 0).xwyz %s%s)) * %ssh… in translate_tex()
2831 …emit_buff(&ctx->glsl_strbufs, "%s = %s(%s(vec4(vec4(texture%s(%s, %s%s%s%s)) * %sshadmask%d + %ssh… in translate_tex()
2846 … emit_buff(&ctx->glsl_strbufs, "%s = %s(%s(texture%s(%s, vec3(%s.xw, 0).xzy %s%s)%s));\n", in translate_tex()
2852 … emit_buff(&ctx->glsl_strbufs, "%s = %s(%s(texture%s(%s, vec2(%s%s, 0.5) %s%s)%s));\n", in translate_tex()
2859 … emit_buff(&ctx->glsl_strbufs, "%s = %s(%s(texture%s(%s, vec3(%s.x / %s.w, 0, %s.y) %s%s)%s));\n", in translate_tex()
2865 … emit_buff(&ctx->glsl_strbufs, "%s = %s(%s(texture%s(%s, vec3(%s%s, 0).xzy %s%s)%s));\n", in translate_tex()
2872 emit_buff(&ctx->glsl_strbufs, "%s = %s(%s(texture%s(%s, %s%s%s%s)%s));\n", in translate_tex()
3022 static void emit_store_mem(struct vrend_glsl_strbufs *glsl_strbufs, const char *dst, int writemask, in emit_store_mem() argument
3028 emit_buff(glsl_strbufs, "%s[(uint(floatBitsToUint(%s)) >> 2) + %du] = %s(%s).%c;\n", in emit_store_mem()
3036 struct vrend_glsl_strbufs *glsl_strbufs, in translate_store() argument
3067 emit_buff(glsl_strbufs, "imageStore(%s,%s(%s(%s)),%s%s(%s));\n", in translate_store()
3075 emit_buff(glsl_strbufs, "switch (addr%d + %d) {\n", dst_reg->Indirect.Index, in translate_store()
3080 … emit_buff(glsl_strbufs, "case %d: imageStore(%simg%d[%d],%s(%s(%s)),%s%s(%s)); break;\n", in translate_store()
3085 emit_buff(glsl_strbufs, "}\n"); in translate_store()
3098 emit_store_mem(glsl_strbufs, dst, dst_reg->Register.WriteMask, srcs, in translate_store()
3108 emit_buff(glsl_strbufs, "switch (addr%d + %d) {\n", dst_reg->Indirect.Index, in translate_store()
3113 emit_buff(glsl_strbufs, "case %d:\n", i); in translate_store()
3115 emit_store_mem(glsl_strbufs, dst_tmp, dst_reg->Register.WriteMask, srcs, in translate_store()
3117 emit_buff(glsl_strbufs, "break;\n"); in translate_store()
3119 emit_buf(glsl_strbufs, "}\n"); in translate_store()
3124 static void emit_load_mem(struct vrend_glsl_strbufs *glsl_strbufs, const char *dst, int writemask, in emit_load_mem() argument
3131 emit_buff(glsl_strbufs, "%s.%c = (%s(%s(%s[ssbo_addr_temp + %du]%s)));\n", dst, in emit_load_mem()
3140 struct vrend_glsl_strbufs *glsl_strbufs, in translate_load() argument
3187 emit_buff(glsl_strbufs, "%s = %s(imageLoad(%s, %s(%s(%s))%s)%s);\n", in translate_load()
3197 …emit_buff(glsl_strbufs, "switch (addr%d + %d) {\n", inst->Src[0].Indirect.Index, inst->Src[0].Regi… in translate_load()
3202 emit_buff(glsl_strbufs, "case %d: %s = %s(imageLoad(%s, %s(%s(%s))%s)%s);break;\n", in translate_load()
3207 emit_buff(glsl_strbufs, "}\n"); in translate_load()
3222 emit_buff(glsl_strbufs, "ssbo_addr_temp = uint(floatBitsToUint(%s)) >> 2;\n", srcs[1]); in translate_load()
3234 …emit_load_mem(glsl_strbufs, mydst, inst->Dst[0].Register.WriteMask, get_string(dtypeprefix), atomi… in translate_load()
3245 …emit_buff(glsl_strbufs, "switch (addr%d + %d) {\n", inst->Src[0].Indirect.Index, inst->Src[0].Regi… in translate_load()
3247 emit_buff(glsl_strbufs, "case %d:\n", i); in translate_load()
3249 …emit_load_mem(glsl_strbufs, mydst, inst->Dst[0].Register.WriteMask, get_string(dtypeprefix), atomi… in translate_load()
3250 emit_buff(glsl_strbufs, " break;\n"); in translate_load()
3252 emit_buf(glsl_strbufs, "}\n"); in translate_load()
3255 emit_buff(glsl_strbufs, "%s = uintBitsToFloat(atomicCounter(%s));\n", dst, srcs[0]); in translate_load()
3312 emit_buff(&ctx->glsl_strbufs, "%s = %s(imageSamples(%s));\n", in translate_resq()
3322 emit_buff(&ctx->glsl_strbufs, "%s = %s(imageSize(%s)%s%s);\n", in translate_resq()
3327 emit_buff(&ctx->glsl_strbufs, "%s = %s(int(%s.length()) << 2);\n", in translate_resq()
3379 set_buf_error(&ctx->glsl_strbufs); in translate_atomic()
3396 emit_buff(&ctx->glsl_strbufs, "%s = %s(imageAtomic%s(%s, %s(%s(%s))%s, %s(%s(%s))%s));\n", in translate_atomic()
3407 …emit_buff(&ctx->glsl_strbufs, "switch (addr%d + %d) {\n", inst->Src[0].Indirect.Index, inst->Src[0… in translate_atomic()
3412 …emit_buff(&ctx->glsl_strbufs, "case %d: %s = %s(imageAtomic%s(%s, %s(%s(%s))%s, %s(%s(%s))%s));\n", in translate_atomic()
3418 emit_buff(&ctx->glsl_strbufs, "}\n"); in translate_atomic()
3435 …emit_buff(&ctx->glsl_strbufs, "%s = %s(atomic%s(%s[int(floatBitsToInt(%s)) >> 2], %s(%s(%s).x)%s))… in translate_atomic()
3441 emit_buff(&ctx->glsl_strbufs, "%s = %s(atomicCounterDecrement(%s) + 1u);\n", in translate_atomic()
3444 emit_buff(&ctx->glsl_strbufs, "%s = %s(atomicCounterIncrement(%s));\n", in translate_atomic()
3447 … emit_buff(&ctx->glsl_strbufs, "%s = %s(atomicCounter%sARB(%s, floatBitsToUint(%s).x%s));\n", in translate_atomic()
4335 …emit_buff(&ctx->glsl_strbufs, "%s.x = %spackDouble2x32(uvec2(%s%s))%s;\n", src_buf->buf, isabsolut… in get_source_info()
4567 struct vrend_glsl_strbufs *glsl_strbufs) in emit_fs_clipdistance_load() argument
4602 …emit_buff(glsl_strbufs, "clip_dist_temp[%d].%c = %sgl_%sDistance[%d];\n", clipidx, wm, prefix, cli… in emit_fs_clipdistance_load()
4824 emit_buf(&ctx->glsl_strbufs, "void main(void)\n{\n"); in iter_instruction()
4826 emit_color_select(ctx, &ctx->glsl_strbufs); in iter_instruction()
4828 emit_fs_clipdistance_load(ctx, &ctx->glsl_strbufs); in iter_instruction()
4857 emit_buff(&ctx->glsl_strbufs, "%s = sqrt(vec4(%s))%s;\n", dsts[0], srcs[0], writemask); in iter_instruction()
4860 …emit_buff(&ctx->glsl_strbufs, "%s = mix(vec4(%s), vec4(%s), vec4(%s))%s;\n", dsts[0], srcs[2], src… in iter_instruction()
4863 …emit_buff(&ctx->glsl_strbufs, "%s = %s(dot(vec2(%s), vec2(%s)));\n", dsts[0], get_string(dinfo.dst… in iter_instruction()
4866 …emit_buff(&ctx->glsl_strbufs, "%s = %s(dot(vec3(%s), vec3(%s)));\n", dsts[0], get_string(dinfo.dst… in iter_instruction()
4869 …emit_buff(&ctx->glsl_strbufs, "%s = %s(dot(vec4(%s), vec4(%s)));\n", dsts[0], get_string(dinfo.dst… in iter_instruction()
4872 …emit_buff(&ctx->glsl_strbufs, "%s = %s(dot(vec4(vec3(%s), 1.0), vec4(%s)));\n", dsts[0], get_strin… in iter_instruction()
4878 …emit_buff(&ctx->glsl_strbufs, "%s = %s(%s(max(%s, %s))%s);\n", dsts[0], get_string(dinfo.dstconv),… in iter_instruction()
4884 …emit_buff(&ctx->glsl_strbufs, "%s = %s(%s(min(%s, %s))%s);\n", dsts[0], get_string(dinfo.dstconv),… in iter_instruction()
4892 emit_buff(&ctx->glsl_strbufs, "if (any(lessThan(%s, vec4(0.0))))\ndiscard;\n", srcs[0]); in iter_instruction()
4896 emit_buff(&ctx->glsl_strbufs, "if (bool(%s.x)) {\n", srcs[0]); in iter_instruction()
4897 indent_buf(&ctx->glsl_strbufs); in iter_instruction()
4900 outdent_buf(&ctx->glsl_strbufs); in iter_instruction()
4901 emit_buf(&ctx->glsl_strbufs, "} else {\n"); in iter_instruction()
4902 indent_buf(&ctx->glsl_strbufs); in iter_instruction()
4905 emit_buf(&ctx->glsl_strbufs, "}\n"); in iter_instruction()
4906 outdent_buf(&ctx->glsl_strbufs); in iter_instruction()
4909 emit_buff(&ctx->glsl_strbufs, "discard;\n"); in iter_instruction()
4912 emit_buff(&ctx->glsl_strbufs, "%s = vec4(1.0, %s.y * %s.y, %s.z, %s.w);\n", dsts[0], in iter_instruction()
4916 …emit_buff(&ctx->glsl_strbufs, "%s = %s(vec4(1.0, max(%s.x, 0.0), step(0.0, %s.x) * pow(max(0.0, %s… in iter_instruction()
4925 …emit_buff(&ctx->glsl_strbufs, "%s = %s(vec4(pow(2.0, floor(%s.x)), %s.x - floor(%s.x), exp2(%s.x),… in iter_instruction()
4928 …emit_buff(&ctx->glsl_strbufs, "%s = %s(vec4(floor(log2(%s.x)), %s.x / pow(2.0, floor(log2(%s.x))),… in iter_instruction()
4937 …emit_buff(&ctx->glsl_strbufs, "%s = %s(vec4(cos(%s.x), sin(%s.x), 0, 1)%s);\n", dsts[0], get_strin… in iter_instruction()
4955 …emit_buff(&ctx->glsl_strbufs, "%s = %s(1.0/(%s));\n", dsts[0], get_string(dinfo.dstconv), srcs[0]); in iter_instruction()
4958 …emit_buff(&ctx->glsl_strbufs, "%s = %s(1.0LF/(%s));\n", dsts[0], get_string(dinfo.dstconv), srcs[0… in iter_instruction()
4990 …emit_buff(&ctx->glsl_strbufs, "%s = %s(inversesqrt(%s.x));\n", dsts[0], get_string(dinfo.dstconv),… in iter_instruction()
4994 …emit_buff(&ctx->glsl_strbufs, "%s = %s(%s(%s%s));\n", dsts[0], get_string(dinfo.dstconv), get_stri… in iter_instruction()
5001 …emit_buff(&ctx->glsl_strbufs, "%s = %s(%s(ivec4((uvec4(%s) + uvec4(%s))))%s);\n", dsts[0], get_str… in iter_instruction()
5015 …emit_buff(&ctx->glsl_strbufs, "%s = %s(%s((uvec4(%s) * uvec4(%s)))%s);\n", dsts[0], get_string(din… in iter_instruction()
5018 …emit_buff(&ctx->glsl_strbufs, "%s = %s(%s((uvec4(%s) %% uvec4(%s)))%s);\n", dsts[0], get_string(di… in iter_instruction()
5021 …emit_buff(&ctx->glsl_strbufs, "%s = %s(%s((ivec4(%s) / ivec4(%s)))%s);\n", dsts[0], get_string(din… in iter_instruction()
5024 …emit_buff(&ctx->glsl_strbufs, "%s = %s(%s((uvec4(%s) / uvec4(%s)))%s);\n", dsts[0], get_string(din… in iter_instruction()
5034 …emit_buff(&ctx->glsl_strbufs, "%s = %s((%s * %s + %s)%s);\n", dsts[0], get_string(dinfo.dstconv), … in iter_instruction()
5038 …emit_buff(&ctx->glsl_strbufs, "%s = %s(%s((%s * %s + %s)%s));\n", dsts[0], get_string(dinfo.dstcon… in iter_instruction()
5072 …emit_buff(&ctx->glsl_strbufs, "%s = %s(ivec4(%s)%s);\n", dsts[0], get_string(dinfo.dstconv), srcs[… in iter_instruction()
5075 …emit_buff(&ctx->glsl_strbufs, "%s = %s(ivec4(%s));\n", dsts[0], get_string(dinfo.dstconv), srcs[0]… in iter_instruction()
5078 emit_buff(&ctx->glsl_strbufs, "%s = %s(%s);\n", dsts[0], get_string(dinfo.dstconv), srcs[0]); in iter_instruction()
5081 …emit_buff(&ctx->glsl_strbufs, "%s = %s(uvec4(%s)%s);\n", dsts[0], get_string(dinfo.dstconv), srcs[… in iter_instruction()
5084 …emit_buff(&ctx->glsl_strbufs, "%s = %s(uvec4(%s));\n", dsts[0], get_string(dinfo.dstconv), srcs[0]… in iter_instruction()
5087 …emit_buff(&ctx->glsl_strbufs, "%s = %s(%s(ivec4(%s))%s);\n", dsts[0], get_string(dinfo.dstconv), g… in iter_instruction()
5090 …emit_buff(&ctx->glsl_strbufs, "%s = %s(%s(%s(%s)));\n", dsts[0], get_string(dinfo.dstconv), get_st… in iter_instruction()
5093 …emit_buff(&ctx->glsl_strbufs, "%s = %s(%s(uvec4(%s))%s);\n", dsts[0], get_string(dinfo.dstconv), g… in iter_instruction()
5096 …emit_buff(&ctx->glsl_strbufs, "%s = %s(%s(%s(%s)));\n", dsts[0], get_string(dinfo.dstconv), get_st… in iter_instruction()
5099 …emit_buff(&ctx->glsl_strbufs, "%s = %s(%s(%s));\n", dsts[0], get_string(dinfo.dstconv), get_string… in iter_instruction()
5102 …emit_buff(&ctx->glsl_strbufs, "%s = %s(uintBitsToFloat(~(uvec4(%s))));\n", dsts[0], get_string(din… in iter_instruction()
5105 …emit_buff(&ctx->glsl_strbufs, "%s = %s(intBitsToFloat(-(ivec4(%s))));\n", dsts[0], get_string(dinf… in iter_instruction()
5108 emit_buff(&ctx->glsl_strbufs, "%s = %s(-%s);\n", dsts[0], get_string(dinfo.dstconv), srcs[0]); in iter_instruction()
5153 …emit_buff(&ctx->glsl_strbufs, "%s = %s(pow(%s, %s));\n", dsts[0], get_string(dinfo.dstconv), srcs[… in iter_instruction()
5156 …emit_buff(&ctx->glsl_strbufs, "%s = mix(%s, %s, greaterThanEqual(%s, vec4(0.0)))%s;\n", dsts[0], s… in iter_instruction()
5159 …emit_buff(&ctx->glsl_strbufs, "%s = mix(%s, %s, notEqual(floatBitsToUint(%s), uvec4(0.0)))%s;\n", … in iter_instruction()
5163 handle_vertex_proc_exit(ctx, &ctx->glsl_strbufs, &ctx->has_clipvertex_so); in iter_instruction()
5165 emit_clip_dist_movs(ctx, &ctx->glsl_strbufs); in iter_instruction()
5168 emit_so_movs(ctx, &ctx->glsl_strbufs, &ctx->has_clipvertex_so); in iter_instruction()
5169 emit_clip_dist_movs(ctx, &ctx->glsl_strbufs); in iter_instruction()
5171 emit_prescale(&ctx->glsl_strbufs); in iter_instruction()
5174 handle_fragment_proc_exit(ctx, &ctx->glsl_strbufs); in iter_instruction()
5176 emit_buf(&ctx->glsl_strbufs, "}\n"); in iter_instruction()
5180 handle_vertex_proc_exit(ctx, &ctx->glsl_strbufs, &ctx->has_clipvertex_so); in iter_instruction()
5182 handle_fragment_proc_exit(ctx, &ctx->glsl_strbufs); in iter_instruction()
5184 emit_buf(&ctx->glsl_strbufs, "return;\n"); in iter_instruction()
5187 emit_buff(&ctx->glsl_strbufs, "%s = int(floor(%s)%s);\n", dsts[0], srcs[0], writemask); in iter_instruction()
5190 emit_buff(&ctx->glsl_strbufs, "%s = int(%s);\n", dsts[0], srcs[0]); in iter_instruction()
5193 …emit_buff(&ctx->glsl_strbufs, "%s = %s(cross(vec3(%s), vec3(%s)));\n", dsts[0], get_string(dinfo.d… in iter_instruction()
5196 emit_buf(&ctx->glsl_strbufs, "do {\n"); in iter_instruction()
5197 indent_buf(&ctx->glsl_strbufs); in iter_instruction()
5200 outdent_buf(&ctx->glsl_strbufs); in iter_instruction()
5201 emit_buf(&ctx->glsl_strbufs, "} while(true);\n"); in iter_instruction()
5204 emit_buf(&ctx->glsl_strbufs, "break;\n"); in iter_instruction()
5209 emit_so_movs(ctx, &ctx->glsl_strbufs, &ctx->has_clipvertex_so); in iter_instruction()
5210 emit_clip_dist_movs(ctx, &ctx->glsl_strbufs); in iter_instruction()
5211 emit_prescale(&ctx->glsl_strbufs); in iter_instruction()
5214 …emit_buff(&ctx->glsl_strbufs, "EmitStreamVertex(%d);\n", imd->val[inst->Src[0].Register.SwizzleX].… in iter_instruction()
5216 emit_buf(&ctx->glsl_strbufs, "EmitVertex();\n"); in iter_instruction()
5223 …emit_buff(&ctx->glsl_strbufs, "EndStreamPrimitive(%d);\n", imd->val[inst->Src[0].Register.SwizzleX… in iter_instruction()
5225 emit_buf(&ctx->glsl_strbufs, "EndPrimitive();\n"); in iter_instruction()
5229 …emit_buff(&ctx->glsl_strbufs, "%s = %s(%s(vec4(interpolateAtCentroid(%s)%s)));\n", dsts[0], get_st… in iter_instruction()
5233 …emit_buff(&ctx->glsl_strbufs, "%s = %s(%s(vec4(interpolateAtSample(%s, %s.x)%s)));\n", dsts[0], ge… in iter_instruction()
5237 …emit_buff(&ctx->glsl_strbufs, "%s = %s(%s(vec4(interpolateAtOffset(%s, %s.xy)%s)));\n", dsts[0], g… in iter_instruction()
5241 … emit_buff(&ctx->glsl_strbufs, "umulExtended(%s, %s, umul_temp, mul_utemp);\n", srcs[0], srcs[1]); in iter_instruction()
5242 …emit_buff(&ctx->glsl_strbufs, "%s = %s(%s(umul_temp%s));\n", dsts[0], get_string(dinfo.dstconv), g… in iter_instruction()
5252 … emit_buff(&ctx->glsl_strbufs, "imulExtended(%s, %s, imul_temp, mul_itemp);\n", srcs[0], srcs[1]); in iter_instruction()
5253 …emit_buff(&ctx->glsl_strbufs, "%s = %s(%s(imul_temp%s));\n", dsts[0], get_string(dinfo.dstconv), g… in iter_instruction()
5264 …emit_buff(&ctx->glsl_strbufs, "%s = %s(%s(bitfieldExtract(%s, int(%s.x), int(%s.x))));\n", dsts[0]… in iter_instruction()
5268 …emit_buff(&ctx->glsl_strbufs, "%s = %s(%s(bitfieldExtract(%s, int(%s.x), int(%s.x))));\n", dsts[0]… in iter_instruction()
5272 …emit_buff(&ctx->glsl_strbufs, "%s = %s(uintBitsToFloat(bitfieldInsert(%s, %s, int(%s), int(%s))));… in iter_instruction()
5276 …emit_buff(&ctx->glsl_strbufs, "%s = %s(%s(bitfieldReverse(%s)));\n", dsts[0], get_string(dinfo.dst… in iter_instruction()
5280 …emit_buff(&ctx->glsl_strbufs, "%s = %s(%s(bitCount(%s)));\n", dsts[0], get_string(dinfo.dstconv), … in iter_instruction()
5284 …emit_buff(&ctx->glsl_strbufs, "%s = %s(%s(findLSB(%s)));\n", dsts[0], get_string(dinfo.dstconv), g… in iter_instruction()
5289 …emit_buff(&ctx->glsl_strbufs, "%s = %s(%s(findMSB(%s)));\n", dsts[0], get_string(dinfo.dstconv), g… in iter_instruction()
5293 emit_buf(&ctx->glsl_strbufs, "barrier();\n"); in iter_instruction()
5304 emit_buf(&ctx->glsl_strbufs, "groupMemoryBarrier();\n"); in iter_instruction()
5307 emit_buf(&ctx->glsl_strbufs, "memoryBarrier();\n"); in iter_instruction()
5311 emit_buf(&ctx->glsl_strbufs, "memoryBarrierBuffer();\n"); in iter_instruction()
5314 emit_buf(&ctx->glsl_strbufs, "memoryBarrierAtomic();\n"); in iter_instruction()
5317 emit_buf(&ctx->glsl_strbufs, "memoryBarrierImage();\n"); in iter_instruction()
5320 emit_buf(&ctx->glsl_strbufs, "memoryBarrierShared();\n"); in iter_instruction()
5332 translate_store(ctx, &ctx->glsl_strbufs, ctx->ssbo_memory_qualifier, in iter_instruction()
5341 translate_load(ctx, &ctx->glsl_strbufs, ctx->ssbo_memory_qualifier, ctx->images, in iter_instruction()
5366 emit_buff(&ctx->glsl_strbufs, "%s = uintBitsToFloat(clock2x32ARB());\n", dsts[0]); in iter_instruction()
5376 …emit_buff(&ctx->glsl_strbufs, "%s = uintBitsToFloat(unpackDouble2x32(%s));\n", fp64_dsts[0], dsts[… in iter_instruction()
5380 emit_buff(&ctx->glsl_strbufs, "%s = clamp(%s, 0.0, 1.0);\n", dsts[0], dsts[0]); in iter_instruction()
5383 if (strbuf_get_error(&ctx->glsl_strbufs.glsl_main)) in iter_instruction()
5403 static void emit_ext(struct vrend_glsl_strbufs *glsl_strbufs, const char *name, in emit_ext() argument
5406 emit_ver_extf(glsl_strbufs, "#extension GL_%s : %s\n", name, verb); in emit_ext()
5409 static void emit_header(const struct dump_ctx *ctx, struct vrend_glsl_strbufs *glsl_strbufs) in emit_header() argument
5412 emit_ver_extf(glsl_strbufs, "#version %d es\n", ctx->cfg->glsl_version); in emit_header()
5416 emit_ext(glsl_strbufs, "EXT_clip_cull_distance", "require"); in emit_header()
5420 emit_ext(glsl_strbufs, "OES_texture_storage_multisample_2d_array", "require"); in emit_header()
5423 emit_ext(glsl_strbufs, "EXT_conservative_depth", "require"); in emit_header()
5427 emit_ext(glsl_strbufs, "EXT_shader_framebuffer_fetch", "require"); in emit_header()
5429 emit_ext(glsl_strbufs, "KHR_blend_equation_advanced", "require"); in emit_header()
5433 emit_ext(glsl_strbufs, "OES_viewport_array", "require"); in emit_header()
5436 emit_ext(glsl_strbufs, "EXT_geometry_shader", "require"); in emit_header()
5438 emit_ext(glsl_strbufs, "OES_geometry_point_size", "enable"); in emit_header()
5442 emit_ext(glsl_strbufs, "NV_image_formats", "require"); in emit_header()
5447 emit_ext(glsl_strbufs, "OES_tessellation_shader", "require"); in emit_header()
5448 emit_ext(glsl_strbufs, "OES_tessellation_point_size", "enable"); in emit_header()
5453 emit_ext(glsl_strbufs, "EXT_texture_buffer", "require"); in emit_header()
5455 emit_ext(glsl_strbufs, "OES_shader_io_blocks", "require"); in emit_header()
5458 emit_ext(glsl_strbufs, "OES_sample_variables", "require"); in emit_header()
5460 emit_ext(glsl_strbufs, "OES_gpu_shader5", "require"); in emit_header()
5461 emit_ext(glsl_strbufs, "OES_shader_multisample_interpolation", in emit_header()
5465 emit_ext(glsl_strbufs, "OES_texture_cube_map_array", "require"); in emit_header()
5467 emit_ext(glsl_strbufs, "EXT_geometry_shader", "require"); in emit_header()
5469 emit_ext(glsl_strbufs, "OES_shader_image_atomic", "require"); in emit_header()
5472 emit_ext(glsl_strbufs, "EXT_geometry_shader", "require"); in emit_header()
5477 emit_ext(glsl_strbufs, "EXT_shader_framebuffer_fetch", "require"); in emit_header()
5479 emit_ext(glsl_strbufs, "EXT_shader_framebuffer_fetch_non_coherent", "require"); in emit_header()
5484 emit_ext(glsl_strbufs, "EXT_texture_query_lod", "require"); in emit_header()
5486 emit_hdr(glsl_strbufs, "precision highp float;\n"); in emit_header()
5487 emit_hdr(glsl_strbufs, "precision highp int;\n"); in emit_header()
5490 emit_ver_ext(glsl_strbufs, "#version 330\n"); in emit_header()
5491 emit_ext(glsl_strbufs, "ARB_compute_shader", "require"); in emit_header()
5494 emit_ver_extf(glsl_strbufs, "#version %d\n", ctx->glsl_ver_required); in emit_header()
5499 emit_ver_ext(glsl_strbufs, "#version 150\n"); in emit_header()
5501 emit_ver_ext(glsl_strbufs, "#version 140\n"); in emit_header()
5503 emit_ver_ext(glsl_strbufs, "#version 130\n"); in emit_header()
5507 emit_ext(glsl_strbufs, "ARB_enhanced_layouts", "require"); in emit_header()
5510 emit_ext(glsl_strbufs, "ARB_separate_shader_objects", "require"); in emit_header()
5513 emit_ext(glsl_strbufs, "ARB_arrays_of_arrays", "require"); in emit_header()
5517 emit_ext(glsl_strbufs, "ARB_tessellation_shader", "require"); in emit_header()
5520 emit_ext(glsl_strbufs, "ARB_explicit_attrib_location", "require"); in emit_header()
5522 emit_ext(glsl_strbufs, "ARB_fragment_coord_conventions", "require"); in emit_header()
5525 emit_ext(glsl_strbufs, "ARB_uniform_buffer_object", "require"); in emit_header()
5528 emit_ext(glsl_strbufs, "ARB_cull_distance", "require"); in emit_header()
5530 emit_ext(glsl_strbufs, "ARB_shader_storage_buffer_object", "require"); in emit_header()
5533 emit_ext(glsl_strbufs, "ARB_shader_atomic_counters", "require"); in emit_header()
5534 emit_ext(glsl_strbufs, "ARB_shader_atomic_counter_ops", "require"); in emit_header()
5542 emit_ext(glsl_strbufs, shader_req_table[i].string, "require"); in emit_header()
5635 struct vrend_glsl_strbufs *glsl_strbufs, in emit_sampler_decl() argument
5653 …emit_hdrf(glsl_strbufs, "uniform %s %csampler%s %ssamp%d[%d];\n", precision, ptc, stc, sname, i, r… in emit_sampler_decl()
5655 emit_hdrf(glsl_strbufs, "uniform %s %csampler%s %ssamp%d;\n", precision, ptc, stc, sname, i); in emit_sampler_decl()
5658 emit_hdrf(glsl_strbufs, "uniform %s vec4 %sshadmask%d;\n", precision, sname, i); in emit_sampler_decl()
5659 emit_hdrf(glsl_strbufs, "uniform %s vec4 %sshadadd%d;\n", precision, sname, i); in emit_sampler_decl()
5795 struct vrend_glsl_strbufs *glsl_strbufs, in emit_image_decl() argument
5820 emit_hdrf(glsl_strbufs, "layout(binding=%d%s%s) ", in emit_image_decl()
5823 emit_hdrf(glsl_strbufs, "layout(%s) ", formatstr); in emit_image_decl()
5827 emit_hdrf(glsl_strbufs, "%s%suniform %s%cimage%s %simg%d[%d];\n", in emit_image_decl()
5830 emit_hdrf(glsl_strbufs, "%s%suniform %s%cimage%s %simg%d;\n", in emit_image_decl()
5835 struct vrend_glsl_strbufs *glsl_strbufs, in emit_ios_common() argument
5843 …emit_hdrf(glsl_strbufs, "vec4 temp%d[%d];\n", ctx->temp_ranges[i].first, ctx->temp_ranges[i].last … in emit_ios_common()
5847 emit_hdr(glsl_strbufs, "uvec4 mul_utemp;\n"); in emit_ios_common()
5848 emit_hdr(glsl_strbufs, "uvec4 umul_temp;\n"); in emit_ios_common()
5852 emit_hdr(glsl_strbufs, "ivec4 mul_itemp;\n"); in emit_ios_common()
5853 emit_hdr(glsl_strbufs, "ivec4 imul_temp;\n"); in emit_ios_common()
5857 emit_hdr(glsl_strbufs, "uint ssbo_addr_temp;\n"); in emit_ios_common()
5861 emit_hdr(glsl_strbufs, "dvec2 fp64_dst[3];\n"); in emit_ios_common()
5862 emit_hdr(glsl_strbufs, "dvec2 fp64_src[4];\n"); in emit_ios_common()
5866 emit_hdrf(glsl_strbufs, "int addr%d;\n", i); in emit_ios_common()
5870 emit_hdrf(glsl_strbufs, "uniform uvec4 %sconst0[%d];\n", cname, ctx->num_consts); in emit_ios_common()
5880 …emit_hdrf(glsl_strbufs, "uniform %subo { vec4 ubocontents[%d]; } %suboarr[%d];\n", cname, ctx->ubo… in emit_ios_common()
5885 …emit_hdrf(glsl_strbufs, "uniform %subo%d { vec4 %subo%dcontents[%d]; };\n", cname, i, cname, i, ct… in emit_ios_common()
5894 … emit_sampler_decl(ctx, glsl_strbufs, shadow_samp_mask, first, range, ctx->samplers + first); in emit_ios_common()
5903 emit_sampler_decl(ctx, glsl_strbufs, shadow_samp_mask, i, 0, ctx->samplers + i); in emit_ios_common()
5911 emit_image_decl(ctx, glsl_strbufs, first, range, ctx->images + first); in emit_ios_common()
5917 emit_image_decl(ctx, glsl_strbufs, i, 0, ctx->images + i); in emit_ios_common()
5923 …emit_hdrf(glsl_strbufs, "layout (binding = %d, offset = %d) uniform atomic_uint ac%d[%d];\n", ctx-… in emit_ios_common()
5925 …emit_hdrf(glsl_strbufs, "layout (binding = %d, offset = %d) uniform atomic_uint ac%d;\n", ctx->abo… in emit_ios_common()
5934 …emit_hdrf(glsl_strbufs, "layout (binding = %d, std430) buffer %sssbo%d { uint %sssbocontents%d[]; … in emit_ios_common()
5942 …emit_hdrf(glsl_strbufs, "layout (binding = %d, std430) %s buffer %sssbo%d { %s %sssbocontents%d[];… in emit_ios_common()
5951 struct vrend_glsl_strbufs *glsl_strbufs) in emit_ios_streamout() argument
5964 …emit_hdrf(glsl_strbufs, "layout (stream=%d) out %s tfout%d;\n", ctx->so->output[i].stream, outtype… in emit_ios_streamout()
5972 emit_hdrf(glsl_strbufs, "out %s tfout%d[];\n", outtype, i); in emit_ios_streamout()
5974 emit_hdrf(glsl_strbufs, "out %s tfout%d;\n", outtype, i); in emit_ios_streamout()
5981 static inline void emit_winsys_correction(struct vrend_glsl_strbufs *glsl_strbufs) in emit_winsys_correction() argument
5983 emit_hdr(glsl_strbufs, "uniform float winsys_adjust_y;\n"); in emit_winsys_correction()
5987 struct vrend_glsl_strbufs *glsl_strbufs, in emit_ios_indirect_generics_output() argument
6000 emit_hdrf(glsl_strbufs, "out %s {\n vec4 %s[%d]; \n} %s;\n", blockname, in emit_ios_indirect_generics_output()
6003 emit_hdrf(glsl_strbufs, "out vec4 %s%s[%d];\n", in emit_ios_indirect_generics_output()
6011 struct vrend_glsl_strbufs *glsl_strbufs, in emit_ios_indirect_generics_input() argument
6033 emit_hdrf(glsl_strbufs, "in %s {\n vec4 %s[%d]; \n} %s;\n", in emit_ios_indirect_generics_input()
6037 emit_hdrf(glsl_strbufs, "in vec4 %s%s[%d];\n", in emit_ios_indirect_generics_input()
6046 struct vrend_glsl_strbufs *glsl_strbufs, in emit_ios_generic() argument
6075 emit_hdr(glsl_strbufs, layout); in emit_ios_generic()
6077 emit_hdrf(glsl_strbufs, "%s%s\n%s %s %s %s%s;\n", in emit_ios_generic()
6104 emit_hdrf(glsl_strbufs, "%s %s {\n", inout, blockname); in emit_ios_generic()
6105 emit_hdr(glsl_strbufs, layout); in emit_ios_generic()
6106 emit_hdrf(glsl_strbufs, "%s%s\n%s %s %s[%d]; \n} %s;\n", in emit_ios_generic()
6115 emit_hdr(glsl_strbufs, layout); in emit_ios_generic()
6116 emit_hdrf(glsl_strbufs, "%s%s\n%s %s %s %s%s[%d];\n", in emit_ios_generic()
6134 struct vrend_glsl_strbufs *glsl_strbufs, in emit_ios_generic_outputs() argument
6171 emit_ios_generic(ctx, glsl_strbufs, generic_ios, in emit_ios_generic_outputs()
6175 emit_hdrf(glsl_strbufs, "%s%s;\n", in emit_ios_generic_outputs()
6190 emit_ios_patch(struct vrend_glsl_strbufs *glsl_strbufs, in emit_ios_patch() argument
6200 emit_hdrf(glsl_strbufs, "layout(location = %d, component = %d)\n", in emit_ios_patch()
6203 emit_hdrf(glsl_strbufs, "layout(location = %d)\n", io->layout_location - 1); in emit_ios_patch()
6210 emit_hdrf(glsl_strbufs, "%s %s %s %s;\n", prefix, inout, t, io->glsl_name); in emit_ios_patch()
6212 emit_hdrf(glsl_strbufs, "%s %s %s %s[%d];\n", prefix, inout, t, in emit_ios_patch()
6223 struct vrend_glsl_strbufs *glsl_strbufs, in emit_ios_vs() argument
6235 emit_hdrf(glsl_strbufs, "layout(location=%d) ", ctx->inputs[i].first); in emit_ios_vs()
6240 emit_hdrf(glsl_strbufs, "in %s %s%s;\n", in emit_ios_vs()
6245 emit_ios_indirect_generics_output(ctx, glsl_strbufs, ""); in emit_ios_vs()
6247 emit_ios_generic_outputs(ctx, glsl_strbufs, generic_ios, front_back_color_emitted_flags, in emit_ios_vs()
6263 emit_hdrf(glsl_strbufs, "%sout vec4 ex_bc%d;\n", INTERP_PREFIX, ctx->outputs[i].sid); in emit_ios_vs()
6267 emit_hdrf(glsl_strbufs, "%sout vec4 ex_c%d;\n", INTERP_PREFIX, ctx->outputs[i].sid); in emit_ios_vs()
6273 emit_winsys_correction(glsl_strbufs); in emit_ios_vs()
6276 emit_hdrf(glsl_strbufs, "%svec4 clipv_tmp;\n", ctx->has_clipvertex_so ? "out " : ""); in emit_ios_vs()
6294 emit_hdr(glsl_strbufs, "uniform vec4 clipp[8];\n"); in emit_ios_vs()
6297 … emit_hdrf(glsl_strbufs, "out gl_PerVertex {\n vec4 gl_Position;\n %s%s};\n", clip_buf, cull_buf); in emit_ios_vs()
6299 emit_hdrf(glsl_strbufs, "%s%s", clip_buf, cull_buf); in emit_ios_vs()
6301 emit_hdr(glsl_strbufs, "vec4 clip_dist_temp[2];\n"); in emit_ios_vs()
6320 struct vrend_glsl_strbufs *glsl_strbufs, in emit_ios_fs() argument
6333 emit_hdrf(glsl_strbufs, "layout(%s%c%s) in vec4 gl_FragCoord;\n", in emit_ios_fs()
6339 emit_hdr(glsl_strbufs, "layout(early_fragment_tests) in;\n"); in emit_ios_fs()
6342 emit_ios_indirect_generics_input(ctx, glsl_strbufs, ""); in emit_ios_fs()
6361 … emit_ios_generic(ctx, glsl_strbufs, generic_ios, io_in, prefixes, &ctx->inputs[i], "in", ""); in emit_ios_fs()
6367 emit_hdr(glsl_strbufs, "uniform float winsys_adjust_y;\n"); in emit_ios_fs()
6372 emit_hdr(glsl_strbufs, "uniform float alpha_ref_val;\n"); in emit_ios_fs()
6377 emit_hdr(glsl_strbufs, "vec4 realcolor0;\n"); in emit_ios_fs()
6379 emit_hdr(glsl_strbufs, "vec4 realcolor1;\n"); in emit_ios_fs()
6385 emit_hdrf(glsl_strbufs, "layout(blend_support_%s) out;\n", blend_to_name(choice)); in emit_ios_fs()
6398 emit_hdrf(glsl_strbufs, "%s fsout_tmp_c%d;\n", type, i); in emit_ios_fs()
6402 …emit_hdrf(glsl_strbufs, "layout (location=%d%s) inout highp %s fsout_c%d;\n", i, noncoherent, type… in emit_ios_fs()
6404 emit_hdrf(glsl_strbufs, "layout (location=%d) out %s fsout_c%d;\n", i, in emit_ios_fs()
6407 emit_hdrf(glsl_strbufs, "out %s fsout_c%d;\n", type, i); in emit_ios_fs()
6420 emit_ios_generic(ctx, glsl_strbufs, generic_ios, io_out, prefix, &ctx->outputs[i], in emit_ios_fs()
6424 emit_hdrf(glsl_strbufs, "%s%s;\n", in emit_ios_fs()
6435 emit_hdrf(glsl_strbufs, "layout (%s) out float gl_FragDepth;\n", depth_layout); in emit_ios_fs()
6440 … emit_hdrf(glsl_strbufs, "in float gl_ClipDistance[%d];\n", ctx->key->prev_stage_num_clip_out); in emit_ios_fs()
6442 emit_hdrf(glsl_strbufs, "in float gl_ClipDistance[%d];\n", ctx->num_in_clip_dist); in emit_ios_fs()
6446 … emit_hdrf(glsl_strbufs, "in float gl_CullDistance[%d];\n", ctx->key->prev_stage_num_cull_out); in emit_ios_fs()
6449 emit_hdr(glsl_strbufs, "vec4 clip_dist_temp[2];\n"); in emit_ios_fs()
6460 struct vrend_glsl_strbufs *glsl_strbufs, in emit_ios_geom() argument
6473 emit_hdrf(glsl_strbufs, "layout(%s%s) in;\n", prim_to_name(ctx->gs_in_prim), in emit_ios_geom()
6475 …emit_hdrf(glsl_strbufs, "layout(%s, max_vertices = %d) out;\n", prim_to_name(ctx->gs_out_prim), ct… in emit_ios_geom()
6482 emit_ios_generic(ctx, glsl_strbufs, generic_ios, in emit_ios_geom()
6501 …emit_hdrf(glsl_strbufs, "layout (stream = %d) %s%s%sout vec4 %s;\n", ctx->outputs[i].stream, prefi… in emit_ios_geom()
6508 emit_ios_generic_outputs(ctx, glsl_strbufs, generic_ios, front_back_color_emitted_flags, in emit_ios_geom()
6511 emit_winsys_correction(glsl_strbufs); in emit_ios_geom()
6527 …emit_hdrf(glsl_strbufs, "in gl_PerVertex {\n vec4 gl_Position; \n %s%s\n} gl_in[];\n", clip_var, c… in emit_ios_geom()
6544 emit_hdrf(glsl_strbufs, "%s%s\n", clip_buf, cull_buf); in emit_ios_geom()
6545 emit_hdrf(glsl_strbufs, "vec4 clip_dist_temp[2];\n"); in emit_ios_geom()
6551 struct vrend_glsl_strbufs *glsl_strbufs, in emit_ios_tcs() argument
6557 emit_ios_indirect_generics_input(ctx, glsl_strbufs, "[]"); in emit_ios_tcs()
6562 …emit_ios_patch(glsl_strbufs, "", &ctx->inputs[i], "in", ctx->inputs[i].last - ctx->inputs[i].firs… in emit_ios_tcs()
6564 … emit_ios_generic(ctx, glsl_strbufs, generic_ios, io_in, "", &ctx->inputs[i], "in", "[]"); in emit_ios_tcs()
6568 emit_hdrf(glsl_strbufs, "layout(vertices = %d) out;\n", ctx->tcs_vertices_out); in emit_ios_tcs()
6570 emit_ios_indirect_generics_output(ctx, glsl_strbufs, "[]"); in emit_ios_tcs()
6573 emit_ios_patch(glsl_strbufs, "patch", &ctx->patch_ios.output_range.io, "out", in emit_ios_tcs()
6579 emit_ios_patch(glsl_strbufs, "patch", &ctx->outputs[i], "out", in emit_ios_tcs()
6582 … emit_ios_generic(ctx, glsl_strbufs, generic_ios, io_out, "", &ctx->outputs[i], "out", "[]"); in emit_ios_tcs()
6584 emit_hdrf(glsl_strbufs, "%s%s;\n", in emit_ios_tcs()
6604 …emit_hdrf(glsl_strbufs, "in gl_PerVertex {\n vec4 gl_Position; \n %s%s} gl_in[];\n", clip_var, cul… in emit_ios_tcs()
6607 …emit_hdrf(glsl_strbufs, "out gl_PerVertex {\n vec4 gl_Position;\n float gl_ClipDistance[%d];\n} gl… in emit_ios_tcs()
6608 emit_hdr(glsl_strbufs, "vec4 clip_dist_temp[2];\n"); in emit_ios_tcs()
6613 struct vrend_glsl_strbufs *glsl_strbufs, in emit_ios_tes() argument
6623 emit_ios_patch(glsl_strbufs, "patch", &ctx->patch_ios.input_range.io, "in", in emit_ios_tes()
6627 emit_ios_indirect_generics_input(ctx, glsl_strbufs, "[]"); in emit_ios_tes()
6632 emit_ios_patch(glsl_strbufs, "patch", &ctx->inputs[i], "in", in emit_ios_tes()
6635 … emit_ios_generic(ctx, glsl_strbufs, generic_ios, io_in, "", &ctx->inputs[i], "in", "[]"); in emit_ios_tes()
6639 emit_hdrf(glsl_strbufs, "layout(%s, %s, %s%s) in;\n", in emit_ios_tes()
6645 emit_ios_generic_outputs(ctx, glsl_strbufs, generic_ios, front_back_color_emitted_flags, in emit_ios_tes()
6648 emit_winsys_correction(glsl_strbufs); in emit_ios_tes()
6663 …emit_hdrf(glsl_strbufs, "in gl_PerVertex {\n vec4 gl_Position; \n %s%s} gl_in[];\n", clip_var, cul… in emit_ios_tes()
6666 …emit_hdrf(glsl_strbufs, "out gl_PerVertex {\n vec4 gl_Position;\n float gl_ClipDistance[%d];\n} gl… in emit_ios_tes()
6667 emit_hdr(glsl_strbufs, "vec4 clip_dist_temp[2];\n"); in emit_ios_tes()
6673 struct vrend_glsl_strbufs *glsl_strbufs) in emit_ios_cs() argument
6675 emit_hdrf(glsl_strbufs, "layout (local_size_x = %d, local_size_y = %d, local_size_z = %d) in;\n", in emit_ios_cs()
6680 emit_hdrf(glsl_strbufs, "shared %s values[%d];\n", get_string(type), ctx->req_local_mem / 4); in emit_ios_cs()
6685 struct vrend_glsl_strbufs *glsl_strbufs, in emit_ios() argument
6699 set_hdr_error(glsl_strbufs); in emit_ios()
6705 …emit_ios_vs(ctx, glsl_strbufs, generic_ios, num_interps, front_back_color_emitted_flags, force_col… in emit_ios()
6708 emit_ios_fs(ctx, glsl_strbufs, generic_ios, num_interps, winsys_adjust_y_emitted); in emit_ios()
6711 …emit_ios_geom(ctx, glsl_strbufs, generic_ios, front_back_color_emitted_flags, num_interps, has_per… in emit_ios()
6714 emit_ios_tcs(ctx, glsl_strbufs, generic_ios, has_pervertex); in emit_ios()
6717 …emit_ios_tes(ctx, glsl_strbufs, generic_ios, front_back_color_emitted_flags, num_interps, has_perv… in emit_ios()
6720 emit_ios_cs(ctx, glsl_strbufs); in emit_ios()
6724 set_hdr_error(glsl_strbufs); in emit_ios()
6734 emit_hdrf(glsl_strbufs, " out vec4 %s_g%dA0_f%s;\n", in emit_ios()
6740 emit_ios_streamout(ctx, glsl_strbufs); in emit_ios()
6741 glsl_ver_required = emit_ios_common(ctx, glsl_strbufs, shadow_samp_mask); in emit_ios()
6745 emit_hdr(glsl_strbufs, "uniform sampler2D pstipple_sampler;\nfloat stip_temp;\n"); in emit_ios()
6912 static bool allocate_strbuffers(struct vrend_glsl_strbufs* glsl_strbufs) in allocate_strbuffers() argument
6914 if (!strbuf_alloc(&glsl_strbufs->glsl_main, 4096)) in allocate_strbuffers()
6917 if (strbuf_get_error(&glsl_strbufs->glsl_main)) in allocate_strbuffers()
6920 if (!strbuf_alloc(&glsl_strbufs->glsl_hdr, 1024)) in allocate_strbuffers()
6923 if (!strbuf_alloc(&glsl_strbufs->glsl_ver_ext, 1024)) in allocate_strbuffers()
6929 …ffers(MAYBE_UNUSED const struct vrend_context *rctx, const struct vrend_glsl_strbufs* glsl_strbufs, in set_strbuffers() argument
6932 strarray_addstrbuf(shader, &glsl_strbufs->glsl_ver_ext); in set_strbuffers()
6933 strarray_addstrbuf(shader, &glsl_strbufs->glsl_hdr); in set_strbuffers()
6934 strarray_addstrbuf(shader, &glsl_strbufs->glsl_main); in set_strbuffers()
7015 if (!allocate_strbuffers(&ctx.glsl_strbufs)) in vrend_convert_shader()
7025 emit_header(&ctx, &ctx.glsl_strbufs); in vrend_convert_shader()
7026 ctx.glsl_ver_required = emit_ios(&ctx, &ctx.glsl_strbufs, &ctx.generic_ios, in vrend_convert_shader()
7033 if (strbuf_get_error(&ctx.glsl_strbufs.glsl_hdr)) in vrend_convert_shader()
7043 set_strbuffers(rctx, &ctx.glsl_strbufs, shader); in vrend_convert_shader()
7072 strbuf_free(&ctx.glsl_strbufs.glsl_main); in vrend_convert_shader()
7073 strbuf_free(&ctx.glsl_strbufs.glsl_hdr); in vrend_convert_shader()
7074 strbuf_free(&ctx.glsl_strbufs.glsl_ver_ext); in vrend_convert_shader()
7327 if (!allocate_strbuffers(&ctx.glsl_strbufs)) in vrend_shader_create_passthrough_tcs()
7339 emit_header(&ctx, &ctx.glsl_strbufs); in vrend_shader_create_passthrough_tcs()
7340 ctx.glsl_ver_required = emit_ios(&ctx, &ctx.glsl_strbufs, &ctx.generic_ios, in vrend_shader_create_passthrough_tcs()
7347 emit_buf(&ctx.glsl_strbufs, "void main() {\n"); in vrend_shader_create_passthrough_tcs()
7363 emit_buff(&ctx.glsl_strbufs, "%s%s%s = %s%s%s;\n", in vrend_shader_create_passthrough_tcs()
7369 emit_buff(&ctx.glsl_strbufs, "%s%s%s[%d] = %s%s%s[%d];\n", in vrend_shader_create_passthrough_tcs()
7377 emit_buff(&ctx.glsl_strbufs, "gl_TessLevelOuter[%d] = %f;\n", i, tess_factors[i]); in vrend_shader_create_passthrough_tcs()
7380 emit_buff(&ctx.glsl_strbufs, "gl_TessLevelInner[%d] = %f;\n", i, tess_factors[i + 4]); in vrend_shader_create_passthrough_tcs()
7382 emit_buf(&ctx.glsl_strbufs, "}\n"); in vrend_shader_create_passthrough_tcs()
7385 set_strbuffers(rctx, &ctx.glsl_strbufs, shader); in vrend_shader_create_passthrough_tcs()
7388 strbuf_free(&ctx.glsl_strbufs.glsl_main); in vrend_shader_create_passthrough_tcs()
7389 strbuf_free(&ctx.glsl_strbufs.glsl_hdr); in vrend_shader_create_passthrough_tcs()
7390 strbuf_free(&ctx.glsl_strbufs.glsl_ver_ext); in vrend_shader_create_passthrough_tcs()