CmD3D9HLSLProgramFactory.cpp 1.5 KB

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