drm: add texture_cube_clear_zwrite_vertex_shader (incomplete)

This commit is contained in:
Zack Buhman 2025-10-18 20:04:50 -05:00
parent 5e0a82f353
commit 0743f780af
6 changed files with 1380 additions and 3 deletions

View File

@ -9,6 +9,9 @@ LDFLAGS += $(shell pkg-config --libs libdrm) -lm
%: %.c
$(CC) $(ARCH) $(CFLAGS) $(LDFLAGS) $(OPT) $< -o $@
%.inc: %.asm
PYTHONPATH=../regs/ python -m assembler $< > $@
clean:
find . -type f ! -name "*.*" -delete

70
drm/cube_rotate.vs.asm Normal file
View File

@ -0,0 +1,70 @@
; CONST[0] = {0.159155, 0.5, 6.283185, -3.141593}
; CONST[1] = {theta1, theta2, 0.2, 0.5}
; each instruction is only allowed to use a single unique `const` address
;
; instructions may use multiple `temp` addresses, so const[1] is moved to
; temp[0]:
;
temp[0].xy = VE_ADD const[1].xy__ const[1].00__
; ME_SIN and ME_COS are clamped to the range -π to +π prior to the sin/cos
; calculation.
;
; This 3-instruction sequence linearly remaps the range [-∞,+∞] to [-π,+π]
temp[0].x = VE_MAD temp[0].x___ const[0].x___ const[0].y___
temp[0].x = VE_FRC temp[0].x___
temp[0].x = VE_MAD temp[0].x___ const[0].z___ const[0].w___
; the same thing, but for temp[0].y
temp[0].y = VE_MAD temp[0].y___ const[0].x___ const[0].y___
temp[0].y = VE_FRC temp[0].y___
temp[0].y = VE_MAD temp[0].y___ const[0].z___ const[0].w___
; sin and cos
temp[3].x = ME_SIN temp[0].___x
temp[3].y = ME_COS temp[0].___x
temp[3].z = ME_SIN temp[0].___y
temp[3].w = ME_COS temp[0].___y
; temp[3] now contains:
; temp[3] = {sin(theta1), cos(theta1), sin(theta2), cos(theta2)}
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; first rotation: X-axis rotation:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; y_ = (-z0 * st1)
; z_ = ( z0 * ct1)
temp[1].yz = VE_MUL input[0]._-zz_ temp[3]._xy_
; x1 = (x0 * 1 + 0)
; y1 = (y0 * ct1 + nz0st1)
; z1 = (y0 * st1 + z0ct1)
temp[1].xyz = VE_MAD input[0].xyy_ temp[3].1yx_ temp[1].0yz_
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; second rotation: Y-axis rotation:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; x_ = (-z1 * st2)
; z_ = ( z1 * ct2)
temp[2].xz = VE_MUL temp[1].-z_z_ temp[3].z_w_
; x2 = (x1 * ct2 + nz1st2)
; y2 = (y1 * 1 + 0)
; z2 = (x1 * st2 + z1ct2)
temp[2].xyz = VE_MAD temp[1].xyx_ temp[3].w1z_ temp[2].x0z_
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; scale
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
temp[2].xyz = VE_MAD temp[1].xyz_ const[1].zzz_ const[1].00w_
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; output
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
out[0].xyzw = VE_MUL temp[2].xyzz temp[2].11-z1
out[1].xyzw = VE_ADD input[1].xyzw input[1].0000

18
drm/cube_rotate.vs.inc Normal file
View File

@ -0,0 +1,18 @@
0x00300003, 0x01f90022, 0x01fc8022, 0x01ffe022,
0x00100004, 0x01ff0000, 0x01ff0002, 0x01ff2002,
0x00100006, 0x01ff0000, 0x01ffe000, 0x01ffe000,
0x00100004, 0x01ff0000, 0x01ff4002, 0x01ff6002,
0x00200004, 0x01ff2000, 0x01ff0002, 0x01ff2002,
0x00200006, 0x01ff2000, 0x01ffe000, 0x01ffe000,
0x00200004, 0x01ff2000, 0x01ff4002, 0x01ff6002,
0x00106050, 0x003fe000, 0x01ffe000, 0x01ffe000,
0x00206051, 0x003fe000, 0x01ffe000, 0x01ffe000,
0x00406050, 0x007fe000, 0x01ffe000, 0x01ffe000,
0x00806051, 0x007fe000, 0x01ffe000, 0x01ffe000,
0x00602002, 0x05d2e001, 0x01c8e060, 0x01ffe060,
0x00702004, 0x01c90001, 0x01c1a060, 0x01d18020,
0x00504002, 0x03d74020, 0x01df4060, 0x01ffe060,
0x00704004, 0x01c10020, 0x01d56060, 0x01d40040,
0x00704004, 0x01d10020, 0x01d24022, 0x09dc8022,
0x00f00202, 0x01510040, 0x0955a040, 0x01ffe040,
0x00f02203, 0x00d10021, 0x01248021, 0x01ffe021,

View File

@ -1,9 +1,9 @@
; CONST[0] = {rotate, _, _, _}
; CONST[1] = {0.159155, 0.5, 6.283185, -3.141593}
; CONST[0] = {0.159155, 0.5, 6.283185, -3.141593}
; CONST[1] = {rotate, _, _, _}
; each instruction is only allowed to use a single unique `const` address
;
; instructions may use multiple `temp` addresses, so const[0] is moved to
; instructions may use multiple `temp` addresses, so const[1] is moved to
; temp[0]:
;
temp[0].x = VE_ADD const[1].x___ const[1].0___

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,128 @@
0x00f00003,
0x00d10022,
0x01248022,
0x01248022,
0x00f02003,
0x00d10022,
0x01248022,
0x01248022,
0x00100004,
0x01ff0002,
0x01ff0020,
0x01ff2000,
0x00100006,
0x01ff0000,
0x01248000,
0x01248000,
0x00100004,
0x01ff0000,
0x01ff4022,
0x01ff6022,
0x00200050,
0x00000000,
0x01248000,
0x01248000,
0x00600002,
0x01d1e001,
0x01c9e000,
0x01248000,
0x00100051,
0x00000000,
0x01248000,
0x01248000,
0x00800004,
0x00bfe001,
0x003fe000,
0x007fe000,
0x00f02003,
0x00d10022,
0x01248022,
0x01248022,
0x00f04003,
0x00d10002,
0x01248002,
0x01248002,
0x00102004,
0x01ff0042,
0x01ff0040,
0x01ff2020,
0x00102006,
0x01ff0020,
0x01248020,
0x01248020,
0x00102004,
0x01ff0020,
0x01ff4022,
0x01ff6022,
0x00102050,
0x00000020,
0x01248020,
0x01248020,
0x00f04003,
0x00d10022,
0x01248022,
0x01248022,
0x00102004,
0x01ff2042,
0x01ff0020,
0x01ff2040,
0x00102006,
0x01ff0020,
0x01248020,
0x01248020,
0x00102004,
0x01ff0020,
0x01ff4022,
0x01ff6022,
0x00202051,
0x00000020,
0x01248020,
0x01248020,
0x00102050,
0x00000020,
0x01248020,
0x01248020,
0x00402002,
0x01dfe000,
0x01c7e020,
0x01248020,
0x00402004,
0x01c7e001,
0x01cfe020,
0x09d7e020,
0x00100004,
0x01ff2001,
0x01ff0000,
0x03ff4000,
0x00200002,
0x01fbe000,
0x01f9e020,
0x01248020,
0x00200004,
0x01f8e001,
0x01f8e020,
0x01f9e000,
0x00f04003,
0x00d10022,
0x01248022,
0x01248022,
0x00200004,
0x01f9e000,
0x01fae042,
0x01f9e040,
0x00400002,
0x01cfe000,
0x01cfe000,
0x01248000,
0x00500204,
0x01ef4020,
0x01e74042,
0x09d78000,
0x00302203,
0x01f90021,
0x01248021,
0x01248021,
0x00a00204,
0x0178e000,
0x013ae042,
0x007ce000,