sincos - vs

Calcola il sine e il cosno, nei radianti.

Sintassi

vs_2_0 e vs_2_x

sincos dst. {x|y|xy}, src0. {x|y|z|w}, src1, src2

 

Dove:

  • dst è il registro di destinazione e deve essere un registro temporaneo (r#). Il registro di destinazione deve avere esattamente una delle tre maschere seguenti: .x | .y | .xy.
  • src0 è un registro di origine che fornisce l'angolo di input, che deve essere all'interno di [-pi, +pi]. {x|y|z|w} è la replica richiesta swizzle.
  • src1 e src2 sono registri di origine e devono essere due registri costanti float (c#). I valori di src1 e src2 devono essere rispettivamente le macro D3DSINCOSCONST1 e D3DSINCOSCONST2 .

vs_3_0

sincos dst. {x|y|xy}, src0. {x|y|z|w}

 

Dove:

  • dst è un registro di destinazione e deve essere un registro temporaneo (r#). Il registro di destinazione deve avere esattamente una delle tre maschere seguenti: .x | .y | .xy.
  • src0 è un registro di origine che fornisce l'angolo di input, che deve essere all'interno di [-pi, +pi]. {x|y|z|w} è la replica richiesta swizzle.

Commenti

Versioni del vertex shader 1_1 2_0 2_x 2_sw 3_0 3_sw
Sincos x x x x x

 

vs_2_0 e vs_2_x osservazioni

Per vs_2_0 e vs_2_x, i sincos possono essere usati con predicazione, ma con una restrizione allo swizzle del Registro predicato (p0): è consentita solo la replica swizzle (.x | .y | .z | .w).

Per vs_2_0 e vs_2_x, l'istruzione opera come indicato di seguito: (V = il valore scalare da src0 con una replica swizzle):

  • Se la maschera di scrittura è .x:

    dest.x = cos( V )
    dest.y is undefined when the instruction completes
    dest.z is undefined when the instruction completes
    dest.w is not touched by the instruction
    
  • Se la maschera di scrittura è .y:

    dest.x is undefined when the instruction completes
    dest.y = sin( V )
    dest.z is undefined when the instruction completes
    dest.w is not touched by the instruction
    
  • Se la maschera di scrittura è .xy:

    dest.x = cos( V )
    dest.y = sin( V )
    dest.z is undefined when the instruction completes
    dest.w is not touched by the instruction
    

vs_3_0 osservazioni

Per vs_3_0, i sincos possono essere usati con predicazione senza alcuna restrizione. Vedere Registro predicato.

Per vs_3_0, l'istruzione opera come indicato di seguito: (V = il valore scalare da src0 con una replica swizzle)

  • Se la maschera di scrittura è .x:

    dest.x = cos( V )
    dest.y is not touched by the instruction
    dest.z is not touched by the instruction
    dest.w is not touched by the instruction
    
  • Se la maschera di scrittura è .y:

    dest.x is not touched by the instruction
    dest.y = sin( V )
    dest.z is not touched by the instruction
    dest.w is not touched by the instruction
    
  • Se la maschera di scrittura è .xy:

    dest.x = cos( V )
    dest.y = sin( V )
    dest.z is not touched by the instruction
    dest.w is not touched by the instruction
    

L'applicazione può eseguire il mapping di un angolo arbitrario (in radianti) all'intervallo [-pi, +pi] usando lo pseudocode shader seguente:

def c0, pi, 0.5, 2*pi, 1/(2*pi)
mad r0.x, input_angle, c0.w, c0.y
frc r0.x, r0.x
mad r0.x, r0.x, c0.z, -c0.x

Istruzioni di Vertex Shader