Lines Matching refs:shader
53 calc_position(struct vl_mc *r, struct ureg_program *shader, struct ureg_src block_scale) in calc_position() argument
59 vrect = ureg_DECL_vs_input(shader, VS_I_RECT); in calc_position()
60 vpos = ureg_DECL_vs_input(shader, VS_I_VPOS); in calc_position()
62 t_vpos = ureg_DECL_temporary(shader); in calc_position()
64 o_vpos = ureg_DECL_output(shader, TGSI_SEMANTIC_POSITION, VS_O_VPOS); in calc_position()
73 ureg_ADD(shader, ureg_writemask(t_vpos, TGSI_WRITEMASK_XY), vpos, vrect); in calc_position()
74 ureg_MUL(shader, ureg_writemask(t_vpos, TGSI_WRITEMASK_XY), ureg_src(t_vpos), block_scale); in calc_position()
75 ureg_MOV(shader, ureg_writemask(o_vpos, TGSI_WRITEMASK_XY), ureg_src(t_vpos)); in calc_position()
76 ureg_MOV(shader, ureg_writemask(o_vpos, TGSI_WRITEMASK_ZW), ureg_imm1f(shader, 1.0f)); in calc_position()
82 calc_line(struct pipe_screen *screen, struct ureg_program *shader) in calc_line() argument
87 tmp = ureg_DECL_temporary(shader); in calc_line()
90 pos = ureg_DECL_system_value(shader, TGSI_SEMANTIC_POSITION, 0); in calc_line()
92 pos = ureg_DECL_fs_input(shader, TGSI_SEMANTIC_POSITION, VS_O_VPOS, in calc_line()
98 ureg_MUL(shader, ureg_writemask(tmp, TGSI_WRITEMASK_Y), pos, ureg_imm1f(shader, 0.5f)); in calc_line()
99 ureg_FRC(shader, ureg_writemask(tmp, TGSI_WRITEMASK_Y), ureg_src(tmp)); in calc_line()
100 ureg_SGE(shader, ureg_writemask(tmp, TGSI_WRITEMASK_Y), ureg_src(tmp), ureg_imm1f(shader, 0.5f)); in calc_line()
108 struct ureg_program *shader; in create_ref_vert_shader() local
115 shader = ureg_create(PIPE_SHADER_VERTEX); in create_ref_vert_shader()
116 if (!shader) in create_ref_vert_shader()
119 vmv[0] = ureg_DECL_vs_input(shader, VS_I_MV_TOP); in create_ref_vert_shader()
120 vmv[1] = ureg_DECL_vs_input(shader, VS_I_MV_BOTTOM); in create_ref_vert_shader()
122 t_vpos = calc_position(r, shader, ureg_imm2f(shader, in create_ref_vert_shader()
127 o_vmv[0] = ureg_DECL_output(shader, TGSI_SEMANTIC_GENERIC, VS_O_VTOP); in create_ref_vert_shader()
128 o_vmv[1] = ureg_DECL_output(shader, TGSI_SEMANTIC_GENERIC, VS_O_VBOTTOM); in create_ref_vert_shader()
141 mv_scale = ureg_imm4f(shader, in create_ref_vert_shader()
148 … ureg_MAD(shader, ureg_writemask(o_vmv[i], TGSI_WRITEMASK_XY), mv_scale, vmv[i], ureg_src(t_vpos)); in create_ref_vert_shader()
149 ureg_MUL(shader, ureg_writemask(o_vmv[i], TGSI_WRITEMASK_ZW), mv_scale, vmv[i]); in create_ref_vert_shader()
152 ureg_release_temporary(shader, t_vpos); in create_ref_vert_shader()
154 ureg_END(shader); in create_ref_vert_shader()
156 return ureg_create_shader_and_destroy(shader, r->pipe); in create_ref_vert_shader()
166 struct ureg_program *shader; in create_ref_frag_shader() local
172 shader = ureg_create(PIPE_SHADER_FRAGMENT); in create_ref_frag_shader()
173 if (!shader) in create_ref_frag_shader()
176 tc[0] = ureg_DECL_fs_input(shader, TGSI_SEMANTIC_GENERIC, VS_O_VTOP, TGSI_INTERPOLATE_LINEAR); in create_ref_frag_shader()
177 tc[1] = ureg_DECL_fs_input(shader, TGSI_SEMANTIC_GENERIC, VS_O_VBOTTOM, TGSI_INTERPOLATE_LINEAR); in create_ref_frag_shader()
179 sampler = ureg_DECL_sampler(shader, 0); in create_ref_frag_shader()
180 ref = ureg_DECL_temporary(shader); in create_ref_frag_shader()
182 fragment = ureg_DECL_output(shader, TGSI_SEMANTIC_COLOR, 0); in create_ref_frag_shader()
184 field = calc_line(r->pipe->screen, shader); in create_ref_frag_shader()
198 ureg_CMP(shader, ureg_writemask(ref, TGSI_WRITEMASK_XYZ), in create_ref_frag_shader()
201 ureg_CMP(shader, ureg_writemask(fragment, TGSI_WRITEMASK_W), in create_ref_frag_shader()
205 ureg_IF(shader, ureg_scalar(ureg_src(ref), TGSI_SWIZZLE_Z), &label); in create_ref_frag_shader()
207 ureg_MUL(shader, ureg_writemask(ref, TGSI_WRITEMASK_Y), in create_ref_frag_shader()
208 ureg_src(ref), ureg_imm1f(shader, y_scale)); in create_ref_frag_shader()
209 ureg_FLR(shader, ureg_writemask(ref, TGSI_WRITEMASK_Y), ureg_src(ref)); in create_ref_frag_shader()
210 ureg_ADD(shader, ureg_writemask(ref, TGSI_WRITEMASK_Y), in create_ref_frag_shader()
212 ureg_MUL(shader, ureg_writemask(ref, TGSI_WRITEMASK_Y), in create_ref_frag_shader()
213 ureg_src(ref), ureg_imm1f(shader, 1.0f / y_scale)); in create_ref_frag_shader()
215 ureg_fixup_label(shader, label, ureg_get_instruction_number(shader)); in create_ref_frag_shader()
216 ureg_ENDIF(shader); in create_ref_frag_shader()
218 …ureg_TEX(shader, ureg_writemask(fragment, TGSI_WRITEMASK_XYZ), TGSI_TEXTURE_2D, ureg_src(ref), sam… in create_ref_frag_shader()
220 ureg_release_temporary(shader, ref); in create_ref_frag_shader()
222 ureg_release_temporary(shader, field); in create_ref_frag_shader()
223 ureg_END(shader); in create_ref_frag_shader()
225 return ureg_create_shader_and_destroy(shader, r->pipe); in create_ref_frag_shader()
231 struct ureg_program *shader; in create_ycbcr_vert_shader() local
244 shader = ureg_create(PIPE_SHADER_VERTEX); in create_ycbcr_vert_shader()
245 if (!shader) in create_ycbcr_vert_shader()
248 vrect = ureg_DECL_vs_input(shader, VS_I_RECT); in create_ycbcr_vert_shader()
249 vpos = ureg_DECL_vs_input(shader, VS_I_VPOS); in create_ycbcr_vert_shader()
251 t_vpos = calc_position(r, shader, ureg_imm2f(shader, scale.x, scale.y)); in create_ycbcr_vert_shader()
252 t_vtex = ureg_DECL_temporary(shader); in create_ycbcr_vert_shader()
254 o_vpos = ureg_DECL_output(shader, TGSI_SEMANTIC_POSITION, VS_O_VPOS); in create_ycbcr_vert_shader()
255 o_flags = ureg_DECL_output(shader, TGSI_SEMANTIC_GENERIC, VS_O_FLAGS); in create_ycbcr_vert_shader()
272 vs_callback(callback_priv, r, shader, VS_O_VTEX, t_vpos); in create_ycbcr_vert_shader()
274 ureg_MUL(shader, ureg_writemask(o_flags, TGSI_WRITEMASK_Z), in create_ycbcr_vert_shader()
275 ureg_scalar(vpos, TGSI_SWIZZLE_Z), ureg_imm1f(shader, 0.5f)); in create_ycbcr_vert_shader()
276 ureg_MOV(shader, ureg_writemask(o_flags, TGSI_WRITEMASK_W), ureg_imm1f(shader, -1.0f)); in create_ycbcr_vert_shader()
279 ureg_IF(shader, ureg_scalar(vpos, TGSI_SWIZZLE_W), &label); in create_ycbcr_vert_shader()
281 ureg_CMP(shader, ureg_writemask(t_vtex, TGSI_WRITEMASK_XY), in create_ycbcr_vert_shader()
283 ureg_imm2f(shader, 0.0f, scale.y), in create_ycbcr_vert_shader()
284 ureg_imm2f(shader, -scale.y, 0.0f)); in create_ycbcr_vert_shader()
285 ureg_MUL(shader, ureg_writemask(t_vtex, TGSI_WRITEMASK_Z), in create_ycbcr_vert_shader()
286 ureg_scalar(vpos, TGSI_SWIZZLE_Y), ureg_imm1f(shader, 0.5f)); in create_ycbcr_vert_shader()
288 ureg_FRC(shader, ureg_writemask(t_vtex, TGSI_WRITEMASK_Z), ureg_src(t_vtex)); in create_ycbcr_vert_shader()
290 ureg_CMP(shader, ureg_writemask(t_vtex, TGSI_WRITEMASK_Y), in create_ycbcr_vert_shader()
294 ureg_ADD(shader, ureg_writemask(o_vpos, TGSI_WRITEMASK_Y), in create_ycbcr_vert_shader()
297 ureg_CMP(shader, ureg_writemask(o_flags, TGSI_WRITEMASK_W), in create_ycbcr_vert_shader()
299 ureg_imm1f(shader, 0.0f), ureg_imm1f(shader, 1.0f)); in create_ycbcr_vert_shader()
301 ureg_fixup_label(shader, label, ureg_get_instruction_number(shader)); in create_ycbcr_vert_shader()
302 ureg_ENDIF(shader); in create_ycbcr_vert_shader()
305 ureg_release_temporary(shader, t_vtex); in create_ycbcr_vert_shader()
306 ureg_release_temporary(shader, t_vpos); in create_ycbcr_vert_shader()
308 ureg_END(shader); in create_ycbcr_vert_shader()
310 return ureg_create_shader_and_destroy(shader, r->pipe); in create_ycbcr_vert_shader()
317 struct ureg_program *shader; in create_ycbcr_frag_shader() local
323 shader = ureg_create(PIPE_SHADER_FRAGMENT); in create_ycbcr_frag_shader()
324 if (!shader) in create_ycbcr_frag_shader()
327 flags = ureg_DECL_fs_input(shader, TGSI_SEMANTIC_GENERIC, VS_O_FLAGS, TGSI_INTERPOLATE_LINEAR); in create_ycbcr_frag_shader()
329 fragment = ureg_DECL_output(shader, TGSI_SEMANTIC_COLOR, 0); in create_ycbcr_frag_shader()
331 tmp = calc_line(r->pipe->screen, shader); in create_ycbcr_frag_shader()
342 ureg_SEQ(shader, ureg_writemask(tmp, TGSI_WRITEMASK_Y), in create_ycbcr_frag_shader()
345 ureg_IF(shader, ureg_scalar(ureg_src(tmp), TGSI_SWIZZLE_Y), &label); in create_ycbcr_frag_shader()
347 ureg_KILL(shader); in create_ycbcr_frag_shader()
349 ureg_fixup_label(shader, label, ureg_get_instruction_number(shader)); in create_ycbcr_frag_shader()
350 ureg_ELSE(shader, &label); in create_ycbcr_frag_shader()
352 fs_callback(callback_priv, r, shader, VS_O_VTEX, tmp); in create_ycbcr_frag_shader()
355 ureg_MAD(shader, ureg_writemask(tmp, TGSI_WRITEMASK_XYZ), in create_ycbcr_frag_shader()
356 ureg_src(tmp), ureg_imm1f(shader, scale), in create_ycbcr_frag_shader()
359 ureg_ADD(shader, ureg_writemask(tmp, TGSI_WRITEMASK_XYZ), in create_ycbcr_frag_shader()
362 …ureg_MUL(shader, ureg_writemask(fragment, TGSI_WRITEMASK_XYZ), ureg_src(tmp), ureg_imm1f(shader, i… in create_ycbcr_frag_shader()
363 ureg_MOV(shader, ureg_writemask(fragment, TGSI_WRITEMASK_W), ureg_imm1f(shader, 1.0f)); in create_ycbcr_frag_shader()
365 ureg_fixup_label(shader, label, ureg_get_instruction_number(shader)); in create_ycbcr_frag_shader()
366 ureg_ENDIF(shader); in create_ycbcr_frag_shader()
368 ureg_release_temporary(shader, tmp); in create_ycbcr_frag_shader()
370 ureg_END(shader); in create_ycbcr_frag_shader()
372 return ureg_create_shader_and_destroy(shader, r->pipe); in create_ycbcr_frag_shader()