   Bypassing FX files
  I want to use the programmable pipeline, but I don't want FX files laying around in my data folder where anyone can modify them. I'm pretty sure I can store them in the exe's resource file, but even more preferable would be the ability to load a custom file format and generate HLSL from that, and then compile the HLSL (this is what I've been doing for other things. I hate leaving X files and FX files and other "newbie formats" laying around in a data folder where anyone can access them. I want to use my own file format that requires an editor to modify) I have already done this with meshes and want to be able to do it with HLSL.Any hints as to what course of action to take?   
  You could just compile them to binary at build-time using fxc.  This will make them hard enough to decipher, and will speed up your load times too.   ;  Oh right, forgot I could do that. What's the function for loading a precompiled shader?EDIT:Also, one of the reasons I object to using a predetermined file format is because anyone can 'steal' the file and use it in their own project. What I'd really prefer to do is have my own Flag-based file format for shaders that generates HLSL data when loaded.   ;Quote:Original post by Super Llama but even more preferable would be the ability to load a custom file format and generate HLSL from that, and then compile the HLSL (this is what I've been You could link your fx files to your exe file as resources files, then extract them to a temporary .tmp file.Once this .tmp file has been loaded it can be deleted from hard-driveQuote:I hate leaving X files and FX files and other "newbie formats" laying around in a data folder where anyone can access them. This is the problem.One solution is to make your own 3d object custom format   ;Quote:Original post by Super LlamaOh right, forgot I could do that. What's the function for loading a precompiled shader?D3DXCreateEffectFromFileQuote:Original post by Super LlamaAlso, one of the reasons I object to using a predetermined file format is because anyone can 'steal' the file and use it in their own project. What I'd really prefer to do is have my own Flag-based file format for shaders that generates HLSL data when loaded.I really don't see why you'd bother.  An obfuscation technique like that can be easily deciphered by anyone who really wants to get at it, and in the end all they're going to get is a bunch of HLSL...something that's completely useless without all of the supporting app code and assets to go with it.   ;Quote:One solution is to make your own 3d object custom formatI did make my own custom 3d format, and now I want to make my own custom shader format. But on the exe level, everything has to be passed to DX eventually. For my mesh format, I converted it to a vertexbuffer. What I'm asking is: Is there a shader equivalent to a VertexBuffer, something that can be passed to DX that is fully contained in binary, or do I have to export a temp file and load that to use HLSL?Looking at D3DXCompileShader, I see the argument:pSrcData    [in] Pointer to a string that contains the shader.Does this mean I can have HLSL in a string and compile a working shader from here?Its output is a D3DXBUFFER, which looks like it could be passed to D3DXCreateEffect's pSrcData    [in] Pointer to a buffer containing an effect description.EDIT:Basically, will the following work?D3DXCompileShader(strHLSLexport, strlen(strHLSLexport), 0, 0, "ShadeVert", LPCSTR D3DXGetVertexShaderProfile(&ddev), 0, &out, NULL, &consttbl);D3DXCreateEffect(&ddev, &out,  sizeof(out),  0, 0, 0, NULL,  &outEffect,  NULL);;  No shaders and Effect's are different.  You can't compile a shader, and then create an effect from it.  You have to create an effect from your .fx source.If you just want to compile an effect from a string, just use D3DXCreateEffect and pass it the string containing your ASCII source code.   ;Quote:Original post by MJPIf you just want to compile an effect from a string, just use D3DXCreateEffect and pass it the string containing your ASCII source code.thanks, that's what i wanted   