Manual bind to slot 4294967295 failed

Started by
11 comments, last by matt77hias 6 years, 5 months ago

The HLSL compiler keeps outputting the following error:

FXC : error X4567: maximum cbuffer exceeded. target has 14 slots, manual bind to slot 4294967295 failed

without mentioning in which file or at which line this occurs.

I also have no idea where the number comes from as I basically use only 5 slots:

#define SLOT_CBUFFER_GAME  0
#define SLOT_CBUFFER_PRIMARY_CAMERA  1
#define SLOT_CBUFFER_COLOR  2
#define SLOT_CBUFFER_LIGHTING  2
#define SLOT_CBUFFER_MODEL  3
#define SLOT_CBUFFER_SECONDARY_CAMERA  4

Any ideas? And how can get more feedback from the compiler?

🧙

Advertisement

can you post the shader (or effects file) that's failing to compile?

3 minutes ago, iedoc said:

can you post the shader (or effects file) that's failing to compile?

The compiler doesn't output the file name:

1>------ Build started: Project: MAGE, Configuration: Release x64 ------
1>FXC : error X4567: maximum cbuffer exceeded. target has 14 slots, manual bind to slot 4294967295 failed
1>

Idd for a rebuild:

1>------ Rebuild All started: Project: MAGE, Configuration: Release x64 ------
1>compilation header save succeeded; see D:\Users\Matthias\Documents\Visual Studio 2017\Projects\MAGE\MAGE\MAGE\src\shader\cso\aa\fxaa_CS.hpp
...
1>compilation header save succeeded; see D:\Users\Matthias\Documents\Visual Studio 2017\Projects\MAGE\MAGE\MAGE\src\shader\cso\deferred\deferred_ward_duer_PS.hpp
1>FXC : error X4567: maximum cbuffer exceeded. target has 14 slots, manual bind to slot 4294967295 failed

🧙

Found the culprit manually: undefined macro

Though it would have helped if the compiler mentioned the file :)

🧙

4294967295 is -1 btw, it usually smell bad to see that value cast as an unsigned :)

16 hours ago, galop1n said:

4294967295 is -1 btw, it usually smell bad to see that value cast as an unsigned

Apparently that is the value assigned by the HLSL pre-processor for a non existing macro. Bit strange compared to the C++ pre-processor who would have complained if the macro didn't exist.

🧙

The C/C++ preprocessor does not warn on that, they fallback to 0.

To warn, you need :

gcc/clang : -Wundef ( not in -Wall )

VS : #pragma warning (enable : 4668) ( default to on only at level 4, no one use level 4 )

 

1 hour ago, galop1n said:

VS : #pragma warning (enable : 4668) ( default to on only at level 4, no one use level 4 )

No one uses Wall. It is perfectly sane to use W4. I use and would use it always.

Furthermore, it does not result in a warning but in an error.

🧙

1 minute ago, matt77hias said:

No one uses Wall. It is perfectly sane to use W4. I use and would use it always.

Furthermore, it does not result in a warning but in an error.

My bad, i got confused between the naming convention of gcc and vs for the warning levels :) Yes, W4 is fine, but warning are warning unless you turn on warning as errors :) And this warning is not on by default at W4, I just checked :( You need to turn it on with the pragma.

 warning C4668: 'NONON' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'

 

 

3 minutes ago, galop1n said:

And this warning is not on by default at W4, I just checked  You need to turn it on with the pragma.

Wait are we still talking about the same thing?

I basically removed the macro define, so we have a program such as:

int main() {
   const int x = 5 + MY_MACRO;
}

which fails to compile with gcc and MVC++

But even if I would have something like this:

#define MY_MACRO

int main() {
   const int x = 5 + MY_MACRO;
}

it will still fail with gcc and MVC++.

 

🧙

This topic is closed to new replies.

Advertisement