00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00020 #ifdef _WIN32
00021 #include <windows.h>
00022 #endif
00023
00024 #include <iostream>
00025
00026 #include "Arb.hpp"
00027 #include "GlTextures.hpp"
00028 #include "GlBackend.hpp"
00029
00030 #include "PBufferStreams.hpp"
00031
00032 namespace shgl {
00033
00034 struct ArbBackend : public GlBackend {
00035 ArbBackend()
00036 : GlBackend(new ArbCodeStrategy(),
00037 new GlTextures(),
00038 #ifdef __APPLE__
00039
00040 0,
00041 #else
00042 new PBufferStreams(),
00043 #endif
00044 "arb", "1.0")
00045 {
00046 }
00047 };
00048
00049 #ifdef _WIN32
00050
00051 extern "C"
00052 BOOL APIENTRY DllMain(HANDLE hModule,
00053 DWORD ul_reason_for_call,
00054 LPVOID lpReserved)
00055 {
00056 return TRUE;
00057 }
00058
00059 #endif // _WIN32
00060
00061
00062 }
00063
00064 extern "C" {
00065 using namespace shgl;
00066 #ifdef _WIN32
00067 __declspec(dllexport)
00068 #endif
00069 ArbBackend* shBackend_libsharb_instantiate()
00070 {
00071 return new ArbBackend();
00072 }
00073
00074 #ifdef _WIN32
00075 __declspec(dllexport)
00076 #endif
00077 int shBackend_libsharb_target_cost(const std::string& target)
00078 {
00079 if ("arb:vertex" == target) return 1;
00080 if ("arb:fragment" == target) return 1;
00081 #ifndef __APPLE__
00082 if ("arb:stream" == target) return 1;
00083 #else
00084 if ("arb:stream" == target) return 0;
00085 #endif
00086
00087 if (("gpu:vertex" == target) || ("gpu:fragment" == target)) return 2;
00088 if (("vertex" == target) || ("fragment" == target)) return 2;
00089 if (("*:vertex" == target) || ("*:fragment" == target)) return 2;
00090
00091 #ifndef __APPLE__
00092 if ("gpu:stream" == target) return 5;
00093 if ("*:stream" == target) return 5;
00094 if ("stream" == target) return 5;
00095 #else
00096 if ("gpu:stream" == target) return 0;
00097 if ("*:stream" == target) return 0;
00098 if ("stream" == target) return 0;
00099 #endif
00100
00101
00102 return 0;
00103 }
00104 }