Changeset 42:0b9b286b67b6
- Timestamp:
- 10/19/07 09:16:11
(1 year ago)
- Author:
- lindquist
- branch:
- trunk
- Message:
[svn r46] fix for shift operations
added a simple opengl binding in demos
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r38 |
r42 |
|
| 1 | 1 | module sdl; |
|---|
| 2 | 2 | |
|---|
| 3 | | version(build) |
|---|
| 4 | | pragma(link,"SDL"); |
|---|
| | 3 | version(build) pragma(link,"SDL"); |
|---|
| 5 | 4 | |
|---|
| 6 | 5 | extern(C): |
|---|
| … | … | |
| 44 | 43 | SDL_FULLSCREEN=0x80000000 |
|---|
| 45 | 44 | } |
|---|
| | 45 | enum { |
|---|
| | 46 | SDL_GL_RED_SIZE, |
|---|
| | 47 | SDL_GL_GREEN_SIZE, |
|---|
| | 48 | SDL_GL_BLUE_SIZE, |
|---|
| | 49 | SDL_GL_ALPHA_SIZE, |
|---|
| | 50 | SDL_GL_BUFFER_SIZE, |
|---|
| | 51 | SDL_GL_DOUBLEBUFFER, |
|---|
| | 52 | SDL_GL_DEPTH_SIZE, |
|---|
| | 53 | SDL_GL_STENCIL_SIZE, |
|---|
| | 54 | SDL_GL_ACCUM_RED_SIZE, |
|---|
| | 55 | SDL_GL_ACCUM_GREEN_SIZE, |
|---|
| | 56 | SDL_GL_ACCUM_BLUE_SIZE, |
|---|
| | 57 | SDL_GL_ACCUM_ALPHA_SIZE, |
|---|
| | 58 | SDL_GL_STEREO, |
|---|
| | 59 | SDL_GL_MULTISAMPLEBUFFERS, |
|---|
| | 60 | SDL_GL_MULTISAMPLESAMPLES, |
|---|
| | 61 | SDL_GL_ACCELERATED_VISUAL, |
|---|
| | 62 | SDL_GL_SWAP_CONTROL |
|---|
| | 63 | } |
|---|
| | 64 | int SDL_GL_LoadLibrary(char*); |
|---|
| | 65 | void* SDL_GL_GetProcAddress(char*); |
|---|
| | 66 | int SDL_GL_SetAttribute(int,int); |
|---|
| | 67 | int SDL_GL_GetAttribute(int,int*); |
|---|
| | 68 | void SDL_GL_SwapBuffers(); |
|---|
| | 69 | void SDL_GL_UpdateRects(int,SDL_Rect*); |
|---|
| | 70 | void SDL_GL_Lock(); |
|---|
| | 71 | void SDL_GL_Unlock(); |
|---|
| | 72 | enum : uint { |
|---|
| | 73 | SDL_INIT_TIMER=0x00000001, |
|---|
| | 74 | SDL_INIT_AUDIO=0x00000010, |
|---|
| | 75 | SDL_INIT_VIDEO=0x00000020, |
|---|
| | 76 | SDL_INIT_CDROM=0x00000100, |
|---|
| | 77 | SDL_INIT_JOYSTICK=0x00000200, |
|---|
| | 78 | SDL_INIT_NOPARACHUTE=0x00100000, |
|---|
| | 79 | SDL_INIT_EVENTTHREAD=0x00200000, |
|---|
| | 80 | SDL_INIT_EVERYTHING=0x0000FFFF |
|---|
| | 81 | } |
|---|
| 46 | 82 | |
|---|
| | 83 | int SDL_Init(uint); |
|---|
| | 84 | int SDL_InitSubSystem(uint); |
|---|
| | 85 | int SDL_QuitSubSystem(uint); |
|---|
| | 86 | int SDL_WasInit(uint); |
|---|
| | 87 | void SDL_Quit(); |
|---|
| r35 |
r42 |
|
| 7413 | 7413 | e1->checkIntegral(); |
|---|
| 7414 | 7414 | e2 = e2->checkIntegral(); |
|---|
| 7415 | | e2 = e2->castTo(sc, Type::tshiftcnt); |
|---|
| | 7415 | //e2 = e2->castTo(sc, Type::tshiftcnt); |
|---|
| | 7416 | e2 = e2->castTo(sc, e1->type); // LLVMDC |
|---|
| 7416 | 7417 | return this; |
|---|
| 7417 | 7418 | } |
|---|
| … | … | |
| 7441 | 7442 | e1->checkIntegral(); |
|---|
| 7442 | 7443 | e2 = e2->checkIntegral(); |
|---|
| 7443 | | e2 = e2->castTo(sc, Type::tshiftcnt); |
|---|
| | 7444 | //e2 = e2->castTo(sc, Type::tshiftcnt); |
|---|
| | 7445 | e2 = e2->castTo(sc, e1->type); // LLVMDC |
|---|
| 7444 | 7446 | return this; |
|---|
| 7445 | 7447 | } |
|---|
| … | … | |
| 7469 | 7471 | e1->checkIntegral(); |
|---|
| 7470 | 7472 | e2 = e2->checkIntegral(); |
|---|
| 7471 | | e2 = e2->castTo(sc, Type::tshiftcnt); |
|---|
| | 7473 | //e2 = e2->castTo(sc, Type::tshiftcnt); |
|---|
| | 7474 | e2 = e2->castTo(sc, e1->type); // LLVMDC |
|---|
| 7472 | 7475 | return this; |
|---|
| 7473 | 7476 | } |
|---|
| … | … | |
| 7942 | 7945 | e2 = e2->checkIntegral(); |
|---|
| 7943 | 7946 | e1 = e1->integralPromotions(sc); |
|---|
| 7944 | | e2 = e2->castTo(sc, Type::tshiftcnt); |
|---|
| | 7947 | //e2 = e2->castTo(sc, Type::tshiftcnt); |
|---|
| | 7948 | e2 = e2->castTo(sc, e1->type); // LLVMDC |
|---|
| 7945 | 7949 | type = e1->type; |
|---|
| 7946 | 7950 | } |
|---|
| … | … | |
| 7966 | 7970 | e2 = e2->checkIntegral(); |
|---|
| 7967 | 7971 | e1 = e1->integralPromotions(sc); |
|---|
| 7968 | | e2 = e2->castTo(sc, Type::tshiftcnt); |
|---|
| | 7972 | //e2 = e2->castTo(sc, Type::tshiftcnt); |
|---|
| | 7973 | e2 = e2->castTo(sc, e1->type); // LLVMDC |
|---|
| 7969 | 7974 | type = e1->type; |
|---|
| 7970 | 7975 | } |
|---|
| … | … | |
| 7990 | 7995 | e2 = e2->checkIntegral(); |
|---|
| 7991 | 7996 | e1 = e1->integralPromotions(sc); |
|---|
| 7992 | | e2 = e2->castTo(sc, Type::tshiftcnt); |
|---|
| | 7997 | //e2 = e2->castTo(sc, Type::tshiftcnt); |
|---|
| | 7998 | e2 = e2->castTo(sc, e1->type); // LLVMDC |
|---|
| 7993 | 7999 | type = e1->type; |
|---|
| 7994 | 8000 | } |
|---|
| r40 |
r42 |
|
| 2251 | 2251 | elem* u = e1->toElem(p); \ |
|---|
| 2252 | 2252 | elem* v = e2->toElem(p); \ |
|---|
| 2253 | | llvm::Value* tmp = llvm::BinaryOperator::create(llvm::Instruction::Y, u->getValue(), v->getValue(), "tmp", p->scopebb()); \ |
|---|
| 2254 | | Logger::cout() << *tmp << '|' << *u->mem << '\n'; \ |
|---|
| | 2253 | llvm::Value* uval = u->getValue(); \ |
|---|
| | 2254 | assert(uval); \ |
|---|
| | 2255 | llvm::Value* vval = v->getValue(); \ |
|---|
| | 2256 | assert(vval); \ |
|---|
| | 2257 | llvm::Value* tmp = llvm::BinaryOperator::create(llvm::Instruction::Y, uval, vval, "tmp", p->scopebb()); \ |
|---|
| 2255 | 2258 | if (u->mem == 0) \ |
|---|
| 2256 | 2259 | LLVM_DtoGiveArgumentStorage(u); \ |
|---|
| | 2260 | Logger::cout() << *tmp << '|' << *u->mem << '\n'; \ |
|---|
| 2257 | 2261 | new llvm::StoreInst(LLVM_DtoPointedType(u->mem, tmp), u->mem, p->scopebb()); \ |
|---|
| 2258 | 2262 | delete u; \ |
|---|
| r35 |
r42 |
|
| 137 | 137 | |
|---|
| 138 | 138 | assert(0, "need opCmp for class <no classinfo yet>"); |
|---|
| 139 | | return 0; |
|---|
| 140 | 139 | //throw new Error("need opCmp for class " ~ this.classinfo.name); |
|---|
| 141 | 140 | } |
|---|
| … | … | |
| 221 | 220 | * null if failed |
|---|
| 222 | 221 | */ |
|---|
| 223 | | static Object factory(char[] classname) |
|---|
| 224 | | { |
|---|
| 225 | | /+auto ci = ClassInfo.find(classname); |
|---|
| | 222 | /+static Object factory(char[] classname) |
|---|
| | 223 | { |
|---|
| | 224 | auto ci = ClassInfo.find(classname); |
|---|
| 226 | 225 | if (ci) |
|---|
| 227 | 226 | { |
|---|
| 228 | 227 | return ci.create(); |
|---|
| | 228 | } |
|---|
| | 229 | return null; |
|---|
| 229 | 230 | }+/ |
|---|
| 230 | | return null; |
|---|
| 231 | | } |
|---|
| 232 | 231 | } |
|---|
| 233 | 232 | |
|---|
| r1 |
r42 |
|
| 208 | 208 | */ |
|---|
| 209 | 209 | version (LLVM) |
|---|
| 210 | | pragma(LLVM_internal, "intrinsic", "llvm.bswap.i32.i32") |
|---|
| | 210 | pragma(LLVM_internal, "intrinsic", "llvm.bswap.i32") |
|---|
| 211 | 211 | uint bswap(uint val); |
|---|
| 212 | 212 | else |
|---|
| r38 |
r42 |
|
| 40 | 40 | return ret; |
|---|
| 41 | 41 | } |
|---|
| 42 | | |
|---|