TXQ : Texture Query

Format

SPA 5.0:
        {@{!}Pg}   TXQ{.B}{.NODEP}{.phase}   Rd, Ra, #query, #tsPtrIdxU13 {, #wmskU04}    {&req_6}   {&rdN}   {&wrN}   {?sched}   ;   
        {@{!}Pg}   TXQ{.B}{.NODEP}{.phase}   Rd, Ra, #query, #tidU08, #smpU05, #wmskU04   {&req_6}   {&rdN}   {&wrN}   {?sched}   ;   

  .B:      Bindless mode, where the texture header pointer and sampler pointer is packed into a 32 bit register as:
           samplerPtr[31:20] | headerPtr[19:0]
           Data is sent via register Ra.

  .NODEP:  Indicates that there is no subsequent quad derivatives to be calculated.
           Threads that have been "killed" will be disabled to stop unnecessary texture fetches.

  .phase:  Allows control on the current warps texture hash, used for scheduling.
               < NONE >
               .T - postfix increment of the 3 bit texture component of the hash.
               .P - postfix increment of the 5 bit phase component, and zero out the 3 bit texture component of the hash. 


The following 3 queries are supported as part of SPA 3.0:
  - TEX_HEADER_DIMENSION
      Input is one coordinate containing a u32 LOD level
      Output is:
TXQ return value table
Texture Type R G B A
ONE_D width zero zero # of mip-map Levels
TWO_D width height zero/one* # of mip-map Levels
THREE_D width height depth # of mip-map Levels
CUBEMAP width height zero # of mip-map Levels
ONE_D_ARRAY width length zero # of mip-map Levels
TWO_D_ARRAY width height length # of mip-map Levels
ONE_D_BUFFER width zero zero one
TWO_D_NO_MIPMAP width height zero/depth* one
CUBEMAP_ARRAY width height length # of mip-map Levels
*zero is for MODE_1X1 case, otherwise the other value is returned. - TEX_HEADER_TEXTURE_TYPE No input data register required. Output is: (R) u32: 0 // reserved for "type", an 8 bit field set by SW in the texture header (G) u32: 0 // reserved for "format" (B) u32: ms count (A) u32: 0 // unused - TEX_HEADER_SAMPLER_POS Input is one coordinate containing the sample index within multisample pattern Output is: (R) u32: sample_position //{4.12,4.12} format (G) u32: 0 (B) u32: 0 (A) u32: 0 The format for sample_position is a packed dx/dy which is also shared with IPA and PIXLD. The format is documented on the IPA ISA page. #tsPtrIdxU13: This immediate index (word address) is a used to fetch the packed header+sampler pointer entry from constant cache. The bank from which it is fetched is determined by bundle state. The constant bank entry is 32 bit structure of the form "samplerPtr[31:20] | headerPtr[19:0]". Note: Ignored if .B option is used. In SetSamplerBinding.ViaHeaderBinding (i.e. OGL) mode, the headerPtr would be used as the samplerPtr as well. Any header pointer greater than one specified in SetTexHeaderPoolC.MaximumIndex will be regarded as an "invalid" texture (i.e. equivalent to BIND_GROUP_TEXTURE_HEADER_VALID_FALSE in fermi). Any sampler pointer greater than one specified in SetSamplerHeaderPoolC.MaximumIndex will be regarded as an "invalid" texture (i.e. equivalent to BIND_GROUP_TEXTURE_HEADER_VALID_FALSE in fermi). #tidU08, #smpU05: This is the "almost" Fermi-compatible specification of tsPtrIdxU13 which allows running of legacy apps/traces where sass will transform these into tsPtrIdxU13 as follows: #tsPtrIdxU13 = {#smpU05, #tidU08} #wmskU04 destination write mask (decimated contiguous writes) Allows for write masking the returning data writes via a bit enable for each of R,G,B,A. A four-vector is always returned from TEX. #wmskU04 defaults to 0xf.

Description

Query of texture information.

    The packing of query parameters in Ra is as follows:
    Texture parameter packing in Ra
    Regparameterformat
    Ra+0SamplerPtr[31:20] | HeaderPtr[19:0]u32
    Ra+1LOD or Sample Positionu32

    If a parameter is not specified, then the rest are compacted upwards within the same Ra register.

Each query returns a 4-vector of data (thought of as R,G,B,A), similar to TEX.

The alignement restrictions on Rd,Ra are as follows:
  1. Rd should be aligned to number of valid components being returned (as specified by wmask)
  2. If the number of parameters in Ra > 0, then cannot be RZ
  3. Ra should always be aligned to
    1. 1 (scalar register) if total number of co-ordinates is 1
    2. 2 (vec2 register) if total number of co-ordinates is 2

Additional Information:

Corresponds to these DX ops:

   resinfo   =  TXQ                    // 

Examples:

TXQ  R0, R6, TEX_HEADER_DIMENSION, 0, 0xf;

Back to Index of Instructions