BsD3D9HLSLProgramFactory.cpp 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #include "BsD3D9HLSLProgramFactory.h"
  2. #include "BsD3D9GpuProgram.h"
  3. namespace BansheeEngine
  4. {
  5. String D3D9HLSLProgramFactory::LANGUAGE_NAME = "hlsl";
  6. D3D9HLSLProgramFactory::D3D9HLSLProgramFactory()
  7. {
  8. }
  9. D3D9HLSLProgramFactory::~D3D9HLSLProgramFactory()
  10. {
  11. }
  12. const String& D3D9HLSLProgramFactory::getLanguage() const
  13. {
  14. return LANGUAGE_NAME;
  15. }
  16. GpuProgramPtr D3D9HLSLProgramFactory::create(const String& source, const String& entryPoint,
  17. GpuProgramType gptype, GpuProgramProfile profile, const Vector<HGpuProgInclude>* includes, bool requiresAdjacency)
  18. {
  19. if (gptype == GPT_VERTEX_PROGRAM)
  20. {
  21. D3D9GpuVertexProgram* prog = new (bs_alloc<D3D9GpuVertexProgram, PoolAlloc>())
  22. D3D9GpuVertexProgram(source, entryPoint, profile, includes);
  23. return bs_core_ptr<D3D9GpuVertexProgram, PoolAlloc>(prog);
  24. }
  25. else if (gptype == GPT_FRAGMENT_PROGRAM)
  26. {
  27. D3D9GpuFragmentProgram* prog = new (bs_alloc<D3D9GpuFragmentProgram, PoolAlloc>())
  28. D3D9GpuFragmentProgram(source, entryPoint, profile, includes);
  29. return bs_core_ptr<D3D9GpuFragmentProgram, PoolAlloc>(prog);
  30. }
  31. return nullptr;
  32. }
  33. GpuProgramPtr D3D9HLSLProgramFactory::create(GpuProgramType type)
  34. {
  35. if (type == GPT_VERTEX_PROGRAM)
  36. {
  37. D3D9GpuVertexProgram* prog = new (bs_alloc<D3D9GpuVertexProgram, PoolAlloc>())
  38. D3D9GpuVertexProgram("", "", GPP_NONE, nullptr);
  39. return bs_core_ptr<D3D9GpuVertexProgram, PoolAlloc>(prog);
  40. }
  41. else if (type == GPT_FRAGMENT_PROGRAM)
  42. {
  43. D3D9GpuFragmentProgram* prog = new (bs_alloc<D3D9GpuFragmentProgram, PoolAlloc>())
  44. D3D9GpuFragmentProgram("", "", GPP_NONE, nullptr);
  45. return bs_core_ptr<D3D9GpuFragmentProgram, PoolAlloc>(prog);
  46. }
  47. return nullptr;
  48. }
  49. }