HRESULT GSDevice11::CompileShader(uint32 id, const string& entry, D3D11_SHADER_MACRO* macro, ID3D11PixelShader** ps) { HRESULT hr; vector<D3D11_SHADER_MACRO> m; PrepareShaderMacro(m, macro); CComPtr<ID3D11Blob> shader, error; hr = D3DX11CompileFromResource(theApp.GetModuleHandle(), MAKEINTRESOURCE(id), NULL, &m[0], NULL, entry.c_str(), m_shader.ps.c_str(), 0, 0, NULL, &shader, &error, NULL); if(error) { printf("%s\n", (const char*)error->GetBufferPointer()); } if(FAILED(hr)) { return hr; } hr = m_dev->CreatePixelShader((void*)shader->GetBufferPointer(), shader->GetBufferSize(),NULL, ps); if(FAILED(hr)) { return hr; } return hr; }
void GSDevice11::CompileShader(uint32 id, const char* entry, D3D11_SHADER_MACRO* macro, ID3D11GeometryShader** gs, D3D11_SO_DECLARATION_ENTRY* layout, int count) { HRESULT hr; vector<D3D11_SHADER_MACRO> m; PrepareShaderMacro(m, macro); CComPtr<ID3D11Blob> shader, error; hr = D3DX11CompileFromResource(theApp.GetModuleHandle(), MAKEINTRESOURCE(id), NULL, &m[0], NULL, entry, m_shader.gs.c_str(), 0, 0, NULL, &shader, &error, NULL); if(error) { printf("%s\n", (const char*)error->GetBufferPointer()); } if(FAILED(hr)) { throw GSDXRecoverableError(); } hr = m_dev->CreateGeometryShaderWithStreamOutput((void*)shader->GetBufferPointer(), shader->GetBufferSize(), layout, count, NULL, 0, D3D11_SO_NO_RASTERIZED_STREAM, NULL, gs); if(FAILED(hr)) { throw GSDXRecoverableError(); } }
HRESULT GSDevice11::CompileShader(uint32 id, const string& entry, D3D11_SHADER_MACRO* macro, ID3D11VertexShader** vs, D3D11_INPUT_ELEMENT_DESC* layout, int count, ID3D11InputLayout** il) { HRESULT hr; vector<D3D11_SHADER_MACRO> m; PrepareShaderMacro(m, macro); CComPtr<ID3D11Blob> shader, error; hr = D3DX11CompileFromResource(theApp.GetModuleHandle(), MAKEINTRESOURCE(id), NULL, &m[0], NULL, entry.c_str(), m_shader.vs.c_str(), 0, 0, NULL, &shader, &error, NULL); if(error) { printf("%s\n", (const char*)error->GetBufferPointer()); } if(FAILED(hr)) { return hr; } hr = m_dev->CreateVertexShader((void*)shader->GetBufferPointer(), shader->GetBufferSize(), NULL, vs); if(FAILED(hr)) { return hr; } hr = m_dev->CreateInputLayout(layout, count, shader->GetBufferPointer(), shader->GetBufferSize(), il); if(FAILED(hr)) { return hr; } return hr; }