Vertex Shader 1.1 SGE assembler instruction fails for me.

Thought I would try out this new forum.


Hardware is NVidia 6800GT with 79.70 Instrumented drivers for Perfkit.


I created a DX8 Effect for color conversion purposes. DX8 because I map into games and need to handle DX7, 8, 9, and someday 10.

I copy the back buffer to a texture and render it to a quad on a rendertarget surface. I copy the rendertarget data to a plain surface in system space where I unlock it and view the contents so that I can see what the shaders are doing. For testing I don't care about the back buffer contents as I send raw register data to the argb rendertarget so I can inspect the GPU registers. So for this message I am testing the vertex shader and simply passing the data through the pixel shader so I can inspect the registers in the vertex shader. (I don't have the option of using a shader debugger in this setup.) The problem is in the vertex shader.

I have the range of U coordinate for a texture set for 0.0 <=U <2.0

In the vertex code I send the U coordinate to the pixel shader using one of two paths and I've tried both. I use two paths because the first didn't work and I wanted to check for some transformation possibly going on that I wasn't aware of.

"I edited out a serious flaw here :)"
I do not transform the vertex I just move V0 to oP0. It does what I want.

I am interested in the texture coordinate register. (BTW: The pass setup states are shown below.)

1. mov oT0.xyz, v7        ;output UV path 1

or

2. mov r3.xyz, v7          ;path 2.
    mov r3.w, c0.w   //just initialize w.
    move oD0,r3       //send the coordinates to the pixel shader.
In the pixel shader version 1.4 I read the value in and output it.

 phase
  mov r0, v0

or using the texture coordinate;
  texcrd r0.xyz, t0
  mov r0.w,c0.w
OK. I get the same values either way and they are the correct values. U is a ramp from 0 to 2 and V is a ramp from 0 to 1. The slope of the ramp is not in question.

Here is my problem: I want to render two lines of the texture into one long line in the render target. So I test U and when it exceeds 1, I add an offset to V to step up to the next line of texels.
Pseudo code:  if(U>=1.0) y=y+dy; where dy =1/Height.

In the vertex shader I do this:
   sge r3,v7,c1     here c1=1,0,0,0
Once it worked and when I inspected the data r3.x jumped to one when v7.x exceeded c1.x
This instruction allows me to generate the Delta(V) step needed for the stated conditions.

While it worked once, I haven't been able to replicate this at all suggesting some state is mismanaged (by me of course).

Actually I want to use sge r3.y,c7.x,c1.x.  It does the same thing:)

I should at least get constants but it appears the U & V ramps are passing through into r3 and I can't for the life of me see why this should happen.
If is use slt rather than sge the ramps are inverted:0x FF becomes 0.
If I put constants into r3 they read out correctly. Anything I put in r3 reads out correctly except any operation that uses the "sge" or the "slt" instructions.

I had the same problems in DX9 vertex code but I was able to move the test to the pixel shader where it works fine. I don't have enough slots to do that in DX8. 

Thre has to be some state variable that I am not setting properly.

This little nuisance is te very last line of code for a project I have been working on for sometime.

Paul

The Pass state setup. Everything but the kitchen sink is thrown in:)

Lighting = False;

CullMode = NONE;

ZEnable = False;

AlphaBlendEnable= False;

FogEnable = False;

ColorWriteEnable= 0xf;

Texture[7] = <PtrTexture>;

TextureTransformFlags[7] = COUNT2;

TEXCOORDINDEX[7] = PASSTHRU;

ColorOp[0] = SelectArg1;

ColorArg1[0] = Texture;

ColorOp[1] = Disable;

Minfilter[7] = Linear;

Magfilter[7] = Linear;

Mipfilter[7] = NONE;

VertexShaderConstant[5]= <VxC5>;

 

 

 

 



Answer this question

Vertex Shader 1.1 SGE assembler instruction fails for me.

  • Rada

    After many hours with no sleep I solved this problem and the problem is me not the vertex shader "sge" instruction. The sge instruction works as advertised but it is called once per vertex and thus I can not use it in between vertices to create a pulse when U>=0.5! It really pays to setup a test program that can use shader debuggers. Since I render to a quad it was easy to count the number of times the vertex shader was called per rendering of an image. It is never called when I need it :) So this case is closed.

    Oh well I have other ways to solve this problem.

    Bye,

    Paul


  • MikeBzz

    I tried a trick that I saw written up:

    sge r0,r0,r0 sets r0 to all 1's. This works.

    slt r0,r0,r0 sets r0 to all 0's. This works.

    Paul


  • Vertex Shader 1.1 SGE assembler instruction fails for me.