1//************************************ bs::framework - Copyright 2018 Marko Pintera **************************************//
2//*********** Licensed under the MIT license. See LICENSE.md for full terms. This notice is not to be removed. ***********//
3#include "GLSL/BsGLSLProgramFactory.h"
4#include "GLSL/BsGLSLGpuProgram.h"
5
6namespace bs { namespace ct
7{
8 SPtr<GpuProgram> GLSLProgramFactory::create(const GPU_PROGRAM_DESC& desc, GpuDeviceFlags deviceMask)
9 {
10 GLSLGpuProgram* prog = new (bs_alloc<GLSLGpuProgram>()) GLSLGpuProgram(desc, deviceMask);
11
12 SPtr<GLSLGpuProgram> gpuProg = bs_shared_ptr<GLSLGpuProgram>(prog);
13 gpuProg->_setThisPtr(gpuProg);
14
15 return gpuProg;
16 }
17
18 SPtr<GpuProgram> GLSLProgramFactory::create(GpuProgramType type, GpuDeviceFlags deviceMask)
19 {
20 GPU_PROGRAM_DESC desc;
21 desc.type = type;
22
23 GLSLGpuProgram* prog = new (bs_alloc<GLSLGpuProgram>()) GLSLGpuProgram(desc, deviceMask);
24
25 SPtr<GLSLGpuProgram> gpuProg = bs_shared_ptr<GLSLGpuProgram>(prog);
26 gpuProg->_setThisPtr(gpuProg);
27
28 return gpuProg;
29 }
30
31 SPtr<GpuProgramBytecode> GLSLProgramFactory::compileBytecode(const GPU_PROGRAM_DESC& desc)
32 {
33 // Note: No bytecode format for GLSL
34 SPtr<GpuProgramBytecode> bytecode = bs_shared_ptr_new<GpuProgramBytecode>();
35 bytecode->compilerId = OPENGL_COMPILER_ID;
36
37 return bytecode;
38 }
39}}