limit on the how many bytes that can be passed across shaders

Started by
3 comments, last by Spazzarama 9 years, 12 months ago

In a structure that receives the pixel shader from the vertex shader

what are the limits to the amount of bytes that can be passed?

Any links to a place that describes this?

I am asking this because I had this structure

struct PS_PAIReduc
{
float4 Pos : SV_POSITION;
uint MVP[4][3][3] : MASKVALUEPOINTS;
uint Loct : LOCATION;
};
But "MVP" could not be created by the compiler so I transformed it to this:
struct PS_PAIReduc
{
float4 Pos : SV_POSITION;
uint3 MVPa[4] : MASKVALUEPOINTSA;
uint3 MVPb[4] : MASKVALUEPOINTSB;
uint3 MVPc[4] : MASKVALUEPOINTSC;
uint Loct : LOCATION;
};
but now the compiler is throwing me this error:
Error X8000: D3D11 Internal Compiler Error: Invalid Bytecode: Mask <and if pixel shader,also interpolation mode> on all input registers in an index range must be identical. Input registers [4] does not match with others in the index range from 1 to 4.
I don't understand this,can someone explain me this error?
Advertisement

loct needs to be a float 4 too or how it is and padded may be???

Have a look here for the limits:

http://msdn.microsoft.com/en-us/library/windows/desktop/ff819065%28v=vs.85%29.aspx

So, the register limit looks to be 32 for shader inputs/outputs. You are creating 4x3x3+2 = 38 registers. So even with your a 'fix' for the alignment / padding, you will still be breaching the register limit. You will need another solution.

Edit: I agree with spazzarama below. I took a second look at it.

The D3D11 p_s_50 shader model supports up to 32 registers (four 32-bit components each). I don't think you are going over the limit (in your second example), I think instead the compiler doesn't know what interpolation mode to use for the uint3[4].

From http://msdn.microsoft.com/en-us/library/windows/desktop/bb509668(v=vs.85).aspx

1. When using an int/uint type, the only valid option is nointerpolation.

I can't test anything at the moment, but perhaps prefixing the uints with nointerpolation will help?

Justin Stenning | Blog | Book - Direct3D Rendering Cookbook (using C# and SharpDX)

Projects: Direct3D Hook, EasyHook, Shared Memory (IPC), SharpDisasm (x86/64 disassembler in C#)

@spazzarama

 

Also, perhaps use MASKVALUEPOINTS0 for the first, and then MASKVALUEPOINTS4 for the second and MASKVALUEPOINTS8 on the third. I seem to remember hitting a similar problem once when passing an array of items to a hull or domain shader.


struct PS_PAIReduc{
    float4 Pos : SV_POSITION;
uint3 MVPa[4] : MASKVALUEPOINTS0;
uint3 MVPb[4] : MASKVALUEPOINTS4;
uint3 MVPc[4] : MASKVALUEPOINTS8;
uint Loct : LOCATION;
};

Justin Stenning | Blog | Book - Direct3D Rendering Cookbook (using C# and SharpDX)

Projects: Direct3D Hook, EasyHook, Shared Memory (IPC), SharpDisasm (x86/64 disassembler in C#)

@spazzarama

 

This topic is closed to new replies.

Advertisement