diff --git a/drm/shadertoy.c b/drm/shadertoy.c index bebf4b5..a4fa851 100644 --- a/drm/shadertoy.c +++ b/drm/shadertoy.c @@ -251,7 +251,6 @@ int indirect_buffer() T0V(FG_DEPTH_SRC, 0x00000000); T0V(US_W_FMT, 0x00000000); - T0V(VAP_PVS_CONST_CNTL, 0x00000000); T0V(TX_INVALTAGS, 0x00000000); T0V(TX_ENABLE, 0x00000000); T0V(VAP_INDEX_OFFSET, 0x00000000); @@ -361,6 +360,23 @@ int indirect_buffer() // 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 , VAP_PVS_CODE_CNTL_0__PVS_FIRST_INST(0) | VAP_PVS_CODE_CNTL_0__PVS_XYZW_VALID_INST(1) diff --git a/drm/shadertoy.vs.asm b/drm/shadertoy.vs.asm index f5380d0..745be4e 100644 --- a/drm/shadertoy.vs.asm +++ b/drm/shadertoy.vs.asm @@ -1,2 +1,3 @@ -out[1].xy = VE_ADD input[0].xy__ input[0].0000 input[0].0000 -out[0].xyzw = VE_ADD input[0].xyz1 input[0].0000 input[0].0000 +; CONST[0] = { 1.3333 , _, _, _ } +out[1].xy = VE_MUL input[0].xy__ const[0].x1__ +out[0].xyzw = VE_ADD input[0].xyz1 input[0].0000 diff --git a/drm/texture_cube_clear_zwrite_vertex_shader.c b/drm/texture_cube_clear_zwrite_vertex_shader.c index 896abda..286f79a 100644 --- a/drm/texture_cube_clear_zwrite_vertex_shader.c +++ b/drm/texture_cube_clear_zwrite_vertex_shader.c @@ -436,7 +436,7 @@ int _3d_cube(int ix, float theta) float theta1 = theta; //float theta2 = 3.14f * theta; float theta2 = theta; - float consts[] = { + const float consts[] = { I_PI_2, 0.5f, PI_2, -PI, theta1, theta2, 0.2f, 0.5f, };