About Store Forum Documentation Contact
Donations:
327$/mo



Post Reply 
(solved)MyProject.exe can't find custom shader
Author Message
3DRaddict Offline
Member

Post: #1
(solved)MyProject.exe can't find custom shader
Until now I've been running all my compiled projects containing custom shaders from the EE Code Editor. For the first time today I published one of my projects, but when I attempted to run its .exe from the '_Publish_' folder I get the message Can't load Shader "User/Custom Shader" .
Where must I place the compiled custom shader so that it will be loaded by application executable?
(This post was last modified: 11-21-2014 05:19 AM by 3DRaddict.)
11-19-2014 10:44 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
RE: MyProject.exe can't find custom shader
Hi,

For the moment I think the only solution would be to manually include it in your pak file, using PakUpdate function on an existing pak file.
This will be improved in the future once I implement the new shader system with the integrated editor.
11-19-2014 01:24 PM
Find all posts by this user Quote this message in a reply
3DRaddict Offline
Member

Post: #3
RE: MyProject.exe can't find custom shader
Thanks, Esenthel, but that does not really help me too much as I'm at a loss as to how to use:
PHP Code:
// Update Pak
Bool PakUpdate(Pak &src_pakC Memp<PakFileData> &update_filesC Str &pak_nameSecure *dest_secure=NULLCOMPRESS_TYPE compress=COMPRESS_NONEInt compression_level=9); // update 'src_pak' by adding 'update_files' and saving the new Pak into 'pak_name', 'compression_level'=(0..9) (0=fastest/worst, 9=slowest/best), if compression is enabled then all files will be compressed (including uncompressed files from 'src_pak') 

My file reading/writing abilities do not go far beyond the more simple stuff.
I've been unable to find any examples of Pak reading/writing, so if anyone here understands this procedure, I'd be extremely grateful if you could kindly post up a code snippet for me so that I might accomplish this task... smile
11-19-2014 03:36 PM
Visit this user's website Find all posts by this user Quote this message in a reply
aceio76 Offline
Silver Supporter

Post: #4
RE: MyProject.exe can't find custom shader
Maybe this will help you get started:

Code:
T1(TYPE) void PakUpdateList(Memb<PakFileData> &updates, C Str &fullname, TYPE &elm)
{
   PakFileData &pfd=updates.New();
   pfd.name=fullname;
   pfd.file.writeMem(); elm.save(pfd.file);
   pfd.modify_time_utc.getUTC();
}

static Memb<PakFileData> updates;  // list that will collect updates to the pak and its contents

PakUpdateList<SomeObjectType>(updates, "filepath inside the pak file", objBasedOnSomeObjectType);  // filepath ie. customobjs\object1.dat

Str custompakfile(CurrentDir+"/custom.pak");
Pak mypak; mypak.load(custompakfile);
PakUpdate(mypak, updates, custompakfile);  // apply updates to custom pak
Paks.add(custompakfile);                      // re-add world pak to the game pak list
(This post was last modified: 11-19-2014 04:27 PM by aceio76.)
11-19-2014 04:25 PM
Visit this user's website Find all posts by this user Quote this message in a reply
3DRaddict Offline
Member

Post: #5
RE: MyProject.exe can't find custom shader
Thanks, aceio76, for that kickstart...I'll see how far I can progress with it.
I've always tried to avoid any C++ code where I see the template designations <....>, but I guess if I'm to make any headway with Esenthel coding, I've got to start facing them sooner rather than later. So, forgive me for an obvious-to-some question, but in your snippet: how do I determine the 'SomeObjectType' and 'objBasedOnSomeObjectType' ?
And how do I determine what type a particular object is? Does my custom shader qualify as an object?
I'm in the process of googling C++ templates, but it would help if you (or anyone)
could supply a quick and simple answer to the above questions. Thanks for your assistance.
(This post was last modified: 11-20-2014 02:37 PM by 3DRaddict.)
11-19-2014 06:51 PM
Visit this user's website Find all posts by this user Quote this message in a reply
aceio76 Offline
Silver Supporter

Post: #6
RE: MyProject.exe can't find custom shader
I see the confusion.

The snippet assumes you are including a newly created object by calling its 'save' function that then puts it in the 'File' struct (see elm.save(pfd.file) inside the PakUpdateList() function. For your case, you already have actual files created (the shader files); those are the ones you need to add to the pak file, perhaps under a specific folder structure inside the pak. You will just need to modify the PakUpdateList() function to read the physical shader file into a 'File' struct, then added to the PakFileData list.

As far as your question with Templates, this snippet happens to use that to designate the object/struct that will be passed to the PakFileData update list.
11-20-2014 01:04 AM
Visit this user's website Find all posts by this user Quote this message in a reply
3DRaddict Offline
Member

Post: #7
RE: MyProject.exe can't find custom shader
I'm getting sooo frustrated...!!

I've been at it all morning, with just no headway

Here is what I've been trying:

PHP Code:
Memb<PakFileDatashaderfile
  
  
PakFileData &pfd=shaderfile.New();
  
pfd.name="User/Custom Shader"
  
pfd.file2="User/Custom Shader";
    
  
Pak pak;
  
pak.load("Bin/Project.pak"); // load the source pak
  
PakUpdate(pakshaderfile"Bin/Project.pak"); // update the pak with the 'User/Custom Shader' file 

The 'Project.pak' is the file in the "_Publish_/myProject/Bin" folder
This is the pak file which has to be updated with my custom shader file (called "Custom Shader") which is held in a folder called "User" off the "Bin" folder.
Running the above code does increase the size of "Project.pak", so something has been added to it. However, on running my application executable, I'm still getting the original error message "Can't load Shader "User/Custom Shader""

Is the above code correct for the job?
I've tried various combinations, with the same result

This is all so complicated. It would be so much easier if there existed a PakManager tool.
(This post was last modified: 11-20-2014 03:11 PM by 3DRaddict.)
11-20-2014 02:34 PM
Visit this user's website Find all posts by this user Quote this message in a reply
aceio76 Offline
Silver Supporter

Post: #8
RE: MyProject.exe can't find custom shader
It looks correct, but of course I'd have to test it myself to be sure. Do you have the Esenthel 1.0 editor? You can use that to view the pak, or create your own pak viewing tool. The Pak struct has everything needed to list the contents. This way you can confirm the files are in the pak file.
The other thing is to make sure that the file path to the user shaders is correct and the folder structure is properly set inside the pak file as well. Being able to view the pak file will help you troubleshoot it.
This might also help you if you need to initialize the pak with its folder structure and starting files:
Code:
Str custpak=CurrentDir+"/cust.pak";
  
   DateTime  timestamp; timestamp.getUTC();
   Memb<File   > files;
   Memb<PakNode> nodes;
   {
      Memb<PakNode> &list=nodes.New().set("folder").children;  // create starting folder called "folder" where all data is stored
      
      File &l=files.New(); l.writeMem(); Object.save(l);
      list.New().set("objects", l, &timestamp);
   }
  
   if(!PakCreate(nodes, custpak)) Exit("Unable to initialize required files");
11-20-2014 02:57 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #9
RE: MyProject.exe can't find custom shader
@3DRaddict:
For the pfd.file2="User/Custom Shader"; I recommend setting full path (including drive) to the source file.
For the pfd.name="User/Custom Shader"; You have forgotten that custom shaders need to be included in folders like:
"Shader/4/xxx"
in your case:
pfd.name="Shader/4/User/Custom Shader";
11-21-2014 01:29 AM
Find all posts by this user Quote this message in a reply
3DRaddict Offline
Member

Post: #10
RE: (solved)MyProject.exe can't find custom shader
Esenthel to the rescue once more... thank you so much!grin
That was indeed the case!

Perhaps some indication in the error message or documentation as to full path required might prevent others from hitting the same problem.

And also thanks to aceio76 for taking the time to look into the problem and steering me in the right direction.
11-21-2014 05:30 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Post Reply