[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gzz-commits] gzz/gfx/libutil nvcode.py
From: |
Janne V. Kujala |
Subject: |
[Gzz-commits] gzz/gfx/libutil nvcode.py |
Date: |
Fri, 31 Jan 2003 04:27:44 -0500 |
CVSROOT: /cvsroot/gzz
Module name: gzz
Changes by: Janne V. Kujala <address@hidden> 03/01/31 04:27:44
Modified files:
gfx/libutil : nvcode.py
Log message:
fix SIGNED_ input mappings and color sum clamp
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/libutil/nvcode.py.diff?tr1=1.17&tr2=1.18&r1=text&r2=text
Patches:
Index: gzz/gfx/libutil/nvcode.py
diff -u gzz/gfx/libutil/nvcode.py:1.17 gzz/gfx/libutil/nvcode.py:1.18
--- gzz/gfx/libutil/nvcode.py:1.17 Fri Jan 31 02:54:23 2003
+++ gzz/gfx/libutil/nvcode.py Fri Jan 31 04:27:44 2003
@@ -662,11 +662,6 @@
def initParams(self):
self.initializedRegs = {}
- if (self.finalInput.has_key("COLOR_SUM_CLAMP_NV") and
- self.finalInput["COLOR_SUM_CLAMP_NV"] not in ("FALSE","0")):
- self.initmap["SPARE0_PLUS_SECONDARY_COLOR_NV"] = "ADD_SAT
SPARE0_PLUS_SECONDARY_COLOR_NV, SPARE0, SECONDARY_COLOR_NV;"
-
-
def initreg(self, reg, output = 0):
# Map constant colors to program.env[0..1,2..17]
if reg in ("CONSTANT_COLOR0_NV", "CONSTANT_COLOR1_NV"):
@@ -690,18 +685,22 @@
return reg
def genInputMapping(self, var, reg, mapping, comp):
+
inmap = {
- # Might need to consider clamping the SIGNED_ mappings, too.
"UNSIGNED_IDENTITY_NV": "MOV_SAT TMP, %s;\n",
"UNSIGNED_INVERT_NV": "SUB_SAT TMP, 1, %s;\n",
- "SIGNED_IDENTITY_NV": "MOV TMP, %s;\n",
- "SIGNED_NEGATE_NV": "MOV TMP, -%s;\n",
+ "SIGNED_IDENTITY_NV": "MIN TMP, %s, 1; MAX TMP, TMP, -1;\n",
+ "SIGNED_NEGATE_NV": "MIN TMP, -%s, 1; MAX TMP, TMP, -1;\n",
"EXPAND_NORMAL_NV": "MOV_SAT TMP, %s; MAD TMP, 2, TMP, -1;\n",
"EXPAND_NEGATE_NV": "MOV_SAT TMP, %s; MAD TMP, 2, -TMP, 1;\n",
"HALF_BIAS_NORMAL_NV": "MOV_SAT TMP, %s; SUB TMP, TMP, .5;\n",
"HALF_BIAS_NEGATE_NV": "MOV_SAT TMP, %s; SUB TMP, .5, TMP;\n",
}
+ if (reg == "SPARE0_PLUS_SECONDARY_COLOR_NV" and
+ self.finalInput.get("COLOR_SUM_CLAMP_NV", "0") in ("FALSE","0")):
+ inmap["UNSIGNED_IDENTITY_NV"] = "MOV TMP, %s;\n"
+
reg = self.initreg(reg)
if comp == "BLUE": reg += ".z"
@@ -843,9 +842,8 @@
self.genInputMapping(var, *vars[var])
self.code += """
- MAD VARIABLE_D_NV, VARIABLE_A_NV, VARIABLE_B_NV, VARIABLE_D_NV;
- SUB VARIABLE_A_NV, 1, VARIABLE_A_NV;
- MAD_SAT result.color.xyz, VARIABLE_A_NV, VARIABLE_C_NV, VARIABLE_D_NV;
+ LRP VARIABLE_A_NV, VARIABLE_A_NV, VARIABLE_B_NV, VARIABLE_C_NV;
+ ADD_SAT result.color.xyz, VARIABLE_A_NV, VARIABLE_D_NV;
"""
self.genInputMapping("result.color.w", *vars["VARIABLE_G_NV"])