mirror of
https://github.com/thug1src/thug.git
synced 2025-01-22 05:43:47 +00:00
34 lines
1.1 KiB
Plaintext
34 lines
1.1 KiB
Plaintext
;------------------------------------------------------------------------------
|
|
; 4-tap filtering
|
|
; Copyright (C) 2001 Microsoft Corporation
|
|
; All rights reserved.
|
|
;------------------------------------------------------------------------------
|
|
xps.1.1
|
|
|
|
; default filter is box filter, but this is easily overwritten using SetPixelShaderConstant
|
|
|
|
; When setting a pixel shader constant, we must check to see if the
|
|
; filter coefficient is negative, in which case we set the constant as a positive
|
|
; number and negate the constant in the expression below.
|
|
def c0, 0.25f, 0.25f, 0.25f, 0.25f
|
|
def c1, 0.25f, 0.25f, 0.25f, 0.25f
|
|
def c2, 0.25f, 0.25f, 0.25f, 0.25f
|
|
def c3, 0.25f, 0.25f, 0.25f, 0.25f
|
|
|
|
; source textures
|
|
tex t0
|
|
tex t1
|
|
tex t2
|
|
tex t3
|
|
|
|
; simple way
|
|
; mul r0, c0, t0
|
|
; mad r0, c1, t1, r0
|
|
; mad r0, c2, t2, r0
|
|
; mad r0, c3, t3, r0
|
|
|
|
; This has better precision (assuming the xmma_x2 intermediates don't overflow):
|
|
xmma_x2 discard, discard, r0, c0, t0, c1, t1 ; 2 * (c0 * t0 + c1 * t1)
|
|
xmma_x2 discard, discard, r1, c2, t2, c3, t3 ; 2 * (c2 * t2 + c3 * t3)
|
|
add_d2 r0, r0, r1
|