licoah

about constant buffer

Discussion created by licoah on Mar 6, 2009
Latest reply on Mar 6, 2009 by licoah

I had written my program as follows:

for(CALuint i = 0; i < cNum; i++)
    {
        r = calResAllocRemote1D(&_Res[offset + i], device, 1, 1, CAL_FORMAT_BYTE_4, 0);
            if(r != CAL_RESULT_OK)
            {
                fprintf(stderr, "AllocateRes: constants: There is an error in calResAllocLocal1D\n");
                return 0;
            }
            r = calCtxGetMem(&_Mem[offset + i], *ctx, _Res[offset + i]);
            if(r != CAL_RESULT_OK)
            {
                fprintf(stderr, "AllocateRes: constants:There is an error in calCtxGetMem\n");
                return 0;
            }
    }

...

 

for(CALuint i = 0; i < cNum; i++)
    {
        sprintf(buffer, "cb%d", i);
        r = calModuleGetName(&progName, *ctx, *module, buffer);
        if(r != CAL_RESULT_OK)
        {
            fprintf(stderr, "BindIOName: constants: Error string is %s\n",calGetErrorString());
            fprintf(stderr, "Failing name binding was %s\n", buffer);
            return 0;
        }
        r = calCtxSetMem(*ctx, progName, _Mem[offset + i]);
        if(r != CAL_RESULT_OK)
        {
            fprintf(stderr, "BindIOName: calCtxSetMem: constants: Error string is %s %d\n",calGetErrorString(),i);
            return 0;
        }
    }

then I got this error message:

BindIOName: calCtxSetMem:constants: Error string is Invalid format for constant buffer " 0

I don't know the reason for this.

Can somebody help me?

Outcomes