summaryrefslogtreecommitdiff
path: root/src/gallium/auxiliary/vl
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/auxiliary/vl')
-rw-r--r--src/gallium/auxiliary/vl/vl_compositor.c8
-rw-r--r--src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c55
-rw-r--r--src/gallium/auxiliary/vl/vl_shader_build.c41
-rw-r--r--src/gallium/auxiliary/vl/vl_shader_build.h11
4 files changed, 57 insertions, 58 deletions
diff --git a/src/gallium/auxiliary/vl/vl_compositor.c b/src/gallium/auxiliary/vl/vl_compositor.c
index 2f594c48dd5..fc2a1c59a6b 100644
--- a/src/gallium/auxiliary/vl/vl_compositor.c
+++ b/src/gallium/auxiliary/vl/vl_compositor.c
@@ -199,12 +199,8 @@ create_frag_shader(struct vl_compositor *c)
decl = vl_decl_samplers(0, 0);
ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti);
- /* decl r0, 2D ; Resource containing picture to display */
- decl = vl_decl_resource(0, TGSI_TEXTURE_2D);
- ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti);
-
- /* tex t0, r0, i0, s0 ; Read src pixel */
- inst = vl_inst4(TGSI_OPCODE_TEX, TGSI_FILE_TEMPORARY, 0, TGSI_FILE_RESOURCE, 0, TGSI_FILE_INPUT, 0, TGSI_FILE_SAMPLER, 0);
+ /* tex2d t0, i0, s0 ; Read src pixel */
+ inst = vl_tex(TGSI_TEXTURE_2D, TGSI_FILE_TEMPORARY, 0, TGSI_FILE_INPUT, 0, TGSI_FILE_SAMPLER, 0);
ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti);
/*
diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c
index 9e72c5f32ed..caf581aca60 100644
--- a/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c
+++ b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c
@@ -215,30 +215,24 @@ create_intra_frag_shader(struct vl_mpeg12_mc_renderer *r)
/*
* decl s0 ; Sampler for luma texture
- * decl r0, 2D
* decl s1 ; Sampler for chroma Cb texture
- * decl r1, 2D
* decl s2 ; Sampler for chroma Cr texture
- * decl r2, 2D
*/
for (i = 0; i < 3; ++i) {
decl = vl_decl_samplers(i, i);
ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti);
-
- decl = vl_decl_resource(i, TGSI_TEXTURE_2D);
- ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti);
}
/*
- * tex t1, r0, i0, s0 ; Read texel from luma texture
+ * tex2d t1, i0, s0 ; Read texel from luma texture
* mov t0.x, t1.x ; Move luma sample into .x component
- * tex t1, r1, i1, s1 ; Read texel from chroma Cb texture
+ * tex2d t1, i1, s1 ; Read texel from chroma Cb texture
* mov t0.y, t1.x ; Move Cb sample into .y component
- * tex t1, r2, i2, s2 ; Read texel from chroma Cr texture
+ * tex2d t1, i2, s2 ; Read texel from chroma Cr texture
* mov t0.z, t1.x ; Move Cr sample into .z component
*/
for (i = 0; i < 3; ++i) {
- inst = vl_inst4(TGSI_OPCODE_TEX, TGSI_FILE_TEMPORARY, 1, TGSI_FILE_RESOURCE, i, TGSI_FILE_INPUT, i, TGSI_FILE_SAMPLER, i);
+ inst = vl_tex(TGSI_TEXTURE_2D, TGSI_FILE_TEMPORARY, 1, TGSI_FILE_INPUT, i, TGSI_FILE_SAMPLER, i);
ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti);
inst = vl_inst2(TGSI_OPCODE_MOV, TGSI_FILE_TEMPORARY, 0, TGSI_FILE_TEMPORARY, 1);
@@ -398,32 +392,25 @@ create_frame_pred_frag_shader(struct vl_mpeg12_mc_renderer *r)
/*
* decl s0 ; Sampler for luma texture
- * decl r0, 2D
* decl s1 ; Sampler for chroma Cb texture
- * decl r1, 2D
* decl s2 ; Sampler for chroma Cr texture
- * decl r2, 2D
* decl s3 ; Sampler for ref surface texture
- * decl r3, 2D
*/
for (i = 0; i < 4; ++i) {
decl = vl_decl_samplers(i, i);
ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti);
-
- decl = vl_decl_resource(i, TGSI_TEXTURE_2D);
- ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti);
}
/*
- * tex t1, r0, i0, s0 ; Read texel from luma texture
+ * tex2d t1, i0, s0 ; Read texel from luma texture
* mov t0.x, t1.x ; Move luma sample into .x component
- * tex t1, r1, i1, s1 ; Read texel from chroma Cb texture
+ * tex2d t1, i1, s1 ; Read texel from chroma Cb texture
* mov t0.y, t1.x ; Move Cb sample into .y component
- * tex t1, r2, i2, s2 ; Read texel from chroma Cr texture
+ * tex2d t1, i2, s2 ; Read texel from chroma Cr texture
* mov t0.z, t1.x ; Move Cr sample into .z component
*/
for (i = 0; i < 3; ++i) {
- inst = vl_inst4(TGSI_OPCODE_TEX, TGSI_FILE_TEMPORARY, 1, TGSI_FILE_RESOURCE, i, TGSI_FILE_INPUT, i, TGSI_FILE_SAMPLER, i);
+ inst = vl_tex(TGSI_TEXTURE_2D, TGSI_FILE_TEMPORARY, 1, TGSI_FILE_INPUT, i, TGSI_FILE_SAMPLER, i);
ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti);
inst = vl_inst2(TGSI_OPCODE_MOV, TGSI_FILE_TEMPORARY, 0, TGSI_FILE_TEMPORARY, 1);
@@ -438,8 +425,8 @@ create_frame_pred_frag_shader(struct vl_mpeg12_mc_renderer *r)
inst = vl_inst3(TGSI_OPCODE_MUL, TGSI_FILE_TEMPORARY, 0, TGSI_FILE_TEMPORARY, 0, TGSI_FILE_CONSTANT, 0);
ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti);
- /* tex t1, r3, i3, s3 ; Read texel from ref macroblock */
- inst = vl_inst4(TGSI_OPCODE_TEX, TGSI_FILE_TEMPORARY, 1, TGSI_FILE_RESOURCE, 3, TGSI_FILE_INPUT, 3, TGSI_FILE_SAMPLER, 3);
+ /* tex2d t1, i3, s3 ; Read texel from ref macroblock */
+ inst = vl_tex(TGSI_TEXTURE_2D, TGSI_FILE_TEMPORARY, 1, TGSI_FILE_INPUT, 3, TGSI_FILE_SAMPLER, 3);
ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti);
/* add o0, t0, t1 ; Add ref and differential to form final output */
@@ -611,34 +598,26 @@ create_frame_bi_pred_frag_shader(struct vl_mpeg12_mc_renderer *r)
/*
* decl s0 ; Sampler for luma texture
- * decl r0, 2D
* decl s1 ; Sampler for chroma Cb texture
- * decl r1, 2D
* decl s2 ; Sampler for chroma Cr texture
- * decl r2, 2D
* decl s3 ; Sampler for first ref surface texture
- * decl r3, 2D
* decl s4 ; Sampler for second ref surface texture
- * decl r4, 2D
*/
for (i = 0; i < 5; ++i) {
decl = vl_decl_samplers(i, i);
ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti);
-
- decl = vl_decl_resource(i, TGSI_TEXTURE_2D);
- ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti);
}
/*
- * tex t1, r0, i0, s0 ; Read texel from luma texture
+ * tex2d t1, i0, s0 ; Read texel from luma texture
* mov t0.x, t1.x ; Move luma sample into .x component
- * tex t1, r1, i1, s1 ; Read texel from chroma Cb texture
+ * tex2d t1, i1, s1 ; Read texel from chroma Cb texture
* mov t0.y, t1.x ; Move Cb sample into .y component
- * tex t1, r2, i2, s2 ; Read texel from chroma Cr texture
+ * tex2d t1, i2, s2 ; Read texel from chroma Cr texture
* mov t0.z, t1.x ; Move Cr sample into .z component
*/
for (i = 0; i < 3; ++i) {
- inst = vl_inst4(TGSI_OPCODE_TEX, TGSI_FILE_TEMPORARY, 1, TGSI_FILE_RESOURCE, i, TGSI_FILE_INPUT, i, TGSI_FILE_SAMPLER, i);
+ inst = vl_tex(TGSI_TEXTURE_2D, TGSI_FILE_TEMPORARY, 1, TGSI_FILE_INPUT, i, TGSI_FILE_SAMPLER, i);
ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti);
inst = vl_inst2(TGSI_OPCODE_MOV, TGSI_FILE_TEMPORARY, 0, TGSI_FILE_TEMPORARY, 1);
@@ -654,11 +633,11 @@ create_frame_bi_pred_frag_shader(struct vl_mpeg12_mc_renderer *r)
ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti);
/*
- * tex t1, r3, i3, s3 ; Read texel from first ref macroblock
- * tex t2, r4, i4, s4 ; Read texel from second ref macroblock
+ * tex2d t1, i3, s3 ; Read texel from first ref macroblock
+ * tex2d t2, i4, s4 ; Read texel from second ref macroblock
*/
for (i = 0; i < 2; ++i) {
- inst = vl_inst4(TGSI_OPCODE_TEX, TGSI_FILE_TEMPORARY, i + 1, TGSI_FILE_RESOURCE, i + 3, TGSI_FILE_INPUT, i + 3, TGSI_FILE_SAMPLER, i + 3);
+ inst = vl_tex(TGSI_TEXTURE_2D, TGSI_FILE_TEMPORARY, i + 1, TGSI_FILE_INPUT, i + 3, TGSI_FILE_SAMPLER, i + 3);
ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti);
}
diff --git a/src/gallium/auxiliary/vl/vl_shader_build.c b/src/gallium/auxiliary/vl/vl_shader_build.c
index 30cd823383b..d011ef97bd6 100644
--- a/src/gallium/auxiliary/vl/vl_shader_build.c
+++ b/src/gallium/auxiliary/vl/vl_shader_build.c
@@ -125,19 +125,6 @@ struct tgsi_full_declaration vl_decl_samplers(unsigned int first, unsigned int l
return decl;
}
-struct tgsi_full_declaration vl_decl_resource(unsigned int index, unsigned int target)
-{
- struct tgsi_full_declaration decl = tgsi_default_full_declaration();
-
- decl.Declaration.File = TGSI_FILE_RESOURCE;
- decl.Declaration.Resource = 1;
- decl.Range.First = index;
- decl.Range.Last = index;
- decl.Resource.Texture = target;
-
- return decl;
-}
-
struct tgsi_full_instruction vl_inst2
(
int opcode,
@@ -186,6 +173,34 @@ struct tgsi_full_instruction vl_inst3
return inst;
}
+struct tgsi_full_instruction vl_tex
+(
+ int tex,
+ enum tgsi_file_type dst_file,
+ unsigned int dst_index,
+ enum tgsi_file_type src1_file,
+ unsigned int src1_index,
+ enum tgsi_file_type src2_file,
+ unsigned int src2_index
+)
+{
+ struct tgsi_full_instruction inst = tgsi_default_full_instruction();
+
+ inst.Instruction.Opcode = TGSI_OPCODE_TEX;
+ inst.Instruction.NumDstRegs = 1;
+ inst.Dst[0].Register.File = dst_file;
+ inst.Dst[0].Register.Index = dst_index;
+ inst.Instruction.NumSrcRegs = 2;
+ inst.Instruction.Texture = 1;
+ inst.Texture.Texture = tex;
+ inst.Src[0].Register.File = src1_file;
+ inst.Src[0].Register.Index = src1_index;
+ inst.Src[1].Register.File = src2_file;
+ inst.Src[1].Register.Index = src2_index;
+
+ return inst;
+}
+
struct tgsi_full_instruction vl_inst4
(
int opcode,
diff --git a/src/gallium/auxiliary/vl/vl_shader_build.h b/src/gallium/auxiliary/vl/vl_shader_build.h
index c3fb7c6110b..5da71f8e136 100644
--- a/src/gallium/auxiliary/vl/vl_shader_build.h
+++ b/src/gallium/auxiliary/vl/vl_shader_build.h
@@ -43,7 +43,6 @@ struct tgsi_full_declaration vl_decl_constants(unsigned int name, unsigned int i
struct tgsi_full_declaration vl_decl_output(unsigned int name, unsigned int index, unsigned int first, unsigned int last);
struct tgsi_full_declaration vl_decl_temps(unsigned int first, unsigned int last);
struct tgsi_full_declaration vl_decl_samplers(unsigned int first, unsigned int last);
-struct tgsi_full_declaration vl_decl_resource(unsigned int index, unsigned int target);
struct tgsi_full_instruction vl_inst2
(
int opcode,
@@ -62,6 +61,16 @@ struct tgsi_full_instruction vl_inst3
enum tgsi_file_type src2_file,
unsigned int src2_index
);
+struct tgsi_full_instruction vl_tex
+(
+ int tex,
+ enum tgsi_file_type dst_file,
+ unsigned int dst_index,
+ enum tgsi_file_type src1_file,
+ unsigned int src1_index,
+ enum tgsi_file_type src2_file,
+ unsigned int src2_index
+);
struct tgsi_full_instruction vl_inst4
(
int opcode,