ShadX  Real addict
  

Status:Offline Date registered: 20.01.2005 Post:266 Send Message | Created on 13.07.2005 - 12:07 |  |
For bkman, "Moe's" OpenglHQ require tree passes, exactly: SDL_openglhq_pass1.fp
!!ARBfp1.0
# # Copyright (C) 2004 Jörg Walter <jwalt@garni.ch> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, version 2 of the License. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #
TEMP pixel0, pixel1, pixel2, pixel3; ALIAS coord1 = pixel1; ALIAS coord2 = pixel2; ALIAS coord3 = pixel3; ALIAS rmean = pixel3; TEMP diff;
PARAM pixel_size = program.env[0]; ATTRIB coord0 = fragment.texcoord[0]; OUTPUT res = result.color;
PARAM coordmask = { 1, 0, 1, 0 }; PARAM weight = { 1.884313725490196078431372549, 3.768627450980392156862745098, 2.822790287990196078431372548, 0 }; PARAM mask = { 0.4710784313725490196078431372, 0, -0.4710784313725490196078431372, 0 };
MAD coord1.xy, pixel_size, coordmask, coord0; MAD coord2.xy, pixel_size, coordmask.gbra, coord0; ADD coord3.xy, pixel_size, coord0;
TEX pixel0.rgb, coord0, texture[0], 2D; TEX pixel1.rgb, coord1, texture[0], 2D; TEX pixel2.rgb, coord2, texture[0], 2D; TEX pixel3.rgb, coord3, texture[0], 2D;
# # Original formula, [0;255] per component, result range [0;764.83]: # sqrt( (2+rmean/256)*r*r + 4*g*g + (2.99609375-rmean/256)*b*b ) # (see http://www.compuphase.com/cmetric.htm) # # Formula used in software hq2x scaler, range [0;31] per component, result range [0;2161.31] clamped to [0;255]: # (0.5+(2*rmean/2048))*r*r + g*g + (0.7490234375-(2*rmean/2048))*b*b # # This code uses this formula, range [0;1] per component, result range [0;2161.31/255] clamped to [0;1]: # (1.884313725490196078431372549+(2*rmean*0.4710784313725490196078431372))*r*r + 3.768627450980392156862745098*g*g + (2.822790287990196078431372548-(2*rmean*0.4710784313725490196078431372))*b*b # (which means that the same trigger values can be used for both) #
SUB diff.rgb, pixel0, pixel3; ADD rmean.a, pixel0.r, pixel3.r; MAD rmean.rgb, rmean.a, mask, weight; MUL diff.rgb, diff, diff; DP3_SAT res.b, rmean, diff;
SUB diff.rgb, pixel0, pixel1; ADD rmean.a, pixel0.r, pixel1.r; MAD rmean.rgb, rmean.a, mask, weight; MUL diff.rgb, diff, diff; DP3_SAT res.r, rmean, diff;
SUB diff.rgb, pixel0, pixel2; ADD rmean.a, pixel0.r, pixel2.r; MAD rmean.rgb, rmean.a, mask, weight; MUL diff.rgb, diff, diff; DP3_SAT res.g, rmean, diff;
SUB diff.rgb, pixel1, pixel2; ADD rmean.a, pixel1.r, pixel2.r; MAD rmean.rgb, rmean.a, mask, weight; MUL diff.rgb, diff, diff; DP3_SAT res.a, rmean, diff;
END
SDL_openglhq_pass2.fp
!!ARBfp1.0
# # Copyright (C) 2004 Jörg Walter <jwalt@garni.ch> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, version 2 of the License. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #
TEMP pixel0, pixel1, pixel2, pixel3; TEMP max; ALIAS coord0 = pixel0; ALIAS coord1 = pixel1; ALIAS coord2 = pixel2; TEMP min; TEMP current_trigger;
PARAM pixel_size = program.env[0]; PARAM trigger = program.local[0]; ATTRIB coord3 = fragment.texcoord[0];
PARAM coordmask = { 0, -1, 0, .0625 }; PARAM factors = { 0.0627450980392157, 0.125490196078431, 0.250980392156863, 0.501960784313725 }; PARAM const = { 65536, 0.1666666666666666, 1, 0 }; ALIAS one_sixteenth = coordmask;
SUB coord0.xy, coord3, pixel_size; MAD coord1.xy, pixel_size.x, coordmask, coord3; MAD coord2.xy, pixel_size.x, coordmask.gbra, coord3;
TEX pixel0, coord0, texture[0], 2D; TEX pixel1, coord1, texture[0], 2D; TEX pixel2, coord2, texture[0], 2D; TEX pixel3, coord3, texture[0], 2D;
MOV pixel1.r, pixel0.b; MOV pixel2.g, pixel0.a;
ADD min, pixel1, pixel2; ADD min, min, pixel3; DP3 current_trigger.a, min, const.g; MUL_SAT current_trigger.a, current_trigger.a, trigger.a; MAX current_trigger.a, current_trigger.a, trigger.r;
MUL current_trigger.a, current_trigger.a, const.r; MAD_SAT pixel1, pixel1, const.r, -current_trigger.a; MAD_SAT pixel2, pixel2, const.r, -current_trigger.a; MAD_SAT pixel3, pixel3, const.r, -current_trigger.a;
# on a Radeon 9500, these three expand to 6 native insns #SLT pixel1, current_trigger.a, pixel1; #SLT pixel2, current_trigger.a, pixel2; #SLT pixel3, current_trigger.a, pixel3;
DP4 result.color.a, pixel3, factors; MAD pixel2, pixel2, one_sixteenth.a, pixel1; DP4 result.color.rgb, pixel2, factors;
END
SDL_openglhq_pass3.fp
!!ARBfp1.0
# # Copyright (C) 2004 Jörg Walter <jwalt@garni.ch> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, version 2 of the License. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #
TEMP coord1, coord2, coord3, pixel0; ALIAS pixel1 = coord1; ALIAS pixel2 = coord2; ALIAS pixel3 = coord3; TEMP diff; TEMP center_offset; TEMP factors;
PARAM pixel_size = program.env[0]; PARAM const = { .0625, .5, .99609375, .001953125 }; ATTRIB coord0 = fragment.texcoord[0]; # r: 1/.875, b: .875 * .958 (from sdlopengl.cpp) PARAM cap = { 1.142857142857142857127368540393064222371, -0.07142857142857143002735720305196309709572, .83825, .080875 };
TEX diff, coord0, texture[1], 2D;
MUL center_offset.xy, coord0, pixel_size.abgr; FRC center_offset.xy, center_offset;
SUB coord3.xy, center_offset, const.g; CMP coord3.xy, coord3, -pixel_size, pixel_size; ADD coord3.xy, coord0, coord3; MOV coord1.x, coord3; MOV coord1.y, coord0; MOV coord2.x, coord0; MOV coord2.y, coord3;
MAD_SAT center_offset.xy, center_offset, cap.r, cap.g; MAD center_offset.xy, center_offset, cap.b, cap.a;
MAD center_offset.x, center_offset, const, diff.a; MAD center_offset.z, diff, const.b, const.a;
TEX pixel0, coord0, texture[0], 2D; TEX pixel1, coord1, texture[0], 2D; TEX pixel2, coord2, texture[0], 2D; TEX pixel3, coord3, texture[0], 2D; TEX factors, center_offset, texture[2], 3D;
MUL pixel0, pixel0, factors.r; MAD pixel0, pixel1, factors.g, pixel0; MAD pixel0, pixel2, factors.b, pixel0; MAD result.color, pixel3, factors.a, pixel0;
#MOV result.color, pixel0; #MOV result.color, diff; #MOV result.color, factors;
END
I'm not able to merge thease fragment programs in one... and Pete's plugin support only one pass... Bye
|