shadertoy: multiply fragment shader coordinates by aspect ratio

This commit is contained in:
Zack Buhman 2025-10-19 16:10:29 -05:00
parent 2779fd6a7c
commit 82f8e56032
3 changed files with 21 additions and 4 deletions

View File

@ -251,7 +251,6 @@ int indirect_buffer()
T0V(FG_DEPTH_SRC, 0x00000000); T0V(FG_DEPTH_SRC, 0x00000000);
T0V(US_W_FMT, 0x00000000); T0V(US_W_FMT, 0x00000000);
T0V(VAP_PVS_CONST_CNTL, 0x00000000);
T0V(TX_INVALTAGS, 0x00000000); T0V(TX_INVALTAGS, 0x00000000);
T0V(TX_ENABLE, 0x00000000); T0V(TX_ENABLE, 0x00000000);
T0V(VAP_INDEX_OFFSET, 0x00000000); T0V(VAP_INDEX_OFFSET, 0x00000000);
@ -361,6 +360,23 @@ int indirect_buffer()
// VAP_PVS // VAP_PVS
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
T0V(VAP_PVS_CONST_CNTL
, VAP_PVS_CONST_CNTL__PVS_CONST_BASE_OFFSET(0)
| VAP_PVS_CONST_CNTL__PVS_MAX_CONST_ADDR(1)
);
T0V(VAP_PVS_VECTOR_INDX_REG
, VAP_PVS_VECTOR_INDX_REG__OCTWORD_OFFSET(1024)
);
const float consts[] = {
4.0f / 3.0f, 0.0f, 0.0f, 0.0f,
};
int consts_length = (sizeof (consts)) / (sizeof (consts[0]));
T0_ONE_REG(VAP_PVS_VECTOR_DATA_REG_128, (consts_length - 1));
for (int i = 0; i < consts_length; i++)
ib[ix++].f32 = consts[i];
T0V(VAP_PVS_CODE_CNTL_0 T0V(VAP_PVS_CODE_CNTL_0
, VAP_PVS_CODE_CNTL_0__PVS_FIRST_INST(0) , VAP_PVS_CODE_CNTL_0__PVS_FIRST_INST(0)
| VAP_PVS_CODE_CNTL_0__PVS_XYZW_VALID_INST(1) | VAP_PVS_CODE_CNTL_0__PVS_XYZW_VALID_INST(1)

View File

@ -1,2 +1,3 @@
out[1].xy = VE_ADD input[0].xy__ input[0].0000 input[0].0000 ; CONST[0] = { 1.3333 , _, _, _ }
out[0].xyzw = VE_ADD input[0].xyz1 input[0].0000 input[0].0000 out[1].xy = VE_MUL input[0].xy__ const[0].x1__
out[0].xyzw = VE_ADD input[0].xyz1 input[0].0000

View File

@ -436,7 +436,7 @@ int _3d_cube(int ix, float theta)
float theta1 = theta; float theta1 = theta;
//float theta2 = 3.14f * theta; //float theta2 = 3.14f * theta;
float theta2 = theta; float theta2 = theta;
float consts[] = { const float consts[] = {
I_PI_2, 0.5f, PI_2, -PI, I_PI_2, 0.5f, PI_2, -PI,
theta1, theta2, 0.2f, 0.5f, theta1, theta2, 0.2f, 0.5f,
}; };