noise functions
authorBrian <brian@nostromo.localnet.net>
Mon, 29 Jan 2007 02:01:35 +0000 (19:01 -0700)
committerBrian <brian@nostromo.localnet.net>
Mon, 29 Jan 2007 02:01:35 +0000 (19:01 -0700)
src/mesa/shader/prog_instruction.c
src/mesa/shader/prog_instruction.h
src/mesa/shader/slang/library/slang_common_builtin.gc
src/mesa/shader/slang/library/slang_common_builtin_gc.h
src/mesa/shader/slang/slang_codegen.c
src/mesa/shader/slang/slang_emit.c
src/mesa/shader/slang/slang_ir.h
src/mesa/swrast/s_fragprog.c
src/mesa/tnl/t_vb_arbprogram.c

index 3de71b8b5d0607a96283a6cdd86fee23a3b46c9c..0523f4212548ffccb926c9af9b68d982f84ddfff 100644 (file)
@@ -150,6 +150,10 @@ static const struct instruction_info InstInfo[MAX_OPCODE] = {
    { OPCODE_MIN,    "MIN",   2 },
    { OPCODE_MOV,    "MOV",   1 },
    { OPCODE_MUL,    "MUL",   2 },
+   { OPCODE_NOISE1, "NOISE1", 1 },
+   { OPCODE_NOISE2, "NOISE2", 1 },
+   { OPCODE_NOISE3, "NOISE3", 1 },
+   { OPCODE_NOISE4, "NOISE4", 1 },
    { OPCODE_PK2H,   "PK2H",  1 },
    { OPCODE_PK2US,  "PK2US", 1 },
    { OPCODE_PK4B,   "PK4B",  1 },
index 83e8d7080b48a81f0d35e0e81d8b92d6e5a9e015..3e88b4e6270c5c1ce171e6970208c92365d3e8f5 100644 (file)
@@ -172,6 +172,10 @@ typedef enum prog_opcode {
    OPCODE_MIN,       /*   X        X       X       X         X   */
    OPCODE_MOV,       /*   X        X       X       X         X   */
    OPCODE_MUL,       /*   X        X       X       X         X   */
+   OPCODE_NOISE1,    /*                                      X   */
+   OPCODE_NOISE2,    /*                                      X   */
+   OPCODE_NOISE3,    /*                                      X   */
+   OPCODE_NOISE4,    /*                                      X   */
    OPCODE_PK2H,      /*                            X             */
    OPCODE_PK2US,     /*                            X             */
    OPCODE_PK4B,      /*                            X             */
index 8812a7341602c8824e3a19630379cab9cc2b0263..e4a55846b8936924fbb2d4622fd6a98fd869af62 100644 (file)
@@ -1699,123 +1699,107 @@ vec4 shadow2DProj (sampler2DShadow sampler, vec4 coord) {
 // AUTHOR: Stefan Gustavson (stegu@itn.liu.se), Nov 26, 2005
 //
 
-float noise1 (float x) {
-    float a;
-    __asm float_noise1 a, x;
-    return a;
+float noise1(const float x)
+{
+   __asm float_noise1 __retVal, x;
 }
 
-float noise1 (vec2 x) {
-    float a;
-    __asm float_noise2 a, x;
-    return a;
-}
 
-float noise1 (vec3 x) {
-    float a;
-    __asm float_noise3 a, x;
-    return a;
+float noise1(const vec2 x)
+{
+    __asm float_noise2 __retVal, x;
 }
 
-float noise1 (vec4 x) {
-    float a;
-    __asm float_noise4 a, x;
-    return a;
+float noise1(const vec3 x)
+{
+    __asm float_noise3 __retVal, x;
 }
 
-vec2 noise2 (float x) {
-    return vec2 (
-        noise1 (x),
-        noise1 (x + 19.34)
-    );
+float noise1(const vec4 x)
+{
+    __asm float_noise4 __retVal, x;
 }
 
-vec2 noise2 (vec2 x) {
-    return vec2 (
-        noise1 (x),
-        noise1 (x + vec2 (19.34, 7.66))
-    );
+vec2 noise2(const float x)
+{
+   __retVal.x = noise1(x);
+   __retVal.y = noise1(x + 19.34);
 }
 
-vec2 noise2 (vec3 x) {
-    return vec2 (
-        noise1 (x),
-        noise1 (x + vec3 (19.34, 7.66, 3.23))
-    );
+vec2 noise2(const vec2 x)
+{
+   __retVal.x = noise1(x);
+   __retVal.y = noise1(x + vec2(19.34, 7.66));
 }
 
-vec2 noise2 (vec4 x) {
-    return vec2 (
-        noise1 (x),
-        noise1 (x + vec4 (19.34, 7.66, 3.23, 2.77))
-    );
+vec2 noise2(const vec3 x)
+{
+   __retVal.x = noise1(x);
+   __retVal.y = noise1(x + vec3(19.34, 7.66, 3.23));
 }
 
-vec3 noise3 (float x) {
-    return vec3 (
-        noise1 (x),
-        noise1 (x + 19.34),
-        noise1 (x + 5.47)
-    );
+vec2 noise2(const vec4 x)
+{
+   __retVal.x = noise1(x);
+   __retVal.y = noise1(x + vec4(19.34, 7.66, 3.23, 2.77));
 }
 
-vec3 noise3 (vec2 x) {
-    return vec3 (
-        noise1 (x),
-        noise1 (x + vec2 (19.34, 7.66)),
-        noise1 (x + vec2 (5.47, 17.85))
-    );
+vec3 noise3(const float x)
+{
+   __retVal.x = noise1(x);
+   __retVal.y = noise1(x + 19.34);
+   __retVal.z = noise1(x + 5.47);
 }
 
-vec3 noise3 (vec3 x) {
-    return vec3 (
-        noise1 (x),
-        noise1 (x + vec3 (19.34, 7.66, 3.23)),
-        noise1 (x + vec3 (5.47, 17.85, 11.04))
-    );
+vec3 noise3(const vec2 x)
+{
+   __retVal.x = noise1(x);
+   __retVal.y = noise1(x + vec2(19.34, 7.66));
+   __retVal.z = noise1(x + vec2(5.47, 17.85));
 }
 
-vec3 noise3 (vec4 x) {
-    return vec3 (
-        noise1 (x),
-        noise1 (x + vec4 (19.34, 7.66, 3.23, 2.77)),
-        noise1 (x + vec4 (5.47, 17.85, 11.04, 13.19))
-    );
+vec3 noise3(const vec3 x)
+{
+   __retVal.x = noise1(x);
+   __retVal.y = noise1(x + vec3(19.34, 7.66, 3.23));
+   __retVal.z = noise1(x + vec3(5.47, 17.85, 11.04));
 }
 
-vec4 noise4 (float x) {
-    return vec4 (
-        noise1 (x),
-        noise1 (x + 19.34),
-        noise1 (x + 5.47),
-        noise1 (x + 23.54)
-    );
+vec3 noise3(const vec4 x)
+{
+   __retVal.x = noise1(x);
+   __retVal.y = noise1(x + vec4(19.34, 7.66, 3.23, 2.77));
+   __retVal.z = noise1(x + vec4(5.47, 17.85, 11.04, 13.19));
 }
 
-vec4 noise4 (vec2 x) {
-    return vec4 (
-        noise1 (x),
-        noise1 (x + vec2 (19.34, 7.66)),
-        noise1 (x + vec2 (5.47, 17.85)),
-        noise1 (x + vec2 (23.54, 29.11))
-    );
+vec4 noise4(const float x)
+{
+   __retVal.x = noise1(x);
+   __retVal.y = noise1(x + 19.34);
+   __retVal.z = noise1(x + 5.47);
+   __retVal.w = noise1(x + 23.54);
 }
 
-vec4 noise4 (vec3 x) {
-    return vec4 (
-        noise1 (x),
-        noise1 (x + vec3 (19.34, 7.66, 3.23)),
-        noise1 (x + vec3 (5.47, 17.85, 11.04)),
-        noise1 (x + vec3 (23.54, 29.11, 31.91))
-    );
+vec4 noise4(const vec2 x)
+{
+   __retVal.x = noise1(x);
+   __retVal.y = noise1(x + vec2 (19.34, 7.66));
+   __retVal.z = noise1(x + vec2 (5.47, 17.85));
+   __retVal.w = noise1(x + vec2 (23.54, 29.11));
 }
 
-vec4 noise4 (vec4 x) {
-    return vec4 (
-        noise1 (x),
-        noise1 (x + vec4 (19.34, 7.66, 3.23, 2.77)),
-        noise1 (x + vec4 (5.47, 17.85, 11.04, 13.19)),
-        noise1 (x + vec4 (23.54, 29.11, 31.91, 37.48))
-    );
+vec4 noise4(const vec3 x)
+{
+   __retVal.x = noise1(x);
+   __retVal.y = noise1(x + vec3(19.34, 7.66, 3.23));
+   __retVal.z = noise1(x + vec3(5.47, 17.85, 11.04));
+   __retVal.w = noise1(x + vec3(23.54, 29.11, 31.91));
 }
 
+vec4 noise4(const vec4 x)
+{
+   __retVal.x = noise1(x);
+   __retVal.y = noise1(x + vec4(19.34, 7.66, 3.23, 2.77));
+   __retVal.z = noise1(x + vec4(5.47, 17.85, 11.04, 13.19));
+   __retVal.w = noise1(x + vec4(23.54, 29.11, 31.91, 37.48));
+}
index 655efdda16832f79a9510185626d3660664dc7c6..e64f401115c63a577e225727ecbc8fffd8bc4c73 100644 (file)
 100,0,0,0,1,8,58,115,104,97,100,111,119,50,68,0,18,115,97,109,112,108,101,114,0,0,58,118,101,99,51,
 0,18,99,111,111,114,100,0,59,115,0,18,99,111,111,114,100,0,59,113,0,49,0,18,99,111,111,114,100,0,
 59,116,0,18,99,111,111,114,100,0,59,113,0,49,0,18,99,111,111,114,100,0,59,112,0,18,99,111,111,114,
-100,0,59,113,0,49,0,0,0,0,0,0,1,0,9,0,110,111,105,115,101,49,0,1,0,0,9,120,0,0,0,1,3,2,0,9,1,97,0,
-0,0,4,102,108,111,97,116,95,110,111,105,115,101,49,0,18,97,0,0,18,120,0,0,0,8,18,97,0,0,0,1,0,9,0,
-110,111,105,115,101,49,0,1,0,0,10,120,0,0,0,1,3,2,0,9,1,97,0,0,0,4,102,108,111,97,116,95,110,111,
-105,115,101,50,0,18,97,0,0,18,120,0,0,0,8,18,97,0,0,0,1,0,9,0,110,111,105,115,101,49,0,1,0,0,11,
-120,0,0,0,1,3,2,0,9,1,97,0,0,0,4,102,108,111,97,116,95,110,111,105,115,101,51,0,18,97,0,0,18,120,0,
-0,0,8,18,97,0,0,0,1,0,9,0,110,111,105,115,101,49,0,1,0,0,12,120,0,0,0,1,3,2,0,9,1,97,0,0,0,4,102,
-108,111,97,116,95,110,111,105,115,101,52,0,18,97,0,0,18,120,0,0,0,8,18,97,0,0,0,1,0,10,0,110,111,
-105,115,101,50,0,1,0,0,9,120,0,0,0,1,8,58,118,101,99,50,0,58,110,111,105,115,101,49,0,18,120,0,0,0,
-0,58,110,111,105,115,101,49,0,18,120,0,17,49,57,0,51,52,0,0,46,0,0,0,0,0,0,1,0,10,0,110,111,105,
-115,101,50,0,1,0,0,10,120,0,0,0,1,8,58,118,101,99,50,0,58,110,111,105,115,101,49,0,18,120,0,0,0,0,
-58,110,111,105,115,101,49,0,18,120,0,58,118,101,99,50,0,17,49,57,0,51,52,0,0,0,17,55,0,54,54,0,0,0,
-0,46,0,0,0,0,0,0,1,0,10,0,110,111,105,115,101,50,0,1,0,0,11,120,0,0,0,1,8,58,118,101,99,50,0,58,
-110,111,105,115,101,49,0,18,120,0,0,0,0,58,110,111,105,115,101,49,0,18,120,0,58,118,101,99,51,0,17,
-49,57,0,51,52,0,0,0,17,55,0,54,54,0,0,0,17,51,0,50,51,0,0,0,0,46,0,0,0,0,0,0,1,0,10,0,110,111,105,
-115,101,50,0,1,0,0,12,120,0,0,0,1,8,58,118,101,99,50,0,58,110,111,105,115,101,49,0,18,120,0,0,0,0,
-58,110,111,105,115,101,49,0,18,120,0,58,118,101,99,52,0,17,49,57,0,51,52,0,0,0,17,55,0,54,54,0,0,0,
-17,51,0,50,51,0,0,0,17,50,0,55,55,0,0,0,0,46,0,0,0,0,0,0,1,0,11,0,110,111,105,115,101,51,0,1,0,0,9,
-120,0,0,0,1,8,58,118,101,99,51,0,58,110,111,105,115,101,49,0,18,120,0,0,0,0,58,110,111,105,115,101,
-49,0,18,120,0,17,49,57,0,51,52,0,0,46,0,0,0,58,110,111,105,115,101,49,0,18,120,0,17,53,0,52,55,0,0,
-46,0,0,0,0,0,0,1,0,11,0,110,111,105,115,101,51,0,1,0,0,10,120,0,0,0,1,8,58,118,101,99,51,0,58,110,
-111,105,115,101,49,0,18,120,0,0,0,0,58,110,111,105,115,101,49,0,18,120,0,58,118,101,99,50,0,17,49,
-57,0,51,52,0,0,0,17,55,0,54,54,0,0,0,0,46,0,0,0,58,110,111,105,115,101,49,0,18,120,0,58,118,101,99,
-50,0,17,53,0,52,55,0,0,0,17,49,55,0,56,53,0,0,0,0,46,0,0,0,0,0,0,1,0,11,0,110,111,105,115,101,51,0,
-1,0,0,11,120,0,0,0,1,8,58,118,101,99,51,0,58,110,111,105,115,101,49,0,18,120,0,0,0,0,58,110,111,
-105,115,101,49,0,18,120,0,58,118,101,99,51,0,17,49,57,0,51,52,0,0,0,17,55,0,54,54,0,0,0,17,51,0,50,
-51,0,0,0,0,46,0,0,0,58,110,111,105,115,101,49,0,18,120,0,58,118,101,99,51,0,17,53,0,52,55,0,0,0,17,
-49,55,0,56,53,0,0,0,17,49,49,0,48,52,0,0,0,0,46,0,0,0,0,0,0,1,0,11,0,110,111,105,115,101,51,0,1,0,
-0,12,120,0,0,0,1,8,58,118,101,99,51,0,58,110,111,105,115,101,49,0,18,120,0,0,0,0,58,110,111,105,
-115,101,49,0,18,120,0,58,118,101,99,52,0,17,49,57,0,51,52,0,0,0,17,55,0,54,54,0,0,0,17,51,0,50,51,
-0,0,0,17,50,0,55,55,0,0,0,0,46,0,0,0,58,110,111,105,115,101,49,0,18,120,0,58,118,101,99,52,0,17,53,
-0,52,55,0,0,0,17,49,55,0,56,53,0,0,0,17,49,49,0,48,52,0,0,0,17,49,51,0,49,57,0,0,0,0,46,0,0,0,0,0,
-0,1,0,12,0,110,111,105,115,101,52,0,1,0,0,9,120,0,0,0,1,8,58,118,101,99,52,0,58,110,111,105,115,
-101,49,0,18,120,0,0,0,0,58,110,111,105,115,101,49,0,18,120,0,17,49,57,0,51,52,0,0,46,0,0,0,58,110,
-111,105,115,101,49,0,18,120,0,17,53,0,52,55,0,0,46,0,0,0,58,110,111,105,115,101,49,0,18,120,0,17,
-50,51,0,53,52,0,0,46,0,0,0,0,0,0,1,0,12,0,110,111,105,115,101,52,0,1,0,0,10,120,0,0,0,1,8,58,118,
-101,99,52,0,58,110,111,105,115,101,49,0,18,120,0,0,0,0,58,110,111,105,115,101,49,0,18,120,0,58,118,
-101,99,50,0,17,49,57,0,51,52,0,0,0,17,55,0,54,54,0,0,0,0,46,0,0,0,58,110,111,105,115,101,49,0,18,
-120,0,58,118,101,99,50,0,17,53,0,52,55,0,0,0,17,49,55,0,56,53,0,0,0,0,46,0,0,0,58,110,111,105,115,
-101,49,0,18,120,0,58,118,101,99,50,0,17,50,51,0,53,52,0,0,0,17,50,57,0,49,49,0,0,0,0,46,0,0,0,0,0,
-0,1,0,12,0,110,111,105,115,101,52,0,1,0,0,11,120,0,0,0,1,8,58,118,101,99,52,0,58,110,111,105,115,
-101,49,0,18,120,0,0,0,0,58,110,111,105,115,101,49,0,18,120,0,58,118,101,99,51,0,17,49,57,0,51,52,0,
-0,0,17,55,0,54,54,0,0,0,17,51,0,50,51,0,0,0,0,46,0,0,0,58,110,111,105,115,101,49,0,18,120,0,58,118,
-101,99,51,0,17,53,0,52,55,0,0,0,17,49,55,0,56,53,0,0,0,17,49,49,0,48,52,0,0,0,0,46,0,0,0,58,110,
-111,105,115,101,49,0,18,120,0,58,118,101,99,51,0,17,50,51,0,53,52,0,0,0,17,50,57,0,49,49,0,0,0,17,
-51,49,0,57,49,0,0,0,0,46,0,0,0,0,0,0,1,0,12,0,110,111,105,115,101,52,0,1,0,0,12,120,0,0,0,1,8,58,
-118,101,99,52,0,58,110,111,105,115,101,49,0,18,120,0,0,0,0,58,110,111,105,115,101,49,0,18,120,0,58,
+100,0,59,113,0,49,0,0,0,0,0,0,1,0,9,0,110,111,105,115,101,49,0,1,1,0,9,120,0,0,0,1,4,102,108,111,
+97,116,95,110,111,105,115,101,49,0,18,95,95,114,101,116,86,97,108,0,0,18,120,0,0,0,0,1,0,9,0,110,
+111,105,115,101,49,0,1,1,0,10,120,0,0,0,1,4,102,108,111,97,116,95,110,111,105,115,101,50,0,18,95,
+95,114,101,116,86,97,108,0,0,18,120,0,0,0,0,1,0,9,0,110,111,105,115,101,49,0,1,1,0,11,120,0,0,0,1,
+4,102,108,111,97,116,95,110,111,105,115,101,51,0,18,95,95,114,101,116,86,97,108,0,0,18,120,0,0,0,0,
+1,0,9,0,110,111,105,115,101,49,0,1,1,0,12,120,0,0,0,1,4,102,108,111,97,116,95,110,111,105,115,101,
+52,0,18,95,95,114,101,116,86,97,108,0,0,18,120,0,0,0,0,1,0,10,0,110,111,105,115,101,50,0,1,1,0,9,
+120,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,59,120,0,58,110,111,105,115,101,49,0,18,120,0,0,0,
+20,0,9,18,95,95,114,101,116,86,97,108,0,59,121,0,58,110,111,105,115,101,49,0,18,120,0,17,49,57,0,
+51,52,0,0,46,0,0,20,0,0,1,0,10,0,110,111,105,115,101,50,0,1,1,0,10,120,0,0,0,1,9,18,95,95,114,101,
+116,86,97,108,0,59,120,0,58,110,111,105,115,101,49,0,18,120,0,0,0,20,0,9,18,95,95,114,101,116,86,
+97,108,0,59,121,0,58,110,111,105,115,101,49,0,18,120,0,58,118,101,99,50,0,17,49,57,0,51,52,0,0,0,
+17,55,0,54,54,0,0,0,0,46,0,0,20,0,0,1,0,10,0,110,111,105,115,101,50,0,1,1,0,11,120,0,0,0,1,9,18,95,
+95,114,101,116,86,97,108,0,59,120,0,58,110,111,105,115,101,49,0,18,120,0,0,0,20,0,9,18,95,95,114,
+101,116,86,97,108,0,59,121,0,58,110,111,105,115,101,49,0,18,120,0,58,118,101,99,51,0,17,49,57,0,51,
+52,0,0,0,17,55,0,54,54,0,0,0,17,51,0,50,51,0,0,0,0,46,0,0,20,0,0,1,0,10,0,110,111,105,115,101,50,0,
+1,1,0,12,120,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,59,120,0,58,110,111,105,115,101,49,0,18,
+120,0,0,0,20,0,9,18,95,95,114,101,116,86,97,108,0,59,121,0,58,110,111,105,115,101,49,0,18,120,0,58,
 118,101,99,52,0,17,49,57,0,51,52,0,0,0,17,55,0,54,54,0,0,0,17,51,0,50,51,0,0,0,17,50,0,55,55,0,0,0,
-0,46,0,0,0,58,110,111,105,115,101,49,0,18,120,0,58,118,101,99,52,0,17,53,0,52,55,0,0,0,17,49,55,0,
-56,53,0,0,0,17,49,49,0,48,52,0,0,0,17,49,51,0,49,57,0,0,0,0,46,0,0,0,58,110,111,105,115,101,49,0,
-18,120,0,58,118,101,99,52,0,17,50,51,0,53,52,0,0,0,17,50,57,0,49,49,0,0,0,17,51,49,0,57,49,0,0,0,
-17,51,55,0,52,56,0,0,0,0,46,0,0,0,0,0,0,0
+0,46,0,0,20,0,0,1,0,11,0,110,111,105,115,101,51,0,1,1,0,9,120,0,0,0,1,9,18,95,95,114,101,116,86,97,
+108,0,59,120,0,58,110,111,105,115,101,49,0,18,120,0,0,0,20,0,9,18,95,95,114,101,116,86,97,108,0,59,
+121,0,58,110,111,105,115,101,49,0,18,120,0,17,49,57,0,51,52,0,0,46,0,0,20,0,9,18,95,95,114,101,116,
+86,97,108,0,59,122,0,58,110,111,105,115,101,49,0,18,120,0,17,53,0,52,55,0,0,46,0,0,20,0,0,1,0,11,0,
+110,111,105,115,101,51,0,1,1,0,10,120,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,59,120,0,58,110,
+111,105,115,101,49,0,18,120,0,0,0,20,0,9,18,95,95,114,101,116,86,97,108,0,59,121,0,58,110,111,105,
+115,101,49,0,18,120,0,58,118,101,99,50,0,17,49,57,0,51,52,0,0,0,17,55,0,54,54,0,0,0,0,46,0,0,20,0,
+9,18,95,95,114,101,116,86,97,108,0,59,122,0,58,110,111,105,115,101,49,0,18,120,0,58,118,101,99,50,
+0,17,53,0,52,55,0,0,0,17,49,55,0,56,53,0,0,0,0,46,0,0,20,0,0,1,0,11,0,110,111,105,115,101,51,0,1,1,
+0,11,120,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,59,120,0,58,110,111,105,115,101,49,0,18,120,0,
+0,0,20,0,9,18,95,95,114,101,116,86,97,108,0,59,121,0,58,110,111,105,115,101,49,0,18,120,0,58,118,
+101,99,51,0,17,49,57,0,51,52,0,0,0,17,55,0,54,54,0,0,0,17,51,0,50,51,0,0,0,0,46,0,0,20,0,9,18,95,
+95,114,101,116,86,97,108,0,59,122,0,58,110,111,105,115,101,49,0,18,120,0,58,118,101,99,51,0,17,53,
+0,52,55,0,0,0,17,49,55,0,56,53,0,0,0,17,49,49,0,48,52,0,0,0,0,46,0,0,20,0,0,1,0,11,0,110,111,105,
+115,101,51,0,1,1,0,12,120,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,59,120,0,58,110,111,105,115,
+101,49,0,18,120,0,0,0,20,0,9,18,95,95,114,101,116,86,97,108,0,59,121,0,58,110,111,105,115,101,49,0,
+18,120,0,58,118,101,99,52,0,17,49,57,0,51,52,0,0,0,17,55,0,54,54,0,0,0,17,51,0,50,51,0,0,0,17,50,0,
+55,55,0,0,0,0,46,0,0,20,0,9,18,95,95,114,101,116,86,97,108,0,59,122,0,58,110,111,105,115,101,49,0,
+18,120,0,58,118,101,99,52,0,17,53,0,52,55,0,0,0,17,49,55,0,56,53,0,0,0,17,49,49,0,48,52,0,0,0,17,
+49,51,0,49,57,0,0,0,0,46,0,0,20,0,0,1,0,12,0,110,111,105,115,101,52,0,1,1,0,9,120,0,0,0,1,9,18,95,
+95,114,101,116,86,97,108,0,59,120,0,58,110,111,105,115,101,49,0,18,120,0,0,0,20,0,9,18,95,95,114,
+101,116,86,97,108,0,59,121,0,58,110,111,105,115,101,49,0,18,120,0,17,49,57,0,51,52,0,0,46,0,0,20,0,
+9,18,95,95,114,101,116,86,97,108,0,59,122,0,58,110,111,105,115,101,49,0,18,120,0,17,53,0,52,55,0,0,
+46,0,0,20,0,9,18,95,95,114,101,116,86,97,108,0,59,119,0,58,110,111,105,115,101,49,0,18,120,0,17,50,
+51,0,53,52,0,0,46,0,0,20,0,0,1,0,12,0,110,111,105,115,101,52,0,1,1,0,10,120,0,0,0,1,9,18,95,95,114,
+101,116,86,97,108,0,59,120,0,58,110,111,105,115,101,49,0,18,120,0,0,0,20,0,9,18,95,95,114,101,116,
+86,97,108,0,59,121,0,58,110,111,105,115,101,49,0,18,120,0,58,118,101,99,50,0,17,49,57,0,51,52,0,0,
+0,17,55,0,54,54,0,0,0,0,46,0,0,20,0,9,18,95,95,114,101,116,86,97,108,0,59,122,0,58,110,111,105,115,
+101,49,0,18,120,0,58,118,101,99,50,0,17,53,0,52,55,0,0,0,17,49,55,0,56,53,0,0,0,0,46,0,0,20,0,9,18,
+95,95,114,101,116,86,97,108,0,59,119,0,58,110,111,105,115,101,49,0,18,120,0,58,118,101,99,50,0,17,
+50,51,0,53,52,0,0,0,17,50,57,0,49,49,0,0,0,0,46,0,0,20,0,0,1,0,12,0,110,111,105,115,101,52,0,1,1,0,
+11,120,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,59,120,0,58,110,111,105,115,101,49,0,18,120,0,0,
+0,20,0,9,18,95,95,114,101,116,86,97,108,0,59,121,0,58,110,111,105,115,101,49,0,18,120,0,58,118,101,
+99,51,0,17,49,57,0,51,52,0,0,0,17,55,0,54,54,0,0,0,17,51,0,50,51,0,0,0,0,46,0,0,20,0,9,18,95,95,
+114,101,116,86,97,108,0,59,122,0,58,110,111,105,115,101,49,0,18,120,0,58,118,101,99,51,0,17,53,0,
+52,55,0,0,0,17,49,55,0,56,53,0,0,0,17,49,49,0,48,52,0,0,0,0,46,0,0,20,0,9,18,95,95,114,101,116,86,
+97,108,0,59,119,0,58,110,111,105,115,101,49,0,18,120,0,58,118,101,99,51,0,17,50,51,0,53,52,0,0,0,
+17,50,57,0,49,49,0,0,0,17,51,49,0,57,49,0,0,0,0,46,0,0,20,0,0,1,0,12,0,110,111,105,115,101,52,0,1,
+1,0,12,120,0,0,0,1,9,18,95,95,114,101,116,86,97,108,0,59,120,0,58,110,111,105,115,101,49,0,18,120,
+0,0,0,20,0,9,18,95,95,114,101,116,86,97,108,0,59,121,0,58,110,111,105,115,101,49,0,18,120,0,58,118,
+101,99,52,0,17,49,57,0,51,52,0,0,0,17,55,0,54,54,0,0,0,17,51,0,50,51,0,0,0,17,50,0,55,55,0,0,0,0,
+46,0,0,20,0,9,18,95,95,114,101,116,86,97,108,0,59,122,0,58,110,111,105,115,101,49,0,18,120,0,58,
+118,101,99,52,0,17,53,0,52,55,0,0,0,17,49,55,0,56,53,0,0,0,17,49,49,0,48,52,0,0,0,17,49,51,0,49,57,
+0,0,0,0,46,0,0,20,0,9,18,95,95,114,101,116,86,97,108,0,59,119,0,58,110,111,105,115,101,49,0,18,120,
+0,58,118,101,99,52,0,17,50,51,0,53,52,0,0,0,17,50,57,0,49,49,0,0,0,17,51,49,0,57,49,0,0,0,17,51,55,
+0,52,56,0,0,0,0,46,0,0,20,0,0,0
index 6ae307d09af0c1d18908381bad7da6e8a983a7de..9b932ca71b4c04c6b8b9fca86f609e622d7a238f 100644 (file)
@@ -494,6 +494,11 @@ static slang_asm_info AsmInfo[] = {
    { "float_rcp", IR_RCP, 1, 1 },
    { "float_sine", IR_SIN, 1, 1 },
    { "float_cosine", IR_COS, 1, 1 },
+   { "float_noise1", IR_NOISE1, 1, 1},
+   { "float_noise2", IR_NOISE2, 1, 1},
+   { "float_noise3", IR_NOISE3, 1, 1},
+   { "float_noise4", IR_NOISE4, 1, 1},
+
    { NULL, IR_NOP, 0, 0 }
 };
 
@@ -1657,6 +1662,8 @@ _slang_gen_var_decl(slang_assemble_ctx *A, slang_variable *var)
 
 /**
  * Generate code for a selection expression:   b ? x : y
+ * XXX in some cases we could implement a selection expression
+ * with an LRP instruction (use the boolean as the interpolant).
  */
 static slang_ir_node *
 _slang_gen_select(slang_assemble_ctx *A, slang_operation *oper)
index 092c53bda003c236734e84bb5e6dbdad5fc6cfea..8e598bf6608a228fcecd92d33dab609de0ce43fb 100644 (file)
@@ -89,6 +89,11 @@ static slang_ir_info IrInfo[] = {
    { IR_DDX, "IR_DDY", OPCODE_DDX, 4, 1 },
    { IR_SIN, "IR_SIN", OPCODE_SIN, 1, 1 },
    { IR_COS, "IR_COS", OPCODE_COS, 1, 1 },
+   { IR_NOISE1, "IR_NOISE1", OPCODE_NOISE1, 1, 1 },
+   { IR_NOISE2, "IR_NOISE2", OPCODE_NOISE2, 1, 1 },
+   { IR_NOISE3, "IR_NOISE3", OPCODE_NOISE3, 1, 1 },
+   { IR_NOISE4, "IR_NOISE4", OPCODE_NOISE4, 1, 1 },
+
    /* other */
    { IR_SEQ, "IR_SEQ", OPCODE_NOP, 0, 0 },
    { IR_SCOPE, "IR_SCOPE", OPCODE_NOP, 0, 0 },
@@ -994,6 +999,10 @@ emit(slang_var_table *vt, slang_ir_node *n, struct gl_program *prog)
    case IR_COS:
    case IR_DDX:
    case IR_DDY:
+   case IR_NOISE1:
+   case IR_NOISE2:
+   case IR_NOISE3:
+   case IR_NOISE4:
    /* binary */
    case IR_ADD:
    case IR_SUB:
index 5617c56d4b5eb67fb1f7374a369cea751ee62554..39b4ab65b594f59b62e429f6651b5785043fd939 100644 (file)
@@ -84,6 +84,10 @@ typedef enum
    IR_DDY,     /* derivative w.r.t. Y */
    IR_SIN,     /* sine */
    IR_COS,     /* cosine */
+   IR_NOISE1,  /* noise(x) */
+   IR_NOISE2,  /* noise(x, y) */
+   IR_NOISE3,  /* noise(x, y, z) */
+   IR_NOISE4,  /* noise(x, y, z, w) */
    IR_NOT,     /* logical not */
    IR_VAR,     /* variable reference */
    IR_VAR_DECL,/* var declaration */
index 74250b3592c6d23b2b01ca8b7cd9b35e805a54dd..ab1e586f3536ef320c4327694543bb70d5fbed63 100644 (file)
@@ -32,6 +32,7 @@
 
 #include "s_fragprog.h"
 #include "s_span.h"
+#include "slang_library_noise.h"
 
 
 /* See comments below for info about this */
@@ -1133,6 +1134,50 @@ execute_program( GLcontext *ctx,
                }
             }
             break;
+         case OPCODE_NOISE1:
+            {
+               GLfloat a[4], result[4];
+               fetch_vector1( ctx, &inst->SrcReg[0], machine, program, a );
+               result[0] =
+               result[1] =
+               result[2] =
+               result[3] = _slang_library_noise1(a[0]);
+               store_vector4( inst, machine, result );
+            }
+            break;
+         case OPCODE_NOISE2:
+            {
+               GLfloat a[4], result[4];
+               fetch_vector4( ctx, &inst->SrcReg[0], machine, program, a );
+               result[0] =
+               result[1] =
+               result[2] =
+               result[3] = _slang_library_noise2(a[0], a[1]);
+               store_vector4( inst, machine, result );
+            }
+            break;
+         case OPCODE_NOISE3:
+            {
+               GLfloat a[4], result[4];
+               fetch_vector4( ctx, &inst->SrcReg[0], machine, program, a );
+               result[0] =
+               result[1] =
+               result[2] =
+               result[3] = _slang_library_noise3(a[0], a[1], a[2]);
+               store_vector4( inst, machine, result );
+            }
+            break;
+         case OPCODE_NOISE4:
+            {
+               GLfloat a[4], result[4];
+               fetch_vector4( ctx, &inst->SrcReg[0], machine, program, a );
+               result[0] =
+               result[1] =
+               result[2] =
+               result[3] = _slang_library_noise4(a[0], a[1], a[2], a[3]);
+               store_vector4( inst, machine, result );
+            }
+            break;
          case OPCODE_NOP:
             break;
          case OPCODE_PK2H: /* pack two 16-bit floats in one 32-bit float */
index 5726a66c90745d1e3277f749e04bcef3f6ea1c6c..22b6089fc8a8b9b3053b63ba28587ffeb0ad7bea 100644 (file)
@@ -766,6 +766,10 @@ static void (* const opcode_func[MAX_OPCODE+3])(struct arb_vp_machine *, union i
    do_MIN,
    do_MOV,
    do_MUL,
+   do_NOP,/*NOISE1*/
+   do_NOP,/*NOISE2*/
+   do_NOP,/*NOISE3*/
+   do_NOP,/*NOISE4*/
    do_NOP,/*PK2H*/
    do_NOP,/*PK2US*/
    do_NOP,/*PK4B*/