summaryrefslogtreecommitdiffstats
path: root/src/mesa/shader
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2007-05-16 15:34:22 -0700
committerIan Romanick <[email protected]>2007-05-16 15:34:22 -0700
commitbb372f1c9bc08e8b0dca983cb4ba36b2f2f039fb (patch)
treeae0fe211215492e6e4ffec238e06ee15adca4a45 /src/mesa/shader
parent9ebffb86a699e49fd683ed9afbf6d5b2ac244ae0 (diff)
Initial implementation of MESA_texture_array
Shadow sampling from texture arrays is still not implemented. Everything else should be there, though.
Diffstat (limited to 'src/mesa/shader')
-rw-r--r--src/mesa/shader/arbprogparse.c22
-rw-r--r--src/mesa/shader/arbprogram.syn21
-rw-r--r--src/mesa/shader/arbprogram_syn.h15
3 files changed, 50 insertions, 8 deletions
diff --git a/src/mesa/shader/arbprogparse.c b/src/mesa/shader/arbprogparse.c
index 5027264f031..7da3c19a89a 100644
--- a/src/mesa/shader/arbprogparse.c
+++ b/src/mesa/shader/arbprogparse.c
@@ -181,7 +181,7 @@ LONGSTRING static char arb_grammar_text[] =
- changed and merged V_* and F_* opcode values to OP_*.
- added GL_ARB_fragment_program_shadow specific tokens (michal)
*/
-#define REVISION 0x09
+#define REVISION 0x0a
/* program type */
#define FRAGMENT_PROGRAM 0x01
@@ -209,6 +209,9 @@ LONGSTRING static char arb_grammar_text[] =
/* GL_ARB_draw_buffers option */
#define ARB_DRAW_BUFFERS 0x07
+/* GL_MESA_texture_array option */
+#define MESA_TEXTURE_ARRAY 0x08
+
/* GL_ARB_fragment_program instruction class */
#define OP_ALU_INST 0x00
#define OP_TEX_INST 0x01
@@ -368,6 +371,9 @@ LONGSTRING static char arb_grammar_text[] =
#define TEXTARGET_SHADOW1D 0x06
#define TEXTARGET_SHADOW2D 0x07
#define TEXTARGET_SHADOWRECT 0x08
+/* GL_MESA_texture_array */
+#define TEXTARGET_1D_ARRAY 0x09
+#define TEXTARGET_2D_ARRAY 0x0a
/* face type */
#define FACE_FRONT 0x00
@@ -2990,6 +2996,12 @@ parse_fp_instruction (GLcontext * ctx, const GLubyte ** inst,
case TEXTARGET_SHADOWRECT:
/* TODO ARB_fragment_program_shadow code */
break;
+ case TEXTARGET_1D_ARRAY:
+ fp->TexSrcTarget = TEXTURE_1D_ARRAY_INDEX;
+ break;
+ case TEXTARGET_2D_ARRAY:
+ fp->TexSrcTarget = TEXTURE_2D_ARRAY_INDEX;
+ break;
}
Program->TexturesUsed[texcoord] |= (1 << fp->TexSrcTarget);
/* Check that both "2D" and "CUBE" (for example) aren't both used */
@@ -3464,6 +3476,10 @@ parse_instructions(GLcontext * ctx, const GLubyte * inst,
/* do nothing for now */
}
break;
+
+ case MESA_TEXTURE_ARRAY:
+ /* do nothing for now */
+ break;
}
break;
@@ -3603,7 +3619,9 @@ enable_parser_extensions(GLcontext *ctx, grammar id)
if (ctx->Extensions.ARB_draw_buffers
&& !enable_ext(ctx, id, "draw_buffers"))
return GL_FALSE;
-
+ if (ctx->Extensions.MESA_texture_array
+ && !enable_ext(ctx, id, "texture_array"))
+ return GL_FALSE;
#if 1
/* hack for Warcraft (see bug 8060) */
enable_ext(ctx, id, "vertex_blend");
diff --git a/src/mesa/shader/arbprogram.syn b/src/mesa/shader/arbprogram.syn
index 6ab0f269380..4f82717873e 100644
--- a/src/mesa/shader/arbprogram.syn
+++ b/src/mesa/shader/arbprogram.syn
@@ -36,7 +36,7 @@
compares the value with its REVISION value. If they do not match, the loader is not up
to date.
*/
-.emtcode REVISION 0x09
+.emtcode REVISION 0x0a
/* program type */
.emtcode FRAGMENT_PROGRAM 0x01
@@ -64,6 +64,9 @@
/* GL_ARB_draw_buffers option */
.emtcode ARB_DRAW_BUFFERS 0x07
+/* GL_MESA_texture_array option */
+.emtcode MESA_TEXTURE_ARRAY 0x08
+
/* GL_ARB_fragment_program instruction class */
.emtcode OP_ALU_INST 0x00
.emtcode OP_TEX_INST 0x01
@@ -223,6 +226,8 @@
.emtcode TEXTARGET_SHADOW1D 0x06
.emtcode TEXTARGET_SHADOW2D 0x07
.emtcode TEXTARGET_SHADOWRECT 0x08
+.emtcode TEXTARGET_1D_ARRAY 0x09
+.emtcode TEXTARGET_2D_ARRAY 0x0a
/* face type */
.emtcode FACE_FRONT 0x00
@@ -436,6 +441,9 @@
/* GL_ARB_draw_buffers */
.regbyte draw_buffers 0x00
+/* GL_MESA_texture_array */
+.regbyte texture_array 0x00
+
/* option presence condition registers */
/* they are all initially set to zero - when a particular OPTION is encountered, the appropriate */
/* register is set to 1 to indicate that the OPTION was specified. */
@@ -456,6 +464,9 @@
/* GL_ARB_draw_buffers */
.regbyte ARB_draw_buffers 0x00
+/* GL_MESA_texture_array */
+.regbyte MESA_texture_array 0x00
+
/* program target condition register */
/* this syntax script deals with two program targets - VERTEX_PROGRAM and FRAGMENT_PROGRAM. */
/* to distinguish between them we need a register that will store for us the current target. */
@@ -523,7 +534,9 @@ fp_optionString
.if (fragment_program_shadow != 0x00) "ARB_fragment_program_shadow"
.emit ARB_FRAGMENT_PROGRAM_SHADOW .load ARB_fragment_program_shadow 0x01 .or
.if (draw_buffers != 0x00) "ARB_draw_buffers" .emit ARB_DRAW_BUFFERS
- .load ARB_draw_buffers 0x01;
+ .load ARB_draw_buffers 0x01 .or
+ .if (texture_array != 0x00) "MESA_texture_array" .emit MESA_TEXTURE_ARRAY
+ .load MESA_texture_array 0x01;
vp_optionString
"ARB_position_invariant" .emit ARB_POSITION_INVARIANT .load ARB_position_invariant 0x01;
fp_ARB_fog_exp
@@ -906,7 +919,9 @@ texTarget
"3D" .emit TEXTARGET_3D .or
.if (texture_rectangle != 0x00) "RECT" .emit TEXTARGET_RECT .or
"CUBE" .emit TEXTARGET_CUBE .or
- .if (ARB_fragment_program_shadow != 0x00) shadowTarget;
+ .if (ARB_fragment_program_shadow != 0x00) shadowTarget .or
+ .if (MESA_texture_array != 0x00) "ARRAY1D" .emit TEXTARGET_1D_ARRAY .or
+ .if (MESA_texture_array != 0x00) "ARRAY2D" .emit TEXTARGET_2D_ARRAY;
/*
GL_ARB_fragment_program_shadow
diff --git a/src/mesa/shader/arbprogram_syn.h b/src/mesa/shader/arbprogram_syn.h
index c67afc67db9..30dc9f4594e 100644
--- a/src/mesa/shader/arbprogram_syn.h
+++ b/src/mesa/shader/arbprogram_syn.h
@@ -1,5 +1,5 @@
".syntax program;\n"
-".emtcode REVISION 0x09\n"
+".emtcode REVISION 0x0a\n"
".emtcode FRAGMENT_PROGRAM 0x01\n"
".emtcode VERTEX_PROGRAM 0x02\n"
".emtcode OPTION 0x01\n"
@@ -14,6 +14,7 @@
".emtcode ARB_POSITION_INVARIANT 0x05\n"
".emtcode ARB_FRAGMENT_PROGRAM_SHADOW 0x06\n"
".emtcode ARB_DRAW_BUFFERS 0x07\n"
+".emtcode MESA_TEXTURE_ARRAY 0x08\n"
".emtcode OP_ALU_INST 0x00\n"
".emtcode OP_TEX_INST 0x01\n"
".emtcode OP_ALU_VECTOR 0x00\n"
@@ -120,6 +121,8 @@
".emtcode TEXTARGET_SHADOW1D 0x06\n"
".emtcode TEXTARGET_SHADOW2D 0x07\n"
".emtcode TEXTARGET_SHADOWRECT 0x08\n"
+".emtcode TEXTARGET_1D_ARRAY 0x09\n"
+".emtcode TEXTARGET_2D_ARRAY 0x0A\n"
".emtcode FACE_FRONT 0x00\n"
".emtcode FACE_BACK 0x01\n"
".emtcode COLOR_PRIMARY 0x00\n"
@@ -264,6 +267,7 @@
".regbyte texture_rectangle 0x00\n"
".regbyte fragment_program_shadow 0x00\n"
".regbyte draw_buffers 0x00\n"
+".regbyte texture_array 0x00\n"
".regbyte ARB_precision_hint_fastest 0x00\n"
".regbyte ARB_precision_hint_nicest 0x00\n"
".regbyte ARB_fog_exp 0x00\n"
@@ -272,6 +276,7 @@
".regbyte ARB_position_invariant 0x00\n"
".regbyte ARB_fragment_program_shadow 0x00\n"
".regbyte ARB_draw_buffers 0x00\n"
+".regbyte MESA_texture_array 0x00\n"
".regbyte program_target 0x00\n"
"program\n"
" programs .error UNKNOWN_PROGRAM_SIGNATURE .emit REVISION;\n"
@@ -309,7 +314,9 @@
" .if (fragment_program_shadow != 0x00) \"ARB_fragment_program_shadow\"\n"
" .emit ARB_FRAGMENT_PROGRAM_SHADOW .load ARB_fragment_program_shadow 0x01 .or\n"
" .if (draw_buffers != 0x00) \"ARB_draw_buffers\" .emit ARB_DRAW_BUFFERS\n"
-" .load ARB_draw_buffers 0x01;\n"
+" .load ARB_draw_buffers 0x01 .or\n"
+" .if (texture_array != 0x00) \"MESA_texture_array\" .emit MESA_TEXTURE_ARRAY\n"
+" .load MESA_texture_array 0x01;\n"
"vp_optionString\n"
" \"ARB_position_invariant\" .emit ARB_POSITION_INVARIANT .load ARB_position_invariant 0x01;\n"
"fp_ARB_fog_exp\n"
@@ -471,7 +478,9 @@
" \"3D\" .emit TEXTARGET_3D .or\n"
" .if (texture_rectangle != 0x00) \"RECT\" .emit TEXTARGET_RECT .or\n"
" \"CUBE\" .emit TEXTARGET_CUBE .or\n"
-" .if (ARB_fragment_program_shadow != 0x00) shadowTarget;\n"
+" .if (ARB_fragment_program_shadow != 0x00) shadowTarget .or\n"
+" .if (MESA_texture_array != 0x00) \"ARRAY1D\" .emit TEXTARGET_1D_ARRAY .or\n"
+" .if (MESA_texture_array != 0x00) \"ARRAY2D\" .emit TEXTARGET_2D_ARRAY;\n"
"shadowTarget\n"
" \"SHADOW1D\" .emit TEXTARGET_SHADOW1D .or\n"
" \"SHADOW2D\" .emit TEXTARGET_SHADOW2D .or\n"