How can I define more constant space in HLSL?

Started by
7 comments, last by S1CA 18 years, 10 months ago
How many constant registers has Geforce3?. My Radeon 8500 has 192, but when I use HLSL and I use about 60+ it fails with the error "too complex". I need a method to indicate HLSL (I use fxc.exe external compiler) that use the 192 c# registers that my card has.
Advertisement
As far as i am aware (i'm just starting with shaders myself) you only have as many constants available as the PS/VS model you are using. So firstly find out what shader model your geforce 3 supports. Then find out how many constants in that model.

ace
Quote:Original post by Dark Schneider
How many constant registers has Geforce3?. My Radeon 8500 has 192, but when I use HLSL and I use about 60+ it fails with the error "too complex".

I need a method to indicate HLSL (I use fxc.exe external compiler) that use the 192 c# registers that my card has.


On what target? what is the full error message? pixel shader < 2.0 only has 8 constants.

EvilDecl81
I'm talking about vertex shader, and constant (c# registers) are not a fix number as in pixel shader, it is a number in D3DCAPS9, MaxVertexShaderConst.

So in vertex shader case constants are not defined by machine, you can have a vs_1_1 with 96 and others (as my Radeon) with 192.

But how I can use them all?.
A GeForce3 supports vs.1.1. The spec allow 96 or more constants. A GeForce3 follows the spec's minimum and supports only 96 constants. A quick look at the caps viewer should confirm this (I'm running a GeForce3, so I there's really no need for you to double check).

Compiling at runtime, I'd expect D3D to allow use of all registers. Compiling before hand, I'd expect D3D to allow use of the minimum registers, and possibly allow you to specify more, but then it's your fault when it fails on some machines. I don't see any command line argument that looks like it would would, except perhaps to disable validation.

Anyway, since your card only supports the minimum, you no longer need to find this missing option.
Quote:Original post by Dark Schneider
I'm talking about vertex shader, and constant (c# registers) are not a fix number as in pixel shader, it is a number in D3DCAPS9, MaxVertexShaderConst.

So in vertex shader case constants are not defined by machine, you can have a vs_1_1 with 96 and others (as my Radeon) with 192.

But how I can use them all?.


The vs_1_1 profile uses the caps bit on the device you are compiling on to determine how many registers are available. Alternatively, you could use vs_2_0 which has a minimum of 256 constants. I don't believe the GF3 supports that profile though -- check dxcapsviewer.

Paul
Thanks.

I was wrong, the problem was that I used more than the 128 slots ops, I try to change the code and I use 90 c# without problems.

So I think HLSL allow you to use unlimited c#, but be careful becuase if you use more than the hardware has it will fail in runtime (I think this but I'm not sure).

If you want as hardware target a Geforce3 (PS1.1) then you are limited to 96 c#.

Anyone know how many c# the Geforce4 (not MX) has?. We know that if our hardware target is Radeon 8500 (PS1.4) we have 192, I am interested in Geforce4 too.
Quote:Original post by Dark Schneider
Anyone know how many c# the Geforce4 (not MX) has?. We know that if our hardware target is Radeon 8500 (PS1.4) we have 192, I am interested in Geforce4 too.


On my GeForce4 (Ti 4200) the caps viewer states 96 for MaxVertexShaderConst.

HTH,
Cambo_frog
For the love of god, please tell me that you've just omitted your error checking code for brevity, and you don't really assume that all those functions succeed.
ATI Radeon 8500 to ATI Radeon 9200: 192 vertex shader constants
ATI Radeon 9600 to ATI Radeon 9800: 256 vertex shader constants
nVidia GeForce 3 & nVidia GeForce 4 range: 96 vertex shader constants
nVidia GeForce FX range: 256 vertex shader constants
Matrox Parhelia: 256 vertex shader constants

Simon O'Connor | Technical Director (Newcastle) Lockwood Publishing | LinkedIn | Personal site

This topic is closed to new replies.

Advertisement