vpalmer

Member
  • Content count

    4
  • Joined

  • Last visited

Community Reputation

107 Neutral

About vpalmer

  • Rank
    Newbie
  1. solved (read first post of that topic).
  2. via debugger i found some errors (compiled shader files were in wrong directory). but now i have next problem:   dev->CreateVertexShader(vsh.pbuf, vsh.size,NULL, &pVS);   returns E_INVALIDARG - what wrong with parameters?
  3. SOLVED!  //my shader files were wrong compiled (without /E parametr for Entry point), and need to remember to allocate memory for variable to read file content into it with ifstream I'm trying to learn DX11 programming - by books and tutorials on net. Few days ago I stucked at loading precompiled shaders files and creating shaders with them.With tutorial I wrote program to draw simple triangle and it works fine while i load and compile shaders from 2 .hlsl files with D3DX11CompileFromFile function. But after i compiled .hlsl files with fxc.exe utility and trying to read them with ifstream, my program crash during runtime (still compiled without warnings).   shaderbuf struct for file reading and global vars: struct shaderbuf { char* pbuf; int size; }; extern shaderbuf vsh; extern shaderbuf psh;   compiled shader files reading function and shader creation: shaderbuf ReadShader(char* filename) { shaderbuf sb; int size; std::ifstream ifs; ifs.open(filename, ifs.in | ifs.binary); ifs.seekg(0, ifs.end); size = int(ifs.tellg()); sb.size = size; ifs.seekg(0, ifs.beg); ifs.read(sb.pbuf, size); ifs.close(); return sb; } void InitPipeline() { shaderbuf vsh = ReadShader("vshader.cso"); shaderbuf psh = ReadShader("pshader.cso"); dev->CreateVertexShader(&vsh.pbuf, vsh.size, NULL, &pVS); dev->CreatePixelShader(&psh.pbuf, psh.size, NULL, &pPS); //set shader objects devcon->VSSetShader(pVS, 0, 0); devcon->PSSetShader(pPS, 0, 0); BufferCreatingAndMapping(); }   InputLayout creation (i guess there can be some errors with pointers to Bytecode too): dev->CreateInputLayout(ied, sizeof(ied)/sizeof(ied[0]), vsh.pbuf, vsh.size, &pLayout);     Help me pls to find my errors. Need to resolve shader files loading with ifstream.