Initial megacommit.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,752 @@
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include "Globals.h"
|
||||
|
||||
#include "VertexLoader.h"
|
||||
|
||||
#include "BPStructs.h"
|
||||
#include "OpcodeDecoding.h"
|
||||
#include "TextureMngr.h"
|
||||
#include "TextureDecoder.h"
|
||||
#include "VertexShader.h"
|
||||
#include "PixelShader.h"
|
||||
|
||||
//BP state
|
||||
BPMemory bpmem;
|
||||
|
||||
#define BPMEM_GENMODE 0x00
|
||||
#define BPMEM_IND_MTX 0x06
|
||||
#define BPMEM_RAS1_SS0 0x25 // ind tex coord scale 0
|
||||
#define BPMEM_RAS1_SS1 0x26 // ind tex coord scale 1
|
||||
#define BPMEM_ZMODE 0x40
|
||||
#define BPMEM_BLENDMODE 0x41
|
||||
#define BPMEM_CONSTANTALPHA 0x42
|
||||
#define BPMEM_ALPHACOMPARE 0xF3
|
||||
#define BPMEM_LINEPTWIDTH 0x22
|
||||
#define BPMEM_TEXINVALIDATE 0x66
|
||||
#define BPMEM_SCISSORTL 0x20
|
||||
#define BPMEM_SCISSORBR 0x21
|
||||
#define BPMEM_SCISSOROFFSET 0x59
|
||||
#define BPMEM_CLEARBBOX1 0x55 // let's hope not many games use bboxes..
|
||||
#define BPMEM_CLEARBBOX2 0x56 // TODO(ector): add something that watches bboxes
|
||||
#define BPMEM_TEXMODE0_1 0x80
|
||||
#define BPMEM_TEXMODE0_2 0xA0
|
||||
#define BPMEM_FOGPARAM0 0xEE
|
||||
#define BPMEM_FOGBMAGNITUDE 0xEF
|
||||
#define BPMEM_FOGBEXPONENT 0xF0
|
||||
#define BPMEM_FOGPARAM3 0xF1
|
||||
#define BPMEM_FOGCOLOR 0xF2
|
||||
#define BPMEM_ZTEX1 0xF4
|
||||
#define BPMEM_ZTEX2 0xF5
|
||||
#define BPMEM_DRAWDONE 0x45
|
||||
|
||||
#define BPMEM_PE_TOKEN_ID 0x47
|
||||
#define BPMEM_PE_TOKEN_INT_ID 0x48
|
||||
|
||||
// State translation lookup tables
|
||||
const GLenum glSrcFactors[8] =
|
||||
{
|
||||
GL_ZERO,
|
||||
GL_ONE,
|
||||
GL_DST_COLOR,
|
||||
GL_ONE_MINUS_DST_COLOR,
|
||||
GL_SRC_ALPHA,
|
||||
GL_ONE_MINUS_SRC_ALPHA,
|
||||
GL_DST_ALPHA,
|
||||
GL_ONE_MINUS_DST_ALPHA
|
||||
};
|
||||
|
||||
const GLenum glDestFactors[8] = {
|
||||
GL_ZERO, GL_ONE, GL_SRC_COLOR, GL_ONE_MINUS_SRC_COLOR,
|
||||
GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_DST_ALPHA, GL_ONE_MINUS_DST_ALPHA };
|
||||
|
||||
const GLenum glCmpFuncs[8] = { GL_NEVER, GL_LESS, GL_EQUAL, GL_LEQUAL, GL_GREATER, GL_NOTEQUAL, GL_GEQUAL, GL_ALWAYS };
|
||||
|
||||
const GLenum glLogicOpCodes[16] = {
|
||||
GL_CLEAR, GL_SET, GL_COPY, GL_COPY_INVERTED, GL_NOOP, GL_INVERT, GL_AND, GL_NAND,
|
||||
GL_OR, GL_NOR, GL_XOR, GL_EQUIV, GL_AND_REVERSE, GL_AND_INVERTED, GL_OR_REVERSE, GL_OR_INVERTED };
|
||||
|
||||
void BPInit()
|
||||
{
|
||||
memset(&bpmem, 0, sizeof(bpmem));
|
||||
bpmem.bpMask = 0xFFFFFF;
|
||||
}
|
||||
|
||||
void BPWritten(int addr, int changes, int newval)
|
||||
{
|
||||
DVSTARTPROFILE();
|
||||
|
||||
//static int count = 0;
|
||||
//ERROR_LOG("(%d) %x: %x\n", count++, addr, newval);
|
||||
|
||||
switch(addr)
|
||||
{
|
||||
case BPMEM_GENMODE:
|
||||
if (changes) {
|
||||
VertexManager::Flush();
|
||||
((u32*)&bpmem)[addr] = newval;
|
||||
PRIM_LOG("genmode: texgen=%d, col=%d, ms_en=%d, tev=%d, culmode=%d, ind=%d, zfeeze=%d\n", bpmem.genMode.numtexgens, bpmem.genMode.numcolchans,
|
||||
bpmem.genMode.ms_en, bpmem.genMode.numtevstages+1, bpmem.genMode.cullmode, bpmem.genMode.numindstages, bpmem.genMode.zfreeze);
|
||||
|
||||
// none, ccw, cw, ccw
|
||||
if (bpmem.genMode.cullmode>0) {
|
||||
glEnable(GL_CULL_FACE);
|
||||
glFrontFace(bpmem.genMode.cullmode==2?GL_CCW:GL_CW);
|
||||
}
|
||||
else glDisable(GL_CULL_FACE);
|
||||
|
||||
PixelShaderMngr::SetGenModeChanged();
|
||||
}
|
||||
break;
|
||||
|
||||
case BPMEM_IND_MTX+0:
|
||||
case BPMEM_IND_MTX+1:
|
||||
case BPMEM_IND_MTX+2:
|
||||
case BPMEM_IND_MTX+3:
|
||||
case BPMEM_IND_MTX+4:
|
||||
case BPMEM_IND_MTX+5:
|
||||
case BPMEM_IND_MTX+6:
|
||||
case BPMEM_IND_MTX+7:
|
||||
case BPMEM_IND_MTX+8:
|
||||
if (changes) {
|
||||
VertexManager::Flush();
|
||||
((u32*)&bpmem)[addr] = newval;
|
||||
PixelShaderMngr::SetIndMatrixChanged((addr-BPMEM_IND_MTX)/3);
|
||||
}
|
||||
break;
|
||||
case BPMEM_RAS1_SS0:
|
||||
case BPMEM_RAS1_SS1:
|
||||
if (changes) {
|
||||
VertexManager::Flush();
|
||||
((u32*)&bpmem)[addr] = newval;
|
||||
PixelShaderMngr::SetIndTexScaleChanged();
|
||||
}
|
||||
break;
|
||||
case BPMEM_ZMODE:
|
||||
if (changes) {
|
||||
VertexManager::Flush();
|
||||
((u32*)&bpmem)[addr] = newval;
|
||||
PRIM_LOG("zmode: test=%d, func=%d, upd=%d\n", bpmem.zmode.testenable, bpmem.zmode.func, bpmem.zmode.updateenable);
|
||||
|
||||
if (bpmem.zmode.testenable) {
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glDepthMask(bpmem.zmode.updateenable?GL_TRUE:GL_FALSE);
|
||||
glDepthFunc(glCmpFuncs[bpmem.zmode.func]);
|
||||
}
|
||||
else {
|
||||
// if the test is disabled write is disabled too
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
glDepthMask(GL_FALSE);
|
||||
}
|
||||
|
||||
if( !bpmem.zmode.updateenable )
|
||||
Renderer::SetRenderMode(Renderer::RM_Normal);
|
||||
}
|
||||
break;
|
||||
|
||||
case BPMEM_ALPHACOMPARE:
|
||||
if (changes) {
|
||||
VertexManager::Flush();
|
||||
((u32*)&bpmem)[addr] = newval;
|
||||
PRIM_LOG("alphacmp: ref0=%d, ref1=%d, comp0=%d, comp1=%d, logic=%d\n", bpmem.alphaFunc.ref0, bpmem.alphaFunc.ref1,
|
||||
bpmem.alphaFunc.comp0, bpmem.alphaFunc.comp1, bpmem.alphaFunc.logic);
|
||||
PixelShaderMngr::SetAlpha(bpmem.alphaFunc);
|
||||
}
|
||||
break;
|
||||
|
||||
case BPMEM_CONSTANTALPHA:
|
||||
if (changes) {
|
||||
VertexManager::Flush();
|
||||
((u32*)&bpmem)[addr] = newval;
|
||||
PRIM_LOG("constalpha: alp=%d, en=%d\n", bpmem.dstalpha.alpha, bpmem.dstalpha.enable);
|
||||
PixelShaderMngr::SetDestAlpha(bpmem.dstalpha);
|
||||
}
|
||||
break;
|
||||
|
||||
case BPMEM_LINEPTWIDTH:
|
||||
{
|
||||
float fratio = VertexShaderMngr::rawViewport[0] != 0 ? (float)Renderer::GetTargetWidth()/640.0f : 1.0f;
|
||||
if( bpmem.lineptwidth.linesize > 0 ) {
|
||||
glLineWidth((float)bpmem.lineptwidth.linesize*fratio/6.0f); // scale by ratio of widths
|
||||
}
|
||||
if( bpmem.lineptwidth.pointsize > 0 )
|
||||
glPointSize((float)bpmem.lineptwidth.pointsize*fratio/6.0f);
|
||||
break;
|
||||
}
|
||||
|
||||
case 0x43:
|
||||
if (changes) {
|
||||
VertexManager::Flush();
|
||||
((u32*)&bpmem)[addr] = newval;
|
||||
}
|
||||
break;
|
||||
|
||||
case BPMEM_BLENDMODE:
|
||||
if (changes & 0xFFFF) {
|
||||
|
||||
VertexManager::Flush();
|
||||
((u32*)&bpmem)[addr] = newval;
|
||||
PRIM_LOG("blendmode: en=%d, open=%d, colupd=%d, alphaupd=%d, dst=%d, src=%d, sub=%d, mode=%d\n",
|
||||
bpmem.blendmode.blendenable, bpmem.blendmode.logicopenable, bpmem.blendmode.colorupdate, bpmem.blendmode.alphaupdate,
|
||||
bpmem.blendmode.dstfactor, bpmem.blendmode.srcfactor, bpmem.blendmode.subtract, bpmem.blendmode.logicmode);
|
||||
|
||||
if (changes & 1) {
|
||||
if (bpmem.blendmode.blendenable) {
|
||||
glEnable(GL_BLEND);
|
||||
|
||||
}
|
||||
else glDisable(GL_BLEND);
|
||||
}
|
||||
if( changes & 2 ) {
|
||||
if( Renderer::CanBlendLogicOp() ) {
|
||||
if( bpmem.blendmode.logicopenable ) {
|
||||
glEnable(GL_COLOR_LOGIC_OP);
|
||||
glLogicOp(glLogicOpCodes[bpmem.blendmode.logicmode]);
|
||||
}
|
||||
else glDisable(GL_COLOR_LOGIC_OP);
|
||||
}
|
||||
//else {
|
||||
// if( bpmem.blendmode.logicopenable ) {
|
||||
// switch(bpmem.blendmode.logicmode) {
|
||||
// case 0: // clear dst to 0
|
||||
// glEnable(GL_BLEND);
|
||||
// glBlendFunc(GL_ZERO, GL_ZERO);
|
||||
// break;
|
||||
// case 1: // set dst to 1
|
||||
// glEnable(GL_BLEND);
|
||||
// glBlendFunc(GL_ONE, GL_ONE);
|
||||
// break;
|
||||
// case 2: // set dst to src
|
||||
// glDisable(GL_BLEND);
|
||||
// break;
|
||||
// case 3: // set dst to ~src
|
||||
// glEnable(GL_BLEND);
|
||||
// glBlendFunc(GL_ONE_MINUS_SRC_COLOR, GL_ZERO); //?
|
||||
// break;
|
||||
// case 4: // set dst to dst
|
||||
// glEnable(GL_BLEND);
|
||||
// glBlendFunc(GL_ZERO, GL_ONE); //?
|
||||
// break;
|
||||
// case 5: // set dst to ~dst
|
||||
// glEnable(GL_BLEND);
|
||||
// glBlendFunc(GL_ZERO, GL_ONE_MINUS_DST_COLOR); //?
|
||||
// break;
|
||||
// case 6: // set dst to src&dst
|
||||
// case 7: // set dst to ~(src&dst)
|
||||
// case 8: // set dst to src|dst
|
||||
// case 9: // set dst to ~(src|dst)
|
||||
// case 10: // set dst to src xor dst
|
||||
// case 11: // set dst to ~(src xor dst)
|
||||
// case 12: // set dst to src&~dst
|
||||
// case 13: // set dst to ~src&dst
|
||||
// case 14: // set dst to src|~dst
|
||||
// case 15: // set dst to ~src|dst
|
||||
// ERROR_LOG("logicopenable %d not supported\n", bpmem.blendmode.logicmode);
|
||||
// break;
|
||||
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
}
|
||||
if (changes & 4) {
|
||||
// pointless
|
||||
//if (bpmem.blendmode.dither) glEnable(GL_DITHER);
|
||||
//else glDisable(GL_DITHER);
|
||||
}
|
||||
if( changes & 0xFE0) {
|
||||
if( !bpmem.blendmode.subtract )
|
||||
glBlendFunc(glSrcFactors[bpmem.blendmode.srcfactor], glDestFactors[bpmem.blendmode.dstfactor]);
|
||||
}
|
||||
if (changes & 0x800) {
|
||||
glBlendEquation(bpmem.blendmode.subtract?GL_FUNC_REVERSE_SUBTRACT:GL_FUNC_ADD);
|
||||
if( bpmem.blendmode.subtract )
|
||||
glBlendFunc(GL_ONE, GL_ONE);
|
||||
else
|
||||
glBlendFunc(glSrcFactors[bpmem.blendmode.srcfactor], glDestFactors[bpmem.blendmode.dstfactor]);
|
||||
}
|
||||
|
||||
if (changes & 0x18)
|
||||
SetColorMask();
|
||||
}
|
||||
break;
|
||||
|
||||
case BPMEM_FOGPARAM0:
|
||||
case BPMEM_FOGBEXPONENT:
|
||||
case BPMEM_FOGBMAGNITUDE:
|
||||
if (changes) {
|
||||
VertexManager::Flush();
|
||||
((u32*)&bpmem)[addr] = newval;
|
||||
}
|
||||
break;
|
||||
|
||||
case BPMEM_FOGPARAM3:
|
||||
//fog settings
|
||||
if (changes) {
|
||||
VertexManager::Flush();
|
||||
((u32*)&bpmem)[addr] = newval;
|
||||
}
|
||||
break;
|
||||
|
||||
case BPMEM_FOGCOLOR:
|
||||
if (changes)
|
||||
{
|
||||
VertexManager::Flush();
|
||||
((u32*)&bpmem)[addr] = newval;
|
||||
float fogcolor[4] = { ((bpmem.fog.color>>16)&0xff)/255.0f, ((bpmem.fog.color>>8)&0xff)/255.0f, (bpmem.fog.color&0xff)/255.0f, (bpmem.fog.color>>24)/255.0f };
|
||||
}
|
||||
break;
|
||||
|
||||
case BPMEM_TEXINVALIDATE:
|
||||
//TexCache_Invalidate();
|
||||
break;
|
||||
|
||||
case BPMEM_SCISSOROFFSET:
|
||||
if (changes) {
|
||||
VertexManager::Flush();
|
||||
((u32*)&bpmem)[addr] = newval;
|
||||
SetScissorRect();
|
||||
}
|
||||
break;
|
||||
|
||||
case BPMEM_SCISSORTL:
|
||||
case BPMEM_SCISSORBR:
|
||||
|
||||
if (changes) {
|
||||
VertexManager::Flush();
|
||||
((u32*)&bpmem)[addr] = newval;
|
||||
if( !SetScissorRect() ) {
|
||||
if( addr == BPMEM_SCISSORBR )
|
||||
ERROR_LOG("bad scissor!\n");
|
||||
}
|
||||
}
|
||||
break;
|
||||
case BPMEM_ZTEX1:
|
||||
if (changes) {
|
||||
VertexManager::Flush();
|
||||
((u32*)&bpmem)[addr] = newval;
|
||||
PRIM_LOG("ztex bias=0x%x\n", bpmem.ztex1.bias);
|
||||
PixelShaderMngr::SetZTetureBias(bpmem.ztex1.bias);
|
||||
}
|
||||
break;
|
||||
case BPMEM_ZTEX2:
|
||||
if (changes) {
|
||||
VertexManager::Flush();
|
||||
((u32*)&bpmem)[addr] = newval;
|
||||
#ifdef _DEBUG
|
||||
const char* pzop[] = {"DISABLE", "ADD", "REPLACE", "?"};
|
||||
const char* pztype[] = {"Z8", "Z16", "Z24", "?"};
|
||||
PRIM_LOG("ztex op=%s, type=%s\n", pzop[bpmem.ztex2.op], pztype[bpmem.ztex2.type]);
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
|
||||
case 0xf6: // ksel0
|
||||
case 0xf7: // ksel1
|
||||
case 0xf8: // ksel2
|
||||
case 0xf9: // ksel3
|
||||
case 0xfa: // ksel4
|
||||
case 0xfb: // ksel5
|
||||
case 0xfc: // ksel6
|
||||
case 0xfd: // ksel7
|
||||
if (changes)
|
||||
{
|
||||
VertexManager::Flush();
|
||||
((u32*)&bpmem)[addr] = newval;
|
||||
PixelShaderMngr::SetTevKSelChanged(addr-0xf6);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
switch(addr & 0xFC) //texture sampler filter
|
||||
{
|
||||
case 0x28: // tevorder 0-3
|
||||
case 0x2C: // tevorder 4-7
|
||||
if (changes)
|
||||
{
|
||||
VertexManager::Flush();
|
||||
((u32*)&bpmem)[addr] = newval;
|
||||
PixelShaderMngr::SetTevOrderChanged(addr-0x28);
|
||||
}
|
||||
break;
|
||||
|
||||
case 0x80: // TEX MODE 0
|
||||
case 0xA0:
|
||||
if (changes)
|
||||
{
|
||||
VertexManager::Flush();
|
||||
((u32*)&bpmem)[addr] = newval;
|
||||
}
|
||||
break;
|
||||
case 0x84://TEX MODE 1
|
||||
case 0xA4:
|
||||
break;
|
||||
case 0x88://TEX IMAGE 0
|
||||
case 0xA8:
|
||||
if (changes)
|
||||
{
|
||||
//textureChanged[((addr&0xE0)==0xA0)*4+(addr&3)] = true;
|
||||
VertexManager::Flush();
|
||||
((u32*)&bpmem)[addr] = newval;
|
||||
}
|
||||
break;
|
||||
case 0x8C://TEX IMAGE 1
|
||||
case 0xAC:
|
||||
if (changes)
|
||||
{
|
||||
//textureChanged[((addr&0xE0)==0xA0)*4+(addr&3)] = true;
|
||||
VertexManager::Flush();
|
||||
((u32*)&bpmem)[addr] = newval;
|
||||
}
|
||||
break;
|
||||
case 0x90://TEX IMAGE 2
|
||||
case 0xB0:
|
||||
if (changes)
|
||||
{
|
||||
//textureChanged[((addr&0xE0)==0xA0)*4+(addr&3)] = true;
|
||||
VertexManager::Flush();
|
||||
((u32*)&bpmem)[addr] = newval;
|
||||
}
|
||||
break;
|
||||
case 0x94://TEX IMAGE 3
|
||||
case 0xB4:
|
||||
if (changes)
|
||||
{
|
||||
//textureChanged[((addr&0xE0)==0xA0)*4+(addr&3)] = true;
|
||||
VertexManager::Flush();
|
||||
((u32*)&bpmem)[addr] = newval;
|
||||
}
|
||||
break;
|
||||
case 0x98://TEX TLUT
|
||||
case 0xB8:
|
||||
if (changes)
|
||||
{
|
||||
//textureChanged[((addr&0xE0)==0xA0)*4+(addr&3)] = true;
|
||||
VertexManager::Flush();
|
||||
((u32*)&bpmem)[addr] = newval;
|
||||
}
|
||||
break;
|
||||
case 0x9C://TEX UNKNOWN
|
||||
case 0xBC:
|
||||
//ERROR_LOG("texunknown%x = %x\n", addr, newval);
|
||||
((u32*)&bpmem)[addr] = newval;
|
||||
break;
|
||||
case 0xE0:
|
||||
case 0xE4:
|
||||
if (addr&1) { // don't compare with changes!
|
||||
VertexManager::Flush();
|
||||
((u32*)&bpmem)[addr] = newval;
|
||||
int num = (addr>>1)&0x3;
|
||||
PixelShaderMngr::SetColorChanged(bpmem.tevregs[num].high.type, num);
|
||||
}
|
||||
else
|
||||
((u32*)&bpmem)[addr] = newval;
|
||||
break;
|
||||
|
||||
default:
|
||||
switch(addr&0xF0) {
|
||||
case 0x10: // tevindirect 0-15
|
||||
if (changes) {
|
||||
VertexManager::Flush();
|
||||
((u32*)&bpmem)[addr] = newval;
|
||||
PixelShaderMngr::SetTevIndirectChanged(addr-0x10);
|
||||
}
|
||||
break;
|
||||
|
||||
case 0x30:
|
||||
if( changes ) {
|
||||
VertexManager::Flush();
|
||||
((u32*)&bpmem)[addr] = newval;
|
||||
PixelShaderMngr::SetTexDimsChanged((addr>>1)&0x7);
|
||||
}
|
||||
break;
|
||||
|
||||
case 0xC0:
|
||||
case 0xD0:
|
||||
if (changes)
|
||||
{
|
||||
VertexManager::Flush();
|
||||
((u32*)&bpmem)[addr] = newval;
|
||||
PixelShaderMngr::SetTevCombinerChanged((addr&0x1f)/2);
|
||||
}
|
||||
break;
|
||||
|
||||
case 0x20:
|
||||
case 0x80:
|
||||
case 0x90:
|
||||
case 0xA0:
|
||||
case 0xB0:
|
||||
default:
|
||||
if (changes)
|
||||
{
|
||||
VertexManager::Flush();
|
||||
((u32*)&bpmem)[addr] = newval;
|
||||
/*switch(addr) {
|
||||
case 0x01:
|
||||
case 0x02:
|
||||
case 0x03:
|
||||
case 0x04: break; // copy filter values
|
||||
case 0x0f: break; // mask
|
||||
case 0x27: break; // tev ind order
|
||||
case 0x44: break; // field mask
|
||||
case 0x45: break; // draw done
|
||||
case 0x46: break; // clock
|
||||
case 0x49:
|
||||
case 0x4a: break; // copy tex src
|
||||
case 0x4b: break; // copy tex dest
|
||||
case 0x4d: break; // copyMipMapStrideChannels
|
||||
case 0x4e: break; // disp copy scale
|
||||
case 0x4f: break; // clear color
|
||||
case 0x50: break; // clear color
|
||||
case 0x51: break; // casez
|
||||
case 0x52: break; // trigger efb copy
|
||||
case 0x53:
|
||||
case 0x54: break; // more copy filters
|
||||
case 0x55:
|
||||
case 0x56: break; // bounding box
|
||||
case 0x64:
|
||||
case 0x65: break; // tlut src dest
|
||||
case 0xe8: break; // fog range
|
||||
case 0xe9:
|
||||
case 0xea:
|
||||
case 0xeb:
|
||||
case 0xec:
|
||||
case 0xed: break; // fog
|
||||
case 0xfe: break; // mask
|
||||
default:
|
||||
// 0x58 = 0xf
|
||||
// 0x69 = 0x49e
|
||||
ERROR_LOG("bp%.2x = %x\n", addr, newval);
|
||||
}*/
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void SetColorMask()
|
||||
{
|
||||
if (bpmem.blendmode.alphaupdate && bpmem.blendmode.colorupdate)
|
||||
glColorMask(GL_TRUE,GL_TRUE,GL_TRUE,GL_TRUE);
|
||||
else if (bpmem.blendmode.alphaupdate)
|
||||
glColorMask(GL_FALSE,GL_FALSE,GL_FALSE,GL_TRUE);
|
||||
else if (bpmem.blendmode.colorupdate)
|
||||
glColorMask(GL_TRUE,GL_TRUE,GL_TRUE,GL_FALSE);
|
||||
}
|
||||
|
||||
bool SetScissorRect()
|
||||
{
|
||||
int xoff = bpmem.scissorOffset.x*2-342;
|
||||
int yoff = bpmem.scissorOffset.y*2-342;
|
||||
|
||||
RECT rc;
|
||||
rc.left=bpmem.scissorTL.x + xoff - 342;
|
||||
if (rc.left<0) rc.left=0;
|
||||
rc.top=bpmem.scissorTL.y + yoff - 342;
|
||||
if (rc.top<0) rc.top=0;
|
||||
|
||||
rc.right=bpmem.scissorBR.x + xoff - 342 +1;
|
||||
if (rc.right>640) rc.right=640;
|
||||
rc.bottom=bpmem.scissorBR.y + yoff - 342 +1;
|
||||
if (rc.bottom>480) rc.bottom=480;
|
||||
|
||||
PRIM_LOG("scissor: lt=(%d,%d),rb=(%d,%d),off=(%d,%d)\n", rc.left, rc.top, rc.right, rc.bottom, xoff, yoff);
|
||||
|
||||
if( rc.right>=rc.left && rc.bottom>=rc.top ) {
|
||||
glScissor(rc.left<<g_AAx, Renderer::GetTargetHeight()-(rc.bottom<<g_AAy), (rc.right-rc.left)<<g_AAx, (rc.bottom-rc.top)<<g_AAy);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void LoadBPReg(u32 value0)
|
||||
{
|
||||
DVSTARTPROFILE();
|
||||
|
||||
//handle the mask register
|
||||
int opcode = value0 >> 24;
|
||||
int oldval = ((u32*)&bpmem)[opcode];
|
||||
int newval = (((u32*)&bpmem)[opcode] & ~bpmem.bpMask) | (value0 & bpmem.bpMask);
|
||||
int changes = (oldval ^ newval) & 0xFFFFFF;
|
||||
//reset the mask register
|
||||
if (opcode != 0xFE)
|
||||
bpmem.bpMask = 0xFFFFFF;
|
||||
|
||||
switch (opcode)
|
||||
{
|
||||
case 0x45: //GXSetDrawDone
|
||||
VertexManager::Flush();
|
||||
switch (value0 & 0xFF)
|
||||
{
|
||||
case 0x02:
|
||||
g_VideoInitialize.pSetPEFinish(); // may generate interrupt
|
||||
DebugLog("GXSetDrawDone SetPEFinish (value: 0x%02X)", (value0 & 0xFFFF));
|
||||
break;
|
||||
|
||||
default:
|
||||
DebugLog("GXSetDrawDone ??? (value 0x%02X)", (value0 & 0xFFFF));
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case BPMEM_PE_TOKEN_ID:
|
||||
g_VideoInitialize.pSetPEToken(static_cast<WORD>(value0 & 0xFFFF), FALSE);
|
||||
DebugLog("SetPEToken 0x%04x", (value0 & 0xFFFF));
|
||||
break;
|
||||
|
||||
case BPMEM_PE_TOKEN_INT_ID:
|
||||
g_VideoInitialize.pSetPEToken(static_cast<WORD>(value0 & 0xFFFF), TRUE);
|
||||
DebugLog("SetPEToken + INT 0x%04x", (value0 & 0xFFFF));
|
||||
break;
|
||||
|
||||
case 0x67: // set gp metric?
|
||||
break;
|
||||
|
||||
case 0x52:
|
||||
{
|
||||
DVProfileFunc _pf("LoadBPReg:swap");
|
||||
VertexManager::Flush();
|
||||
|
||||
((u32*)&bpmem)[opcode] = newval;
|
||||
TRectangle rc = {
|
||||
(int)(bpmem.copyTexSrcXY.x),
|
||||
(int)(bpmem.copyTexSrcXY.y),
|
||||
(int)((bpmem.copyTexSrcXY.x+bpmem.copyTexSrcWH.x)),
|
||||
(int)((bpmem.copyTexSrcXY.y+bpmem.copyTexSrcWH.y))
|
||||
};
|
||||
|
||||
UPE_Copy PE_copy;
|
||||
PE_copy.Hex = bpmem.triggerEFBCopy;
|
||||
|
||||
if (PE_copy.copy_to_xfb == 0) {
|
||||
// EFB to texture
|
||||
// for some reason it sets bpmem.zcontrol.pixel_format to PIXELFMT_Z24 every time a zbuffer format is given as a dest to GXSetTexCopyDst
|
||||
TextureMngr::CopyRenderTargetToTexture(bpmem.copyTexDest<<5, bpmem.zcontrol.pixel_format==PIXELFMT_Z24, PE_copy.intensity_fmt>0,
|
||||
(PE_copy.target_pixel_format/2)+((PE_copy.target_pixel_format&1)*8), PE_copy.half_scale>0, &rc);
|
||||
}
|
||||
else {
|
||||
// EFB to XFB
|
||||
Renderer::Swap(rc);
|
||||
g_VideoInitialize.pCopiedToXFB();
|
||||
}
|
||||
|
||||
// clearing
|
||||
if (PE_copy.clear) {
|
||||
// clear color
|
||||
Renderer::SetRenderMode(Renderer::RM_Normal);
|
||||
|
||||
u32 nRestoreZBufferTarget = Renderer::GetZBufferTarget();
|
||||
|
||||
glViewport(0, 0, Renderer::GetTargetWidth()<<g_AAx, Renderer::GetTargetHeight()<<g_AAy);
|
||||
// if copied to texture, set the dimensions to the source copy dims, otherwise, clear the entire buffer
|
||||
if( PE_copy.copy_to_xfb == 0 )
|
||||
glScissor(rc.left<<g_AAx, (Renderer::GetTargetHeight()-rc.bottom)<<g_AAy, (rc.right-rc.left)<<g_AAx, (rc.bottom-rc.top)<<g_AAy);
|
||||
VertexShaderMngr::SetViewportChanged();
|
||||
|
||||
// since clear operations use the source rectangle, have to do regular renders (glClear clears the entire buffer)
|
||||
if( bpmem.blendmode.colorupdate || bpmem.blendmode.alphaupdate || bpmem.zmode.updateenable ) {
|
||||
|
||||
GLbitfield bits = 0;
|
||||
if( bpmem.blendmode.colorupdate || bpmem.blendmode.alphaupdate ) {
|
||||
u32 clearColor = (bpmem.clearcolorAR<<16)|bpmem.clearcolorGB;
|
||||
glClearColor(((clearColor>>16)&0xff)*(1/255.0f),((clearColor>>8)&0xff)*(1/255.0f),
|
||||
((clearColor>>0)&0xff)*(1/255.0f),((clearColor>>24)&0xff)*(1/255.0f));
|
||||
bits |= GL_COLOR_BUFFER_BIT;
|
||||
}
|
||||
|
||||
if( bpmem.zmode.updateenable ) {
|
||||
glClearDepth((float)(bpmem.clearZValue&0xFFFFFF) / float(0xFFFFFF));
|
||||
bits |= GL_DEPTH_BUFFER_BIT;
|
||||
}
|
||||
|
||||
if( nRestoreZBufferTarget )
|
||||
glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT); // don't clear ztarget here
|
||||
|
||||
glClear(bits);
|
||||
}
|
||||
|
||||
if (bpmem.zmode.updateenable && nRestoreZBufferTarget ) { // have to clear the target zbuffer
|
||||
|
||||
glDrawBuffer(GL_COLOR_ATTACHMENT1_EXT);
|
||||
GL_REPORT_ERRORD();
|
||||
|
||||
glColorMask(GL_TRUE,GL_TRUE,GL_TRUE,GL_TRUE);
|
||||
|
||||
// red should probably be the LSB
|
||||
glClearColor(((bpmem.clearZValue>>0)&0xff)*(1/255.0f),((bpmem.clearZValue>>8)&0xff)*(1/255.0f),
|
||||
((bpmem.clearZValue>>16)&0xff)*(1/255.0f), 0);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
SetColorMask();
|
||||
GL_REPORT_ERRORD();
|
||||
}
|
||||
|
||||
if( nRestoreZBufferTarget ) {
|
||||
// restore target
|
||||
GLenum s_drawbuffers[2] = {GL_COLOR_ATTACHMENT0_EXT, GL_COLOR_ATTACHMENT1_EXT};
|
||||
glDrawBuffers(2, s_drawbuffers);
|
||||
}
|
||||
|
||||
if( PE_copy.copy_to_xfb == 0 )
|
||||
SetScissorRect(); // reset the scissor rect
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 0x65: //GXLoadTlut
|
||||
{
|
||||
DVProfileFunc _pf("LoadBPReg:GXLoadTlut");
|
||||
VertexManager::Flush();
|
||||
((u32*)&bpmem)[opcode] = newval;
|
||||
|
||||
u32 tlutTMemAddr = (value0&0x3FF)<<9;
|
||||
u32 tlutXferCount = (value0&0x1FFC00)>>5;
|
||||
//do the transfer!!
|
||||
memcpy_gc(texMem + tlutTMemAddr, g_VideoInitialize.pGetMemoryPointer((bpmem.tlutXferSrc&0xFFFFF)<<5), tlutXferCount);
|
||||
// TODO(ector) : kill all textures that use this palette
|
||||
// Not sure if it's a good idea, though. For now, we hash texture palettes
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
//notify the video handling so it can update render states
|
||||
BPWritten(opcode, changes, newval);
|
||||
//((u32*)&bpmem)[opcode] = newval;
|
||||
}
|
||||
|
||||
void BPReload()
|
||||
{
|
||||
for (int i=0; i<254; i++)
|
||||
BPWritten(i, 0xFFFFFF, ((u32*)&bpmem)[i]);
|
||||
}
|
||||
|
||||
|
||||
size_t BPSaveLoadState(char *ptr, BOOL save)
|
||||
{
|
||||
BEGINSAVELOAD;
|
||||
SAVELOAD(&bpmem,sizeof(BPMemory));
|
||||
if (!save)
|
||||
BPReload();
|
||||
//char temp[256];
|
||||
//sprintf(temp,"MOJS %08x",(bpmem.clearcolorAR<<16)|(bpmem.clearcolorGB));
|
||||
//g_VideoInitialize.pLog(temp, FALSE);
|
||||
ENDSAVELOAD;
|
||||
}
|
||||
@@ -0,0 +1,787 @@
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#ifndef _BPSTRUCTS_H
|
||||
#define _BPSTRUCTS_H
|
||||
|
||||
#pragma pack(4)
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Tev/combiner things
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
#define TEVOP_ADD 0
|
||||
#define TEVOP_SUB 1
|
||||
#define TEVCMP_R8_GT 8
|
||||
#define TEVCMP_R8_EQ 9
|
||||
#define TEVCMP_GR16_GT 10
|
||||
#define TEVCMP_GR16_EQ 11
|
||||
#define TEVCMP_BGR24_GT 12
|
||||
#define TEVCMP_BGR24_EQ 13
|
||||
#define TEVCMP_RGB8_GT 14
|
||||
#define TEVCMP_RGB8_EQ 15
|
||||
#define TEVCMP_A8_GT 14
|
||||
#define TEVCMP_A8_EQ 15
|
||||
|
||||
#define TEVCOLORARG_CPREV 0
|
||||
#define TEVCOLORARG_APREV 1
|
||||
#define TEVCOLORARG_C0 2
|
||||
#define TEVCOLORARG_A0 3
|
||||
#define TEVCOLORARG_C1 4
|
||||
#define TEVCOLORARG_A1 5
|
||||
#define TEVCOLORARG_C2 6
|
||||
#define TEVCOLORARG_A2 7
|
||||
#define TEVCOLORARG_TEXC 8
|
||||
#define TEVCOLORARG_TEXA 9
|
||||
#define TEVCOLORARG_RASC 10
|
||||
#define TEVCOLORARG_RASA 11
|
||||
#define TEVCOLORARG_ONE 12
|
||||
#define TEVCOLORARG_HALF 13
|
||||
#define TEVCOLORARG_KONST 14
|
||||
#define TEVCOLORARG_ZERO 15
|
||||
|
||||
#define TEVALPHAARG_APREV 0
|
||||
#define TEVALPHAARG_A0 1
|
||||
#define TEVALPHAARG_A1 2
|
||||
#define TEVALPHAARG_A2 3
|
||||
#define TEVALPHAARG_TEXA 4
|
||||
#define TEVALPHAARG_RASA 5
|
||||
#define TEVALPHAARG_KONST 6
|
||||
#define TEVALPHAARG_ZERO 7
|
||||
|
||||
#define ALPHACMP_NEVER 0
|
||||
#define ALPHACMP_LESS 1
|
||||
#define ALPHACMP_EQUAL 2
|
||||
#define ALPHACMP_LEQUAL 3
|
||||
#define ALPHACMP_GREATER 4
|
||||
#define ALPHACMP_NEQUAL 5
|
||||
#define ALPHACMP_GEQUAL 6
|
||||
#define ALPHACMP_ALWAYS 7
|
||||
|
||||
#define ZTEXTURE_DISABLE 0
|
||||
#define ZTEXTURE_ADD 1
|
||||
#define ZTEXTURE_REPLACE 2
|
||||
|
||||
union IND_MTXA
|
||||
{
|
||||
struct
|
||||
{
|
||||
signed ma : 11;
|
||||
signed mb : 11;
|
||||
unsigned s0 : 2; // bits 0-1 of scale factor
|
||||
unsigned rid : 8;
|
||||
};
|
||||
u32 hex;
|
||||
};
|
||||
|
||||
union IND_MTXB
|
||||
{
|
||||
struct
|
||||
{
|
||||
signed mc : 11;
|
||||
signed md : 11;
|
||||
unsigned s1 : 2; // bits 2-3 of scale factor
|
||||
unsigned rid : 8;
|
||||
};
|
||||
u32 hex;
|
||||
};
|
||||
|
||||
union IND_MTXC
|
||||
{
|
||||
struct
|
||||
{
|
||||
signed me : 11;
|
||||
signed mf : 11;
|
||||
unsigned s2 : 2; // bits 4-5 of scale factor
|
||||
unsigned rid : 8;
|
||||
};
|
||||
u32 hex;
|
||||
};
|
||||
|
||||
struct IND_MTX
|
||||
{
|
||||
IND_MTXA col0;
|
||||
IND_MTXB col1;
|
||||
IND_MTXC col2;
|
||||
};
|
||||
|
||||
union IND_IMASK
|
||||
{
|
||||
struct
|
||||
{
|
||||
unsigned mask : 24;
|
||||
unsigned rid : 8;
|
||||
};
|
||||
u32 hex;
|
||||
};
|
||||
|
||||
#define TEVSELCC_CPREV 0
|
||||
#define TEVSELCC_APREV 1
|
||||
#define TEVSELCC_C0 2
|
||||
#define TEVSELCC_A0 3
|
||||
#define TEVSELCC_C1 4
|
||||
#define TEVSELCC_A1 5
|
||||
#define TEVSELCC_C2 6
|
||||
#define TEVSELCC_A2 7
|
||||
#define TEVSELCC_TEXC 8
|
||||
#define TEVSELCC_TEXA 9
|
||||
#define TEVSELCC_RASC 10
|
||||
#define TEVSELCC_RASA 11
|
||||
#define TEVSELCC_ONE 12
|
||||
#define TEVSELCC_HALF 13
|
||||
#define TEVSELCC_KONST 14
|
||||
#define TEVSELCC_ZERO 15
|
||||
|
||||
#define TEVSELCA_APREV 0
|
||||
#define TEVSELCA_A0 1
|
||||
#define TEVSELCA_A1 2
|
||||
#define TEVSELCA_A2 3
|
||||
#define TEVSELCA_TEXA 4
|
||||
#define TEVSELCA_RASA 5
|
||||
#define TEVSELCA_KONST 6
|
||||
#define TEVSELCA_ZERO 7
|
||||
|
||||
struct TevStageCombiner
|
||||
{
|
||||
union ColorCombiner
|
||||
{
|
||||
struct //abc=8bit,d=10bit
|
||||
{
|
||||
unsigned d : 4; // TEVSELCC_X
|
||||
unsigned c : 4; // TEVSELCC_X
|
||||
unsigned b : 4; // TEVSELCC_X
|
||||
unsigned a : 4; // TEVSELCC_X
|
||||
|
||||
unsigned bias : 2;
|
||||
unsigned op : 1;
|
||||
unsigned clamp : 1;
|
||||
|
||||
unsigned shift : 2;
|
||||
unsigned dest : 2; //1,2,3
|
||||
|
||||
};
|
||||
u32 hex;
|
||||
};
|
||||
union AlphaCombiner
|
||||
{
|
||||
struct
|
||||
{
|
||||
unsigned rswap : 2;
|
||||
unsigned tswap : 2;
|
||||
unsigned d : 3; // TEVSELCA_
|
||||
unsigned c : 3; // TEVSELCA_
|
||||
unsigned b : 3; // TEVSELCA_
|
||||
unsigned a : 3; // TEVSELCA_
|
||||
|
||||
unsigned bias : 2; //GXTevBias
|
||||
unsigned op : 1;
|
||||
unsigned clamp : 1;
|
||||
|
||||
unsigned shift : 2;
|
||||
unsigned dest : 2; //1,2,3
|
||||
};
|
||||
u32 hex;
|
||||
};
|
||||
|
||||
ColorCombiner colorC;
|
||||
AlphaCombiner alphaC;
|
||||
};
|
||||
|
||||
#define ITF_8 0
|
||||
#define ITF_5 1
|
||||
#define ITF_4 2
|
||||
#define ITF_3 3
|
||||
|
||||
#define ITB_NONE 0
|
||||
#define ITB_S 1
|
||||
#define ITB_T 2
|
||||
#define ITB_ST 3
|
||||
#define ITB_U 4
|
||||
#define ITB_SU 5
|
||||
#define ITB_TU 6
|
||||
#define ITB_STU 7
|
||||
|
||||
#define ITBA_OFF 0
|
||||
#define ITBA_S 1
|
||||
#define ITBA_T 2
|
||||
#define ITBA_U 3
|
||||
|
||||
#define ITW_OFF 0
|
||||
#define ITW_256 1
|
||||
#define ITW_128 2
|
||||
#define ITW_64 3
|
||||
#define ITW_32 4
|
||||
#define ITW_16 5
|
||||
#define ITW_0 6
|
||||
|
||||
// several discoveries:
|
||||
// GXSetTevIndBumpST(tevstage, indstage, matrixind)
|
||||
// if( matrix == 2 ) realmat = 6; // 10
|
||||
// else if( matrix == 3 ) realmat = 7; // 11
|
||||
// else if( matrix == 1 ) realmat = 5; // 9
|
||||
// GXSetTevIndirect(tevstage, indstage, 0, 3, realmat, 6, 6, 0, 0, 0)
|
||||
// GXSetTevIndirect(tevstage+1, indstage, 0, 3, realmat+4, 6, 6, 1, 0, 0)
|
||||
// GXSetTevIndirect(tevstage+2, indstage, 0, 0, 0, 0, 0, 1, 0, 0)
|
||||
|
||||
union TevStageIndirect
|
||||
{
|
||||
// if mid, sw, tw, and addprev are 0, then no indirect stage is used, mask = 0x17fe00
|
||||
struct
|
||||
{
|
||||
unsigned bt : 2; // indirect tex stage ID
|
||||
unsigned fmt : 2; // format: ITF_X
|
||||
unsigned bias : 3; // ITB_X
|
||||
unsigned bs : 2; // ITBA_X, indicates which coordinate will become the 'bump alpha'
|
||||
unsigned mid : 4; // matrix id to multiply offsets with
|
||||
unsigned sw : 3; // ITW_X, wrapping factor for S of regular coord
|
||||
unsigned tw : 3; // ITW_X, wrapping factor for T of regular coord
|
||||
unsigned lb_utclod : 1; // use modified or unmodified texture coordinates for LOD computation
|
||||
unsigned fb_addprev : 1; // 1 if the texture coordinate results from the previous TEV stage should be added
|
||||
unsigned pad0 : 3;
|
||||
unsigned rid : 8;
|
||||
};
|
||||
struct
|
||||
{
|
||||
u32 hex : 21;
|
||||
u32 unused : 11;
|
||||
};
|
||||
|
||||
bool IsActive() { return (hex&0x17fe00)!=0; }
|
||||
};
|
||||
|
||||
union TwoTevStageOrders
|
||||
{
|
||||
struct
|
||||
{
|
||||
unsigned texmap0 : 3; // indirect tex stage texmap
|
||||
unsigned texcoord0 : 3;
|
||||
unsigned enable0 : 1; // 1 if should read from texture
|
||||
unsigned colorchan0 : 3; // RAS1_CC_X
|
||||
|
||||
unsigned pad0 : 2;
|
||||
|
||||
unsigned texmap1 : 3;
|
||||
unsigned texcoord1 : 3;
|
||||
unsigned enable1 : 1; // 1 if should read from texture
|
||||
unsigned colorchan1 : 3; // RAS1_CC_X
|
||||
|
||||
unsigned pad1 : 2;
|
||||
unsigned rid : 8;
|
||||
};
|
||||
u32 hex;
|
||||
int getTexMap(int i){return i?texmap1:texmap0;}
|
||||
int getTexCoord(int i){return i?texcoord1:texcoord0;}
|
||||
int getEnable(int i){return i?enable1:enable0;}
|
||||
int getColorChan(int i){return i?colorchan1:colorchan0;}
|
||||
};
|
||||
|
||||
union TEXSCALE
|
||||
{
|
||||
struct
|
||||
{
|
||||
unsigned ss0 : 4; // indirect tex stage 0, 2^(-ss0)
|
||||
unsigned ts0 : 4; // indirect tex stage 0
|
||||
unsigned ss1 : 4; // indirect tex stage 1
|
||||
unsigned ts1 : 4; // indirect tex stage 1
|
||||
unsigned pad : 8;
|
||||
unsigned rid : 8;
|
||||
};
|
||||
u32 hex;
|
||||
|
||||
float getScaleS(int i){return 1.0f/(float)(1<<(i?ss1:ss0));}
|
||||
float getScaleT(int i){return 1.0f/(float)(1<<(i?ts1:ts0));}
|
||||
};
|
||||
|
||||
union RAS1_IREF
|
||||
{
|
||||
struct
|
||||
{
|
||||
unsigned bi0 : 3; // indirect tex stage 0 ntexmap
|
||||
unsigned bc0 : 3; // indirect tex stage 0 ntexcoord
|
||||
unsigned bi1 : 3;
|
||||
unsigned bc1 : 3;
|
||||
unsigned bi2 : 3;
|
||||
unsigned bc3 : 3;
|
||||
unsigned bi4 : 3;
|
||||
unsigned bc4 : 3;
|
||||
unsigned rid : 8;
|
||||
};
|
||||
u32 hex;
|
||||
|
||||
u32 getTexCoord(int i) { return (hex>>(6*i+3))&3; }
|
||||
u32 getTexMap(int i) { return (hex>>(6*i))&3; }
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Texture structs
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
union TexMode0
|
||||
{
|
||||
struct
|
||||
{
|
||||
unsigned wrap_s : 2;
|
||||
unsigned wrap_t : 2;
|
||||
unsigned mag_filter : 1;
|
||||
unsigned min_filter : 3;
|
||||
unsigned diag_lod : 1;
|
||||
signed lod_bias : 10;
|
||||
unsigned max_aniso : 2;
|
||||
unsigned lod_clamp : 1;
|
||||
};
|
||||
u32 hex;
|
||||
};
|
||||
union TexMode1
|
||||
{
|
||||
struct
|
||||
{
|
||||
unsigned min_lod : 8;
|
||||
unsigned max_lod : 8;
|
||||
};
|
||||
u32 hex;
|
||||
};
|
||||
union TexImage0
|
||||
{
|
||||
struct
|
||||
{
|
||||
unsigned width : 10; //actually w-1
|
||||
unsigned height : 10; //actually h-1
|
||||
unsigned format : 4;
|
||||
};
|
||||
u32 hex;
|
||||
};
|
||||
union TexImage1
|
||||
{
|
||||
struct
|
||||
{
|
||||
unsigned tmem_offset : 15; // we ignore texture caching for now, we do it ourselves
|
||||
unsigned cache_width : 3;
|
||||
unsigned cache_height : 3;
|
||||
unsigned image_type : 1;
|
||||
};
|
||||
u32 hex;
|
||||
};
|
||||
|
||||
union TexImage2
|
||||
{
|
||||
struct
|
||||
{
|
||||
unsigned tmem_offset : 15; // we ignore texture caching for now, we do it ourselves
|
||||
unsigned cache_width : 3;
|
||||
unsigned cache_height : 3;
|
||||
};
|
||||
u32 hex;
|
||||
};
|
||||
|
||||
union TexImage3
|
||||
{
|
||||
struct
|
||||
{
|
||||
unsigned image_base: 24; //address in memory >> 5 (was 20 for GC)
|
||||
};
|
||||
u32 hex;
|
||||
};
|
||||
union TexTLUT
|
||||
{
|
||||
struct
|
||||
{
|
||||
unsigned tmem_offset : 10;
|
||||
unsigned tlut_format : 2;
|
||||
};
|
||||
u32 hex;
|
||||
};
|
||||
|
||||
union ZTex1
|
||||
{
|
||||
struct
|
||||
{
|
||||
unsigned bias : 24;
|
||||
};
|
||||
u32 hex;
|
||||
};
|
||||
|
||||
union ZTex2
|
||||
{
|
||||
struct
|
||||
{
|
||||
unsigned type : 2; // TEV_Z_TYPE_X
|
||||
unsigned op : 2; // GXZTexOp
|
||||
};
|
||||
u32 hex;
|
||||
};
|
||||
|
||||
// Z-texture types (formats)
|
||||
#define TEV_ZTEX_TYPE_U8 0
|
||||
#define TEV_ZTEX_TYPE_U16 1
|
||||
#define TEV_ZTEX_TYPE_U24 2
|
||||
|
||||
#define TEV_ZTEX_DISABLE 0
|
||||
#define TEV_ZTEX_ADD 1
|
||||
#define TEV_ZTEX_REPLACE 2
|
||||
|
||||
|
||||
struct FourTexUnits
|
||||
{
|
||||
TexMode0 texMode0[4];
|
||||
TexMode1 texMode1[4];
|
||||
TexImage0 texImage0[4];
|
||||
TexImage1 texImage1[4];
|
||||
TexImage2 texImage2[4];
|
||||
TexImage3 texImage3[4];
|
||||
TexTLUT texTlut[4];
|
||||
u32 unknown[4];
|
||||
};
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Geometry/other structs
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
union GenMode
|
||||
{
|
||||
struct
|
||||
{
|
||||
unsigned numtexgens : 4; // 0xF
|
||||
unsigned numcolchans : 5; // 0x1E0
|
||||
unsigned ms_en : 1; // 0x200
|
||||
unsigned numtevstages : 4; // 0x3C00
|
||||
unsigned cullmode : 2; // 0xC000
|
||||
unsigned numindstages : 3; // 0x30000
|
||||
unsigned zfreeze : 5; //0x3C0000
|
||||
};
|
||||
u32 hex;
|
||||
};
|
||||
|
||||
union LPSize
|
||||
{
|
||||
struct
|
||||
{
|
||||
unsigned linesize : 8; // in 1/6th pixels
|
||||
unsigned pointsize : 8; // in 1/6th pixels
|
||||
unsigned lineoff : 3;
|
||||
unsigned pointoff : 3;
|
||||
unsigned lineaspect : 1;
|
||||
unsigned padding : 1;
|
||||
};
|
||||
u32 hex;
|
||||
};
|
||||
|
||||
|
||||
union X12Y12
|
||||
{
|
||||
struct
|
||||
{
|
||||
unsigned y : 12;
|
||||
unsigned x : 12;
|
||||
};
|
||||
u32 hex;
|
||||
};
|
||||
union X10Y10
|
||||
{
|
||||
struct
|
||||
{
|
||||
unsigned x : 10;
|
||||
unsigned y : 10;
|
||||
};
|
||||
u32 hex;
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Framebuffer/pixel stuff (incl fog)
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
union BlendMode
|
||||
{
|
||||
struct
|
||||
{
|
||||
unsigned blendenable : 1;
|
||||
unsigned logicopenable : 1;
|
||||
unsigned dither : 1;
|
||||
unsigned colorupdate : 1;
|
||||
unsigned alphaupdate : 1;
|
||||
unsigned dstfactor : 3; //BLEND_ONE, BLEND_INV_SRc etc
|
||||
unsigned srcfactor : 3;
|
||||
unsigned subtract : 1;
|
||||
unsigned logicmode : 4;
|
||||
};
|
||||
u32 hex;
|
||||
};
|
||||
|
||||
|
||||
union FogParam0
|
||||
{
|
||||
struct
|
||||
{
|
||||
unsigned mantissa : 11;
|
||||
unsigned exponent : 8;
|
||||
unsigned sign : 1;
|
||||
};
|
||||
|
||||
float GetA() {
|
||||
union { u32 i; float f; } dummy;
|
||||
dummy.i = ((u32)sign<<31)|((u32)exponent<<23)|((u32)mantissa<<12);
|
||||
return dummy.f;
|
||||
}
|
||||
|
||||
u32 hex;
|
||||
};
|
||||
|
||||
union FogParam3
|
||||
{
|
||||
struct
|
||||
{
|
||||
unsigned c_mant : 11;
|
||||
unsigned c_exp : 8;
|
||||
unsigned c_sign : 1;
|
||||
unsigned proj : 1; // 0 - perspective, 1 - orthographic
|
||||
unsigned fsel : 3; // 0 - off, 2 - linear, 4 - exp, 5 - exp2, 6 - backward exp, 7 - backward exp2
|
||||
};
|
||||
|
||||
// amount to subtract from eyespacez after range adjustment
|
||||
float GetC() {
|
||||
union { u32 i; float f; } dummy;
|
||||
dummy.i = ((u32)c_sign << 31) | ((u32)c_exp << 23) | ((u32)c_mant << 12);
|
||||
return dummy.f;
|
||||
}
|
||||
|
||||
u32 hex;
|
||||
};
|
||||
|
||||
// final eq: ze = A/(B_MAG - (Zs>>B_SHF));
|
||||
struct FogParams
|
||||
{
|
||||
FogParam0 a;
|
||||
u32 b_magnitude;
|
||||
u32 b_shift; // b's exp + 1?
|
||||
FogParam3 c_proj_fsel;
|
||||
u32 color; //0:b 8:g 16:r - nice!
|
||||
};
|
||||
|
||||
union ZMode
|
||||
{
|
||||
struct
|
||||
{
|
||||
unsigned testenable : 1;
|
||||
unsigned func : 3;
|
||||
unsigned updateenable : 1; //size?
|
||||
};
|
||||
u32 hex;
|
||||
};
|
||||
|
||||
union ConstantAlpha
|
||||
{
|
||||
struct
|
||||
{
|
||||
unsigned alpha : 8;
|
||||
unsigned enable : 1;
|
||||
};
|
||||
u32 hex;
|
||||
};
|
||||
|
||||
#define PIXELFMT_RGB8_Z24 0
|
||||
#define PIXELFMT_RGBA6_Z24 1
|
||||
#define PIXELFMT_RGB565_Z16 2
|
||||
#define PIXELFMT_Z24 3
|
||||
#define PIXELFMT_Y8 4
|
||||
#define PIXELFMT_U8 5
|
||||
#define PIXELFMT_V8 6
|
||||
#define PIXELFMT_YUV420 7
|
||||
|
||||
union PE_CONTROL
|
||||
{
|
||||
struct
|
||||
{
|
||||
unsigned pixel_format : 3; // PIXELFMT_X
|
||||
unsigned zformat : 3; // 0 - linear, 1 - near, 2 - mid, 3 - far
|
||||
unsigned zcomploc : 1; // 1: before tex stage
|
||||
unsigned unused : 17;
|
||||
unsigned rid : 8;
|
||||
};
|
||||
u32 hex;
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Texture coordinate stuff
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
union TCInfo
|
||||
{
|
||||
struct
|
||||
{
|
||||
unsigned scale_minus_1 : 16;
|
||||
unsigned range_bias : 1;
|
||||
unsigned cylindric_wrap : 1;
|
||||
};
|
||||
u32 hex;
|
||||
};
|
||||
struct TCoordInfo
|
||||
{
|
||||
TCInfo s;
|
||||
TCInfo t;
|
||||
};
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// All of BP memory
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
union ColReg
|
||||
{
|
||||
u32 hex;
|
||||
struct
|
||||
{
|
||||
signed a : 11;
|
||||
unsigned : 1;
|
||||
signed b : 11;
|
||||
unsigned type : 1;
|
||||
};
|
||||
};
|
||||
|
||||
struct TevReg
|
||||
{
|
||||
ColReg low;
|
||||
ColReg high;
|
||||
};
|
||||
|
||||
union TevKSel
|
||||
{
|
||||
struct {
|
||||
unsigned swap1 : 2;
|
||||
unsigned swap2 : 2;
|
||||
unsigned kcsel0 : 5;
|
||||
unsigned kasel0 : 5;
|
||||
unsigned kcsel1 : 5;
|
||||
unsigned kasel1 : 5;
|
||||
};
|
||||
u32 hex;
|
||||
|
||||
int getKC(int i) {return i?kcsel1:kcsel0;}
|
||||
int getKA(int i) {return i?kasel1:kasel0;}
|
||||
};
|
||||
|
||||
union AlphaFunc
|
||||
{
|
||||
struct
|
||||
{
|
||||
unsigned ref0 : 8;
|
||||
unsigned ref1 : 8;
|
||||
unsigned comp0 : 3;
|
||||
unsigned comp1 : 3;
|
||||
unsigned logic : 2;
|
||||
};
|
||||
u32 hex;
|
||||
};
|
||||
|
||||
union UPE_Copy
|
||||
{
|
||||
u32 Hex;
|
||||
struct
|
||||
{
|
||||
unsigned clamp0 : 1;
|
||||
unsigned clamp1 : 1;
|
||||
unsigned : 1;
|
||||
unsigned target_pixel_format : 4; // realformat is (fmt/2)+((fmt&1)*8).... for some reason the msb is the lsb
|
||||
unsigned gamma : 2;
|
||||
unsigned half_scale : 1; // real size should be 2x smaller (run a gauss filter?)
|
||||
unsigned scale_something : 1;
|
||||
unsigned clear : 1;
|
||||
unsigned frame_to_field : 2;
|
||||
unsigned copy_to_xfb : 1;
|
||||
unsigned intensity_fmt : 1; // if set, is an intensity format (I4,I8,IA4,IA8)
|
||||
unsigned : 16; // seems to set everything to 1s when target pixel format is invalid
|
||||
};
|
||||
};
|
||||
|
||||
struct BPMemory
|
||||
{
|
||||
GenMode genMode;
|
||||
u32 display_copy_filter[4]; //01-04
|
||||
u32 unknown; //05
|
||||
// indirect matrices (set by GXSetIndTexMtx, selected by TevStageIndirect::mid)
|
||||
// abc form a 2x3 offset matrix, there's 3 such matrices
|
||||
// the 3 offset matrices can either be indirect type, S-type, or T-type
|
||||
// 6bit scale factor s is distributed across IND_MTXA/B/C.
|
||||
// before using matrices scale by 2^-(s-17)
|
||||
IND_MTX indmtx[3];//06-0e GXSetIndTexMtx, 2x3 matrices
|
||||
IND_IMASK imask;//0f
|
||||
TevStageIndirect tevind[16];//10 GXSetTevIndirect
|
||||
X12Y12 scissorTL; //20
|
||||
X12Y12 scissorBR; //21
|
||||
LPSize lineptwidth; //22 line and point width
|
||||
u32 sucounter; //23
|
||||
u32 rascounter; //24
|
||||
TEXSCALE texscale[2]; //25-26 GXSetIndTexCoordScale
|
||||
RAS1_IREF tevindref; //27 GXSetIndTexOrder
|
||||
TwoTevStageOrders tevorders[8]; //28-2F
|
||||
TCoordInfo texcoords[8]; //0x30 s,t,s,t,s,t,s,t...
|
||||
ZMode zmode; //40
|
||||
BlendMode blendmode; //41
|
||||
ConstantAlpha dstalpha; //42
|
||||
PE_CONTROL zcontrol; //43 GXSetZCompLoc, GXPixModeSync
|
||||
u32 fieldmask; //44
|
||||
u32 drawdone; //45, bit1=1 if end of list
|
||||
u32 unknown5; //46 clock?
|
||||
u32 petoken; //47
|
||||
u32 petokenint; //48
|
||||
X10Y10 copyTexSrcXY; //49
|
||||
X10Y10 copyTexSrcWH; //4a
|
||||
u32 copyTexDest; //4b// 4b == CopyAddress (GXDispCopy and GXTexCopy use it)
|
||||
u32 unknown6; //4c
|
||||
u32 copyMipMapStrideChannels; // 4d usually set to 4 when dest is single channel, 8 when dest is 2 channel, 16 when dest is RGBA
|
||||
// also, doubles whenever mipmap box filter option is set (excent on RGBA). Probably to do with number of bytes to look at when smoothing
|
||||
u32 dispcopyyscale; //4e
|
||||
u32 clearcolorAR; //4f
|
||||
u32 clearcolorGB; //50
|
||||
u32 clearZValue; //51
|
||||
u32 triggerEFBCopy; //52
|
||||
u32 copyfilter[2]; //53,54
|
||||
u32 boundbox0;//55
|
||||
u32 boundbox1;//56
|
||||
u32 unknown7[2];//57,58
|
||||
X10Y10 scissorOffset; //59
|
||||
u32 unknown8[10]; //5a,5b,5c,5d, 5e,5f,60,61, 62, 63 (GXTexModeSync), 0x60-0x63 have to do with preloaded textures?
|
||||
u32 tlutXferSrc; //64
|
||||
u32 tlutXferDest; //65
|
||||
u32 texinvalidate;//66
|
||||
u32 metric; //67
|
||||
u32 fieldmode;//68
|
||||
u32 unknown10[7];//69-6F
|
||||
u32 unknown11[16];//70-7F
|
||||
FourTexUnits tex[2]; //80-bf
|
||||
TevStageCombiner combiners[16]; //0xC0-0xDF
|
||||
TevReg tevregs[4]; //0xE0
|
||||
u32 fogRangeAdj; //0xE8
|
||||
u32 unknown15[3]; //0xe9,0xea,0xeb - fog related
|
||||
u32 tev_range_adj_c; //0xec - screenx center for range adjustment, range adjustment enable
|
||||
u32 tev_range_adj_k; //0xed - specifies range adjustment function = sqrt(x*x+k*k)/k
|
||||
FogParams fog; //0xEE,0xEF,0xF0,0xF1,0xF2
|
||||
AlphaFunc alphaFunc; //0xF3
|
||||
ZTex1 ztex1; //0xf4,0xf5
|
||||
ZTex2 ztex2;
|
||||
TevKSel tevksel[8];//0xf6,0xf7,f8,f9,fa,fb,fc,fd
|
||||
u32 bpMask; //0xFE
|
||||
u32 unknown18; //ff
|
||||
};
|
||||
|
||||
void BPInit();
|
||||
size_t BPSaveLoadState(char *ptr, BOOL save);
|
||||
//bool BPWritten(int addr, int changes);
|
||||
void LoadBPReg(u32 value0);
|
||||
|
||||
void SetColorMask();
|
||||
bool SetScissorRect();
|
||||
|
||||
extern BPMemory bpmem;
|
||||
|
||||
#pragma pack()
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,96 @@
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include "Globals.h"
|
||||
#include "DataReader.h"
|
||||
|
||||
// =================================================================================================
|
||||
// CDataReader_Fifo
|
||||
// =================================================================================================
|
||||
|
||||
IDataReader* g_pDataReader = NULL;
|
||||
extern u8 FAKE_ReadFifo8();
|
||||
extern u16 FAKE_ReadFifo16();
|
||||
extern u32 FAKE_ReadFifo32();
|
||||
extern void FAKE_SkipFifo(u32 skip);
|
||||
|
||||
CDataReader_Fifo::CDataReader_Fifo(void)
|
||||
{
|
||||
m_szName = "CDataReader_Fifo";
|
||||
}
|
||||
|
||||
u8 CDataReader_Fifo::Read8(void)
|
||||
{
|
||||
return FAKE_ReadFifo8();
|
||||
};
|
||||
|
||||
u16 CDataReader_Fifo::Read16(void)
|
||||
{
|
||||
return FAKE_ReadFifo16();
|
||||
};
|
||||
|
||||
u32 CDataReader_Fifo::Read32(void)
|
||||
{
|
||||
return FAKE_ReadFifo32();
|
||||
};
|
||||
|
||||
void CDataReader_Fifo::Skip(u32 skip)
|
||||
{
|
||||
return FAKE_SkipFifo(skip);
|
||||
}
|
||||
|
||||
// =================================================================================================
|
||||
// CDataReader_Memory
|
||||
// =================================================================================================
|
||||
|
||||
CDataReader_Memory::CDataReader_Memory(u32 _uAddress) :
|
||||
m_uReadAddress(_uAddress)
|
||||
{
|
||||
//m_pMemory = g_VideoInitialize.pGetMemoryPointer(0x00);
|
||||
m_szName = "CDataReader_Memory";
|
||||
}
|
||||
|
||||
u32 CDataReader_Memory::GetReadAddress(void)
|
||||
{
|
||||
return m_uReadAddress;
|
||||
}
|
||||
|
||||
u8 CDataReader_Memory::Read8(void)
|
||||
{
|
||||
u8 tmp = Memory_Read_U8(m_uReadAddress);//m_pMemory[m_uReadAddress];
|
||||
m_uReadAddress++;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
u16 CDataReader_Memory::Read16(void)
|
||||
{
|
||||
u16 tmp = Memory_Read_U16(m_uReadAddress);//_byteswap_ushort(*(u16*)&m_pMemory[m_uReadAddress]);
|
||||
m_uReadAddress += 2;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
u32 CDataReader_Memory::Read32(void)
|
||||
{
|
||||
u32 tmp = Memory_Read_U32(m_uReadAddress);//_byteswap_ulong(*(u32*)&m_pMemory[m_uReadAddress]);
|
||||
m_uReadAddress += 4;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
void CDataReader_Memory::Skip(u32 skip)
|
||||
{
|
||||
m_uReadAddress += skip;
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#ifndef _DATAREADER_H
|
||||
#define _DATAREADER_H
|
||||
|
||||
// =================================================================================================
|
||||
// IDataReader
|
||||
// =================================================================================================
|
||||
|
||||
class IDataReader
|
||||
{
|
||||
protected:
|
||||
const char *m_szName;
|
||||
|
||||
public:
|
||||
virtual void Skip(u32) = 0;
|
||||
virtual u8 Read8 (void) = 0;
|
||||
virtual u16 Read16(void) = 0;
|
||||
virtual u32 Read32(void) = 0;
|
||||
};
|
||||
|
||||
// =================================================================================================
|
||||
// CDataReader_Fifo
|
||||
// =================================================================================================
|
||||
|
||||
class CDataReader_Fifo : public IDataReader
|
||||
{
|
||||
private:
|
||||
|
||||
public:
|
||||
CDataReader_Fifo(void);
|
||||
|
||||
virtual void Skip(u32);
|
||||
virtual u8 Read8(void);
|
||||
virtual u16 Read16(void);
|
||||
virtual u32 Read32(void);
|
||||
};
|
||||
|
||||
// =================================================================================================
|
||||
// CDataReader_Memory
|
||||
// =================================================================================================
|
||||
|
||||
class CDataReader_Memory : public IDataReader
|
||||
{
|
||||
private:
|
||||
|
||||
//u8* m_pMemory;
|
||||
u32 m_uReadAddress;
|
||||
|
||||
public:
|
||||
|
||||
CDataReader_Memory(u32 _uAddress);
|
||||
|
||||
u32 GetReadAddress(void);
|
||||
|
||||
virtual void Skip(u32);
|
||||
virtual u8 Read8(void);
|
||||
virtual u16 Read16(void);
|
||||
virtual u32 Read32(void);
|
||||
};
|
||||
|
||||
extern IDataReader* g_pDataReader;
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,170 @@
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "Common.h"
|
||||
#include "Globals.h"
|
||||
#include "MemoryUtil.h"
|
||||
#include "Fifo.h"
|
||||
#include "Thread.h"
|
||||
#include "OpcodeDecoding.h"
|
||||
|
||||
#define FIFO_SIZE (1024*1024)
|
||||
|
||||
FifoReader fifo;
|
||||
static u8 *videoBuffer;
|
||||
|
||||
int size = 0;
|
||||
int readptr = 0;
|
||||
|
||||
void Fifo_Init()
|
||||
{
|
||||
videoBuffer = (u8*)AllocateMemoryPages(FIFO_SIZE);
|
||||
fifo.Init(videoBuffer, videoBuffer); //zero length. there is no data yet.
|
||||
}
|
||||
|
||||
void Fifo_Shutdown()
|
||||
{
|
||||
FreeMemoryPages(videoBuffer, FIFO_SIZE);
|
||||
}
|
||||
|
||||
int FAKE_GetFifoSize()
|
||||
{
|
||||
if (size < readptr)
|
||||
{
|
||||
PanicAlert("GFX Fifo underrun encountered.");
|
||||
}
|
||||
return (size - readptr);
|
||||
}
|
||||
|
||||
u8 FAKE_PeekFifo8(u32 _uOffset)
|
||||
{
|
||||
return videoBuffer[readptr + _uOffset];
|
||||
}
|
||||
|
||||
u16 FAKE_PeekFifo16(u32 _uOffset)
|
||||
{
|
||||
return Common::swap16(*(u16*)&videoBuffer[readptr + _uOffset]);
|
||||
}
|
||||
|
||||
u32 FAKE_PeekFifo32(u32 _uOffset)
|
||||
{
|
||||
return Common::swap32(*(u32*)&videoBuffer[readptr + _uOffset]);
|
||||
}
|
||||
|
||||
u8 FAKE_ReadFifo8()
|
||||
{
|
||||
return videoBuffer[readptr++];
|
||||
}
|
||||
|
||||
u16 FAKE_ReadFifo16()
|
||||
{
|
||||
u16 val = Common::swap16(*(u16*)(videoBuffer+readptr));
|
||||
readptr += 2;
|
||||
return val;
|
||||
}
|
||||
|
||||
u32 FAKE_ReadFifo32()
|
||||
{
|
||||
u32 val = Common::swap32(*(u32*)(videoBuffer+readptr));
|
||||
readptr += 4;
|
||||
return val;
|
||||
}
|
||||
|
||||
void FAKE_SkipFifo(u32 skip)
|
||||
{
|
||||
readptr += skip;
|
||||
}
|
||||
|
||||
void Video_SendFifoData(BYTE *_uData)
|
||||
{
|
||||
memcpy(videoBuffer + size, _uData, 32);
|
||||
size += 32;
|
||||
if (size + 32 >= FIFO_SIZE)
|
||||
{
|
||||
if (FAKE_GetFifoSize() > readptr)
|
||||
{
|
||||
SysMessage("out of bounds");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
DebugLog("FAKE BUFFER LOOPS");
|
||||
memmove(&videoBuffer[0], &videoBuffer[readptr], FAKE_GetFifoSize());
|
||||
// memset(&videoBuffer[FAKE_GetFifoSize()], 0, FIFO_SIZE - FAKE_GetFifoSize());
|
||||
size = FAKE_GetFifoSize();
|
||||
readptr = 0;
|
||||
}
|
||||
OpcodeDecoder_Run();
|
||||
}
|
||||
|
||||
|
||||
//TODO - turn inside out, have the "reader" ask for bytes instead
|
||||
// See Core.cpp for threading idea
|
||||
void Video_EnterLoop()
|
||||
{
|
||||
SCPFifoStruct &fifo = *g_VideoInitialize.pCPFifo;
|
||||
|
||||
// TODO(ector): Don't peek so often!
|
||||
while (g_VideoInitialize.pPeekMessages())
|
||||
{
|
||||
if (fifo.CPReadWriteDistance < 1) //fifo.CPLoWatermark)
|
||||
Common::SleepCurrentThread(1);
|
||||
//etc...
|
||||
|
||||
// check if we are able to run this buffer
|
||||
if ((fifo.bFF_GPReadEnable) && !(fifo.bFF_BPEnable && fifo.bFF_Breakpoint))
|
||||
{
|
||||
int count = 200;
|
||||
while(fifo.CPReadWriteDistance > 0 && count)
|
||||
{
|
||||
// check if we are on a breakpoint
|
||||
if (fifo.bFF_BPEnable)
|
||||
{
|
||||
if (fifo.CPReadPointer == fifo.CPBreakpoint)
|
||||
{
|
||||
fifo.bFF_Breakpoint = 1;
|
||||
g_VideoInitialize.pUpdateInterrupts();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// read the data and send it to the VideoPlugin
|
||||
|
||||
u8 *uData = Memory_GetPtr(fifo.CPReadPointer);
|
||||
#ifdef _WIN32
|
||||
EnterCriticalSection(&fifo.sync);
|
||||
#endif
|
||||
fifo.CPReadPointer += 32;
|
||||
Video_SendFifoData(uData);
|
||||
#ifdef _WIN32
|
||||
InterlockedExchangeAdd((LONG*)&fifo.CPReadWriteDistance, -32);
|
||||
LeaveCriticalSection(&fifo.sync);
|
||||
#endif
|
||||
// increase the ReadPtr
|
||||
if (fifo.CPReadPointer >= fifo.CPEnd)
|
||||
{
|
||||
fifo.CPReadPointer = fifo.CPBase;
|
||||
//LOG(COMMANDPROCESSOR, "BUFFER LOOP");
|
||||
}
|
||||
count--;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#ifndef _FIFO_H
|
||||
#define _FIFO_H
|
||||
|
||||
#include "Common.h"
|
||||
// inline for speed!
|
||||
class FifoReader
|
||||
{
|
||||
u8 *ptr;
|
||||
u8 *end;
|
||||
u8 *tempPtr; //single element stack :P
|
||||
u8 *tempEnd;
|
||||
bool pushed;
|
||||
public:
|
||||
void Init(u8 *_ptr, u8 *_end)
|
||||
{
|
||||
ptr = _ptr; end = _end; pushed = false;
|
||||
}
|
||||
bool IsPushed() {return pushed;}
|
||||
void Push(u8 *_ptr, u8 *_end) {pushed = true; tempPtr = ptr; tempEnd = end; ptr = _ptr; end = _end;}
|
||||
void Pop() {pushed = false; ptr = tempPtr; end = tempEnd;}
|
||||
u8 Peek8 (int offset) const { return ptr[offset]; }
|
||||
u16 Peek16(int offset) const { return Common::swap16(*(u16*)(ptr+offset)); }
|
||||
u32 Peek32(int offset) const { return Common::swap32(*(u32*)(ptr+offset)); }
|
||||
u8 Read8 () {return *ptr++;}
|
||||
u16 Read16() {const u16 value = Common::swap16(*((u16*)ptr)); ptr+=2; return value;}
|
||||
u32 Read32() {const u32 value = Common::swap32(*((u32*)ptr)); ptr+=4; return value;}
|
||||
float Read32F() {const u32 value = Common::swap32(*((u32*)ptr)); ptr+=4; return *(float*)&value;}
|
||||
int GetRemainSize() const { return (int)(end - ptr); }
|
||||
u8 *GetPtr() const { return ptr; }
|
||||
void MoveEndForward() { end += 32; }
|
||||
u8 *GetEnd() const { return end; }
|
||||
};
|
||||
|
||||
extern FifoReader fifo;
|
||||
|
||||
void Fifo_Init();
|
||||
void Fifo_Shutdown();
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,446 @@
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include "Globals.h"
|
||||
#ifdef _WIN32
|
||||
#include "EmuWindow.h"
|
||||
#endif
|
||||
#include "GLInit.h"
|
||||
|
||||
|
||||
// Handles OpenGL and the window
|
||||
|
||||
|
||||
// screen offset
|
||||
int nBackbufferWidth, nBackbufferHeight;
|
||||
u32 s_nTargetWidth = 0, s_nTargetHeight = 0;
|
||||
u32 g_AAx = 0, g_AAy = 0;
|
||||
|
||||
#ifndef _WIN32
|
||||
GLWindow GLWin;
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
static HDC hDC = NULL; // Private GDI Device Context
|
||||
static HGLRC hRC = NULL; // Permanent Rendering Context
|
||||
extern HINSTANCE g_hInstance;
|
||||
#endif
|
||||
|
||||
void OpenGL_SwapBuffers()
|
||||
{
|
||||
#ifdef _WIN32
|
||||
SwapBuffers(hDC);
|
||||
#else
|
||||
glXSwapBuffers(GLWin.dpy, GLWin.win);
|
||||
#endif
|
||||
}
|
||||
|
||||
void OpenGL_SetWindowText(const char *text)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
SetWindowText(EmuWindow::GetWnd(), text);
|
||||
#else
|
||||
// TODO
|
||||
#endif
|
||||
}
|
||||
|
||||
BOOL Callback_PeekMessages()
|
||||
{
|
||||
#ifdef _WIN32
|
||||
//TODO: peekmessage
|
||||
MSG msg;
|
||||
while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE))
|
||||
{
|
||||
if (msg.message == WM_QUIT)
|
||||
return FALSE;
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
return TRUE;
|
||||
#else
|
||||
XEvent event;
|
||||
while (XPending(GLWin.dpy) > 0) {
|
||||
XNextEvent(GLWin.dpy, &event);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void UpdateFPSDisplay(const char *text)
|
||||
{
|
||||
OpenGL_SetWindowText(text);
|
||||
}
|
||||
|
||||
|
||||
bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _width, int _height)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
EmuWindow::SetSize(_width, _height);
|
||||
#endif
|
||||
|
||||
nBackbufferWidth = _width;
|
||||
nBackbufferHeight = _height;
|
||||
|
||||
// change later
|
||||
s_nTargetWidth = 640<<g_AAx;
|
||||
s_nTargetHeight = 480<<g_AAy;
|
||||
|
||||
g_VideoInitialize.pPeekMessages = &Callback_PeekMessages;
|
||||
g_VideoInitialize.pUpdateFPSDisplay = &UpdateFPSDisplay;
|
||||
|
||||
#ifdef _WIN32
|
||||
// create the window
|
||||
if (g_VideoInitialize.pWindowHandle == NULL) {
|
||||
// create the window
|
||||
g_VideoInitialize.pWindowHandle = (void*)EmuWindow::Create(NULL, g_hInstance, "Please wait...");
|
||||
if (g_VideoInitialize.pWindowHandle == NULL) {
|
||||
SysMessage("failed to create window");
|
||||
return false;
|
||||
}
|
||||
EmuWindow::Show();
|
||||
}
|
||||
else
|
||||
{
|
||||
g_VideoInitialize.pWindowHandle = (void*)EmuWindow::Create((HWND)g_VideoInitialize.pWindowHandle, g_hInstance, "Please wait...");
|
||||
}
|
||||
|
||||
GLuint PixelFormat; // Holds The Results After Searching For A Match
|
||||
DWORD dwExStyle; // Window Extended Style
|
||||
DWORD dwStyle; // Window Style
|
||||
|
||||
RECT rcdesktop;
|
||||
GetWindowRect(GetDesktopWindow(), &rcdesktop);
|
||||
|
||||
if (g_Config.bFullscreen) {
|
||||
nBackbufferWidth = rcdesktop.right - rcdesktop.left;
|
||||
nBackbufferHeight = rcdesktop.bottom - rcdesktop.top;
|
||||
|
||||
DEVMODE dmScreenSettings;
|
||||
memset(&dmScreenSettings,0,sizeof(dmScreenSettings));
|
||||
dmScreenSettings.dmSize=sizeof(dmScreenSettings);
|
||||
dmScreenSettings.dmPelsWidth = nBackbufferWidth;
|
||||
dmScreenSettings.dmPelsHeight = nBackbufferHeight;
|
||||
dmScreenSettings.dmBitsPerPel = 32;
|
||||
dmScreenSettings.dmFields = DM_BITSPERPEL|DM_PELSWIDTH|DM_PELSHEIGHT;
|
||||
|
||||
// Try To Set Selected Mode And Get Results. NOTE: CDS_FULLSCREEN Gets Rid Of Start Bar.
|
||||
if (ChangeDisplaySettings(&dmScreenSettings,CDS_FULLSCREEN)!=DISP_CHANGE_SUCCESSFUL)
|
||||
{
|
||||
if (MessageBox(NULL,"The Requested Fullscreen Mode Is Not Supported By\nYour Video Card. Use Windowed Mode Instead?","NeHe GL",MB_YESNO|MB_ICONEXCLAMATION)==IDYES)
|
||||
g_Config.bFullscreen = false;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// change to default resolution
|
||||
ChangeDisplaySettings(NULL, 0);
|
||||
}
|
||||
|
||||
if (g_Config.bFullscreen) {
|
||||
dwExStyle=WS_EX_APPWINDOW;
|
||||
dwStyle=WS_POPUP;
|
||||
ShowCursor(FALSE);
|
||||
}
|
||||
else {
|
||||
dwExStyle=WS_EX_APPWINDOW | WS_EX_WINDOWEDGE;
|
||||
dwStyle=WS_OVERLAPPEDWINDOW;
|
||||
}
|
||||
|
||||
RECT rc;
|
||||
rc.left = 0; rc.top = 0;
|
||||
rc.right = nBackbufferWidth; rc.bottom = nBackbufferHeight;
|
||||
AdjustWindowRectEx(&rc, dwStyle, FALSE, dwExStyle);
|
||||
int X = (rcdesktop.right-rcdesktop.left)/2 - (rc.right-rc.left)/2;
|
||||
int Y = (rcdesktop.bottom-rcdesktop.top)/2 - (rc.bottom-rc.top)/2;
|
||||
|
||||
// SetWindowPos(EmuWindow::GetWnd(), NULL, X, Y, rc.right-rc.left, rc.bottom-rc.top, SWP_NOREPOSITION|SWP_NOZORDER);
|
||||
|
||||
PIXELFORMATDESCRIPTOR pfd= // pfd Tells Windows How We Want Things To Be
|
||||
{
|
||||
sizeof(PIXELFORMATDESCRIPTOR), // Size Of This Pixel Format Descriptor
|
||||
1, // Version Number
|
||||
PFD_DRAW_TO_WINDOW | // Format Must Support Window
|
||||
PFD_SUPPORT_OPENGL | // Format Must Support OpenGL
|
||||
PFD_DOUBLEBUFFER, // Must Support Double Buffering
|
||||
PFD_TYPE_RGBA, // Request An RGBA Format
|
||||
32, // Select Our Color Depth
|
||||
0, 0, 0, 0, 0, 0, // Color Bits Ignored
|
||||
0, // 8bit Alpha Buffer
|
||||
0, // Shift Bit Ignored
|
||||
0, // No Accumulation Buffer
|
||||
0, 0, 0, 0, // Accumulation Bits Ignored
|
||||
24, // 24Bit Z-Buffer (Depth Buffer)
|
||||
8, // 8bit Stencil Buffer
|
||||
0, // No Auxiliary Buffer
|
||||
PFD_MAIN_PLANE, // Main Drawing Layer
|
||||
0, // Reserved
|
||||
0, 0, 0 // Layer Masks Ignored
|
||||
};
|
||||
|
||||
if (!(hDC=GetDC(EmuWindow::GetWnd()))) {
|
||||
MessageBox(NULL,"(1) Can't Create A GL Device Context.","ERROR",MB_OK|MB_ICONEXCLAMATION);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!(PixelFormat=ChoosePixelFormat(hDC,&pfd))) {
|
||||
MessageBox(NULL,"(2) Can't Find A Suitable PixelFormat.","ERROR",MB_OK|MB_ICONEXCLAMATION);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!SetPixelFormat(hDC,PixelFormat,&pfd)) {
|
||||
MessageBox(NULL,"(3) Can't Set The PixelFormat.","ERROR",MB_OK|MB_ICONEXCLAMATION);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!(hRC=wglCreateContext(hDC))) {
|
||||
MessageBox(NULL,"(4) Can't Create A GL Rendering Context.","ERROR",MB_OK|MB_ICONEXCLAMATION);
|
||||
return false;
|
||||
}
|
||||
|
||||
#else
|
||||
XVisualInfo *vi;
|
||||
Colormap cmap;
|
||||
int dpyWidth, dpyHeight;
|
||||
int glxMajorVersion, glxMinorVersion;
|
||||
int vidModeMajorVersion, vidModeMinorVersion;
|
||||
Atom wmDelete;
|
||||
|
||||
// attributes for a single buffered visual in RGBA format with at least
|
||||
// 8 bits per color and a 24 bit depth buffer
|
||||
int attrListSgl[] = {GLX_RGBA, GLX_RED_SIZE, 8,
|
||||
GLX_GREEN_SIZE, 8,
|
||||
GLX_BLUE_SIZE, 8,
|
||||
GLX_DEPTH_SIZE, 24,
|
||||
None};
|
||||
|
||||
// attributes for a double buffered visual in RGBA format with at least
|
||||
// 8 bits per color and a 24 bit depth buffer
|
||||
int attrListDbl[] = { GLX_RGBA, GLX_DOUBLEBUFFER,
|
||||
GLX_RED_SIZE, 8,
|
||||
GLX_GREEN_SIZE, 8,
|
||||
GLX_BLUE_SIZE, 8,
|
||||
GLX_DEPTH_SIZE, 24,
|
||||
None };
|
||||
GLWin.dpy = XOpenDisplay(0);
|
||||
g_VideoInitialize.pWindowHandle = (HWND)GLWin.dpy;
|
||||
GLWin.screen = DefaultScreen(GLWin.dpy);
|
||||
|
||||
GLWin.fs = false; // !!(conf.options & GSOPTION_FULLSCREEN);
|
||||
|
||||
/* get an appropriate visual */
|
||||
vi = glXChooseVisual(GLWin.dpy, GLWin.screen, attrListDbl);
|
||||
if (vi == NULL) {
|
||||
vi = glXChooseVisual(GLWin.dpy, GLWin.screen, attrListSgl);
|
||||
GLWin.doubleBuffered = False;
|
||||
ERROR_LOG("Only Singlebuffered Visual!\n");
|
||||
}
|
||||
else {
|
||||
GLWin.doubleBuffered = True;
|
||||
ERROR_LOG("Got Doublebuffered Visual!\n");
|
||||
}
|
||||
|
||||
glXQueryVersion(GLWin.dpy, &glxMajorVersion, &glxMinorVersion);
|
||||
ERROR_LOG("glX-Version %d.%d\n", glxMajorVersion, glxMinorVersion);
|
||||
/* create a GLX context */
|
||||
GLWin.ctx = glXCreateContext(GLWin.dpy, vi, 0, GL_TRUE);
|
||||
/* create a color map */
|
||||
cmap = XCreateColormap(GLWin.dpy, RootWindow(GLWin.dpy, vi->screen),
|
||||
vi->visual, AllocNone);
|
||||
GLWin.attr.colormap = cmap;
|
||||
GLWin.attr.border_pixel = 0;
|
||||
|
||||
// get a connection
|
||||
XF86VidModeQueryVersion(GLWin.dpy, &vidModeMajorVersion, &vidModeMinorVersion);
|
||||
|
||||
if (GLWin.fs) {
|
||||
|
||||
XF86VidModeModeInfo **modes = NULL;
|
||||
int modeNum = 0;
|
||||
int bestMode = 0;
|
||||
|
||||
// set best mode to current
|
||||
bestMode = 0;
|
||||
ERROR_LOG("XF86VidModeExtension-Version %d.%d\n", vidModeMajorVersion, vidModeMinorVersion);
|
||||
XF86VidModeGetAllModeLines(GLWin.dpy, GLWin.screen, &modeNum, &modes);
|
||||
|
||||
if (modeNum > 0 && modes != NULL) {
|
||||
/* save desktop-resolution before switching modes */
|
||||
GLWin.deskMode = *modes[0];
|
||||
/* look for mode with requested resolution */
|
||||
for (int i = 0; i < modeNum; i++) {
|
||||
if ((modes[i]->hdisplay == _width) && (modes[i]->vdisplay == _height)) {
|
||||
bestMode = i;
|
||||
}
|
||||
}
|
||||
|
||||
XF86VidModeSwitchToMode(GLWin.dpy, GLWin.screen, modes[bestMode]);
|
||||
XF86VidModeSetViewPort(GLWin.dpy, GLWin.screen, 0, 0);
|
||||
dpyWidth = modes[bestMode]->hdisplay;
|
||||
dpyHeight = modes[bestMode]->vdisplay;
|
||||
ERROR_LOG("Resolution %dx%d\n", dpyWidth, dpyHeight);
|
||||
XFree(modes);
|
||||
|
||||
/* create a fullscreen window */
|
||||
GLWin.attr.override_redirect = True;
|
||||
GLWin.attr.event_mask = ExposureMask | KeyPressMask | ButtonPressMask |
|
||||
StructureNotifyMask;
|
||||
GLWin.win = XCreateWindow(GLWin.dpy, RootWindow(GLWin.dpy, vi->screen),
|
||||
0, 0, dpyWidth, dpyHeight, 0, vi->depth, InputOutput, vi->visual,
|
||||
CWBorderPixel | CWColormap | CWEventMask | CWOverrideRedirect,
|
||||
&GLWin.attr);
|
||||
XWarpPointer(GLWin.dpy, None, GLWin.win, 0, 0, 0, 0, 0, 0);
|
||||
XMapRaised(GLWin.dpy, GLWin.win);
|
||||
XGrabKeyboard(GLWin.dpy, GLWin.win, True, GrabModeAsync,
|
||||
GrabModeAsync, CurrentTime);
|
||||
XGrabPointer(GLWin.dpy, GLWin.win, True, ButtonPressMask,
|
||||
GrabModeAsync, GrabModeAsync, GLWin.win, None, CurrentTime);
|
||||
}
|
||||
else {
|
||||
ERROR_LOG("Failed to start fullscreen. If you received the \n"
|
||||
"\"XFree86-VidModeExtension\" extension is missing, add\n"
|
||||
"Load \"extmod\"\n"
|
||||
"to your X configuration file (under the Module Section)\n");
|
||||
GLWin.fs = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!GLWin.fs) {
|
||||
|
||||
//XRootWindow(dpy,screen)
|
||||
//int X = (rcdesktop.right-rcdesktop.left)/2 - (rc.right-rc.left)/2;
|
||||
//int Y = (rcdesktop.bottom-rcdesktop.top)/2 - (rc.bottom-rc.top)/2;
|
||||
|
||||
// create a window in window mode
|
||||
GLWin.attr.event_mask = ExposureMask | KeyPressMask | ButtonPressMask |
|
||||
StructureNotifyMask;
|
||||
GLWin.win = XCreateWindow(GLWin.dpy, RootWindow(GLWin.dpy, vi->screen),
|
||||
0, 0, _width, _height, 0, vi->depth, InputOutput, vi->visual,
|
||||
CWBorderPixel | CWColormap | CWEventMask, &GLWin.attr);
|
||||
// only set window title and handle wm_delete_events if in windowed mode
|
||||
wmDelete = XInternAtom(GLWin.dpy, "WM_DELETE_WINDOW", True);
|
||||
XSetWMProtocols(GLWin.dpy, GLWin.win, &wmDelete, 1);
|
||||
XSetStandardProperties(GLWin.dpy, GLWin.win, "GPU",
|
||||
"GPU", None, NULL, 0, NULL);
|
||||
XMapRaised(GLWin.dpy, GLWin.win);
|
||||
}
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
bool OpenGL_MakeCurrent()
|
||||
{
|
||||
#ifdef _WIN32
|
||||
if (!wglMakeCurrent(hDC,hRC)) {
|
||||
MessageBox(NULL,"(5) Can't Activate The GL Rendering Context.","ERROR",MB_OK|MB_ICONEXCLAMATION);
|
||||
return false;
|
||||
}
|
||||
#else
|
||||
Window winDummy;
|
||||
unsigned int borderDummy;
|
||||
// connect the glx-context to the window
|
||||
glXMakeCurrent(GLWin.dpy, GLWin.win, GLWin.ctx);
|
||||
XGetGeometry(GLWin.dpy, GLWin.win, &winDummy, &GLWin.x, &GLWin.y,
|
||||
&GLWin.width, &GLWin.height, &borderDummy, &GLWin.depth);
|
||||
ERROR_LOG("GLWin Depth %d", GLWin.depth);
|
||||
if (glXIsDirect(GLWin.dpy, GLWin.ctx))
|
||||
ERROR_LOG("you have Direct Rendering!");
|
||||
else
|
||||
ERROR_LOG("no Direct Rendering possible!");
|
||||
|
||||
// better for pad plugin key input (thc)
|
||||
XSelectInput(GLWin.dpy, GLWin.win, ExposureMask | KeyPressMask | KeyReleaseMask |
|
||||
ButtonPressMask | StructureNotifyMask | EnterWindowMask | LeaveWindowMask |
|
||||
FocusChangeMask );
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
void OpenGL_Update()
|
||||
{
|
||||
#ifdef _WIN32
|
||||
|
||||
if (EmuWindow::GetParentWnd())
|
||||
{
|
||||
RECT rcWindow;
|
||||
GetWindowRect(EmuWindow::GetParentWnd(), &rcWindow);
|
||||
|
||||
int width = rcWindow.right - rcWindow.left;
|
||||
int height = rcWindow.bottom - rcWindow.top;
|
||||
|
||||
::MoveWindow(EmuWindow::GetWnd(), 0,0,width,height, FALSE);
|
||||
nBackbufferWidth = width;
|
||||
nBackbufferHeight = height;
|
||||
|
||||
/*
|
||||
u32 TmpAAx = (width / 640) - 1;
|
||||
u32 TmpAAy = (height / 480) - 1;
|
||||
u32 FinalAA = TmpAAx < TmpAAy ? TmpAAx : TmpAAy;
|
||||
|
||||
g_AAx = FinalAA;
|
||||
g_AAy = FinalAA;
|
||||
|
||||
s_nTargetWidth = 640<<g_AAx;
|
||||
s_nTargetHeight = 480<<g_AAy; */
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void OpenGL_Shutdown()
|
||||
{
|
||||
#ifdef _WIN32
|
||||
if (hRC) // Do We Have A Rendering Context?
|
||||
{
|
||||
if (!wglMakeCurrent(NULL,NULL)) // Are We Able To Release The DC And RC Contexts?
|
||||
{
|
||||
MessageBox(NULL,"Release Of DC And RC Failed.", "SHUTDOWN ERROR", MB_OK | MB_ICONINFORMATION);
|
||||
}
|
||||
|
||||
if (!wglDeleteContext(hRC)) // Are We Able To Delete The RC?
|
||||
{
|
||||
MessageBox(NULL,"Release Rendering Context Failed.", "SHUTDOWN ERROR", MB_OK | MB_ICONINFORMATION);
|
||||
}
|
||||
hRC = NULL; // Set RC To NULL
|
||||
}
|
||||
|
||||
if (hDC && !ReleaseDC(EmuWindow::GetWnd(),hDC)) // Are We Able To Release The DC
|
||||
{
|
||||
MessageBox(NULL,"Release Device Context Failed.", "SHUTDOWN ERROR", MB_OK | MB_ICONINFORMATION);
|
||||
hDC = NULL; // Set DC To NULL
|
||||
}
|
||||
#else // linux
|
||||
if (GLWin.ctx)
|
||||
{
|
||||
if (!glXMakeCurrent(GLWin.dpy, None, NULL))
|
||||
{
|
||||
ERROR_LOG("Could not release drawing context.\n");
|
||||
}
|
||||
glXDestroyContext(GLWin.dpy, GLWin.ctx);
|
||||
GLWin.ctx = NULL;
|
||||
}
|
||||
/* switch back to original desktop resolution if we were in fs */
|
||||
if (GLWin.dpy != NULL) {
|
||||
if (GLWin.fs) {
|
||||
XF86VidModeSwitchToMode(GLWin.dpy, GLWin.screen, &GLWin.deskMode);
|
||||
XF86VidModeSetViewPort(GLWin.dpy, GLWin.screen, 0, 0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#ifndef _GLINIT_H
|
||||
#define _GLINIT_H
|
||||
|
||||
#ifndef _WIN32
|
||||
|
||||
#undef I_NEED_OS2_H
|
||||
#undef BOOL
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
#include <X11/keysym.h>
|
||||
#include <X11/extensions/xf86vmode.h>
|
||||
//#include <gtk/gtk.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
typedef struct {
|
||||
Display *dpy;
|
||||
int screen;
|
||||
Window win;
|
||||
GLXContext ctx;
|
||||
XSetWindowAttributes attr;
|
||||
Bool fs;
|
||||
Bool doubleBuffered;
|
||||
XF86VidModeModeInfo deskMode;
|
||||
int x, y;
|
||||
unsigned int width, height;
|
||||
unsigned int depth;
|
||||
} GLWindow;
|
||||
|
||||
extern GLWindow GLWin;
|
||||
|
||||
#endif
|
||||
|
||||
// yeah yeah, these should be hidden
|
||||
extern int nBackbufferWidth, nBackbufferHeight;
|
||||
extern u32 s_nTargetWidth, s_nTargetHeight;
|
||||
extern u32 g_AAx, g_AAy;
|
||||
|
||||
bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _width, int _height);
|
||||
bool OpenGL_MakeCurrent();
|
||||
void OpenGL_SwapBuffers();
|
||||
void OpenGL_SetWindowText(const char *text);
|
||||
void OpenGL_Shutdown();
|
||||
void OpenGL_Update();
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,686 @@
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include "Globals.h"
|
||||
|
||||
#include "pluginspecs_video.h"
|
||||
#include "main.h"
|
||||
|
||||
#include "IniFile.h"
|
||||
#include <assert.h>
|
||||
|
||||
int frameCount;
|
||||
int lut3to8[8];
|
||||
int lut4to8[16];
|
||||
int lut5to8[32];
|
||||
int lut6to8[64];
|
||||
float lutu8tosfloat[256];
|
||||
float lutu8toufloat[256];
|
||||
float luts8tosfloat[256];
|
||||
|
||||
int g_Res[NUMWNDRES][2] =
|
||||
{
|
||||
{640,480},
|
||||
{800,600},
|
||||
{1024,768},
|
||||
{1280,960},
|
||||
{1280,1024},
|
||||
{1600,1200},
|
||||
};
|
||||
|
||||
Config g_Config;
|
||||
Statistics stats;
|
||||
|
||||
void Statistics::ResetFrame()
|
||||
{
|
||||
memset(&thisFrame,0,sizeof(ThisFrame));
|
||||
}
|
||||
|
||||
void InitLUTs()
|
||||
{
|
||||
int i;
|
||||
for (i=0; i<8; i++)
|
||||
lut3to8[i] = (i*255)/7;
|
||||
for (i=0; i<16; i++)
|
||||
lut4to8[i] = (i*255)/15;
|
||||
for (i=0; i<32; i++)
|
||||
lut5to8[i] = (i*255)/31;
|
||||
for (i=0; i<64; i++)
|
||||
lut6to8[i] = (i*255)/63;
|
||||
for (i=0; i<256; i++)
|
||||
{
|
||||
lutu8tosfloat[i] = (float)(i-128)/127.0f;
|
||||
lutu8toufloat[i] = (float)(i)/255.0f;
|
||||
luts8tosfloat[i] = ((float)(signed char)(char)i) / 127.0f;
|
||||
}
|
||||
}
|
||||
|
||||
Config::Config()
|
||||
{
|
||||
memset(this, 0, sizeof(Config));
|
||||
}
|
||||
|
||||
void Config::Load()
|
||||
{
|
||||
IniFile iniFile;
|
||||
iniFile.Load("flipper.ini");
|
||||
iniFile.Get("Hardware", "Adapter", &iAdapter, 0);
|
||||
iniFile.Get("Hardware", "WindowedRes", &iWindowedRes, 0);
|
||||
iniFile.Get("Hardware", "FullscreenRes", &iFSResolution, 0);
|
||||
iniFile.Get("Hardware", "Fullscreen", &bFullscreen, 0);
|
||||
if (iAdapter == -1)
|
||||
iAdapter = 0;
|
||||
|
||||
iniFile.Get("Settings", "OverlayStats", &bOverlayStats, false);
|
||||
iniFile.Get("Settings", "Postprocess", &iPostprocessEffect, 0);
|
||||
iniFile.Get("Settings", "DLOptimize", &iCompileDLsLevel, 0);
|
||||
iniFile.Get("Settings", "DumpTextures", &bDumpTextures, 0);
|
||||
iniFile.Get("Settings", "ShowShaderErrors", &bShowShaderErrors, 0);
|
||||
iniFile.Get("Settings", "Multisample", &iMultisampleMode, 0);
|
||||
std::string s;
|
||||
iniFile.Get("Settings", "TexDumpPath", &s, 0);
|
||||
if( s.size() < sizeof(texDumpPath) )
|
||||
strcpy(texDumpPath, s.c_str());
|
||||
else {
|
||||
strncpy(texDumpPath, s.c_str(), sizeof(texDumpPath)-1);
|
||||
texDumpPath[sizeof(texDumpPath)-1] = 0;
|
||||
}
|
||||
|
||||
iniFile.Get("Enhancements", "ForceFiltering", &bForceFiltering, 0);
|
||||
iniFile.Get("Enhancements", "ForceMaxAniso", &bForceMaxAniso, 0);
|
||||
}
|
||||
|
||||
void Config::Save()
|
||||
{
|
||||
IniFile iniFile;
|
||||
iniFile.Load("flipper.ini");
|
||||
iniFile.Set("Hardware", "Adapter", iAdapter);
|
||||
iniFile.Set("Hardware", "WindowedRes", iWindowedRes);
|
||||
iniFile.Set("Hardware", "FullscreenRes", iFSResolution);
|
||||
iniFile.Set("Hardware", "Fullscreen", bFullscreen);
|
||||
|
||||
iniFile.Set("Settings", "OverlayStats", bOverlayStats);
|
||||
iniFile.Set("Settings", "OverlayStats", bOverlayStats);
|
||||
iniFile.Set("Settings", "Postprocess", iPostprocessEffect);
|
||||
iniFile.Set("Settings", "DLOptimize", iCompileDLsLevel);
|
||||
iniFile.Set("Settings", "DumpTextures", bDumpTextures);
|
||||
iniFile.Set("Settings", "ShowShaderErrors", bShowShaderErrors);
|
||||
iniFile.Set("Settings", "Multisample", iMultisampleMode);
|
||||
iniFile.Set("Settings", "TexDumpPath", texDumpPath);
|
||||
|
||||
iniFile.Set("Enhancements", "ForceFiltering", bForceFiltering);
|
||||
iniFile.Set("Enhancements", "ForceMaxAniso", bForceMaxAniso);
|
||||
iniFile.Save("flipper.ini");
|
||||
}
|
||||
|
||||
#ifdef _M_IX86
|
||||
|
||||
extern "C" {
|
||||
#ifdef _WIN32
|
||||
#define XMD_H
|
||||
#undef FAR
|
||||
#define HAVE_BOOLEAN
|
||||
#endif
|
||||
|
||||
#include <jpeglib.h>
|
||||
}
|
||||
|
||||
bool SaveJPEG(const char* filename, int image_width, int image_height, const void* pdata, int quality)
|
||||
{
|
||||
u8* image_buffer = new u8[image_width * image_height * 3];
|
||||
u8* psrc = (u8*)pdata;
|
||||
|
||||
// input data is rgba format, so convert to rgb
|
||||
u8* p = image_buffer;
|
||||
for(int i = 0; i < image_height; ++i) {
|
||||
for(int j = 0; j < image_width; ++j) {
|
||||
p[0] = psrc[0];
|
||||
p[1] = psrc[1];
|
||||
p[2] = psrc[2];
|
||||
p += 3;
|
||||
psrc += 4;
|
||||
}
|
||||
}
|
||||
|
||||
/* This struct contains the JPEG compression parameters and pointers to
|
||||
* working space (which is allocated as needed by the JPEG library).
|
||||
* It is possible to have several such structures, representing multiple
|
||||
* compression/decompression processes, in existence at once. We refer
|
||||
* to any one struct (and its associated working data) as a "JPEG object".
|
||||
*/
|
||||
struct jpeg_compress_struct cinfo;
|
||||
/* This struct represents a JPEG error handler. It is declared separately
|
||||
* because applications often want to supply a specialized error handler
|
||||
* (see the second half of this file for an example). But here we just
|
||||
* take the easy way out and use the standard error handler, which will
|
||||
* print a message on stderr and call exit() if compression fails.
|
||||
* Note that this struct must live as long as the main JPEG parameter
|
||||
* struct, to avoid dangling-pointer problems.
|
||||
*/
|
||||
struct jpeg_error_mgr jerr;
|
||||
/* More stuff */
|
||||
FILE * outfile; /* target file */
|
||||
JSAMPROW row_pointer[1]; /* pointer to JSAMPLE row[s] */
|
||||
int row_stride; /* physical row width in image buffer */
|
||||
|
||||
/* Step 1: allocate and initialize JPEG compression object */
|
||||
|
||||
/* We have to set up the error handler first, in case the initialization
|
||||
* step fails. (Unlikely, but it could happen if you are out of memory.)
|
||||
* This routine fills in the contents of struct jerr, and returns jerr's
|
||||
* address which we place into the link field in cinfo.
|
||||
*/
|
||||
cinfo.err = jpeg_std_error(&jerr);
|
||||
/* Now we can initialize the JPEG compression object. */
|
||||
jpeg_create_compress(&cinfo);
|
||||
|
||||
/* Step 2: specify data destination (eg, a file) */
|
||||
/* Note: steps 2 and 3 can be done in either order. */
|
||||
|
||||
/* Here we use the library-supplied code to send compressed data to a
|
||||
* stdio stream. You can also write your own code to do something else.
|
||||
* VERY IMPORTANT: use "b" option to fopen() if you are on a machine that
|
||||
* requires it in order to write binary files.
|
||||
*/
|
||||
if ((outfile = fopen(filename, "wb")) == NULL) {
|
||||
fprintf(stderr, "can't open %s\n", filename);
|
||||
exit(1);
|
||||
}
|
||||
jpeg_stdio_dest(&cinfo, outfile);
|
||||
|
||||
/* Step 3: set parameters for compression */
|
||||
|
||||
/* First we supply a description of the input image.
|
||||
* Four fields of the cinfo struct must be filled in:
|
||||
*/
|
||||
cinfo.image_width = image_width; /* image width and height, in pixels */
|
||||
cinfo.image_height = image_height;
|
||||
cinfo.input_components = 3; /* # of color components per pixel */
|
||||
cinfo.in_color_space = JCS_RGB; /* colorspace of input image */
|
||||
/* Now use the library's routine to set default compression parameters.
|
||||
* (You must set at least cinfo.in_color_space before calling this,
|
||||
* since the defaults depend on the source color space.)
|
||||
*/
|
||||
jpeg_set_defaults(&cinfo);
|
||||
/* Now you can set any non-default parameters you wish to.
|
||||
* Here we just illustrate the use of quality (quantization table) scaling:
|
||||
*/
|
||||
jpeg_set_quality(&cinfo, quality, TRUE /* limit to baseline-JPEG values */);
|
||||
|
||||
/* Step 4: Start compressor */
|
||||
|
||||
/* TRUE ensures that we will write a complete interchange-JPEG file.
|
||||
* Pass TRUE unless you are very sure of what you're doing.
|
||||
*/
|
||||
jpeg_start_compress(&cinfo, TRUE);
|
||||
|
||||
/* Step 5: while (scan lines remain to be written) */
|
||||
/* jpeg_write_scanlines(...); */
|
||||
|
||||
/* Here we use the library's state variable cinfo.next_scanline as the
|
||||
* loop counter, so that we don't have to keep track ourselves.
|
||||
* To keep things simple, we pass one scanline per call; you can pass
|
||||
* more if you wish, though.
|
||||
*/
|
||||
row_stride = image_width * 3; /* JSAMPLEs per row in image_buffer */
|
||||
|
||||
while (cinfo.next_scanline < cinfo.image_height) {
|
||||
/* jpeg_write_scanlines expects an array of pointers to scanlines.
|
||||
* Here the array is only one element long, but you could pass
|
||||
* more than one scanline at a time if that's more convenient.
|
||||
*/
|
||||
row_pointer[0] = & image_buffer[cinfo.next_scanline * row_stride];
|
||||
(void) jpeg_write_scanlines(&cinfo, row_pointer, 1);
|
||||
}
|
||||
|
||||
/* Step 6: Finish compression */
|
||||
|
||||
jpeg_finish_compress(&cinfo);
|
||||
/* After finish_compress, we can close the output file. */
|
||||
fclose(outfile);
|
||||
|
||||
/* Step 7: release JPEG compression object */
|
||||
|
||||
/* This is an important step since it will release a good deal of memory. */
|
||||
jpeg_destroy_compress(&cinfo);
|
||||
|
||||
delete image_buffer;
|
||||
/* And we're done! */
|
||||
return true;
|
||||
}
|
||||
|
||||
#else
|
||||
bool SaveJPEG(const char* filename, int image_width, int image_height, const void* pdata, int quality)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma pack(push, 1)
|
||||
#endif
|
||||
|
||||
struct TGA_HEADER
|
||||
{
|
||||
u8 identsize; // size of ID field that follows 18 u8 header (0 usually)
|
||||
u8 colourmaptype; // type of colour map 0=none, 1=has palette
|
||||
u8 imagetype; // type of image 0=none,1=indexed,2=rgb,3=grey,+8=rle packed
|
||||
|
||||
s16 colourmapstart; // first colour map entry in palette
|
||||
s16 colourmaplength; // number of colours in palette
|
||||
u8 colourmapbits; // number of bits per palette entry 15,16,24,32
|
||||
|
||||
s16 xstart; // image x origin
|
||||
s16 ystart; // image y origin
|
||||
s16 width; // image width in pixels
|
||||
s16 height; // image height in pixels
|
||||
u8 bits; // image bits per pixel 8,16,24,32
|
||||
u8 descriptor; // image descriptor bits (vh flip bits)
|
||||
|
||||
// pixel data follows header
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
};
|
||||
#pragma pack(pop)
|
||||
#else
|
||||
} __attribute__((packed));
|
||||
#endif
|
||||
|
||||
bool SaveTGA(const char* filename, int width, int height, void* pdata)
|
||||
{
|
||||
TGA_HEADER hdr;
|
||||
FILE* f = fopen(filename, "wb");
|
||||
if (f == NULL)
|
||||
return false;
|
||||
|
||||
_assert_( sizeof(TGA_HEADER) == 18 && sizeof(hdr) == 18 );
|
||||
|
||||
memset(&hdr, 0, sizeof(hdr));
|
||||
hdr.imagetype = 2;
|
||||
hdr.bits = 32;
|
||||
hdr.width = width;
|
||||
hdr.height = height;
|
||||
hdr.descriptor |= 8|(1<<5); // 8bit alpha, flip vertical
|
||||
|
||||
fwrite(&hdr, sizeof(hdr), 1, f);
|
||||
fwrite(pdata, width*height*4, 1, f);
|
||||
fclose(f);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SaveTexture(const char* filename, u32 textarget, u32 tex, int width, int height)
|
||||
{
|
||||
GL_REPORT_ERRORD();
|
||||
std::vector<u32> data(width*height);
|
||||
glBindTexture(textarget, tex);
|
||||
glGetTexImage(textarget, 0, GL_RGBA, GL_UNSIGNED_BYTE, &data[0]);
|
||||
GLenum err;
|
||||
GL_REPORT_ERROR();
|
||||
if (err != GL_NO_ERROR) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return SaveTGA(filename, width, height, &data[0]);//SaveJPEG(filename, width, height, &data[0], 70);
|
||||
}
|
||||
|
||||
////////////////////
|
||||
// Small profiler //
|
||||
////////////////////
|
||||
#include <list>
|
||||
#include <string>
|
||||
#include <map>
|
||||
using namespace std;
|
||||
|
||||
int g_bWriteProfile=0;
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
#if defined (_MSC_VER) && _MSC_VER >= 1400
|
||||
#include <intrin.h>
|
||||
#pragma intrinsic(__rdtsc)
|
||||
#endif
|
||||
|
||||
static u64 luPerfFreq=0;
|
||||
inline u64 GET_PROFILE_TIME()
|
||||
{
|
||||
#if defined (_MSC_VER) && _MSC_VER >= 1400
|
||||
return __rdtsc();
|
||||
#else
|
||||
LARGE_INTEGER lu;
|
||||
QueryPerformanceCounter(&lu);
|
||||
return lu.QuadPart;
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
static u64 luPerfFreq=1000000;
|
||||
#define GET_PROFILE_TIME() //GetCpuTick()
|
||||
#endif
|
||||
|
||||
|
||||
struct DVPROFSTRUCT;
|
||||
|
||||
struct DVPROFSTRUCT
|
||||
{
|
||||
struct DATA
|
||||
{
|
||||
DATA(u64 time, u32 user = 0) : dwTime(time), dwUserData(user) {}
|
||||
DATA() : dwTime(0), dwUserData(0) {}
|
||||
|
||||
u64 dwTime;
|
||||
u32 dwUserData;
|
||||
};
|
||||
|
||||
~DVPROFSTRUCT() {
|
||||
list<DVPROFSTRUCT*>::iterator it = listpChild.begin();
|
||||
while(it != listpChild.end() ) {
|
||||
delete *it; *it = NULL;
|
||||
++it;
|
||||
}
|
||||
}
|
||||
|
||||
list<DATA> listTimes; // before DVProfEnd is called, contains the global time it started
|
||||
// after DVProfEnd is called, contains the time it lasted
|
||||
// the list contains all the tracked times
|
||||
char pname[256];
|
||||
|
||||
list<DVPROFSTRUCT*> listpChild; // other profilers called during this profiler period
|
||||
};
|
||||
|
||||
struct DVPROFTRACK
|
||||
{
|
||||
u32 dwUserData;
|
||||
DVPROFSTRUCT::DATA* pdwTime;
|
||||
DVPROFSTRUCT* pprof;
|
||||
};
|
||||
|
||||
list<DVPROFTRACK> g_listCurTracking; // the current profiling functions, the back element is the
|
||||
// one that will first get popped off the list when DVProfEnd is called
|
||||
// the pointer is an element in DVPROFSTRUCT::listTimes
|
||||
list<DVPROFSTRUCT> g_listProfilers; // the current profilers, note that these are the parents
|
||||
// any profiler started during the time of another is held in
|
||||
// DVPROFSTRUCT::listpChild
|
||||
list<DVPROFSTRUCT*> g_listAllProfilers; // ignores the hierarchy, pointer to elements in g_listProfilers
|
||||
|
||||
void DVProfRegister(const char *pname)
|
||||
{
|
||||
if (!g_bWriteProfile)
|
||||
return;
|
||||
|
||||
#ifdef _WIN32
|
||||
if (luPerfFreq <= 1) {
|
||||
#if defined (_MSC_VER) && _MSC_VER >= 1400
|
||||
luPerfFreq = 1000000;
|
||||
#else
|
||||
LARGE_INTEGER temp;
|
||||
QueryPerformanceFrequency(&temp);
|
||||
luPerfFreq = temp.QuadPart;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
list<DVPROFSTRUCT*>::iterator it = g_listAllProfilers.begin();
|
||||
|
||||
// while(it != g_listAllProfilers.end() ) {
|
||||
//
|
||||
// if( _tcscmp(pname, (*it)->pname) == 0 ) {
|
||||
// (*it)->listTimes.push_back(timeGetTime());
|
||||
// DVPROFTRACK dvtrack;
|
||||
// dvtrack.pdwTime = &(*it)->listTimes.back();
|
||||
// dvtrack.pprof = *it;
|
||||
// g_listCurTracking.push_back(dvtrack);
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// ++it;
|
||||
// }
|
||||
|
||||
// else add in a new profiler to the appropriate parent profiler
|
||||
DVPROFSTRUCT* pprof = NULL;
|
||||
|
||||
if (g_listCurTracking.size() > 0) {
|
||||
_assert_( g_listCurTracking.back().pprof != NULL );
|
||||
g_listCurTracking.back().pprof->listpChild.push_back(new DVPROFSTRUCT());
|
||||
pprof = g_listCurTracking.back().pprof->listpChild.back();
|
||||
}
|
||||
else {
|
||||
g_listProfilers.push_back(DVPROFSTRUCT());
|
||||
pprof = &g_listProfilers.back();
|
||||
}
|
||||
|
||||
strncpy(pprof->pname, pname, 256);
|
||||
|
||||
// setup the profiler for tracking
|
||||
pprof->listTimes.push_back(DVPROFSTRUCT::DATA(GET_PROFILE_TIME()));
|
||||
|
||||
DVPROFTRACK dvtrack;
|
||||
dvtrack.pdwTime = &pprof->listTimes.back();
|
||||
dvtrack.pprof = pprof;
|
||||
dvtrack.dwUserData = 0;
|
||||
|
||||
g_listCurTracking.push_back(dvtrack);
|
||||
|
||||
// add to all profiler list
|
||||
g_listAllProfilers.push_back(pprof);
|
||||
}
|
||||
|
||||
void DVProfEnd(u32 dwUserData)
|
||||
{
|
||||
if (!g_bWriteProfile)
|
||||
return;
|
||||
if (g_listCurTracking.size() == 0)
|
||||
return;
|
||||
|
||||
DVPROFTRACK dvtrack = g_listCurTracking.back();
|
||||
|
||||
_assert_( dvtrack.pdwTime != NULL && dvtrack.pprof != NULL );
|
||||
|
||||
dvtrack.pdwTime->dwTime = GET_PROFILE_TIME()- dvtrack.pdwTime->dwTime;
|
||||
dvtrack.pdwTime->dwUserData= dwUserData;
|
||||
|
||||
g_listCurTracking.pop_back();
|
||||
}
|
||||
|
||||
struct DVTIMEINFO
|
||||
{
|
||||
DVTIMEINFO() : uInclusive(0), uExclusive(0) {}
|
||||
u64 uInclusive, uExclusive;
|
||||
};
|
||||
|
||||
map<string, DVTIMEINFO> mapAggregateTimes;
|
||||
|
||||
u64 DVProfWriteStruct(FILE* f, DVPROFSTRUCT* p, int ident)
|
||||
{
|
||||
fprintf(f, "%*s%s - ", ident, "", p->pname);
|
||||
|
||||
list<DVPROFSTRUCT::DATA>::iterator ittime = p->listTimes.begin();
|
||||
|
||||
u64 utime = 0;
|
||||
|
||||
while(ittime != p->listTimes.end() ) {
|
||||
utime += ittime->dwTime;
|
||||
|
||||
if (ittime->dwUserData)
|
||||
fprintf(f, "time: %d, user: 0x%8.8x", (u32)ittime->dwTime, ittime->dwUserData);
|
||||
else
|
||||
fprintf(f, "time: %d", (u32)ittime->dwTime);
|
||||
++ittime;
|
||||
}
|
||||
|
||||
// yes this is necessary, maps have problems with constructors on their type
|
||||
map<string, DVTIMEINFO>::iterator ittimes = mapAggregateTimes.find(p->pname);
|
||||
if (ittimes == mapAggregateTimes.end()) {
|
||||
ittimes = mapAggregateTimes.insert(map<string, DVTIMEINFO>::value_type(p->pname, DVTIMEINFO())).first;
|
||||
ittimes->second.uExclusive = 0;
|
||||
ittimes->second.uInclusive = 0;
|
||||
}
|
||||
|
||||
ittimes->second.uInclusive += utime;
|
||||
|
||||
fprintf(f, "\n");
|
||||
|
||||
list<DVPROFSTRUCT*>::iterator itprof = p->listpChild.begin();
|
||||
|
||||
u64 uex = utime;
|
||||
while(itprof != p->listpChild.end() ) {
|
||||
|
||||
uex -= DVProfWriteStruct(f, *itprof, ident+4);
|
||||
++itprof;
|
||||
}
|
||||
|
||||
if (uex > utime) {
|
||||
uex = 0;
|
||||
}
|
||||
|
||||
ittimes->second.uExclusive += uex;
|
||||
return utime;
|
||||
}
|
||||
|
||||
void DVProfWrite(const char* pfilename, u32 frames)
|
||||
{
|
||||
_assert_( pfilename != NULL );
|
||||
FILE* f = fopen(pfilename, "w");
|
||||
|
||||
// pop back any unused
|
||||
mapAggregateTimes.clear();
|
||||
list<DVPROFSTRUCT>::iterator it = g_listProfilers.begin();
|
||||
|
||||
while(it != g_listProfilers.end() ) {
|
||||
DVProfWriteStruct(f, &(*it), 0);
|
||||
++it;
|
||||
}
|
||||
|
||||
{
|
||||
map<string, DVTIMEINFO>::iterator it;
|
||||
fprintf(f, "\n\n-------------------------------------------------------------------\n\n");
|
||||
|
||||
u64 uTotal[2] = {0};
|
||||
double fiTotalTime[2];
|
||||
|
||||
for(it = mapAggregateTimes.begin(); it != mapAggregateTimes.end(); ++it) {
|
||||
uTotal[0] += it->second.uExclusive;
|
||||
uTotal[1] += it->second.uInclusive;
|
||||
}
|
||||
|
||||
fprintf(f, "total times (%d): ex: %Lu ", frames, 1000000*uTotal[0]/(luPerfFreq*(u64)frames));
|
||||
fprintf(f, "inc: %Lu\n", 1000000 * uTotal[1]/(luPerfFreq*(u64)frames));
|
||||
|
||||
fiTotalTime[0] = 1.0 / (double)uTotal[0];
|
||||
fiTotalTime[1] = 1.0 / (double)uTotal[1];
|
||||
|
||||
// output the combined times
|
||||
for(it = mapAggregateTimes.begin(); it != mapAggregateTimes.end(); ++it) {
|
||||
fprintf(f, "%s - ex: %f inc: %f\n", it->first.c_str(), (float)((double)it->second.uExclusive * fiTotalTime[0]),
|
||||
(float)((double)it->second.uInclusive * fiTotalTime[1]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
void DVProfClear()
|
||||
{
|
||||
g_listCurTracking.clear();
|
||||
g_listProfilers.clear();
|
||||
g_listAllProfilers.clear();
|
||||
}
|
||||
|
||||
|
||||
#ifdef _WIN32
|
||||
// The one for Linux is in Linux/Linux.cpp
|
||||
void SysMessage(const char* _fmt, ...)
|
||||
{
|
||||
char* Msg = (char*)alloca(strlen(_fmt)+512);
|
||||
va_list ap;
|
||||
|
||||
va_start( ap, _fmt );
|
||||
vsnprintf( Msg, strlen(_fmt)+512, _fmt, ap );
|
||||
va_end( ap );
|
||||
|
||||
g_VideoInitialize.pLog(Msg, FALSE);
|
||||
PanicAlert(Msg);
|
||||
}
|
||||
HANDLE hConsole = NULL;
|
||||
void OpenConsole() {
|
||||
COORD csize;
|
||||
CONSOLE_SCREEN_BUFFER_INFO csbiInfo;
|
||||
SMALL_RECT srect;
|
||||
|
||||
if (hConsole) return;
|
||||
AllocConsole();
|
||||
SetConsoleTitle("Opengl Plugin Output");
|
||||
csize.X = 80;
|
||||
csize.Y = 1024;
|
||||
SetConsoleScreenBufferSize(GetStdHandle(STD_OUTPUT_HANDLE), csize);
|
||||
|
||||
GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &csbiInfo);
|
||||
srect = csbiInfo.srWindow;
|
||||
srect.Right = srect.Left + 79;
|
||||
srect.Bottom = srect.Top + 44;
|
||||
SetConsoleWindowInfo(GetStdHandle(STD_OUTPUT_HANDLE), TRUE, &srect);
|
||||
hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
}
|
||||
|
||||
void CloseConsole() {
|
||||
if (hConsole == NULL) return;
|
||||
FreeConsole(); hConsole = NULL;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
FILE* pfLog = NULL;
|
||||
void __Log(const char *fmt, ...)
|
||||
{
|
||||
char* Msg = (char*)alloca(strlen(fmt)+512);
|
||||
va_list ap;
|
||||
|
||||
va_start( ap, fmt );
|
||||
vsnprintf( Msg, strlen(fmt)+512, fmt, ap );
|
||||
va_end( ap );
|
||||
|
||||
g_VideoInitialize.pLog(Msg, FALSE);
|
||||
|
||||
if( pfLog == NULL ) pfLog = fopen("Logs/oglgfx.txt", "w");
|
||||
|
||||
if( pfLog != NULL )
|
||||
fwrite(Msg, strlen(Msg), 1, pfLog);
|
||||
#ifdef _WIN32
|
||||
DWORD tmp;
|
||||
WriteConsole(hConsole, Msg, (DWORD)strlen(Msg), &tmp, 0);
|
||||
#else
|
||||
//printf("%s", Msg);
|
||||
#endif
|
||||
}
|
||||
|
||||
void __Log(int type, const char *fmt, ...)
|
||||
{
|
||||
char* Msg = (char*)alloca(strlen(fmt)+512);
|
||||
va_list ap;
|
||||
|
||||
va_start( ap, fmt );
|
||||
vsnprintf( Msg, strlen(fmt)+512, fmt, ap );
|
||||
va_end( ap );
|
||||
|
||||
g_VideoInitialize.pLog(Msg, FALSE);
|
||||
|
||||
#ifdef _WIN32
|
||||
DWORD tmp;
|
||||
WriteConsole(hConsole, Msg, (DWORD)strlen(Msg), &tmp, 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -0,0 +1,356 @@
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
// several global utilities not really tied to core emulation
|
||||
#ifndef _GLOBALS_H
|
||||
#define _GLOBALS_H
|
||||
|
||||
#define LOGGING
|
||||
|
||||
#include "Common.h"
|
||||
#include "x64Emitter.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
#include <windows.h>
|
||||
#include <windowsx.h>
|
||||
#include <mmsystem.h>
|
||||
|
||||
#include "resource.h"
|
||||
|
||||
void OpenConsole();
|
||||
void CloseConsole();
|
||||
|
||||
#define GLEW_STATIC
|
||||
|
||||
#include "GL/glew.h"
|
||||
#include "GL/wglew.h"
|
||||
#include "GL/gl.h"
|
||||
#include "GL/glext.h"
|
||||
|
||||
#else // linux basic definitions
|
||||
|
||||
#define ARRAYSIZE(A) (sizeof(A)/sizeof((A)[0]))
|
||||
#define I_NEED_OS2_H // HAXXOR
|
||||
//#include <GL/glew.h>
|
||||
#include <GL/glxew.h>
|
||||
#include <GL/gl.h>
|
||||
//#include <GL/glx.h>
|
||||
#define __inline inline
|
||||
|
||||
#include <sys/timeb.h> // ftime(), struct timeb
|
||||
|
||||
inline unsigned long timeGetTime()
|
||||
{
|
||||
#ifdef _WIN32
|
||||
_timeb t;
|
||||
_ftime(&t);
|
||||
#else
|
||||
timeb t;
|
||||
ftime(&t);
|
||||
#endif
|
||||
|
||||
return (unsigned long)(t.time*1000+t.millitm);
|
||||
}
|
||||
|
||||
struct RECT
|
||||
{
|
||||
int left, top;
|
||||
int right, bottom;
|
||||
};
|
||||
|
||||
#endif // linux basic definitions
|
||||
|
||||
#include <Cg/cg.h>
|
||||
#include <Cg/cgGL.h>
|
||||
|
||||
#ifndef GL_DEPTH24_STENCIL8_EXT // allows FBOs to support stencils
|
||||
#define GL_DEPTH_STENCIL_EXT 0x84F9
|
||||
#define GL_UNSIGNED_INT_24_8_EXT 0x84FA
|
||||
#define GL_DEPTH24_STENCIL8_EXT 0x88F0
|
||||
#define GL_TEXTURE_STENCIL_SIZE_EXT 0x88F1
|
||||
#endif
|
||||
|
||||
// several macros
|
||||
#ifndef SAFE_DELETE_ARRAY
|
||||
#define SAFE_DELETE_ARRAY(x) if( (x) != NULL ) { delete[] (x); (x) = NULL; }
|
||||
#endif
|
||||
#ifndef SAFE_RELEASE
|
||||
#define SAFE_RELEASE(x) if( (x) != NULL ) { (x)->Release(); (x) = NULL; }
|
||||
#endif
|
||||
|
||||
#define SAFE_RELEASE_CGPROG(x) { if( (x) != NULL ) { cgDestroyProgram(x); x = NULL; } }
|
||||
#define SAFE_RELEASE_PROG(x) { if( (x) != 0 ) { glDeleteProgramsARB(1, &(x)); x = 0; } }
|
||||
#define SAFE_RELEASE_TEX(x) { if( (x) != 0 ) { glDeleteTextures(1, &(x)); x = 0; } }
|
||||
#define SAFE_RELEASE_BUF(x) { if( (x) != 0 ) { glDeleteBuffers(1, &(x)); x = 0; } }
|
||||
|
||||
#define FORIT(it, v) for(it = (v).begin(); it != (v).end(); ++(it))
|
||||
|
||||
#define ERROR_LOG __Log
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define INFO_LOG if( g_Config.iLog & 1 ) __Log
|
||||
#define PRIM_LOG if( g_Config.iLog & 2 ) __Log
|
||||
#define DEBUG_LOG __Log
|
||||
#else
|
||||
#define INFO_LOG(...)
|
||||
#define PRIM_LOG(...)
|
||||
#define DEBUG_LOG(...)
|
||||
#endif
|
||||
|
||||
#define GL_REPORT_ERROR() { err = glGetError(); if( err != GL_NO_ERROR ) { ERROR_LOG("%s:%d: gl error 0x%x\n", __FILE__, (int)__LINE__, err); HandleGLError(); } }
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define GL_REPORT_ERRORD() { GLenum err = glGetError(); if( err != GL_NO_ERROR ) { ERROR_LOG("%s:%d: gl error 0x%x\n", __FILE__, (int)__LINE__, err); HandleGLError(); } }
|
||||
#else
|
||||
#define GL_REPORT_ERRORD()
|
||||
#endif
|
||||
|
||||
#ifndef ARRAY_SIZE
|
||||
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
|
||||
#endif
|
||||
|
||||
#define BEGINSAVELOAD char *optr=ptr;
|
||||
#define SAVELOAD(what,size) memcpy((void*)((save)?(void*)(ptr):(void*)(what)),(void*)((save)?(void*)(what):(void*)(ptr)),(size)); ptr+=(size);
|
||||
#define ENDSAVELOAD return ptr-optr;
|
||||
|
||||
struct TEXTUREFMT
|
||||
{
|
||||
TEXTUREFMT(GLenum format, GLenum type) : type(type), format(format) {}
|
||||
GLenum type, format;
|
||||
};
|
||||
|
||||
extern int frameCount;
|
||||
extern int lut3to8[8];
|
||||
extern int lut4to8[16];
|
||||
extern int lut5to8[32];
|
||||
extern int lut6to8[64];
|
||||
extern float lutu8tosfloat[256];
|
||||
extern float lutu8toufloat[256];
|
||||
extern float luts8tosfloat[256];
|
||||
|
||||
#define NUMWNDRES 6
|
||||
extern int g_Res[NUMWNDRES][2];
|
||||
|
||||
#define CONF_LOG 1
|
||||
#define CONF_PRIMLOG 2
|
||||
#define CONF_SAVETEXTURES 4
|
||||
#define CONF_SAVETARGETS 8
|
||||
|
||||
struct Config
|
||||
{
|
||||
Config();
|
||||
void Load();
|
||||
void Save();
|
||||
|
||||
int iAdapter;
|
||||
int iFSResolution;
|
||||
int iMultisampleMode;
|
||||
|
||||
int iPostprocessEffect;
|
||||
int iCompileDLsLevel;
|
||||
|
||||
int iLog; // CONF_ bits
|
||||
bool bFullscreen;
|
||||
bool bWireFrame;
|
||||
bool bOverlayStats;
|
||||
bool bDumpTextures;
|
||||
bool bOldCard;
|
||||
bool bShowShaderErrors;
|
||||
//enhancements
|
||||
bool bForceFiltering;
|
||||
bool bForceMaxAniso;
|
||||
|
||||
bool bPreUpscale;
|
||||
int iPreUpscaleFilter;
|
||||
|
||||
bool bTruform;
|
||||
int iTruformLevel;
|
||||
|
||||
int iWindowedRes;
|
||||
int aa; // anti-aliasing level
|
||||
|
||||
char psProfile[16];
|
||||
char vsProfile[16];
|
||||
|
||||
int iSaveTargetId;
|
||||
|
||||
char texDumpPath[280];
|
||||
};
|
||||
|
||||
extern Config g_Config;
|
||||
|
||||
struct Statistics
|
||||
{
|
||||
int numPrimitives;
|
||||
|
||||
int numPixelShadersCreated;
|
||||
int numPixelShadersAlive;
|
||||
int numVertexShadersCreated;
|
||||
int numVertexShadersAlive;
|
||||
|
||||
int numTexturesCreated;
|
||||
int numTexturesAlive;
|
||||
|
||||
int numRenderTargetsCreated;
|
||||
int numRenderTargetsAlive;
|
||||
|
||||
int numDListsCalled;
|
||||
int numDListsCreated;
|
||||
int numDListsAlive;
|
||||
|
||||
int numJoins;
|
||||
|
||||
struct ThisFrame
|
||||
{
|
||||
int numBPLoads;
|
||||
int numCPLoads;
|
||||
int numXFLoads;
|
||||
|
||||
int numBPLoadsInDL;
|
||||
int numCPLoadsInDL;
|
||||
int numXFLoadsInDL;
|
||||
|
||||
int numDLs;
|
||||
int numDLPrims;
|
||||
int numPrims;
|
||||
int numShaderChanges;
|
||||
int numBadCommands; //hope this always is zero ;)
|
||||
};
|
||||
ThisFrame thisFrame;
|
||||
void ResetFrame();
|
||||
};
|
||||
|
||||
extern Statistics stats;
|
||||
|
||||
#define STATISTICS
|
||||
|
||||
#ifdef STATISTICS
|
||||
#define INCSTAT(a) (a)++;
|
||||
#define ADDSTAT(a,b) (a)+=(b);
|
||||
#define SETSTAT(a,x) (a)=(int)(x);
|
||||
#else
|
||||
#define INCSTAT(a) ;
|
||||
#define ADDSTAT(a,b) ;
|
||||
#define SETSTAT(a,x) ;
|
||||
#endif
|
||||
|
||||
void DebugLog(const char* _fmt, ...);
|
||||
void __Log(const char *format, ...);
|
||||
void __Log(int type, const char *format, ...);
|
||||
void SysMessage(const char *fmt, ...);
|
||||
void HandleGLError();
|
||||
|
||||
void InitLUTs();
|
||||
bool SaveJPEG(const char* filename, int image_width, int image_height, const void* pdata, int quality);
|
||||
bool SaveTGA(const char* filename, int width, int height, void* pdata);
|
||||
bool SaveTexture(const char* filename, u32 textarget, u32 tex, int width, int height);
|
||||
|
||||
#if defined(_MSC_VER) && !defined(__x86_64__) && !defined(_M_X64)
|
||||
void * memcpy_amd(void *dest, const void *src, size_t n);
|
||||
unsigned char memcmp_mmx(const void* src1, const void* src2, int cmpsize);
|
||||
#define memcpy_gc memcpy_amd
|
||||
#define memcmp_gc memcmp_mmx
|
||||
#else
|
||||
#define memcpy_gc memcpy
|
||||
#define memcmp_gc memcmp
|
||||
#endif
|
||||
|
||||
//#define RAM_MASK 0x1FFFFFF
|
||||
|
||||
#include "main.h"
|
||||
|
||||
inline u8 *Memory_GetPtr(u32 _uAddress)
|
||||
{
|
||||
return g_VideoInitialize.pGetMemoryPointer(_uAddress);//&g_pMemory[_uAddress & RAM_MASK];
|
||||
}
|
||||
|
||||
inline u8 Memory_Read_U8(u32 _uAddress)
|
||||
{
|
||||
return *(u8*)g_VideoInitialize.pGetMemoryPointer(_uAddress);//g_pMemory[_uAddress & RAM_MASK];
|
||||
}
|
||||
|
||||
inline u16 Memory_Read_U16(u32 _uAddress)
|
||||
{
|
||||
return Common::swap16(*(u16*)g_VideoInitialize.pGetMemoryPointer(_uAddress));
|
||||
//return _byteswap_ushort(*(u16*)&g_pMemory[_uAddress & RAM_MASK]);
|
||||
}
|
||||
|
||||
inline u32 Memory_Read_U32(u32 _uAddress)
|
||||
{
|
||||
return Common::swap32(*(u32*)g_VideoInitialize.pGetMemoryPointer(_uAddress));
|
||||
//return _byteswap_ulong(*(u32*)&g_pMemory[_uAddress & RAM_MASK]);
|
||||
}
|
||||
|
||||
inline float Memory_Read_Float(u32 _uAddress)
|
||||
{
|
||||
union {u32 i; float f;} temp;
|
||||
temp.i = Memory_Read_U32(_uAddress);
|
||||
return temp.f;
|
||||
}
|
||||
|
||||
////
|
||||
// profiling
|
||||
///
|
||||
|
||||
extern int g_bWriteProfile; // global variable to enable/disable profiling (if DVPROFILE is defined)
|
||||
|
||||
// IMPORTANT: For every Reigster there must be an End
|
||||
void DVProfRegister(const char* pname); // first checks if this profiler exists in g_listProfilers
|
||||
void DVProfEnd(u32 dwUserData);
|
||||
void DVProfWrite(const char* pfilename, u32 frames = 0);
|
||||
void DVProfClear(); // clears all the profilers
|
||||
|
||||
//#define DVPROFILE // comment out to disable profiling
|
||||
|
||||
#if defined(DVPROFILE) && (defined(_WIN32)||defined(WIN32))
|
||||
|
||||
#ifdef _MSC_VER
|
||||
|
||||
#ifndef __PRETTY_FUNCTION__
|
||||
#define __PRETTY_FUNCTION__ __FUNCTION__
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#define DVSTARTPROFILE() DVProfileFunc _pf(__PRETTY_FUNCTION__);
|
||||
|
||||
class DVProfileFunc
|
||||
{
|
||||
public:
|
||||
u32 dwUserData;
|
||||
DVProfileFunc(const char* pname) { DVProfRegister(pname); dwUserData = 0; }
|
||||
DVProfileFunc(const char* pname, u32 dwUserData) : dwUserData(dwUserData) { DVProfRegister(pname); }
|
||||
~DVProfileFunc() { DVProfEnd(dwUserData); }
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
#define DVSTARTPROFILE()
|
||||
|
||||
class DVProfileFunc
|
||||
{
|
||||
public:
|
||||
u32 dwUserData;
|
||||
__forceinline DVProfileFunc(const char* pname) {}
|
||||
__forceinline DVProfileFunc(const char* pname, u32 dwUserData) { }
|
||||
~DVProfileFunc() {}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,104 @@
|
||||
/* GSsoft
|
||||
* Copyright (C) 2002-2004 GSsoft Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include "GS.h"
|
||||
|
||||
extern string s_strIniPath;
|
||||
|
||||
void SaveConfig() {
|
||||
FILE *f;
|
||||
char cfg[255];
|
||||
|
||||
strcpy(cfg, s_strIniPath.c_str());
|
||||
f = fopen(cfg,"w");
|
||||
if (f == NULL) {
|
||||
printf("failed to open %s\n", s_strIniPath.c_str());
|
||||
return;
|
||||
}
|
||||
fprintf(f, "interlace = %x\n", conf.interlace);
|
||||
fprintf(f, "aliasing = %x\n", conf.aa);
|
||||
fprintf(f, "bilinear = %x\n", conf.bilinear);
|
||||
fprintf(f, "options = %x\n", conf.options);
|
||||
fprintf(f, "gamesettings = %x\n", conf.gamesettings);
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
void LoadConfig() {
|
||||
FILE *f;
|
||||
char cfg[255];
|
||||
|
||||
memset(&conf, 0, sizeof(conf));
|
||||
conf.interlace = 0; // on, mode 1
|
||||
conf.mrtdepth = 1;
|
||||
conf.options = 0;
|
||||
conf.bilinear = 1;
|
||||
conf.width = 640;
|
||||
conf.height = 480;
|
||||
|
||||
strcpy(cfg, s_strIniPath.c_str());
|
||||
f = fopen(cfg, "r");
|
||||
if (f == NULL) {
|
||||
printf("failed to open %s\n", s_strIniPath.c_str());
|
||||
SaveConfig();//save and return
|
||||
return;
|
||||
}
|
||||
fscanf(f, "interlace = %x\n", &conf.interlace);
|
||||
fscanf(f, "aliasing = %x\n", &conf.aa);
|
||||
fscanf(f, "bilinear = %x\n", &conf.bilinear);
|
||||
fscanf(f, "options = %x\n", &conf.options);
|
||||
fscanf(f, "gamesettings = %x\n", &conf.gamesettings);
|
||||
fclose(f);
|
||||
|
||||
// filter bad files
|
||||
if( conf.aa < 0 || conf.aa > 2 ) conf.aa = 0;
|
||||
|
||||
switch(conf.options&GSOPTION_WINDIMS) {
|
||||
case GSOPTION_WIN640:
|
||||
conf.width = 640;
|
||||
conf.height = 480;
|
||||
break;
|
||||
case GSOPTION_WIN800:
|
||||
conf.width = 800;
|
||||
conf.height = 600;
|
||||
break;
|
||||
case GSOPTION_WIN1024:
|
||||
conf.width = 1024;
|
||||
conf.height = 768;
|
||||
break;
|
||||
case GSOPTION_WIN1280:
|
||||
conf.width = 1280;
|
||||
conf.height = 960;
|
||||
break;
|
||||
}
|
||||
|
||||
// turn off all hacks by defaultof
|
||||
conf.options &= ~(GSOPTION_FULLSCREEN|GSOPTION_WIREFRAME|GSOPTION_CAPTUREAVI);
|
||||
conf.options |= GSOPTION_LOADED;
|
||||
|
||||
if( conf.width <= 0 || conf.height <= 0 ) {
|
||||
conf.width = 640;
|
||||
conf.height = 480;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,433 @@
|
||||
/* ZeroGS
|
||||
* Copyright (C) 2002-2004 GSsoft Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include <dlfcn.h>
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
/*
|
||||
extern "C" {
|
||||
#include "interface.h"
|
||||
#include "support.h"
|
||||
#include "callbacks.h"
|
||||
}*/
|
||||
|
||||
#include "Linux.h"
|
||||
#include "Common.h"
|
||||
|
||||
#define CALLBACK
|
||||
|
||||
#include <map>
|
||||
|
||||
static int prevbilinearfilter;
|
||||
//static map<string, int> mapConfOpts;
|
||||
struct confOptsStruct{
|
||||
int value;
|
||||
char *desc;
|
||||
}confOpts;
|
||||
|
||||
static std::map<std::string, confOptsStruct> mapConfOpts;
|
||||
|
||||
/*
|
||||
extern void OnKeyboardF5(int);
|
||||
extern void OnKeyboardF6(int);
|
||||
extern void OnKeyboardF7(int);
|
||||
extern void OnKeyboardF9(int);
|
||||
|
||||
void CALLBACK GSkeyEvent(keyEvent *ev)
|
||||
{
|
||||
static bool bShift = false;
|
||||
static bool bAlt = false;
|
||||
|
||||
switch(ev->event) {
|
||||
case KEYPRESS:
|
||||
switch(ev->key) {
|
||||
case XK_F5:
|
||||
OnKeyboardF5(bShift);
|
||||
break;
|
||||
case XK_F6:
|
||||
OnKeyboardF6(bShift);
|
||||
break;
|
||||
case XK_F7:
|
||||
OnKeyboardF7(bShift);
|
||||
break;
|
||||
case XK_F9:
|
||||
OnKeyboardF9(bShift);
|
||||
break;
|
||||
case XK_Escape:
|
||||
break;
|
||||
case XK_Shift_L:
|
||||
case XK_Shift_R:
|
||||
bShift = true;
|
||||
break;
|
||||
case XK_Alt_L:
|
||||
case XK_Alt_R:
|
||||
bAlt = true;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case KEYRELEASE:
|
||||
switch(ev->key) {
|
||||
case XK_Shift_L:
|
||||
case XK_Shift_R:
|
||||
bShift = false;
|
||||
break;
|
||||
case XK_Alt_L:
|
||||
case XK_Alt_R:
|
||||
bAlt = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
GtkWidget *Conf;
|
||||
GtkWidget *Logging;
|
||||
GList *fresl;
|
||||
GList *wresl;
|
||||
GList *cachesizel;
|
||||
GList *codecl;
|
||||
GList *filtersl;
|
||||
|
||||
void OnConf_Ok(GtkButton *button, gpointer user_data)
|
||||
{
|
||||
GtkWidget *Btn;
|
||||
GtkWidget *treeview;
|
||||
GtkTreeModel *treemodel;
|
||||
GtkTreeIter treeiter;
|
||||
gboolean treeoptval;
|
||||
gchar *gbuf;
|
||||
char *str;
|
||||
int i;
|
||||
/*
|
||||
u32 newinterlace = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(Conf, "checkInterlace")));
|
||||
|
||||
if( !conf.interlace ) conf.interlace = newinterlace;
|
||||
else if( !newinterlace ) conf.interlace = 2; // off
|
||||
|
||||
conf.bilinear = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(Conf, "checkBilinear")));
|
||||
// restore
|
||||
if( conf.bilinear && prevbilinearfilter )
|
||||
conf.bilinear = prevbilinearfilter;
|
||||
|
||||
//conf.mrtdepth = 1;//IsDlgButtonChecked(hW, IDC_CONFIG_DEPTHWRITE);
|
||||
|
||||
if( gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(Conf, "radioAANone"))) ) {
|
||||
conf.aa = 0;
|
||||
}
|
||||
else if( gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(Conf, "radioAA2X"))) ) {
|
||||
conf.aa = 1;
|
||||
}
|
||||
else conf.aa = 2;
|
||||
|
||||
conf.options = 0;
|
||||
conf.options |= gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(Conf, "checkAVI"))) ? GSOPTION_CAPTUREAVI : 0;
|
||||
conf.options |= gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(Conf, "checkWireframe"))) ? GSOPTION_WIREFRAME : 0;
|
||||
conf.options |= gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(Conf, "checkbutton6"))) ? GSOPTION_FULLSCREEN : 0;
|
||||
conf.options |= gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(Conf, "checkTGA"))) ? GSOPTION_TGASNAP : 0;
|
||||
|
||||
//------- get advanced options from the treeview model -------//
|
||||
treeview = lookup_widget(Conf,"treeview1");
|
||||
treemodel = gtk_tree_view_get_model(GTK_TREE_VIEW(treeview));
|
||||
gtk_tree_model_get_iter_first(treemodel, &treeiter);
|
||||
|
||||
conf.gamesettings = 0;
|
||||
for(map<string, confOptsStruct>::iterator it = mapConfOpts.begin(); it != mapConfOpts.end(); ++it) {
|
||||
treeoptval = FALSE;
|
||||
gtk_tree_model_get(treemodel, &treeiter,
|
||||
0, &treeoptval,
|
||||
-1);
|
||||
if(treeoptval){
|
||||
conf.gamesettings |= it->second.value;
|
||||
}
|
||||
gtk_tree_model_iter_next(treemodel,&treeiter);
|
||||
}
|
||||
GSsetGameCRC(0, conf.gamesettings);
|
||||
//---------- done getting advanced options ---------//
|
||||
|
||||
if( gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(Conf, "radioSize640"))) )
|
||||
conf.options |= GSOPTION_WIN640;
|
||||
else if( gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(Conf, "radioSize800"))) )
|
||||
conf.options |= GSOPTION_WIN800;
|
||||
else if( gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(Conf, "radioSize1024"))) )
|
||||
conf.options |= GSOPTION_WIN1024;
|
||||
else if( gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(Conf, "radioSize1280"))) )
|
||||
conf.options |= GSOPTION_WIN1280;
|
||||
|
||||
SaveConfig();
|
||||
|
||||
gtk_widget_destroy(Conf);
|
||||
gtk_main_quit();
|
||||
*/
|
||||
}
|
||||
|
||||
void OnConf_Cancel(GtkButton *button, gpointer user_data) {
|
||||
gtk_widget_destroy(Conf);
|
||||
gtk_main_quit();
|
||||
}
|
||||
|
||||
void CALLBACK GSconfigure()
|
||||
{
|
||||
char name[32];
|
||||
char descbuf[255];
|
||||
int nmodes, i;
|
||||
bool itval;
|
||||
GtkWidget *treeview;
|
||||
GtkCellRenderer *treerend;
|
||||
GtkListStore *treestore;//Gets typecast as GtkTreeModel as needed.
|
||||
GtkTreeIter treeiter;
|
||||
GtkTreeViewColumn *treecol;
|
||||
/*
|
||||
if( !(conf.options & GSOPTION_LOADED) )
|
||||
LoadConfig();
|
||||
|
||||
Conf = create_Config();
|
||||
|
||||
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(lookup_widget(Conf, "checkBilinear")), !!conf.bilinear);
|
||||
//gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(lookup_widget(Conf, "checkbutton6")), conf.mrtdepth);
|
||||
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(lookup_widget(Conf, "radioAANone")), conf.aa==0);
|
||||
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(lookup_widget(Conf, "radioAA2X")), conf.aa==1);
|
||||
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(lookup_widget(Conf, "radioAA4X")), conf.aa==2);
|
||||
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(lookup_widget(Conf, "checkWireframe")), (conf.options&GSOPTION_WIREFRAME)?1:0);
|
||||
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(lookup_widget(Conf, "checkAVI")), (conf.options&GSOPTION_CAPTUREAVI)?1:0);
|
||||
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(lookup_widget(Conf, "checkbutton6")), (conf.options&GSOPTION_FULLSCREEN)?1:0);
|
||||
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(lookup_widget(Conf, "checkTGA")), (conf.options&GSOPTION_TGASNAP)?1:0);
|
||||
|
||||
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(lookup_widget(Conf, "radioSize640")), ((conf.options&GSOPTION_WINDIMS)>>4)==0);
|
||||
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(lookup_widget(Conf, "radioSize800")), ((conf.options&GSOPTION_WINDIMS)>>4)==1);
|
||||
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(lookup_widget(Conf, "radioSize1024")), ((conf.options&GSOPTION_WINDIMS)>>4)==2);
|
||||
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(lookup_widget(Conf, "radioSize1280")), ((conf.options&GSOPTION_WINDIMS)>>4)==3);
|
||||
|
||||
prevbilinearfilter = conf.bilinear;
|
||||
|
||||
//--------- Let's build a treeview for our advanced options! --------//
|
||||
treeview = lookup_widget(Conf,"treeview1");
|
||||
treestore = gtk_list_store_new(2,G_TYPE_BOOLEAN, G_TYPE_STRING);
|
||||
|
||||
//setup columns in treeview
|
||||
//COLUMN 0 is the checkboxes
|
||||
treecol = gtk_tree_view_column_new();
|
||||
gtk_tree_view_column_set_title(treecol, "Select");
|
||||
gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), treecol);
|
||||
treerend = gtk_cell_renderer_toggle_new();
|
||||
gtk_tree_view_column_pack_start(treecol, treerend, TRUE);
|
||||
gtk_tree_view_column_add_attribute(treecol, treerend, "active", 0);//link 'active' attrib to first column of model
|
||||
g_object_set(treerend, "activatable", TRUE, NULL);//set 'activatable' attrib true by default for all rows regardless of model.
|
||||
g_signal_connect(treerend, "toggled", (GCallback) OnToggle_advopts, treestore);//set a global callback, we also pass a reference to our treestore.
|
||||
|
||||
//COLUMN 1 is the text descriptions
|
||||
treecol = gtk_tree_view_column_new();
|
||||
gtk_tree_view_column_set_title(treecol, "Description");
|
||||
gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), treecol);
|
||||
treerend = gtk_cell_renderer_text_new();
|
||||
gtk_tree_view_column_pack_start(treecol, treerend, TRUE);
|
||||
gtk_tree_view_column_add_attribute(treecol, treerend, "text", 1);//link 'text' attrib to second column of model
|
||||
|
||||
//setup the model with all our rows of option data
|
||||
mapConfOpts.clear();
|
||||
confOpts.value = 0x00000001;
|
||||
confOpts.desc = "Tex Target checking - 00000001\nLego Racers";
|
||||
mapConfOpts["00000001"] = confOpts;
|
||||
confOpts.value = 0x00000002;
|
||||
confOpts.desc = "Auto reset targs - 00000002\nShadow Hearts, Samurai Warriors. Use when game is slow and toggling AA fixes it.";
|
||||
mapConfOpts["00000002"] = confOpts;
|
||||
confOpts.value = 0x00000004;
|
||||
confOpts.desc = "Interlace 2X - 00000004\nFixes 2x bigger screen (Gradius 3).";
|
||||
mapConfOpts["00000004"] = confOpts;
|
||||
confOpts.value = 0x00000008;
|
||||
confOpts.desc = "Text Alpha hack - 00000008\nNightmare Before Christmas.";
|
||||
mapConfOpts["00000008"] = confOpts;
|
||||
confOpts.value = 0x00000010;
|
||||
confOpts.desc = "No target resolves - 00000010\nStops all resolving of targets. Try this first for really slow games.";
|
||||
mapConfOpts["00000010"] = confOpts;
|
||||
confOpts.value = 0x00000020;
|
||||
confOpts.desc = "Exact color testing - 00000020\nFixes overbright or shadow/black artifacts (Crash 'n Burn).";
|
||||
mapConfOpts["00000020"] = confOpts;
|
||||
confOpts.value = 0x00000040;
|
||||
confOpts.desc = "No color clamping - 00000040\nSpeeds up games, but might be too bright or too dim.";
|
||||
mapConfOpts["00000040"] = confOpts;
|
||||
confOpts.value = 0x00000080;
|
||||
confOpts.desc = "FFX hack - 00000080\nShows missing geometry.";
|
||||
mapConfOpts["00000080"] = confOpts;
|
||||
confOpts.value = 0x00000200;
|
||||
confOpts.desc = "Disable depth updates - 00000200";
|
||||
mapConfOpts["00000200"] = confOpts;
|
||||
confOpts.value = 0x00000400;
|
||||
confOpts.desc = "Resolve Hack #1 - 00000400\nKingdom Hearts. Speeds some games.";
|
||||
mapConfOpts["00000400"] = confOpts;
|
||||
confOpts.value = 0x00000800;
|
||||
confOpts.desc = "Resolve Hack #2 - 00000800\nShadow Hearts, Urbz.";
|
||||
mapConfOpts["00000800"] = confOpts;
|
||||
confOpts.value = 0x00001000;
|
||||
confOpts.desc = "No target CLUT - 00001000\nResident Evil 4, or foggy scenes.";
|
||||
mapConfOpts["00001000"] = confOpts;
|
||||
confOpts.value = 0x00002000;
|
||||
confOpts.desc = "Disable stencil buffer - 00002000\nUsually safe to do for simple scenes.";
|
||||
mapConfOpts["00002000"] = confOpts;
|
||||
confOpts.value = 0x00004000;
|
||||
confOpts.desc = "No vertical stripes - 00004000\nTry when there's a lot of garbage on screen.";
|
||||
mapConfOpts["00004000"] = confOpts;
|
||||
confOpts.value = 0x00008000;
|
||||
confOpts.desc = "No depth resolve - 00008000\nMight give z buffer artifacts.";
|
||||
mapConfOpts["00008000"] = confOpts;
|
||||
confOpts.value = 0x00010000;
|
||||
confOpts.desc = "Full 16 bit resolution - 00010000\nUse when half the screen is missing.";
|
||||
mapConfOpts["00010000"] = confOpts;
|
||||
confOpts.value = 0x00020000;
|
||||
confOpts.desc = "Resolve Hack #3 - 00020000\nNeopets";
|
||||
mapConfOpts["00020000"] = confOpts;
|
||||
confOpts.value = 0x00040000;
|
||||
confOpts.desc = "Fast Update - 00040000\nOkami. Speeds some games.";
|
||||
mapConfOpts["00040000"] = confOpts;
|
||||
confOpts.value = 0x00080000;
|
||||
confOpts.desc = "Disable alpha testing - 00080000";
|
||||
mapConfOpts["00080000"] = confOpts;
|
||||
confOpts.value = 0x00100000;
|
||||
confOpts.desc = "Disable Multiple RTs - 00100000";
|
||||
mapConfOpts["00100000"] = confOpts;
|
||||
confOpts.value = 0x00200000;
|
||||
confOpts.desc = "32 bit render targets - 00200000";
|
||||
mapConfOpts["00200000"] = confOpts;
|
||||
|
||||
for(map<string, confOptsStruct>::iterator it = mapConfOpts.begin(); it != mapConfOpts.end(); ++it) {
|
||||
gtk_list_store_append(treestore, &treeiter);//new row
|
||||
itval = (conf.gamesettings&it->second.value)?TRUE:FALSE;
|
||||
snprintf(descbuf, 254, "%s", it->second.desc);
|
||||
gtk_list_store_set(treestore, &treeiter,
|
||||
0, itval,
|
||||
1, descbuf,
|
||||
-1);
|
||||
}
|
||||
|
||||
gtk_tree_view_set_model(GTK_TREE_VIEW(treeview), GTK_TREE_MODEL(treestore));//NB: store is cast as tree model.
|
||||
g_object_unref(treestore);//allow model to be destroyed when the tree is destroyed.
|
||||
|
||||
//don't select/highlight rows
|
||||
gtk_tree_selection_set_mode(gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview)), GTK_SELECTION_NONE);
|
||||
//------treeview done -------//
|
||||
*/
|
||||
//Let's do it!
|
||||
gtk_widget_show_all(Conf);
|
||||
gtk_main();
|
||||
}
|
||||
|
||||
void OnToggle_advopts(GtkCellRendererToggle *cell, gchar *path, gpointer user_data){
|
||||
GtkTreeIter treeiter;
|
||||
gboolean val;
|
||||
|
||||
gtk_tree_model_get_iter_from_string(GTK_TREE_MODEL(user_data), &treeiter, path);
|
||||
gtk_tree_model_get(GTK_TREE_MODEL(user_data), &treeiter,
|
||||
0, &val,
|
||||
-1);
|
||||
val = !val;
|
||||
gtk_list_store_set(GTK_LIST_STORE(user_data), &treeiter,
|
||||
0, val,
|
||||
-1);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
GtkWidget *About;
|
||||
|
||||
void OnAbout_Ok(GtkButton *button, gpointer user_data) {
|
||||
gtk_widget_destroy(About);
|
||||
gtk_main_quit();
|
||||
}
|
||||
|
||||
void CALLBACK GSabout() {
|
||||
|
||||
//About = create_About();
|
||||
|
||||
//gtk_widget_show_all(About);
|
||||
//gtk_main();
|
||||
}
|
||||
|
||||
s32 CALLBACK GStest() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
GtkWidget *MsgDlg;
|
||||
|
||||
void OnMsg_Ok() {
|
||||
gtk_widget_destroy(MsgDlg);
|
||||
gtk_main_quit();
|
||||
}
|
||||
|
||||
void SysMessage(const char *fmt, ...) {
|
||||
GtkWidget *Ok,*Txt;
|
||||
GtkWidget *Box,*Box1;
|
||||
va_list list;
|
||||
char msg[512];
|
||||
|
||||
va_start(list, fmt);
|
||||
vsprintf(msg, fmt, list);
|
||||
va_end(list);
|
||||
|
||||
if (msg[strlen(msg)-1] == '\n') msg[strlen(msg)-1] = 0;
|
||||
|
||||
MsgDlg = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_position(GTK_WINDOW(MsgDlg), GTK_WIN_POS_CENTER);
|
||||
gtk_window_set_title(GTK_WINDOW(MsgDlg), "GSsoft Msg");
|
||||
gtk_container_set_border_width(GTK_CONTAINER(MsgDlg), 5);
|
||||
|
||||
Box = gtk_vbox_new(5, 0);
|
||||
gtk_container_add(GTK_CONTAINER(MsgDlg), Box);
|
||||
gtk_widget_show(Box);
|
||||
|
||||
Txt = gtk_label_new(msg);
|
||||
|
||||
gtk_box_pack_start(GTK_BOX(Box), Txt, FALSE, FALSE, 5);
|
||||
gtk_widget_show(Txt);
|
||||
|
||||
Box1 = gtk_hbutton_box_new();
|
||||
gtk_box_pack_start(GTK_BOX(Box), Box1, FALSE, FALSE, 0);
|
||||
gtk_widget_show(Box1);
|
||||
|
||||
Ok = gtk_button_new_with_label("Ok");
|
||||
gtk_signal_connect (GTK_OBJECT(Ok), "clicked", GTK_SIGNAL_FUNC(OnMsg_Ok), NULL);
|
||||
gtk_container_add(GTK_CONTAINER(Box1), Ok);
|
||||
GTK_WIDGET_SET_FLAGS(Ok, GTK_CAN_DEFAULT);
|
||||
gtk_widget_show(Ok);
|
||||
|
||||
gtk_widget_show(MsgDlg);
|
||||
|
||||
gtk_main();
|
||||
}
|
||||
|
||||
void *SysLoadLibrary(char *lib) {
|
||||
return dlopen(lib, RTLD_NOW | RTLD_GLOBAL);
|
||||
}
|
||||
|
||||
void *SysLoadSym(void *lib, char *sym) {
|
||||
void *ret = dlsym(lib, sym);
|
||||
if (ret == NULL) printf("null: %s\n", sym);
|
||||
return dlsym(lib, sym);
|
||||
}
|
||||
|
||||
char *SysLibError() {
|
||||
return dlerror();
|
||||
}
|
||||
|
||||
void SysCloseLibrary(void *lib) {
|
||||
dlclose(lib);
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Copyright (C) 2002-2004 GSsoft Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef __LINUX_H__
|
||||
#define __LINUX_H__
|
||||
#endif
|
||||
|
||||
void OnToggle_advopts(GtkCellRendererToggle *cell, gchar *path, gpointer user_data);
|
||||
@@ -0,0 +1,674 @@
|
||||
<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
|
||||
<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
|
||||
|
||||
<glade-interface>
|
||||
|
||||
<widget class="GtkWindow" id="Config">
|
||||
<property name="border_width">5</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="title" translatable="yes">ZeroOGS Configuration</property>
|
||||
<property name="type">GTK_WINDOW_TOPLEVEL</property>
|
||||
<property name="window_position">GTK_WIN_POS_NONE</property>
|
||||
<property name="modal">False</property>
|
||||
<property name="resizable">True</property>
|
||||
<property name="destroy_with_parent">False</property>
|
||||
<property name="decorated">True</property>
|
||||
<property name="skip_taskbar_hint">False</property>
|
||||
<property name="skip_pager_hint">False</property>
|
||||
<property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
|
||||
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
|
||||
<property name="focus_on_map">True</property>
|
||||
<property name="urgency_hint">False</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkVBox" id="vbox4">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkCheckButton" id="checkInterlace">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Interlace Enable (toggle with F5)
|
||||
there are 2 modes + interlace off</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<property name="active">False</property>
|
||||
<property name="inconsistent">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkCheckButton" id="checkBilinear">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Bilinear Filtering (Shift+F5)
|
||||
Best quality is on, turn off for speed</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<property name="active">False</property>
|
||||
<property name="inconsistent">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkFrame" id="frame4">
|
||||
<property name="visible">True</property>
|
||||
<property name="label_xalign">0</property>
|
||||
<property name="label_yalign">0.5</property>
|
||||
<property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkAlignment" id="alignment1">
|
||||
<property name="visible">True</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xscale">1</property>
|
||||
<property name="yscale">1</property>
|
||||
<property name="top_padding">0</property>
|
||||
<property name="bottom_padding">0</property>
|
||||
<property name="left_padding">12</property>
|
||||
<property name="right_padding">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox6">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">True</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkRadioButton" id="radioAANone">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">None</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<property name="active">True</property>
|
||||
<property name="inconsistent">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkRadioButton" id="radioAA2X">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">2X</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<property name="active">False</property>
|
||||
<property name="inconsistent">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<property name="group">radioAANone</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkRadioButton" id="radioAA4X">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">4X</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<property name="active">False</property>
|
||||
<property name="inconsistent">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<property name="group">radioAANone</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label9">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes"><b>Anti-aliasing for higher quality (F6)</b></property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">True</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
|
||||
<property name="width_chars">-1</property>
|
||||
<property name="single_line_mode">False</property>
|
||||
<property name="angle">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="type">label_item</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkCheckButton" id="checkWireframe">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Wireframe rendering (Shift+F6)</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<property name="active">False</property>
|
||||
<property name="inconsistent">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkCheckButton" id="checkAVI">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Capture Avi (zerogs.avi)(F7)</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<property name="active">False</property>
|
||||
<property name="inconsistent">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkCheckButton" id="checkTGA">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Save Snapshots as TGAs (default is JPG)</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<property name="active">False</property>
|
||||
<property name="inconsistent">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkCheckButton" id="checkbutton6">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Fullscreen (Alt+Enter)
|
||||
to get out press Alt+Enter again (or ESC)</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<property name="active">False</property>
|
||||
<property name="inconsistent">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkFrame" id="frame5">
|
||||
<property name="visible">True</property>
|
||||
<property name="label_xalign">0</property>
|
||||
<property name="label_yalign">0.5</property>
|
||||
<property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkAlignment" id="alignment2">
|
||||
<property name="visible">True</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xscale">1</property>
|
||||
<property name="yscale">1</property>
|
||||
<property name="top_padding">0</property>
|
||||
<property name="bottom_padding">0</property>
|
||||
<property name="left_padding">12</property>
|
||||
<property name="right_padding">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox7">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">True</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkRadioButton" id="radioSize640">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">640x480</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<property name="active">False</property>
|
||||
<property name="inconsistent">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkRadioButton" id="radioSize800">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">800x600</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<property name="active">True</property>
|
||||
<property name="inconsistent">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<property name="group">radioSize640</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkRadioButton" id="radioSize1024">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">1024x768</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<property name="active">False</property>
|
||||
<property name="inconsistent">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<property name="group">radioSize640</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkRadioButton" id="radioSize1280">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">1280x960</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<property name="active">False</property>
|
||||
<property name="inconsistent">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<property name="group">radioSize640</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label10">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes"><b>Default Window Size (no speed impact)</b></property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">True</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
|
||||
<property name="width_chars">-1</property>
|
||||
<property name="single_line_mode">False</property>
|
||||
<property name="angle">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="type">label_item</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkFrame" id="frame6">
|
||||
<property name="visible">True</property>
|
||||
<property name="label_xalign">0</property>
|
||||
<property name="label_yalign">0.5</property>
|
||||
<property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkAlignment" id="alignment3">
|
||||
<property name="visible">True</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xscale">1</property>
|
||||
<property name="yscale">1</property>
|
||||
<property name="top_padding">0</property>
|
||||
<property name="bottom_padding">0</property>
|
||||
<property name="left_padding">12</property>
|
||||
<property name="right_padding">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkScrolledWindow" id="scrolledwindow1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
||||
<property name="vscrollbar_policy">GTK_POLICY_ALWAYS</property>
|
||||
<property name="shadow_type">GTK_SHADOW_IN</property>
|
||||
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkTreeView" id="treeview1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="headers_visible">True</property>
|
||||
<property name="rules_hint">False</property>
|
||||
<property name="reorderable">False</property>
|
||||
<property name="enable_search">True</property>
|
||||
<property name="fixed_height_mode">False</property>
|
||||
<property name="hover_selection">False</property>
|
||||
<property name="hover_expand">False</property>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label12">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes"><b>Advanced Options</b></property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">True</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
|
||||
<property name="width_chars">-1</property>
|
||||
<property name="single_line_mode">False</property>
|
||||
<property name="angle">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="type">label_item</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label11">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Show Frames Per Second (Shift+F7)
|
||||
(value is the average over 4-16 PS2 frames)</property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
|
||||
<property name="width_chars">-1</property>
|
||||
<property name="single_line_mode">False</property>
|
||||
<property name="angle">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkHButtonBox" id="hbuttonbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="layout_style">GTK_BUTTONBOX_SPREAD</property>
|
||||
<property name="spacing">30</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkButton" id="button1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Ok</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<signal name="clicked" handler="OnConf_Ok"/>
|
||||
</widget>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkButton" id="button2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Cancel</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<signal name="clicked" handler="OnConf_Cancel"/>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget class="GtkWindow" id="About">
|
||||
<property name="border_width">5</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="title" translatable="yes">ZeroGS KOSMOS About</property>
|
||||
<property name="type">GTK_WINDOW_TOPLEVEL</property>
|
||||
<property name="window_position">GTK_WIN_POS_NONE</property>
|
||||
<property name="modal">False</property>
|
||||
<property name="resizable">True</property>
|
||||
<property name="destroy_with_parent">False</property>
|
||||
<property name="decorated">True</property>
|
||||
<property name="skip_taskbar_hint">False</property>
|
||||
<property name="skip_pager_hint">False</property>
|
||||
<property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
|
||||
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
|
||||
<property name="focus_on_map">True</property>
|
||||
<property name="urgency_hint">False</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkVBox" id="vbox2">
|
||||
<property name="border_width">5</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">5</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label2">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">OpenGL version</property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_CENTER</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
|
||||
<property name="width_chars">-1</property>
|
||||
<property name="single_line_mode">False</property>
|
||||
<property name="angle">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label3">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Author: zerofrog(@gmail.com)</property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
|
||||
<property name="width_chars">-1</property>
|
||||
<property name="single_line_mode">False</property>
|
||||
<property name="angle">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label4">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Many thanks to the Pcsx2 testing team</property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
|
||||
<property name="width_chars">-1</property>
|
||||
<property name="single_line_mode">False</property>
|
||||
<property name="angle">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkHButtonBox" id="hbuttonbox2">
|
||||
<property name="visible">True</property>
|
||||
<property name="layout_style">GTK_BUTTONBOX_DEFAULT_STYLE</property>
|
||||
<property name="spacing">30</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkButton" id="button3">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Ok</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<signal name="clicked" handler="OnAbout_Ok"/>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
</glade-interface>
|
||||
@@ -0,0 +1,280 @@
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
//DL facts:
|
||||
// Ikaruga uses NO display lists!
|
||||
// Zelda WW uses TONS of display lists
|
||||
// Zelda TP uses almost 100% display lists except menus (we like this!)
|
||||
|
||||
// Note that it IS NOT POSSIBLE to precompile display lists! You can compile them as they are
|
||||
// and hope that the vertex format doesn't change, though, if you do it just when they are
|
||||
// called. The reason is that the vertex format affects the sizes of the vertices.
|
||||
|
||||
#include "Globals.h"
|
||||
#include "OpcodeDecoding.h"
|
||||
#include "VertexLoader.h"
|
||||
#include "VertexShader.h"
|
||||
#include "TextureMngr.h"
|
||||
|
||||
#include "BPStructs.h"
|
||||
#include "DataReader.h"
|
||||
|
||||
#define CMDBUFFER_SIZE 1024*1024
|
||||
void Decode();
|
||||
|
||||
extern u8 FAKE_PeekFifo8(u32 _uOffset);
|
||||
extern u16 FAKE_PeekFifo16(u32 _uOffset);
|
||||
extern u32 FAKE_PeekFifo32(u32 _uOffset);
|
||||
extern int FAKE_GetFifoSize();
|
||||
|
||||
CDataReader_Fifo g_fifoReader;
|
||||
|
||||
void ExecuteDisplayList(u32 address, u32 size)
|
||||
{
|
||||
IDataReader* pOldReader = g_pDataReader;
|
||||
|
||||
//address &= 0x01FFFFFF; // phys address
|
||||
CDataReader_Memory memoryReader(address);
|
||||
g_pDataReader = &memoryReader;
|
||||
|
||||
while((memoryReader.GetReadAddress() - address) < size)
|
||||
{
|
||||
Decode();
|
||||
}
|
||||
INCSTAT(stats.numDListsAlive);
|
||||
// reset to the old reader
|
||||
g_pDataReader = pOldReader;
|
||||
}
|
||||
|
||||
inline u8 PeekFifo8(u32 _uOffset)
|
||||
{
|
||||
return FAKE_PeekFifo8(_uOffset);
|
||||
}
|
||||
|
||||
inline u16 PeekFifo16(u32 _uOffset)
|
||||
{
|
||||
return FAKE_PeekFifo16(_uOffset);
|
||||
}
|
||||
|
||||
inline u32 PeekFifo32(u32 _uOffset)
|
||||
{
|
||||
return FAKE_PeekFifo32(_uOffset);
|
||||
}
|
||||
|
||||
|
||||
bool FifoCommandRunnable(void)
|
||||
{
|
||||
u32 iBufferSize = FAKE_GetFifoSize();
|
||||
if (iBufferSize == 0)
|
||||
return false;
|
||||
|
||||
u8 Cmd = PeekFifo8(0);
|
||||
u32 iCommandSize = 0;
|
||||
|
||||
switch(Cmd)
|
||||
{
|
||||
case GX_NOP:
|
||||
// Hm, this means that we scan over nop streams pretty slowly...
|
||||
iCommandSize = 1;
|
||||
break;
|
||||
|
||||
case GX_LOAD_CP_REG:
|
||||
iCommandSize = 6;
|
||||
break;
|
||||
|
||||
case GX_LOAD_INDX_A:
|
||||
case GX_LOAD_INDX_B:
|
||||
case GX_LOAD_INDX_C:
|
||||
case GX_LOAD_INDX_D:
|
||||
iCommandSize = 5;
|
||||
break;
|
||||
|
||||
case GX_CMD_CALL_DL:
|
||||
iCommandSize = 9;
|
||||
break;
|
||||
|
||||
case 0x44:
|
||||
iCommandSize = 1;
|
||||
// zelda 4 swords calls it and checks the metrics registers after that
|
||||
break;
|
||||
|
||||
case GX_CMD_INVL_VC: // invalid vertex cache - no parameter?
|
||||
iCommandSize = 1;
|
||||
break;
|
||||
|
||||
case GX_LOAD_BP_REG:
|
||||
iCommandSize = 5;
|
||||
break;
|
||||
|
||||
case GX_LOAD_XF_REG:
|
||||
{
|
||||
// check if we can read the header
|
||||
if (iBufferSize >= 5) {
|
||||
iCommandSize = 1 + 4;
|
||||
u32 Cmd2 = PeekFifo32(1);
|
||||
int dwTransferSize = ((Cmd2>>16)&15) + 1;
|
||||
iCommandSize += dwTransferSize * 4;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
if (Cmd&0x80)
|
||||
{
|
||||
// check if we can read the header
|
||||
if (iBufferSize >= 3) {
|
||||
iCommandSize = 1 + 2;
|
||||
u16 numVertices = PeekFifo16(1);
|
||||
VertexLoader& vtxLoader = g_VertexLoaders[Cmd & GX_VAT_MASK];
|
||||
iCommandSize += numVertices * vtxLoader.ComputeVertexSize();
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
char szTemp[512];
|
||||
sprintf(szTemp, "Error: Unknown Opcode (0x%x)", Cmd);
|
||||
SysMessage(szTemp);
|
||||
g_VideoInitialize.pLog(szTemp, TRUE);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (iCommandSize > iBufferSize)
|
||||
return false;
|
||||
|
||||
INFO_LOG("OP detected: Cmd 0x%x size %i buffer %i",Cmd, iCommandSize, iBufferSize);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void Decode(void)
|
||||
{
|
||||
int Cmd = g_pDataReader->Read8();
|
||||
switch(Cmd)
|
||||
{
|
||||
case GX_NOP:
|
||||
break;
|
||||
|
||||
case GX_LOAD_CP_REG: //0x08
|
||||
{
|
||||
u32 SubCmd = g_pDataReader->Read8();
|
||||
u32 Value = g_pDataReader->Read32();
|
||||
VertexManager::LoadCPReg(SubCmd,Value);
|
||||
}
|
||||
break;
|
||||
|
||||
case GX_LOAD_XF_REG:
|
||||
{
|
||||
u32 Cmd2 = g_pDataReader->Read32();
|
||||
|
||||
int dwTransferSize = ((Cmd2>>16)&15) + 1;
|
||||
DWORD dwAddress = Cmd2 & 0xFFFF;
|
||||
static u32 pData[16];
|
||||
for (int i=0; i<dwTransferSize; i++)
|
||||
pData[i] = g_pDataReader->Read32();
|
||||
VertexShaderMngr::LoadXFReg(dwTransferSize,dwAddress,pData);
|
||||
}
|
||||
break;
|
||||
|
||||
case GX_LOAD_INDX_A: //used for position matrices
|
||||
VertexShaderMngr::LoadIndexedXF(g_pDataReader->Read32(),0xC);
|
||||
break;
|
||||
case GX_LOAD_INDX_B: //used for normal matrices
|
||||
VertexShaderMngr::LoadIndexedXF(g_pDataReader->Read32(),0xD);
|
||||
break;
|
||||
case GX_LOAD_INDX_C: //used for postmatrices
|
||||
VertexShaderMngr::LoadIndexedXF(g_pDataReader->Read32(),0xE);
|
||||
break;
|
||||
case GX_LOAD_INDX_D: //used for lights
|
||||
VertexShaderMngr::LoadIndexedXF(g_pDataReader->Read32(),0xF);
|
||||
break;
|
||||
|
||||
case GX_CMD_CALL_DL:
|
||||
{
|
||||
u32 dwAddr = g_pDataReader->Read32();
|
||||
u32 dwCount = g_pDataReader->Read32();
|
||||
ExecuteDisplayList(dwAddr, dwCount);
|
||||
}
|
||||
break;
|
||||
|
||||
case 0x44:
|
||||
// zelda 4 swords calls it and checks the metrics registers after that
|
||||
break;
|
||||
|
||||
case GX_CMD_INVL_VC:// Invalidate (vertex cache?)
|
||||
DebugLog("Invalidate (vertex cache?)");
|
||||
break;
|
||||
|
||||
case GX_LOAD_BP_REG: //0x61
|
||||
{
|
||||
u32 cmd = g_pDataReader->Read32();
|
||||
LoadBPReg(cmd);
|
||||
}
|
||||
break;
|
||||
|
||||
// draw primitives
|
||||
default:
|
||||
if (Cmd&0x80)
|
||||
{
|
||||
// load vertices
|
||||
u16 numVertices = g_pDataReader->Read16();
|
||||
if( numVertices > 0 ) {
|
||||
g_VertexLoaders[Cmd & GX_VAT_MASK].RunVertices((Cmd & GX_PRIMITIVE_MASK) >> GX_PRIMITIVE_SHIFT, numVertices);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// char szTmp[256];
|
||||
//sprintf(szTmp, "Illegal command %02x (at %08x)",Cmd,g_pDataReader->GetPtr());
|
||||
//g_VideoInitialize.pLog(szTmp);
|
||||
//MessageBox(0,szTmp,"GFX ERROR",0);
|
||||
// _assert_msg_(0,szTmp,"");
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void OpcodeDecoder_Init()
|
||||
{
|
||||
g_pDataReader = &g_fifoReader;
|
||||
}
|
||||
|
||||
|
||||
void OpcodeDecoder_Shutdown()
|
||||
{
|
||||
}
|
||||
|
||||
void OpcodeDecoder_Run()
|
||||
{
|
||||
// just a small check
|
||||
if (g_pDataReader != &g_fifoReader) {
|
||||
SysMessage("very strange");
|
||||
}
|
||||
|
||||
DVSTARTPROFILE();
|
||||
|
||||
while (FifoCommandRunnable())
|
||||
{
|
||||
Decode();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#ifndef _OPCODE_DECODING_H
|
||||
#define _OPCODE_DECODING_H
|
||||
|
||||
#define GX_NOP 0x00
|
||||
|
||||
#define GX_LOAD_BP_REG 0x61
|
||||
#define GX_LOAD_CP_REG 0x08
|
||||
#define GX_LOAD_XF_REG 0x10
|
||||
#define GX_LOAD_INDX_A 0x20
|
||||
#define GX_LOAD_INDX_B 0x28
|
||||
#define GX_LOAD_INDX_C 0x30
|
||||
#define GX_LOAD_INDX_D 0x38
|
||||
|
||||
#define GX_CMD_CALL_DL 0x40
|
||||
#define GX_CMD_INVL_VC 0x48
|
||||
|
||||
#define GX_PRIMITIVE_MASK 0x78
|
||||
#define GX_PRIMITIVE_SHIFT 3
|
||||
#define GX_VAT_MASK 0x07
|
||||
|
||||
void OpcodeDecoder_Init();
|
||||
void OpcodeDecoder_Shutdown();
|
||||
void OpcodeDecoder_Run();
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,215 @@
|
||||
#include "OpcodeReaders.h"
|
||||
|
||||
_u8 *readerMemPtr;
|
||||
_u8 *bufPtr;
|
||||
FifoData *gFifoData;
|
||||
_u32 gDListEnd, gDListPtr;
|
||||
|
||||
namespace OpcodeReaders
|
||||
{
|
||||
void SetBufPtr(_u8 *_bufptr)
|
||||
{
|
||||
bufPtr = _bufptr;
|
||||
}
|
||||
void SetFifoData(FifoData *_fdata)
|
||||
{
|
||||
gFifoData = _fdata;
|
||||
}
|
||||
void SetMemPtr(_u8 *_mptr)
|
||||
{
|
||||
readerMemPtr = _mptr;
|
||||
}
|
||||
|
||||
void SetDListReader(_u32 _ptr, _u32 _end)
|
||||
{
|
||||
gDListPtr = _ptr & 0x1FFFFFF;
|
||||
gDListEnd = _end & 0x1FFFFFF;
|
||||
}
|
||||
void DListReaderSkip(int _skip)
|
||||
{
|
||||
gDListPtr+=_skip;
|
||||
}
|
||||
bool IsDListOKToRead()
|
||||
{
|
||||
return gDListPtr<gDListEnd;
|
||||
}
|
||||
}
|
||||
//FifoData *fifoData;
|
||||
|
||||
_u8 PeekFifo8()
|
||||
{
|
||||
int addr = (gFifoData->readptr+1)^3;
|
||||
if (addr==gFifoData->gpend)
|
||||
addr=gFifoData->gpbegin;
|
||||
return readerMemPtr[addr];
|
||||
}
|
||||
// ________________________________________________________________________________________________
|
||||
// ReadFifo8
|
||||
//
|
||||
_u8 ReadFifo8()
|
||||
{
|
||||
while (
|
||||
(gFifoData->readenable == false) ||
|
||||
(gFifoData->readptr == gFifoData->writeptr) ||
|
||||
(gFifoData->bpenable && (gFifoData->readptr == gFifoData->breakpt))
|
||||
)
|
||||
{
|
||||
//if (gFifoData->readptr == gFifoData->breakpt)
|
||||
// MessageBox(0,"hello breakpoint",0,0);
|
||||
SwitchToFiber(gFifoData->cpuFiber);
|
||||
}
|
||||
|
||||
_u8 val = readerMemPtr[(gFifoData->readptr++)^3];
|
||||
|
||||
if (gFifoData->readptr == gFifoData->gpend)
|
||||
gFifoData->readptr = gFifoData->gpbegin;
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
// ________________________________________________________________________________________________
|
||||
// ReadFifo16
|
||||
//
|
||||
_u16 ReadFifo16()
|
||||
{
|
||||
//PowerPC byte ordering :(
|
||||
_u8 val1 = ReadFifo8();
|
||||
_u8 val2 = ReadFifo8();
|
||||
return (val1<<8)|(val2);
|
||||
}
|
||||
|
||||
// ________________________________________________________________________________________________
|
||||
// ReadFifo32
|
||||
//
|
||||
_u32 ReadFifo32()
|
||||
{
|
||||
//PowerPC byte ordering :(
|
||||
_u8 val1 = ReadFifo8();
|
||||
_u8 val2 = ReadFifo8();
|
||||
_u8 val3 = ReadFifo8();
|
||||
_u8 val4 = ReadFifo8();
|
||||
return (val1<<24)|(val2<<16)|(val3<<8)|(val4);
|
||||
}
|
||||
|
||||
_u32 GetPtrFifo()
|
||||
{
|
||||
return gFifoData->readptr;
|
||||
}
|
||||
|
||||
_u8 PeekDList8()
|
||||
{
|
||||
if (gDListPtr<gDListEnd-1)
|
||||
return readerMemPtr[(gDListPtr+1)^3];
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
// ________________________________________________________________________________________________
|
||||
// ReadFifo8
|
||||
//
|
||||
_u8 ReadDList8()
|
||||
{
|
||||
return readerMemPtr[(gDListPtr++)^3];
|
||||
}
|
||||
|
||||
// ________________________________________________________________________________________________
|
||||
// ReadFifo16
|
||||
//
|
||||
_u16 ReadDList16()
|
||||
{
|
||||
//PowerPC byte ordering :(
|
||||
_u8 val1 = readerMemPtr[(gDListPtr++)^3];
|
||||
_u8 val2 = readerMemPtr[(gDListPtr++)^3];
|
||||
return (val1<<8)|(val2);
|
||||
}
|
||||
|
||||
// ________________________________________________________________________________________________
|
||||
// ReadFifo32
|
||||
//
|
||||
_u32 ReadDList32()
|
||||
{
|
||||
//PowerPC byte ordering :(
|
||||
_u8 val1 = readerMemPtr[(gDListPtr++)^3];
|
||||
_u8 val2 = readerMemPtr[(gDListPtr++)^3];
|
||||
_u8 val3 = readerMemPtr[(gDListPtr++)^3];
|
||||
_u8 val4 = readerMemPtr[(gDListPtr++)^3];
|
||||
return (val1<<24)|(val2<<16)|(val3<<8)|(val4);
|
||||
}
|
||||
|
||||
_u32 GetPtrDList()
|
||||
{
|
||||
return gDListPtr;
|
||||
}
|
||||
|
||||
|
||||
_u8 PeekBuf8()
|
||||
{
|
||||
return bufPtr[0];
|
||||
}
|
||||
|
||||
// ________________________________________________________________________________________________
|
||||
// ReadFifo8
|
||||
//
|
||||
_u8 ReadBuf8()
|
||||
{
|
||||
return *bufPtr++;
|
||||
}
|
||||
|
||||
// ________________________________________________________________________________________________
|
||||
// ReadFifo16
|
||||
//
|
||||
_u16 ReadBuf16()
|
||||
{
|
||||
_u16 val = *(_u16*)bufPtr;
|
||||
bufPtr+=2;
|
||||
return (val<<8)|(val>>8);
|
||||
}
|
||||
|
||||
// ________________________________________________________________________________________________
|
||||
// ReadFifo32
|
||||
//
|
||||
_u32 ReadBuf32()
|
||||
{
|
||||
// _u32 val = *(_u32*)bufPtr;
|
||||
//__asm
|
||||
// {
|
||||
// mov ebx,bufPtr
|
||||
// mov eax,[ebx]
|
||||
// add ebx,4
|
||||
// mov bufPtr,ebx
|
||||
// bswap eax
|
||||
// }
|
||||
_u32 high = ReadBuf16();
|
||||
return (high<<16) | ReadBuf16();
|
||||
// return swap32(val);
|
||||
}
|
||||
|
||||
|
||||
ReaderInterface fifoReader =
|
||||
{
|
||||
ReadFifo8,
|
||||
PeekFifo8,
|
||||
ReadFifo16,
|
||||
ReadFifo32,
|
||||
GetPtrFifo
|
||||
};
|
||||
|
||||
|
||||
ReaderInterface dlistReader =
|
||||
{
|
||||
ReadDList8,
|
||||
PeekDList8,
|
||||
ReadDList16,
|
||||
ReadDList32,
|
||||
GetPtrDList
|
||||
};
|
||||
|
||||
ReaderInterface bufReader =
|
||||
{
|
||||
ReadBuf8,
|
||||
PeekBuf8,
|
||||
ReadBuf16,
|
||||
ReadBuf32,
|
||||
0
|
||||
};
|
||||
|
||||
ReaderInterface *reader;
|
||||
@@ -0,0 +1,26 @@
|
||||
#pragma once
|
||||
#include "../plugin_specs/video.h"
|
||||
#include "structs.h"
|
||||
|
||||
struct ReaderInterface
|
||||
{
|
||||
_u8 (*Read8) (void);
|
||||
_u8 (*Peek8) (void); //to combine primitive draws..
|
||||
_u16 (*Read16)(void);
|
||||
_u32 (*Read32)(void);
|
||||
_u32 (*GetPtr)(void);
|
||||
};
|
||||
|
||||
extern ReaderInterface *reader;
|
||||
extern ReaderInterface fifoReader,dlistReader,bufReader;
|
||||
|
||||
namespace OpcodeReaders
|
||||
{
|
||||
void SetDListReader(_u32 _ptr, _u32 _end);
|
||||
void DListReaderSkip(int _skip);
|
||||
void SetMemPtr(_u8 *_mptr);
|
||||
void SetFifoData(FifoData *_fdata);
|
||||
bool IsDListOKToRead();
|
||||
|
||||
void SetBufPtr(_u8 *_bufptr);
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,154 @@
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#ifndef GCOGL_PIXELSHADER
|
||||
#define GCOGL_PIXELSHADER
|
||||
|
||||
#include "Render.h"
|
||||
#include "BPStructs.h"
|
||||
|
||||
struct FRAGMENTSHADER
|
||||
{
|
||||
FRAGMENTSHADER() : glprogid(0) { }
|
||||
GLuint glprogid; // opengl program id
|
||||
|
||||
#ifdef _DEBUG
|
||||
std::string strprog;
|
||||
#endif
|
||||
};
|
||||
|
||||
class PixelShaderMngr
|
||||
{
|
||||
class PIXELSHADERUID
|
||||
{
|
||||
public:
|
||||
PIXELSHADERUID() { values = new u32[3+32+6+11]; tevstages = indstages = 0; }
|
||||
~PIXELSHADERUID() { delete[] values; }
|
||||
PIXELSHADERUID(const PIXELSHADERUID& r)
|
||||
{
|
||||
values = new u32[4+32+6+11];
|
||||
tevstages = r.tevstages; indstages = r.indstages;
|
||||
int N = tevstages + indstages + 3;
|
||||
_assert_(N <= 4+32+6+11);
|
||||
for(int i = 0; i < N; ++i)
|
||||
values[i] = r.values[i];
|
||||
}
|
||||
|
||||
bool operator<(const PIXELSHADERUID& _Right) const
|
||||
{
|
||||
if( values[0] < _Right.values[0] )
|
||||
return true;
|
||||
else if( values[0] > _Right.values[0] )
|
||||
return false;
|
||||
|
||||
int N = tevstages + 3; // numTevStages*3/2+1
|
||||
int i = 1;
|
||||
for(; i < N; ++i) {
|
||||
if( values[i] < _Right.values[i] )
|
||||
return true;
|
||||
else if( values[i] > _Right.values[i] )
|
||||
return false;
|
||||
}
|
||||
|
||||
N += indstages;
|
||||
for(; i < N; ++i) {
|
||||
if( values[i] < _Right.values[i] )
|
||||
return true;
|
||||
else if( values[i] > _Right.values[i] )
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool operator==(const PIXELSHADERUID& _Right) const
|
||||
{
|
||||
if( values[0] != _Right.values[0] )
|
||||
return false;
|
||||
|
||||
int N = tevstages + 3; // numTevStages*3/2+1
|
||||
int i = 1;
|
||||
for(; i < N; ++i) {
|
||||
if( values[i] != _Right.values[i] )
|
||||
return false;
|
||||
}
|
||||
|
||||
N += indstages;
|
||||
for(; i < N; ++i) {
|
||||
if( values[i] != _Right.values[i] )
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
u32* values;
|
||||
u16 tevstages, indstages;
|
||||
};
|
||||
|
||||
struct PSCacheEntry
|
||||
{
|
||||
FRAGMENTSHADER shader;
|
||||
int frameCount;
|
||||
PSCacheEntry() : frameCount(0) {}
|
||||
~PSCacheEntry() {}
|
||||
void Destroy() {
|
||||
glDeleteProgramsARB(1, &shader.glprogid);
|
||||
}
|
||||
};
|
||||
|
||||
typedef std::map<PIXELSHADERUID,PSCacheEntry> PSCache;
|
||||
|
||||
static FRAGMENTSHADER* pShaderLast; // last used shader
|
||||
static PSCache pshaders;
|
||||
|
||||
static bool GeneratePixelShader(FRAGMENTSHADER& ps);
|
||||
static void GetPixelShaderId(PIXELSHADERUID&);
|
||||
static PIXELSHADERUID s_curuid; // the current pixel shader uid (progressively changed as memory is written)
|
||||
|
||||
public:
|
||||
static void Init();
|
||||
static void Cleanup();
|
||||
static void Shutdown();
|
||||
static FRAGMENTSHADER* GetShader();
|
||||
static bool CompilePixelShader(FRAGMENTSHADER& ps, const char* pstrprogram);
|
||||
|
||||
static void SetConstants(FRAGMENTSHADER& ps); // sets pixel shader constants
|
||||
|
||||
// constant management, should be called after memory is committed
|
||||
static void SetColorChanged(int type, int index);
|
||||
static void SetAlpha(const AlphaFunc& alpha);
|
||||
static void SetDestAlpha(const ConstantAlpha& alpha);
|
||||
static void SetTexDims(int texmapid, u32 width, u32 height, u32 wraps, u32 wrapt);
|
||||
static void SetZTetureBias(u32 bias);
|
||||
static void SetIndTexScaleChanged();
|
||||
static void SetIndMatrixChanged(int matrixidx);
|
||||
|
||||
static void SetGenModeChanged();
|
||||
static void SetTevCombinerChanged(int id);
|
||||
static void SetTevKSelChanged(int id);
|
||||
static void SetTevOrderChanged(int id);
|
||||
static void SetTevIndirectChanged(int id);
|
||||
static void SetZTetureOpChanged();
|
||||
static void SetTexturesUsed(u32 nonpow2tex);
|
||||
static void SetTexDimsChanged(int texmapid);
|
||||
|
||||
static void SetColorMatrix(const float* pmatrix, const float* pfConstAdd);
|
||||
static GLuint GetColorMatrixProgram();
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,838 @@
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include "Globals.h"
|
||||
#include <list>
|
||||
|
||||
#include "GLInit.h"
|
||||
#include "Render.h"
|
||||
#include "OpcodeDecoding.h"
|
||||
#include "BPStructs.h"
|
||||
#include "TextureMngr.h"
|
||||
#include "rasterfont.h"
|
||||
#include "VertexShader.h"
|
||||
#include "PixelShader.h"
|
||||
#include "VertexLoader.h"
|
||||
|
||||
|
||||
#ifdef _WIN32
|
||||
#include "EmuWindow.h"
|
||||
#else
|
||||
#endif
|
||||
|
||||
struct MESSAGE
|
||||
{
|
||||
MESSAGE() {}
|
||||
MESSAGE(const char* p, u32 dw) { strcpy(str, p); dwTimeStamp = dw; }
|
||||
char str[255];
|
||||
u32 dwTimeStamp;
|
||||
};
|
||||
|
||||
CGcontext g_cgcontext;
|
||||
CGprofile g_cgvProf, g_cgfProf;
|
||||
|
||||
static int g_MaxTexWidth = 0, g_MaxTexHeight = 0;
|
||||
static RasterFont* s_pfont = NULL;
|
||||
static std::list<MESSAGE> s_listMsgs;
|
||||
static bool s_bFullscreen = false;
|
||||
static bool s_bOutputCgErrors = true;
|
||||
static int nZBufferRender = 0; // if > 0, then using zbuffer render
|
||||
static u32 s_uFramebuffer = 0;
|
||||
static u32 s_RenderTargets[1] = {0}, s_DepthTarget = 0, s_ZBufferTarget = 0;
|
||||
static bool s_bATIDrawBuffers = false, s_bHaveStencilBuffer = false;
|
||||
static Renderer::RenderMode s_RenderMode = Renderer::RM_Normal;
|
||||
static int s_nCurTarget = 0;
|
||||
bool g_bBlendLogicOp = false;
|
||||
|
||||
|
||||
void HandleCgError(CGcontext ctx, CGerror err, void* appdata);
|
||||
|
||||
|
||||
bool Renderer::Create2()
|
||||
{
|
||||
bool bSuccess = true;
|
||||
GLenum err = GL_NO_ERROR;
|
||||
g_cgcontext = cgCreateContext();
|
||||
cgGetError();
|
||||
cgSetErrorHandler(HandleCgError, NULL);
|
||||
|
||||
// fill the opengl extension map
|
||||
const char* ptoken = (const char*)glGetString( GL_EXTENSIONS );
|
||||
if (ptoken == NULL) return false;
|
||||
|
||||
__Log("Supported OpenGL Extensions:\n");
|
||||
__Log(ptoken); // write to the log file
|
||||
__Log("\n");
|
||||
|
||||
if( strstr(ptoken, "GL_EXT_blend_logic_op") != NULL )
|
||||
g_bBlendLogicOp = true;
|
||||
if( strstr(ptoken, "ATI_draw_buffers") != NULL )
|
||||
s_bATIDrawBuffers = true;
|
||||
|
||||
s_bFullscreen = g_Config.bFullscreen;
|
||||
|
||||
if (glewInit() != GLEW_OK) {
|
||||
ERROR_LOG("glewInit() failed!\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!GLEW_EXT_framebuffer_object) {
|
||||
ERROR_LOG("*********\nGPU: ERROR: Need GL_EXT_framebufer_object for multiple render targets\nGPU: *********\n");
|
||||
bSuccess = false;
|
||||
}
|
||||
|
||||
if (!GLEW_EXT_secondary_color) {
|
||||
ERROR_LOG("*********\nGPU: OGL ERROR: Need GL_EXT_secondary_color\nGPU: *********\n");
|
||||
bSuccess = false;
|
||||
}
|
||||
|
||||
int numvertexattribs=0;
|
||||
glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, &numvertexattribs);
|
||||
|
||||
if (numvertexattribs < 11) {
|
||||
ERROR_LOG("*********\nGPU: OGL ERROR: Number of attributes %d not enough\nGPU: *********\n", numvertexattribs);
|
||||
bSuccess = false;
|
||||
}
|
||||
|
||||
if (!bSuccess)
|
||||
return false;
|
||||
|
||||
#ifdef _WIN32
|
||||
if (WGLEW_EXT_swap_control)
|
||||
wglSwapIntervalEXT(0);
|
||||
else
|
||||
ERROR_LOG("no support for SwapInterval (framerate clamped to monitor refresh rate)\n");
|
||||
#else
|
||||
if (glXSwapIntervalSGI)
|
||||
glXSwapIntervalSGI(0);
|
||||
else
|
||||
ERROR_LOG("no support for SwapInterval (framerate clamped to monitor refresh rate)\n");
|
||||
#endif
|
||||
|
||||
// check the max texture width and height
|
||||
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &g_MaxTexWidth);
|
||||
g_MaxTexHeight = g_MaxTexWidth;
|
||||
|
||||
GL_REPORT_ERROR();
|
||||
if (err != GL_NO_ERROR) bSuccess = false;
|
||||
|
||||
if (glDrawBuffers == NULL && !GLEW_ARB_draw_buffers)
|
||||
glDrawBuffers = glDrawBuffersARB;
|
||||
|
||||
glGenFramebuffersEXT( 1, &s_uFramebuffer);
|
||||
if (s_uFramebuffer == 0) {
|
||||
ERROR_LOG("failed to create the renderbuffer\n");
|
||||
}
|
||||
|
||||
_assert_( glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT) == GL_FRAMEBUFFER_COMPLETE_EXT );
|
||||
glBindFramebufferEXT( GL_FRAMEBUFFER_EXT, s_uFramebuffer );
|
||||
|
||||
// create the framebuffer targets
|
||||
glGenTextures(ARRAYSIZE(s_RenderTargets), s_RenderTargets);
|
||||
for(int i = 0; i < ARRAYSIZE(s_RenderTargets); ++i) {
|
||||
glBindTexture(GL_TEXTURE_RECTANGLE_NV, s_RenderTargets[i]);
|
||||
// initialize to default
|
||||
glTexImage2D(GL_TEXTURE_RECTANGLE_NV, 0, 4, s_nTargetWidth, s_nTargetHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
|
||||
glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
if( glGetError() != GL_NO_ERROR) {
|
||||
glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_WRAP_S, GL_CLAMP);
|
||||
glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_WRAP_T, GL_CLAMP);
|
||||
GL_REPORT_ERROR();
|
||||
}
|
||||
glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
}
|
||||
s_nCurTarget = 0;
|
||||
|
||||
GL_REPORT_ERROR();
|
||||
|
||||
int nMaxMRT = 0;
|
||||
glGetIntegerv(GL_MAX_COLOR_ATTACHMENTS_EXT, &nMaxMRT);
|
||||
|
||||
if( nMaxMRT > 1 ) {
|
||||
// create zbuffer target
|
||||
glGenTextures(1, &s_ZBufferTarget);
|
||||
glBindTexture(GL_TEXTURE_RECTANGLE_NV, s_ZBufferTarget);
|
||||
glTexImage2D(GL_TEXTURE_RECTANGLE_NV, 0, 4, s_nTargetWidth, s_nTargetHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
|
||||
|
||||
glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
if( glGetError() != GL_NO_ERROR) {
|
||||
glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_WRAP_S, GL_CLAMP);
|
||||
glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_WRAP_T, GL_CLAMP);
|
||||
GL_REPORT_ERROR();
|
||||
}
|
||||
glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
}
|
||||
|
||||
// create the depth buffer
|
||||
glGenRenderbuffersEXT( 1, &s_DepthTarget);
|
||||
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, s_DepthTarget);
|
||||
glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH24_STENCIL8_EXT, s_nTargetWidth, s_nTargetHeight);
|
||||
if( glGetError() != GL_NO_ERROR ) {
|
||||
glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT, s_nTargetWidth, s_nTargetHeight);
|
||||
s_bHaveStencilBuffer = false;
|
||||
}
|
||||
else s_bHaveStencilBuffer = true;
|
||||
|
||||
GL_REPORT_ERROR();
|
||||
|
||||
// set as render targets
|
||||
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_RECTANGLE_NV, s_RenderTargets[s_nCurTarget], 0 );
|
||||
glFramebufferRenderbufferEXT( GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, s_DepthTarget );
|
||||
GL_REPORT_ERROR();
|
||||
|
||||
if( s_ZBufferTarget != 0 ) {
|
||||
// test to make sure it works
|
||||
glFramebufferTexture2DEXT( GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT1_EXT, GL_TEXTURE_RECTANGLE_NV, s_ZBufferTarget, 0);
|
||||
bool bFailed = glGetError() != GL_NO_ERROR || glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT) != GL_FRAMEBUFFER_COMPLETE_EXT;
|
||||
glFramebufferTexture2DEXT( GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT1_EXT, GL_TEXTURE_RECTANGLE_NV, 0, 0);
|
||||
|
||||
if( bFailed ) {
|
||||
glDeleteTextures(1, &s_ZBufferTarget);
|
||||
s_ZBufferTarget = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if( s_ZBufferTarget == 0 )
|
||||
ERROR_LOG("disabling ztarget mrt feature (max mrt=%d)\n", nMaxMRT);
|
||||
|
||||
//glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_STENCIL_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, s_DepthTarget );
|
||||
|
||||
glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT);
|
||||
nZBufferRender = 0;
|
||||
|
||||
GL_REPORT_ERROR();
|
||||
if (err != GL_NO_ERROR) bSuccess = false;
|
||||
|
||||
s_pfont = new RasterFont();
|
||||
|
||||
SetAA(g_Config.aa);
|
||||
GL_REPORT_ERROR();
|
||||
|
||||
// load the effect, find the best profiles (if any)
|
||||
if (cgGLIsProfileSupported(CG_PROFILE_ARBVP1) != CG_TRUE) {
|
||||
ERROR_LOG("arbvp1 not supported\n");
|
||||
return false;
|
||||
}
|
||||
if (cgGLIsProfileSupported(CG_PROFILE_ARBFP1) != CG_TRUE) {
|
||||
ERROR_LOG("arbfp1 not supported\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
g_cgvProf = cgGLGetLatestProfile(CG_GL_VERTEX);
|
||||
g_cgfProf = cgGLGetLatestProfile(CG_GL_FRAGMENT);//CG_PROFILE_ARBFP1;
|
||||
//cgGLSetOptimalOptions(g_cgvProf);
|
||||
//cgGLSetOptimalOptions(g_cgfProf);
|
||||
|
||||
//ERROR_LOG("max buffer sizes: %d %d\n", cgGetProgramBufferMaxSize(g_cgvProf), cgGetProgramBufferMaxSize(g_cgfProf));
|
||||
int nenvvertparams, nenvfragparams, naddrregisters[2];
|
||||
glGetProgramivARB(GL_VERTEX_PROGRAM_ARB, GL_MAX_PROGRAM_ENV_PARAMETERS_ARB, &nenvvertparams);
|
||||
glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_ENV_PARAMETERS_ARB, &nenvfragparams);
|
||||
glGetProgramivARB(GL_VERTEX_PROGRAM_ARB, GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB, &naddrregisters[0]);
|
||||
glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB, &naddrregisters[1]);
|
||||
__Log("max program env parameters: vert=%d, frag=%d\n", nenvvertparams, nenvfragparams);
|
||||
__Log("max program address register parameters: vert=%d, frag=%d\n", naddrregisters[0], naddrregisters[1]);
|
||||
|
||||
if( nenvvertparams < 238 )
|
||||
ERROR_LOG("not enough vertex shader environment constants!!\n");
|
||||
|
||||
#ifndef _DEBUG
|
||||
cgGLSetDebugMode(GL_FALSE);
|
||||
#endif
|
||||
|
||||
if( cgGetError() != CG_NO_ERROR ) {
|
||||
ERROR_LOG("cg error\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
//glEnable(GL_POLYGON_OFFSET_FILL);
|
||||
//glEnable(GL_POLYGON_OFFSET_LINE);
|
||||
//glPolygonOffset(0, 1);
|
||||
|
||||
if (!Initialize())
|
||||
return false;
|
||||
|
||||
return glGetError() == GL_NO_ERROR && bSuccess;
|
||||
}
|
||||
|
||||
void Renderer::Shutdown(void)
|
||||
{
|
||||
SAFE_DELETE(s_pfont);
|
||||
|
||||
if( g_cgcontext != 0 ) {
|
||||
cgDestroyContext(g_cgcontext);
|
||||
g_cgcontext = 0;
|
||||
}
|
||||
|
||||
if( s_RenderTargets[0] ) {
|
||||
glDeleteTextures(ARRAYSIZE(s_RenderTargets), s_RenderTargets);
|
||||
memset(s_RenderTargets, 0, sizeof(s_RenderTargets));
|
||||
}
|
||||
if( s_DepthTarget ) {
|
||||
glDeleteRenderbuffersEXT(1, &s_DepthTarget); s_DepthTarget = 0;
|
||||
}
|
||||
|
||||
if (s_uFramebuffer != 0) {
|
||||
glDeleteFramebuffersEXT( 1, &s_uFramebuffer);
|
||||
s_uFramebuffer = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool Renderer::Initialize()
|
||||
{
|
||||
glStencilFunc(GL_ALWAYS, 0, 0);
|
||||
glBlendFunc(GL_ONE, GL_ONE);
|
||||
|
||||
glViewport(0,0,s_nTargetWidth,s_nTargetWidth); // Reset The Current Viewport
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
|
||||
glShadeModel(GL_SMOOTH);
|
||||
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
glClearDepth(1.0f);
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glDisable(GL_LIGHTING);
|
||||
glDepthFunc(GL_LEQUAL);
|
||||
|
||||
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); // perspective correct interpolation of colors and tex coords
|
||||
|
||||
// setup the default vertex declaration
|
||||
glDisable(GL_STENCIL_TEST);
|
||||
glEnable(GL_SCISSOR_TEST);
|
||||
glScissor(0,0,nBackbufferWidth,nBackbufferHeight);
|
||||
glBlendColorEXT(0, 0, 0, 0.5f);
|
||||
glClearDepth(1.0f);
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
|
||||
//Renderer::SetZBufferRender();
|
||||
|
||||
// legacy multitexturing: select texture channel only
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
glClientActiveTexture(GL_TEXTURE0);
|
||||
glTexEnvf( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE );
|
||||
|
||||
s_RenderMode = Renderer::RM_Normal;
|
||||
|
||||
GLenum err = GL_NO_ERROR;
|
||||
GL_REPORT_ERROR();
|
||||
return err == GL_NO_ERROR;
|
||||
}
|
||||
|
||||
void Renderer::AddMessage(const char* pstr, u32 ms)
|
||||
{
|
||||
s_listMsgs.push_back(MESSAGE(pstr, timeGetTime()+ms));
|
||||
}
|
||||
|
||||
void Renderer::ProcessMessages()
|
||||
{
|
||||
if (s_listMsgs.size() > 0) {
|
||||
int left = 25, top = 15;
|
||||
list<MESSAGE>::iterator it = s_listMsgs.begin();
|
||||
|
||||
while( it != s_listMsgs.end() ) {
|
||||
DrawText(it->str, left+1, top+1, 0xff000000);
|
||||
DrawText(it->str, left, top, 0xffffff30);
|
||||
top += 15;
|
||||
|
||||
if ((int)(it->dwTimeStamp - timeGetTime()) < 0)
|
||||
it = s_listMsgs.erase(it);
|
||||
else ++it;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Renderer::DrawText(const char* pstr, int left, int top, u32 color)
|
||||
{
|
||||
glColor3f(((color>>16) & 0xff)/255.0f, ((color>>8) & 0xff)/255.0f, (color & 0xff)/255.0f);
|
||||
s_pfont->printString(pstr, left * 2.0f / (float)nBackbufferWidth - 1, 1 - top * 2.0f / (float)nBackbufferHeight,0);
|
||||
}
|
||||
|
||||
void Renderer::SetAA(int aa)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Renderer::ReinitView(int nNewWidth, int nNewHeight)
|
||||
{
|
||||
int oldscreen = s_bFullscreen;
|
||||
|
||||
OpenGL_Shutdown();
|
||||
int oldwidth = nBackbufferWidth, oldheight = nBackbufferHeight;
|
||||
if (!OpenGL_Create(g_VideoInitialize, nNewWidth, nNewHeight)) {//nNewWidth&~7, nNewHeight&~7) ) {
|
||||
ERROR_LOG("Failed to recreate, reverting to old settings\n");
|
||||
if (!OpenGL_Create(g_VideoInitialize, oldwidth, oldheight)) {
|
||||
SysMessage("Failed to revert, exiting...\n");
|
||||
// TODO - don't takedown the entire emu
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
OpenGL_MakeCurrent();
|
||||
|
||||
if (oldscreen && !g_Config.bFullscreen) { // if transitioning from full screen
|
||||
#ifdef _WIN32
|
||||
RECT rc;
|
||||
rc.left = 0; rc.top = 0;
|
||||
rc.right = nNewWidth; rc.bottom = nNewHeight;
|
||||
AdjustWindowRect(&rc, EmuWindow::g_winstyle, FALSE);
|
||||
|
||||
RECT rcdesktop;
|
||||
GetWindowRect(GetDesktopWindow(), &rcdesktop);
|
||||
|
||||
SetWindowLong( EmuWindow::GetWnd(), GWL_STYLE, EmuWindow::g_winstyle );
|
||||
SetWindowPos(EmuWindow::GetWnd(), HWND_TOP, ((rcdesktop.right-rcdesktop.left)-(rc.right-rc.left))/2,
|
||||
((rcdesktop.bottom-rcdesktop.top)-(rc.bottom-rc.top))/2,
|
||||
rc.right-rc.left, rc.bottom-rc.top, SWP_SHOWWINDOW);
|
||||
UpdateWindow(EmuWindow::GetWnd());
|
||||
#else // linux
|
||||
#endif
|
||||
}
|
||||
|
||||
nBackbufferWidth = nNewWidth > 16 ? nNewWidth : 16;
|
||||
nBackbufferHeight = nNewHeight > 16 ? nNewHeight : 16;
|
||||
}
|
||||
|
||||
int Renderer::GetTargetWidth()
|
||||
{
|
||||
return s_nTargetWidth;
|
||||
}
|
||||
|
||||
bool Renderer::CanBlendLogicOp()
|
||||
{
|
||||
return g_bBlendLogicOp;
|
||||
}
|
||||
|
||||
int Renderer::GetTargetHeight()
|
||||
{
|
||||
return s_nTargetHeight;
|
||||
}
|
||||
|
||||
void Renderer::SetRenderTarget(u32 targ)
|
||||
{
|
||||
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_RECTANGLE_NV, targ!=0?targ:s_RenderTargets[s_nCurTarget], 0 );
|
||||
}
|
||||
|
||||
void Renderer::SetDepthTarget(u32 targ)
|
||||
{
|
||||
glFramebufferRenderbufferEXT( GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, targ != 0 ? targ : s_DepthTarget );
|
||||
}
|
||||
|
||||
void Renderer::SetFramebuffer(u32 fb)
|
||||
{
|
||||
glBindFramebufferEXT( GL_FRAMEBUFFER_EXT, fb != 0 ? fb : s_uFramebuffer );
|
||||
}
|
||||
|
||||
u32 Renderer::GetRenderTarget()
|
||||
{
|
||||
return s_RenderTargets[s_nCurTarget];
|
||||
}
|
||||
|
||||
void Renderer::ResetGLState()
|
||||
{
|
||||
glDisable(GL_SCISSOR_TEST);
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
glDisable(GL_CULL_FACE);
|
||||
glDisable(GL_BLEND);
|
||||
glDepthMask(GL_FALSE);
|
||||
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
|
||||
|
||||
glDisable( GL_VERTEX_PROGRAM_ARB );
|
||||
glDisable( GL_FRAGMENT_PROGRAM_ARB );
|
||||
}
|
||||
|
||||
void Renderer::RestoreGLState()
|
||||
{
|
||||
glEnable(GL_SCISSOR_TEST);
|
||||
|
||||
if (bpmem.genMode.cullmode>0) glEnable(GL_CULL_FACE);
|
||||
if (bpmem.zmode.testenable) glEnable(GL_DEPTH_TEST);
|
||||
if (bpmem.blendmode.blendenable) glEnable(GL_BLEND);
|
||||
if(bpmem.zmode.updateenable) glDepthMask(GL_TRUE);
|
||||
|
||||
glEnable( GL_VERTEX_PROGRAM_ARB );
|
||||
glEnable( GL_FRAGMENT_PROGRAM_ARB );
|
||||
SetColorMask();
|
||||
}
|
||||
|
||||
bool Renderer::IsUsingATIDrawBuffers()
|
||||
{
|
||||
return s_bATIDrawBuffers;
|
||||
}
|
||||
|
||||
bool Renderer::HaveStencilBuffer()
|
||||
{
|
||||
return s_bHaveStencilBuffer;
|
||||
}
|
||||
|
||||
void Renderer::SetZBufferRender()
|
||||
{
|
||||
nZBufferRender = 10; // give it 10 frames
|
||||
GLenum s_drawbuffers[2] = {GL_COLOR_ATTACHMENT0_EXT, GL_COLOR_ATTACHMENT1_EXT};
|
||||
glDrawBuffers(2, s_drawbuffers);
|
||||
glFramebufferTexture2DEXT( GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT1_EXT, GL_TEXTURE_RECTANGLE_NV, s_ZBufferTarget, 0);
|
||||
_assert_(glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT) == GL_FRAMEBUFFER_COMPLETE_EXT);
|
||||
}
|
||||
|
||||
void Renderer::FlushZBufferAlphaToTarget()
|
||||
{
|
||||
ResetGLState();
|
||||
|
||||
SetRenderTarget(0);
|
||||
glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT);
|
||||
glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_TRUE);
|
||||
|
||||
glViewport(0, 0, GetTargetWidth()<<g_AAx, GetTargetHeight()<<g_AAy);
|
||||
|
||||
// texture map s_RenderTargets[s_curtarget] onto the main buffer
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
glBindTexture(GL_TEXTURE_RECTANGLE_NV, s_ZBufferTarget);
|
||||
TextureMngr::EnableTexRECT(0);
|
||||
// disable all other stages
|
||||
for(int i = 1; i < 8; ++i) TextureMngr::DisableStage(i);
|
||||
GL_REPORT_ERRORD();
|
||||
|
||||
// setup the stencil to only accept pixels that have been written
|
||||
glStencilFunc(GL_EQUAL, 1, 0xff);
|
||||
glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
|
||||
|
||||
glBegin(GL_QUADS);
|
||||
glTexCoord2f(0, 0); glVertex2f(-1,-1);
|
||||
glTexCoord2f(0, (float)(GetTargetHeight()<<g_AAy)); glVertex2f(-1,1);
|
||||
glTexCoord2f((float)(GetTargetWidth()<<g_AAx), (float)(GetTargetWidth()<<g_AAy)); glVertex2f(1,1);
|
||||
glTexCoord2f((float)(GetTargetWidth()<<g_AAx), 0); glVertex2f(1,-1);
|
||||
glEnd();
|
||||
|
||||
GL_REPORT_ERRORD();
|
||||
|
||||
glBindTexture(GL_TEXTURE_RECTANGLE_NV, 0);
|
||||
RestoreGLState();
|
||||
}
|
||||
|
||||
void Renderer::SetRenderMode(RenderMode mode)
|
||||
{
|
||||
if( !s_bHaveStencilBuffer && mode == RM_ZBufferAlpha )
|
||||
mode = RM_ZBufferOnly;
|
||||
|
||||
if( s_RenderMode == mode )
|
||||
return;
|
||||
|
||||
if( mode == RM_Normal ) {
|
||||
// flush buffers
|
||||
if( s_RenderMode == RM_ZBufferAlpha ) {
|
||||
FlushZBufferAlphaToTarget();
|
||||
glDisable(GL_STENCIL_TEST);
|
||||
}
|
||||
SetColorMask();
|
||||
SetRenderTarget(0);
|
||||
SetZBufferRender();
|
||||
GL_REPORT_ERRORD();
|
||||
}
|
||||
else if( s_RenderMode == RM_Normal ) {
|
||||
// setup buffers
|
||||
_assert_(GetZBufferTarget() && bpmem.zmode.updateenable);
|
||||
|
||||
if( mode == RM_ZBufferAlpha ) {
|
||||
glEnable(GL_STENCIL_TEST);
|
||||
glClearStencil(0);
|
||||
glClear(GL_STENCIL_BUFFER_BIT);
|
||||
glStencilFunc(GL_ALWAYS, 1, 0xff);
|
||||
glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
|
||||
}
|
||||
|
||||
glDrawBuffer(GL_COLOR_ATTACHMENT1_EXT);
|
||||
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
|
||||
GL_REPORT_ERRORD();
|
||||
}
|
||||
else {
|
||||
_assert_(GetZBufferTarget());
|
||||
_assert_(s_bHaveStencilBuffer);
|
||||
|
||||
if( mode == RM_ZBufferOnly ) {
|
||||
// flush and remove stencil
|
||||
_assert_(s_RenderMode==RM_ZBufferAlpha);
|
||||
FlushZBufferAlphaToTarget();
|
||||
glDisable(GL_STENCIL_TEST);
|
||||
|
||||
SetRenderTarget(s_ZBufferTarget);
|
||||
glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT);
|
||||
GL_REPORT_ERRORD();
|
||||
}
|
||||
else {
|
||||
_assert_(mode == RM_ZBufferAlpha&&s_RenderMode==RM_ZBufferOnly);
|
||||
|
||||
// setup stencil
|
||||
glEnable(GL_STENCIL_TEST);
|
||||
glClearStencil(0);
|
||||
glClear(GL_STENCIL_BUFFER_BIT);
|
||||
glStencilFunc(GL_ALWAYS, 1, 0xff);
|
||||
glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
|
||||
}
|
||||
}
|
||||
|
||||
s_RenderMode = mode;
|
||||
}
|
||||
|
||||
Renderer::RenderMode Renderer::GetRenderMode()
|
||||
{
|
||||
return s_RenderMode;
|
||||
}
|
||||
|
||||
u32 Renderer::GetZBufferTarget()
|
||||
{
|
||||
return nZBufferRender > 0 ? s_ZBufferTarget : 0;
|
||||
}
|
||||
|
||||
void Renderer::Swap(const TRectangle& rc)
|
||||
{
|
||||
OpenGL_Update(); // just updates the render window position and the backbuffer size
|
||||
|
||||
DVProfileFunc _pf("Renderer::Swap");
|
||||
|
||||
Renderer::SetRenderMode(Renderer::RM_Normal);
|
||||
|
||||
// render to the real buffer now
|
||||
glBindFramebufferEXT( GL_FRAMEBUFFER_EXT, 0 ); // switch to the backbuffer
|
||||
glViewport(0, 0, nBackbufferWidth, nBackbufferHeight);
|
||||
|
||||
ResetGLState();
|
||||
|
||||
// texture map s_RenderTargets[s_curtarget] onto the main buffer
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
glBindTexture(GL_TEXTURE_RECTANGLE_NV, s_RenderTargets[s_nCurTarget]);
|
||||
TextureMngr::EnableTexRECT(0);
|
||||
// disable all other stages
|
||||
for(int i = 1; i < 8; ++i) TextureMngr::DisableStage(i);
|
||||
GL_REPORT_ERRORD();
|
||||
|
||||
|
||||
float FactorW = (float)s_nTargetWidth / (float)nBackbufferWidth;
|
||||
float FactorH = (float)s_nTargetHeight / (float)nBackbufferHeight;
|
||||
|
||||
float Max = (FactorW < FactorH) ? FactorH : FactorW;
|
||||
float Temp = 1 / Max;
|
||||
FactorW *= Temp;
|
||||
FactorH *= Temp;
|
||||
|
||||
|
||||
glBegin(GL_QUADS);
|
||||
glTexCoord2f(0, 0); glVertex2f(-FactorW,-FactorH);
|
||||
glTexCoord2f(0, (float)s_nTargetHeight); glVertex2f(-FactorW,FactorH);
|
||||
glTexCoord2f((float)s_nTargetWidth, (float)s_nTargetHeight); glVertex2f(FactorW,FactorH);
|
||||
glTexCoord2f((float)s_nTargetWidth, 0); glVertex2f(FactorW,-FactorH);
|
||||
glEnd();
|
||||
|
||||
glBindTexture(GL_TEXTURE_RECTANGLE_NV, 0);
|
||||
TextureMngr::DisableStage(0);
|
||||
|
||||
// static int fpscount = 0;
|
||||
// static float s_fps = 0;
|
||||
// static u32 lasttime = timeGetTime();
|
||||
//
|
||||
// if( ++fpscount >= 16 ) {
|
||||
// s_fps = 16*1000.0f/(float)(timeGetTime() - lasttime);
|
||||
// lasttime = timeGetTime();
|
||||
// fpscount = 0;
|
||||
// }
|
||||
//
|
||||
// char strfps[25];
|
||||
// sprintf(strfps, "fps: %2.1f\n", s_fps);
|
||||
// Renderer::DrawText(strfps, 20, 20, 0xFF00FFFF);
|
||||
|
||||
if (g_Config.bOverlayStats) {
|
||||
char st[2048];
|
||||
char *p = st;
|
||||
p+=sprintf(p,"Num textures created: %i\n",stats.numTexturesCreated);
|
||||
p+=sprintf(p,"Num textures alive: %i\n",stats.numTexturesAlive);
|
||||
p+=sprintf(p,"Num pshaders created: %i\n",stats.numPixelShadersCreated);
|
||||
p+=sprintf(p,"Num pshaders alive: %i\n",stats.numPixelShadersAlive);
|
||||
p+=sprintf(p,"Num vshaders created: %i\n",stats.numVertexShadersCreated);
|
||||
p+=sprintf(p,"Num vshaders alive: %i\n",stats.numVertexShadersAlive);
|
||||
p+=sprintf(p,"Num dlists called: %i\n",stats.numDListsCalled);
|
||||
p+=sprintf(p,"Num dlists created: %i\n",stats.numDListsCreated);
|
||||
p+=sprintf(p,"Num dlists alive: %i\n",stats.numDListsAlive);
|
||||
p+=sprintf(p,"Num strip joins: %i\n",stats.numJoins);
|
||||
p+=sprintf(p,"Num primitives: %i\n",stats.thisFrame.numPrims);
|
||||
p+=sprintf(p,"Num primitives (DL): %i\n",stats.thisFrame.numDLPrims);
|
||||
p+=sprintf(p,"Num bad commands: %i%s\n",stats.thisFrame.numBadCommands,stats.thisFrame.numBadCommands?"!!!":"");
|
||||
p+=sprintf(p,"Num XF loads: %i\n",stats.thisFrame.numXFLoads);
|
||||
p+=sprintf(p,"Num XF loads (DL): %i\n",stats.thisFrame.numXFLoadsInDL);
|
||||
p+=sprintf(p,"Num CP loads: %i\n",stats.thisFrame.numCPLoads);
|
||||
p+=sprintf(p,"Num CP loads (DL): %i\n",stats.thisFrame.numCPLoadsInDL);
|
||||
p+=sprintf(p,"Num BP loads: %i\n",stats.thisFrame.numBPLoads);
|
||||
p+=sprintf(p,"Num BP loads (DL): %i\n",stats.thisFrame.numBPLoadsInDL);
|
||||
|
||||
Renderer::DrawText(st, 20, 20, 0xFF00FFFF);
|
||||
}
|
||||
|
||||
#if defined(DVPROFILE)
|
||||
if (g_bWriteProfile) {
|
||||
//g_bWriteProfile = 0;
|
||||
static int framenum = 0;
|
||||
const int UPDATE_FRAMES = 8;
|
||||
if (++framenum >= UPDATE_FRAMES) {
|
||||
DVProfWrite("prof.txt", UPDATE_FRAMES);
|
||||
DVProfClear();
|
||||
framenum = 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// copy the rendered from to the real window
|
||||
OpenGL_SwapBuffers();
|
||||
|
||||
GL_REPORT_ERRORD();
|
||||
|
||||
//clean out old stuff from caches
|
||||
frameCount++;
|
||||
PixelShaderMngr::Cleanup();
|
||||
TextureMngr::Cleanup();
|
||||
|
||||
// New frame
|
||||
stats.ResetFrame();
|
||||
|
||||
glBindFramebufferEXT( GL_FRAMEBUFFER_EXT, s_uFramebuffer );
|
||||
|
||||
// s_nCurTarget = !s_nCurTarget;
|
||||
// SetRenderTarget(0);
|
||||
|
||||
if( nZBufferRender > 0 ) {
|
||||
if( --nZBufferRender == 0 ) {
|
||||
// turn off
|
||||
nZBufferRender = 0;
|
||||
glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT);
|
||||
glFramebufferTexture2DEXT( GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT1_EXT, GL_TEXTURE_RECTANGLE_NV, 0, 0);
|
||||
Renderer::SetRenderMode(RM_Normal); // turn off any zwrites
|
||||
}
|
||||
}
|
||||
|
||||
RestoreGLState();
|
||||
GL_REPORT_ERRORD();
|
||||
|
||||
g_Config.iSaveTargetId = 0;
|
||||
|
||||
// for testing zbuffer targets
|
||||
//Renderer::SetZBufferRender();
|
||||
//SaveTexture("tex.tga", GL_TEXTURE_RECTANGLE_NV, s_ZBufferTarget, GetTargetWidth(), GetTargetHeight());
|
||||
}
|
||||
|
||||
bool Renderer::SaveRenderTarget(const char* filename, int jpeg)
|
||||
{
|
||||
bool bflip = true;
|
||||
vector<u32> data(s_nTargetWidth*s_nTargetHeight);
|
||||
glReadPixels(0, 0, s_nTargetWidth, s_nTargetHeight, GL_BGRA, GL_UNSIGNED_BYTE, &data[0]);
|
||||
if (glGetError() != GL_NO_ERROR)
|
||||
return false;
|
||||
|
||||
if (bflip) {
|
||||
// swap scanlines
|
||||
vector<u32> scanline(s_nTargetWidth);
|
||||
for(u32 i = 0; i < s_nTargetHeight/2; ++i) {
|
||||
memcpy(&scanline[0], &data[i*s_nTargetWidth], s_nTargetWidth*4);
|
||||
memcpy(&data[i*s_nTargetWidth], &data[(s_nTargetHeight-i-1)*s_nTargetWidth], s_nTargetWidth*4);
|
||||
memcpy(&data[(s_nTargetHeight-i-1)*s_nTargetWidth], &scanline[0], s_nTargetWidth*4);
|
||||
}
|
||||
}
|
||||
|
||||
if (jpeg) return SaveJPEG(filename, s_nTargetWidth, s_nTargetHeight, &data[0], 70);
|
||||
|
||||
return SaveTGA(filename, s_nTargetWidth, s_nTargetHeight, &data[0]);
|
||||
}
|
||||
|
||||
void Renderer::SetCgErrorOutput(bool bOutput)
|
||||
{
|
||||
s_bOutputCgErrors = bOutput;
|
||||
}
|
||||
|
||||
void HandleGLError()
|
||||
{
|
||||
const GLubyte* pstr = glGetString(GL_PROGRAM_ERROR_STRING_ARB);
|
||||
if (pstr != NULL && pstr[0] != 0 ) {
|
||||
GLint loc=0;
|
||||
glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &loc);
|
||||
ERROR_LOG("program error at %d: ", loc);
|
||||
ERROR_LOG((char*)pstr);
|
||||
ERROR_LOG("\n");
|
||||
}
|
||||
|
||||
// check the error status of this framebuffer */
|
||||
GLenum error = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
|
||||
|
||||
// if error != GL_FRAMEBUFFER_COMPLETE_EXT, there's an error of some sort
|
||||
if (error != 0) {
|
||||
int w, h;
|
||||
GLint fmt;
|
||||
glGetRenderbufferParameterivEXT(GL_COLOR_ATTACHMENT0_EXT, GL_RENDERBUFFER_INTERNAL_FORMAT_EXT, &fmt);
|
||||
glGetRenderbufferParameterivEXT(GL_COLOR_ATTACHMENT0_EXT, GL_RENDERBUFFER_WIDTH_EXT, &w);
|
||||
glGetRenderbufferParameterivEXT(GL_COLOR_ATTACHMENT0_EXT, GL_RENDERBUFFER_HEIGHT_EXT, &h);
|
||||
|
||||
switch(error)
|
||||
{
|
||||
case GL_FRAMEBUFFER_COMPLETE_EXT:
|
||||
break;
|
||||
case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT:
|
||||
ERROR_LOG("Error! missing a required image/buffer attachment!\n");
|
||||
break;
|
||||
case GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT:
|
||||
ERROR_LOG("Error! has no images/buffers attached!\n");
|
||||
break;
|
||||
// case GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT:
|
||||
// ERROR_LOG("Error! has an image/buffer attached in multiple locations!\n");
|
||||
// break;
|
||||
case GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT:
|
||||
ERROR_LOG("Error! has mismatched image/buffer dimensions!\n");
|
||||
break;
|
||||
case GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT:
|
||||
ERROR_LOG("Error! colorbuffer attachments have different types!\n");
|
||||
break;
|
||||
case GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT:
|
||||
ERROR_LOG("Error! trying to draw to non-attached color buffer!\n");
|
||||
break;
|
||||
case GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT:
|
||||
ERROR_LOG("Error! trying to read from a non-attached color buffer!\n");
|
||||
break;
|
||||
case GL_FRAMEBUFFER_UNSUPPORTED_EXT:
|
||||
ERROR_LOG("Error! format is not supported by current graphics card/driver!\n");
|
||||
break;
|
||||
default:
|
||||
ERROR_LOG("*UNKNOWN ERROR* reported from glCheckFramebufferStatusEXT()!\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void HandleCgError(CGcontext ctx, CGerror err, void* appdata)
|
||||
{
|
||||
if( s_bOutputCgErrors ) {
|
||||
ERROR_LOG("Cg error: %s\n", cgGetErrorString(err));
|
||||
const char* listing = cgGetLastListing(g_cgcontext);
|
||||
if (listing != NULL) {
|
||||
ERROR_LOG(" last listing: %s\n", listing);
|
||||
}
|
||||
// glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &loc);
|
||||
// printf("pos: %d\n", loc);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#ifndef GCOGL_RENDER
|
||||
#define GCOGL_RENDER
|
||||
|
||||
#include "TextureMngr.h"
|
||||
|
||||
extern CGcontext g_cgcontext;
|
||||
extern CGprofile g_cgvProf, g_cgfProf;
|
||||
extern u32 g_AAx, g_AAy; // anti-aliasing
|
||||
|
||||
class Renderer
|
||||
{
|
||||
static void FlushZBufferAlphaToTarget();
|
||||
|
||||
public:
|
||||
enum RenderMode
|
||||
{
|
||||
RM_Normal=0, // normal target as color0, ztarget as color1
|
||||
RM_ZBufferOnly, // zbuffer as color 0
|
||||
RM_ZBufferAlpha // zbuffer as color0, also will dump alpha info to regular target once mode is switched
|
||||
// use stencil buffer to indicate what pixels were written
|
||||
};
|
||||
|
||||
static bool Create2();
|
||||
static void Shutdown();
|
||||
|
||||
// initialize opengl standard values (like viewport)
|
||||
static bool Initialize();
|
||||
|
||||
static void AddMessage(const char* str, u32 ms);
|
||||
static void ProcessMessages(); // draw the current messages on the screen
|
||||
static void DrawText(const char* pstr, int left, int top, u32 color);
|
||||
static void SetAA(int aa); // sets the anti-aliasing level
|
||||
|
||||
static void ReinitView(int nNewWidth, int nNewHeight);
|
||||
|
||||
static int GetTargetWidth();
|
||||
static int GetTargetHeight();
|
||||
static bool CanBlendLogicOp();
|
||||
static void SetCgErrorOutput(bool bOutput);
|
||||
|
||||
static void ResetGLState();
|
||||
static void RestoreGLState();
|
||||
static bool IsUsingATIDrawBuffers();
|
||||
static bool HaveStencilBuffer();
|
||||
|
||||
static void SetZBufferRender(); // sets rendering of the zbuffer using MRTs
|
||||
static u32 GetZBufferTarget();
|
||||
|
||||
static void SetRenderMode(RenderMode mode);
|
||||
static RenderMode GetRenderMode();
|
||||
|
||||
static void SetRenderTarget(u32 targ); // if targ is 0, sets to original render target
|
||||
static void SetDepthTarget(u32 targ);
|
||||
static void SetFramebuffer(u32 fb);
|
||||
static u32 GetRenderTarget();
|
||||
|
||||
// Finish up the current frame, print some stats
|
||||
static void Swap(const TRectangle& rc);
|
||||
|
||||
static bool SaveRenderTarget(const char* filename, int jpeg);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,26 @@
|
||||
Import('env')
|
||||
|
||||
files = ["BPStructs.cpp",
|
||||
"DataReader.cpp",
|
||||
"Fifo.cpp",
|
||||
"Globals.cpp",
|
||||
"GLInit.cpp",
|
||||
"main.cpp",
|
||||
"memcpy_amd.cpp",
|
||||
"OpcodeDecoding.cpp",
|
||||
# "OpcodeReaders.cpp", # outdated
|
||||
"PixelShader.cpp",
|
||||
"rasterfont.cpp",
|
||||
"Render.cpp",
|
||||
"TextureDecoder.cpp",
|
||||
"TextureMngr.cpp",
|
||||
"VertexLoader.cpp",
|
||||
"VertexLoader_Normal.cpp",
|
||||
"VertexShader.cpp",
|
||||
# "Linux/Conf.cpp",
|
||||
"Linux/Linux.cpp",
|
||||
]
|
||||
|
||||
gfxenv=env.Copy(CXXFLAGS = " `pkg-config --cflags gtk+-2.0`", LINKFLAGS = " `pkg-config --libs gtk+-2.0`")
|
||||
|
||||
gfxenv.SharedLibrary("../../../../Binary/linux/Plugins/zeroogl.so", files, LIBS=["common", "cairo", "GL", "GLEW", "CgGL", "Cg"])
|
||||
@@ -0,0 +1,443 @@
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include "Globals.h"
|
||||
|
||||
#include "BPStructs.h"
|
||||
#include "TextureDecoder.h"
|
||||
|
||||
#include "OpcodeDecoding.h"
|
||||
|
||||
// TRAM
|
||||
u8 texMem[TMEM_SIZE];
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Gamecube texture decoder
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Decodes all known Gamecube texture formats.
|
||||
// by ector
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
int TexDecoder_GetTexelSizeInNibbles(int format)
|
||||
{
|
||||
switch(format&0x3f) {
|
||||
case GX_TF_I4: return 1;
|
||||
case GX_TF_I8: return 2;
|
||||
case GX_TF_IA4: return 2;
|
||||
case GX_TF_IA8: return 4;
|
||||
case GX_TF_RGB565: return 4;
|
||||
case GX_TF_RGB5A3: return 4;
|
||||
case GX_TF_RGBA8: return 8;
|
||||
case GX_TF_C4: return 1;
|
||||
case GX_TF_C8: return 2;
|
||||
case GX_TF_C14X2: return 4;
|
||||
case GX_TF_CMPR: return 1;
|
||||
default: return 1;
|
||||
}
|
||||
}
|
||||
int TexDecoder_GetBlockWidthInTexels(int format)
|
||||
{
|
||||
switch(format) {
|
||||
case GX_TF_I4: return 8;
|
||||
case GX_TF_I8: return 8;
|
||||
case GX_TF_IA4: return 8;
|
||||
case GX_TF_IA8: return 4;
|
||||
case GX_TF_RGB565: return 4;
|
||||
case GX_TF_RGB5A3: return 4;
|
||||
case GX_TF_RGBA8: return 4;
|
||||
case GX_TF_C4: return 8;
|
||||
case GX_TF_C8: return 8;
|
||||
case GX_TF_C14X2: return 4;
|
||||
case GX_TF_CMPR: return 8;
|
||||
default:return 8;
|
||||
}
|
||||
}
|
||||
|
||||
//returns bytes
|
||||
int TexDecoder_GetPaletteSize(int format)
|
||||
{
|
||||
switch (format) {
|
||||
case GX_TF_C4: return 16*2;
|
||||
case GX_TF_C8: return 256*2;
|
||||
case GX_TF_C14X2: return 16384*2;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
inline u32 decode565(u16 val)
|
||||
{
|
||||
int r,g,b,a;
|
||||
r=lut5to8[(val>>11)&0x1f];
|
||||
g=lut6to8[(val>>5 )&0x3f];
|
||||
b=lut5to8[(val )&0x1f];
|
||||
a=0xFF;
|
||||
return (a<<24) | (r<<16) | (g<<8) | b;
|
||||
}
|
||||
|
||||
inline u32 decodeIA8(u16 val)
|
||||
{
|
||||
int a=val>>8;
|
||||
int r,g,b;
|
||||
r=g=b=val&0xFF;
|
||||
return (a<<24) | (r<<16) | (g<<8) | b;
|
||||
}
|
||||
|
||||
inline u32 decode5A3(u16 val)
|
||||
{
|
||||
int r,g,b,a;
|
||||
if ((val&0x8000))
|
||||
{
|
||||
r=lut5to8[(val>>10)&0x1f];
|
||||
g=lut5to8[(val>>5 )&0x1f];
|
||||
b=lut5to8[(val )&0x1f];
|
||||
a=0xFF;
|
||||
}
|
||||
else
|
||||
{
|
||||
a=lut3to8[(val>>12)&0x7];
|
||||
r=lut4to8[(val>>8 )&0xf];
|
||||
g=lut4to8[(val>>4 )&0xf];
|
||||
b=lut4to8[(val )&0xf];
|
||||
}
|
||||
return (a<<24) | (r<<16) | (g<<8) | b;
|
||||
}
|
||||
|
||||
|
||||
|
||||
struct DXTBlock
|
||||
{
|
||||
u16 color1;
|
||||
u16 color2;
|
||||
u8 lines[4];
|
||||
};
|
||||
|
||||
inline int expand8888(const int j)
|
||||
{
|
||||
int i = j | (j<<8);
|
||||
return i|(i<<16);
|
||||
}
|
||||
|
||||
inline void decodebytesI4(u32 *dst, u8 *src, int numbytes)
|
||||
{
|
||||
for (int x=0; x<numbytes; x++)
|
||||
{
|
||||
int val = src[x];
|
||||
*dst++ = expand8888(lut4to8[val>>4]);
|
||||
*dst++ = expand8888(lut4to8[val&15]);
|
||||
}
|
||||
}
|
||||
|
||||
inline void decodebytesI8(u32 *dst, u8 *src, int numbytes)
|
||||
{
|
||||
for (int x=0; x<numbytes; x++)
|
||||
*dst++ = expand8888(src[x]); //asm bswap loop?
|
||||
}
|
||||
|
||||
inline void decodebytesC4(u32 *dst, u8 *src, int numbytes, int tlutaddr, int tlutfmt)
|
||||
{
|
||||
u16 *tlut = (u16*)(texMem+tlutaddr);
|
||||
for (int x=0; x<numbytes; x++)
|
||||
{
|
||||
int val = src[x];
|
||||
switch(tlutfmt) {
|
||||
case 0:
|
||||
*dst++ = decodeIA8(Common::swap16(tlut[(val>>4)]));
|
||||
*dst++ = decodeIA8(Common::swap16(tlut[(val&15)]));
|
||||
break;
|
||||
case 1:
|
||||
*dst++ = decode565(Common::swap16(tlut[(val>>4)]));
|
||||
*dst++ = decode565(Common::swap16(tlut[(val&15)]));
|
||||
break;
|
||||
case 2:
|
||||
*dst++ = decode5A3(Common::swap16(tlut[(val>>4)]));
|
||||
*dst++ = decode5A3(Common::swap16(tlut[(val&15)]));
|
||||
break;
|
||||
case 3: //ERROR
|
||||
*dst++ = 0xFFFF00FF;
|
||||
*dst++ = 0xFFFF00FF;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
inline void decodebytesC8(u32 *dst, u8 *src, int numbytes, int tlutaddr, int tlutfmt)
|
||||
{
|
||||
u16 *tlut = (u16*)(texMem+tlutaddr);
|
||||
for (int x=0; x<numbytes; x++)
|
||||
{
|
||||
int val = src[x];
|
||||
switch(tlutfmt) {
|
||||
case 0:
|
||||
*dst++ = decodeIA8(Common::swap16(tlut[val]));
|
||||
break;
|
||||
case 1:
|
||||
*dst++ = decode565(Common::swap16(tlut[val]));
|
||||
break;
|
||||
case 2:
|
||||
*dst++ = decode5A3(Common::swap16(tlut[val]));
|
||||
break;
|
||||
case 3: //ERROR
|
||||
*dst++ = 0xFFFF00FF;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
inline void decodebytesC14X2(u32 *dst, u16 *src, int numpixels, int tlutaddr, int tlutfmt)
|
||||
{
|
||||
u16 *tlut = (u16*)(texMem+tlutaddr);
|
||||
for (int x=0; x<numpixels; x++)
|
||||
{
|
||||
int val = Common::swap16(src[x]);
|
||||
switch(tlutfmt) {
|
||||
case 0:
|
||||
*dst++ = decodeIA8(Common::swap16(tlut[(val&0x3FFF)]));
|
||||
break;
|
||||
case 1:
|
||||
*dst++ = decode565(Common::swap16(tlut[(val&0x3FFF)]));
|
||||
break;
|
||||
case 2:
|
||||
*dst++ = decode5A3(Common::swap16(tlut[(val&0x3FFF)]));
|
||||
break;
|
||||
case 3: //ERROR
|
||||
*dst++ = 0xFFFF00FF;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
inline void decodebytesRGB565(u32 *dst, u16 *src, int numpixels)
|
||||
{
|
||||
for (int x=0; x<numpixels; x++)
|
||||
*dst++ = decode565(Common::swap16(src[x]));
|
||||
}
|
||||
|
||||
inline void decodebytesIA4(u32 *dst, u8 *src, int numbytes)
|
||||
{
|
||||
for (int x=0; x<numbytes; x++)
|
||||
{
|
||||
int val = src[x];
|
||||
|
||||
int a = lut4to8[val>>4];
|
||||
int r = lut4to8[val&15];
|
||||
*dst++ = (a<<24) | (r<<16) | (r<<8) | r;
|
||||
}
|
||||
}
|
||||
|
||||
inline void decodebytesIA8(u32 *dst, u16 *src, int numpixels)
|
||||
{
|
||||
for (int x=0; x<numpixels; x++)
|
||||
*dst++ = decodeIA8(Common::swap16(src[x]));
|
||||
}
|
||||
|
||||
inline void decodebytesRGB5A3(u32 *dst, u16 *src, int numpixels)
|
||||
{
|
||||
for (int x=0; x<numpixels; x++)
|
||||
*dst++ = decode5A3(Common::swap16(src[x]));
|
||||
}
|
||||
|
||||
inline void decodebytesARGB8pass1(u32 *dst, u16 *src, int numpixels)
|
||||
{
|
||||
for (int x=0; x<numpixels; x++)
|
||||
{
|
||||
int val = Common::swap16(src[x]);
|
||||
int a=val&0xFF;
|
||||
val>>=8;
|
||||
|
||||
*dst++ = (a<<16) | (val<<24);
|
||||
}
|
||||
}
|
||||
|
||||
inline void decodebytesARGB8pass2(u32 *dst, u16 *src, int numpixels)
|
||||
{
|
||||
for (int x=0; x<numpixels; x++)
|
||||
{
|
||||
int val = Common::swap16(src[x]);
|
||||
int a=val&0xFF;
|
||||
val>>=8;
|
||||
|
||||
*dst++ |= (val<<8) | (a<<0);
|
||||
}
|
||||
}
|
||||
|
||||
inline u32 makecol(int r,int g,int b,int a)
|
||||
{
|
||||
return ((a&255)<<24)|((r&255)<<16)|((g&255)<<8)|((b&255));
|
||||
}
|
||||
|
||||
|
||||
//this needs to be FAST, used by some games realtime video
|
||||
//TODO: port to ASM or intrinsics
|
||||
void decodeDXTBlock(u32 *dst, DXTBlock *src, int pitch)
|
||||
{
|
||||
u16 c1 = Common::swap16(src->color1);
|
||||
u16 c2 = Common::swap16(src->color2);
|
||||
int blue1 = lut5to8[c1&0x1F];
|
||||
int blue2 = lut5to8[c2&0x1F];
|
||||
int green1 = lut6to8[(c1>>5)&0x3F];
|
||||
int green2 = lut6to8[(c2>>5)&0x3F];
|
||||
int red1 = lut5to8[(c1>>11)&0x1F];
|
||||
int red2 = lut5to8[(c2>>11)&0x1F];
|
||||
|
||||
int colors[4];
|
||||
|
||||
if (c1>c2)
|
||||
{
|
||||
colors[0]=makecol(red1,green1,blue1,255);
|
||||
colors[1]=makecol(red2,green2,blue2,255);
|
||||
colors[2]=makecol(red1+(red2-red1)/3,green1+(green2-green1)/3,blue1+(blue2-blue1)/3,255);
|
||||
colors[3]=makecol(red2+(red1-red2)/3,green2+(green1-green2)/3,blue2+(blue1-blue2)/3,255);
|
||||
}
|
||||
else
|
||||
{
|
||||
colors[0]=makecol(red1,green1,blue1,255);
|
||||
colors[1]=makecol(red2,green2,blue2,255);
|
||||
colors[2]=makecol((red1+red2)/2,(green1+green2)/2,(blue1+blue2)/2,255);
|
||||
colors[3]=makecol(0,0,0,0); //transparent
|
||||
}
|
||||
|
||||
for (int y=0; y<4; y++)
|
||||
{
|
||||
int val = src->lines[y];
|
||||
for (int x=0; x<4; x++)
|
||||
{
|
||||
dst[x] = colors[(val>>6)&3];
|
||||
val<<=2;
|
||||
}
|
||||
dst+=pitch;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//switch endianness, unswizzle
|
||||
//TODO: to save memory, don't blindly convert everything to argb8888
|
||||
//also ARGB order needs to be swapped later, to accommodate modern hardware better
|
||||
//need to add DXT support too
|
||||
TEXTUREFMT TexDecoder_Decode(u8 *dst, u8 *src, int width, int height, int texformat, int tlutaddr, int tlutfmt)
|
||||
{
|
||||
DVSTARTPROFILE();
|
||||
|
||||
switch (texformat)
|
||||
{
|
||||
case GX_TF_C4:
|
||||
{
|
||||
for (int y=0; y<height; y+=8)
|
||||
for (int x=0; x<width; x+=8)
|
||||
for (int iy=0; iy<8; iy++, src+=4)
|
||||
decodebytesC4((u32*)dst+(y+iy)*width+x,src,4,tlutaddr,tlutfmt);
|
||||
}
|
||||
return TEXTUREFMT(GL_BGRA, GL_UNSIGNED_BYTE);
|
||||
case GX_TF_I4:
|
||||
{
|
||||
for (int y=0; y<height; y+=8)
|
||||
for (int x=0; x<width; x+=8)
|
||||
for (int iy=0; iy<8; iy++, src+=4)
|
||||
decodebytesI4((u32*)dst+(y+iy)*width+x,src,4);
|
||||
}
|
||||
return TEXTUREFMT(GL_BGRA, GL_UNSIGNED_BYTE);
|
||||
case GX_TF_C8:
|
||||
{
|
||||
for (int y=0; y<height; y+=4)
|
||||
for (int x=0; x<width; x+=8)
|
||||
for (int iy=0; iy<4; iy++, src+=8)
|
||||
decodebytesC8((u32*)dst+(y+iy)*width+x,src,8,tlutaddr,tlutfmt);
|
||||
}
|
||||
return TEXTUREFMT(GL_BGRA, GL_UNSIGNED_BYTE);
|
||||
|
||||
case GX_TF_I8:
|
||||
{
|
||||
for (int y=0; y<height; y+=4)
|
||||
for (int x=0; x<width; x+=8)
|
||||
for (int iy=0; iy<4; iy++, src+=8)
|
||||
decodebytesI8((u32*)dst+(y+iy)*width+x,src,8);
|
||||
}
|
||||
return TEXTUREFMT(GL_BGRA, GL_UNSIGNED_BYTE);
|
||||
case GX_TF_IA4:
|
||||
{
|
||||
for (int y=0; y<height; y+=4)
|
||||
for (int x=0; x<width; x+=8)
|
||||
for (int iy=0; iy<4; iy++, src+=8)
|
||||
decodebytesIA4((u32*)dst+(y+iy)*width+x,src,8);
|
||||
}
|
||||
return TEXTUREFMT(GL_BGRA, GL_UNSIGNED_BYTE);
|
||||
case GX_TF_IA8:
|
||||
{
|
||||
for (int y=0; y<height; y+=4)
|
||||
for (int x=0; x<width; x+=4)
|
||||
for (int iy=0; iy<4; iy++,src+=8)
|
||||
decodebytesIA8((u32*)dst+(y+iy)*width+x,(u16*)src,4);
|
||||
}
|
||||
return TEXTUREFMT(GL_BGRA, GL_UNSIGNED_BYTE);
|
||||
case GX_TF_C14X2:
|
||||
{
|
||||
for (int y=0; y<height; y+=4)
|
||||
for (int x=0; x<width; x+=4)
|
||||
for (int iy=0; iy<4; iy++,src+=8)
|
||||
decodebytesC14X2((u32*)dst+(y+iy)*width+x,(u16*)src,4,tlutaddr,tlutfmt);
|
||||
}
|
||||
return TEXTUREFMT(GL_BGRA, GL_UNSIGNED_BYTE);
|
||||
case GX_TF_RGB565:
|
||||
{
|
||||
for (int y=0; y<height; y+=4)
|
||||
for (int x=0; x<width; x+=4)
|
||||
for (int iy=0; iy<4; iy++,src+=8)
|
||||
decodebytesRGB565((u32*)dst+(y+iy)*width+x,(u16*)src,4);
|
||||
}
|
||||
return TEXTUREFMT(GL_BGRA, GL_UNSIGNED_BYTE);
|
||||
case GX_TF_RGB5A3:
|
||||
{
|
||||
for (int y=0; y<height; y+=4)
|
||||
for (int x=0; x<width; x+=4)
|
||||
for (int iy=0; iy<4; iy++,src+=8)
|
||||
decodebytesRGB5A3((u32*)dst+(y+iy)*width+x,(u16*)src,4);
|
||||
}
|
||||
return TEXTUREFMT(GL_BGRA, GL_UNSIGNED_BYTE);
|
||||
case GX_TF_RGBA8:
|
||||
{
|
||||
for (int y=0; y<height; y+=4)
|
||||
for (int x=0; x<width; x+=4)
|
||||
{
|
||||
for (int iy=0; iy<4; iy++,src+=8)
|
||||
decodebytesARGB8pass1((u32*)dst+(y+iy)*width+x,(u16*)src,4);
|
||||
for (int iy=0; iy<4; iy++,src+=8)
|
||||
decodebytesARGB8pass2((u32*)dst+(y+iy)*width+x,(u16*)src,4);
|
||||
}
|
||||
}
|
||||
return TEXTUREFMT(GL_BGRA, GL_UNSIGNED_BYTE);
|
||||
case GX_TF_CMPR:
|
||||
{
|
||||
// 11111111 22222222 55555555 66666666
|
||||
// 33333333 44444444 77777777 88888888
|
||||
|
||||
|
||||
for (int y=0; y<height; y+=8)
|
||||
for (int x=0; x<width; x+=8)
|
||||
{
|
||||
decodeDXTBlock((u32*)dst+y*width+x,(DXTBlock*)src,width);src+=sizeof(DXTBlock);
|
||||
decodeDXTBlock((u32*)dst+y*width+x+4,(DXTBlock*)src,width);src+=sizeof(DXTBlock);
|
||||
decodeDXTBlock((u32*)dst+(y+4)*width+x,(DXTBlock*)src,width);src+=sizeof(DXTBlock);
|
||||
decodeDXTBlock((u32*)dst+(y+4)*width+x+4,(DXTBlock*)src,width);src+=sizeof(DXTBlock);
|
||||
}
|
||||
}
|
||||
return TEXTUREFMT(GL_BGRA, GL_UNSIGNED_BYTE);
|
||||
}
|
||||
|
||||
// The "copy" texture formats, too?
|
||||
|
||||
return TEXTUREFMT(0, 0);
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#ifndef _TEXTUREDECODER_H
|
||||
#define _TEXTUREDECODER_H
|
||||
|
||||
enum
|
||||
{
|
||||
TMEM_SIZE = 1024*1024,
|
||||
HALFTMEM_SIZE = 512*1024
|
||||
};
|
||||
extern u8 texMem[TMEM_SIZE];
|
||||
|
||||
enum TextureFormat
|
||||
{
|
||||
GX_TF_I4 = 0x0,
|
||||
GX_TF_I8 = 0x1,
|
||||
GX_TF_IA4 = 0x2,
|
||||
GX_TF_IA8 = 0x3,
|
||||
GX_TF_RGB565 = 0x4,
|
||||
GX_TF_RGB5A3 = 0x5,
|
||||
GX_TF_RGBA8 = 0x6,
|
||||
GX_TF_C4 = 0x8,
|
||||
GX_TF_C8 = 0x9,
|
||||
GX_TF_C14X2 = 0xA,
|
||||
GX_TF_CMPR = 0xE,
|
||||
|
||||
_GX_TF_CTF = 0x20, // copy-texture-format only (simply means linear?)
|
||||
_GX_TF_ZTF = 0x10, // Z-texture-format
|
||||
|
||||
// these formats are also valid when copying targets
|
||||
GX_CTF_R4 = 0x0 | _GX_TF_CTF,
|
||||
GX_CTF_RA4 = 0x2 | _GX_TF_CTF,
|
||||
GX_CTF_RA8 = 0x3 | _GX_TF_CTF,
|
||||
GX_CTF_YUVA8 = 0x6 | _GX_TF_CTF,
|
||||
GX_CTF_A8 = 0x7 | _GX_TF_CTF,
|
||||
GX_CTF_R8 = 0x8 | _GX_TF_CTF,
|
||||
GX_CTF_G8 = 0x9 | _GX_TF_CTF,
|
||||
GX_CTF_B8 = 0xA | _GX_TF_CTF,
|
||||
GX_CTF_RG8 = 0xB | _GX_TF_CTF,
|
||||
GX_CTF_GB8 = 0xC | _GX_TF_CTF,
|
||||
|
||||
GX_TF_Z8 = 0x1 | _GX_TF_ZTF,
|
||||
GX_TF_Z16 = 0x3 | _GX_TF_ZTF,
|
||||
GX_TF_Z24X8 = 0x6 | _GX_TF_ZTF,
|
||||
|
||||
GX_CTF_Z4 = 0x0 | _GX_TF_ZTF | _GX_TF_CTF,
|
||||
GX_CTF_Z8M = 0x9 | _GX_TF_ZTF | _GX_TF_CTF,
|
||||
GX_CTF_Z8L = 0xA | _GX_TF_ZTF | _GX_TF_CTF,
|
||||
GX_CTF_Z16L = 0xC | _GX_TF_ZTF | _GX_TF_CTF,
|
||||
};
|
||||
|
||||
int TexDecoder_GetTexelSizeInNibbles(int format);
|
||||
int TexDecoder_GetBlockWidthInTexels(int format);
|
||||
int TexDecoder_GetPaletteSize(int fmt);
|
||||
|
||||
TEXTUREFMT TexDecoder_Decode(u8 *dst, u8 *src, int width, int height, int texformat, int tlutaddr, int tlutfmt);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,578 @@
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <intrin.h>
|
||||
#endif
|
||||
|
||||
#include "Globals.h"
|
||||
|
||||
#include "Render.h"
|
||||
|
||||
#include "MemoryUtil.h"
|
||||
#include "BPStructs.h"
|
||||
#include "TextureDecoder.h"
|
||||
#include "TextureMngr.h"
|
||||
#include "PixelShader.h"
|
||||
#include "VertexShader.h"
|
||||
|
||||
u8 *TextureMngr::temp = NULL;
|
||||
TextureMngr::TexCache TextureMngr::textures;
|
||||
std::map<u32, TextureMngr::DEPTHTARGET> TextureMngr::mapDepthTargets;
|
||||
int TextureMngr::nTex2DEnabled, TextureMngr::nTexRECTEnabled;
|
||||
|
||||
extern int frameCount;
|
||||
static u32 s_TempFramebuffer = 0;
|
||||
#define TEMP_SIZE (1024*1024*4)
|
||||
|
||||
const GLint c_MinLinearFilter[8] = {
|
||||
GL_NEAREST, GL_NEAREST_MIPMAP_NEAREST, GL_NEAREST_MIPMAP_LINEAR, GL_NEAREST,
|
||||
GL_LINEAR, GL_LINEAR_MIPMAP_NEAREST, GL_LINEAR_MIPMAP_LINEAR, GL_LINEAR};
|
||||
|
||||
const GLint c_WrapSettings[4] = { GL_CLAMP_TO_EDGE, GL_REPEAT, GL_MIRRORED_REPEAT, GL_REPEAT };
|
||||
|
||||
void TextureMngr::TCacheEntry::SetTextureParameters(TexMode0& newmode)
|
||||
{
|
||||
mode = newmode;
|
||||
if( isNonPow2 ) {
|
||||
// very limited!
|
||||
glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_MAG_FILTER, (newmode.mag_filter||g_Config.bForceFiltering)?GL_LINEAR:GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_MIN_FILTER, (g_Config.bForceFiltering||newmode.min_filter>=4)?GL_LINEAR:GL_NEAREST);
|
||||
if( newmode.wrap_s == 2 || newmode.wrap_t == 2 ) {
|
||||
DEBUG_LOG("cannot support mirrorred repeat mode\n");
|
||||
}
|
||||
}
|
||||
else {
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, (newmode.mag_filter||g_Config.bForceFiltering)?GL_LINEAR:GL_NEAREST);
|
||||
|
||||
if( bHaveMipMaps ) {
|
||||
int filt = newmode.min_filter;
|
||||
if( g_Config.bForceFiltering && newmode.min_filter < 4 )
|
||||
newmode.min_filter += 4; // take equivalent forced linear
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, c_MinLinearFilter[filt]);
|
||||
}
|
||||
else
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, (g_Config.bForceFiltering||newmode.min_filter>=4)?GL_LINEAR:GL_NEAREST);
|
||||
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, c_WrapSettings[newmode.wrap_s]);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, c_WrapSettings[newmode.wrap_t]);
|
||||
}
|
||||
|
||||
if (g_Config.bForceMaxAniso)
|
||||
{
|
||||
// not used for now, check out GL_EXT_texture_filter_anisotropic
|
||||
}
|
||||
}
|
||||
|
||||
void TextureMngr::TCacheEntry::Destroy()
|
||||
{
|
||||
SAFE_RELEASE_TEX(texture);
|
||||
}
|
||||
|
||||
void TextureMngr::Init()
|
||||
{
|
||||
temp = (u8*)AllocateMemoryPages(TEMP_SIZE);
|
||||
nTex2DEnabled = nTexRECTEnabled = 0;
|
||||
}
|
||||
|
||||
void TextureMngr::Invalidate()
|
||||
{
|
||||
TexCache::iterator iter = textures.begin();
|
||||
for (;iter!=textures.end();iter++)
|
||||
iter->second.Destroy();
|
||||
textures.clear();
|
||||
}
|
||||
|
||||
void TextureMngr::Shutdown()
|
||||
{
|
||||
Invalidate();
|
||||
std::map<u32, DEPTHTARGET>::iterator itdepth = mapDepthTargets.begin();
|
||||
for (itdepth = mapDepthTargets.begin(); itdepth != mapDepthTargets.end(); ++itdepth) {
|
||||
glDeleteRenderbuffersEXT(1, &itdepth->second.targ);
|
||||
}
|
||||
mapDepthTargets.clear();
|
||||
|
||||
if( s_TempFramebuffer ) {
|
||||
glDeleteFramebuffersEXT(1, &s_TempFramebuffer);
|
||||
s_TempFramebuffer = 0;
|
||||
}
|
||||
|
||||
FreeMemoryPages(temp, TEMP_SIZE);
|
||||
temp = NULL;
|
||||
}
|
||||
|
||||
void TextureMngr::Cleanup()
|
||||
{
|
||||
TexCache::iterator iter = textures.begin();
|
||||
|
||||
while(iter!=textures.end()) {
|
||||
if (frameCount > 20 + iter->second.frameCount) {
|
||||
if (!iter->second.isRenderTarget) {
|
||||
u32 *ptr = (u32*)g_VideoInitialize.pGetMemoryPointer(iter->second.addr + iter->second.hashoffset*4);
|
||||
if (*ptr == iter->second.hash)
|
||||
*ptr = iter->second.oldpixel;
|
||||
iter->second.Destroy();
|
||||
#ifdef _WIN32
|
||||
iter = textures.erase(iter);
|
||||
#else
|
||||
textures.erase(iter++);
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
iter->second.Destroy();
|
||||
#ifdef _WIN32
|
||||
iter = textures.erase(iter);
|
||||
#else
|
||||
textures.erase(iter++);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else
|
||||
iter++;
|
||||
}
|
||||
|
||||
std::map<u32, DEPTHTARGET>::iterator itdepth = mapDepthTargets.begin();
|
||||
while(itdepth != mapDepthTargets.end()) {
|
||||
if( frameCount > 20 + itdepth->second.framecount) {
|
||||
#ifdef _WIN32
|
||||
itdepth = mapDepthTargets.erase(itdepth);
|
||||
#else
|
||||
mapDepthTargets.erase(itdepth++);
|
||||
#endif
|
||||
}
|
||||
else ++itdepth;
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef _WIN32
|
||||
inline u32 _rotl(u32 x, int shift) {
|
||||
return (x << shift) | (x >> (32 - shift));
|
||||
}
|
||||
#endif
|
||||
TextureMngr::TCacheEntry* TextureMngr::Load(int texstage, u32 address, int width, int height, int format, int tlutaddr, int tlutfmt)
|
||||
{
|
||||
if (address == 0 )
|
||||
return NULL;
|
||||
|
||||
TexCache::iterator iter = textures.find(address);
|
||||
TexMode0 &tm0 = bpmem.tex[texstage>3].texMode0[texstage&3];
|
||||
u8 *ptr = g_VideoInitialize.pGetMemoryPointer(address);
|
||||
|
||||
int palSize = TexDecoder_GetPaletteSize(format);
|
||||
u32 palhash = 0xc0debabe;
|
||||
|
||||
if (palSize) {
|
||||
if (palSize>16)
|
||||
palSize = 16; //let's not do excessive amount of checking
|
||||
u8 *pal = g_VideoInitialize.pGetMemoryPointer(tlutaddr);
|
||||
if (pal != 0) {
|
||||
for (int i=0; i<palSize; i++) {
|
||||
palhash = _rotl(palhash,13);
|
||||
palhash ^= pal[i];
|
||||
palhash += 31;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (iter != textures.end()) {
|
||||
TCacheEntry &entry = iter->second;
|
||||
|
||||
if( entry.isRenderTarget || ((u32 *)ptr)[entry.hashoffset] == entry.hash && palhash == entry.paletteHash) { //stupid, improve
|
||||
entry.frameCount = frameCount;
|
||||
//glEnable(entry.isNonPow2?GL_TEXTURE_RECTANGLE_NV:GL_TEXTURE_2D);
|
||||
glBindTexture(entry.isNonPow2?GL_TEXTURE_RECTANGLE_NV:GL_TEXTURE_2D, entry.texture);
|
||||
if (entry.mode.hex != tm0.hex)
|
||||
entry.SetTextureParameters(tm0);
|
||||
return &entry;
|
||||
}
|
||||
else
|
||||
{
|
||||
// can potentially do some caching
|
||||
|
||||
//TCacheEntry &entry = entry;
|
||||
/*if (width == entry.w && height==entry.h && format==entry.fmt)
|
||||
{
|
||||
LPDIRECT3DTEXTURE9 tex = entry.texture;
|
||||
int bs = TexDecoder_GetBlockWidthInTexels(format)-1; //TexelSizeInNibbles(format)*width*height/16;
|
||||
int expandedWidth = (width+bs) & (~bs);
|
||||
D3DFORMAT dfmt = TexDecoder_Decode(temp,ptr,expandedWidth,height,format, tlutaddr, tlutfmt);
|
||||
ReplaceTexture2D(tex,temp,width,height,expandedWidth,dfmt);
|
||||
dev->SetTexture(texstage, stage,tex);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{*/
|
||||
entry.Destroy();
|
||||
textures.erase(iter);
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
int bs = TexDecoder_GetBlockWidthInTexels(format)-1; //TexelSizeInNibbles(format)*width*height/16;
|
||||
int expandedWidth = (width+bs) & (~bs);
|
||||
TEXTUREFMT dfmt = TexDecoder_Decode(temp,ptr,expandedWidth,height,format, tlutaddr, tlutfmt);
|
||||
|
||||
//Make an entry in the table
|
||||
TCacheEntry& entry = textures[address];
|
||||
|
||||
entry.hashoffset = 0;
|
||||
entry.hash = (u32)(((double)rand() / RAND_MAX) * 0xFFFFFFFF);
|
||||
entry.paletteHash = palhash;
|
||||
entry.oldpixel = ((u32 *)ptr)[entry.hashoffset];
|
||||
((u32 *)ptr)[entry.hashoffset] = entry.hash;
|
||||
|
||||
entry.addr = address;
|
||||
entry.isRenderTarget=false;
|
||||
|
||||
entry.isNonPow2 = ((width&(width-1)) || (height&(height-1)));
|
||||
|
||||
glGenTextures(1, &entry.texture);
|
||||
GLenum target = entry.isNonPow2 ? GL_TEXTURE_RECTANGLE_NV : GL_TEXTURE_2D;
|
||||
glBindTexture(target, entry.texture);
|
||||
|
||||
if (expandedWidth != width)
|
||||
glPixelStorei(GL_UNPACK_ROW_LENGTH, expandedWidth);
|
||||
|
||||
if( !entry.isNonPow2 && ((tm0.min_filter&3)==1||(tm0.min_filter&3)==2) ) {
|
||||
gluBuild2DMipmaps(GL_TEXTURE_2D, 4, width, height, GL_BGRA, GL_UNSIGNED_BYTE, temp);
|
||||
entry.bHaveMipMaps = true;
|
||||
}
|
||||
else
|
||||
glTexImage2D(target, 0, 4, width, height, 0, dfmt.format, dfmt.type, temp);
|
||||
|
||||
if (expandedWidth != width) // reset
|
||||
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
|
||||
|
||||
entry.frameCount = frameCount;
|
||||
entry.w=width;
|
||||
entry.h=height;
|
||||
entry.fmt=format;
|
||||
entry.SetTextureParameters(tm0);
|
||||
|
||||
if (g_Config.bDumpTextures) { // dump texture to file
|
||||
static int counter = 0;
|
||||
char szTemp[MAX_PATH];
|
||||
sprintf(szTemp, "%s\\txt_%04i_%i.png", g_Config.texDumpPath, counter++, format);
|
||||
|
||||
SaveTexture(szTemp,target, entry.texture, width, height);
|
||||
}
|
||||
|
||||
INCSTAT(stats.numTexturesCreated);
|
||||
SETSTAT(stats.numTexturesAlive,textures.size());
|
||||
|
||||
//glEnable(entry.isNonPow2?GL_TEXTURE_RECTANGLE_NV:GL_TEXTURE_2D);
|
||||
|
||||
//SaveTexture("tex.tga", target, entry.texture, entry.w, entry.h);
|
||||
return &entry;
|
||||
}
|
||||
|
||||
void TextureMngr::CopyRenderTargetToTexture(u32 address, bool bFromZBuffer, bool bIsIntensityFmt, u32 copyfmt, bool bScaleByHalf, TRectangle *source)
|
||||
{
|
||||
DVSTARTPROFILE();
|
||||
GL_REPORT_ERRORD();
|
||||
|
||||
// for intensity values, use Y of YUV format!
|
||||
// for all purposes, treat 4bit equivalents as 8bit (probably just used for compression)
|
||||
// RGBA8 - RGBA8
|
||||
// RGB565 - RGB565
|
||||
// RGB5A3 - RGB5A3
|
||||
// I4,R4,Z4 - I4
|
||||
// IA4,RA4 - IA4
|
||||
// Z8M,G8,I8,A8,Z8,R8,B8,Z8L - I8
|
||||
// Z16,GB8,RG8,Z16L,IA8,RA8 - IA8
|
||||
bool bIsInit = textures.find(address) != textures.end();
|
||||
|
||||
PRIM_LOG("copytarg: addr=0x%x, fromz=%d, intfmt=%d, copyfmt=%d\n", address, (int)bFromZBuffer,(int)bIsIntensityFmt,copyfmt);
|
||||
|
||||
TCacheEntry& entry = textures[address];
|
||||
entry.isNonPow2 = true;
|
||||
entry.hash = 0;
|
||||
entry.hashoffset = 0;
|
||||
entry.frameCount = frameCount;
|
||||
|
||||
int mult = bScaleByHalf?2:1;
|
||||
int w = (abs(source->right-source->left)/mult+7)&~7;
|
||||
int h = (abs(source->bottom-source->top)/mult+7)&~7;
|
||||
|
||||
GL_REPORT_ERRORD();
|
||||
|
||||
if( !bIsInit ) {
|
||||
glGenTextures(1, &entry.texture);
|
||||
glBindTexture(GL_TEXTURE_RECTANGLE_NV, entry.texture);
|
||||
glTexImage2D(GL_TEXTURE_RECTANGLE_NV, 0, 4, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
|
||||
GL_REPORT_ERRORD();
|
||||
}
|
||||
else {
|
||||
_assert_(entry.texture);
|
||||
bool bReInit = true;
|
||||
|
||||
if( entry.w == w && entry.h == h ) {
|
||||
glBindTexture(GL_TEXTURE_RECTANGLE_NV, entry.texture);
|
||||
// for some reason mario sunshine errors here...
|
||||
GLenum err = GL_NO_ERROR;
|
||||
GL_REPORT_ERROR();
|
||||
if( err == GL_NO_ERROR )
|
||||
bReInit = false;
|
||||
}
|
||||
|
||||
if( bReInit ) {
|
||||
// necessary, for some reason opengl gives errors when texture isn't deleted
|
||||
glDeleteTextures(1,&entry.texture);
|
||||
glGenTextures(1, &entry.texture);
|
||||
glBindTexture(GL_TEXTURE_RECTANGLE_NV, entry.texture);
|
||||
glTexImage2D(GL_TEXTURE_RECTANGLE_NV, 0, 4, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
|
||||
GL_REPORT_ERRORD();
|
||||
}
|
||||
}
|
||||
|
||||
if( !bIsInit || !entry.isRenderTarget ) {
|
||||
glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
|
||||
glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
if( glGetError() != GL_NO_ERROR) {
|
||||
glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_WRAP_S, GL_CLAMP);
|
||||
glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_WRAP_T, GL_CLAMP);
|
||||
GL_REPORT_ERRORD();
|
||||
}
|
||||
}
|
||||
|
||||
entry.w = w;
|
||||
entry.h = h;
|
||||
entry.isRenderTarget=true;
|
||||
entry.fmt = copyfmt;
|
||||
|
||||
float colmat[16];
|
||||
float fConstAdd[4] = {0};
|
||||
memset(colmat, 0, sizeof(colmat));
|
||||
|
||||
if( bFromZBuffer ) {
|
||||
switch(copyfmt) {
|
||||
case 0: // Z4
|
||||
case 1: // Z8
|
||||
colmat[2] = colmat[6] = colmat[10] = colmat[14] = 1;
|
||||
break;
|
||||
|
||||
case 3: // Z16 //?
|
||||
case 11: // Z16
|
||||
colmat[1] = colmat[5] = colmat[9] = colmat[14] = 1;
|
||||
break;
|
||||
case 6: // Z24X8
|
||||
colmat[0] = 1;
|
||||
colmat[5] = 1;
|
||||
colmat[10] = 1;
|
||||
break;
|
||||
case 9: // Z8M
|
||||
colmat[1] = colmat[5] = colmat[9] = colmat[13] = 1;
|
||||
break;
|
||||
case 10: // Z8L
|
||||
colmat[0] = colmat[4] = colmat[8] = colmat[12] = 1;
|
||||
break;
|
||||
case 12: // Z16L
|
||||
colmat[0] = colmat[4] = colmat[8] = colmat[13] = 1;
|
||||
break;
|
||||
default:
|
||||
ERROR_LOG("Unknown copy zbuf format: 0x%x\n", copyfmt);
|
||||
colmat[0] = colmat[5] = colmat[10] = colmat[15] = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if( bIsIntensityFmt ) {
|
||||
fConstAdd[0] = fConstAdd[1] = fConstAdd[2] = 16.0f/255.0f;
|
||||
switch(copyfmt) {
|
||||
case 0: // I4
|
||||
case 1: // I8
|
||||
case 2: // IA4
|
||||
case 3: // IA8
|
||||
colmat[0] = 0.257f; colmat[1] = 0.504f; colmat[2] = 0.098f;
|
||||
colmat[4] = 0.257f; colmat[5] = 0.504f; colmat[6] = 0.098f;
|
||||
colmat[8] = 0.257f; colmat[9] = 0.504f; colmat[10] = 0.098f;
|
||||
if( copyfmt < 2 ) {
|
||||
fConstAdd[3] = 16.0f/255.0f;
|
||||
colmat[12] = 0.257f; colmat[13] = 0.504f; colmat[14] = 0.098f;
|
||||
}
|
||||
else { // alpha
|
||||
colmat[15] = 1;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
ERROR_LOG("Unknown copy intensity format: 0x%x\n", copyfmt);
|
||||
colmat[0] = colmat[5] = colmat[10] = colmat[15] = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
switch(copyfmt) {
|
||||
case 0: // R4
|
||||
case 8: // R8
|
||||
colmat[0] = colmat[4] = colmat[8] = colmat[12] = 1;
|
||||
break;
|
||||
case 2: // RA4
|
||||
case 3: // RA8
|
||||
colmat[0] = colmat[4] = colmat[8] = colmat[15] = 1;
|
||||
break;
|
||||
|
||||
case 7: // A8
|
||||
colmat[3] = colmat[7] = colmat[11] = colmat[15] = 1;
|
||||
break;
|
||||
case 9: // G8
|
||||
colmat[1] = colmat[5] = colmat[9] = colmat[13] = 1;
|
||||
break;
|
||||
case 10: // B8
|
||||
colmat[2] = colmat[6] = colmat[10] = colmat[14] = 1;
|
||||
break;
|
||||
case 11: // RG8
|
||||
colmat[0] = colmat[4] = colmat[8] = colmat[13] = 1;
|
||||
break;
|
||||
case 12: // GB8
|
||||
colmat[1] = colmat[5] = colmat[9] = colmat[14] = 1;
|
||||
break;
|
||||
|
||||
case 4: // RGB565
|
||||
colmat[0] = colmat[5] = colmat[10] = 1;
|
||||
fConstAdd[3] = 1; // set alpha to 1
|
||||
break;
|
||||
case 5: // RGB5A3
|
||||
case 6: // RGBA8
|
||||
colmat[0] = colmat[5] = colmat[10] = colmat[15] = 1;
|
||||
break;
|
||||
|
||||
default:
|
||||
ERROR_LOG("Unknown copy color format: 0x%x\n", copyfmt);
|
||||
colmat[0] = colmat[5] = colmat[10] = colmat[15] = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// if( bCopyToTarget ) {
|
||||
// _assert_( glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT) == GL_FRAMEBUFFER_COMPLETE_EXT );
|
||||
// glReadBuffer(GL_COLOR_ATTACHMENT0_EXT);
|
||||
// GL_REPORT_ERRORD();
|
||||
// glCopyTexSubImage2D(GL_TEXTURE_RECTANGLE_NV, 0, 0, 0, source->left, source->top, source->right-source->left, source->bottom-source->top);
|
||||
// entry.isUpsideDown = true; // note that the copy is upside down!!
|
||||
// GL_REPORT_ERRORD();
|
||||
// return;
|
||||
// }
|
||||
|
||||
Renderer::SetRenderMode(Renderer::RM_Normal); // set back to normal
|
||||
GL_REPORT_ERRORD();
|
||||
|
||||
// have to run a pixel shader
|
||||
|
||||
Renderer::ResetGLState(); // reset any game specific settings
|
||||
|
||||
if( s_TempFramebuffer == 0 )
|
||||
glGenFramebuffersEXT( 1, &s_TempFramebuffer);
|
||||
|
||||
Renderer::SetFramebuffer(s_TempFramebuffer);
|
||||
Renderer::SetRenderTarget(entry.texture);
|
||||
GL_REPORT_ERRORD();
|
||||
|
||||
// create and attach the render target
|
||||
std::map<u32, DEPTHTARGET>::iterator itdepth = mapDepthTargets.find((h<<16)|w);
|
||||
|
||||
if( itdepth == mapDepthTargets.end() ) {
|
||||
DEPTHTARGET& depth = mapDepthTargets[(h<<16)|w];
|
||||
depth.framecount = frameCount;
|
||||
glGenRenderbuffersEXT( 1, &depth.targ);
|
||||
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, depth.targ);
|
||||
glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT/*GL_DEPTH24_STENCIL8_EXT*/, w, h);
|
||||
GL_REPORT_ERRORD();
|
||||
Renderer::SetDepthTarget(depth.targ);
|
||||
GL_REPORT_ERRORD();
|
||||
}
|
||||
else {
|
||||
itdepth->second.framecount = frameCount;
|
||||
Renderer::SetDepthTarget(itdepth->second.targ);
|
||||
GL_REPORT_ERRORD();
|
||||
}
|
||||
|
||||
glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT);
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
glBindTexture(GL_TEXTURE_RECTANGLE_NV, bFromZBuffer?Renderer::GetZBufferTarget():Renderer::GetRenderTarget());
|
||||
TextureMngr::EnableTexRECT(0);
|
||||
|
||||
glViewport(0, 0, w, h);
|
||||
|
||||
glEnable(GL_FRAGMENT_PROGRAM_ARB);
|
||||
glBindProgramARB( GL_FRAGMENT_PROGRAM_ARB, PixelShaderMngr::GetColorMatrixProgram());
|
||||
PixelShaderMngr::SetColorMatrix(colmat, fConstAdd); // set transformation
|
||||
GL_REPORT_ERRORD();
|
||||
|
||||
glBegin(GL_QUADS);
|
||||
glTexCoord2f((float)source->left, Renderer::GetTargetHeight()-(float)source->bottom); glVertex2f(-1,1);
|
||||
glTexCoord2f((float)source->left, Renderer::GetTargetHeight()-(float)source->top); glVertex2f(-1,-1);
|
||||
glTexCoord2f((float)source->right, Renderer::GetTargetHeight()-(float)source->top); glVertex2f(1,-1);
|
||||
glTexCoord2f((float)source->right, Renderer::GetTargetHeight()-(float)source->bottom); glVertex2f(1,1);
|
||||
glEnd();
|
||||
|
||||
GL_REPORT_ERRORD();
|
||||
|
||||
Renderer::SetFramebuffer(0);
|
||||
Renderer::RestoreGLState();
|
||||
VertexShaderMngr::SetViewportChanged();
|
||||
|
||||
TextureMngr::DisableStage(0);
|
||||
|
||||
if( bFromZBuffer )
|
||||
Renderer::SetZBufferRender(); // notify for future settings
|
||||
|
||||
GL_REPORT_ERRORD();
|
||||
//SaveTexture("frame.tga", GL_TEXTURE_RECTANGLE_NV, entry.texture, entry.w, entry.h);
|
||||
//SaveTexture("tex.tga", GL_TEXTURE_RECTANGLE_NV, Renderer::GetZBufferTarget(), Renderer::GetTargetWidth(), Renderer::GetTargetHeight());
|
||||
}
|
||||
|
||||
void TextureMngr::EnableTex2D(int stage)
|
||||
{
|
||||
if( !(nTex2DEnabled & (1<<stage)) ) {
|
||||
nTex2DEnabled |= (1<<stage);
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
}
|
||||
if( nTexRECTEnabled & (1<<stage) ) {
|
||||
nTexRECTEnabled &= ~(1<<stage);
|
||||
glDisable(GL_TEXTURE_RECTANGLE_NV);
|
||||
}
|
||||
}
|
||||
|
||||
void TextureMngr::EnableTexRECT(int stage)
|
||||
{
|
||||
if( (nTex2DEnabled & (1<<stage)) ) {
|
||||
nTex2DEnabled &= ~(1<<stage);
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
}
|
||||
if( !(nTexRECTEnabled & (1<<stage)) ) {
|
||||
nTexRECTEnabled |= (1<<stage);
|
||||
glEnable(GL_TEXTURE_RECTANGLE_NV);
|
||||
}
|
||||
}
|
||||
|
||||
void TextureMngr::DisableStage(int stage)
|
||||
{
|
||||
bool bset = false;
|
||||
if( nTex2DEnabled & (1<<stage) ) {
|
||||
nTex2DEnabled &= ~(1<<stage);
|
||||
glActiveTexture(GL_TEXTURE0+stage);
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
bset = true;
|
||||
}
|
||||
if( nTexRECTEnabled & (1<<stage) ) {
|
||||
nTexRECTEnabled &= ~(1<<stage);
|
||||
if( !bset ) glActiveTexture(GL_TEXTURE0+stage);
|
||||
glDisable(GL_TEXTURE_RECTANGLE_NV);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#ifndef _TextureMngr_H
|
||||
#define _TextureMngr_H
|
||||
|
||||
#include <map>
|
||||
#include "BPStructs.h"
|
||||
|
||||
struct TRectangle
|
||||
{
|
||||
int left, top, right, bottom;
|
||||
};
|
||||
|
||||
class TextureMngr
|
||||
{
|
||||
public:
|
||||
struct TCacheEntry
|
||||
{
|
||||
TCacheEntry() : texture(0), addr(0), hash(0), w(0), h(0), isRenderTarget(false), isUpsideDown(false), isNonPow2(true), bHaveMipMaps(false) { mode.hex = 0xFCFCFCFC; }
|
||||
|
||||
u32 texture;
|
||||
u32 addr;
|
||||
u32 hash;
|
||||
u32 paletteHash;
|
||||
u32 hashoffset;
|
||||
u32 oldpixel; // used for simple cleanup
|
||||
TexMode0 mode; // current filter and clamp modes that texture is set to
|
||||
|
||||
int frameCount;
|
||||
int w,h,fmt;
|
||||
|
||||
bool isRenderTarget; // if render texture, then rendertex is filled with the direct copy of the render target
|
||||
// later conversions would have to convert properly from rendertexfmt to texfmt
|
||||
bool isUpsideDown;
|
||||
bool isNonPow2; // if nonpow2, use GL_TEXTURE_2D, else GL_TEXTURE_RECTANGLE_NV
|
||||
bool bHaveMipMaps;
|
||||
|
||||
void SetTextureParameters(TexMode0& newmode);
|
||||
void Destroy();
|
||||
void ConvertFromRenderTarget(u32 taddr, int twidth, int theight, int tformat, int tlutaddr, int tlutfmt);
|
||||
};
|
||||
|
||||
struct DEPTHTARGET
|
||||
{
|
||||
DEPTHTARGET() : targ(0), framecount(0) {}
|
||||
GLuint targ;
|
||||
int framecount;
|
||||
};
|
||||
|
||||
private:
|
||||
typedef std::map<u32,TCacheEntry> TexCache;
|
||||
|
||||
static u8 *temp;
|
||||
static TexCache textures;
|
||||
static std::map<u32, DEPTHTARGET> mapDepthTargets;
|
||||
static int nTex2DEnabled, nTexRECTEnabled;
|
||||
|
||||
public:
|
||||
|
||||
static void Init();
|
||||
static void Cleanup();
|
||||
static void Shutdown();
|
||||
static void Invalidate();
|
||||
static TCacheEntry* Load(int texstage, u32 address, int width, int height, int format, int tlutaddr, int tlutfmt);
|
||||
static void CopyRenderTargetToTexture(u32 address, bool bFromZBuffer, bool bIsIntensityFmt, u32 copyfmt, bool bScaleByHalf, TRectangle *source);
|
||||
|
||||
static void EnableTex2D(int stage);
|
||||
static void EnableTexRECT(int stage);
|
||||
static void DisableStage(int stage); // sets active texture
|
||||
};
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,417 @@
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#ifndef _VERTEXLOADER_H
|
||||
#define _VERTEXLOADER_H
|
||||
|
||||
#include <vector>
|
||||
|
||||
#define SHADER_POSMTX_ATTRIB 1
|
||||
#define SHADER_NORM1_ATTRIB 6
|
||||
#define SHADER_NORM2_ATTRIB 7
|
||||
|
||||
using namespace std;
|
||||
|
||||
////////////////
|
||||
// CP Structs //
|
||||
////////////////
|
||||
|
||||
// Vertex array numbers
|
||||
enum
|
||||
{
|
||||
ARRAY_POSITION = 0,
|
||||
ARRAY_NORMAL = 1,
|
||||
ARRAY_COLOR = 2,
|
||||
ARRAY_COLOR2 = 3,
|
||||
ARRAY_TEXCOORD0 = 4
|
||||
};
|
||||
|
||||
// Vertex components
|
||||
enum
|
||||
{
|
||||
NOT_PRESENT = 0,
|
||||
DIRECT = 1,
|
||||
INDEX8 = 2,
|
||||
INDEX16 = 3,
|
||||
};
|
||||
|
||||
#pragma pack(4)
|
||||
|
||||
union TVtxDesc
|
||||
{
|
||||
u64 Hex;
|
||||
struct
|
||||
{
|
||||
// 0: not present
|
||||
// 1: present
|
||||
unsigned PosMatIdx : 1;
|
||||
unsigned Tex0MatIdx : 1;
|
||||
unsigned Tex1MatIdx : 1;
|
||||
unsigned Tex2MatIdx : 1;
|
||||
unsigned Tex3MatIdx : 1;
|
||||
unsigned Tex4MatIdx : 1;
|
||||
unsigned Tex5MatIdx : 1;
|
||||
unsigned Tex6MatIdx : 1;
|
||||
unsigned Tex7MatIdx : 1;
|
||||
|
||||
// 00: not present
|
||||
// 01: direct
|
||||
// 10: 8 bit index
|
||||
// 11: 16 bit index
|
||||
unsigned Position : 2;
|
||||
unsigned Normal : 2;
|
||||
unsigned Color0 : 2;
|
||||
unsigned Color1 : 2;
|
||||
unsigned Tex0Coord : 2;
|
||||
unsigned Tex1Coord : 2;
|
||||
unsigned Tex2Coord : 2;
|
||||
unsigned Tex3Coord : 2;
|
||||
unsigned Tex4Coord : 2;
|
||||
unsigned Tex5Coord : 2;
|
||||
unsigned Tex6Coord : 2;
|
||||
unsigned Tex7Coord : 2;
|
||||
unsigned :31;
|
||||
};
|
||||
struct {
|
||||
u32 Hex0, Hex1;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
FORMAT_UBYTE = 0, // 2 Cmp
|
||||
FORMAT_BYTE = 1, // 3 Cmp
|
||||
FORMAT_USHORT = 2,
|
||||
FORMAT_SHORT = 3,
|
||||
FORMAT_FLOAT = 4,
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
FORMAT_16B_565 = 0, // NA
|
||||
FORMAT_24B_888 = 1,
|
||||
FORMAT_32B_888x = 2,
|
||||
FORMAT_16B_4444 = 3,
|
||||
FORMAT_24B_6666 = 4,
|
||||
FORMAT_32B_8888 = 5,
|
||||
};
|
||||
|
||||
union UVAT_group0
|
||||
{
|
||||
u32 Hex;
|
||||
struct
|
||||
{
|
||||
// 0:8
|
||||
unsigned PosElements : 1;
|
||||
unsigned PosFormat : 3;
|
||||
unsigned PosFrac : 5;
|
||||
// 9:12
|
||||
unsigned NormalElements : 1;
|
||||
unsigned NormalFormat : 3;
|
||||
// 13:16
|
||||
unsigned Color0Elements : 1;
|
||||
unsigned Color0Comp : 3;
|
||||
// 17:20
|
||||
unsigned Color1Elements : 1;
|
||||
unsigned Color1Comp : 3;
|
||||
// 21:29
|
||||
unsigned Tex0CoordElements : 1;
|
||||
unsigned Tex0CoordFormat : 3;
|
||||
unsigned Tex0Frac : 5;
|
||||
// 30:31
|
||||
unsigned ByteDequant: 1;
|
||||
unsigned NormalIndex3: 1;
|
||||
};
|
||||
};
|
||||
|
||||
union UVAT_group1
|
||||
{
|
||||
u32 Hex;
|
||||
struct
|
||||
{
|
||||
// 0:8
|
||||
unsigned Tex1CoordElements : 1;
|
||||
unsigned Tex1CoordFormat : 3;
|
||||
unsigned Tex1Frac : 5;
|
||||
// 9:17
|
||||
unsigned Tex2CoordElements : 1;
|
||||
unsigned Tex2CoordFormat : 3;
|
||||
unsigned Tex2Frac : 5;
|
||||
// 18:26
|
||||
unsigned Tex3CoordElements : 1;
|
||||
unsigned Tex3CoordFormat : 3;
|
||||
unsigned Tex3Frac : 5;
|
||||
// 27:30
|
||||
unsigned Tex4CoordElements : 1;
|
||||
unsigned Tex4CoordFormat : 3;
|
||||
//
|
||||
unsigned : 1;
|
||||
};
|
||||
};
|
||||
|
||||
union UVAT_group2
|
||||
{
|
||||
u32 Hex;
|
||||
struct
|
||||
{
|
||||
// 0:4
|
||||
unsigned Tex4Frac : 5;
|
||||
// 5:13
|
||||
unsigned Tex5CoordElements : 1;
|
||||
unsigned Tex5CoordFormat : 3;
|
||||
unsigned Tex5Frac : 5;
|
||||
// 14:22
|
||||
unsigned Tex6CoordElements : 1;
|
||||
unsigned Tex6CoordFormat : 3;
|
||||
unsigned Tex6Frac : 5;
|
||||
// 23:31
|
||||
unsigned Tex7CoordElements : 1;
|
||||
unsigned Tex7CoordFormat : 3;
|
||||
unsigned Tex7Frac : 5;
|
||||
};
|
||||
};
|
||||
|
||||
struct ColorAttr
|
||||
{
|
||||
u8 Elements;
|
||||
u8 Comp;
|
||||
};
|
||||
|
||||
struct TexAttr
|
||||
{
|
||||
u8 Elements;
|
||||
u8 Format;
|
||||
u8 Frac;
|
||||
};
|
||||
|
||||
struct TVtxAttr
|
||||
{
|
||||
u8 PosElements;
|
||||
u8 PosFormat;
|
||||
u8 PosFrac;
|
||||
u8 NormalElements;
|
||||
u8 NormalFormat;
|
||||
ColorAttr color[2];
|
||||
TexAttr texCoord[8];
|
||||
u8 ByteDequant;
|
||||
u8 NormalIndex3;
|
||||
};
|
||||
|
||||
#pragma pack ()
|
||||
|
||||
#define LOADERDECL __cdecl
|
||||
typedef void (LOADERDECL *TPipelineFunction)(void*);
|
||||
|
||||
/// Use to manage loading and setting vertex buffer data for OpenGL
|
||||
class VertexLoader
|
||||
{
|
||||
public:
|
||||
enum
|
||||
{
|
||||
NRM_ZERO = 0,
|
||||
NRM_ONE = 1,
|
||||
NRM_THREE = 3
|
||||
};
|
||||
|
||||
// m_components
|
||||
enum {
|
||||
VB_HAS_POSMTXIDX =(1<<1),
|
||||
VB_HAS_TEXMTXIDX0=(1<<2),
|
||||
VB_HAS_TEXMTXIDX1=(1<<3),
|
||||
VB_HAS_TEXMTXIDX2=(1<<4),
|
||||
VB_HAS_TEXMTXIDX3=(1<<5),
|
||||
VB_HAS_TEXMTXIDX4=(1<<6),
|
||||
VB_HAS_TEXMTXIDX5=(1<<7),
|
||||
VB_HAS_TEXMTXIDX6=(1<<8),
|
||||
VB_HAS_TEXMTXIDX7=(1<<9),
|
||||
VB_HAS_TEXMTXIDXALL=(0xff<<2),
|
||||
//VB_HAS_POS=0, // Implied, it always has pos! don't bother testing
|
||||
VB_HAS_NRM0=(1<<10),
|
||||
VB_HAS_NRM1=(1<<11),
|
||||
VB_HAS_NRM2=(1<<12),
|
||||
VB_HAS_NRMALL=(7<<10),
|
||||
|
||||
VB_HAS_COL0=(1<<13),
|
||||
VB_HAS_COL1=(1<<14),
|
||||
|
||||
VB_HAS_UV0=(1<<15),
|
||||
VB_HAS_UV1=(1<<16),
|
||||
VB_HAS_UV2=(1<<17),
|
||||
VB_HAS_UV3=(1<<18),
|
||||
VB_HAS_UV4=(1<<19),
|
||||
VB_HAS_UV5=(1<<20),
|
||||
VB_HAS_UV6=(1<<21),
|
||||
VB_HAS_UV7=(1<<22),
|
||||
VB_HAS_UVALL=(0xff<<15),
|
||||
VB_HAS_UVTEXMTXSHIFT=13,
|
||||
};
|
||||
|
||||
private:
|
||||
TPipelineFunction m_PipelineStates[32];
|
||||
int m_numPipelineStates;
|
||||
int m_VertexSize; // number of bytes of a raw vertex
|
||||
int m_counter;
|
||||
int m_VBVertexStride, m_VBStridePad; // stride of a vertex to send to the GPU
|
||||
|
||||
u32 m_components; // VB_HAS_X
|
||||
|
||||
UVAT_group0 m_group0;
|
||||
UVAT_group1 m_group1;
|
||||
UVAT_group2 m_group2;
|
||||
|
||||
vector<int> m_vtexmap; // tex index map
|
||||
TVtxAttr m_VtxAttr; //Decoded into easy format
|
||||
|
||||
u8* m_compiledCode;
|
||||
|
||||
//common for all loaders
|
||||
TVtxDesc m_VtxDesc;
|
||||
|
||||
// seup the pipeline with this vertex fmt
|
||||
void SetupColor(int num, int _iMode, int _iFormat, int _iElements);
|
||||
void SetupTexCoord(int num, int _iMode, int _iFormat, int _iElements, int _iFrac);
|
||||
|
||||
int m_AttrDirty;
|
||||
|
||||
public:
|
||||
// constructor
|
||||
VertexLoader();
|
||||
~VertexLoader();
|
||||
|
||||
// run the pipeline
|
||||
void ProcessFormat();
|
||||
void PrepareRun();
|
||||
void RunVertices(int primitive, int count);
|
||||
void WriteCall(void (LOADERDECL *func)(void *));
|
||||
|
||||
int GetGCVertexSize() const { _assert_( !m_AttrDirty ); return m_VertexSize; }
|
||||
int GetVBVertexStride() const { _assert_( !m_AttrDirty); return m_VBVertexStride; }
|
||||
|
||||
int ComputeVertexSize();
|
||||
|
||||
// SetVAT_group
|
||||
// ignore PosFrac, texCoord[i].Frac
|
||||
|
||||
void SetVAT_group0(u32 _group0)
|
||||
{
|
||||
if ((m_group0.Hex&~0x3e0001f0) != (_group0&~0x3e0001f0)) {
|
||||
m_AttrDirty = 2;
|
||||
}
|
||||
m_group0.Hex = _group0;
|
||||
|
||||
m_VtxAttr.PosElements = m_group0.PosElements;
|
||||
m_VtxAttr.PosFormat = m_group0.PosFormat;
|
||||
m_VtxAttr.PosFrac = m_group0.PosFrac;
|
||||
m_VtxAttr.NormalElements = m_group0.NormalElements;
|
||||
m_VtxAttr.NormalFormat = m_group0.NormalFormat;
|
||||
m_VtxAttr.color[0].Elements = m_group0.Color0Elements;
|
||||
m_VtxAttr.color[0].Comp = m_group0.Color0Comp;
|
||||
m_VtxAttr.color[1].Elements = m_group0.Color1Elements;
|
||||
m_VtxAttr.color[1].Comp = m_group0.Color1Comp;
|
||||
m_VtxAttr.texCoord[0].Elements = m_group0.Tex0CoordElements;
|
||||
m_VtxAttr.texCoord[0].Format = m_group0.Tex0CoordFormat;
|
||||
m_VtxAttr.texCoord[0].Frac = m_group0.Tex0Frac;
|
||||
m_VtxAttr.ByteDequant = m_group0.ByteDequant;
|
||||
m_VtxAttr.NormalIndex3 = m_group0.NormalIndex3;
|
||||
};
|
||||
|
||||
void SetVAT_group1(u32 _group1)
|
||||
{
|
||||
if ((m_group1.Hex&~0x7c3e1f0) != (_group1&~0x7c3e1f0)) {
|
||||
m_AttrDirty = 2;
|
||||
}
|
||||
m_group1.Hex = _group1;
|
||||
|
||||
|
||||
m_VtxAttr.texCoord[1].Elements = m_group1.Tex1CoordElements;
|
||||
m_VtxAttr.texCoord[1].Format = m_group1.Tex1CoordFormat;
|
||||
m_VtxAttr.texCoord[1].Frac = m_group1.Tex1Frac;
|
||||
m_VtxAttr.texCoord[2].Elements = m_group1.Tex2CoordElements;
|
||||
m_VtxAttr.texCoord[2].Format = m_group1.Tex2CoordFormat;
|
||||
m_VtxAttr.texCoord[2].Frac = m_group1.Tex2Frac;
|
||||
m_VtxAttr.texCoord[3].Elements = m_group1.Tex3CoordElements;
|
||||
m_VtxAttr.texCoord[3].Format = m_group1.Tex3CoordFormat;
|
||||
m_VtxAttr.texCoord[3].Frac = m_group1.Tex3Frac;
|
||||
m_VtxAttr.texCoord[4].Elements = m_group1.Tex4CoordElements;
|
||||
m_VtxAttr.texCoord[4].Format = m_group1.Tex4CoordFormat;
|
||||
};
|
||||
|
||||
void SetVAT_group2(u32 _group2)
|
||||
{
|
||||
if ((m_group2.Hex&~0xf87c3e1f) != (_group2&~0xf87c3e1f)) {
|
||||
m_AttrDirty = 2;
|
||||
}
|
||||
m_group2.Hex = _group2;
|
||||
|
||||
m_VtxAttr.texCoord[4].Frac = m_group2.Tex4Frac;
|
||||
m_VtxAttr.texCoord[5].Elements = m_group2.Tex5CoordElements;
|
||||
m_VtxAttr.texCoord[5].Format = m_group2.Tex5CoordFormat;
|
||||
m_VtxAttr.texCoord[5].Frac = m_group2.Tex5Frac;
|
||||
m_VtxAttr.texCoord[6].Elements = m_group2.Tex6CoordElements;
|
||||
m_VtxAttr.texCoord[6].Format = m_group2.Tex6CoordFormat;
|
||||
m_VtxAttr.texCoord[6].Frac = m_group2.Tex6Frac;
|
||||
m_VtxAttr.texCoord[7].Elements = m_group2.Tex7CoordElements;
|
||||
m_VtxAttr.texCoord[7].Format = m_group2.Tex7CoordFormat;
|
||||
m_VtxAttr.texCoord[7].Frac = m_group2.Tex7Frac;
|
||||
};
|
||||
};
|
||||
|
||||
/// Methods to manage and cache the global state of vertex streams and flushing streams
|
||||
/// Also handles processing the CP registers
|
||||
class VertexManager
|
||||
{
|
||||
static TVtxDesc s_GlobalVtxDesc;
|
||||
|
||||
public:
|
||||
enum Collection
|
||||
{
|
||||
C_NOTHING=0,
|
||||
C_TRIANGLES=1,
|
||||
C_LINES=2,
|
||||
C_POINTS=3
|
||||
};
|
||||
|
||||
static bool Init();
|
||||
static void Destroy();
|
||||
|
||||
static void ResetBuffer();
|
||||
static void ResetComponents();
|
||||
|
||||
static void AddVertices(int primitive, int numvertices);
|
||||
static void Flush(); // flushes the current buffer
|
||||
|
||||
static int GetRemainingSize();
|
||||
static TVtxDesc &GetVtxDesc() {return s_GlobalVtxDesc; }
|
||||
|
||||
static void LoadCPReg(u32 SubCmd, u32 Value);
|
||||
static size_t SaveLoadState(char *ptr, BOOL save);
|
||||
|
||||
static u8* s_pCurBufferPointer;
|
||||
static float shiftLookup[32];
|
||||
};
|
||||
|
||||
extern VertexLoader g_VertexLoaders[8];
|
||||
extern u32 arraybases[16];
|
||||
extern u32 arraystrides[16];
|
||||
u8 ReadBuffer8();
|
||||
u16 ReadBuffer16();
|
||||
u32 ReadBuffer32();
|
||||
float ReadBuffer32F();
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,223 @@
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#ifndef _VERTEXLOADERCOLOR_H
|
||||
#define _VERTEXLOADERCOLOR_H
|
||||
|
||||
#define RSHIFT 0
|
||||
#define GSHIFT 8
|
||||
#define BSHIFT 16
|
||||
#define ASHIFT 24
|
||||
|
||||
extern int colIndex;
|
||||
|
||||
inline void _SetCol(u32 val)
|
||||
{
|
||||
*(u32*)VertexManager::s_pCurBufferPointer = val;
|
||||
VertexManager::s_pCurBufferPointer += 4;
|
||||
colIndex++;
|
||||
}
|
||||
|
||||
void _SetCol4444(u16 val)
|
||||
{
|
||||
u32 col = lut4to8[(val>>0)&0xF]<<ASHIFT;
|
||||
col |= lut4to8[(val>>12)&0xF] <<RSHIFT;
|
||||
col |= lut4to8[(val>>8)&0xF] <<GSHIFT;
|
||||
col |= lut4to8[(val>>4)&0xF] <<BSHIFT;
|
||||
_SetCol(col);
|
||||
}
|
||||
|
||||
void _SetCol6666(u32 val)
|
||||
{
|
||||
u32 col = lut6to8[(val>>18)&0x3F] << RSHIFT;
|
||||
col |= lut6to8[(val>>12)&0x3F] << GSHIFT;
|
||||
col |= lut6to8[(val>>6)&0x3F] << BSHIFT;
|
||||
col |= lut6to8[(val>>0)&0x3F] << ASHIFT;
|
||||
_SetCol(col);
|
||||
}
|
||||
|
||||
void _SetCol565(u16 val)
|
||||
{
|
||||
u32 col = lut5to8[(val>>11)&0x1f] << RSHIFT;
|
||||
col |= lut6to8[(val>>5 )&0x3f] << GSHIFT;
|
||||
col |= lut5to8[(val )&0x1f] << BSHIFT;
|
||||
_SetCol(col | (0xFF<<ASHIFT));
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
inline u32 _Read24(u32 iAddress)
|
||||
{
|
||||
u32 col = Memory_Read_U8(iAddress) << RSHIFT; //should just get a pointer to main memory instead of going thru slow memhandler
|
||||
col |= Memory_Read_U8(iAddress+1) << GSHIFT; //we can guarantee that it is reading from main memory
|
||||
col |= Memory_Read_U8(iAddress+2) << BSHIFT;
|
||||
return col | (0xFF<<ASHIFT);
|
||||
}
|
||||
|
||||
inline u32 _Read32(u32 iAddress)
|
||||
{
|
||||
u32 col = Memory_Read_U8(iAddress) << RSHIFT; //should just get a pointer to main memory instead of going thru slow memhandler
|
||||
col |= Memory_Read_U8(iAddress+1) << GSHIFT; //we can guarantee that it is reading from main memory
|
||||
col |= Memory_Read_U8(iAddress+2) << BSHIFT;
|
||||
col |= Memory_Read_U8(iAddress+3) << ASHIFT;
|
||||
return col;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void LOADERDECL Color_ReadDirect_24b_888(void* _p)
|
||||
{
|
||||
u32 col = ReadBuffer8()<<RSHIFT;
|
||||
col |= ReadBuffer8()<<GSHIFT;
|
||||
col |= ReadBuffer8()<<BSHIFT;
|
||||
_SetCol(col | (0xFF<<ASHIFT));
|
||||
}
|
||||
|
||||
void LOADERDECL Color_ReadDirect_32b_888x(void* _p){
|
||||
u32 col = ReadBuffer8()<<RSHIFT;
|
||||
col |= ReadBuffer8()<<GSHIFT;
|
||||
col |= ReadBuffer8()<<BSHIFT;
|
||||
_SetCol(col | (0xFF<<ASHIFT));
|
||||
ReadBuffer8();
|
||||
}
|
||||
void LOADERDECL Color_ReadDirect_16b_565(void* _p)
|
||||
{
|
||||
_SetCol565(ReadBuffer16());
|
||||
}
|
||||
void LOADERDECL Color_ReadDirect_16b_4444(void *_p)
|
||||
{
|
||||
_SetCol4444(ReadBuffer16());
|
||||
}
|
||||
void LOADERDECL Color_ReadDirect_24b_6666(void* _p)
|
||||
{
|
||||
u32 val = ReadBuffer8()<<16;
|
||||
val|=ReadBuffer8()<<8;
|
||||
val|=ReadBuffer8();
|
||||
_SetCol6666(val);
|
||||
}
|
||||
|
||||
// F|RES: i am not 100 percent show, but the colElements seems to be important for rendering only
|
||||
// at least it fixes mario party 4
|
||||
//
|
||||
// if (colElements[colIndex])
|
||||
// else
|
||||
// col |= 0xFF<<ASHIFT;
|
||||
//
|
||||
void LOADERDECL Color_ReadDirect_32b_8888(void* _p)
|
||||
{
|
||||
u32 col = ReadBuffer8()<<RSHIFT;
|
||||
col |= ReadBuffer8()<<GSHIFT;
|
||||
col |= ReadBuffer8()<<BSHIFT;
|
||||
col |= ReadBuffer8()<<ASHIFT;
|
||||
|
||||
// "kill" the alpha
|
||||
if (!colElements[colIndex])
|
||||
col |= 0xFF<<ASHIFT;
|
||||
|
||||
_SetCol(col);
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void LOADERDECL Color_ReadIndex8_16b_565(void* _p)
|
||||
{
|
||||
u8 Index = ReadBuffer8();
|
||||
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
|
||||
u16 val = Memory_Read_U16(iAddress);
|
||||
_SetCol565(val);
|
||||
}
|
||||
void LOADERDECL Color_ReadIndex8_24b_888(void* _p)
|
||||
{
|
||||
u8 Index = ReadBuffer8();
|
||||
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
|
||||
_SetCol(_Read24(iAddress));
|
||||
}
|
||||
void LOADERDECL Color_ReadIndex8_32b_888x(void* _p)
|
||||
{
|
||||
u8 Index = ReadBuffer8();
|
||||
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR]+colIndex);
|
||||
_SetCol(_Read24(iAddress));
|
||||
}
|
||||
void LOADERDECL Color_ReadIndex8_16b_4444(void* _p)
|
||||
{
|
||||
u8 Index = ReadBuffer8();
|
||||
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
|
||||
u16 val = Memory_Read_U16(iAddress);
|
||||
_SetCol4444(val);
|
||||
}
|
||||
void LOADERDECL Color_ReadIndex8_24b_6666(void* _p)
|
||||
{
|
||||
u8 Index = ReadBuffer8();
|
||||
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
|
||||
u32 val = Memory_Read_U8(iAddress+2) |
|
||||
(Memory_Read_U8(iAddress+1)<<8) |
|
||||
(Memory_Read_U8(iAddress)<<16);
|
||||
|
||||
_SetCol6666(val);
|
||||
}
|
||||
void LOADERDECL Color_ReadIndex8_32b_8888(void* _p)
|
||||
{
|
||||
u8 Index = ReadBuffer8();
|
||||
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
|
||||
_SetCol(_Read32(iAddress));
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void LOADERDECL Color_ReadIndex16_16b_565(void* _p)
|
||||
{
|
||||
u16 Index = ReadBuffer16();
|
||||
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
|
||||
u16 val = Memory_Read_U16(iAddress);
|
||||
_SetCol565(val);
|
||||
}
|
||||
void LOADERDECL Color_ReadIndex16_24b_888(void* _p)
|
||||
{
|
||||
u16 Index = ReadBuffer16();
|
||||
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
|
||||
_SetCol(_Read24(iAddress));
|
||||
}
|
||||
void LOADERDECL Color_ReadIndex16_32b_888x(void* _p)
|
||||
{
|
||||
u16 Index = ReadBuffer16();
|
||||
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
|
||||
_SetCol(_Read24(iAddress));
|
||||
}
|
||||
void LOADERDECL Color_ReadIndex16_16b_4444(void* _p)
|
||||
{
|
||||
u16 Index = ReadBuffer16();
|
||||
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
|
||||
u16 val = Memory_Read_U16(iAddress);
|
||||
_SetCol4444(val);
|
||||
}
|
||||
void LOADERDECL Color_ReadIndex16_24b_6666(void* _p)
|
||||
{
|
||||
u16 Index = ReadBuffer16();
|
||||
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
|
||||
u32 val = Memory_Read_U8(iAddress+2) |
|
||||
(Memory_Read_U8(iAddress+1)<<8) |
|
||||
(Memory_Read_U8(iAddress)<<16);
|
||||
_SetCol6666(val);
|
||||
}
|
||||
void LOADERDECL Color_ReadIndex16_32b_8888(void* _p)
|
||||
{
|
||||
u16 Index = ReadBuffer16();
|
||||
u32 iAddress = arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
|
||||
_SetCol(_Read32(iAddress));
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,419 @@
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
//__________________________________________________________________________________________________
|
||||
// F|RES 2003-2005
|
||||
//
|
||||
#include "Globals.h"
|
||||
#include "VertexLoader.h"
|
||||
#include "VertexLoader_Normal.h"
|
||||
|
||||
#define LOG_NORM8() PRIM_LOG("norm: %f %f %f, ", ((s8*)VertexManager::s_pCurBufferPointer)[-3]/127.0f, ((s8*)VertexManager::s_pCurBufferPointer)[-2]/127.0f, ((s8*)VertexManager::s_pCurBufferPointer)[-1]/127.0f);
|
||||
#define LOG_NORM16() PRIM_LOG("norm: %f %f %f, ", ((s16*)VertexManager::s_pCurBufferPointer)[-3]/32767.0f, ((s16*)VertexManager::s_pCurBufferPointer)[-2]/32767.0f, ((s16*)VertexManager::s_pCurBufferPointer)[-1]/32767.0f);
|
||||
#define LOG_NORMF() PRIM_LOG("norm: %f %f %f, ", ((float*)VertexManager::s_pCurBufferPointer)[-3], ((float*)VertexManager::s_pCurBufferPointer)[-2], ((float*)VertexManager::s_pCurBufferPointer)[-1]);
|
||||
|
||||
BYTE VertexLoader_Normal::m_sizeTable[NUM_NRM_TYPE][NUM_NRM_FORMAT][NUM_NRM_ELEMENTS];
|
||||
TPipelineFunction VertexLoader_Normal::m_funcTable[NUM_NRM_TYPE][NUM_NRM_FORMAT][NUM_NRM_ELEMENTS];
|
||||
|
||||
bool VertexLoader_Normal::index3;
|
||||
// __________________________________________________________________________________________________
|
||||
// Init
|
||||
//
|
||||
void VertexLoader_Normal::Init(void)
|
||||
{
|
||||
// size table
|
||||
m_sizeTable[NRM_DIRECT][FORMAT_UBYTE] [NRM_NBT] = 3;
|
||||
m_sizeTable[NRM_DIRECT][FORMAT_BYTE] [NRM_NBT] = 3;
|
||||
m_sizeTable[NRM_DIRECT][FORMAT_USHORT][NRM_NBT] = 6;
|
||||
m_sizeTable[NRM_DIRECT][FORMAT_SHORT] [NRM_NBT] = 6;
|
||||
m_sizeTable[NRM_DIRECT][FORMAT_FLOAT] [NRM_NBT] = 12;
|
||||
m_sizeTable[NRM_DIRECT][FORMAT_UBYTE] [NRM_NBT3] = 9;
|
||||
m_sizeTable[NRM_DIRECT][FORMAT_BYTE] [NRM_NBT3] = 9;
|
||||
m_sizeTable[NRM_DIRECT][FORMAT_USHORT][NRM_NBT3] = 18;
|
||||
m_sizeTable[NRM_DIRECT][FORMAT_SHORT] [NRM_NBT3] = 18;
|
||||
m_sizeTable[NRM_DIRECT][FORMAT_FLOAT] [NRM_NBT3] = 36;
|
||||
|
||||
m_sizeTable[NRM_INDEX8][FORMAT_UBYTE] [NRM_NBT] = 1;
|
||||
m_sizeTable[NRM_INDEX8][FORMAT_BYTE] [NRM_NBT] = 1;
|
||||
m_sizeTable[NRM_INDEX8][FORMAT_USHORT][NRM_NBT] = 1;
|
||||
m_sizeTable[NRM_INDEX8][FORMAT_SHORT] [NRM_NBT] = 1;
|
||||
m_sizeTable[NRM_INDEX8][FORMAT_FLOAT] [NRM_NBT] = 1;
|
||||
m_sizeTable[NRM_INDEX8][FORMAT_UBYTE] [NRM_NBT3] = 3;
|
||||
m_sizeTable[NRM_INDEX8][FORMAT_BYTE] [NRM_NBT3] = 3;
|
||||
m_sizeTable[NRM_INDEX8][FORMAT_USHORT][NRM_NBT3] = 3;
|
||||
m_sizeTable[NRM_INDEX8][FORMAT_SHORT] [NRM_NBT3] = 3;
|
||||
m_sizeTable[NRM_INDEX8][FORMAT_FLOAT] [NRM_NBT3] = 3;
|
||||
|
||||
m_sizeTable[NRM_INDEX16][FORMAT_UBYTE] [NRM_NBT] = 2;
|
||||
m_sizeTable[NRM_INDEX16][FORMAT_BYTE] [NRM_NBT] = 2;
|
||||
m_sizeTable[NRM_INDEX16][FORMAT_USHORT][NRM_NBT] = 2;
|
||||
m_sizeTable[NRM_INDEX16][FORMAT_SHORT] [NRM_NBT] = 2;
|
||||
m_sizeTable[NRM_INDEX16][FORMAT_FLOAT] [NRM_NBT] = 2;
|
||||
m_sizeTable[NRM_INDEX16][FORMAT_UBYTE] [NRM_NBT3] = 6;
|
||||
m_sizeTable[NRM_INDEX16][FORMAT_BYTE] [NRM_NBT3] = 6;
|
||||
m_sizeTable[NRM_INDEX16][FORMAT_USHORT][NRM_NBT3] = 6;
|
||||
m_sizeTable[NRM_INDEX16][FORMAT_SHORT] [NRM_NBT3] = 6;
|
||||
m_sizeTable[NRM_INDEX16][FORMAT_FLOAT] [NRM_NBT3] = 6;
|
||||
|
||||
// function table
|
||||
m_funcTable[NRM_DIRECT][FORMAT_UBYTE] [NRM_NBT] = Normal_DirectByte; //HACK
|
||||
m_funcTable[NRM_DIRECT][FORMAT_BYTE] [NRM_NBT] = Normal_DirectByte;
|
||||
m_funcTable[NRM_DIRECT][FORMAT_USHORT][NRM_NBT] = Normal_DirectShort; //HACK
|
||||
m_funcTable[NRM_DIRECT][FORMAT_SHORT] [NRM_NBT] = Normal_DirectShort;
|
||||
m_funcTable[NRM_DIRECT][FORMAT_FLOAT] [NRM_NBT] = Normal_DirectFloat;
|
||||
m_funcTable[NRM_DIRECT][FORMAT_UBYTE] [NRM_NBT3] = Normal_DirectByte3; //HACK
|
||||
m_funcTable[NRM_DIRECT][FORMAT_BYTE] [NRM_NBT3] = Normal_DirectByte3;
|
||||
m_funcTable[NRM_DIRECT][FORMAT_USHORT][NRM_NBT3] = Normal_DirectShort3; //HACK
|
||||
m_funcTable[NRM_DIRECT][FORMAT_SHORT] [NRM_NBT3] = Normal_DirectShort3;
|
||||
m_funcTable[NRM_DIRECT][FORMAT_FLOAT] [NRM_NBT3] = Normal_DirectFloat3;
|
||||
|
||||
m_funcTable[NRM_INDEX8][FORMAT_UBYTE] [NRM_NBT] = Normal_Index8_Byte; //HACK
|
||||
m_funcTable[NRM_INDEX8][FORMAT_BYTE] [NRM_NBT] = Normal_Index8_Byte;
|
||||
m_funcTable[NRM_INDEX8][FORMAT_USHORT][NRM_NBT] = Normal_Index8_Short; //HACK
|
||||
m_funcTable[NRM_INDEX8][FORMAT_SHORT] [NRM_NBT] = Normal_Index8_Short;
|
||||
m_funcTable[NRM_INDEX8][FORMAT_FLOAT] [NRM_NBT] = Normal_Index8_Float;
|
||||
m_funcTable[NRM_INDEX8][FORMAT_UBYTE] [NRM_NBT3] = Normal_Index8_Byte3; //HACK
|
||||
m_funcTable[NRM_INDEX8][FORMAT_BYTE] [NRM_NBT3] = Normal_Index8_Byte3;
|
||||
m_funcTable[NRM_INDEX8][FORMAT_USHORT][NRM_NBT3] = Normal_Index8_Short3; //HACK
|
||||
m_funcTable[NRM_INDEX8][FORMAT_SHORT] [NRM_NBT3] = Normal_Index8_Short3;
|
||||
m_funcTable[NRM_INDEX8][FORMAT_FLOAT] [NRM_NBT3] = Normal_Index8_Float3;
|
||||
|
||||
m_funcTable[NRM_INDEX16][FORMAT_UBYTE] [NRM_NBT] = Normal_Index16_Byte; //HACK
|
||||
m_funcTable[NRM_INDEX16][FORMAT_BYTE] [NRM_NBT] = Normal_Index16_Byte;
|
||||
m_funcTable[NRM_INDEX16][FORMAT_USHORT][NRM_NBT] = Normal_Index16_Short; //HACK
|
||||
m_funcTable[NRM_INDEX16][FORMAT_SHORT] [NRM_NBT] = Normal_Index16_Short;
|
||||
m_funcTable[NRM_INDEX16][FORMAT_FLOAT] [NRM_NBT] = Normal_Index16_Float;
|
||||
m_funcTable[NRM_INDEX16][FORMAT_UBYTE] [NRM_NBT3] = Normal_Index16_Byte3; //HACK
|
||||
m_funcTable[NRM_INDEX16][FORMAT_BYTE] [NRM_NBT3] = Normal_Index16_Byte3;
|
||||
m_funcTable[NRM_INDEX16][FORMAT_USHORT][NRM_NBT3] = Normal_Index16_Short3; //HACK
|
||||
m_funcTable[NRM_INDEX16][FORMAT_SHORT] [NRM_NBT3] = Normal_Index16_Short3;
|
||||
m_funcTable[NRM_INDEX16][FORMAT_FLOAT] [NRM_NBT3] = Normal_Index16_Float3;
|
||||
}
|
||||
|
||||
unsigned int VertexLoader_Normal::GetSize(unsigned int _type, unsigned int _format, unsigned int _elements)
|
||||
{
|
||||
return m_sizeTable[_type][_format][_elements];
|
||||
}
|
||||
|
||||
TPipelineFunction VertexLoader_Normal::GetFunction(unsigned int _type, unsigned int _format, unsigned int _elements)
|
||||
{
|
||||
TPipelineFunction pFunc = m_funcTable[_type][_format][_elements];
|
||||
return pFunc;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// --- Direct ---
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
void LOADERDECL VertexLoader_Normal::Normal_DirectByte(void* _p)
|
||||
{
|
||||
*VertexManager::s_pCurBufferPointer++ = ReadBuffer8();
|
||||
*VertexManager::s_pCurBufferPointer++ = ReadBuffer8();
|
||||
*VertexManager::s_pCurBufferPointer++ = ReadBuffer8();
|
||||
LOG_NORM8();
|
||||
// ((float*)VertexManager::s_pCurBufferPointer)[0] = ((float)(signed char)ReadBuffer8()+0.5f) / 127.5f;
|
||||
}
|
||||
|
||||
void LOADERDECL VertexLoader_Normal::Normal_DirectShort(void* _p)
|
||||
{
|
||||
((u16*)VertexManager::s_pCurBufferPointer)[0] = ReadBuffer16();
|
||||
((u16*)VertexManager::s_pCurBufferPointer)[1] = ReadBuffer16();
|
||||
((u16*)VertexManager::s_pCurBufferPointer)[2] = ReadBuffer16();
|
||||
VertexManager::s_pCurBufferPointer += 6;
|
||||
LOG_NORM16()
|
||||
// ((float*)VertexManager::s_pCurBufferPointer)[0] = ((float)(signed short)ReadBuffer16()+0.5f) / 32767.5f;
|
||||
// ((float*)VertexManager::s_pCurBufferPointer)[1] = ((float)(signed short)ReadBuffer16()+0.5f) / 32767.5f;
|
||||
// ((float*)VertexManager::s_pCurBufferPointer)[2] = ((float)(signed short)ReadBuffer16()+0.5f) / 32767.5f;
|
||||
}
|
||||
|
||||
void LOADERDECL VertexLoader_Normal::Normal_DirectFloat(void* _p)
|
||||
{
|
||||
((float*)VertexManager::s_pCurBufferPointer)[0] = ReadBuffer32F();
|
||||
((float*)VertexManager::s_pCurBufferPointer)[1] = ReadBuffer32F();
|
||||
((float*)VertexManager::s_pCurBufferPointer)[2] = ReadBuffer32F();
|
||||
VertexManager::s_pCurBufferPointer += 12;
|
||||
LOG_NORMF()
|
||||
}
|
||||
|
||||
void LOADERDECL VertexLoader_Normal::Normal_DirectByte3(void* _p)
|
||||
{
|
||||
for (int i=0; i<3; i++)
|
||||
{
|
||||
*VertexManager::s_pCurBufferPointer++ = ReadBuffer8();
|
||||
*VertexManager::s_pCurBufferPointer++ = ReadBuffer8();
|
||||
*VertexManager::s_pCurBufferPointer++ = ReadBuffer8();
|
||||
LOG_NORM8();
|
||||
}
|
||||
}
|
||||
|
||||
void LOADERDECL VertexLoader_Normal::Normal_DirectShort3(void* _p)
|
||||
{
|
||||
for (int i=0; i<3; i++)
|
||||
{
|
||||
((u16*)VertexManager::s_pCurBufferPointer)[0] = ReadBuffer16();
|
||||
((u16*)VertexManager::s_pCurBufferPointer)[1] = ReadBuffer16();
|
||||
((u16*)VertexManager::s_pCurBufferPointer)[2] = ReadBuffer16();
|
||||
VertexManager::s_pCurBufferPointer += 6;
|
||||
LOG_NORM16();
|
||||
}
|
||||
}
|
||||
|
||||
void LOADERDECL VertexLoader_Normal::Normal_DirectFloat3(void* _p)
|
||||
{
|
||||
for (int i=0; i<3; i++)
|
||||
{
|
||||
((float*)VertexManager::s_pCurBufferPointer)[0] = ReadBuffer32F();
|
||||
((float*)VertexManager::s_pCurBufferPointer)[1] = ReadBuffer32F();
|
||||
((float*)VertexManager::s_pCurBufferPointer)[2] = ReadBuffer32F();
|
||||
VertexManager::s_pCurBufferPointer += 12;
|
||||
LOG_NORMF();
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// --- Index8 ---
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
void LOADERDECL VertexLoader_Normal::Normal_Index8_Byte(void* _p)
|
||||
{
|
||||
u8 Index = ReadBuffer8();
|
||||
u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]);
|
||||
*VertexManager::s_pCurBufferPointer++ = Memory_Read_U8(iAddress);
|
||||
*VertexManager::s_pCurBufferPointer++ = Memory_Read_U8(iAddress+1);
|
||||
*VertexManager::s_pCurBufferPointer++ = Memory_Read_U8(iAddress+2);
|
||||
// ((float*)VertexManager::s_pCurBufferPointer)[0] = ((float)(signed char)Memory_Read_U8(iAddress)+0.5f) / 127.5f;
|
||||
// ((float*)VertexManager::s_pCurBufferPointer)[1] = ((float)(signed char)Memory_Read_U8(iAddress+1)+0.5f) / 127.5f;
|
||||
// ((float*)VertexManager::s_pCurBufferPointer)[2] = ((float)(signed char)Memory_Read_U8(iAddress+2)+0.5f) / 127.5f;
|
||||
// VertexManager::s_pCurBufferPointer += 12;
|
||||
LOG_NORM8();
|
||||
}
|
||||
|
||||
void LOADERDECL VertexLoader_Normal::Normal_Index8_Short(void* _p)
|
||||
{
|
||||
u8 Index = ReadBuffer8();
|
||||
u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]);
|
||||
((u16*)VertexManager::s_pCurBufferPointer)[0] = Memory_Read_U16(iAddress);
|
||||
((u16*)VertexManager::s_pCurBufferPointer)[1] = Memory_Read_U16(iAddress+2);
|
||||
((u16*)VertexManager::s_pCurBufferPointer)[2] = Memory_Read_U16(iAddress+4);
|
||||
VertexManager::s_pCurBufferPointer += 6;
|
||||
LOG_NORM16();
|
||||
}
|
||||
|
||||
void LOADERDECL VertexLoader_Normal::Normal_Index8_Float(void* _p)
|
||||
{
|
||||
u8 Index = ReadBuffer8();
|
||||
u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]);
|
||||
((float*)VertexManager::s_pCurBufferPointer)[0] = Memory_Read_Float(iAddress);
|
||||
((float*)VertexManager::s_pCurBufferPointer)[1] = Memory_Read_Float(iAddress+4);
|
||||
((float*)VertexManager::s_pCurBufferPointer)[2] = Memory_Read_Float(iAddress+8);
|
||||
VertexManager::s_pCurBufferPointer += 12;
|
||||
LOG_NORMF();
|
||||
}
|
||||
|
||||
void LOADERDECL VertexLoader_Normal::Normal_Index8_Byte3(void* _p)
|
||||
{
|
||||
if (index3) {
|
||||
for (int i=0; i<3; i++) {
|
||||
u8 Index = ReadBuffer8();
|
||||
u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]) + 1*3*i;
|
||||
*VertexManager::s_pCurBufferPointer++ = Memory_Read_U8(iAddress);
|
||||
*VertexManager::s_pCurBufferPointer++ = Memory_Read_U8(iAddress+1);
|
||||
*VertexManager::s_pCurBufferPointer++ = Memory_Read_U8(iAddress+2);
|
||||
LOG_NORM8();
|
||||
}
|
||||
}
|
||||
else {
|
||||
u8 Index = ReadBuffer8();
|
||||
for (int i=0; i<3; i++) {
|
||||
u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]) + 1*3*i;
|
||||
*VertexManager::s_pCurBufferPointer++ = Memory_Read_U8(iAddress);
|
||||
*VertexManager::s_pCurBufferPointer++ = Memory_Read_U8(iAddress+1);
|
||||
*VertexManager::s_pCurBufferPointer++ = Memory_Read_U8(iAddress+2);
|
||||
LOG_NORM8();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LOADERDECL VertexLoader_Normal::Normal_Index8_Short3(void* _p)
|
||||
{
|
||||
if (index3) {
|
||||
for (int i=0; i<3; i++) {
|
||||
u8 Index = ReadBuffer8();
|
||||
u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]) + 2*3*i;
|
||||
((u16*)VertexManager::s_pCurBufferPointer)[0] = Memory_Read_U16(iAddress);
|
||||
((u16*)VertexManager::s_pCurBufferPointer)[1] = Memory_Read_U16(iAddress+2);
|
||||
((u16*)VertexManager::s_pCurBufferPointer)[2] = Memory_Read_U16(iAddress+4);
|
||||
VertexManager::s_pCurBufferPointer += 6;
|
||||
LOG_NORM16();
|
||||
}
|
||||
}
|
||||
else {
|
||||
u8 Index = ReadBuffer8();
|
||||
for (int i=0; i<3; i++) {
|
||||
u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]) + 2*3*i;
|
||||
((u16*)VertexManager::s_pCurBufferPointer)[0] = Memory_Read_U16(iAddress);
|
||||
((u16*)VertexManager::s_pCurBufferPointer)[1] = Memory_Read_U16(iAddress+2);
|
||||
((u16*)VertexManager::s_pCurBufferPointer)[2] = Memory_Read_U16(iAddress+4);
|
||||
VertexManager::s_pCurBufferPointer += 6;
|
||||
LOG_NORM16();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LOADERDECL VertexLoader_Normal::Normal_Index8_Float3(void* _p)
|
||||
{
|
||||
if (index3) {
|
||||
for (int i=0; i<3; i++) {
|
||||
u8 Index = ReadBuffer8();
|
||||
u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]) + 4*3*i;
|
||||
((float*)VertexManager::s_pCurBufferPointer)[0] = Memory_Read_Float(iAddress);
|
||||
((float*)VertexManager::s_pCurBufferPointer)[1] = Memory_Read_Float(iAddress+4);
|
||||
((float*)VertexManager::s_pCurBufferPointer)[2] = Memory_Read_Float(iAddress+8);
|
||||
VertexManager::s_pCurBufferPointer += 12;
|
||||
LOG_NORMF();
|
||||
}
|
||||
}
|
||||
else {
|
||||
u8 Index = ReadBuffer8();
|
||||
for (int i=0; i<3; i++) {
|
||||
u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]) + 4*3*i;
|
||||
((float*)VertexManager::s_pCurBufferPointer)[0] = Memory_Read_Float(iAddress);
|
||||
((float*)VertexManager::s_pCurBufferPointer)[1] = Memory_Read_Float(iAddress+4);
|
||||
((float*)VertexManager::s_pCurBufferPointer)[2] = Memory_Read_Float(iAddress+8);
|
||||
VertexManager::s_pCurBufferPointer += 12;
|
||||
LOG_NORMF();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// --- Index16 ---
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void LOADERDECL VertexLoader_Normal::Normal_Index16_Byte(void* _p)
|
||||
{
|
||||
u16 Index = ReadBuffer16();
|
||||
u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]);
|
||||
*VertexManager::s_pCurBufferPointer++ = Memory_Read_U8(iAddress);
|
||||
*VertexManager::s_pCurBufferPointer++ = Memory_Read_U8(iAddress+1);
|
||||
*VertexManager::s_pCurBufferPointer++ = Memory_Read_U8(iAddress+2);
|
||||
LOG_NORM8();
|
||||
}
|
||||
|
||||
void LOADERDECL VertexLoader_Normal::Normal_Index16_Short(void* _p)
|
||||
{
|
||||
u16 Index = ReadBuffer16();
|
||||
u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]);
|
||||
((u16*)VertexManager::s_pCurBufferPointer)[0] = Memory_Read_U16(iAddress);
|
||||
((u16*)VertexManager::s_pCurBufferPointer)[1] = Memory_Read_U16(iAddress+2);
|
||||
((u16*)VertexManager::s_pCurBufferPointer)[2] = Memory_Read_U16(iAddress+4);
|
||||
VertexManager::s_pCurBufferPointer += 6;
|
||||
LOG_NORM16();
|
||||
}
|
||||
|
||||
void LOADERDECL VertexLoader_Normal::Normal_Index16_Float(void* _p)
|
||||
{
|
||||
u16 Index = ReadBuffer16();
|
||||
u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]);
|
||||
((float*)VertexManager::s_pCurBufferPointer)[0] = Memory_Read_Float(iAddress);
|
||||
((float*)VertexManager::s_pCurBufferPointer)[1] = Memory_Read_Float(iAddress+4);
|
||||
((float*)VertexManager::s_pCurBufferPointer)[2] = Memory_Read_Float(iAddress+8);
|
||||
VertexManager::s_pCurBufferPointer += 12;
|
||||
LOG_NORMF();
|
||||
}
|
||||
|
||||
void LOADERDECL VertexLoader_Normal::Normal_Index16_Byte3(void* _p)
|
||||
{
|
||||
if (index3) {
|
||||
for (int i=0; i<3; i++) {
|
||||
u16 Index = ReadBuffer16();
|
||||
u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]) + 1*3*i;
|
||||
*VertexManager::s_pCurBufferPointer++ = Memory_Read_U8(iAddress);
|
||||
*VertexManager::s_pCurBufferPointer++ = Memory_Read_U8(iAddress+1);
|
||||
*VertexManager::s_pCurBufferPointer++ = Memory_Read_U8(iAddress+2);
|
||||
LOG_NORM8();
|
||||
}
|
||||
}
|
||||
else {
|
||||
u16 Index = ReadBuffer16();
|
||||
for (int i=0; i<3; i++) {
|
||||
u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]) + 1*3*i;
|
||||
*VertexManager::s_pCurBufferPointer++ = Memory_Read_U8(iAddress);
|
||||
*VertexManager::s_pCurBufferPointer++ = Memory_Read_U8(iAddress+1);
|
||||
*VertexManager::s_pCurBufferPointer++ = Memory_Read_U8(iAddress+2);
|
||||
LOG_NORM8();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LOADERDECL VertexLoader_Normal::Normal_Index16_Short3(void* _p)
|
||||
{
|
||||
if (index3)
|
||||
{
|
||||
for (int i=0; i<3; i++)
|
||||
{
|
||||
u16 Index = ReadBuffer16();
|
||||
u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]) + 2*3*i;
|
||||
((u16*)VertexManager::s_pCurBufferPointer)[0] = Memory_Read_U16(iAddress);
|
||||
((u16*)VertexManager::s_pCurBufferPointer)[1] = Memory_Read_U16(iAddress+2);
|
||||
((u16*)VertexManager::s_pCurBufferPointer)[2] = Memory_Read_U16(iAddress+4);
|
||||
VertexManager::s_pCurBufferPointer += 6;
|
||||
LOG_NORM16();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
u16 Index = ReadBuffer16();
|
||||
for (int i=0; i<3; i++)
|
||||
{
|
||||
u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]) + 2*3*i;
|
||||
((u16*)VertexManager::s_pCurBufferPointer)[0] = Memory_Read_U16(iAddress);
|
||||
((u16*)VertexManager::s_pCurBufferPointer)[1] = Memory_Read_U16(iAddress+2);
|
||||
((u16*)VertexManager::s_pCurBufferPointer)[2] = Memory_Read_U16(iAddress+4);
|
||||
VertexManager::s_pCurBufferPointer += 6;
|
||||
LOG_NORM16();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LOADERDECL VertexLoader_Normal::Normal_Index16_Float3(void* _p)
|
||||
{
|
||||
if (index3)
|
||||
{
|
||||
for (int i=0; i<3; i++)
|
||||
{
|
||||
u16 Index = ReadBuffer16();
|
||||
u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]) + 4*3*i;
|
||||
((float*)VertexManager::s_pCurBufferPointer)[0] = Memory_Read_Float(iAddress);
|
||||
((float*)VertexManager::s_pCurBufferPointer)[1] = Memory_Read_Float(iAddress+4);
|
||||
((float*)VertexManager::s_pCurBufferPointer)[2] = Memory_Read_Float(iAddress+8);
|
||||
VertexManager::s_pCurBufferPointer += 12;
|
||||
LOG_NORMF();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
u16 Index = ReadBuffer16();
|
||||
for (int i=0; i<3; i++)
|
||||
{
|
||||
u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]) + 4*3*i;
|
||||
((float*)VertexManager::s_pCurBufferPointer)[0] = Memory_Read_Float(iAddress);
|
||||
((float*)VertexManager::s_pCurBufferPointer)[1] = Memory_Read_Float(iAddress+4);
|
||||
((float*)VertexManager::s_pCurBufferPointer)[2] = Memory_Read_Float(iAddress+8);
|
||||
VertexManager::s_pCurBufferPointer += 12;
|
||||
LOG_NORMF();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#ifndef _VERTEXLOADER_NORMAL_H
|
||||
#define _VERTEXLOADER_NORMAL_H
|
||||
|
||||
class VertexLoader_Normal
|
||||
{
|
||||
public:
|
||||
|
||||
static bool index3;
|
||||
// Init
|
||||
static void Init(void);
|
||||
|
||||
// GetSize
|
||||
static unsigned int GetSize(unsigned int _type, unsigned int _format, unsigned int _elements);
|
||||
|
||||
// GetFunction
|
||||
static TPipelineFunction GetFunction(unsigned int _type, unsigned int _format, unsigned int _elements);
|
||||
|
||||
private:
|
||||
enum ENormalType
|
||||
{
|
||||
NRM_NOT_PRESENT = 0,
|
||||
NRM_DIRECT = 1,
|
||||
NRM_INDEX8 = 2,
|
||||
NRM_INDEX16 = 3,
|
||||
NUM_NRM_TYPE
|
||||
};
|
||||
|
||||
enum ENormalFormat
|
||||
{
|
||||
FORMAT_UBYTE = 0,
|
||||
FORMAT_BYTE = 1,
|
||||
FORMAT_USHORT = 2,
|
||||
FORMAT_SHORT = 3,
|
||||
FORMAT_FLOAT = 4,
|
||||
NUM_NRM_FORMAT
|
||||
};
|
||||
|
||||
enum ENormalElements
|
||||
{
|
||||
NRM_NBT = 0,
|
||||
NRM_NBT3 = 1,
|
||||
NUM_NRM_ELEMENTS
|
||||
};
|
||||
|
||||
// tables
|
||||
static BYTE m_sizeTable[NUM_NRM_TYPE][NUM_NRM_FORMAT][NUM_NRM_ELEMENTS];
|
||||
static TPipelineFunction m_funcTable[NUM_NRM_TYPE][NUM_NRM_FORMAT][NUM_NRM_ELEMENTS];
|
||||
|
||||
// direct
|
||||
static void LOADERDECL Normal_DirectByte(void* _p);
|
||||
static void LOADERDECL Normal_DirectShort(void* _p);
|
||||
static void LOADERDECL Normal_DirectFloat(void* _p);
|
||||
static void LOADERDECL Normal_DirectByte3(void* _p);
|
||||
static void LOADERDECL Normal_DirectShort3(void* _p);
|
||||
static void LOADERDECL Normal_DirectFloat3(void* _p);
|
||||
|
||||
// index8
|
||||
static void LOADERDECL Normal_Index8_Byte(void* _p);
|
||||
static void LOADERDECL Normal_Index8_Short(void* _p);
|
||||
static void LOADERDECL Normal_Index8_Float(void* _p);
|
||||
static void LOADERDECL Normal_Index8_Byte3(void* _p);
|
||||
static void LOADERDECL Normal_Index8_Short3(void* _p);
|
||||
static void LOADERDECL Normal_Index8_Float3(void* _p);
|
||||
|
||||
// index16
|
||||
static void LOADERDECL Normal_Index16_Byte(void* _p);
|
||||
static void LOADERDECL Normal_Index16_Short(void* _p);
|
||||
static void LOADERDECL Normal_Index16_Float(void* _p);
|
||||
static void LOADERDECL Normal_Index16_Byte3(void* _p);
|
||||
static void LOADERDECL Normal_Index16_Short3(void* _p);
|
||||
static void LOADERDECL Normal_Index16_Float3(void* _p);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,201 @@
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#ifndef VERTEXLOADER_POSITION_H
|
||||
#define VERTEXLOADER_POSITION_H
|
||||
|
||||
#define LOG_VTX() PRIM_LOG("vtx: %f %f %f, ", ((float*)VertexManager::s_pCurBufferPointer)[0], ((float*)VertexManager::s_pCurBufferPointer)[1], ((float*)VertexManager::s_pCurBufferPointer)[2]);
|
||||
|
||||
// ==============================================================================
|
||||
// Direct
|
||||
// ==============================================================================
|
||||
void LOADERDECL Pos_ReadDirect_UByte(void* _p)
|
||||
{
|
||||
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
||||
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)ReadBuffer8() * posScale;
|
||||
((float*)VertexManager::s_pCurBufferPointer)[1] = (float)ReadBuffer8() * posScale;
|
||||
if (pVtxAttr->PosElements)
|
||||
((float*)VertexManager::s_pCurBufferPointer)[2] = (float)ReadBuffer8() * posScale;
|
||||
else
|
||||
((float*)VertexManager::s_pCurBufferPointer)[2] = 1.0f;
|
||||
LOG_VTX();
|
||||
VertexManager::s_pCurBufferPointer += 12;
|
||||
}
|
||||
|
||||
void LOADERDECL Pos_ReadDirect_Byte(void* _p)
|
||||
{
|
||||
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
||||
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(s8)ReadBuffer8() * posScale;
|
||||
((float*)VertexManager::s_pCurBufferPointer)[1] = (float)(s8)ReadBuffer8() * posScale;
|
||||
if (pVtxAttr->PosElements)
|
||||
((float*)VertexManager::s_pCurBufferPointer)[2] = (float)(s8)ReadBuffer8() * posScale;
|
||||
else
|
||||
((float*)VertexManager::s_pCurBufferPointer)[2] = 1.0;
|
||||
LOG_VTX();
|
||||
VertexManager::s_pCurBufferPointer += 12;
|
||||
}
|
||||
|
||||
void LOADERDECL Pos_ReadDirect_UShort(void* _p)
|
||||
{
|
||||
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
||||
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)ReadBuffer16() * posScale;
|
||||
((float*)VertexManager::s_pCurBufferPointer)[1] = (float)ReadBuffer16() * posScale;
|
||||
if (pVtxAttr->PosElements)
|
||||
((float*)VertexManager::s_pCurBufferPointer)[2] = (float)ReadBuffer16() * posScale;
|
||||
else
|
||||
((float*)VertexManager::s_pCurBufferPointer)[2] = 1.0f;
|
||||
LOG_VTX();
|
||||
VertexManager::s_pCurBufferPointer += 12;
|
||||
}
|
||||
|
||||
void LOADERDECL Pos_ReadDirect_Short(void* _p)
|
||||
{
|
||||
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
||||
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(s16)ReadBuffer16() * posScale;
|
||||
((float*)VertexManager::s_pCurBufferPointer)[1] = (float)(s16)ReadBuffer16() * posScale;
|
||||
if (pVtxAttr->PosElements)
|
||||
((float*)VertexManager::s_pCurBufferPointer)[2] = (float)(s16)ReadBuffer16() * posScale;
|
||||
else
|
||||
((float*)VertexManager::s_pCurBufferPointer)[2] = 1.0f;
|
||||
LOG_VTX();
|
||||
VertexManager::s_pCurBufferPointer += 12;
|
||||
}
|
||||
|
||||
void LOADERDECL Pos_ReadDirect_Float(void* _p)
|
||||
{
|
||||
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
||||
((float*)VertexManager::s_pCurBufferPointer)[0] = ReadBuffer32F();
|
||||
((float*)VertexManager::s_pCurBufferPointer)[1] = ReadBuffer32F();
|
||||
if (pVtxAttr->PosElements)
|
||||
((float*)VertexManager::s_pCurBufferPointer)[2] = ReadBuffer32F();
|
||||
else
|
||||
((float*)VertexManager::s_pCurBufferPointer)[2] = 1.0f;
|
||||
LOG_VTX();
|
||||
VertexManager::s_pCurBufferPointer += 12;
|
||||
}
|
||||
|
||||
#define Pos_ReadIndex_Byte(T) { \
|
||||
u32 iAddress = arraybases[ARRAY_POSITION] + ((u32)Index * arraystrides[ARRAY_POSITION]); \
|
||||
((float*)VertexManager::s_pCurBufferPointer)[0] = ((float)(T)Memory_Read_U8(iAddress)) * posScale; \
|
||||
((float*)VertexManager::s_pCurBufferPointer)[1] = ((float)(T)Memory_Read_U8(iAddress+1)) * posScale; \
|
||||
if (pVtxAttr->PosElements) \
|
||||
((float*)VertexManager::s_pCurBufferPointer)[2] = ((float)(T)Memory_Read_U8(iAddress+2)) * posScale; \
|
||||
else \
|
||||
((float*)VertexManager::s_pCurBufferPointer)[2] = 1.0f; \
|
||||
LOG_VTX(); \
|
||||
VertexManager::s_pCurBufferPointer += 12; \
|
||||
}
|
||||
|
||||
#define Pos_ReadIndex_Short(T) { \
|
||||
u32 iAddress = arraybases[ARRAY_POSITION] + ((u32)Index * arraystrides[ARRAY_POSITION]); \
|
||||
((float*)VertexManager::s_pCurBufferPointer)[0] = ((float)(T)Memory_Read_U16(iAddress)) * posScale; \
|
||||
((float*)VertexManager::s_pCurBufferPointer)[1] = ((float)(T)Memory_Read_U16(iAddress+2)) * posScale; \
|
||||
if (pVtxAttr->PosElements) \
|
||||
((float*)VertexManager::s_pCurBufferPointer)[2] = ((float)(T)Memory_Read_U16(iAddress+4)) * posScale; \
|
||||
else \
|
||||
((float*)VertexManager::s_pCurBufferPointer)[2] = 1.0f; \
|
||||
LOG_VTX(); \
|
||||
VertexManager::s_pCurBufferPointer += 12; \
|
||||
}
|
||||
|
||||
#define Pos_ReadIndex_Float() { \
|
||||
u32 iAddress = arraybases[ARRAY_POSITION] + (Index * arraystrides[ARRAY_POSITION]); \
|
||||
((u32*)VertexManager::s_pCurBufferPointer)[0] = Memory_Read_U32(iAddress); \
|
||||
((u32*)VertexManager::s_pCurBufferPointer)[1] = Memory_Read_U32(iAddress+4); \
|
||||
if (pVtxAttr->PosElements) \
|
||||
((u32*)VertexManager::s_pCurBufferPointer)[2] = Memory_Read_U32(iAddress+8); \
|
||||
else \
|
||||
((float*)VertexManager::s_pCurBufferPointer)[2] = 1.0f; \
|
||||
LOG_VTX(); \
|
||||
VertexManager::s_pCurBufferPointer += 12; \
|
||||
}
|
||||
|
||||
// ==============================================================================
|
||||
// Index 8
|
||||
// ==============================================================================
|
||||
void LOADERDECL Pos_ReadIndex8_UByte(void* _p)
|
||||
{
|
||||
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
||||
u8 Index = ReadBuffer8();
|
||||
Pos_ReadIndex_Byte(u8);
|
||||
}
|
||||
|
||||
void LOADERDECL Pos_ReadIndex8_Byte(void* _p)
|
||||
{
|
||||
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
||||
u8 Index = ReadBuffer8();
|
||||
Pos_ReadIndex_Byte(s8);
|
||||
}
|
||||
|
||||
void LOADERDECL Pos_ReadIndex8_UShort(void* _p)
|
||||
{
|
||||
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
||||
u8 Index = ReadBuffer8();
|
||||
Pos_ReadIndex_Short(u16);
|
||||
}
|
||||
|
||||
void LOADERDECL Pos_ReadIndex8_Short(void* _p)
|
||||
{
|
||||
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
||||
u8 Index = ReadBuffer8();
|
||||
Pos_ReadIndex_Short(s16);
|
||||
}
|
||||
|
||||
void LOADERDECL Pos_ReadIndex8_Float(void* _p)
|
||||
{
|
||||
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
||||
u8 Index = ReadBuffer8();
|
||||
Pos_ReadIndex_Float();
|
||||
}
|
||||
|
||||
// ==============================================================================
|
||||
// Index 16
|
||||
// ==============================================================================
|
||||
|
||||
void LOADERDECL Pos_ReadIndex16_UByte(void* _p){
|
||||
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
||||
u16 Index = ReadBuffer16();
|
||||
Pos_ReadIndex_Byte(u8);
|
||||
}
|
||||
|
||||
void LOADERDECL Pos_ReadIndex16_Byte(void* _p){
|
||||
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
||||
u16 Index = ReadBuffer16();
|
||||
Pos_ReadIndex_Byte(s8);
|
||||
}
|
||||
|
||||
void LOADERDECL Pos_ReadIndex16_UShort(void* _p){
|
||||
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
||||
u16 Index = ReadBuffer16();
|
||||
Pos_ReadIndex_Short(u16);
|
||||
}
|
||||
|
||||
void LOADERDECL Pos_ReadIndex16_Short(void* _p)
|
||||
{
|
||||
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
||||
u16 Index = ReadBuffer16();
|
||||
Pos_ReadIndex_Short(s16);
|
||||
}
|
||||
|
||||
void LOADERDECL Pos_ReadIndex16_Float(void* _p)
|
||||
{
|
||||
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
||||
u16 Index = ReadBuffer16();
|
||||
Pos_ReadIndex_Float();
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,341 @@
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#ifndef VERTEXLOADER_TEXCOORD_H
|
||||
#define VERTEXLOADER_TEXCOORD_H
|
||||
|
||||
#define LOG_TEX1() PRIM_LOG("tex: %f, ", ((float*)VertexManager::s_pCurBufferPointer)[0]);
|
||||
#define LOG_TEX2() PRIM_LOG("tex: %f %f, ", ((float*)VertexManager::s_pCurBufferPointer)[0], ((float*)VertexManager::s_pCurBufferPointer)[1]);
|
||||
|
||||
extern int tcIndex;
|
||||
|
||||
void LOADERDECL TexCoord_Read_Dummy(void* _p)
|
||||
{
|
||||
tcIndex++;
|
||||
}
|
||||
|
||||
void LOADERDECL TexCoord_ReadDirect_UByte1(void* _p)
|
||||
{
|
||||
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)ReadBuffer8() * tcScaleU[tcIndex];
|
||||
LOG_TEX1();
|
||||
VertexManager::s_pCurBufferPointer += 4;
|
||||
tcIndex++;
|
||||
}
|
||||
void LOADERDECL TexCoord_ReadDirect_UByte2(void* _p)
|
||||
{
|
||||
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)ReadBuffer8() * tcScaleU[tcIndex];
|
||||
((float*)VertexManager::s_pCurBufferPointer)[1] = (float)ReadBuffer8() * tcScaleV[tcIndex];
|
||||
LOG_TEX2();
|
||||
VertexManager::s_pCurBufferPointer += 8;
|
||||
tcIndex++;
|
||||
}
|
||||
|
||||
void LOADERDECL TexCoord_ReadDirect_Byte1(void* _p)
|
||||
{
|
||||
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(s8)ReadBuffer8() * tcScaleU[tcIndex];
|
||||
LOG_TEX1();
|
||||
VertexManager::s_pCurBufferPointer += 4;
|
||||
tcIndex++;
|
||||
}
|
||||
void LOADERDECL TexCoord_ReadDirect_Byte2(void* _p)
|
||||
{
|
||||
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(s8)ReadBuffer8() * tcScaleU[tcIndex];
|
||||
((float*)VertexManager::s_pCurBufferPointer)[1] = (float)(s8)ReadBuffer8() * tcScaleV[tcIndex];
|
||||
LOG_TEX2();
|
||||
VertexManager::s_pCurBufferPointer += 8;
|
||||
tcIndex++;
|
||||
}
|
||||
|
||||
void LOADERDECL TexCoord_ReadDirect_UShort1(void* _p)
|
||||
{
|
||||
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)ReadBuffer16() * tcScaleU[tcIndex];
|
||||
LOG_TEX1();
|
||||
VertexManager::s_pCurBufferPointer += 4;
|
||||
tcIndex++;
|
||||
}
|
||||
void LOADERDECL TexCoord_ReadDirect_UShort2(void* _p)
|
||||
{
|
||||
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)ReadBuffer16() * tcScaleU[tcIndex];
|
||||
((float*)VertexManager::s_pCurBufferPointer)[1] = (float)ReadBuffer16() * tcScaleV[tcIndex];
|
||||
LOG_TEX2();
|
||||
VertexManager::s_pCurBufferPointer += 8;
|
||||
tcIndex++;
|
||||
}
|
||||
|
||||
void LOADERDECL TexCoord_ReadDirect_Short1(void* _p)
|
||||
{
|
||||
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(s16)ReadBuffer16() * tcScaleU[tcIndex];
|
||||
LOG_TEX1();
|
||||
VertexManager::s_pCurBufferPointer += 4;
|
||||
tcIndex++;
|
||||
}
|
||||
void LOADERDECL TexCoord_ReadDirect_Short2(void* _p)
|
||||
{
|
||||
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(s16)ReadBuffer16() * tcScaleU[tcIndex];
|
||||
((float*)VertexManager::s_pCurBufferPointer)[1] = (float)(s16)ReadBuffer16() * tcScaleV[tcIndex];
|
||||
LOG_TEX2();
|
||||
VertexManager::s_pCurBufferPointer += 8;
|
||||
tcIndex++;
|
||||
}
|
||||
|
||||
void LOADERDECL TexCoord_ReadDirect_Float1(void* _p)
|
||||
{
|
||||
((float*)VertexManager::s_pCurBufferPointer)[0] = ReadBuffer32F() * tcScaleU[tcIndex];
|
||||
LOG_TEX1();
|
||||
VertexManager::s_pCurBufferPointer += 4;
|
||||
tcIndex++;
|
||||
}
|
||||
void LOADERDECL TexCoord_ReadDirect_Float2(void* _p)
|
||||
{
|
||||
((float*)VertexManager::s_pCurBufferPointer)[0] = ReadBuffer32F() * tcScaleU[tcIndex];
|
||||
((float*)VertexManager::s_pCurBufferPointer)[1] = ReadBuffer32F() * tcScaleV[tcIndex];
|
||||
LOG_TEX2();
|
||||
VertexManager::s_pCurBufferPointer += 8;
|
||||
tcIndex++;
|
||||
}
|
||||
|
||||
// ==================================================================================
|
||||
void LOADERDECL TexCoord_ReadIndex8_UByte1(void* _p)
|
||||
{
|
||||
u8 Index = ReadBuffer8();
|
||||
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
||||
|
||||
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(u8)Memory_Read_U8(iAddress) * tcScaleU[tcIndex];
|
||||
LOG_TEX1();
|
||||
VertexManager::s_pCurBufferPointer += 4;
|
||||
tcIndex++;
|
||||
}
|
||||
void LOADERDECL TexCoord_ReadIndex8_UByte2(void* _p)
|
||||
{
|
||||
u8 Index = ReadBuffer8();
|
||||
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
||||
|
||||
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(u8)Memory_Read_U8(iAddress) * tcScaleU[tcIndex];
|
||||
((float*)VertexManager::s_pCurBufferPointer)[1] = (float)(u8)Memory_Read_U8(iAddress+1) * tcScaleV[tcIndex];
|
||||
LOG_TEX2();
|
||||
VertexManager::s_pCurBufferPointer += 8;
|
||||
tcIndex++;
|
||||
}
|
||||
|
||||
void LOADERDECL TexCoord_ReadIndex8_Byte1(void* _p)
|
||||
{
|
||||
u8 Index = ReadBuffer8();
|
||||
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
||||
|
||||
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(s8)Memory_Read_U8(iAddress) * tcScaleU[tcIndex];
|
||||
LOG_TEX1();
|
||||
VertexManager::s_pCurBufferPointer += 4;
|
||||
tcIndex++;
|
||||
}
|
||||
void LOADERDECL TexCoord_ReadIndex8_Byte2(void* _p)
|
||||
{
|
||||
u8 Index = ReadBuffer8();
|
||||
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
||||
|
||||
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(s8)Memory_Read_U8(iAddress) * tcScaleU[tcIndex];
|
||||
((float*)VertexManager::s_pCurBufferPointer)[1] = (float)(s8)Memory_Read_U8(iAddress+1) * tcScaleV[tcIndex];
|
||||
LOG_TEX2();
|
||||
VertexManager::s_pCurBufferPointer += 8;
|
||||
tcIndex++;
|
||||
}
|
||||
|
||||
void LOADERDECL TexCoord_ReadIndex8_UShort1(void* _p)
|
||||
{
|
||||
u8 Index = ReadBuffer8();
|
||||
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
||||
|
||||
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(u16)Memory_Read_U16(iAddress) * tcScaleU[tcIndex];
|
||||
LOG_TEX1();
|
||||
VertexManager::s_pCurBufferPointer += 4;
|
||||
tcIndex++;
|
||||
}
|
||||
void LOADERDECL TexCoord_ReadIndex8_UShort2(void* _p)
|
||||
{
|
||||
u8 Index = ReadBuffer8();
|
||||
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
||||
|
||||
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(u16)Memory_Read_U16(iAddress) * tcScaleU[tcIndex];
|
||||
((float*)VertexManager::s_pCurBufferPointer)[1] = (float)(u16)Memory_Read_U16(iAddress+2) * tcScaleV[tcIndex];
|
||||
LOG_TEX2();
|
||||
VertexManager::s_pCurBufferPointer += 8;
|
||||
tcIndex++;
|
||||
}
|
||||
|
||||
void LOADERDECL TexCoord_ReadIndex8_Short1(void* _p)
|
||||
{
|
||||
u8 Index = ReadBuffer8();
|
||||
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
||||
|
||||
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(s16)Memory_Read_U16(iAddress) * tcScaleU[tcIndex];
|
||||
LOG_TEX1();
|
||||
VertexManager::s_pCurBufferPointer += 4;
|
||||
tcIndex++;
|
||||
}
|
||||
void LOADERDECL TexCoord_ReadIndex8_Short2(void* _p)
|
||||
{
|
||||
u8 Index = ReadBuffer8();
|
||||
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
||||
|
||||
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(s16)Memory_Read_U16(iAddress) * tcScaleU[tcIndex];
|
||||
((float*)VertexManager::s_pCurBufferPointer)[1] = (float)(s16)Memory_Read_U16(iAddress+2) * tcScaleV[tcIndex];
|
||||
LOG_TEX2();
|
||||
VertexManager::s_pCurBufferPointer += 8;
|
||||
tcIndex++;
|
||||
}
|
||||
|
||||
void LOADERDECL TexCoord_ReadIndex8_Float1(void* _p)
|
||||
{
|
||||
u16 Index = ReadBuffer8();
|
||||
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
||||
u32 uTemp;
|
||||
uTemp = Memory_Read_U32(iAddress);
|
||||
((float*)VertexManager::s_pCurBufferPointer)[0] = *(float*)&uTemp * tcScaleU[tcIndex];
|
||||
LOG_TEX1();
|
||||
VertexManager::s_pCurBufferPointer += 4;
|
||||
tcIndex++;
|
||||
}
|
||||
void LOADERDECL TexCoord_ReadIndex8_Float2(void* _p)
|
||||
{
|
||||
u16 Index = ReadBuffer8();
|
||||
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
||||
u32 uTemp;
|
||||
uTemp = Memory_Read_U32(iAddress);
|
||||
((float*)VertexManager::s_pCurBufferPointer)[0] = *(float*)&uTemp * tcScaleU[tcIndex];
|
||||
uTemp = Memory_Read_U32(iAddress+4);
|
||||
((float*)VertexManager::s_pCurBufferPointer)[1] = *(float*)&uTemp * tcScaleV[tcIndex];
|
||||
LOG_TEX2();
|
||||
VertexManager::s_pCurBufferPointer += 8;
|
||||
tcIndex++;
|
||||
}
|
||||
|
||||
// ==================================================================================
|
||||
void LOADERDECL TexCoord_ReadIndex16_UByte1(void* _p)
|
||||
{
|
||||
u16 Index = ReadBuffer16();
|
||||
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
||||
|
||||
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(u8)Memory_Read_U8(iAddress) * tcScaleU[tcIndex];
|
||||
LOG_TEX1();
|
||||
VertexManager::s_pCurBufferPointer += 4;
|
||||
tcIndex++;
|
||||
}
|
||||
void LOADERDECL TexCoord_ReadIndex16_UByte2(void* _p)
|
||||
{
|
||||
u16 Index = ReadBuffer16();
|
||||
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
||||
|
||||
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(u8)Memory_Read_U8(iAddress) * tcScaleU[tcIndex];
|
||||
((float*)VertexManager::s_pCurBufferPointer)[1] = (float)(u8)Memory_Read_U8(iAddress+1) * tcScaleV[tcIndex];
|
||||
LOG_TEX2();
|
||||
VertexManager::s_pCurBufferPointer += 8;
|
||||
tcIndex++;
|
||||
}
|
||||
|
||||
void LOADERDECL TexCoord_ReadIndex16_Byte1(void* _p)
|
||||
{
|
||||
u16 Index = ReadBuffer16();
|
||||
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
||||
|
||||
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(s8)Memory_Read_U8(iAddress) * tcScaleU[tcIndex];
|
||||
LOG_TEX1();
|
||||
VertexManager::s_pCurBufferPointer += 4;
|
||||
tcIndex++;
|
||||
}
|
||||
void LOADERDECL TexCoord_ReadIndex16_Byte2(void* _p)
|
||||
{
|
||||
u16 Index = ReadBuffer16();
|
||||
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
||||
|
||||
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(s8)Memory_Read_U8(iAddress) * tcScaleU[tcIndex];
|
||||
((float*)VertexManager::s_pCurBufferPointer)[1] = (float)(s8)Memory_Read_U8(iAddress+1) * tcScaleV[tcIndex];
|
||||
LOG_TEX2();
|
||||
VertexManager::s_pCurBufferPointer += 8;
|
||||
tcIndex++;
|
||||
}
|
||||
|
||||
void LOADERDECL TexCoord_ReadIndex16_UShort1(void* _p)
|
||||
{
|
||||
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
||||
u16 Index = ReadBuffer16();
|
||||
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
||||
|
||||
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(u16)Memory_Read_U16(iAddress) * tcScaleU[tcIndex];
|
||||
LOG_TEX1();
|
||||
VertexManager::s_pCurBufferPointer += 4;
|
||||
tcIndex++;
|
||||
}
|
||||
void LOADERDECL TexCoord_ReadIndex16_UShort2(void* _p)
|
||||
{
|
||||
TVtxAttr* pVtxAttr = (TVtxAttr*)_p;
|
||||
u16 Index = ReadBuffer16();
|
||||
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
||||
|
||||
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(u16)Memory_Read_U16(iAddress) * tcScaleU[tcIndex];
|
||||
((float*)VertexManager::s_pCurBufferPointer)[1] = (float)(u16)Memory_Read_U16(iAddress+2) * tcScaleV[tcIndex];
|
||||
LOG_TEX2();
|
||||
VertexManager::s_pCurBufferPointer += 8;
|
||||
tcIndex++;
|
||||
}
|
||||
|
||||
void LOADERDECL TexCoord_ReadIndex16_Short1(void* _p)
|
||||
{
|
||||
u16 Index = ReadBuffer16();
|
||||
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
||||
|
||||
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(s16)Memory_Read_U16(iAddress) * tcScaleU[tcIndex];
|
||||
LOG_TEX1();
|
||||
VertexManager::s_pCurBufferPointer += 4;
|
||||
tcIndex++;
|
||||
}
|
||||
void LOADERDECL TexCoord_ReadIndex16_Short2(void* _p)
|
||||
{
|
||||
u16 Index = ReadBuffer16();
|
||||
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
||||
|
||||
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(s16)Memory_Read_U16(iAddress) * tcScaleU[tcIndex];
|
||||
((float*)VertexManager::s_pCurBufferPointer)[1] = (float)(s16)Memory_Read_U16(iAddress+2) * tcScaleV[tcIndex];
|
||||
LOG_TEX2();
|
||||
VertexManager::s_pCurBufferPointer += 8;
|
||||
tcIndex++;
|
||||
}
|
||||
|
||||
void LOADERDECL TexCoord_ReadIndex16_Float1(void* _p)
|
||||
{
|
||||
u16 Index = ReadBuffer16();
|
||||
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
||||
u32 uTemp;
|
||||
uTemp = Memory_Read_U32(iAddress );
|
||||
((float*)VertexManager::s_pCurBufferPointer)[0] = *(float*)&uTemp * tcScaleU[tcIndex];
|
||||
LOG_TEX1();
|
||||
VertexManager::s_pCurBufferPointer += 4;
|
||||
tcIndex++;
|
||||
}
|
||||
void LOADERDECL TexCoord_ReadIndex16_Float2(void* _p)
|
||||
{
|
||||
u16 Index = ReadBuffer16();
|
||||
u32 iAddress = arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
||||
u32 uTemp;
|
||||
uTemp = Memory_Read_U32(iAddress );
|
||||
((float*)VertexManager::s_pCurBufferPointer)[0] = *(float*)&uTemp * tcScaleU[tcIndex];
|
||||
uTemp = Memory_Read_U32(iAddress+4);
|
||||
((float*)VertexManager::s_pCurBufferPointer)[1] = *(float*)&uTemp * tcScaleV[tcIndex];
|
||||
LOG_TEX2();
|
||||
VertexManager::s_pCurBufferPointer += 8;
|
||||
tcIndex++;
|
||||
}
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,325 @@
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#ifndef GCOGL_VERTEXSHADER_H
|
||||
#define GCOGL_VERTEXSHADER_H
|
||||
|
||||
#include <map>
|
||||
|
||||
/////////////
|
||||
// Lighting
|
||||
/////////////
|
||||
#define XF_TEXPROJ_ST 0
|
||||
#define XF_TEXPROJ_STQ 1
|
||||
|
||||
#define XF_TEXINPUT_AB11 0
|
||||
#define XF_TEXINPUT_ABC1 1
|
||||
|
||||
#define XF_TEXGEN_REGULAR 0
|
||||
#define XF_TEXGEN_EMBOSS_MAP 1 // used when bump mapping
|
||||
#define XF_TEXGEN_COLOR_STRGBC0 2
|
||||
#define XF_TEXGEN_COLOR_STRGBC1 3
|
||||
|
||||
#define XF_SRCGEOM_INROW 0 // input is abc
|
||||
#define XF_SRCNORMAL_INROW 1 // input is abc
|
||||
#define XF_SRCCOLORS_INROW 2
|
||||
#define XF_SRCBINORMAL_T_INROW 3 // input is abc
|
||||
#define XF_SRCBINORMAL_B_INROW 4 // input is abc
|
||||
#define XF_SRCTEX0_INROW 5
|
||||
#define XF_SRCTEX1_INROW 6
|
||||
#define XF_SRCTEX2_INROW 7
|
||||
#define XF_SRCTEX3_INROW 8
|
||||
#define XF_SRCTEX4_INROW 9
|
||||
#define XF_SRCTEX5_INROW 10
|
||||
#define XF_SRCTEX6_INROW 11
|
||||
#define XF_SRCTEX7_INROW 12
|
||||
|
||||
struct Light
|
||||
{
|
||||
u32 useless[3];
|
||||
u32 color; //rgba
|
||||
float a0; //attenuation
|
||||
float a1;
|
||||
float a2;
|
||||
float k0; //k stuff
|
||||
float k1;
|
||||
float k2;
|
||||
union
|
||||
{
|
||||
struct {
|
||||
float dpos[3];
|
||||
float ddir[3]; // specular lights only
|
||||
};
|
||||
struct {
|
||||
float sdir[3];
|
||||
float shalfangle[3]; // specular lights only
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
#define LIGHTDIF_NONE 0
|
||||
#define LIGHTDIF_SIGN 1
|
||||
#define LIGHTDIF_CLAMP 2
|
||||
|
||||
#define LIGHTATTN_SPEC 0 // specular attenuation
|
||||
#define LIGHTATTN_SPOT 1 // distance/spotlight attenuation
|
||||
#define LIGHTATTN_NONE 2
|
||||
#define LIGHTATTN_DIR 3
|
||||
|
||||
union LitChannel
|
||||
{
|
||||
struct
|
||||
{
|
||||
unsigned matsource : 1;
|
||||
unsigned enablelighting : 1;
|
||||
unsigned lightMask0_3 : 4;
|
||||
unsigned ambsource : 1;
|
||||
unsigned diffusefunc : 2; // LIGHTDIF_X
|
||||
unsigned attnfunc : 2; // LIGHTATTN_X
|
||||
unsigned lightMask4_7 : 4;
|
||||
};
|
||||
struct
|
||||
{
|
||||
u32 hex : 15;
|
||||
u32 unused : 17;
|
||||
};
|
||||
struct
|
||||
{
|
||||
u32 dummy0 : 7;
|
||||
u32 lightparams : 4;
|
||||
u32 dummy1 : 21;
|
||||
};
|
||||
unsigned int GetFullLightMask() const
|
||||
{
|
||||
return enablelighting ? (lightMask0_3 | (lightMask4_7 << 4)) : 0;
|
||||
}
|
||||
};
|
||||
|
||||
struct ColorChannel
|
||||
{
|
||||
u32 ambColor;
|
||||
u32 matColor;
|
||||
LitChannel color;
|
||||
LitChannel alpha;
|
||||
};
|
||||
|
||||
|
||||
union INVTXSPEC
|
||||
{
|
||||
struct
|
||||
{
|
||||
unsigned numcolors : 2;
|
||||
unsigned numnormals : 2; // 0 - nothing, 1 - just normal, 2 - normals and binormals
|
||||
unsigned numtextures : 4;
|
||||
unsigned unused : 24;
|
||||
};
|
||||
u32 hex;
|
||||
};
|
||||
|
||||
union TexMtxInfo
|
||||
{
|
||||
struct
|
||||
{
|
||||
unsigned unknown : 1;
|
||||
unsigned projection : 1; // XF_TEXPROJ_X
|
||||
unsigned inputform : 2; // XF_TEXINPUT_X
|
||||
unsigned texgentype : 3; // XF_TEXGEN_X
|
||||
unsigned sourcerow : 5; // XF_SRCGEOM_X
|
||||
unsigned embosssourceshift : 3; // what generated texcoord to use
|
||||
unsigned embosslightshift : 3; // light index that is used
|
||||
};
|
||||
u32 hex;
|
||||
};
|
||||
|
||||
union PostMtxInfo
|
||||
{
|
||||
struct
|
||||
{
|
||||
unsigned index : 6; // base row of dual transform matrix
|
||||
unsigned unused : 2;
|
||||
unsigned normalize : 1; // normalize before send operation
|
||||
};
|
||||
u32 hex;
|
||||
};
|
||||
|
||||
struct TexCoordInfo
|
||||
{
|
||||
TexMtxInfo texmtxinfo;
|
||||
PostMtxInfo postmtxinfo;
|
||||
};
|
||||
|
||||
struct XFRegisters
|
||||
{
|
||||
int numTexGens;
|
||||
int nNumChans;
|
||||
INVTXSPEC hostinfo; // number of textures,colors,normals from vertex input
|
||||
ColorChannel colChans[2]; //C0A0 C1A1
|
||||
TexCoordInfo texcoords[8];
|
||||
bool bEnableDualTexTransform;
|
||||
};
|
||||
|
||||
#define XFMEM_SIZE 0x8000
|
||||
#define XFMEM_POSMATRICES 0x000
|
||||
#define XFMEM_POSMATRICES_END 0x100
|
||||
#define XFMEM_NORMALMATRICES 0x400
|
||||
#define XFMEM_NORMALMATRICES_END 0x460
|
||||
#define XFMEM_POSTMATRICES 0x500
|
||||
#define XFMEM_POSTMATRICES_END 0x600
|
||||
#define XFMEM_LIGHTS 0x600
|
||||
#define XFMEM_LIGHTS_END 0x680
|
||||
|
||||
// Matrix indices
|
||||
union TMatrixIndexA
|
||||
{
|
||||
struct
|
||||
{
|
||||
unsigned PosNormalMtxIdx : 6;
|
||||
unsigned Tex0MtxIdx : 6;
|
||||
unsigned Tex1MtxIdx : 6;
|
||||
unsigned Tex2MtxIdx : 6;
|
||||
unsigned Tex3MtxIdx : 6;
|
||||
};
|
||||
struct
|
||||
{
|
||||
u32 Hex : 30;
|
||||
u32 unused : 2;
|
||||
};
|
||||
};
|
||||
|
||||
union TMatrixIndexB
|
||||
{
|
||||
struct
|
||||
{
|
||||
unsigned Tex4MtxIdx : 6;
|
||||
unsigned Tex5MtxIdx : 6;
|
||||
unsigned Tex6MtxIdx : 6;
|
||||
unsigned Tex7MtxIdx : 6;
|
||||
};
|
||||
struct
|
||||
{
|
||||
u32 Hex : 24;
|
||||
u32 unused : 8;
|
||||
};
|
||||
};
|
||||
|
||||
struct VERTEXSHADER
|
||||
{
|
||||
VERTEXSHADER() : glprogid(0) {}
|
||||
GLuint glprogid; // opengl program id
|
||||
|
||||
#ifdef _DEBUG
|
||||
std::string strprog;
|
||||
#endif
|
||||
};
|
||||
|
||||
class VertexShaderMngr
|
||||
{
|
||||
struct VSCacheEntry
|
||||
{
|
||||
VERTEXSHADER shader;
|
||||
int frameCount;
|
||||
VSCacheEntry() : frameCount(0) {}
|
||||
void Destroy() {
|
||||
SAFE_RELEASE_PROG(shader.glprogid);
|
||||
}
|
||||
};
|
||||
|
||||
class VERTEXSHADERUID
|
||||
{
|
||||
public:
|
||||
VERTEXSHADERUID() {}
|
||||
VERTEXSHADERUID(const VERTEXSHADERUID& r) {
|
||||
for(size_t i = 0; i < sizeof(values) / sizeof(u32); ++i)
|
||||
values[i] = r.values[i];
|
||||
}
|
||||
|
||||
bool operator<(const VERTEXSHADERUID& _Right) const
|
||||
{
|
||||
if( values[0] < _Right.values[0] )
|
||||
return true;
|
||||
else if( values[0] > _Right.values[0] )
|
||||
return false;
|
||||
|
||||
int N = (((values[0]>>23)&0xf)*3+3)/4 + 3; // numTexGens*3/4+1
|
||||
for(int i = 1; i < N; ++i) {
|
||||
if( values[i] < _Right.values[i] )
|
||||
return true;
|
||||
else if( values[i] > _Right.values[i] )
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool operator==(const VERTEXSHADERUID& _Right) const
|
||||
{
|
||||
if( values[0] != _Right.values[0] )
|
||||
return false;
|
||||
|
||||
int N = (((values[0]>>23)&0xf)*3+3)/4 + 3; // numTexGens*3/4+1
|
||||
for(int i = 1; i < N; ++i) {
|
||||
if( values[i] != _Right.values[i] )
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
u32 values[9];
|
||||
};
|
||||
|
||||
typedef std::map<VERTEXSHADERUID,VSCacheEntry> VSCache;
|
||||
|
||||
static VSCache vshaders;
|
||||
static VERTEXSHADER* pShaderLast;
|
||||
static TMatrixIndexA MatrixIndexA;
|
||||
static TMatrixIndexB MatrixIndexB;
|
||||
|
||||
static void GetVertexShaderId(VERTEXSHADERUID& uid, u32 components);
|
||||
static bool GenerateVertexShader(VERTEXSHADER& vs, u32 components);
|
||||
static char* GenerateLightShader(char* p, int index, const LitChannel& chan, const char* dest, int coloralpha);
|
||||
|
||||
public:
|
||||
static void Init();
|
||||
static void Cleanup();
|
||||
static void Shutdown();
|
||||
static VERTEXSHADER* GetShader(u32 components);
|
||||
static bool CompileVertexShader(VERTEXSHADER& ps, const char* pstrprogram);
|
||||
|
||||
// constant management
|
||||
static void SetConstants(VERTEXSHADER& vs);
|
||||
|
||||
static void SetViewport(float* _Viewport);
|
||||
static void SetViewportChanged();
|
||||
static void SetProjection(float* _pProjection, int constantIndex = -1);
|
||||
static void InvalidateXFRange(int start, int end);
|
||||
static void SetTexMatrixChangedA(u32 Value);
|
||||
static void SetTexMatrixChangedB(u32 Value);
|
||||
|
||||
static size_t SaveLoadState(char *ptr, BOOL save);
|
||||
static void LoadXFReg(u32 transferSize, u32 address, u32 *pData);
|
||||
static void LoadIndexedXF(u32 val, int array);
|
||||
|
||||
static float* GetPosNormalMat();
|
||||
|
||||
static float rawViewport[6];
|
||||
static float rawProjection[7];
|
||||
};
|
||||
|
||||
extern XFRegisters xfregs;
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,281 @@
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include "ChunkFile.h"
|
||||
|
||||
namespace W32Util
|
||||
{
|
||||
ChunkFile::ChunkFile(const TCHAR *filename, bool _read)
|
||||
{
|
||||
data=0;
|
||||
fastMode=false;
|
||||
if (file.Open(filename,_read ? FILE_READ : FILE_WRITE))
|
||||
{
|
||||
didFail=false;
|
||||
}
|
||||
else
|
||||
{
|
||||
didFail=true;
|
||||
return;
|
||||
}
|
||||
|
||||
int fSize = file.GetSize();
|
||||
|
||||
fastMode = _read ? true : false;
|
||||
|
||||
if (fastMode)
|
||||
{
|
||||
data = new char[fSize];
|
||||
file.Read(data,fSize);
|
||||
file.Close();
|
||||
}
|
||||
|
||||
eof=fSize;
|
||||
numLevels=0;
|
||||
read=_read;
|
||||
pos=0;
|
||||
didFail=false;
|
||||
}
|
||||
|
||||
ChunkFile::~ChunkFile()
|
||||
{
|
||||
if (fastMode && data)
|
||||
delete [] data;
|
||||
else
|
||||
file.Close();
|
||||
}
|
||||
|
||||
|
||||
int ChunkFile::ReadInt()
|
||||
{
|
||||
if (pos<eof)
|
||||
{
|
||||
/*
|
||||
int temp = *(int *)(data+pos);
|
||||
pos+=4;
|
||||
*/
|
||||
pos+=4;
|
||||
if (fastMode)
|
||||
return *(int *)(data+pos-4);
|
||||
else
|
||||
return file.ReadInt();
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ChunkFile::WriteInt(int i)
|
||||
{
|
||||
/*
|
||||
*(int *)(data+pos) = i;
|
||||
pos+=4;
|
||||
*/
|
||||
file.WriteInt(i);
|
||||
pos+=4;
|
||||
}
|
||||
|
||||
//let's get into the business
|
||||
bool ChunkFile::Descend(unsigned int id)
|
||||
{
|
||||
id=flipID(id);
|
||||
if (read)
|
||||
{
|
||||
bool found = false;
|
||||
int startPos = pos;
|
||||
ChunkInfo temp = stack[numLevels];
|
||||
|
||||
//save information to restore after the next Ascend
|
||||
stack[numLevels].parentStartLocation = pos;
|
||||
stack[numLevels].parentEOF = eof;
|
||||
|
||||
|
||||
int firstID = 0;
|
||||
//let's search through children..
|
||||
while(pos<eof)
|
||||
{
|
||||
stack[numLevels].ID = ReadInt();
|
||||
if (firstID == 0) firstID=stack[numLevels].ID|1;
|
||||
stack[numLevels].length = ReadInt();
|
||||
stack[numLevels].startLocation = pos;
|
||||
|
||||
if (stack[numLevels].ID == id)
|
||||
{
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
SeekTo(pos + stack[numLevels].length); //try next block
|
||||
}
|
||||
}
|
||||
|
||||
//if we found nothing, return false so the caller can skip this
|
||||
if (!found)
|
||||
{
|
||||
/*
|
||||
pos = startPos;
|
||||
char temp1[5]; TCHAR temp2[5];
|
||||
temp1[4]=0; temp2[4]=0;
|
||||
*(int *)temp1 =id;
|
||||
TCHAR tempx[256];
|
||||
|
||||
for (int i=0; i<4; i++)
|
||||
temp2[i]=temp1[i];
|
||||
|
||||
_stprintf(tempx,TEXT("Couldn't find chunk \"%s\" in file"),temp2);
|
||||
|
||||
MessageBox(theApp->getHWND(),tempx,0,0);
|
||||
*/
|
||||
stack[numLevels]=temp;
|
||||
SeekTo(stack[numLevels].parentStartLocation);
|
||||
return false;
|
||||
}
|
||||
|
||||
//descend into it
|
||||
//pos was set inside the loop above
|
||||
eof = stack[numLevels].startLocation + stack[numLevels].length;
|
||||
numLevels++;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
//write a chunk id, and prepare for filling in length later
|
||||
WriteInt(id);
|
||||
WriteInt(0); //will be filled in by Ascend
|
||||
stack[numLevels].startLocation=pos;
|
||||
numLevels++;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
void ChunkFile::SeekTo(int _pos)
|
||||
{
|
||||
if (!fastMode)
|
||||
file.SeekBeg(_pos);
|
||||
pos=_pos;
|
||||
}
|
||||
|
||||
//let's Ascend out
|
||||
void ChunkFile::Ascend()
|
||||
{
|
||||
if (read)
|
||||
{
|
||||
//Ascend, and restore information
|
||||
numLevels--;
|
||||
SeekTo(stack[numLevels].parentStartLocation);
|
||||
eof = stack[numLevels].parentEOF;
|
||||
}
|
||||
else
|
||||
{
|
||||
numLevels--;
|
||||
//now fill in the written length automatically
|
||||
int posNow = pos;
|
||||
SeekTo(stack[numLevels].startLocation - 4);
|
||||
WriteInt(posNow-stack[numLevels].startLocation);
|
||||
SeekTo(posNow);
|
||||
}
|
||||
}
|
||||
|
||||
//read a block
|
||||
void ChunkFile::ReadData(void *what, int count)
|
||||
{
|
||||
|
||||
if (fastMode)
|
||||
memcpy(what,data+pos,count);
|
||||
else
|
||||
file.Read(what,count);
|
||||
|
||||
pos+=count;
|
||||
char temp[4]; //discarded
|
||||
count &= 3;
|
||||
if (count)
|
||||
{
|
||||
count=4-count;
|
||||
if (!fastMode)
|
||||
file.Read(temp,count);
|
||||
pos+=count;
|
||||
}
|
||||
}
|
||||
|
||||
//write a block
|
||||
void ChunkFile::WriteData(void *what, int count)
|
||||
{
|
||||
/*
|
||||
memcpy(data+pos,what,count);
|
||||
pos += count;
|
||||
*/
|
||||
file.Write(what,count);
|
||||
pos+=count;
|
||||
char temp[5]={0,0,0,0,0};
|
||||
count &= 3;
|
||||
if (count)
|
||||
{
|
||||
count=4-count;
|
||||
file.Write(temp,count);
|
||||
pos+=count;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
void ChunkFile::WriteString(String str)
|
||||
{
|
||||
wchar_t *text;
|
||||
int len=str.length();
|
||||
#ifdef UNICODE
|
||||
text = str.getPointer();
|
||||
#else
|
||||
text=new wchar_t[len+1];
|
||||
str.toUnicode(text);
|
||||
#endif
|
||||
WriteInt(len);
|
||||
WriteData((char *)text,len*sizeof(wchar_t));
|
||||
#ifndef UNICODE
|
||||
delete [] text;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
String ChunkFile::readString()
|
||||
{
|
||||
int len=ReadInt();
|
||||
wchar_t *text = new wchar_t[len+1];
|
||||
ReadData((char *)text,len*sizeof(wchar_t));
|
||||
text[len]=0;
|
||||
#ifdef UNICODE
|
||||
String s(text);
|
||||
delete [] text;
|
||||
return s;
|
||||
#else
|
||||
String temp;
|
||||
temp.fromUnicode(text);
|
||||
delete [] text;
|
||||
return temp;
|
||||
#endif
|
||||
}
|
||||
*/
|
||||
|
||||
int ChunkFile::GetCurrentChunkSize()
|
||||
{
|
||||
if (numLevels)
|
||||
return stack[numLevels-1].length;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
//TO REMEMBER WHEN USING:
|
||||
|
||||
//EITHER a chunk contains ONLY data
|
||||
//OR it contains ONLY other chunks
|
||||
//otherwise the scheme breaks...
|
||||
#include "File.h"
|
||||
|
||||
namespace W32Util
|
||||
{
|
||||
inline unsigned int flipID(unsigned int id)
|
||||
{
|
||||
return ((id>>24)&0xFF) | ((id>>8)&0xFF00) | ((id<<8)&0xFF0000) | ((id<<24)&0xFF000000);
|
||||
}
|
||||
|
||||
class ChunkFile
|
||||
{
|
||||
File file;
|
||||
struct ChunkInfo
|
||||
{
|
||||
int startLocation;
|
||||
int parentStartLocation;
|
||||
int parentEOF;
|
||||
unsigned int ID;
|
||||
int length;
|
||||
};
|
||||
ChunkInfo stack[8];
|
||||
int numLevels;
|
||||
|
||||
char *data;
|
||||
int pos,eof;
|
||||
bool fastMode;
|
||||
bool read;
|
||||
bool didFail;
|
||||
|
||||
void SeekTo(int _pos);
|
||||
int GetPos() {return pos;}
|
||||
public:
|
||||
ChunkFile(const TCHAR *filename, bool _read);
|
||||
~ChunkFile();
|
||||
|
||||
bool Descend(unsigned int id);
|
||||
void Ascend();
|
||||
|
||||
int ReadInt();
|
||||
void ReadInt(int &i) {i = ReadInt();}
|
||||
void ReadData(void *data, int count);
|
||||
// String ReadString();
|
||||
|
||||
void WriteInt(int i);
|
||||
//void WriteString(String str);
|
||||
void WriteData(void *data, int count);
|
||||
|
||||
int GetCurrentChunkSize();
|
||||
bool Failed() {return didFail;}
|
||||
};
|
||||
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include "DialogManager.h"
|
||||
|
||||
typedef std::vector <HWND> WindowList;
|
||||
WindowList dialogs;
|
||||
|
||||
void DialogManager::AddDlg(HWND hDialog)
|
||||
{
|
||||
dialogs.push_back(hDialog);
|
||||
}
|
||||
|
||||
bool DialogManager::IsDialogMessage(LPMSG message)
|
||||
{
|
||||
WindowList::iterator iter;
|
||||
for (iter=dialogs.begin(); iter!=dialogs.end(); iter++)
|
||||
{
|
||||
if (::IsDialogMessage(*iter,message))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void DialogManager::EnableAll(BOOL enable)
|
||||
{
|
||||
WindowList::iterator iter;
|
||||
for (iter=dialogs.begin(); iter!=dialogs.end(); iter++)
|
||||
EnableWindow(*iter,enable);
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
class DialogManager
|
||||
{
|
||||
public:
|
||||
static void AddDlg(HWND hDialog);
|
||||
static bool IsDialogMessage(LPMSG message);
|
||||
static void EnableAll(BOOL enable);
|
||||
};
|
||||
|
||||
@@ -0,0 +1,192 @@
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include "Globals.h"
|
||||
|
||||
#include <windowsx.h>
|
||||
|
||||
#include "resource.h"
|
||||
#include "PropertySheet.h"
|
||||
#include "ShellUtil.h"
|
||||
#include "Misc.h"
|
||||
|
||||
struct TabOGL : public W32Util::Tab
|
||||
{
|
||||
void Init(HWND hDlg)
|
||||
{
|
||||
ComboBox_AddString(GetDlgItem(hDlg, IDC_ANTIALIASMODE), "1X");
|
||||
ComboBox_AddString(GetDlgItem(hDlg, IDC_ANTIALIASMODE), "2X");
|
||||
ComboBox_AddString(GetDlgItem(hDlg, IDC_ANTIALIASMODE), "4X");
|
||||
ComboBox_AddString(GetDlgItem(hDlg, IDC_ANTIALIASMODE), "8X");
|
||||
ComboBox_AddString(GetDlgItem(hDlg, IDC_ANTIALIASMODE), "16X");
|
||||
ComboBox_SetCurSel(GetDlgItem(hDlg, IDC_ANTIALIASMODE), g_Config.iMultisampleMode);
|
||||
|
||||
//EnableWindow(GetDlgItem(hDlg, IDC_ANTIALIASMODE), FALSE);
|
||||
|
||||
for (int i = 0; i < NUMWNDRES; i++)
|
||||
{
|
||||
char temp[256];
|
||||
sprintf(temp,"%ix%i",g_Res[i][0],g_Res[i][1]);
|
||||
ComboBox_AddString(GetDlgItem(hDlg,IDC_RESOLUTIONWINDOWED),temp);
|
||||
ComboBox_AddString(GetDlgItem(hDlg,IDC_RESOLUTION), temp);
|
||||
}
|
||||
ComboBox_SetCurSel(GetDlgItem(hDlg,IDC_RESOLUTIONWINDOWED),g_Config.iWindowedRes);
|
||||
ComboBox_SetCurSel(GetDlgItem(hDlg,IDC_RESOLUTION), g_Config.iFSResolution);
|
||||
|
||||
CheckDlgButton(hDlg, IDC_FULLSCREENENABLE, g_Config.bFullscreen ? TRUE : FALSE);
|
||||
}
|
||||
|
||||
void Command(HWND hDlg,WPARAM wParam)
|
||||
{
|
||||
/*
|
||||
switch (LOWORD(wParam))
|
||||
{
|
||||
default:
|
||||
break;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
void Apply(HWND hDlg)
|
||||
{
|
||||
g_Config.iWindowedRes = ComboBox_GetCurSel(GetDlgItem(hDlg, IDC_RESOLUTIONWINDOWED));
|
||||
g_Config.iMultisampleMode = ComboBox_GetCurSel(GetDlgItem(hDlg, IDC_ANTIALIASMODE));
|
||||
g_Config.iFSResolution = ComboBox_GetCurSel(GetDlgItem(hDlg,IDC_RESOLUTION));
|
||||
g_Config.bFullscreen = Button_GetCheck(GetDlgItem(hDlg, IDC_FULLSCREENENABLE)) ? true : false;
|
||||
}
|
||||
};
|
||||
|
||||
struct TabAdvanced : public W32Util::Tab
|
||||
{
|
||||
void Init(HWND hDlg)
|
||||
{
|
||||
HWND opt = GetDlgItem(hDlg,IDC_DLOPTLEVEL);
|
||||
ComboBox_AddString(opt,"0: Interpret (slowest, most compatible)");
|
||||
ComboBox_AddString(opt,"1: Compile lists and decode vertex lists");
|
||||
//ComboBox_AddString(opt,"2: Compile+decode to vbufs and use hw xform");
|
||||
//ComboBox_AddString(opt,"Recompile to vbuffers and shaders");
|
||||
ComboBox_SetCurSel(opt,g_Config.iCompileDLsLevel);
|
||||
|
||||
Button_SetCheck(GetDlgItem(hDlg,IDC_OVERLAYSTATS), g_Config.bOverlayStats);
|
||||
Button_SetCheck(GetDlgItem(hDlg,IDC_WIREFRAME), g_Config.bWireFrame);
|
||||
Button_SetCheck(GetDlgItem(hDlg,IDC_TEXDUMP), g_Config.bDumpTextures);
|
||||
Button_SetCheck(GetDlgItem(hDlg,IDC_SHOWSHADERERRORS), g_Config.bShowShaderErrors);
|
||||
|
||||
SetWindowText(GetDlgItem(hDlg,IDC_TEXDUMPPATH),g_Config.texDumpPath);
|
||||
Edit_LimitText(GetDlgItem(hDlg,IDC_TEXDUMPPATH),255);
|
||||
}
|
||||
void Command(HWND hDlg,WPARAM wParam)
|
||||
{
|
||||
switch (LOWORD(wParam))
|
||||
{
|
||||
case IDC_BROWSETEXDUMPPATH:
|
||||
{
|
||||
std::string path = W32Util::BrowseForFolder(hDlg,"Choose texture dump path:");
|
||||
SetWindowText(GetDlgItem(hDlg,IDC_TEXDUMPPATH),path.c_str());
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
void Apply(HWND hDlg)
|
||||
{
|
||||
g_Config.bOverlayStats = Button_GetCheck(GetDlgItem(hDlg,IDC_OVERLAYSTATS)) ? true : false;
|
||||
g_Config.bWireFrame = Button_GetCheck(GetDlgItem(hDlg,IDC_WIREFRAME)) ? true : false;
|
||||
g_Config.bDumpTextures = Button_GetCheck(GetDlgItem(hDlg,IDC_TEXDUMP)) ? true : false;
|
||||
g_Config.iCompileDLsLevel = (int)ComboBox_GetCurSel(GetDlgItem(hDlg,IDC_DLOPTLEVEL));
|
||||
g_Config.bShowShaderErrors = Button_GetCheck(GetDlgItem(hDlg,IDC_SHOWSHADERERRORS)) ? true : false;
|
||||
char temp[MAX_PATH];
|
||||
GetWindowText(GetDlgItem(hDlg,IDC_TEXDUMPPATH), temp, MAX_PATH);
|
||||
strcpy(g_Config.texDumpPath, temp);
|
||||
}
|
||||
};
|
||||
|
||||
struct TabDebug : public W32Util::Tab
|
||||
{
|
||||
void Init(HWND hDlg)
|
||||
{
|
||||
}
|
||||
void Command(HWND hDlg,WPARAM wParam)
|
||||
{
|
||||
/*
|
||||
switch (LOWORD(wParam))
|
||||
{
|
||||
default:
|
||||
break;
|
||||
}
|
||||
*/
|
||||
}
|
||||
void Apply(HWND hDlg)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
struct TabEnhancements : public W32Util::Tab
|
||||
{
|
||||
void Init(HWND hDlg)
|
||||
{
|
||||
Button_SetCheck(GetDlgItem(hDlg,IDC_FORCEFILTERING),g_Config.bForceFiltering);
|
||||
}
|
||||
void Command(HWND hDlg,WPARAM wParam)
|
||||
{
|
||||
/*
|
||||
switch (LOWORD(wParam))
|
||||
{
|
||||
default:
|
||||
break;
|
||||
}
|
||||
*/
|
||||
}
|
||||
void Apply(HWND hDlg)
|
||||
{
|
||||
g_Config.bForceFiltering = Button_GetCheck(GetDlgItem(hDlg,IDC_FORCEFILTERING)) ? true : false;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
void DlgSettings_Show(HINSTANCE hInstance, HWND _hParent)
|
||||
{
|
||||
g_Config.Load();
|
||||
W32Util::PropSheet sheet;
|
||||
sheet.Add(new TabOGL,(LPCTSTR)IDD_SETTINGS,"Direct3D");
|
||||
sheet.Add(new TabEnhancements,(LPCTSTR)IDD_ENHANCEMENTS,"Enhancements");
|
||||
sheet.Add(new TabAdvanced,(LPCTSTR)IDD_ADVANCED,"Advanced");
|
||||
//sheet.Add(new TabDebug,(LPCTSTR)IDD_DEBUGGER,"Debugger");
|
||||
sheet.Show(hInstance,_hParent,"Graphics Plugin");
|
||||
g_Config.Save();
|
||||
}
|
||||
|
||||
// Message handler for about box.
|
||||
LRESULT CALLBACK AboutProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
switch (message)
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
W32Util::CenterWindow(hDlg);
|
||||
return TRUE;
|
||||
|
||||
case WM_COMMAND:
|
||||
if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
|
||||
{
|
||||
EndDialog(hDlg, LOWORD(wParam));
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
void DlgSettings_Show(HINSTANCE hInstance, HWND parent);
|
||||
LRESULT CALLBACK AboutProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
|
||||
@@ -0,0 +1,174 @@
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#include "../../Core/Src/Core.h"
|
||||
#include "EmuWindow.h"
|
||||
|
||||
namespace EmuWindow
|
||||
{
|
||||
HWND m_hWnd;
|
||||
HWND m_hParent = NULL;
|
||||
HINSTANCE m_hInstance;
|
||||
WNDCLASSEX wndClass;
|
||||
const TCHAR m_szClassName[] = "DolphinEmuWnd";
|
||||
int g_winstyle;
|
||||
|
||||
HWND GetWnd()
|
||||
{
|
||||
return m_hWnd;
|
||||
}
|
||||
|
||||
HWND GetParentWnd()
|
||||
{
|
||||
return m_hParent;
|
||||
}
|
||||
|
||||
LRESULT CALLBACK WndProc( HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam )
|
||||
{
|
||||
HDC hdc;
|
||||
PAINTSTRUCT ps;
|
||||
switch( iMsg )
|
||||
{
|
||||
case WM_PAINT:
|
||||
hdc = BeginPaint( hWnd, &ps );
|
||||
EndPaint( hWnd, &ps );
|
||||
return 0;
|
||||
|
||||
case WM_KEYDOWN:
|
||||
switch( LOWORD( wParam ))
|
||||
{
|
||||
case VK_ESCAPE: /* Pressing esc quits */
|
||||
//DestroyWindow(hWnd);
|
||||
//PostQuitMessage(0);
|
||||
break;
|
||||
/*
|
||||
case MY_KEYS:
|
||||
hypotheticalScene->sendMessage(KEYDOWN...);
|
||||
*/
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_CLOSE:
|
||||
//Core::SetState(Core::CORE_UNINITIALIZED);
|
||||
exit(0);
|
||||
return 0;
|
||||
|
||||
case WM_DESTROY:
|
||||
//Shutdown();
|
||||
//PostQuitMessage( 0 );
|
||||
break;
|
||||
}
|
||||
|
||||
return DefWindowProc(hWnd, iMsg, wParam, lParam);
|
||||
}
|
||||
|
||||
|
||||
HWND OpenWindow(HWND parent, HINSTANCE hInstance, bool windowed, int width, int height, const TCHAR *title)
|
||||
{
|
||||
wndClass.cbSize = sizeof( wndClass );
|
||||
wndClass.style = CS_HREDRAW | CS_VREDRAW;
|
||||
wndClass.lpfnWndProc = WndProc;
|
||||
wndClass.cbClsExtra = 0;
|
||||
wndClass.cbWndExtra = 0;
|
||||
wndClass.hInstance = hInstance;
|
||||
wndClass.hIcon = LoadIcon( NULL, IDI_APPLICATION );
|
||||
wndClass.hCursor = LoadCursor( NULL, IDC_ARROW );
|
||||
wndClass.hbrBackground = (HBRUSH)GetStockObject( BLACK_BRUSH );
|
||||
wndClass.lpszMenuName = NULL;
|
||||
wndClass.lpszClassName = m_szClassName;
|
||||
wndClass.hIconSm = LoadIcon( NULL, IDI_APPLICATION );
|
||||
|
||||
m_hInstance = hInstance;
|
||||
RegisterClassEx( &wndClass );
|
||||
|
||||
if (parent && windowed)
|
||||
{
|
||||
m_hWnd = CreateWindow(m_szClassName, title,
|
||||
WS_CHILD,
|
||||
CW_USEDEFAULT, CW_USEDEFAULT,CW_USEDEFAULT, CW_USEDEFAULT,
|
||||
parent, NULL, hInstance, NULL );
|
||||
|
||||
m_hParent = parent;
|
||||
|
||||
ShowWindow(m_hWnd, SW_SHOWMAXIMIZED);
|
||||
}
|
||||
else
|
||||
{
|
||||
DWORD style = windowed ? WS_OVERLAPPEDWINDOW : WS_POPUP;
|
||||
|
||||
RECT rc = {0, 0, width, height};
|
||||
AdjustWindowRect(&rc, style, false);
|
||||
|
||||
int w = rc.right - rc.left;
|
||||
int h = rc.bottom - rc.top;
|
||||
|
||||
rc.left = (1280 - w)/2;
|
||||
rc.right = rc.left + w;
|
||||
rc.top = (1024 - h)/2;
|
||||
rc.bottom = rc.top + h;
|
||||
|
||||
|
||||
m_hWnd = CreateWindow(m_szClassName, title,
|
||||
style,
|
||||
rc.left, rc.top, rc.right-rc.left, rc.bottom-rc.top,
|
||||
parent, NULL, hInstance, NULL );
|
||||
|
||||
g_winstyle = GetWindowLong( m_hWnd, GWL_STYLE );
|
||||
g_winstyle &= ~WS_MAXIMIZE & ~WS_MINIMIZE; // remove minimize/maximize style
|
||||
|
||||
}
|
||||
|
||||
return m_hWnd;
|
||||
}
|
||||
|
||||
void Show()
|
||||
{
|
||||
ShowWindow(m_hWnd, SW_SHOW);
|
||||
BringWindowToTop(m_hWnd);
|
||||
UpdateWindow(m_hWnd);
|
||||
}
|
||||
|
||||
HWND Create(HWND hParent, HINSTANCE hInstance, const TCHAR *title)
|
||||
{
|
||||
return OpenWindow(hParent, hInstance, true, 640, 480, title);
|
||||
}
|
||||
|
||||
void Close()
|
||||
{
|
||||
DestroyWindow(m_hWnd);
|
||||
UnregisterClass(m_szClassName, m_hInstance);
|
||||
}
|
||||
|
||||
|
||||
void SetSize(int width, int height)
|
||||
{
|
||||
RECT rc = {0, 0, width, height};
|
||||
AdjustWindowRect(&rc, WS_OVERLAPPEDWINDOW, false);
|
||||
|
||||
int w = rc.right - rc.left;
|
||||
int h = rc.bottom - rc.top;
|
||||
|
||||
rc.left = (1280 - w)/2;
|
||||
rc.right = rc.left + w;
|
||||
rc.top = (1024 - h)/2;
|
||||
rc.bottom = rc.top + h;
|
||||
::MoveWindow(m_hWnd, rc.left,rc.top,rc.right-rc.left,rc.bottom-rc.top, TRUE);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
namespace EmuWindow
|
||||
{
|
||||
extern int g_winstyle;
|
||||
|
||||
HWND GetWnd();
|
||||
HWND GetParentWnd();
|
||||
HWND Create(HWND hParent, HINSTANCE hInstance, const TCHAR *title);
|
||||
void Show();
|
||||
void Close();
|
||||
void SetSize(int displayWidth, int displayHeight);
|
||||
}
|
||||
@@ -0,0 +1,165 @@
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "File.h"
|
||||
|
||||
|
||||
namespace W32Util
|
||||
{
|
||||
|
||||
File::File()
|
||||
{
|
||||
fileHandle = INVALID_HANDLE_VALUE;
|
||||
isOpen=false;
|
||||
}
|
||||
|
||||
File::~File()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
bool File::Open(const TCHAR *filename, eFileMode _mode)
|
||||
{
|
||||
mode = _mode;
|
||||
//it's time to open the file
|
||||
fileHandle = CreateFile(filename,
|
||||
mode==FILE_READ ? GENERIC_READ : GENERIC_WRITE, //open mode
|
||||
mode == FILE_READ ? FILE_SHARE_READ : NULL, //sharemode
|
||||
NULL, //security
|
||||
mode==FILE_READ ? OPEN_EXISTING : CREATE_ALWAYS, //create mode
|
||||
FILE_ATTRIBUTE_NORMAL, //atrributes
|
||||
NULL); //template
|
||||
|
||||
if (fileHandle == INVALID_HANDLE_VALUE)
|
||||
isOpen=false;
|
||||
else
|
||||
isOpen=true;
|
||||
|
||||
return isOpen;
|
||||
}
|
||||
|
||||
|
||||
void File::Close()
|
||||
{
|
||||
if (isOpen)
|
||||
{
|
||||
//close the file and reset variables
|
||||
CloseHandle(fileHandle);
|
||||
fileHandle=INVALID_HANDLE_VALUE;
|
||||
isOpen=false;
|
||||
}
|
||||
}
|
||||
|
||||
int File::GetSize()
|
||||
{
|
||||
if (!isOpen) //of course
|
||||
return 0;
|
||||
else
|
||||
return GetFileSize(fileHandle,0);
|
||||
}
|
||||
|
||||
int File::Write(void *data, int size) //let's do some writing
|
||||
{
|
||||
if (isOpen)
|
||||
{
|
||||
DWORD written;
|
||||
WriteFile(fileHandle, data, size, &written,0);
|
||||
return written; //we return the number of bytes that actually got written
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
int File::Read(void *data, int size)
|
||||
{
|
||||
if (isOpen)
|
||||
{
|
||||
DWORD wasRead;
|
||||
ReadFile(fileHandle, data, size, &wasRead,0);
|
||||
return wasRead; //we return the number of bytes that actually was read
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
int File::WR(void *data, int size)
|
||||
{
|
||||
if (mode==FILE_READ)
|
||||
return Read(data,size);
|
||||
else
|
||||
return Write(data,size);
|
||||
}
|
||||
bool File::MagicCookie(int cookie)
|
||||
{
|
||||
if (mode==FILE_READ)
|
||||
{
|
||||
if (ReadInt()!=cookie)
|
||||
{
|
||||
char mojs[5],temp[256];
|
||||
mojs[4]=0;
|
||||
*(int*)mojs=cookie;
|
||||
sprintf(temp,"W32Util::File: Magic Cookie %s is bad!",mojs);
|
||||
MessageBox(0,temp,"Error reading file",MB_ICONERROR);
|
||||
return false;
|
||||
}
|
||||
else
|
||||
return true;
|
||||
}
|
||||
else if (mode==FILE_WRITE)
|
||||
{
|
||||
WriteInt(cookie);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
int File::ReadInt()
|
||||
{
|
||||
int temp;
|
||||
if (Read(&temp, sizeof(int)))
|
||||
return temp;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
void File::WriteInt(int i)
|
||||
{
|
||||
Write(&i,sizeof(int));
|
||||
}
|
||||
|
||||
char File::ReadChar()
|
||||
{
|
||||
char temp;
|
||||
if (Read(&temp, sizeof(char)))
|
||||
return temp;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
void File::WriteChar(char i)
|
||||
{
|
||||
Write(&i,sizeof(char));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#ifndef __LAMEFILE_H__
|
||||
#define __LAMEFILE_H__
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
namespace W32Util
|
||||
{
|
||||
|
||||
enum eFileMode
|
||||
{
|
||||
FILE_READ=5,
|
||||
FILE_WRITE=6,
|
||||
FILE_ERROR=0xff
|
||||
};
|
||||
|
||||
class File
|
||||
{
|
||||
HANDLE fileHandle;
|
||||
eFileMode mode;
|
||||
bool isOpen;
|
||||
public:
|
||||
File();
|
||||
virtual ~File();
|
||||
|
||||
bool Open(const TCHAR *filename, eFileMode mode);
|
||||
void Adopt(HANDLE h) { fileHandle = h;}
|
||||
void Close();
|
||||
|
||||
void WriteInt(int i);
|
||||
void WriteChar(char i);
|
||||
int Write(void *data, int size);
|
||||
|
||||
|
||||
int ReadInt();
|
||||
char ReadChar();
|
||||
int Read(void *data, int size);
|
||||
|
||||
int WR(void *data, int size); //write or read depending on open mode
|
||||
bool MagicCookie(int cookie);
|
||||
|
||||
int GetSize();
|
||||
eFileMode GetMode() {return mode;}
|
||||
void SeekBeg(int pos)
|
||||
{
|
||||
if (isOpen) SetFilePointer(fileHandle,pos,0,FILE_BEGIN);
|
||||
}
|
||||
void SeekEnd(int pos)
|
||||
{
|
||||
if (isOpen) SetFilePointer(fileHandle,pos,0,FILE_END);
|
||||
}
|
||||
void SeekCurrent(int pos)
|
||||
{
|
||||
if (isOpen) SetFilePointer(fileHandle,pos,0,FILE_CURRENT);
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif //__LAMEFILE_H__
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,210 @@
|
||||
|
||||
C GLUT version of "GL/fgl.h"
|
||||
|
||||
C Modifications from SGI IRIX 5.3 version:
|
||||
C 1) F prefix removed from GLU constants.
|
||||
C 2) Fix GLU_TRUE and GLU_FALSE.
|
||||
|
||||
C *** Generic constants ***
|
||||
|
||||
C Errors: (return value 0 = no error)
|
||||
integer*4 GLU_INVALID_ENUM
|
||||
parameter ( GLU_INVALID_ENUM = 100900 )
|
||||
integer*4 GLU_INVALID_VALUE
|
||||
parameter ( GLU_INVALID_VALUE = 100901 )
|
||||
integer*4 GLU_OUT_OF_MEMORY
|
||||
parameter ( GLU_OUT_OF_MEMORY = 100902 )
|
||||
|
||||
C For laughs:
|
||||
integer*4 GLU_TRUE
|
||||
parameter ( GLU_TRUE = 1 )
|
||||
integer*4 GLU_FALSE
|
||||
parameter ( GLU_FALSE = 0 )
|
||||
|
||||
|
||||
C *** Quadric constants ***
|
||||
|
||||
C Types of normals:
|
||||
integer*4 GLU_SMOOTH
|
||||
parameter ( GLU_SMOOTH = 100000 )
|
||||
integer*4 GLU_FLAT
|
||||
parameter ( GLU_FLAT = 100001 )
|
||||
integer*4 GLU_NONE
|
||||
parameter ( GLU_NONE = 100002 )
|
||||
|
||||
C DrawStyle types:
|
||||
integer*4 GLU_POINT
|
||||
parameter ( GLU_POINT = 100010 )
|
||||
integer*4 GLU_LINE
|
||||
parameter ( GLU_LINE = 100011 )
|
||||
integer*4 GLU_FILL
|
||||
parameter ( GLU_FILL = 100012 )
|
||||
integer*4 GLU_SILHOUETTE
|
||||
parameter ( GLU_SILHOUETTE = 100013 )
|
||||
|
||||
C Orientation types:
|
||||
integer*4 GLU_OUTSIDE
|
||||
parameter ( GLU_OUTSIDE = 100020 )
|
||||
integer*4 GLU_INSIDE
|
||||
parameter ( GLU_INSIDE = 100021 )
|
||||
|
||||
C Callback types:
|
||||
C GLU_ERROR 100103
|
||||
|
||||
|
||||
C *** Tesselation constants ***
|
||||
|
||||
C Callback types:
|
||||
integer*4 GLU_BEGIN
|
||||
parameter ( GLU_BEGIN = 100100 )
|
||||
integer*4 GLU_VERTEX
|
||||
parameter ( GLU_VERTEX = 100101 )
|
||||
integer*4 GLU_END
|
||||
parameter ( GLU_END = 100102 )
|
||||
integer*4 GLU_ERROR
|
||||
parameter ( GLU_ERROR = 100103 )
|
||||
integer*4 GLU_EDGE_FLAG
|
||||
parameter ( GLU_EDGE_FLAG = 100104 )
|
||||
|
||||
C Contours types:
|
||||
integer*4 GLU_CW
|
||||
parameter ( GLU_CW = 100120 )
|
||||
integer*4 GLU_CCW
|
||||
parameter ( GLU_CCW = 100121 )
|
||||
integer*4 GLU_INTERIOR
|
||||
parameter ( GLU_INTERIOR = 100122 )
|
||||
integer*4 GLU_EXTERIOR
|
||||
parameter ( GLU_EXTERIOR = 100123 )
|
||||
integer*4 GLU_UNKNOWN
|
||||
parameter ( GLU_UNKNOWN = 100124 )
|
||||
|
||||
integer*4 GLU_TESS_ERROR1
|
||||
parameter ( GLU_TESS_ERROR1 = 100151 )
|
||||
integer*4 GLU_TESS_ERROR2
|
||||
parameter ( GLU_TESS_ERROR2 = 100152 )
|
||||
integer*4 GLU_TESS_ERROR3
|
||||
parameter ( GLU_TESS_ERROR3 = 100153 )
|
||||
integer*4 GLU_TESS_ERROR4
|
||||
parameter ( GLU_TESS_ERROR4 = 100154 )
|
||||
integer*4 GLU_TESS_ERROR5
|
||||
parameter ( GLU_TESS_ERROR5 = 100155 )
|
||||
integer*4 GLU_TESS_ERROR6
|
||||
parameter ( GLU_TESS_ERROR6 = 100156 )
|
||||
integer*4 GLU_TESS_ERROR7
|
||||
parameter ( GLU_TESS_ERROR7 = 100157 )
|
||||
integer*4 GLU_TESS_ERROR8
|
||||
parameter ( GLU_TESS_ERROR8 = 100158 )
|
||||
|
||||
|
||||
C *** NURBS constants ***
|
||||
|
||||
C Properties:
|
||||
integer*4 GLU_AUTO_LOAD_MATRIX
|
||||
parameter ( GLU_AUTO_LOAD_MATRIX = 100200 )
|
||||
integer*4 GLU_CULLING
|
||||
parameter ( GLU_CULLING = 100201 )
|
||||
integer*4 GLU_SAMPLING_TOLERANCE
|
||||
parameter ( GLU_SAMPLING_TOLERANCE = 100203 )
|
||||
integer*4 GLU_DISPLAY_MODE
|
||||
parameter ( GLU_DISPLAY_MODE = 100204 )
|
||||
|
||||
C Trimming curve types
|
||||
integer*4 GLU_MAP1_TRIM_2
|
||||
parameter ( GLU_MAP1_TRIM_2 = 100210 )
|
||||
integer*4 GLU_MAP1_TRIM_3
|
||||
parameter ( GLU_MAP1_TRIM_3 = 100211 )
|
||||
|
||||
C Display modes:
|
||||
C GLU_FILL 100012
|
||||
integer*4 GLU_OUTLINE_POLYGON
|
||||
parameter ( GLU_OUTLINE_POLYGON = 100240 )
|
||||
integer*4 GLU_OUTLINE_PATCH
|
||||
parameter ( GLU_OUTLINE_PATCH = 100241 )
|
||||
|
||||
C Callbacks:
|
||||
C GLU_ERROR 100103
|
||||
|
||||
C Errors:
|
||||
integer*4 GLU_NURBS_ERROR1
|
||||
parameter ( GLU_NURBS_ERROR1 = 100251 )
|
||||
integer*4 GLU_NURBS_ERROR2
|
||||
parameter ( GLU_NURBS_ERROR2 = 100252 )
|
||||
integer*4 GLU_NURBS_ERROR3
|
||||
parameter ( GLU_NURBS_ERROR3 = 100253 )
|
||||
integer*4 GLU_NURBS_ERROR4
|
||||
parameter ( GLU_NURBS_ERROR4 = 100254 )
|
||||
integer*4 GLU_NURBS_ERROR5
|
||||
parameter ( GLU_NURBS_ERROR5 = 100255 )
|
||||
integer*4 GLU_NURBS_ERROR6
|
||||
parameter ( GLU_NURBS_ERROR6 = 100256 )
|
||||
integer*4 GLU_NURBS_ERROR7
|
||||
parameter ( GLU_NURBS_ERROR7 = 100257 )
|
||||
integer*4 GLU_NURBS_ERROR8
|
||||
parameter ( GLU_NURBS_ERROR8 = 100258 )
|
||||
integer*4 GLU_NURBS_ERROR9
|
||||
parameter ( GLU_NURBS_ERROR9 = 100259 )
|
||||
integer*4 GLU_NURBS_ERROR10
|
||||
parameter ( GLU_NURBS_ERROR10 = 100260 )
|
||||
integer*4 GLU_NURBS_ERROR11
|
||||
parameter ( GLU_NURBS_ERROR11 = 100261 )
|
||||
integer*4 GLU_NURBS_ERROR12
|
||||
parameter ( GLU_NURBS_ERROR12 = 100262 )
|
||||
integer*4 GLU_NURBS_ERROR13
|
||||
parameter ( GLU_NURBS_ERROR13 = 100263 )
|
||||
integer*4 GLU_NURBS_ERROR14
|
||||
parameter ( GLU_NURBS_ERROR14 = 100264 )
|
||||
integer*4 GLU_NURBS_ERROR15
|
||||
parameter ( GLU_NURBS_ERROR15 = 100265 )
|
||||
integer*4 GLU_NURBS_ERROR16
|
||||
parameter ( GLU_NURBS_ERROR16 = 100266 )
|
||||
integer*4 GLU_NURBS_ERROR17
|
||||
parameter ( GLU_NURBS_ERROR17 = 100267 )
|
||||
integer*4 GLU_NURBS_ERROR18
|
||||
parameter ( GLU_NURBS_ERROR18 = 100268 )
|
||||
integer*4 GLU_NURBS_ERROR19
|
||||
parameter ( GLU_NURBS_ERROR19 = 100269 )
|
||||
integer*4 GLU_NURBS_ERROR20
|
||||
parameter ( GLU_NURBS_ERROR20 = 100270 )
|
||||
integer*4 GLU_NURBS_ERROR21
|
||||
parameter ( GLU_NURBS_ERROR21 = 100271 )
|
||||
integer*4 GLU_NURBS_ERROR22
|
||||
parameter ( GLU_NURBS_ERROR22 = 100272 )
|
||||
integer*4 GLU_NURBS_ERROR23
|
||||
parameter ( GLU_NURBS_ERROR23 = 100273 )
|
||||
integer*4 GLU_NURBS_ERROR24
|
||||
parameter ( GLU_NURBS_ERROR24 = 100274 )
|
||||
integer*4 GLU_NURBS_ERROR25
|
||||
parameter ( GLU_NURBS_ERROR25 = 100275 )
|
||||
integer*4 GLU_NURBS_ERROR26
|
||||
parameter ( GLU_NURBS_ERROR26 = 100276 )
|
||||
integer*4 GLU_NURBS_ERROR27
|
||||
parameter ( GLU_NURBS_ERROR27 = 100277 )
|
||||
integer*4 GLU_NURBS_ERROR28
|
||||
parameter ( GLU_NURBS_ERROR28 = 100278 )
|
||||
integer*4 GLU_NURBS_ERROR29
|
||||
parameter ( GLU_NURBS_ERROR29 = 100279 )
|
||||
integer*4 GLU_NURBS_ERROR30
|
||||
parameter ( GLU_NURBS_ERROR30 = 100280 )
|
||||
integer*4 GLU_NURBS_ERROR31
|
||||
parameter ( GLU_NURBS_ERROR31 = 100281 )
|
||||
integer*4 GLU_NURBS_ERROR32
|
||||
parameter ( GLU_NURBS_ERROR32 = 100282 )
|
||||
integer*4 GLU_NURBS_ERROR33
|
||||
parameter ( GLU_NURBS_ERROR33 = 100283 )
|
||||
integer*4 GLU_NURBS_ERROR34
|
||||
parameter ( GLU_NURBS_ERROR34 = 100284 )
|
||||
integer*4 GLU_NURBS_ERROR35
|
||||
parameter ( GLU_NURBS_ERROR35 = 100285 )
|
||||
integer*4 GLU_NURBS_ERROR36
|
||||
parameter ( GLU_NURBS_ERROR36 = 100286 )
|
||||
integer*4 GLU_NURBS_ERROR37
|
||||
parameter ( GLU_NURBS_ERROR37 = 100287 )
|
||||
|
||||
|
||||
character*128 fgluErrorString
|
||||
character*128 fgluGetString
|
||||
integer*4 fgluBuild1DMipmaps
|
||||
integer*4 fgluBuild2DMipmaps
|
||||
integer*4 fgluProject
|
||||
integer*4 fgluScaleImage
|
||||
integer*4 fgluUnProject
|
||||
@@ -0,0 +1,321 @@
|
||||
|
||||
C Copyright (c) Mark J. Kilgard, 1994.
|
||||
|
||||
C This program is freely distributable without licensing fees
|
||||
C and is provided without guarantee or warrantee expressed or
|
||||
C implied. This program is -not- in the public domain.
|
||||
|
||||
C GLUT Fortran header file
|
||||
|
||||
C display mode bit masks
|
||||
integer*4 GLUT_RGB
|
||||
parameter ( GLUT_RGB = 0 )
|
||||
integer*4 GLUT_RGBA
|
||||
parameter ( GLUT_RGBA = 0 )
|
||||
integer*4 GLUT_INDEX
|
||||
parameter ( GLUT_INDEX = 1 )
|
||||
integer*4 GLUT_SINGLE
|
||||
parameter ( GLUT_SINGLE = 0 )
|
||||
integer*4 GLUT_DOUBLE
|
||||
parameter ( GLUT_DOUBLE = 2 )
|
||||
integer*4 GLUT_ACCUM
|
||||
parameter ( GLUT_ACCUM = 4 )
|
||||
integer*4 GLUT_ALPHA
|
||||
parameter ( GLUT_ALPHA = 8 )
|
||||
integer*4 GLUT_DEPTH
|
||||
parameter ( GLUT_DEPTH = 16 )
|
||||
integer*4 GLUT_STENCIL
|
||||
parameter ( GLUT_STENCIL = 32 )
|
||||
integer*4 GLUT_MULTISAMPLE
|
||||
parameter ( GLUT_MULTISAMPLE = 128 )
|
||||
integer*4 GLUT_STEREO
|
||||
parameter ( GLUT_STEREO = 256 )
|
||||
|
||||
C mouse buttons
|
||||
integer*4 GLUT_LEFT_BUTTON
|
||||
parameter ( GLUT_LEFT_BUTTON = 0 )
|
||||
integer*4 GLUT_MIDDLE_BUTTON
|
||||
parameter ( GLUT_MIDDLE_BUTTON = 1 )
|
||||
integer*4 GLUT_RIGHT_BUTTON
|
||||
parameter ( GLUT_RIGHT_BUTTON = 2 )
|
||||
|
||||
C mouse button callback state
|
||||
integer*4 GLUT_DOWN
|
||||
parameter ( GLUT_DOWN = 0 )
|
||||
integer*4 GLUT_UP
|
||||
parameter ( GLUT_UP = 1 )
|
||||
|
||||
C special key callback values
|
||||
integer*4 GLUT_KEY_F1
|
||||
parameter ( GLUT_KEY_F1 = 1 )
|
||||
integer*4 GLUT_KEY_F2
|
||||
parameter ( GLUT_KEY_F2 = 2 )
|
||||
integer*4 GLUT_KEY_F3
|
||||
parameter ( GLUT_KEY_F3 = 3 )
|
||||
integer*4 GLUT_KEY_F4
|
||||
parameter ( GLUT_KEY_F4 = 4 )
|
||||
integer*4 GLUT_KEY_F5
|
||||
parameter ( GLUT_KEY_F5 = 5 )
|
||||
integer*4 GLUT_KEY_F6
|
||||
parameter ( GLUT_KEY_F6 = 6 )
|
||||
integer*4 GLUT_KEY_F7
|
||||
parameter ( GLUT_KEY_F7 = 7 )
|
||||
integer*4 GLUT_KEY_F8
|
||||
parameter ( GLUT_KEY_F8 = 8 )
|
||||
integer*4 GLUT_KEY_F9
|
||||
parameter ( GLUT_KEY_F9 = 9 )
|
||||
integer*4 GLUT_KEY_F10
|
||||
parameter ( GLUT_KEY_F10 = 10 )
|
||||
integer*4 GLUT_KEY_F11
|
||||
parameter ( GLUT_KEY_F11 = 11 )
|
||||
integer*4 GLUT_KEY_F12
|
||||
parameter ( GLUT_KEY_F12 = 12 )
|
||||
integer*4 GLUT_KEY_LEFT
|
||||
parameter ( GLUT_KEY_LEFT = 100 )
|
||||
integer*4 GLUT_KEY_UP
|
||||
parameter ( GLUT_KEY_UP = 101 )
|
||||
integer*4 GLUT_KEY_RIGHT
|
||||
parameter ( GLUT_KEY_RIGHT = 102 )
|
||||
integer*4 GLUT_KEY_DOWN
|
||||
parameter ( GLUT_KEY_DOWN = 103 )
|
||||
integer*4 GLUT_KEY_PAGE_UP
|
||||
parameter ( GLUT_KEY_PAGE_UP = 104 )
|
||||
integer*4 GLUT_KEY_PAGE_DOWN
|
||||
parameter ( GLUT_KEY_PAGE_DOWN = 105 )
|
||||
integer*4 GLUT_KEY_HOME
|
||||
parameter ( GLUT_KEY_HOME = 106 )
|
||||
integer*4 GLUT_KEY_END
|
||||
parameter ( GLUT_KEY_END = 107 )
|
||||
integer*4 GLUT_KEY_INSERT
|
||||
parameter ( GLUT_KEY_INSERT = 108 )
|
||||
|
||||
C entry/exit callback state
|
||||
integer*4 GLUT_LEFT
|
||||
parameter ( GLUT_LEFT = 0 )
|
||||
integer*4 GLUT_ENTERED
|
||||
parameter ( GLUT_ENTERED = 1 )
|
||||
|
||||
C menu usage callback state
|
||||
integer*4 GLUT_MENU_NOT_IN_USE
|
||||
parameter ( GLUT_MENU_NOT_IN_USE = 0 )
|
||||
integer*4 GLUT_MENU_IN_USE
|
||||
parameter ( GLUT_MENU_IN_USE = 1 )
|
||||
|
||||
C visibility callback state
|
||||
integer*4 GLUT_NOT_VISIBLE
|
||||
parameter ( GLUT_NOT_VISIBLE = 0 )
|
||||
integer*4 GLUT_VISIBLE
|
||||
parameter ( GLUT_VISIBLE = 1 )
|
||||
|
||||
C color index component selection values
|
||||
integer*4 GLUT_RED
|
||||
parameter ( GLUT_RED = 0 )
|
||||
integer*4 GLUT_GREEN
|
||||
parameter ( GLUT_GREEN = 1 )
|
||||
integer*4 GLUT_BLUE
|
||||
parameter ( GLUT_BLUE = 2 )
|
||||
|
||||
C XXX Unfortunately, SGI's Fortran compiler links with
|
||||
C EXTERNAL data even if it is not used. This defeats
|
||||
C the purpose of GLUT naming fonts via opaque symbols.
|
||||
C This means GLUT Fortran programmers should explicitly
|
||||
C declared EXTERNAL GLUT fonts in subroutines where
|
||||
C the fonts are used.
|
||||
|
||||
C stroke font opaque names
|
||||
C external GLUT_STROKE_ROMAN
|
||||
C external GLUT_STROKE_MONO_ROMAN
|
||||
|
||||
C bitmap font opaque names
|
||||
C external GLUT_BITMAP_9_BY_15
|
||||
C external GLUT_BITMAP_8_BY_13
|
||||
C external GLUT_BITMAP_TIMES_ROMAN_10
|
||||
C external GLUT_BITMAP_TIMES_ROMAN_24
|
||||
C external GLUT_BITMAP_HELVETICA_10
|
||||
C external GLUT_BITMAP_HELVETICA_12
|
||||
C external GLUT_BITMAP_HELVETICA_18
|
||||
|
||||
C glutGet parameters
|
||||
integer*4 GLUT_WINDOW_X
|
||||
parameter ( GLUT_WINDOW_X = 100 )
|
||||
integer*4 GLUT_WINDOW_Y
|
||||
parameter ( GLUT_WINDOW_Y = 101 )
|
||||
integer*4 GLUT_WINDOW_WIDTH
|
||||
parameter ( GLUT_WINDOW_WIDTH = 102 )
|
||||
integer*4 GLUT_WINDOW_HEIGHT
|
||||
parameter ( GLUT_WINDOW_HEIGHT = 103 )
|
||||
integer*4 GLUT_WINDOW_BUFFER_SIZE
|
||||
parameter ( GLUT_WINDOW_BUFFER_SIZE = 104 )
|
||||
integer*4 GLUT_WINDOW_STENCIL_SIZE
|
||||
parameter ( GLUT_WINDOW_STENCIL_SIZE = 105 )
|
||||
integer*4 GLUT_WINDOW_DEPTH_SIZE
|
||||
parameter ( GLUT_WINDOW_DEPTH_SIZE = 106 )
|
||||
integer*4 GLUT_WINDOW_RED_SIZE
|
||||
parameter ( GLUT_WINDOW_RED_SIZE = 107 )
|
||||
integer*4 GLUT_WINDOW_GREEN_SIZE
|
||||
parameter ( GLUT_WINDOW_GREEN_SIZE = 108 )
|
||||
integer*4 GLUT_WINDOW_BLUE_SIZE
|
||||
parameter ( GLUT_WINDOW_BLUE_SIZE = 109 )
|
||||
integer*4 GLUT_WINDOW_ALPHA_SIZE
|
||||
parameter ( GLUT_WINDOW_ALPHA_SIZE = 110 )
|
||||
integer*4 GLUT_WINDOW_ACCUM_RED_SIZE
|
||||
parameter ( GLUT_WINDOW_ACCUM_RED_SIZE = 111 )
|
||||
integer*4 GLUT_WINDOW_ACCUM_GREEN_SIZE
|
||||
parameter ( GLUT_WINDOW_ACCUM_GREEN_SIZE = 112 )
|
||||
integer*4 GLUT_WINDOW_ACCUM_BLUE_SIZE
|
||||
parameter ( GLUT_WINDOW_ACCUM_BLUE_SIZE = 113 )
|
||||
integer*4 GLUT_WINDOW_ACCUM_ALPHA_SIZE
|
||||
parameter ( GLUT_WINDOW_ACCUM_ALPHA_SIZE = 114 )
|
||||
integer*4 GLUT_WINDOW_DOUBLEBUFFER
|
||||
parameter ( GLUT_WINDOW_DOUBLEBUFFER = 115 )
|
||||
integer*4 GLUT_WINDOW_RGBA
|
||||
parameter ( GLUT_WINDOW_RGBA = 116 )
|
||||
integer*4 GLUT_WINDOW_PARENT
|
||||
parameter ( GLUT_WINDOW_PARENT = 117 )
|
||||
integer*4 GLUT_WINDOW_NUM_CHILDREN
|
||||
parameter ( GLUT_WINDOW_NUM_CHILDREN = 118 )
|
||||
integer*4 GLUT_WINDOW_COLORMAP_SIZE
|
||||
parameter ( GLUT_WINDOW_COLORMAP_SIZE = 119 )
|
||||
integer*4 GLUT_WINDOW_NUM_SAMPLES
|
||||
parameter ( GLUT_WINDOW_NUM_SAMPLES = 120 )
|
||||
integer*4 GLUT_WINDOW_STEREO
|
||||
parameter ( GLUT_WINDOW_STEREO = 121 )
|
||||
integer*4 GLUT_WINDOW_CURSOR
|
||||
parameter ( GLUT_WINDOW_CURSOR = 122 )
|
||||
integer*4 GLUT_SCREEN_WIDTH
|
||||
parameter ( GLUT_SCREEN_WIDTH = 200 )
|
||||
integer*4 GLUT_SCREEN_HEIGHT
|
||||
parameter ( GLUT_SCREEN_HEIGHT = 201 )
|
||||
integer*4 GLUT_SCREEN_WIDTH_MM
|
||||
parameter ( GLUT_SCREEN_WIDTH_MM = 202 )
|
||||
integer*4 GLUT_SCREEN_HEIGHT_MM
|
||||
parameter ( GLUT_SCREEN_HEIGHT_MM = 203 )
|
||||
integer*4 GLUT_MENU_NUM_ITEMS
|
||||
parameter ( GLUT_MENU_NUM_ITEMS = 300 )
|
||||
integer*4 GLUT_DISPLAY_MODE_POSSIBLE
|
||||
parameter ( GLUT_DISPLAY_MODE_POSSIBLE = 400 )
|
||||
integer*4 GLUT_INIT_WINDOW_X
|
||||
parameter ( GLUT_INIT_WINDOW_X = 500 )
|
||||
integer*4 GLUT_INIT_WINDOW_Y
|
||||
parameter ( GLUT_INIT_WINDOW_Y = 501 )
|
||||
integer*4 GLUT_INIT_WINDOW_WIDTH
|
||||
parameter ( GLUT_INIT_WINDOW_WIDTH = 502 )
|
||||
integer*4 GLUT_INIT_WINDOW_HEIGHT
|
||||
parameter ( GLUT_INIT_WINDOW_HEIGHT = 503 )
|
||||
integer*4 GLUT_INIT_DISPLAY_MODE
|
||||
parameter ( GLUT_INIT_DISPLAY_MODE = 504 )
|
||||
integer*4 GLUT_ELAPSED_TIME
|
||||
parameter ( GLUT_ELAPSED_TIME = 700 )
|
||||
|
||||
C glutDeviceGet parameters
|
||||
integer*4 GLUT_HAS_KEYBOARD
|
||||
parameter ( GLUT_HAS_KEYBOARD = 600 )
|
||||
integer*4 GLUT_HAS_MOUSE
|
||||
parameter ( GLUT_HAS_MOUSE = 601 )
|
||||
integer*4 GLUT_HAS_SPACEBALL
|
||||
parameter ( GLUT_HAS_SPACEBALL = 602 )
|
||||
integer*4 GLUT_HAS_DIAL_AND_BUTTON_BOX
|
||||
parameter ( GLUT_HAS_DIAL_AND_BUTTON_BOX = 603 )
|
||||
integer*4 GLUT_HAS_TABLET
|
||||
parameter ( GLUT_HAS_TABLET = 604 )
|
||||
integer*4 GLUT_NUM_MOUSE_BUTTONS
|
||||
parameter ( GLUT_NUM_MOUSE_BUTTONS = 605 )
|
||||
integer*4 GLUT_NUM_SPACEBALL_BUTTONS
|
||||
parameter ( GLUT_NUM_SPACEBALL_BUTTONS = 606 )
|
||||
integer*4 GLUT_NUM_BUTTON_BOX_BUTTONS
|
||||
parameter ( GLUT_NUM_BUTTON_BOX_BUTTONS = 607 )
|
||||
integer*4 GLUT_NUM_DIALS
|
||||
parameter ( GLUT_NUM_DIALS = 608 )
|
||||
integer*4 GLUT_NUM_TABLET_BUTTONS
|
||||
parameter ( GLUT_NUM_TABLET_BUTTONS = 609 )
|
||||
|
||||
C glutLayerGet parameters
|
||||
integer*4 GLUT_OVERLAY_POSSIBLE
|
||||
parameter ( GLUT_OVERLAY_POSSIBLE = 800 )
|
||||
integer*4 GLUT_LAYER_IN_USE
|
||||
parameter ( GLUT_LAYER_IN_USE = 801 )
|
||||
integer*4 GLUT_HAS_OVERLAY
|
||||
parameter ( GLUT_HAS_OVERLAY = 802 )
|
||||
integer*4 GLUT_TRANSPARENT_INDEX
|
||||
parameter ( GLUT_TRANSPARENT_INDEX = 803 )
|
||||
integer*4 GLUT_NORMAL_DAMAGED
|
||||
parameter ( GLUT_NORMAL_DAMAGED = 804 )
|
||||
integer*4 GLUT_OVERLAY_DAMAGED
|
||||
parameter ( GLUT_OVERLAY_DAMAGED = 805 )
|
||||
|
||||
C glutUseLayer parameters
|
||||
integer*4 GLUT_NORMAL
|
||||
parameter ( GLUT_NORMAL = 0 )
|
||||
integer*4 GLUT_OVERLAY
|
||||
parameter ( GLUT_OVERLAY = 1 )
|
||||
|
||||
C glutGetModifiers return mask
|
||||
integer*4 GLUT_ACTIVE_SHIFT
|
||||
parameter ( GLUT_ACTIVE_SHIFT = 1 )
|
||||
integer*4 GLUT_ACTIVE_CTRL
|
||||
parameter ( GLUT_ACTIVE_CTRL = 2 )
|
||||
integer*4 GLUT_ACTIVE_ALT
|
||||
parameter ( GLUT_ACTIVE_ALT = 4 )
|
||||
|
||||
C glutSetCursor parameters
|
||||
integer*4 GLUT_CURSOR_RIGHT_ARROW
|
||||
parameter ( GLUT_CURSOR_RIGHT_ARROW = 0 )
|
||||
integer*4 GLUT_CURSOR_LEFT_ARROW
|
||||
parameter ( GLUT_CURSOR_LEFT_ARROW = 1 )
|
||||
integer*4 GLUT_CURSOR_INFO
|
||||
parameter ( GLUT_CURSOR_INFO = 2 )
|
||||
integer*4 GLUT_CURSOR_DESTROY
|
||||
parameter ( GLUT_CURSOR_DESTROY = 3 )
|
||||
integer*4 GLUT_CURSOR_HELP
|
||||
parameter ( GLUT_CURSOR_HELP = 4 )
|
||||
integer*4 GLUT_CURSOR_CYCLE
|
||||
parameter ( GLUT_CURSOR_CYCLE = 5 )
|
||||
integer*4 GLUT_CURSOR_SPRAY
|
||||
parameter ( GLUT_CURSOR_SPRAY = 6 )
|
||||
integer*4 GLUT_CURSOR_WAIT
|
||||
parameter ( GLUT_CURSOR_WAIT = 7 )
|
||||
integer*4 GLUT_CURSOR_TEXT
|
||||
parameter ( GLUT_CURSOR_TEXT = 8 )
|
||||
integer*4 GLUT_CURSOR_CROSSHAIR
|
||||
parameter ( GLUT_CURSOR_CROSSHAIR = 9 )
|
||||
integer*4 GLUT_CURSOR_UP_DOWN
|
||||
parameter ( GLUT_CURSOR_UP_DOWN = 10 )
|
||||
integer*4 GLUT_CURSOR_LEFT_RIGHT
|
||||
parameter ( GLUT_CURSOR_LEFT_RIGHT = 11 )
|
||||
integer*4 GLUT_CURSOR_TOP_SIDE
|
||||
parameter ( GLUT_CURSOR_TOP_SIDE = 12 )
|
||||
integer*4 GLUT_CURSOR_BOTTOM_SIDE
|
||||
parameter ( GLUT_CURSOR_BOTTOM_SIDE = 13 )
|
||||
integer*4 GLUT_CURSOR_LEFT_SIDE
|
||||
parameter ( GLUT_CURSOR_LEFT_SIDE = 14 )
|
||||
integer*4 GLUT_CURSOR_RIGHT_SIDE
|
||||
parameter ( GLUT_CURSOR_RIGHT_SIDE = 15 )
|
||||
integer*4 GLUT_CURSOR_TOP_LEFT_CORNER
|
||||
parameter ( GLUT_CURSOR_TOP_LEFT_CORNER = 16 )
|
||||
integer*4 GLUT_CURSOR_TOP_RIGHT_CORNER
|
||||
parameter ( GLUT_CURSOR_TOP_RIGHT_CORNER = 17 )
|
||||
integer*4 GLUT_CURSOR_BOTTOM_RIGHT_CORNER
|
||||
parameter ( GLUT_CURSOR_BOTTOM_RIGHT_CORNER = 18 )
|
||||
integer*4 GLUT_CURSOR_BOTTOM_LEFT_CORNER
|
||||
parameter ( GLUT_CURSOR_BOTTOM_LEFT_CORNER = 19 )
|
||||
integer*4 GLUT_CURSOR_INHERIT
|
||||
parameter ( GLUT_CURSOR_INHERIT = 100 )
|
||||
integer*4 GLUT_CURSOR_NONE
|
||||
parameter ( GLUT_CURSOR_NONE = 101 )
|
||||
integer*4 GLUT_CURSOR_FULL_CROSSHAIR
|
||||
parameter ( GLUT_CURSOR_FULL_CROSSHAIR = 102 )
|
||||
|
||||
C GLUT functions
|
||||
integer*4 glutcreatewindow
|
||||
integer*4 glutcreatesubwindow
|
||||
integer*4 glutgetwindow
|
||||
integer*4 glutcreatemenu
|
||||
integer*4 glutgetmenu
|
||||
real glutgetcolor
|
||||
integer*4 glutget
|
||||
integer*4 glutdeviceget
|
||||
integer*4 glutextensionsupported
|
||||
|
||||
C GLUT NULL name
|
||||
external glutnull
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,137 @@
|
||||
#ifndef __glsmap_h__
|
||||
#define __glsmap_h__
|
||||
|
||||
/* Copyright (c) Mark J. Kilgard, 1998. */
|
||||
|
||||
/* This program is freely distributable without licensing fees
|
||||
and is provided without guarantee or warrantee expressed or
|
||||
implied. This program is -not- in the public domain. */
|
||||
|
||||
#if defined(_WIN32)
|
||||
|
||||
/* Try hard to avoid including <windows.h> to avoid name space pollution,
|
||||
but Win32's <GL/gl.h> needs APIENTRY and WINGDIAPI defined properly. */
|
||||
# if 0
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
# include <windows.h>
|
||||
# else
|
||||
/* XXX This is from Win32's <windef.h> */
|
||||
# ifndef APIENTRY
|
||||
# if (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED)
|
||||
# define APIENTRY __stdcall
|
||||
# else
|
||||
# define APIENTRY
|
||||
# endif
|
||||
# endif
|
||||
# ifndef CALLBACK
|
||||
/* XXX This is from Win32's <winnt.h> */
|
||||
# if (defined(_M_MRX000) || defined(_M_IX86) || defined(_M_ALPHA) || defined(_M_PPC)) && !defined(MIDL_PASS)
|
||||
# define CALLBACK __stdcall
|
||||
# else
|
||||
# define CALLBACK
|
||||
# endif
|
||||
# endif
|
||||
/* XXX This is from Win32's <wingdi.h> and <winnt.h> */
|
||||
# ifndef WINGDIAPI
|
||||
# define WINGDIAPI __declspec(dllimport)
|
||||
# endif
|
||||
/* XXX This is from Win32's <ctype.h> */
|
||||
# ifndef _WCHAR_T_DEFINED
|
||||
typedef unsigned short wchar_t;
|
||||
# define _WCHAR_T_DEFINED
|
||||
# endif
|
||||
# endif
|
||||
|
||||
#pragma warning (disable:4244) /* Disable bogus conversion warnings. */
|
||||
#pragma warning (disable:4305) /* VC++ 5.0 version of above warning. */
|
||||
|
||||
#endif /* _WIN32 */
|
||||
|
||||
#include <GL/gl.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
SMAP_CLEAR_SMAP_TEXTURE = 0x1,
|
||||
SMAP_GENERATE_VIEW_MIPMAPS = 0x2,
|
||||
SMAP_GENERATE_SMAP_MIPMAPS = 0x4,
|
||||
SMAP_GENERATE_MIPMAPS = 0x6 /* both of above */
|
||||
} SphereMapFlags;
|
||||
|
||||
/* Cube view enumerants. */
|
||||
enum {
|
||||
SMAP_FRONT = 0,
|
||||
SMAP_TOP = 1,
|
||||
SMAP_BOTTOM = 2,
|
||||
SMAP_LEFT = 3,
|
||||
SMAP_RIGHT = 4,
|
||||
SMAP_BACK = 5
|
||||
};
|
||||
|
||||
typedef struct _SphereMap SphereMap;
|
||||
|
||||
extern SphereMap *smapCreateSphereMap(SphereMap *shareSmap);
|
||||
extern void smapDestroySphereMap(SphereMap *smap);
|
||||
|
||||
extern void smapConfigureSphereMapMesh(SphereMap *smap, int steps, int rings, int edgeExtend);
|
||||
|
||||
extern void smapSetSphereMapTexObj(SphereMap *smap, GLuint texobj);
|
||||
extern void smapSetViewTexObj(SphereMap *smap, GLuint texobj);
|
||||
extern void smapSetViewTexObjs(SphereMap *smap, GLuint texobjs[6]);
|
||||
extern void smapGetSphereMapTexObj(SphereMap *smap, GLuint *texobj);
|
||||
extern void smapGetViewTexObj(SphereMap *smap, GLuint *texobj);
|
||||
extern void smapGetViewTexObjs(SphereMap *smap, GLuint texobjs[6]);
|
||||
|
||||
extern void smapSetFlags(SphereMap *smap, SphereMapFlags flags);
|
||||
extern void smapGetFlags(SphereMap *smap, SphereMapFlags *flags);
|
||||
|
||||
extern void smapSetViewOrigin(SphereMap *smap, GLint x, GLint y);
|
||||
extern void smapSetSphereMapOrigin(SphereMap *smap, GLint x, GLint y);
|
||||
extern void smapGetViewOrigin(SphereMap *smap, GLint *x, GLint *y);
|
||||
extern void smapGetSphereMapOrigin(SphereMap *smap, GLint *x, GLint *y);
|
||||
|
||||
extern void smapSetEye(SphereMap *smap, GLfloat eyex, GLfloat eyey, GLfloat eyez);
|
||||
extern void smapSetEyeVector(SphereMap *smap, GLfloat *eye);
|
||||
extern void smapSetUp(SphereMap *smap, GLfloat upx, GLfloat upy, GLfloat upz);
|
||||
extern void smapSetUpVector(SphereMap *smap, GLfloat *up);
|
||||
extern void smapSetObject(SphereMap *smap, GLfloat objx, GLfloat objy, GLfloat objz);
|
||||
extern void smapSetObjectVector(SphereMap *smap, GLfloat *obj);
|
||||
extern void smapGetEye(SphereMap *smap, GLfloat *eyex, GLfloat *eyey, GLfloat *eyez);
|
||||
extern void smapGetEyeVector(SphereMap *smap, GLfloat *eye);
|
||||
extern void smapGetUp(SphereMap *smap, GLfloat *upx, GLfloat *upy, GLfloat *upz);
|
||||
extern void smapGetUpVector(SphereMap *smap, GLfloat *up);
|
||||
extern void smapGetObject(SphereMap *smap, GLfloat *objx, GLfloat *objy, GLfloat *objz);
|
||||
extern void smapGetObjectVector(SphereMap *smap, GLfloat *obj);
|
||||
|
||||
extern void smapSetNearFar(SphereMap *smap, GLfloat viewNear, GLfloat viewFar);
|
||||
extern void smapGetNearFar(SphereMap *smap, GLfloat *viewNear, GLfloat *viewFar);
|
||||
|
||||
extern void smapSetSphereMapTexDim(SphereMap *smap, GLsizei texdim);
|
||||
extern void smapSetViewTexDim(SphereMap *smap, GLsizei texdim);
|
||||
extern void smapGetSphereMapTexDim(SphereMap *smap, GLsizei *texdim);
|
||||
extern void smapGetViewTexDim(SphereMap *smap, GLsizei *texdim);
|
||||
|
||||
extern void smapSetContextData(SphereMap *smap, void *context);
|
||||
extern void smapGetContextData(SphereMap *smap, void **context);
|
||||
|
||||
extern void smapSetPositionLightsFunc(SphereMap *smap, void (*positionLights)(int view, void *context));
|
||||
extern void smapSetDrawViewFunc(SphereMap *smap, void (*drawView)(int view, void *context));
|
||||
extern void smapGetPositionLightsFunc(SphereMap *smap, void (**positionLights)(int view, void *context));
|
||||
extern void smapGetDrawViewFunc(SphereMap *smap, void (**drawView)(int view, void *context));
|
||||
|
||||
extern void smapGenViewTex(SphereMap *smap, int view);
|
||||
extern void smapGenViewTexs(SphereMap *smap);
|
||||
extern void smapGenSphereMapFromViewTexs(SphereMap *smap);
|
||||
extern void smapGenSphereMap(SphereMap *smap);
|
||||
extern void smapGenSphereMapWithOneViewTex(SphereMap *smap);
|
||||
|
||||
extern int smapRvecToSt(float rvec[3], float st[2]);
|
||||
extern void smapStToRvec(float *st, float *rvec);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif /* __glsmap_h__ */
|
||||
@@ -0,0 +1,243 @@
|
||||
#ifndef __glx_h__
|
||||
#define __glx_h__
|
||||
|
||||
/*
|
||||
** The contents of this file are subject to the GLX Public License Version 1.0
|
||||
** (the "License"). You may not use this file except in compliance with the
|
||||
** License. You may obtain a copy of the License at Silicon Graphics, Inc.,
|
||||
** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043
|
||||
** or at http://www.sgi.com/software/opensource/glx/license.html.
|
||||
**
|
||||
** Software distributed under the License is distributed on an "AS IS"
|
||||
** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY
|
||||
** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
|
||||
** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific
|
||||
** language governing rights and limitations under the License.
|
||||
**
|
||||
** The Original Software is GLX version 1.2 source code, released February,
|
||||
** 1999. The developer of the Original Software is Silicon Graphics, Inc.
|
||||
** Those portions of the Subject Software created by Silicon Graphics, Inc.
|
||||
** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved.
|
||||
**
|
||||
** $Header: /teleimm/telev/inc/GL/glx.h,v 1.1 2006/01/05 03:28:50 zerocool Exp $
|
||||
*/
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
#include <X11/Xmd.h>
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glxtokens.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* GLX resources.
|
||||
*/
|
||||
typedef XID GLXContextID;
|
||||
typedef XID GLXPixmap;
|
||||
typedef XID GLXDrawable;
|
||||
typedef XID GLXPbuffer;
|
||||
typedef XID GLXWindow;
|
||||
typedef XID GLXFBConfigID;
|
||||
|
||||
/*
|
||||
* GLXContext is a pointer to opaque data.
|
||||
*/
|
||||
typedef struct __GLXcontextRec *GLXContext;
|
||||
|
||||
/*
|
||||
* GLXFBConfig is a pointer to opaque data.
|
||||
*/
|
||||
typedef struct __GLXFBConfigRec *GLXFBConfig;
|
||||
typedef struct __GLXFBConfigRec *GLXFBConfigSGIX;
|
||||
|
||||
|
||||
/**********************************************************************/
|
||||
|
||||
/*
|
||||
* GLX 1.0 functions.
|
||||
*/
|
||||
extern XVisualInfo* glXChooseVisual(Display *dpy, int screen,
|
||||
int *attrib_list);
|
||||
|
||||
extern void glXCopyContext(Display *dpy, GLXContext src,
|
||||
GLXContext dst, unsigned int mask);
|
||||
|
||||
extern GLXContext glXCreateContext(Display *dpy, XVisualInfo *vis,
|
||||
GLXContext share_list, Bool direct);
|
||||
|
||||
extern GLXPixmap glXCreateGLXPixmap(Display *dpy, XVisualInfo *vis,
|
||||
Pixmap pixmap);
|
||||
|
||||
extern void glXDestroyContext(Display *dpy, GLXContext ctx);
|
||||
|
||||
extern void glXDestroyGLXPixmap(Display *dpy, GLXPixmap pix);
|
||||
|
||||
extern int glXGetConfig(Display *dpy, XVisualInfo *vis,
|
||||
int attrib, int *value);
|
||||
|
||||
extern GLXContext glXGetCurrentContext(void);
|
||||
|
||||
extern GLXDrawable glXGetCurrentDrawable(void);
|
||||
|
||||
extern Bool glXIsDirect(Display *dpy, GLXContext ctx);
|
||||
|
||||
extern Bool glXMakeCurrent(Display *dpy, GLXDrawable drawable,
|
||||
GLXContext ctx);
|
||||
|
||||
extern Bool glXQueryExtension(Display *dpy, int *error_base, int *event_base);
|
||||
|
||||
extern Bool glXQueryVersion(Display *dpy, int *major, int *minor);
|
||||
|
||||
extern void glXSwapBuffers(Display *dpy, GLXDrawable drawable);
|
||||
|
||||
extern void glXUseXFont(Font font, int first, int count, int list_base);
|
||||
|
||||
extern void glXWaitGL(void);
|
||||
|
||||
extern void glXWaitX(void);
|
||||
|
||||
|
||||
/*
|
||||
* GLX 1.1 functions.
|
||||
*/
|
||||
extern const char *glXGetClientString(Display *dpy, int name);
|
||||
|
||||
extern const char *glXQueryServerString(Display *dpy, int screen, int name);
|
||||
|
||||
extern const char *glXQueryExtensionsString(Display *dpy, int screen);
|
||||
|
||||
|
||||
/*
|
||||
* GLX 1.2 functions.
|
||||
*/
|
||||
extern Display *glXGetCurrentDisplay(void);
|
||||
|
||||
|
||||
/*
|
||||
* GLX 1.3 functions.
|
||||
*/
|
||||
extern GLXFBConfig *glXChooseFBConfig(Display *dpy, int screen,
|
||||
const int *attrib_list, int *nelements);
|
||||
|
||||
extern GLXContext glXCreateNewContext(Display *dpy, GLXFBConfig config,
|
||||
int render_type, GLXContext share_list,
|
||||
Bool direct);
|
||||
|
||||
extern GLXPbuffer glXCreatePbuffer(Display *dpy, GLXFBConfig config,
|
||||
const int *attrib_list);
|
||||
|
||||
extern GLXPixmap glXCreatePixmap(Display *dpy, GLXFBConfig config,
|
||||
Pixmap pixmap, const int *attrib_list);
|
||||
|
||||
extern GLXWindow glXCreateWindow(Display *dpy, GLXFBConfig config,
|
||||
Window win, const int *attrib_list);
|
||||
|
||||
extern void glXDestroyPbuffer(Display *dpy, GLXPbuffer pbuf);
|
||||
|
||||
extern void glXDestroyPixmap(Display *dpy, GLXPixmap pixmap);
|
||||
|
||||
extern void glXDestroyWindow(Display *dpy, GLXWindow win);
|
||||
|
||||
extern GLXDrawable glXGetCurrentReadDrawable(void);
|
||||
|
||||
extern int glXGetFBConfigAttrib(Display *dpy, GLXFBConfig config,
|
||||
int attribute, int *value);
|
||||
|
||||
extern GLXFBConfig *glXGetFBConfigs(Display *dpy, int screen, int *nelements);
|
||||
|
||||
extern void glXGetSelectedEvent(Display *dpy, GLXDrawable draw,
|
||||
unsigned long *event_mask);
|
||||
|
||||
extern XVisualInfo *glXGetVisualFromFBConfig(Display *dpy, GLXFBConfig config);
|
||||
|
||||
extern Bool glXMakeContextCurrent(Display *display, GLXDrawable draw,
|
||||
GLXDrawable read, GLXContext ctx);
|
||||
|
||||
extern int glXQueryContext(Display *dpy, GLXContext ctx,
|
||||
int attribute, int *value);
|
||||
|
||||
extern void glXQueryDrawable(Display *dpy, GLXDrawable draw,
|
||||
int attribute, unsigned int *value);
|
||||
|
||||
extern void glXSelectEvent(Display *dpy, GLXDrawable draw,
|
||||
unsigned long event_mask);
|
||||
|
||||
|
||||
/**********************************************************************/
|
||||
|
||||
/*
|
||||
* ARB_get_proc_address
|
||||
*/
|
||||
extern void (*glXGetProcAddressARB(const GLubyte *procName))(void);
|
||||
|
||||
/*
|
||||
* EXT_import_context
|
||||
*/
|
||||
extern void glXFreeContextEXT(Display *dpy, GLXContext ctx);
|
||||
|
||||
extern GLXContextID glXGetContextIDEXT(const GLXContext ctx);
|
||||
|
||||
extern GLXDrawable glXGetCurrentDrawableEXT(void);
|
||||
|
||||
extern GLXContext glXImportContextEXT(Display *dpy, GLXContextID contextID);
|
||||
|
||||
extern int glXQueryContextInfoEXT(Display *dpy, GLXContext ctx,
|
||||
int attribute, int *value);
|
||||
|
||||
/*
|
||||
* SGI_video_sync
|
||||
*/
|
||||
extern int glXGetVideoSyncSGI(unsigned int *count);
|
||||
|
||||
extern int glXWaitVideoSyncSGI(int divisor, int remainder,
|
||||
unsigned int *count);
|
||||
|
||||
extern int glXGetRefreshRateSGI(unsigned int *rate);
|
||||
|
||||
/*
|
||||
* SGIX_swap_group
|
||||
*/
|
||||
extern void glXJoinSwapGroupSGIX(Display *dpy, GLXDrawable drawable,
|
||||
GLXDrawable member);
|
||||
|
||||
/*
|
||||
* SGIX_swap_barrier
|
||||
*/
|
||||
extern void glXBindSwapBarrierSGIX(Display *dpy, GLXDrawable drawable,
|
||||
int barrier);
|
||||
|
||||
extern Bool glXQueryMaxSwapBarriersSGIX(Display *dpy, int screen, int *max);
|
||||
|
||||
/**********************************************************************/
|
||||
|
||||
/*** Should these go here, or in another header? */
|
||||
/*
|
||||
* GLX Events
|
||||
*/
|
||||
typedef struct {
|
||||
int event_type; /* GLX_DAMAGED or GLX_SAVED */
|
||||
int draw_type; /* GLX_WINDOW or GLX_PBUFFER */
|
||||
unsigned long serial; /* # of last request processed by server */
|
||||
Bool send_event; /* true if this came for SendEvent request */
|
||||
Display *display; /* display the event was read from */
|
||||
GLXDrawable drawable; /* XID of Drawable */
|
||||
unsigned int buffer_mask; /* mask indicating which buffers are affected */
|
||||
unsigned int aux_buffer; /* which aux buffer was affected */
|
||||
int x, y;
|
||||
int width, height;
|
||||
int count; /* if nonzero, at least this many more */
|
||||
} GLXPbufferClobberEvent;
|
||||
|
||||
typedef union __GLXEvent {
|
||||
GLXPbufferClobberEvent glxpbufferclobber;
|
||||
long pad[24];
|
||||
} GLXEvent;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !__glx_h__ */
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,615 @@
|
||||
#ifndef __glxext_h_
|
||||
#define __glxext_h_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
** License Applicability. Except to the extent portions of this file are
|
||||
** made subject to an alternative license as permitted in the SGI Free
|
||||
** Software License B, Version 1.1 (the "License"), the contents of this
|
||||
** file are subject only to the provisions of the License. You may not use
|
||||
** this file except in compliance with the License. You may obtain a copy
|
||||
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
|
||||
** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
|
||||
**
|
||||
** http://oss.sgi.com/projects/FreeB
|
||||
**
|
||||
** Note that, as provided in the License, the Software is distributed on an
|
||||
** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
|
||||
** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
|
||||
** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
|
||||
** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
|
||||
**
|
||||
** Original Code. The Original Code is: OpenGL Sample Implementation,
|
||||
** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
|
||||
** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
|
||||
** Copyright in any portions created by third parties is as indicated
|
||||
** elsewhere herein. All Rights Reserved.
|
||||
**
|
||||
** Additional Notice Provisions: This software was created using the
|
||||
** OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has
|
||||
** not been independently verified as being compliant with the OpenGL(R)
|
||||
** version 1.2.1 Specification.
|
||||
*/
|
||||
|
||||
#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__)
|
||||
#define WIN32_LEAN_AND_MEAN 1
|
||||
#include <windows.h>
|
||||
#else
|
||||
#include <GL/glx.h>
|
||||
#endif
|
||||
|
||||
#ifndef APIENTRY
|
||||
#define APIENTRY
|
||||
#endif
|
||||
|
||||
|
||||
/*************************************************************/
|
||||
|
||||
/* Header file version number, required by OpenGL ABI for Linux */
|
||||
#define GLX_GLXEXT_VERSION 2
|
||||
|
||||
#ifndef GLX_VERSION_1_3
|
||||
#define GLX_WINDOW_BIT 0x00000001
|
||||
#define GLX_PIXMAP_BIT 0x00000002
|
||||
#define GLX_PBUFFER_BIT 0x00000004
|
||||
#define GLX_RGBA_BIT 0x00000001
|
||||
#define GLX_COLOR_INDEX_BIT 0x00000002
|
||||
#define GLX_PBUFFER_CLOBBER_MASK 0x08000000
|
||||
#define GLX_FRONT_LEFT_BUFFER_BIT 0x00000001
|
||||
#define GLX_FRONT_RIGHT_BUFFER_BIT 0x00000002
|
||||
#define GLX_BACK_LEFT_BUFFER_BIT 0x00000004
|
||||
#define GLX_BACK_RIGHT_BUFFER_BIT 0x00000008
|
||||
#define GLX_AUX_BUFFERS_BIT 0x00000010
|
||||
#define GLX_DEPTH_BUFFER_BIT 0x00000020
|
||||
#define GLX_STENCIL_BUFFER_BIT 0x00000040
|
||||
#define GLX_ACCUM_BUFFER_BIT 0x00000080
|
||||
#define GLX_CONFIG_CAVEAT 0x20
|
||||
#define GLX_X_VISUAL_TYPE 0x22
|
||||
#define GLX_TRANSPARENT_TYPE 0x23
|
||||
#define GLX_TRANSPARENT_INDEX_VALUE 0x24
|
||||
#define GLX_TRANSPARENT_RED_VALUE 0x25
|
||||
#define GLX_TRANSPARENT_GREEN_VALUE 0x26
|
||||
#define GLX_TRANSPARENT_BLUE_VALUE 0x27
|
||||
#define GLX_TRANSPARENT_ALPHA_VALUE 0x28
|
||||
#define GLX_DONT_CARE 0xFFFFFFFF
|
||||
#define GLX_NONE 0x8000
|
||||
#define GLX_SLOW_CONFIG 0x8001
|
||||
#define GLX_TRUE_COLOR 0x8002
|
||||
#define GLX_DIRECT_COLOR 0x8003
|
||||
#define GLX_PSEUDO_COLOR 0x8004
|
||||
#define GLX_STATIC_COLOR 0x8005
|
||||
#define GLX_GRAY_SCALE 0x8006
|
||||
#define GLX_STATIC_GRAY 0x8007
|
||||
#define GLX_TRANSPARENT_RGB 0x8008
|
||||
#define GLX_TRANSPARENT_INDEX 0x8009
|
||||
#define GLX_VISUAL_ID 0x800B
|
||||
#define GLX_SCREEN 0x800C
|
||||
#define GLX_NON_CONFORMANT_CONFIG 0x800D
|
||||
#define GLX_DRAWABLE_TYPE 0x8010
|
||||
#define GLX_RENDER_TYPE 0x8011
|
||||
#define GLX_X_RENDERABLE 0x8012
|
||||
#define GLX_FBCONFIG_ID 0x8013
|
||||
#define GLX_RGBA_TYPE 0x8014
|
||||
#define GLX_COLOR_INDEX_TYPE 0x8015
|
||||
#define GLX_MAX_PBUFFER_WIDTH 0x8016
|
||||
#define GLX_MAX_PBUFFER_HEIGHT 0x8017
|
||||
#define GLX_MAX_PBUFFER_PIXELS 0x8018
|
||||
#define GLX_PRESERVED_CONTENTS 0x801B
|
||||
#define GLX_LARGEST_PBUFFER 0x801C
|
||||
#define GLX_WIDTH 0x801D
|
||||
#define GLX_HEIGHT 0x801E
|
||||
#define GLX_EVENT_MASK 0x801F
|
||||
#define GLX_DAMAGED 0x8020
|
||||
#define GLX_SAVED 0x8021
|
||||
#define GLX_WINDOW 0x8022
|
||||
#define GLX_PBUFFER 0x8023
|
||||
#define GLX_PBUFFER_HEIGHT 0x8040
|
||||
#define GLX_PBUFFER_WIDTH 0x8041
|
||||
#endif
|
||||
|
||||
#ifndef GLX_EXT_visual_info
|
||||
#define GLX_X_VISUAL_TYPE_EXT 0x22
|
||||
#define GLX_TRANSPARENT_TYPE_EXT 0x23
|
||||
#define GLX_TRANSPARENT_INDEX_VALUE_EXT 0x24
|
||||
#define GLX_TRANSPARENT_RED_VALUE_EXT 0x25
|
||||
#define GLX_TRANSPARENT_GREEN_VALUE_EXT 0x26
|
||||
#define GLX_TRANSPARENT_BLUE_VALUE_EXT 0x27
|
||||
#define GLX_TRANSPARENT_ALPHA_VALUE_EXT 0x28
|
||||
#define GLX_NONE_EXT 0x8000
|
||||
#define GLX_TRUE_COLOR_EXT 0x8002
|
||||
#define GLX_DIRECT_COLOR_EXT 0x8003
|
||||
#define GLX_PSEUDO_COLOR_EXT 0x8004
|
||||
#define GLX_STATIC_COLOR_EXT 0x8005
|
||||
#define GLX_GRAY_SCALE_EXT 0x8006
|
||||
#define GLX_STATIC_GRAY_EXT 0x8007
|
||||
#define GLX_TRANSPARENT_RGB_EXT 0x8008
|
||||
#define GLX_TRANSPARENT_INDEX_EXT 0x8009
|
||||
#endif
|
||||
|
||||
#ifndef GLX_SGI_swap_control
|
||||
#endif
|
||||
|
||||
#ifndef GLX_SGI_video_sync
|
||||
#endif
|
||||
|
||||
#ifndef GLX_SGI_make_current_read
|
||||
#endif
|
||||
|
||||
#ifndef GLX_SGIX_video_source
|
||||
#endif
|
||||
|
||||
#ifndef GLX_EXT_visual_rating
|
||||
#define GLX_VISUAL_CAVEAT_EXT 0x20
|
||||
#define GLX_SLOW_VISUAL_EXT 0x8001
|
||||
#define GLX_NON_CONFORMANT_VISUAL_EXT 0x800D
|
||||
/* reuse GLX_NONE_EXT */
|
||||
#endif
|
||||
|
||||
#ifndef GLX_EXT_import_context
|
||||
#define GLX_SHARE_CONTEXT_EXT 0x800A
|
||||
#define GLX_VISUAL_ID_EXT 0x800B
|
||||
#define GLX_SCREEN_EXT 0x800C
|
||||
#endif
|
||||
|
||||
#ifndef GLX_SGIX_fbconfig
|
||||
#ifndef GLX_WINDOW_BIT_SGIX
|
||||
#define GLX_WINDOW_BIT_SGIX 0x00000001
|
||||
#endif
|
||||
#ifndef GLX_PIXMAP_BIT_SGIX
|
||||
#define GLX_PIXMAP_BIT_SGIX 0x00000002
|
||||
#endif
|
||||
#ifndef GLX_RGBA_BIT_SGIX
|
||||
#define GLX_RGBA_BIT_SGIX 0x00000001
|
||||
#endif
|
||||
#ifndef GLX_COLOR_INDEX_BIT_SGIX
|
||||
#define GLX_COLOR_INDEX_BIT_SGIX 0x00000002
|
||||
#endif
|
||||
#ifndef GLX_DRAWABLE_TYPE_SGIX
|
||||
#define GLX_DRAWABLE_TYPE_SGIX 0x8010
|
||||
#endif
|
||||
#ifndef GLX_RENDER_TYPE_SGIX
|
||||
#define GLX_RENDER_TYPE_SGIX 0x8011
|
||||
#endif
|
||||
#ifndef GLX_X_RENDERABLE_SGIX
|
||||
#define GLX_X_RENDERABLE_SGIX 0x8012
|
||||
#endif
|
||||
#ifndef GLX_FBCONFIG_ID_SGIX
|
||||
#define GLX_FBCONFIG_ID_SGIX 0x8013
|
||||
#endif
|
||||
#ifndef GLX_RGBA_TYPE_SGIX
|
||||
#define GLX_RGBA_TYPE_SGIX 0x8014
|
||||
#endif
|
||||
#ifndef GLX_COLOR_INDEX_TYPE_SGIX
|
||||
#define GLX_COLOR_INDEX_TYPE_SGIX 0x8015
|
||||
#endif
|
||||
/* reuse GLX_SCREEN_EXT */
|
||||
#endif
|
||||
|
||||
#ifndef GLX_SGIX_pbuffer
|
||||
#ifndef GLX_PBUFFER_BIT_SGIX
|
||||
#define GLX_PBUFFER_BIT_SGIX 0x00000004
|
||||
#endif
|
||||
#ifndef GLX_BUFFER_CLOBBER_MASK_SGIX
|
||||
#define GLX_BUFFER_CLOBBER_MASK_SGIX 0x08000000
|
||||
#endif
|
||||
#ifndef GLX_FRONT_LEFT_BUFFER_BIT_SGIX
|
||||
#define GLX_FRONT_LEFT_BUFFER_BIT_SGIX 0x00000001
|
||||
#endif
|
||||
#ifndef GLX_FRONT_RIGHT_BUFFER_BIT_SGIX
|
||||
#define GLX_FRONT_RIGHT_BUFFER_BIT_SGIX 0x00000002
|
||||
#endif
|
||||
#ifndef GLX_BACK_LEFT_BUFFER_BIT_SGIX
|
||||
#define GLX_BACK_LEFT_BUFFER_BIT_SGIX 0x00000004
|
||||
#endif
|
||||
#ifndef GLX_BACK_RIGHT_BUFFER_BIT_SGIX
|
||||
#define GLX_BACK_RIGHT_BUFFER_BIT_SGIX 0x00000008
|
||||
#endif
|
||||
#ifndef GLX_AUX_BUFFERS_BIT_SGIX
|
||||
#define GLX_AUX_BUFFERS_BIT_SGIX 0x00000010
|
||||
#endif
|
||||
#ifndef GLX_DEPTH_BUFFER_BIT_SGIX
|
||||
#define GLX_DEPTH_BUFFER_BIT_SGIX 0x00000020
|
||||
#endif
|
||||
#ifndef GLX_STENCIL_BUFFER_BIT_SGIX
|
||||
#define GLX_STENCIL_BUFFER_BIT_SGIX 0x00000040
|
||||
#endif
|
||||
#ifndef GLX_ACCUM_BUFFER_BIT_SGIX
|
||||
#define GLX_ACCUM_BUFFER_BIT_SGIX 0x00000080
|
||||
#endif
|
||||
#ifndef GLX_SAMPLE_BUFFERS_BIT_SGIX
|
||||
#define GLX_SAMPLE_BUFFERS_BIT_SGIX 0x00000100
|
||||
#endif
|
||||
#ifndef GLX_MAX_PBUFFER_WIDTH_SGIX
|
||||
#define GLX_MAX_PBUFFER_WIDTH_SGIX 0x8016
|
||||
#endif
|
||||
#ifndef GLX_MAX_PBUFFER_HEIGHT_SGIX
|
||||
#define GLX_MAX_PBUFFER_HEIGHT_SGIX 0x8017
|
||||
#endif
|
||||
#ifndef GLX_MAX_PBUFFER_PIXELS_SGIX
|
||||
#define GLX_MAX_PBUFFER_PIXELS_SGIX 0x8018
|
||||
#endif
|
||||
#ifndef GLX_OPTIMAL_PBUFFER_WIDTH_SGIX
|
||||
#define GLX_OPTIMAL_PBUFFER_WIDTH_SGIX 0x8019
|
||||
#endif
|
||||
#ifndef GLX_OPTIMAL_PBUFFER_HEIGHT_SGIX
|
||||
#define GLX_OPTIMAL_PBUFFER_HEIGHT_SGIX 0x801A
|
||||
#endif
|
||||
#ifndef GLX_PRESERVED_CONTENTS_SGIX
|
||||
#define GLX_PRESERVED_CONTENTS_SGIX 0x801B
|
||||
#endif
|
||||
#ifndef GLX_LARGEST_PBUFFER_SGIX
|
||||
#define GLX_LARGEST_PBUFFER_SGIX 0x801C
|
||||
#endif
|
||||
#ifndef GLX_WIDTH_SGIX
|
||||
#define GLX_WIDTH_SGIX 0x801D
|
||||
#endif
|
||||
#ifndef GLX_HEIGHT_SGIX
|
||||
#define GLX_HEIGHT_SGIX 0x801E
|
||||
#endif
|
||||
#ifndef GLX_EVENT_MASK_SGIX
|
||||
#define GLX_EVENT_MASK_SGIX 0x801F
|
||||
#endif
|
||||
#ifndef GLX_DAMAGED_SGIX
|
||||
#define GLX_DAMAGED_SGIX 0x8020
|
||||
#endif
|
||||
#ifndef GLX_SAVED_SGIX
|
||||
#define GLX_SAVED_SGIX 0x8021
|
||||
#endif
|
||||
#ifndef GLX_WINDOW_SGIX
|
||||
#define GLX_WINDOW_SGIX 0x8022
|
||||
#endif
|
||||
#ifndef GLX_PBUFFER_SGIX
|
||||
#define GLX_PBUFFER_SGIX 0x8023
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef GLX_SGI_cushion
|
||||
#endif
|
||||
|
||||
#ifndef GLX_SGIX_video_resize
|
||||
#define GLX_SYNC_FRAME_SGIX 0x00000000
|
||||
#define GLX_SYNC_SWAP_SGIX 0x00000001
|
||||
#endif
|
||||
|
||||
#ifndef GLX_SGIX_dmbuffer
|
||||
#define GLX_DIGITAL_MEDIA_PBUFFER_SGIX 0x8024
|
||||
#endif
|
||||
|
||||
#ifndef GLX_SGIX_swap_group
|
||||
#endif
|
||||
|
||||
#ifndef GLX_SGIX_swap_barrier
|
||||
#endif
|
||||
|
||||
#ifndef GLX_SGIS_blended_overlay
|
||||
#define GLX_BLENDED_RGBA_SGIS 0x8025
|
||||
#endif
|
||||
|
||||
#ifndef GLX_SGIS_shared_multisample
|
||||
#define GLX_MULTISAMPLE_SUB_RECT_WIDTH_SGIS 0x8026
|
||||
#define GLX_MULTISAMPLE_SUB_RECT_HEIGHT_SGIS 0x8027
|
||||
#endif
|
||||
|
||||
#ifndef GLX_SUN_get_transparent_index
|
||||
#endif
|
||||
|
||||
#ifndef GLX_3DFX_multisample
|
||||
#define GLX_SAMPLE_BUFFERS_3DFX 0x8050
|
||||
#define GLX_SAMPLES_3DFX 0x8051
|
||||
#endif
|
||||
|
||||
#ifndef GLX_MESA_copy_sub_buffer
|
||||
#endif
|
||||
|
||||
#ifndef GLX_MESA_pixmap_colormap
|
||||
#endif
|
||||
|
||||
#ifndef GLX_MESA_release_buffers
|
||||
#endif
|
||||
|
||||
#ifndef GLX_MESA_set_3dfx_mode
|
||||
#define GLX_3DFX_WINDOW_MODE_MESA 0x1
|
||||
#define GLX_3DFX_FULLSCREEN_MODE_MESA 0x2
|
||||
#endif
|
||||
|
||||
|
||||
/*************************************************************/
|
||||
|
||||
#ifndef GLX_ARB_get_proc_address
|
||||
typedef void (*__GLXextFuncPtr)();
|
||||
#endif
|
||||
|
||||
#ifndef GLX_SGIX_video_source
|
||||
typedef XID GLXVideoSourceSGIX;
|
||||
#endif
|
||||
|
||||
#ifndef GLX_SGIX_fbconfig
|
||||
typedef XID GLXFBConfigIDSGIX;
|
||||
typedef struct __GLXFBConfigRec *GLXFBConfigSGIX;
|
||||
#endif
|
||||
|
||||
#ifndef GLX_SGIX_pbuffer
|
||||
typedef XID GLXPbufferSGIX;
|
||||
typedef struct {
|
||||
int type;
|
||||
unsigned long serial; /* # of last request processed by server */
|
||||
Bool send_event; /* true if this came for SendEvent request */
|
||||
Display *display; /* display the event was read from */
|
||||
GLXDrawable drawable; /* i.d. of Drawable */
|
||||
int event_type; /* GLX_DAMAGED_SGIX or GLX_SAVED_SGIX */
|
||||
int draw_type; /* GLX_WINDOW_SGIX or GLX_PBUFFER_SGIX */
|
||||
unsigned int mask; /* mask indicating which buffers are affected*/
|
||||
int x, y;
|
||||
int width, height;
|
||||
int count; /* if nonzero, at least this many more */
|
||||
} GLXBufferClobberEventSGIX;
|
||||
#endif
|
||||
|
||||
#ifndef GLX_VERSION_1_3
|
||||
#define GLX_VERSION_1_3 1
|
||||
#ifdef GLX_GLXEXT_PROTOTYPES
|
||||
extern GLXFBConfig * glXGetFBConfigs (Display *, int, int *);
|
||||
extern GLXFBConfig * glXChooseFBConfig (Display *, int, const int *, int *);
|
||||
extern int glXGetFBConfigAttrib (Display *, GLXFBConfig, int, int *);
|
||||
extern XVisualInfo * glXGetVisualFromFBConfig (Display *, GLXFBConfig);
|
||||
extern GLXWindow glXCreateWindow (Display *, GLXFBConfig, Window, const int *);
|
||||
extern void glXDestroyWindow (Display *, GLXWindow);
|
||||
extern GLXPixmap glXCreatePixmap (Display *, GLXFBConfig, Pixmap, const int *);
|
||||
extern void glXDestroyPixmap (Display *, GLXPixmap);
|
||||
extern GLXPbuffer glXCreatePbuffer (Display *, GLXFBConfig, const int *);
|
||||
extern void glXDestroyPbuffer (Display *, GLXPbuffer);
|
||||
extern void glXQueryDrawable (Display *, GLXDrawable, int, unsigned int *);
|
||||
extern GLXContext glXCreateNewContext (Display *, GLXFBConfig, int, GLXContext, Bool);
|
||||
extern Bool glXMakeContextCurrent (Display *, GLXDrawable, GLXDrawable, GLXContext);
|
||||
extern GLXDrawable glXGetCurrentReadDrawable (void);
|
||||
extern Display * glXGetCurrentDisplay (void);
|
||||
extern int glXQueryContext (Display *, GLXContext, int, int *);
|
||||
extern void glXSelectEvent (Display *, GLXDrawable, unsigned long);
|
||||
extern void glXGetSelectedEvent (Display *, GLXDrawable, unsigned long *);
|
||||
#endif /* GLX_GLXEXT_PROTOTYPES */
|
||||
typedef GLXFBConfig * ( * PFNGLXGETFBCONFIGSPROC) (Display *dpy, int screen, int *nelements);
|
||||
typedef GLXFBConfig * ( * PFNGLXCHOOSEFBCONFIGPROC) (Display *dpy, int screen, const int *attrib_list, int *nelements);
|
||||
typedef int ( * PFNGLXGETFBCONFIGATTRIBPROC) (Display *dpy, GLXFBConfig config, int attribute, int *value);
|
||||
typedef XVisualInfo * ( * PFNGLXGETVISUALFROMFBCONFIGPROC) (Display *dpy, GLXFBConfig config);
|
||||
typedef GLXWindow ( * PFNGLXCREATEWINDOWPROC) (Display *dpy, GLXFBConfig config, Window win, const int *attrib_list);
|
||||
typedef void ( * PFNGLXDESTROYWINDOWPROC) (Display *dpy, GLXWindow win);
|
||||
typedef GLXPixmap ( * PFNGLXCREATEPIXMAPPROC) (Display *dpy, GLXFBConfig config, Pixmap pixmap, const int *attrib_list);
|
||||
typedef void ( * PFNGLXDESTROYPIXMAPPROC) (Display *dpy, GLXPixmap pixmap);
|
||||
typedef GLXPbuffer ( * PFNGLXCREATEPBUFFERPROC) (Display *dpy, GLXFBConfig config, const int *attrib_list);
|
||||
typedef void ( * PFNGLXDESTROYPBUFFERPROC) (Display *dpy, GLXPbuffer pbuf);
|
||||
typedef void ( * PFNGLXQUERYDRAWABLEPROC) (Display *dpy, GLXDrawable draw, int attribute, unsigned int *value);
|
||||
typedef GLXContext ( * PFNGLXCREATENEWCONTEXTPROC) (Display *dpy, GLXFBConfig config, int render_type, GLXContext share_list, Bool direct);
|
||||
typedef Bool ( * PFNGLXMAKECONTEXTCURRENTPROC) (Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx);
|
||||
typedef GLXDrawable ( * PFNGLXGETCURRENTREADDRAWABLEPROC) (void);
|
||||
typedef Display * ( * PFNGLXGETCURRENTDISPLAYPROC) (void);
|
||||
typedef int ( * PFNGLXQUERYCONTEXTPROC) (Display *dpy, GLXContext ctx, int attribute, int *value);
|
||||
typedef void ( * PFNGLXSELECTEVENTPROC) (Display *dpy, GLXDrawable draw, unsigned long event_mask);
|
||||
typedef void ( * PFNGLXGETSELECTEDEVENTPROC) (Display *dpy, GLXDrawable draw, unsigned long *event_mask);
|
||||
#endif
|
||||
|
||||
#ifndef GLX_ARB_get_proc_address
|
||||
#define GLX_ARB_get_proc_address 1
|
||||
#ifdef GLX_GLXEXT_PROTOTYPES
|
||||
extern __GLXextFuncPtr glXGetProcAddressARB (const GLubyte *);
|
||||
#endif /* GLX_GLXEXT_PROTOTYPES */
|
||||
typedef __GLXextFuncPtr ( * PFNGLXGETPROCADDRESSARBPROC) (const GLubyte *procName);
|
||||
#endif
|
||||
|
||||
#ifndef GLX_SGIS_multisample
|
||||
#define GLX_SGIS_multisample 1
|
||||
#endif
|
||||
|
||||
#ifndef GLX_EXT_visual_info
|
||||
#define GLX_EXT_visual_info 1
|
||||
#endif
|
||||
|
||||
#ifndef GLX_NV_vertex_array_range
|
||||
#define GLX_NV_vertex_array_range
|
||||
#ifdef GLX_GLXEXT_PROTOTYPES
|
||||
extern void *glXAllocateMemoryNV (GLsizei, GLfloat, GLfloat, GLfloat);
|
||||
extern void glXFreeMemoryNV (void *);
|
||||
#endif
|
||||
typedef void * ( * PFNGLXALLOCATEMEMORYNVPROC) (GLsizei, GLfloat, GLfloat, GLfloat);
|
||||
typedef void ( * PFNGLXFREEMEMORYNVPROC) (void *);
|
||||
#endif
|
||||
|
||||
#ifndef GLX_SGI_swap_control
|
||||
#define GLX_SGI_swap_control 1
|
||||
#ifdef GLX_GLXEXT_PROTOTYPES
|
||||
extern int glXSwapIntervalSGI (int);
|
||||
#endif /* GLX_GLXEXT_PROTOTYPES */
|
||||
typedef int ( * PFNGLXSWAPINTERVALSGIPROC) (int interval);
|
||||
#endif
|
||||
|
||||
#ifndef GLX_SGI_video_sync
|
||||
#define GLX_SGI_video_sync 1
|
||||
#ifdef GLX_GLXEXT_PROTOTYPES
|
||||
extern int glXGetVideoSyncSGI (unsigned int *);
|
||||
extern int glXWaitVideoSyncSGI (int, int, unsigned int *);
|
||||
#endif /* GLX_GLXEXT_PROTOTYPES */
|
||||
typedef int ( * PFNGLXGETVIDEOSYNCSGIPROC) (unsigned int *count);
|
||||
typedef int ( * PFNGLXWAITVIDEOSYNCSGIPROC) (int divisor, int remainder, unsigned int *count);
|
||||
#endif
|
||||
|
||||
#ifndef GLX_SGI_make_current_read
|
||||
#define GLX_SGI_make_current_read 1
|
||||
#ifdef GLX_GLXEXT_PROTOTYPES
|
||||
extern Bool glXMakeCurrentReadSGI (Display *, GLXDrawable, GLXDrawable, GLXContext);
|
||||
extern GLXDrawable glXGetCurrentReadDrawableSGI (void);
|
||||
#endif /* GLX_GLXEXT_PROTOTYPES */
|
||||
typedef Bool ( * PFNGLXMAKECURRENTREADSGIPROC) (Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx);
|
||||
typedef GLXDrawable ( * PFNGLXGETCURRENTREADDRAWABLESGIPROC) (void);
|
||||
#endif
|
||||
|
||||
#ifdef _VL_H
|
||||
#ifndef GLX_SGIX_video_source
|
||||
#define GLX_SGIX_video_source 1
|
||||
#ifdef GLX_GLXEXT_PROTOTYPES
|
||||
extern GLXVideoSourceSGIX glXCreateGLXVideoSourceSGIX (Display *, int, VLServer, VLPath, int, VLNode);
|
||||
extern void glXDestroyGLXVideoSourceSGIX (Display *, GLXVideoSourceSGIX);
|
||||
#endif /* GLX_GLXEXT_PROTOTYPES */
|
||||
typedef GLXVideoSourceSGIX ( * PFNGLXCREATEGLXVIDEOSOURCESGIXPROC) (Display *display, int screen, VLServer server, VLPath path, int nodeClass, VLNode drainNode);
|
||||
typedef void ( * PFNGLXDESTROYGLXVIDEOSOURCESGIXPROC) (Display *dpy, GLXVideoSourceSGIX glxvideosource);
|
||||
#endif
|
||||
|
||||
#endif /* _VL_H */
|
||||
#ifndef GLX_EXT_visual_rating
|
||||
#define GLX_EXT_visual_rating 1
|
||||
#endif
|
||||
|
||||
#ifndef GLX_EXT_import_context
|
||||
#define GLX_EXT_import_context 1
|
||||
#ifdef GLX_GLXEXT_PROTOTYPES
|
||||
extern Display * glXGetCurrentDisplayEXT (void);
|
||||
extern int glXQueryContextInfoEXT (Display *, GLXContext, int, int *);
|
||||
extern GLXContextID glXGetContextIDEXT (GLXContext);
|
||||
extern GLXContext glXImportContextEXT (Display *, GLXContextID);
|
||||
extern void glXFreeContextEXT (Display *, GLXContext);
|
||||
#endif /* GLX_GLXEXT_PROTOTYPES */
|
||||
typedef Display * ( * PFNGLXGETCURRENTDISPLAYEXTPROC) (void);
|
||||
typedef int ( * PFNGLXQUERYCONTEXTINFOEXTPROC) (Display *dpy, GLXContext context, int attribute, int *value);
|
||||
typedef GLXContextID ( * PFNGLXGETCONTEXTIDEXTPROC) (GLXContext context);
|
||||
typedef GLXContext ( * PFNGLXIMPORTCONTEXTEXTPROC) (Display *dpy, GLXContextID contextID);
|
||||
typedef void ( * PFNGLXFREECONTEXTEXTPROC) (Display *dpy, GLXContext context);
|
||||
#endif
|
||||
|
||||
#ifndef GLX_SGIX_fbconfig
|
||||
#define GLX_SGIX_fbconfig 1
|
||||
#ifdef GLX_GLXEXT_PROTOTYPES
|
||||
extern int glXGetFBConfigAttribSGIX (Display *, GLXFBConfigSGIX, int, int *);
|
||||
extern GLXFBConfigSGIX * glXChooseFBConfigSGIX (Display *, int, int *, int *);
|
||||
extern GLXPixmap glXCreateGLXPixmapWithConfigSGIX (Display *, GLXFBConfigSGIX, Pixmap);
|
||||
extern GLXContext glXCreateContextWithConfigSGIX (Display *, GLXFBConfigSGIX, int, GLXContext, Bool);
|
||||
extern XVisualInfo * glXGetVisualFromFBConfigSGIX (Display *, GLXFBConfigSGIX);
|
||||
extern GLXFBConfigSGIX glXGetFBConfigFromVisualSGIX (Display *, XVisualInfo *);
|
||||
#endif /* GLX_GLXEXT_PROTOTYPES */
|
||||
typedef int ( * PFNGLXGETFBCONFIGATTRIBSGIXPROC) (Display *dpy, GLXFBConfigSGIX config, int attribute, int *value);
|
||||
typedef GLXFBConfigSGIX * ( * PFNGLXCHOOSEFBCONFIGSGIXPROC) (Display *dpy, int screen, int *attrib_list, int *nelements);
|
||||
typedef GLXPixmap ( * PFNGLXCREATEGLXPIXMAPWITHCONFIGSGIXPROC) (Display *dpy, GLXFBConfigSGIX config, Pixmap pixmap);
|
||||
typedef GLXContext ( * PFNGLXCREATECONTEXTWITHCONFIGSGIXPROC) (Display *dpy, GLXFBConfigSGIX config, int render_type, GLXContext share_list, Bool direct);
|
||||
typedef XVisualInfo * ( * PFNGLXGETVISUALFROMFBCONFIGSGIXPROC) (Display *dpy, GLXFBConfigSGIX config);
|
||||
typedef GLXFBConfigSGIX ( * PFNGLXGETFBCONFIGFROMVISUALSGIXPROC) (Display *dpy, XVisualInfo *vis);
|
||||
#endif
|
||||
|
||||
#ifndef GLX_SGIX_pbuffer
|
||||
#define GLX_SGIX_pbuffer 1
|
||||
#ifdef GLX_GLXEXT_PROTOTYPES
|
||||
extern GLXPbufferSGIX glXCreateGLXPbufferSGIX (Display *, GLXFBConfigSGIX, unsigned int, unsigned int, int *);
|
||||
extern void glXDestroyGLXPbufferSGIX (Display *, GLXPbufferSGIX);
|
||||
extern int glXQueryGLXPbufferSGIX (Display *, GLXPbufferSGIX, int, unsigned int *);
|
||||
extern void glXSelectEventSGIX (Display *, GLXDrawable, unsigned long);
|
||||
extern void glXGetSelectedEventSGIX (Display *, GLXDrawable, unsigned long *);
|
||||
#endif /* GLX_GLXEXT_PROTOTYPES */
|
||||
typedef GLXPbufferSGIX ( * PFNGLXCREATEGLXPBUFFERSGIXPROC) (Display *dpy, GLXFBConfigSGIX config, unsigned int width, unsigned int height, int *attrib_list);
|
||||
typedef void ( * PFNGLXDESTROYGLXPBUFFERSGIXPROC) (Display *dpy, GLXPbufferSGIX pbuf);
|
||||
typedef int ( * PFNGLXQUERYGLXPBUFFERSGIXPROC) (Display *dpy, GLXPbufferSGIX pbuf, int attribute, unsigned int *value);
|
||||
typedef void ( * PFNGLXSELECTEVENTSGIXPROC) (Display *dpy, GLXDrawable drawable, unsigned long mask);
|
||||
typedef void ( * PFNGLXGETSELECTEDEVENTSGIXPROC) (Display *dpy, GLXDrawable drawable, unsigned long *mask);
|
||||
#endif
|
||||
|
||||
#ifndef GLX_NV_float_buffer
|
||||
#define GLX_NV_float_buffer 1
|
||||
#endif
|
||||
|
||||
#ifndef GLX_SGI_cushion
|
||||
#define GLX_SGI_cushion 1
|
||||
#ifdef GLX_GLXEXT_PROTOTYPES
|
||||
extern void glXCushionSGI (Display *, Window, float);
|
||||
#endif /* GLX_GLXEXT_PROTOTYPES */
|
||||
typedef void ( * PFNGLXCUSHIONSGIPROC) (Display *dpy, Window window, float cushion);
|
||||
#endif
|
||||
|
||||
#ifndef GLX_SGIX_video_resize
|
||||
#define GLX_SGIX_video_resize 1
|
||||
#ifdef GLX_GLXEXT_PROTOTYPES
|
||||
extern int glXBindChannelToWindowSGIX (Display *, int, int, Window);
|
||||
extern int glXChannelRectSGIX (Display *, int, int, int, int, int, int);
|
||||
extern int glXQueryChannelRectSGIX (Display *, int, int, int *, int *, int *, int *);
|
||||
extern int glXQueryChannelDeltasSGIX (Display *, int, int, int *, int *, int *, int *);
|
||||
extern int glXChannelRectSyncSGIX (Display *, int, int, GLenum);
|
||||
#endif /* GLX_GLXEXT_PROTOTYPES */
|
||||
typedef int ( * PFNGLXBINDCHANNELTOWINDOWSGIXPROC) (Display *display, int screen, int channel, Window window);
|
||||
typedef int ( * PFNGLXCHANNELRECTSGIXPROC) (Display *display, int screen, int channel, int x, int y, int w, int h);
|
||||
typedef int ( * PFNGLXQUERYCHANNELRECTSGIXPROC) (Display *display, int screen, int channel, int *dx, int *dy, int *dw, int *dh);
|
||||
typedef int ( * PFNGLXQUERYCHANNELDELTASSGIXPROC) (Display *display, int screen, int channel, int *x, int *y, int *w, int *h);
|
||||
typedef int ( * PFNGLXCHANNELRECTSYNCSGIXPROC) (Display *display, int screen, int channel, GLenum synctype);
|
||||
#endif
|
||||
|
||||
#ifdef _DM_BUFFER_H_
|
||||
#ifndef GLX_SGIX_dmbuffer
|
||||
#define GLX_SGIX_dmbuffer 1
|
||||
#ifdef GLX_GLXEXT_PROTOTYPES
|
||||
extern Bool glXAssociateDMPbufferSGIX (Display *, GLXPbufferSGIX, DMparams *, DMbuffer);
|
||||
#endif /* GLX_GLXEXT_PROTOTYPES */
|
||||
typedef Bool ( * PFNGLXASSOCIATEDMPBUFFERSGIXPROC) (Display *dpy, GLXPbufferSGIX pbuffer, DMparams *params, DMbuffer dmbuffer);
|
||||
#endif
|
||||
|
||||
#endif /* _DM_BUFFER_H_ */
|
||||
#ifndef GLX_SGIX_swap_group
|
||||
#define GLX_SGIX_swap_group 1
|
||||
#ifdef GLX_GLXEXT_PROTOTYPES
|
||||
extern void glXJoinSwapGroupSGIX (Display *, GLXDrawable, GLXDrawable);
|
||||
#endif /* GLX_GLXEXT_PROTOTYPES */
|
||||
typedef void ( * PFNGLXJOINSWAPGROUPSGIXPROC) (Display *dpy, GLXDrawable drawable, GLXDrawable member);
|
||||
#endif
|
||||
|
||||
#ifndef GLX_SGIX_swap_barrier
|
||||
#define GLX_SGIX_swap_barrier 1
|
||||
#ifdef GLX_GLXEXT_PROTOTYPES
|
||||
extern void glXBindSwapBarrierSGIX (Display *, GLXDrawable, int);
|
||||
extern Bool glXQueryMaxSwapBarriersSGIX (Display *, int, int *);
|
||||
#endif /* GLX_GLXEXT_PROTOTYPES */
|
||||
typedef void ( * PFNGLXBINDSWAPBARRIERSGIXPROC) (Display *dpy, GLXDrawable drawable, int barrier);
|
||||
typedef Bool ( * PFNGLXQUERYMAXSWAPBARRIERSSGIXPROC) (Display *dpy, int screen, int *max);
|
||||
#endif
|
||||
|
||||
#ifndef GLX_SUN_get_transparent_index
|
||||
#define GLX_SUN_get_transparent_index 1
|
||||
#ifdef GLX_GLXEXT_PROTOTYPES
|
||||
extern Status glXGetTransparentIndexSUN (Display *, Window, Window, long *);
|
||||
#endif /* GLX_GLXEXT_PROTOTYPES */
|
||||
typedef Status ( * PFNGLXGETTRANSPARENTINDEXSUNPROC) (Display *dpy, Window overlay, Window underlay, long *pTransparentIndex);
|
||||
#endif
|
||||
|
||||
#ifndef GLX_MESA_copy_sub_buffer
|
||||
#define GLX_MESA_copy_sub_buffer 1
|
||||
#ifdef GLX_GLXEXT_PROTOTYPES
|
||||
extern void glXCopySubBufferMESA (Display *, GLXDrawable, int, int, int, int);
|
||||
#endif /* GLX_GLXEXT_PROTOTYPES */
|
||||
typedef void ( * PFNGLXCOPYSUBBUFFERMESAPROC) (Display *dpy, GLXDrawable drawable, int x, int y, int width, int height);
|
||||
#endif
|
||||
|
||||
#ifndef GLX_MESA_pixmap_colormap
|
||||
#define GLX_MESA_pixmap_colormap 1
|
||||
#ifdef GLX_GLXEXT_PROTOTYPES
|
||||
extern GLXPixmap glXCreateGLXPixmapMESA (Display *, XVisualInfo *, Pixmap, Colormap);
|
||||
#endif /* GLX_GLXEXT_PROTOTYPES */
|
||||
typedef GLXPixmap ( * PFNGLXCREATEGLXPIXMAPMESAPROC) (Display *dpy, XVisualInfo *visual, Pixmap pixmap, Colormap cmap);
|
||||
#endif
|
||||
|
||||
#ifndef GLX_MESA_release_buffers
|
||||
#define GLX_MESA_release_buffers 1
|
||||
#ifdef GLX_GLXEXT_PROTOTYPES
|
||||
extern Bool glXReleaseBuffersMESA (Display *, GLXDrawable);
|
||||
#endif /* GLX_GLXEXT_PROTOTYPES */
|
||||
typedef Bool ( * PFNGLXRELEASEBUFFERSMESAPROC) (Display *dpy, GLXDrawable drawable);
|
||||
#endif
|
||||
|
||||
#ifndef GLX_MESA_set_3dfx_mode
|
||||
#define GLX_MESA_set_3dfx_mode 1
|
||||
#ifdef GLX_GLXEXT_PROTOTYPES
|
||||
extern Bool glXSet3DfxModeMESA (int);
|
||||
#endif /* GLX_GLXEXT_PROTOTYPES */
|
||||
typedef Bool ( * PFNGLXSET3DFXMODEMESAPROC) (int mode);
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,252 @@
|
||||
#ifndef __glxtokens_h__
|
||||
#define __glxtokens_h__
|
||||
|
||||
/*
|
||||
** The contents of this file are subject to the GLX Public License Version 1.0
|
||||
** (the "License"). You may not use this file except in compliance with the
|
||||
** License. You may obtain a copy of the License at Silicon Graphics, Inc.,
|
||||
** attn: Legal Services, 2011 N. Shoreline Blvd., Mountain View, CA 94043
|
||||
** or at http://www.sgi.com/software/opensource/glx/license.html.
|
||||
**
|
||||
** Software distributed under the License is distributed on an "AS IS"
|
||||
** basis. ALL WARRANTIES ARE DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY
|
||||
** IMPLIED WARRANTIES OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
|
||||
** PURPOSE OR OF NON- INFRINGEMENT. See the License for the specific
|
||||
** language governing rights and limitations under the License.
|
||||
**
|
||||
** The Original Software is GLX version 1.2 source code, released February,
|
||||
** 1999. The developer of the Original Software is Silicon Graphics, Inc.
|
||||
** Those portions of the Subject Software created by Silicon Graphics, Inc.
|
||||
** are Copyright (c) 1991-9 Silicon Graphics, Inc. All Rights Reserved.
|
||||
**
|
||||
** $Header: /teleimm/telev/inc/GL/glxtokens.h,v 1.1 2006/01/05 03:28:50 zerocool Exp $
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define GLX_VERSION_1_1 1
|
||||
#define GLX_VERSION_1_2 1
|
||||
|
||||
/*
|
||||
* Names for attributes to glXGetConfig.
|
||||
*/
|
||||
#define GLX_USE_GL 1 /* support GLX rendering */
|
||||
#define GLX_BUFFER_SIZE 2 /* depth of the color buffer */
|
||||
#define GLX_LEVEL 3 /* level in plane stacking */
|
||||
#define GLX_RGBA 4 /* true if RGBA mode */
|
||||
#define GLX_DOUBLEBUFFER 5 /* double buffering supported */
|
||||
#define GLX_STEREO 6 /* stereo buffering supported */
|
||||
#define GLX_AUX_BUFFERS 7 /* number of aux buffers */
|
||||
#define GLX_RED_SIZE 8 /* number of red component bits */
|
||||
#define GLX_GREEN_SIZE 9 /* number of green component bits */
|
||||
#define GLX_BLUE_SIZE 10 /* number of blue component bits */
|
||||
#define GLX_ALPHA_SIZE 11 /* number of alpha component bits */
|
||||
#define GLX_DEPTH_SIZE 12 /* number of depth bits */
|
||||
#define GLX_STENCIL_SIZE 13 /* number of stencil bits */
|
||||
#define GLX_ACCUM_RED_SIZE 14 /* number of red accum bits */
|
||||
#define GLX_ACCUM_GREEN_SIZE 15 /* number of green accum bits */
|
||||
#define GLX_ACCUM_BLUE_SIZE 16 /* number of blue accum bits */
|
||||
#define GLX_ACCUM_ALPHA_SIZE 17 /* number of alpha accum bits */
|
||||
|
||||
#define GLX_SAMPLE_BUFFERS_ARB 100000 /* number of multisample buffers */
|
||||
#define GLX_SAMPLES_ARB 100001 /* number of multisample samples */
|
||||
|
||||
/*
|
||||
* FBConfig-specific attributes
|
||||
*/
|
||||
#define GLX_X_VISUAL_TYPE 0x22
|
||||
#define GLX_CONFIG_CAVEAT 0x20 /* Like visual_info VISUAL_CAVEAT */
|
||||
#define GLX_TRANSPARENT_TYPE 0x23
|
||||
#define GLX_TRANSPARENT_INDEX_VALUE 0x24
|
||||
#define GLX_TRANSPARENT_RED_VALUE 0x25
|
||||
#define GLX_TRANSPARENT_GREEN_VALUE 0x26
|
||||
#define GLX_TRANSPARENT_BLUE_VALUE 0x27
|
||||
#define GLX_TRANSPARENT_ALPHA_VALUE 0x28
|
||||
#define GLX_DRAWABLE_TYPE 0x8010
|
||||
#define GLX_RENDER_TYPE 0x8011
|
||||
#define GLX_X_RENDERABLE 0x8012
|
||||
#define GLX_FBCONFIG_ID 0x8013
|
||||
#define GLX_MAX_PBUFFER_WIDTH 0x8016
|
||||
#define GLX_MAX_PBUFFER_HEIGHT 0x8017
|
||||
#define GLX_MAX_PBUFFER_PIXELS 0x8018
|
||||
#define GLX_VISUAL_ID 0x800B
|
||||
|
||||
#define GLX_DRAWABLE_TYPE_SGIX GLX_DRAWABLE_TYPE
|
||||
#define GLX_RENDER_TYPE_SGIX GLX_RENDER_TYPE
|
||||
#define GLX_X_RENDERABLE_SGIX GLX_X_RENDERABLE
|
||||
#define GLX_FBCONFIG_ID_SGIX GLX_FBCONFIG_ID
|
||||
#define GLX_MAX_PBUFFER_WIDTH_SGIX GLX_MAX_PBUFFER_WIDTH
|
||||
#define GLX_MAX_PBUFFER_HEIGHT_SGIX GLX_MAX_PBUFFER_HEIGHT
|
||||
#define GLX_MAX_PBUFFER_PIXELS_SGIX GLX_MAX_PBUFFER_PIXELS
|
||||
#define GLX_OPTIMAL_PBUFFER_WIDTH_SGIX 0x8019
|
||||
#define GLX_OPTIMAL_PBUFFER_HEIGHT_SGIX 0x801A
|
||||
|
||||
/*
|
||||
* Error return values from glXGetConfig. Success is indicated by
|
||||
* a value of 0.
|
||||
*/
|
||||
#define GLX_BAD_SCREEN 1 /* screen # is bad */
|
||||
#define GLX_BAD_ATTRIBUTE 2 /* attribute to get is bad */
|
||||
#define GLX_NO_EXTENSION 3 /* no glx extension on server */
|
||||
#define GLX_BAD_VISUAL 4 /* visual # not known by GLX */
|
||||
#define GLX_BAD_CONTEXT 5
|
||||
#define GLX_BAD_VALUE 6
|
||||
#define GLX_BAD_ENUM 7
|
||||
|
||||
|
||||
/* FBConfig attribute values */
|
||||
|
||||
/*
|
||||
* Generic "don't care" value for glX ChooseFBConfig attributes (except
|
||||
* GLX_LEVEL).
|
||||
*/
|
||||
#define GLX_DONT_CARE 0xFFFFFFFF
|
||||
|
||||
/* GLX_RENDER_TYPE bits */
|
||||
#define GLX_RGBA_BIT 0x00000001
|
||||
#define GLX_COLOR_INDEX_BIT 0x00000002
|
||||
#define GLX_RGBA_BIT_SGIX GLX_RGBA_BIT
|
||||
#define GLX_COLOR_INDEX_BIT_SGIX GLX_COLOR_INDEX_BIT
|
||||
|
||||
/* GLX_DRAWABLE_TYPE bits */
|
||||
#define GLX_WINDOW_BIT 0x00000001
|
||||
#define GLX_PIXMAP_BIT 0x00000002
|
||||
#define GLX_PBUFFER_BIT 0x00000004
|
||||
#define GLX_WINDOW_BIT_SGIX GLX_WINDOW_BIT
|
||||
#define GLX_PIXMAP_BIT_SGIX GLX_PIXMAP_BIT
|
||||
#define GLX_PBUFFER_BIT_SGIX GLX_PBUFFER_BIT
|
||||
|
||||
/* GLX_CONFIG_CAVEAT attribute values */
|
||||
#define GLX_NONE 0x8000
|
||||
#define GLX_SLOW_CONFIG 0x8001
|
||||
#define GLX_NON_CONFORMANT_CONFIG 0x800D
|
||||
|
||||
/* GLX_X_VISUAL_TYPE attribute values */
|
||||
#define GLX_TRUE_COLOR 0x8002
|
||||
#define GLX_DIRECT_COLOR 0x8003
|
||||
#define GLX_PSEUDO_COLOR 0x8004
|
||||
#define GLX_STATIC_COLOR 0x8005
|
||||
#define GLX_GRAY_SCALE 0x8006
|
||||
#define GLX_STATIC_GRAY 0x8007
|
||||
|
||||
/* GLX_TRANSPARENT_TYPE attribute values */
|
||||
/* #define GLX_NONE 0x8000 */
|
||||
#define GLX_TRANSPARENT_RGB 0x8008
|
||||
#define GLX_TRANSPARENT_INDEX 0x8009
|
||||
|
||||
/* glXCreateGLXPbuffer attributes */
|
||||
#define GLX_PRESERVED_CONTENTS 0x801B
|
||||
#define GLX_LARGEST_PBUFFER 0x801C
|
||||
#define GLX_PBUFFER_HEIGHT 0x8040 /* New for GLX 1.3 */
|
||||
#define GLX_PBUFFER_WIDTH 0x8041 /* New for GLX 1.3 */
|
||||
#define GLX_PRESERVED_CONTENTS_SGIX GLX_PRESERVED_CONTENTS
|
||||
#define GLX_LARGEST_PBUFFER_SGIX GLX_LARGEST_PBUFFER
|
||||
|
||||
/* glXQueryGLXPBuffer attributes */
|
||||
#define GLX_WIDTH 0x801D
|
||||
#define GLX_HEIGHT 0x801E
|
||||
#define GLX_EVENT_MASK 0x801F
|
||||
#define GLX_WIDTH_SGIX GLX_WIDTH
|
||||
#define GLX_HEIGHT_SGIX GLX_HEIGHT
|
||||
#define GLX_EVENT_MASK_SGIX GLX_EVENT_MASK
|
||||
|
||||
/* glXCreateNewContext render_type attribute values */
|
||||
#define GLX_RGBA_TYPE 0x8014
|
||||
#define GLX_COLOR_INDEX_TYPE 0x8015
|
||||
#define GLX_RGBA_TYPE_SGIX GLX_RGBA_TYPE
|
||||
#define GLX_COLOR_INDEX_TYPE_SGIX GLX_COLOR_INDEX_TYPE
|
||||
|
||||
/* glXQueryContext attributes */
|
||||
/* #define GLX_FBCONFIG_ID 0x8013 */
|
||||
/* #define GLX_RENDER_TYPE 0x8011 */
|
||||
#define GLX_SCREEN 0x800C
|
||||
|
||||
/* glXSelectEvent event mask bits */
|
||||
#define GLX_PBUFFER_CLOBBER_MASK 0x08000000
|
||||
#define GLX_PBUFFER_CLOBBER_MASK_SGIX GLX_PBUFFER_CLOBBER_MASK
|
||||
|
||||
/* GLXPbufferClobberEvent event_type values */
|
||||
#define GLX_DAMAGED 0x8020
|
||||
#define GLX_SAVED 0x8021
|
||||
#define GLX_DAMAGED_SGIX GLX_DAMAGED
|
||||
#define GLX_SAVED_SGIX GLX_SAVED
|
||||
|
||||
/* GLXPbufferClobberEvent draw_type values */
|
||||
#define GLX_WINDOW 0x8022
|
||||
#define GLX_PBUFFER 0x8023
|
||||
#define GLX_WINDOW_SGIX GLX_WINDOW
|
||||
#define GLX_PBUFFER_SGIX GLX_PBUFFER
|
||||
|
||||
/* GLXPbufferClobberEvent buffer_mask bits */
|
||||
#define GLX_FRONT_LEFT_BUFFER_BIT 0x00000001
|
||||
#define GLX_FRONT_RIGHT_BUFFER_BIT 0x00000002
|
||||
#define GLX_BACK_LEFT_BUFFER_BIT 0x00000004
|
||||
#define GLX_BACK_RIGHT_BUFFER_BIT 0x00000008
|
||||
#define GLX_AUX_BUFFERS_BIT 0x00000010
|
||||
#define GLX_DEPTH_BUFFER_BIT 0x00000020
|
||||
#define GLX_STENCIL_BUFFER_BIT 0x00000040
|
||||
#define GLX_ACCUM_BUFFER_BIT 0x00000080
|
||||
#define GLX_FRONT_LEFT_BUFFER_BIT_SGIX GLX_FRONT_LEFT_BUFFER_BIT
|
||||
#define GLX_FRONT_RIGHT_BUFFER_BIT_SGIX GLX_FRONT_RIGHT_BUFFER_BIT
|
||||
#define GLX_BACK_LEFT_BUFFER_BIT_SGIX GLX_BACK_LEFT_BUFFER_BIT
|
||||
#define GLX_BACK_RIGHT_BUFFER_BIT_SGIX GLX_BACK_RIGHT_BUFFER_BIT
|
||||
#define GLX_AUX_BUFFERS_BIT_SGIX GLX_AUX_BUFFERS_BIT
|
||||
#define GLX_DEPTH_BUFFER_BIT_SGIX GLX_DEPTH_BUFFER_BIT
|
||||
#define GLX_STENCIL_BUFFER_BIT_SGIX GLX_STENCIL_BUFFER_BIT
|
||||
#define GLX_ACCUM_BUFFER_BIT_SGIX GLX_ACCUM_BUFFER_BIT
|
||||
|
||||
/*
|
||||
* Extension return values from glXGetConfig. These are also
|
||||
* accepted as parameter values for glXChooseVisual.
|
||||
*/
|
||||
|
||||
#define GLX_X_VISUAL_TYPE_EXT 0x22 /* visual_info extension type */
|
||||
#define GLX_TRANSPARENT_TYPE_EXT 0x23 /* visual_info extension */
|
||||
#define GLX_TRANSPARENT_INDEX_VALUE_EXT 0x24 /* visual_info extension */
|
||||
#define GLX_TRANSPARENT_RED_VALUE_EXT 0x25 /* visual_info extension */
|
||||
#define GLX_TRANSPARENT_GREEN_VALUE_EXT 0x26 /* visual_info extension */
|
||||
#define GLX_TRANSPARENT_BLUE_VALUE_EXT 0x27 /* visual_info extension */
|
||||
#define GLX_TRANSPARENT_ALPHA_VALUE_EXT 0x28 /* visual_info extension */
|
||||
|
||||
/* Property values for visual_type */
|
||||
#define GLX_TRUE_COLOR_EXT 0x8002
|
||||
#define GLX_DIRECT_COLOR_EXT 0x8003
|
||||
#define GLX_PSEUDO_COLOR_EXT 0x8004
|
||||
#define GLX_STATIC_COLOR_EXT 0x8005
|
||||
#define GLX_GRAY_SCALE_EXT 0x8006
|
||||
#define GLX_STATIC_GRAY_EXT 0x8007
|
||||
|
||||
/* Property values for transparent pixel */
|
||||
#define GLX_NONE_EXT 0x8000
|
||||
#define GLX_TRANSPARENT_RGB_EXT 0x8008
|
||||
#define GLX_TRANSPARENT_INDEX_EXT 0x8009
|
||||
|
||||
/* Property values for visual_rating */
|
||||
#define GLX_VISUAL_CAVEAT_EXT 0x20 /* visual_rating extension type */
|
||||
#define GLX_SLOW_VISUAL_EXT 0x8001
|
||||
#define GLX_NON_CONFORMANT_VISUAL_EXT 0x800D
|
||||
|
||||
/*
|
||||
* Names for attributes to glXGetClientString.
|
||||
*/
|
||||
#define GLX_VENDOR 0x1
|
||||
#define GLX_VERSION 0x2
|
||||
#define GLX_EXTENSIONS 0x3
|
||||
|
||||
/*
|
||||
* Names for attributes to glXQueryContextInfoEXT.
|
||||
*/
|
||||
#define GLX_SHARE_CONTEXT_EXT 0x800A /* id of share context */
|
||||
#define GLX_VISUAL_ID_EXT 0x800B /* id of context's visual */
|
||||
#define GLX_SCREEN_EXT 0x800C /* screen number */
|
||||
|
||||
/* NV_float_buffer */
|
||||
#define GLX_FLOAT_COMPONENTS_NV 0x20B0
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !__glxtokens_h__ */
|
||||
@@ -0,0 +1,205 @@
|
||||
/*
|
||||
* tube.h
|
||||
*
|
||||
* FUNCTION:
|
||||
* Tubing and Extrusion header file.
|
||||
* This file provides protypes and defines for the extrusion
|
||||
* and tubing primitives.
|
||||
*
|
||||
* HISTORY:
|
||||
* Linas Vepstas 1990, 1991
|
||||
*/
|
||||
|
||||
#ifndef __TUBE_H__
|
||||
#define __TUBE_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
GLE API revision history:
|
||||
|
||||
GLE_API_VERSION is updated to reflect GLE API changes (interface
|
||||
changes, semantic changes, deletions, or additions).
|
||||
|
||||
GLE_API_VERSION=228 GLUT 3.7 release of GLE.
|
||||
**/
|
||||
#ifndef GLE_API_VERSION /* allow this to be overriden */
|
||||
#define GLE_API_VERSION 228
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
#define OPENGL_10
|
||||
#endif
|
||||
|
||||
/* some types */
|
||||
#define gleDouble double
|
||||
typedef gleDouble gleAffine[2][3];
|
||||
|
||||
/* ====================================================== */
|
||||
|
||||
/* defines for tubing join styles */
|
||||
#define TUBE_JN_RAW 0x1
|
||||
#define TUBE_JN_ANGLE 0x2
|
||||
#define TUBE_JN_CUT 0x3
|
||||
#define TUBE_JN_ROUND 0x4
|
||||
#define TUBE_JN_MASK 0xf /* mask bits */
|
||||
#define TUBE_JN_CAP 0x10
|
||||
|
||||
/* determine how normal vectors are to be handled */
|
||||
#define TUBE_NORM_FACET 0x100
|
||||
#define TUBE_NORM_EDGE 0x200
|
||||
#define TUBE_NORM_PATH_EDGE 0x400 /* for spiral, lathe, helix primitives */
|
||||
#define TUBE_NORM_MASK 0xf00 /* mask bits */
|
||||
|
||||
/* closed or open countours */
|
||||
#define TUBE_CONTOUR_CLOSED 0x1000
|
||||
|
||||
#define GLE_TEXTURE_ENABLE 0x10000
|
||||
#define GLE_TEXTURE_STYLE_MASK 0xff
|
||||
#define GLE_TEXTURE_VERTEX_FLAT 1
|
||||
#define GLE_TEXTURE_NORMAL_FLAT 2
|
||||
#define GLE_TEXTURE_VERTEX_CYL 3
|
||||
#define GLE_TEXTURE_NORMAL_CYL 4
|
||||
#define GLE_TEXTURE_VERTEX_SPH 5
|
||||
#define GLE_TEXTURE_NORMAL_SPH 6
|
||||
#define GLE_TEXTURE_VERTEX_MODEL_FLAT 7
|
||||
#define GLE_TEXTURE_NORMAL_MODEL_FLAT 8
|
||||
#define GLE_TEXTURE_VERTEX_MODEL_CYL 9
|
||||
#define GLE_TEXTURE_NORMAL_MODEL_CYL 10
|
||||
#define GLE_TEXTURE_VERTEX_MODEL_SPH 11
|
||||
#define GLE_TEXTURE_NORMAL_MODEL_SPH 12
|
||||
|
||||
#ifdef GL_32
|
||||
/* HACK for GL 3.2 -- needed because no way to tell if lighting is on. */
|
||||
#define TUBE_LIGHTING_ON 0x80000000
|
||||
|
||||
#define gleExtrusion extrusion
|
||||
#define gleSetJoinStyle setjoinstyle
|
||||
#define gleGetJoinStyle getjoinstyle
|
||||
#define glePolyCone polycone
|
||||
#define glePolyCylinder polycylinder
|
||||
#define gleSuperExtrusion super_extrusion
|
||||
#define gleTwistExtrusion twist_extrusion
|
||||
#define gleSpiral spiral
|
||||
#define gleLathe lathe
|
||||
#define gleHelicoid helicoid
|
||||
#define gleToroid toroid
|
||||
#define gleScrew screw
|
||||
|
||||
#endif /* GL_32 */
|
||||
|
||||
extern int gleGetJoinStyle (void);
|
||||
extern void gleSetJoinStyle (int style); /* bitwise OR of flags */
|
||||
extern int gleGetNumSlices(void);
|
||||
extern void gleSetNumSlices(int slices);
|
||||
|
||||
/* draw polyclinder, specified as a polyline */
|
||||
extern void glePolyCylinder (int npoints, /* num points in polyline */
|
||||
gleDouble point_array[][3], /* polyline vertces */
|
||||
float color_array[][3], /* colors at polyline verts */
|
||||
gleDouble radius); /* radius of polycylinder */
|
||||
|
||||
/* draw polycone, specified as a polyline with radii */
|
||||
extern void glePolyCone (int npoints, /* numpoints in poly-line */
|
||||
gleDouble point_array[][3], /* polyline vertices */
|
||||
float color_array[][3], /* colors at polyline verts */
|
||||
gleDouble radius_array[]); /* cone radii at polyline verts */
|
||||
|
||||
/* extrude arbitrary 2D contour along arbitrary 3D path */
|
||||
extern void gleExtrusion (int ncp, /* number of contour points */
|
||||
gleDouble contour[][2], /* 2D contour */
|
||||
gleDouble cont_normal[][2], /* 2D contour normals */
|
||||
gleDouble up[3], /* up vector for contour */
|
||||
int npoints, /* numpoints in poly-line */
|
||||
gleDouble point_array[][3], /* polyline vertices */
|
||||
float color_array[][3]); /* colors at polyline verts */
|
||||
|
||||
/* extrude 2D contour, specifying local rotations (twists) */
|
||||
extern void gleTwistExtrusion (int ncp, /* number of contour points */
|
||||
gleDouble contour[][2], /* 2D contour */
|
||||
gleDouble cont_normal[][2], /* 2D contour normals */
|
||||
gleDouble up[3], /* up vector for contour */
|
||||
int npoints, /* numpoints in poly-line */
|
||||
gleDouble point_array[][3], /* polyline vertices */
|
||||
float color_array[][3], /* color at polyline verts */
|
||||
gleDouble twist_array[]); /* countour twists (in degrees) */
|
||||
|
||||
/* extrude 2D contour, specifying local affine tranformations */
|
||||
extern void gleSuperExtrusion (int ncp, /* number of contour points */
|
||||
gleDouble contour[][2], /* 2D contour */
|
||||
gleDouble cont_normal[][2], /* 2D contour normals */
|
||||
gleDouble up[3], /* up vector for contour */
|
||||
int npoints, /* numpoints in poly-line */
|
||||
gleDouble point_array[][3], /* polyline vertices */
|
||||
float color_array[][3], /* color at polyline verts */
|
||||
gleDouble xform_array[][2][3]); /* 2D contour xforms */
|
||||
|
||||
/* spiral moves contour along helical path by parallel transport */
|
||||
extern void gleSpiral (int ncp, /* number of contour points */
|
||||
gleDouble contour[][2], /* 2D contour */
|
||||
gleDouble cont_normal[][2], /* 2D contour normals */
|
||||
gleDouble up[3], /* up vector for contour */
|
||||
gleDouble startRadius, /* spiral starts in x-y plane */
|
||||
gleDouble drdTheta, /* change in radius per revolution */
|
||||
gleDouble startZ, /* starting z value */
|
||||
gleDouble dzdTheta, /* change in Z per revolution */
|
||||
gleDouble startXform[2][3], /* starting contour affine xform */
|
||||
gleDouble dXformdTheta[2][3], /* tangent change xform per revoln */
|
||||
gleDouble startTheta, /* start angle in x-y plane */
|
||||
gleDouble sweepTheta); /* degrees to spiral around */
|
||||
|
||||
/* lathe moves contour along helical path by helically shearing 3D space */
|
||||
extern void gleLathe (int ncp, /* number of contour points */
|
||||
gleDouble contour[][2], /* 2D contour */
|
||||
gleDouble cont_normal[][2], /* 2D contour normals */
|
||||
gleDouble up[3], /* up vector for contour */
|
||||
gleDouble startRadius, /* spiral starts in x-y plane */
|
||||
gleDouble drdTheta, /* change in radius per revolution */
|
||||
gleDouble startZ, /* starting z value */
|
||||
gleDouble dzdTheta, /* change in Z per revolution */
|
||||
gleDouble startXform[2][3], /* starting contour affine xform */
|
||||
gleDouble dXformdTheta[2][3], /* tangent change xform per revoln */
|
||||
gleDouble startTheta, /* start angle in x-y plane */
|
||||
gleDouble sweepTheta); /* degrees to spiral around */
|
||||
|
||||
/* similar to spiral, except contour is a circle */
|
||||
extern void gleHelicoid (gleDouble rToroid, /* circle contour (torus) radius */
|
||||
gleDouble startRadius, /* spiral starts in x-y plane */
|
||||
gleDouble drdTheta, /* change in radius per revolution */
|
||||
gleDouble startZ, /* starting z value */
|
||||
gleDouble dzdTheta, /* change in Z per revolution */
|
||||
gleDouble startXform[2][3], /* starting contour affine xform */
|
||||
gleDouble dXformdTheta[2][3], /* tangent change xform per revoln */
|
||||
gleDouble startTheta, /* start angle in x-y plane */
|
||||
gleDouble sweepTheta); /* degrees to spiral around */
|
||||
|
||||
/* similar to lathe, except contour is a circle */
|
||||
extern void gleToroid (gleDouble rToroid, /* circle contour (torus) radius */
|
||||
gleDouble startRadius, /* spiral starts in x-y plane */
|
||||
gleDouble drdTheta, /* change in radius per revolution */
|
||||
gleDouble startZ, /* starting z value */
|
||||
gleDouble dzdTheta, /* change in Z per revolution */
|
||||
gleDouble startXform[2][3], /* starting contour affine xform */
|
||||
gleDouble dXformdTheta[2][3], /* tangent change xform per revoln */
|
||||
gleDouble startTheta, /* start angle in x-y plane */
|
||||
gleDouble sweepTheta); /* degrees to spiral around */
|
||||
|
||||
/* draws a screw shape */
|
||||
extern void gleScrew (int ncp, /* number of contour points */
|
||||
gleDouble contour[][2], /* 2D contour */
|
||||
gleDouble cont_normal[][2], /* 2D contour normals */
|
||||
gleDouble up[3], /* up vector for contour */
|
||||
gleDouble startz, /* start of segment */
|
||||
gleDouble endz, /* end of segment */
|
||||
gleDouble twist); /* number of rotations */
|
||||
|
||||
extern void gleTextureMode (int mode);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif /* __TUBE_H__ */
|
||||
/* ================== END OF FILE ======================= */
|
||||
@@ -0,0 +1,998 @@
|
||||
/*
|
||||
** The OpenGL Extension Wrangler Library
|
||||
** Copyright (C) 2002-2007, Milan Ikits <milan ikits[]ieee org>
|
||||
** Copyright (C) 2002-2007, Marcelo E. Magallon <mmagallo[]debian org>
|
||||
** Copyright (C) 2002, Lev Povalahev
|
||||
** All rights reserved.
|
||||
**
|
||||
** Redistribution and use in source and binary forms, with or without
|
||||
** modification, are permitted provided that the following conditions are met:
|
||||
**
|
||||
** * Redistributions of source code must retain the above copyright notice,
|
||||
** this list of conditions and the following disclaimer.
|
||||
** * Redistributions in binary form must reproduce the above copyright notice,
|
||||
** this list of conditions and the following disclaimer in the documentation
|
||||
** and/or other materials provided with the distribution.
|
||||
** * The name of the author may be used to endorse or promote products
|
||||
** derived from this software without specific prior written permission.
|
||||
**
|
||||
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||
** THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef __wglew_h__
|
||||
#define __wglew_h__
|
||||
#define __WGLEW_H__
|
||||
|
||||
#ifdef __wglext_h_
|
||||
#error wglext.h included before wglew.h
|
||||
#endif
|
||||
|
||||
#define __wglext_h_
|
||||
|
||||
#if !defined(APIENTRY) && !defined(__CYGWIN__)
|
||||
# ifndef WIN32_LEAN_AND_MEAN
|
||||
# define WIN32_LEAN_AND_MEAN 1
|
||||
# endif
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* GLEW_STATIC needs to be set when using the static version.
|
||||
* GLEW_BUILD is set when building the DLL version.
|
||||
*/
|
||||
#ifdef GLEW_STATIC
|
||||
# define GLEWAPI extern
|
||||
#else
|
||||
# ifdef GLEW_BUILD
|
||||
# define GLEWAPI extern __declspec(dllexport)
|
||||
# else
|
||||
# define GLEWAPI extern __declspec(dllimport)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* -------------------------- WGL_3DFX_multisample ------------------------- */
|
||||
|
||||
#ifndef WGL_3DFX_multisample
|
||||
#define WGL_3DFX_multisample 1
|
||||
|
||||
#define WGL_SAMPLE_BUFFERS_3DFX 0x2060
|
||||
#define WGL_SAMPLES_3DFX 0x2061
|
||||
|
||||
#define WGLEW_3DFX_multisample WGLEW_GET_VAR(__WGLEW_3DFX_multisample)
|
||||
|
||||
#endif /* WGL_3DFX_multisample */
|
||||
|
||||
/* ------------------------- WGL_3DL_stereo_control ------------------------ */
|
||||
|
||||
#ifndef WGL_3DL_stereo_control
|
||||
#define WGL_3DL_stereo_control 1
|
||||
|
||||
#define WGL_STEREO_EMITTER_ENABLE_3DL 0x2055
|
||||
#define WGL_STEREO_EMITTER_DISABLE_3DL 0x2056
|
||||
#define WGL_STEREO_POLARITY_NORMAL_3DL 0x2057
|
||||
#define WGL_STEREO_POLARITY_INVERT_3DL 0x2058
|
||||
|
||||
typedef BOOL (WINAPI * PFNWGLSETSTEREOEMITTERSTATE3DLPROC) (HDC hDC, UINT uState);
|
||||
|
||||
#define wglSetStereoEmitterState3DL WGLEW_GET_FUN(__wglewSetStereoEmitterState3DL)
|
||||
|
||||
#define WGLEW_3DL_stereo_control WGLEW_GET_VAR(__WGLEW_3DL_stereo_control)
|
||||
|
||||
#endif /* WGL_3DL_stereo_control */
|
||||
|
||||
/* ------------------------- WGL_ARB_buffer_region ------------------------- */
|
||||
|
||||
#ifndef WGL_ARB_buffer_region
|
||||
#define WGL_ARB_buffer_region 1
|
||||
|
||||
#define WGL_FRONT_COLOR_BUFFER_BIT_ARB 0x00000001
|
||||
#define WGL_BACK_COLOR_BUFFER_BIT_ARB 0x00000002
|
||||
#define WGL_DEPTH_BUFFER_BIT_ARB 0x00000004
|
||||
#define WGL_STENCIL_BUFFER_BIT_ARB 0x00000008
|
||||
|
||||
typedef HANDLE (WINAPI * PFNWGLCREATEBUFFERREGIONARBPROC) (HDC hDC, int iLayerPlane, UINT uType);
|
||||
typedef VOID (WINAPI * PFNWGLDELETEBUFFERREGIONARBPROC) (HANDLE hRegion);
|
||||
typedef BOOL (WINAPI * PFNWGLRESTOREBUFFERREGIONARBPROC) (HANDLE hRegion, int x, int y, int width, int height, int xSrc, int ySrc);
|
||||
typedef BOOL (WINAPI * PFNWGLSAVEBUFFERREGIONARBPROC) (HANDLE hRegion, int x, int y, int width, int height);
|
||||
|
||||
#define wglCreateBufferRegionARB WGLEW_GET_FUN(__wglewCreateBufferRegionARB)
|
||||
#define wglDeleteBufferRegionARB WGLEW_GET_FUN(__wglewDeleteBufferRegionARB)
|
||||
#define wglRestoreBufferRegionARB WGLEW_GET_FUN(__wglewRestoreBufferRegionARB)
|
||||
#define wglSaveBufferRegionARB WGLEW_GET_FUN(__wglewSaveBufferRegionARB)
|
||||
|
||||
#define WGLEW_ARB_buffer_region WGLEW_GET_VAR(__WGLEW_ARB_buffer_region)
|
||||
|
||||
#endif /* WGL_ARB_buffer_region */
|
||||
|
||||
/* ----------------------- WGL_ARB_extensions_string ----------------------- */
|
||||
|
||||
#ifndef WGL_ARB_extensions_string
|
||||
#define WGL_ARB_extensions_string 1
|
||||
|
||||
typedef const char* (WINAPI * PFNWGLGETEXTENSIONSSTRINGARBPROC) (HDC hdc);
|
||||
|
||||
#define wglGetExtensionsStringARB WGLEW_GET_FUN(__wglewGetExtensionsStringARB)
|
||||
|
||||
#define WGLEW_ARB_extensions_string WGLEW_GET_VAR(__WGLEW_ARB_extensions_string)
|
||||
|
||||
#endif /* WGL_ARB_extensions_string */
|
||||
|
||||
/* ----------------------- WGL_ARB_make_current_read ----------------------- */
|
||||
|
||||
#ifndef WGL_ARB_make_current_read
|
||||
#define WGL_ARB_make_current_read 1
|
||||
|
||||
typedef HDC (WINAPI * PFNWGLGETCURRENTREADDCARBPROC) (VOID);
|
||||
typedef BOOL (WINAPI * PFNWGLMAKECONTEXTCURRENTARBPROC) (HDC hDrawDC, HDC hReadDC, HGLRC hglrc);
|
||||
|
||||
#define wglGetCurrentReadDCARB WGLEW_GET_FUN(__wglewGetCurrentReadDCARB)
|
||||
#define wglMakeContextCurrentARB WGLEW_GET_FUN(__wglewMakeContextCurrentARB)
|
||||
|
||||
#define WGLEW_ARB_make_current_read WGLEW_GET_VAR(__WGLEW_ARB_make_current_read)
|
||||
|
||||
#endif /* WGL_ARB_make_current_read */
|
||||
|
||||
/* -------------------------- WGL_ARB_multisample -------------------------- */
|
||||
|
||||
#ifndef WGL_ARB_multisample
|
||||
#define WGL_ARB_multisample 1
|
||||
|
||||
#define WGL_SAMPLE_BUFFERS_ARB 0x2041
|
||||
#define WGL_SAMPLES_ARB 0x2042
|
||||
|
||||
#define WGLEW_ARB_multisample WGLEW_GET_VAR(__WGLEW_ARB_multisample)
|
||||
|
||||
#endif /* WGL_ARB_multisample */
|
||||
|
||||
/* ---------------------------- WGL_ARB_pbuffer ---------------------------- */
|
||||
|
||||
#ifndef WGL_ARB_pbuffer
|
||||
#define WGL_ARB_pbuffer 1
|
||||
|
||||
#define WGL_DRAW_TO_PBUFFER_ARB 0x202D
|
||||
#define WGL_MAX_PBUFFER_PIXELS_ARB 0x202E
|
||||
#define WGL_MAX_PBUFFER_WIDTH_ARB 0x202F
|
||||
#define WGL_MAX_PBUFFER_HEIGHT_ARB 0x2030
|
||||
#define WGL_PBUFFER_LARGEST_ARB 0x2033
|
||||
#define WGL_PBUFFER_WIDTH_ARB 0x2034
|
||||
#define WGL_PBUFFER_HEIGHT_ARB 0x2035
|
||||
#define WGL_PBUFFER_LOST_ARB 0x2036
|
||||
|
||||
DECLARE_HANDLE(HPBUFFERARB);
|
||||
|
||||
typedef HPBUFFERARB (WINAPI * PFNWGLCREATEPBUFFERARBPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int* piAttribList);
|
||||
typedef BOOL (WINAPI * PFNWGLDESTROYPBUFFERARBPROC) (HPBUFFERARB hPbuffer);
|
||||
typedef HDC (WINAPI * PFNWGLGETPBUFFERDCARBPROC) (HPBUFFERARB hPbuffer);
|
||||
typedef BOOL (WINAPI * PFNWGLQUERYPBUFFERARBPROC) (HPBUFFERARB hPbuffer, int iAttribute, int* piValue);
|
||||
typedef int (WINAPI * PFNWGLRELEASEPBUFFERDCARBPROC) (HPBUFFERARB hPbuffer, HDC hDC);
|
||||
|
||||
#define wglCreatePbufferARB WGLEW_GET_FUN(__wglewCreatePbufferARB)
|
||||
#define wglDestroyPbufferARB WGLEW_GET_FUN(__wglewDestroyPbufferARB)
|
||||
#define wglGetPbufferDCARB WGLEW_GET_FUN(__wglewGetPbufferDCARB)
|
||||
#define wglQueryPbufferARB WGLEW_GET_FUN(__wglewQueryPbufferARB)
|
||||
#define wglReleasePbufferDCARB WGLEW_GET_FUN(__wglewReleasePbufferDCARB)
|
||||
|
||||
#define WGLEW_ARB_pbuffer WGLEW_GET_VAR(__WGLEW_ARB_pbuffer)
|
||||
|
||||
#endif /* WGL_ARB_pbuffer */
|
||||
|
||||
/* -------------------------- WGL_ARB_pixel_format ------------------------- */
|
||||
|
||||
#ifndef WGL_ARB_pixel_format
|
||||
#define WGL_ARB_pixel_format 1
|
||||
|
||||
#define WGL_NUMBER_PIXEL_FORMATS_ARB 0x2000
|
||||
#define WGL_DRAW_TO_WINDOW_ARB 0x2001
|
||||
#define WGL_DRAW_TO_BITMAP_ARB 0x2002
|
||||
#define WGL_ACCELERATION_ARB 0x2003
|
||||
#define WGL_NEED_PALETTE_ARB 0x2004
|
||||
#define WGL_NEED_SYSTEM_PALETTE_ARB 0x2005
|
||||
#define WGL_SWAP_LAYER_BUFFERS_ARB 0x2006
|
||||
#define WGL_SWAP_METHOD_ARB 0x2007
|
||||
#define WGL_NUMBER_OVERLAYS_ARB 0x2008
|
||||
#define WGL_NUMBER_UNDERLAYS_ARB 0x2009
|
||||
#define WGL_TRANSPARENT_ARB 0x200A
|
||||
#define WGL_SHARE_DEPTH_ARB 0x200C
|
||||
#define WGL_SHARE_STENCIL_ARB 0x200D
|
||||
#define WGL_SHARE_ACCUM_ARB 0x200E
|
||||
#define WGL_SUPPORT_GDI_ARB 0x200F
|
||||
#define WGL_SUPPORT_OPENGL_ARB 0x2010
|
||||
#define WGL_DOUBLE_BUFFER_ARB 0x2011
|
||||
#define WGL_STEREO_ARB 0x2012
|
||||
#define WGL_PIXEL_TYPE_ARB 0x2013
|
||||
#define WGL_COLOR_BITS_ARB 0x2014
|
||||
#define WGL_RED_BITS_ARB 0x2015
|
||||
#define WGL_RED_SHIFT_ARB 0x2016
|
||||
#define WGL_GREEN_BITS_ARB 0x2017
|
||||
#define WGL_GREEN_SHIFT_ARB 0x2018
|
||||
#define WGL_BLUE_BITS_ARB 0x2019
|
||||
#define WGL_BLUE_SHIFT_ARB 0x201A
|
||||
#define WGL_ALPHA_BITS_ARB 0x201B
|
||||
#define WGL_ALPHA_SHIFT_ARB 0x201C
|
||||
#define WGL_ACCUM_BITS_ARB 0x201D
|
||||
#define WGL_ACCUM_RED_BITS_ARB 0x201E
|
||||
#define WGL_ACCUM_GREEN_BITS_ARB 0x201F
|
||||
#define WGL_ACCUM_BLUE_BITS_ARB 0x2020
|
||||
#define WGL_ACCUM_ALPHA_BITS_ARB 0x2021
|
||||
#define WGL_DEPTH_BITS_ARB 0x2022
|
||||
#define WGL_STENCIL_BITS_ARB 0x2023
|
||||
#define WGL_AUX_BUFFERS_ARB 0x2024
|
||||
#define WGL_NO_ACCELERATION_ARB 0x2025
|
||||
#define WGL_GENERIC_ACCELERATION_ARB 0x2026
|
||||
#define WGL_FULL_ACCELERATION_ARB 0x2027
|
||||
#define WGL_SWAP_EXCHANGE_ARB 0x2028
|
||||
#define WGL_SWAP_COPY_ARB 0x2029
|
||||
#define WGL_SWAP_UNDEFINED_ARB 0x202A
|
||||
#define WGL_TYPE_RGBA_ARB 0x202B
|
||||
#define WGL_TYPE_COLORINDEX_ARB 0x202C
|
||||
#define WGL_TRANSPARENT_RED_VALUE_ARB 0x2037
|
||||
#define WGL_TRANSPARENT_GREEN_VALUE_ARB 0x2038
|
||||
#define WGL_TRANSPARENT_BLUE_VALUE_ARB 0x2039
|
||||
#define WGL_TRANSPARENT_ALPHA_VALUE_ARB 0x203A
|
||||
#define WGL_TRANSPARENT_INDEX_VALUE_ARB 0x203B
|
||||
|
||||
typedef BOOL (WINAPI * PFNWGLCHOOSEPIXELFORMATARBPROC) (HDC hdc, const int* piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);
|
||||
typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBFVARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int* piAttributes, FLOAT *pfValues);
|
||||
typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int* piAttributes, int *piValues);
|
||||
|
||||
#define wglChoosePixelFormatARB WGLEW_GET_FUN(__wglewChoosePixelFormatARB)
|
||||
#define wglGetPixelFormatAttribfvARB WGLEW_GET_FUN(__wglewGetPixelFormatAttribfvARB)
|
||||
#define wglGetPixelFormatAttribivARB WGLEW_GET_FUN(__wglewGetPixelFormatAttribivARB)
|
||||
|
||||
#define WGLEW_ARB_pixel_format WGLEW_GET_VAR(__WGLEW_ARB_pixel_format)
|
||||
|
||||
#endif /* WGL_ARB_pixel_format */
|
||||
|
||||
/* ----------------------- WGL_ARB_pixel_format_float ---------------------- */
|
||||
|
||||
#ifndef WGL_ARB_pixel_format_float
|
||||
#define WGL_ARB_pixel_format_float 1
|
||||
|
||||
#define WGL_TYPE_RGBA_FLOAT_ARB 0x21A0
|
||||
|
||||
#define WGLEW_ARB_pixel_format_float WGLEW_GET_VAR(__WGLEW_ARB_pixel_format_float)
|
||||
|
||||
#endif /* WGL_ARB_pixel_format_float */
|
||||
|
||||
/* ------------------------- WGL_ARB_render_texture ------------------------ */
|
||||
|
||||
#ifndef WGL_ARB_render_texture
|
||||
#define WGL_ARB_render_texture 1
|
||||
|
||||
#define WGL_BIND_TO_TEXTURE_RGB_ARB 0x2070
|
||||
#define WGL_BIND_TO_TEXTURE_RGBA_ARB 0x2071
|
||||
#define WGL_TEXTURE_FORMAT_ARB 0x2072
|
||||
#define WGL_TEXTURE_TARGET_ARB 0x2073
|
||||
#define WGL_MIPMAP_TEXTURE_ARB 0x2074
|
||||
#define WGL_TEXTURE_RGB_ARB 0x2075
|
||||
#define WGL_TEXTURE_RGBA_ARB 0x2076
|
||||
#define WGL_NO_TEXTURE_ARB 0x2077
|
||||
#define WGL_TEXTURE_CUBE_MAP_ARB 0x2078
|
||||
#define WGL_TEXTURE_1D_ARB 0x2079
|
||||
#define WGL_TEXTURE_2D_ARB 0x207A
|
||||
#define WGL_MIPMAP_LEVEL_ARB 0x207B
|
||||
#define WGL_CUBE_MAP_FACE_ARB 0x207C
|
||||
#define WGL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB 0x207D
|
||||
#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB 0x207E
|
||||
#define WGL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB 0x207F
|
||||
#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB 0x2080
|
||||
#define WGL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB 0x2081
|
||||
#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB 0x2082
|
||||
#define WGL_FRONT_LEFT_ARB 0x2083
|
||||
#define WGL_FRONT_RIGHT_ARB 0x2084
|
||||
#define WGL_BACK_LEFT_ARB 0x2085
|
||||
#define WGL_BACK_RIGHT_ARB 0x2086
|
||||
#define WGL_AUX0_ARB 0x2087
|
||||
#define WGL_AUX1_ARB 0x2088
|
||||
#define WGL_AUX2_ARB 0x2089
|
||||
#define WGL_AUX3_ARB 0x208A
|
||||
#define WGL_AUX4_ARB 0x208B
|
||||
#define WGL_AUX5_ARB 0x208C
|
||||
#define WGL_AUX6_ARB 0x208D
|
||||
#define WGL_AUX7_ARB 0x208E
|
||||
#define WGL_AUX8_ARB 0x208F
|
||||
#define WGL_AUX9_ARB 0x2090
|
||||
|
||||
typedef BOOL (WINAPI * PFNWGLBINDTEXIMAGEARBPROC) (HPBUFFERARB hPbuffer, int iBuffer);
|
||||
typedef BOOL (WINAPI * PFNWGLRELEASETEXIMAGEARBPROC) (HPBUFFERARB hPbuffer, int iBuffer);
|
||||
typedef BOOL (WINAPI * PFNWGLSETPBUFFERATTRIBARBPROC) (HPBUFFERARB hPbuffer, const int* piAttribList);
|
||||
|
||||
#define wglBindTexImageARB WGLEW_GET_FUN(__wglewBindTexImageARB)
|
||||
#define wglReleaseTexImageARB WGLEW_GET_FUN(__wglewReleaseTexImageARB)
|
||||
#define wglSetPbufferAttribARB WGLEW_GET_FUN(__wglewSetPbufferAttribARB)
|
||||
|
||||
#define WGLEW_ARB_render_texture WGLEW_GET_VAR(__WGLEW_ARB_render_texture)
|
||||
|
||||
#endif /* WGL_ARB_render_texture */
|
||||
|
||||
/* ----------------------- WGL_ATI_pixel_format_float ---------------------- */
|
||||
|
||||
#ifndef WGL_ATI_pixel_format_float
|
||||
#define WGL_ATI_pixel_format_float 1
|
||||
|
||||
#define WGL_TYPE_RGBA_FLOAT_ATI 0x21A0
|
||||
#define GL_RGBA_FLOAT_MODE_ATI 0x8820
|
||||
#define GL_COLOR_CLEAR_UNCLAMPED_VALUE_ATI 0x8835
|
||||
|
||||
#define WGLEW_ATI_pixel_format_float WGLEW_GET_VAR(__WGLEW_ATI_pixel_format_float)
|
||||
|
||||
#endif /* WGL_ATI_pixel_format_float */
|
||||
|
||||
/* -------------------- WGL_ATI_render_texture_rectangle ------------------- */
|
||||
|
||||
#ifndef WGL_ATI_render_texture_rectangle
|
||||
#define WGL_ATI_render_texture_rectangle 1
|
||||
|
||||
#define WGL_TEXTURE_RECTANGLE_ATI 0x21A5
|
||||
|
||||
#define WGLEW_ATI_render_texture_rectangle WGLEW_GET_VAR(__WGLEW_ATI_render_texture_rectangle)
|
||||
|
||||
#endif /* WGL_ATI_render_texture_rectangle */
|
||||
|
||||
/* -------------------------- WGL_EXT_depth_float -------------------------- */
|
||||
|
||||
#ifndef WGL_EXT_depth_float
|
||||
#define WGL_EXT_depth_float 1
|
||||
|
||||
#define WGL_DEPTH_FLOAT_EXT 0x2040
|
||||
|
||||
#define WGLEW_EXT_depth_float WGLEW_GET_VAR(__WGLEW_EXT_depth_float)
|
||||
|
||||
#endif /* WGL_EXT_depth_float */
|
||||
|
||||
/* ---------------------- WGL_EXT_display_color_table ---------------------- */
|
||||
|
||||
#ifndef WGL_EXT_display_color_table
|
||||
#define WGL_EXT_display_color_table 1
|
||||
|
||||
typedef GLboolean (WINAPI * PFNWGLBINDDISPLAYCOLORTABLEEXTPROC) (GLushort id);
|
||||
typedef GLboolean (WINAPI * PFNWGLCREATEDISPLAYCOLORTABLEEXTPROC) (GLushort id);
|
||||
typedef void (WINAPI * PFNWGLDESTROYDISPLAYCOLORTABLEEXTPROC) (GLushort id);
|
||||
typedef GLboolean (WINAPI * PFNWGLLOADDISPLAYCOLORTABLEEXTPROC) (GLushort* table, GLuint length);
|
||||
|
||||
#define wglBindDisplayColorTableEXT WGLEW_GET_FUN(__wglewBindDisplayColorTableEXT)
|
||||
#define wglCreateDisplayColorTableEXT WGLEW_GET_FUN(__wglewCreateDisplayColorTableEXT)
|
||||
#define wglDestroyDisplayColorTableEXT WGLEW_GET_FUN(__wglewDestroyDisplayColorTableEXT)
|
||||
#define wglLoadDisplayColorTableEXT WGLEW_GET_FUN(__wglewLoadDisplayColorTableEXT)
|
||||
|
||||
#define WGLEW_EXT_display_color_table WGLEW_GET_VAR(__WGLEW_EXT_display_color_table)
|
||||
|
||||
#endif /* WGL_EXT_display_color_table */
|
||||
|
||||
/* ----------------------- WGL_EXT_extensions_string ----------------------- */
|
||||
|
||||
#ifndef WGL_EXT_extensions_string
|
||||
#define WGL_EXT_extensions_string 1
|
||||
|
||||
typedef const char* (WINAPI * PFNWGLGETEXTENSIONSSTRINGEXTPROC) (void);
|
||||
|
||||
#define wglGetExtensionsStringEXT WGLEW_GET_FUN(__wglewGetExtensionsStringEXT)
|
||||
|
||||
#define WGLEW_EXT_extensions_string WGLEW_GET_VAR(__WGLEW_EXT_extensions_string)
|
||||
|
||||
#endif /* WGL_EXT_extensions_string */
|
||||
|
||||
/* ------------------------ WGL_EXT_framebuffer_sRGB ----------------------- */
|
||||
|
||||
#ifndef WGL_EXT_framebuffer_sRGB
|
||||
#define WGL_EXT_framebuffer_sRGB 1
|
||||
|
||||
#define WGL_FRAMEBUFFER_SRGB_CAPABLE_EXT 0x20A9
|
||||
|
||||
#define WGLEW_EXT_framebuffer_sRGB WGLEW_GET_VAR(__WGLEW_EXT_framebuffer_sRGB)
|
||||
|
||||
#endif /* WGL_EXT_framebuffer_sRGB */
|
||||
|
||||
/* ----------------------- WGL_EXT_make_current_read ----------------------- */
|
||||
|
||||
#ifndef WGL_EXT_make_current_read
|
||||
#define WGL_EXT_make_current_read 1
|
||||
|
||||
typedef HDC (WINAPI * PFNWGLGETCURRENTREADDCEXTPROC) (VOID);
|
||||
typedef BOOL (WINAPI * PFNWGLMAKECONTEXTCURRENTEXTPROC) (HDC hDrawDC, HDC hReadDC, HGLRC hglrc);
|
||||
|
||||
#define wglGetCurrentReadDCEXT WGLEW_GET_FUN(__wglewGetCurrentReadDCEXT)
|
||||
#define wglMakeContextCurrentEXT WGLEW_GET_FUN(__wglewMakeContextCurrentEXT)
|
||||
|
||||
#define WGLEW_EXT_make_current_read WGLEW_GET_VAR(__WGLEW_EXT_make_current_read)
|
||||
|
||||
#endif /* WGL_EXT_make_current_read */
|
||||
|
||||
/* -------------------------- WGL_EXT_multisample -------------------------- */
|
||||
|
||||
#ifndef WGL_EXT_multisample
|
||||
#define WGL_EXT_multisample 1
|
||||
|
||||
#define WGL_SAMPLE_BUFFERS_EXT 0x2041
|
||||
#define WGL_SAMPLES_EXT 0x2042
|
||||
|
||||
#define WGLEW_EXT_multisample WGLEW_GET_VAR(__WGLEW_EXT_multisample)
|
||||
|
||||
#endif /* WGL_EXT_multisample */
|
||||
|
||||
/* ---------------------------- WGL_EXT_pbuffer ---------------------------- */
|
||||
|
||||
#ifndef WGL_EXT_pbuffer
|
||||
#define WGL_EXT_pbuffer 1
|
||||
|
||||
#define WGL_DRAW_TO_PBUFFER_EXT 0x202D
|
||||
#define WGL_MAX_PBUFFER_PIXELS_EXT 0x202E
|
||||
#define WGL_MAX_PBUFFER_WIDTH_EXT 0x202F
|
||||
#define WGL_MAX_PBUFFER_HEIGHT_EXT 0x2030
|
||||
#define WGL_OPTIMAL_PBUFFER_WIDTH_EXT 0x2031
|
||||
#define WGL_OPTIMAL_PBUFFER_HEIGHT_EXT 0x2032
|
||||
#define WGL_PBUFFER_LARGEST_EXT 0x2033
|
||||
#define WGL_PBUFFER_WIDTH_EXT 0x2034
|
||||
#define WGL_PBUFFER_HEIGHT_EXT 0x2035
|
||||
|
||||
DECLARE_HANDLE(HPBUFFEREXT);
|
||||
|
||||
typedef HPBUFFEREXT (WINAPI * PFNWGLCREATEPBUFFEREXTPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int* piAttribList);
|
||||
typedef BOOL (WINAPI * PFNWGLDESTROYPBUFFEREXTPROC) (HPBUFFEREXT hPbuffer);
|
||||
typedef HDC (WINAPI * PFNWGLGETPBUFFERDCEXTPROC) (HPBUFFEREXT hPbuffer);
|
||||
typedef BOOL (WINAPI * PFNWGLQUERYPBUFFEREXTPROC) (HPBUFFEREXT hPbuffer, int iAttribute, int* piValue);
|
||||
typedef int (WINAPI * PFNWGLRELEASEPBUFFERDCEXTPROC) (HPBUFFEREXT hPbuffer, HDC hDC);
|
||||
|
||||
#define wglCreatePbufferEXT WGLEW_GET_FUN(__wglewCreatePbufferEXT)
|
||||
#define wglDestroyPbufferEXT WGLEW_GET_FUN(__wglewDestroyPbufferEXT)
|
||||
#define wglGetPbufferDCEXT WGLEW_GET_FUN(__wglewGetPbufferDCEXT)
|
||||
#define wglQueryPbufferEXT WGLEW_GET_FUN(__wglewQueryPbufferEXT)
|
||||
#define wglReleasePbufferDCEXT WGLEW_GET_FUN(__wglewReleasePbufferDCEXT)
|
||||
|
||||
#define WGLEW_EXT_pbuffer WGLEW_GET_VAR(__WGLEW_EXT_pbuffer)
|
||||
|
||||
#endif /* WGL_EXT_pbuffer */
|
||||
|
||||
/* -------------------------- WGL_EXT_pixel_format ------------------------- */
|
||||
|
||||
#ifndef WGL_EXT_pixel_format
|
||||
#define WGL_EXT_pixel_format 1
|
||||
|
||||
#define WGL_NUMBER_PIXEL_FORMATS_EXT 0x2000
|
||||
#define WGL_DRAW_TO_WINDOW_EXT 0x2001
|
||||
#define WGL_DRAW_TO_BITMAP_EXT 0x2002
|
||||
#define WGL_ACCELERATION_EXT 0x2003
|
||||
#define WGL_NEED_PALETTE_EXT 0x2004
|
||||
#define WGL_NEED_SYSTEM_PALETTE_EXT 0x2005
|
||||
#define WGL_SWAP_LAYER_BUFFERS_EXT 0x2006
|
||||
#define WGL_SWAP_METHOD_EXT 0x2007
|
||||
#define WGL_NUMBER_OVERLAYS_EXT 0x2008
|
||||
#define WGL_NUMBER_UNDERLAYS_EXT 0x2009
|
||||
#define WGL_TRANSPARENT_EXT 0x200A
|
||||
#define WGL_TRANSPARENT_VALUE_EXT 0x200B
|
||||
#define WGL_SHARE_DEPTH_EXT 0x200C
|
||||
#define WGL_SHARE_STENCIL_EXT 0x200D
|
||||
#define WGL_SHARE_ACCUM_EXT 0x200E
|
||||
#define WGL_SUPPORT_GDI_EXT 0x200F
|
||||
#define WGL_SUPPORT_OPENGL_EXT 0x2010
|
||||
#define WGL_DOUBLE_BUFFER_EXT 0x2011
|
||||
#define WGL_STEREO_EXT 0x2012
|
||||
#define WGL_PIXEL_TYPE_EXT 0x2013
|
||||
#define WGL_COLOR_BITS_EXT 0x2014
|
||||
#define WGL_RED_BITS_EXT 0x2015
|
||||
#define WGL_RED_SHIFT_EXT 0x2016
|
||||
#define WGL_GREEN_BITS_EXT 0x2017
|
||||
#define WGL_GREEN_SHIFT_EXT 0x2018
|
||||
#define WGL_BLUE_BITS_EXT 0x2019
|
||||
#define WGL_BLUE_SHIFT_EXT 0x201A
|
||||
#define WGL_ALPHA_BITS_EXT 0x201B
|
||||
#define WGL_ALPHA_SHIFT_EXT 0x201C
|
||||
#define WGL_ACCUM_BITS_EXT 0x201D
|
||||
#define WGL_ACCUM_RED_BITS_EXT 0x201E
|
||||
#define WGL_ACCUM_GREEN_BITS_EXT 0x201F
|
||||
#define WGL_ACCUM_BLUE_BITS_EXT 0x2020
|
||||
#define WGL_ACCUM_ALPHA_BITS_EXT 0x2021
|
||||
#define WGL_DEPTH_BITS_EXT 0x2022
|
||||
#define WGL_STENCIL_BITS_EXT 0x2023
|
||||
#define WGL_AUX_BUFFERS_EXT 0x2024
|
||||
#define WGL_NO_ACCELERATION_EXT 0x2025
|
||||
#define WGL_GENERIC_ACCELERATION_EXT 0x2026
|
||||
#define WGL_FULL_ACCELERATION_EXT 0x2027
|
||||
#define WGL_SWAP_EXCHANGE_EXT 0x2028
|
||||
#define WGL_SWAP_COPY_EXT 0x2029
|
||||
#define WGL_SWAP_UNDEFINED_EXT 0x202A
|
||||
#define WGL_TYPE_RGBA_EXT 0x202B
|
||||
#define WGL_TYPE_COLORINDEX_EXT 0x202C
|
||||
|
||||
typedef BOOL (WINAPI * PFNWGLCHOOSEPIXELFORMATEXTPROC) (HDC hdc, const int* piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);
|
||||
typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBFVEXTPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int* piAttributes, FLOAT *pfValues);
|
||||
typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVEXTPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int* piAttributes, int *piValues);
|
||||
|
||||
#define wglChoosePixelFormatEXT WGLEW_GET_FUN(__wglewChoosePixelFormatEXT)
|
||||
#define wglGetPixelFormatAttribfvEXT WGLEW_GET_FUN(__wglewGetPixelFormatAttribfvEXT)
|
||||
#define wglGetPixelFormatAttribivEXT WGLEW_GET_FUN(__wglewGetPixelFormatAttribivEXT)
|
||||
|
||||
#define WGLEW_EXT_pixel_format WGLEW_GET_VAR(__WGLEW_EXT_pixel_format)
|
||||
|
||||
#endif /* WGL_EXT_pixel_format */
|
||||
|
||||
/* ------------------- WGL_EXT_pixel_format_packed_float ------------------- */
|
||||
|
||||
#ifndef WGL_EXT_pixel_format_packed_float
|
||||
#define WGL_EXT_pixel_format_packed_float 1
|
||||
|
||||
#define WGL_TYPE_RGBA_UNSIGNED_FLOAT_EXT 0x20A8
|
||||
|
||||
#define WGLEW_EXT_pixel_format_packed_float WGLEW_GET_VAR(__WGLEW_EXT_pixel_format_packed_float)
|
||||
|
||||
#endif /* WGL_EXT_pixel_format_packed_float */
|
||||
|
||||
/* -------------------------- WGL_EXT_swap_control ------------------------- */
|
||||
|
||||
#ifndef WGL_EXT_swap_control
|
||||
#define WGL_EXT_swap_control 1
|
||||
|
||||
typedef int (WINAPI * PFNWGLGETSWAPINTERVALEXTPROC) (void);
|
||||
typedef BOOL (WINAPI * PFNWGLSWAPINTERVALEXTPROC) (int interval);
|
||||
|
||||
#define wglGetSwapIntervalEXT WGLEW_GET_FUN(__wglewGetSwapIntervalEXT)
|
||||
#define wglSwapIntervalEXT WGLEW_GET_FUN(__wglewSwapIntervalEXT)
|
||||
|
||||
#define WGLEW_EXT_swap_control WGLEW_GET_VAR(__WGLEW_EXT_swap_control)
|
||||
|
||||
#endif /* WGL_EXT_swap_control */
|
||||
|
||||
/* --------------------- WGL_I3D_digital_video_control --------------------- */
|
||||
|
||||
#ifndef WGL_I3D_digital_video_control
|
||||
#define WGL_I3D_digital_video_control 1
|
||||
|
||||
#define WGL_DIGITAL_VIDEO_CURSOR_ALPHA_FRAMEBUFFER_I3D 0x2050
|
||||
#define WGL_DIGITAL_VIDEO_CURSOR_ALPHA_VALUE_I3D 0x2051
|
||||
#define WGL_DIGITAL_VIDEO_CURSOR_INCLUDED_I3D 0x2052
|
||||
#define WGL_DIGITAL_VIDEO_GAMMA_CORRECTED_I3D 0x2053
|
||||
|
||||
typedef BOOL (WINAPI * PFNWGLGETDIGITALVIDEOPARAMETERSI3DPROC) (HDC hDC, int iAttribute, int* piValue);
|
||||
typedef BOOL (WINAPI * PFNWGLSETDIGITALVIDEOPARAMETERSI3DPROC) (HDC hDC, int iAttribute, const int* piValue);
|
||||
|
||||
#define wglGetDigitalVideoParametersI3D WGLEW_GET_FUN(__wglewGetDigitalVideoParametersI3D)
|
||||
#define wglSetDigitalVideoParametersI3D WGLEW_GET_FUN(__wglewSetDigitalVideoParametersI3D)
|
||||
|
||||
#define WGLEW_I3D_digital_video_control WGLEW_GET_VAR(__WGLEW_I3D_digital_video_control)
|
||||
|
||||
#endif /* WGL_I3D_digital_video_control */
|
||||
|
||||
/* ----------------------------- WGL_I3D_gamma ----------------------------- */
|
||||
|
||||
#ifndef WGL_I3D_gamma
|
||||
#define WGL_I3D_gamma 1
|
||||
|
||||
#define WGL_GAMMA_TABLE_SIZE_I3D 0x204E
|
||||
#define WGL_GAMMA_EXCLUDE_DESKTOP_I3D 0x204F
|
||||
|
||||
typedef BOOL (WINAPI * PFNWGLGETGAMMATABLEI3DPROC) (HDC hDC, int iEntries, USHORT* puRed, USHORT *puGreen, USHORT *puBlue);
|
||||
typedef BOOL (WINAPI * PFNWGLGETGAMMATABLEPARAMETERSI3DPROC) (HDC hDC, int iAttribute, int* piValue);
|
||||
typedef BOOL (WINAPI * PFNWGLSETGAMMATABLEI3DPROC) (HDC hDC, int iEntries, const USHORT* puRed, const USHORT *puGreen, const USHORT *puBlue);
|
||||
typedef BOOL (WINAPI * PFNWGLSETGAMMATABLEPARAMETERSI3DPROC) (HDC hDC, int iAttribute, const int* piValue);
|
||||
|
||||
#define wglGetGammaTableI3D WGLEW_GET_FUN(__wglewGetGammaTableI3D)
|
||||
#define wglGetGammaTableParametersI3D WGLEW_GET_FUN(__wglewGetGammaTableParametersI3D)
|
||||
#define wglSetGammaTableI3D WGLEW_GET_FUN(__wglewSetGammaTableI3D)
|
||||
#define wglSetGammaTableParametersI3D WGLEW_GET_FUN(__wglewSetGammaTableParametersI3D)
|
||||
|
||||
#define WGLEW_I3D_gamma WGLEW_GET_VAR(__WGLEW_I3D_gamma)
|
||||
|
||||
#endif /* WGL_I3D_gamma */
|
||||
|
||||
/* ---------------------------- WGL_I3D_genlock ---------------------------- */
|
||||
|
||||
#ifndef WGL_I3D_genlock
|
||||
#define WGL_I3D_genlock 1
|
||||
|
||||
#define WGL_GENLOCK_SOURCE_MULTIVIEW_I3D 0x2044
|
||||
#define WGL_GENLOCK_SOURCE_EXTERNAL_SYNC_I3D 0x2045
|
||||
#define WGL_GENLOCK_SOURCE_EXTERNAL_FIELD_I3D 0x2046
|
||||
#define WGL_GENLOCK_SOURCE_EXTERNAL_TTL_I3D 0x2047
|
||||
#define WGL_GENLOCK_SOURCE_DIGITAL_SYNC_I3D 0x2048
|
||||
#define WGL_GENLOCK_SOURCE_DIGITAL_FIELD_I3D 0x2049
|
||||
#define WGL_GENLOCK_SOURCE_EDGE_FALLING_I3D 0x204A
|
||||
#define WGL_GENLOCK_SOURCE_EDGE_RISING_I3D 0x204B
|
||||
#define WGL_GENLOCK_SOURCE_EDGE_BOTH_I3D 0x204C
|
||||
|
||||
typedef BOOL (WINAPI * PFNWGLDISABLEGENLOCKI3DPROC) (HDC hDC);
|
||||
typedef BOOL (WINAPI * PFNWGLENABLEGENLOCKI3DPROC) (HDC hDC);
|
||||
typedef BOOL (WINAPI * PFNWGLGENLOCKSAMPLERATEI3DPROC) (HDC hDC, UINT uRate);
|
||||
typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEDELAYI3DPROC) (HDC hDC, UINT uDelay);
|
||||
typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEEDGEI3DPROC) (HDC hDC, UINT uEdge);
|
||||
typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEI3DPROC) (HDC hDC, UINT uSource);
|
||||
typedef BOOL (WINAPI * PFNWGLGETGENLOCKSAMPLERATEI3DPROC) (HDC hDC, UINT* uRate);
|
||||
typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEDELAYI3DPROC) (HDC hDC, UINT* uDelay);
|
||||
typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEEDGEI3DPROC) (HDC hDC, UINT* uEdge);
|
||||
typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEI3DPROC) (HDC hDC, UINT* uSource);
|
||||
typedef BOOL (WINAPI * PFNWGLISENABLEDGENLOCKI3DPROC) (HDC hDC, BOOL* pFlag);
|
||||
typedef BOOL (WINAPI * PFNWGLQUERYGENLOCKMAXSOURCEDELAYI3DPROC) (HDC hDC, UINT* uMaxLineDelay, UINT *uMaxPixelDelay);
|
||||
|
||||
#define wglDisableGenlockI3D WGLEW_GET_FUN(__wglewDisableGenlockI3D)
|
||||
#define wglEnableGenlockI3D WGLEW_GET_FUN(__wglewEnableGenlockI3D)
|
||||
#define wglGenlockSampleRateI3D WGLEW_GET_FUN(__wglewGenlockSampleRateI3D)
|
||||
#define wglGenlockSourceDelayI3D WGLEW_GET_FUN(__wglewGenlockSourceDelayI3D)
|
||||
#define wglGenlockSourceEdgeI3D WGLEW_GET_FUN(__wglewGenlockSourceEdgeI3D)
|
||||
#define wglGenlockSourceI3D WGLEW_GET_FUN(__wglewGenlockSourceI3D)
|
||||
#define wglGetGenlockSampleRateI3D WGLEW_GET_FUN(__wglewGetGenlockSampleRateI3D)
|
||||
#define wglGetGenlockSourceDelayI3D WGLEW_GET_FUN(__wglewGetGenlockSourceDelayI3D)
|
||||
#define wglGetGenlockSourceEdgeI3D WGLEW_GET_FUN(__wglewGetGenlockSourceEdgeI3D)
|
||||
#define wglGetGenlockSourceI3D WGLEW_GET_FUN(__wglewGetGenlockSourceI3D)
|
||||
#define wglIsEnabledGenlockI3D WGLEW_GET_FUN(__wglewIsEnabledGenlockI3D)
|
||||
#define wglQueryGenlockMaxSourceDelayI3D WGLEW_GET_FUN(__wglewQueryGenlockMaxSourceDelayI3D)
|
||||
|
||||
#define WGLEW_I3D_genlock WGLEW_GET_VAR(__WGLEW_I3D_genlock)
|
||||
|
||||
#endif /* WGL_I3D_genlock */
|
||||
|
||||
/* -------------------------- WGL_I3D_image_buffer ------------------------- */
|
||||
|
||||
#ifndef WGL_I3D_image_buffer
|
||||
#define WGL_I3D_image_buffer 1
|
||||
|
||||
#define WGL_IMAGE_BUFFER_MIN_ACCESS_I3D 0x00000001
|
||||
#define WGL_IMAGE_BUFFER_LOCK_I3D 0x00000002
|
||||
|
||||
typedef BOOL (WINAPI * PFNWGLASSOCIATEIMAGEBUFFEREVENTSI3DPROC) (HDC hdc, HANDLE* pEvent, LPVOID *pAddress, DWORD *pSize, UINT count);
|
||||
typedef LPVOID (WINAPI * PFNWGLCREATEIMAGEBUFFERI3DPROC) (HDC hDC, DWORD dwSize, UINT uFlags);
|
||||
typedef BOOL (WINAPI * PFNWGLDESTROYIMAGEBUFFERI3DPROC) (HDC hDC, LPVOID pAddress);
|
||||
typedef BOOL (WINAPI * PFNWGLRELEASEIMAGEBUFFEREVENTSI3DPROC) (HDC hdc, LPVOID* pAddress, UINT count);
|
||||
|
||||
#define wglAssociateImageBufferEventsI3D WGLEW_GET_FUN(__wglewAssociateImageBufferEventsI3D)
|
||||
#define wglCreateImageBufferI3D WGLEW_GET_FUN(__wglewCreateImageBufferI3D)
|
||||
#define wglDestroyImageBufferI3D WGLEW_GET_FUN(__wglewDestroyImageBufferI3D)
|
||||
#define wglReleaseImageBufferEventsI3D WGLEW_GET_FUN(__wglewReleaseImageBufferEventsI3D)
|
||||
|
||||
#define WGLEW_I3D_image_buffer WGLEW_GET_VAR(__WGLEW_I3D_image_buffer)
|
||||
|
||||
#endif /* WGL_I3D_image_buffer */
|
||||
|
||||
/* ------------------------ WGL_I3D_swap_frame_lock ------------------------ */
|
||||
|
||||
#ifndef WGL_I3D_swap_frame_lock
|
||||
#define WGL_I3D_swap_frame_lock 1
|
||||
|
||||
typedef BOOL (WINAPI * PFNWGLDISABLEFRAMELOCKI3DPROC) (VOID);
|
||||
typedef BOOL (WINAPI * PFNWGLENABLEFRAMELOCKI3DPROC) (VOID);
|
||||
typedef BOOL (WINAPI * PFNWGLISENABLEDFRAMELOCKI3DPROC) (BOOL* pFlag);
|
||||
typedef BOOL (WINAPI * PFNWGLQUERYFRAMELOCKMASTERI3DPROC) (BOOL* pFlag);
|
||||
|
||||
#define wglDisableFrameLockI3D WGLEW_GET_FUN(__wglewDisableFrameLockI3D)
|
||||
#define wglEnableFrameLockI3D WGLEW_GET_FUN(__wglewEnableFrameLockI3D)
|
||||
#define wglIsEnabledFrameLockI3D WGLEW_GET_FUN(__wglewIsEnabledFrameLockI3D)
|
||||
#define wglQueryFrameLockMasterI3D WGLEW_GET_FUN(__wglewQueryFrameLockMasterI3D)
|
||||
|
||||
#define WGLEW_I3D_swap_frame_lock WGLEW_GET_VAR(__WGLEW_I3D_swap_frame_lock)
|
||||
|
||||
#endif /* WGL_I3D_swap_frame_lock */
|
||||
|
||||
/* ------------------------ WGL_I3D_swap_frame_usage ----------------------- */
|
||||
|
||||
#ifndef WGL_I3D_swap_frame_usage
|
||||
#define WGL_I3D_swap_frame_usage 1
|
||||
|
||||
typedef BOOL (WINAPI * PFNWGLBEGINFRAMETRACKINGI3DPROC) (void);
|
||||
typedef BOOL (WINAPI * PFNWGLENDFRAMETRACKINGI3DPROC) (void);
|
||||
typedef BOOL (WINAPI * PFNWGLGETFRAMEUSAGEI3DPROC) (float* pUsage);
|
||||
typedef BOOL (WINAPI * PFNWGLQUERYFRAMETRACKINGI3DPROC) (DWORD* pFrameCount, DWORD *pMissedFrames, float *pLastMissedUsage);
|
||||
|
||||
#define wglBeginFrameTrackingI3D WGLEW_GET_FUN(__wglewBeginFrameTrackingI3D)
|
||||
#define wglEndFrameTrackingI3D WGLEW_GET_FUN(__wglewEndFrameTrackingI3D)
|
||||
#define wglGetFrameUsageI3D WGLEW_GET_FUN(__wglewGetFrameUsageI3D)
|
||||
#define wglQueryFrameTrackingI3D WGLEW_GET_FUN(__wglewQueryFrameTrackingI3D)
|
||||
|
||||
#define WGLEW_I3D_swap_frame_usage WGLEW_GET_VAR(__WGLEW_I3D_swap_frame_usage)
|
||||
|
||||
#endif /* WGL_I3D_swap_frame_usage */
|
||||
|
||||
/* -------------------------- WGL_NV_float_buffer -------------------------- */
|
||||
|
||||
#ifndef WGL_NV_float_buffer
|
||||
#define WGL_NV_float_buffer 1
|
||||
|
||||
#define WGL_FLOAT_COMPONENTS_NV 0x20B0
|
||||
#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_R_NV 0x20B1
|
||||
#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RG_NV 0x20B2
|
||||
#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGB_NV 0x20B3
|
||||
#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGBA_NV 0x20B4
|
||||
#define WGL_TEXTURE_FLOAT_R_NV 0x20B5
|
||||
#define WGL_TEXTURE_FLOAT_RG_NV 0x20B6
|
||||
#define WGL_TEXTURE_FLOAT_RGB_NV 0x20B7
|
||||
#define WGL_TEXTURE_FLOAT_RGBA_NV 0x20B8
|
||||
|
||||
#define WGLEW_NV_float_buffer WGLEW_GET_VAR(__WGLEW_NV_float_buffer)
|
||||
|
||||
#endif /* WGL_NV_float_buffer */
|
||||
|
||||
/* -------------------------- WGL_NV_gpu_affinity -------------------------- */
|
||||
|
||||
#ifndef WGL_NV_gpu_affinity
|
||||
#define WGL_NV_gpu_affinity 1
|
||||
|
||||
#define WGL_ERROR_INCOMPATIBLE_AFFINITY_MASKS_NV 0x20D0
|
||||
#define WGL_ERROR_MISSING_AFFINITY_MASK_NV 0x20D1
|
||||
|
||||
DECLARE_HANDLE(HGPUNV);
|
||||
typedef struct _GPU_DEVICE {
|
||||
DWORD cb;
|
||||
CHAR DeviceName[32];
|
||||
CHAR DeviceString[128];
|
||||
DWORD Flags;
|
||||
RECT rcVirtualScreen;
|
||||
} GPU_DEVICE, *PGPU_DEVICE;
|
||||
|
||||
typedef HDC (WINAPI * PFNWGLCREATEAFFINITYDCNVPROC) (const HGPUNV *phGpuList);
|
||||
typedef BOOL (WINAPI * PFNWGLDELETEDCNVPROC) (HDC hdc);
|
||||
typedef BOOL (WINAPI * PFNWGLENUMGPUDEVICESNVPROC) (HGPUNV hGpu, UINT iDeviceIndex, PGPU_DEVICE lpGpuDevice);
|
||||
typedef BOOL (WINAPI * PFNWGLENUMGPUSFROMAFFINITYDCNVPROC) (HDC hAffinityDC, UINT iGpuIndex, HGPUNV *hGpu);
|
||||
typedef BOOL (WINAPI * PFNWGLENUMGPUSNVPROC) (UINT iGpuIndex, HGPUNV *phGpu);
|
||||
|
||||
#define wglCreateAffinityDCNV WGLEW_GET_FUN(__wglewCreateAffinityDCNV)
|
||||
#define wglDeleteDCNV WGLEW_GET_FUN(__wglewDeleteDCNV)
|
||||
#define wglEnumGpuDevicesNV WGLEW_GET_FUN(__wglewEnumGpuDevicesNV)
|
||||
#define wglEnumGpusFromAffinityDCNV WGLEW_GET_FUN(__wglewEnumGpusFromAffinityDCNV)
|
||||
#define wglEnumGpusNV WGLEW_GET_FUN(__wglewEnumGpusNV)
|
||||
|
||||
#define WGLEW_NV_gpu_affinity WGLEW_GET_VAR(__WGLEW_NV_gpu_affinity)
|
||||
|
||||
#endif /* WGL_NV_gpu_affinity */
|
||||
|
||||
/* ---------------------- WGL_NV_render_depth_texture ---------------------- */
|
||||
|
||||
#ifndef WGL_NV_render_depth_texture
|
||||
#define WGL_NV_render_depth_texture 1
|
||||
|
||||
#define WGL_NO_TEXTURE_ARB 0x2077
|
||||
#define WGL_BIND_TO_TEXTURE_DEPTH_NV 0x20A3
|
||||
#define WGL_BIND_TO_TEXTURE_RECTANGLE_DEPTH_NV 0x20A4
|
||||
#define WGL_DEPTH_TEXTURE_FORMAT_NV 0x20A5
|
||||
#define WGL_TEXTURE_DEPTH_COMPONENT_NV 0x20A6
|
||||
#define WGL_DEPTH_COMPONENT_NV 0x20A7
|
||||
|
||||
#define WGLEW_NV_render_depth_texture WGLEW_GET_VAR(__WGLEW_NV_render_depth_texture)
|
||||
|
||||
#endif /* WGL_NV_render_depth_texture */
|
||||
|
||||
/* -------------------- WGL_NV_render_texture_rectangle -------------------- */
|
||||
|
||||
#ifndef WGL_NV_render_texture_rectangle
|
||||
#define WGL_NV_render_texture_rectangle 1
|
||||
|
||||
#define WGL_BIND_TO_TEXTURE_RECTANGLE_RGB_NV 0x20A0
|
||||
#define WGL_BIND_TO_TEXTURE_RECTANGLE_RGBA_NV 0x20A1
|
||||
#define WGL_TEXTURE_RECTANGLE_NV 0x20A2
|
||||
|
||||
#define WGLEW_NV_render_texture_rectangle WGLEW_GET_VAR(__WGLEW_NV_render_texture_rectangle)
|
||||
|
||||
#endif /* WGL_NV_render_texture_rectangle */
|
||||
|
||||
/* ----------------------- WGL_NV_vertex_array_range ----------------------- */
|
||||
|
||||
#ifndef WGL_NV_vertex_array_range
|
||||
#define WGL_NV_vertex_array_range 1
|
||||
|
||||
typedef void * (WINAPI * PFNWGLALLOCATEMEMORYNVPROC) (GLsizei size, GLfloat readFrequency, GLfloat writeFrequency, GLfloat priority);
|
||||
typedef void (WINAPI * PFNWGLFREEMEMORYNVPROC) (void *pointer);
|
||||
|
||||
#define wglAllocateMemoryNV WGLEW_GET_FUN(__wglewAllocateMemoryNV)
|
||||
#define wglFreeMemoryNV WGLEW_GET_FUN(__wglewFreeMemoryNV)
|
||||
|
||||
#define WGLEW_NV_vertex_array_range WGLEW_GET_VAR(__WGLEW_NV_vertex_array_range)
|
||||
|
||||
#endif /* WGL_NV_vertex_array_range */
|
||||
|
||||
/* -------------------------- WGL_OML_sync_control ------------------------- */
|
||||
|
||||
#ifndef WGL_OML_sync_control
|
||||
#define WGL_OML_sync_control 1
|
||||
|
||||
typedef BOOL (WINAPI * PFNWGLGETMSCRATEOMLPROC) (HDC hdc, INT32* numerator, INT32 *denominator);
|
||||
typedef BOOL (WINAPI * PFNWGLGETSYNCVALUESOMLPROC) (HDC hdc, INT64* ust, INT64 *msc, INT64 *sbc);
|
||||
typedef INT64 (WINAPI * PFNWGLSWAPBUFFERSMSCOMLPROC) (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder);
|
||||
typedef INT64 (WINAPI * PFNWGLSWAPLAYERBUFFERSMSCOMLPROC) (HDC hdc, INT fuPlanes, INT64 target_msc, INT64 divisor, INT64 remainder);
|
||||
typedef BOOL (WINAPI * PFNWGLWAITFORMSCOMLPROC) (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder, INT64* ust, INT64 *msc, INT64 *sbc);
|
||||
typedef BOOL (WINAPI * PFNWGLWAITFORSBCOMLPROC) (HDC hdc, INT64 target_sbc, INT64* ust, INT64 *msc, INT64 *sbc);
|
||||
|
||||
#define wglGetMscRateOML WGLEW_GET_FUN(__wglewGetMscRateOML)
|
||||
#define wglGetSyncValuesOML WGLEW_GET_FUN(__wglewGetSyncValuesOML)
|
||||
#define wglSwapBuffersMscOML WGLEW_GET_FUN(__wglewSwapBuffersMscOML)
|
||||
#define wglSwapLayerBuffersMscOML WGLEW_GET_FUN(__wglewSwapLayerBuffersMscOML)
|
||||
#define wglWaitForMscOML WGLEW_GET_FUN(__wglewWaitForMscOML)
|
||||
#define wglWaitForSbcOML WGLEW_GET_FUN(__wglewWaitForSbcOML)
|
||||
|
||||
#define WGLEW_OML_sync_control WGLEW_GET_VAR(__WGLEW_OML_sync_control)
|
||||
|
||||
#endif /* WGL_OML_sync_control */
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
#ifdef GLEW_MX
|
||||
#define WGLEW_EXPORT
|
||||
#else
|
||||
#define WGLEW_EXPORT GLEWAPI
|
||||
#endif /* GLEW_MX */
|
||||
|
||||
#ifdef GLEW_MX
|
||||
struct WGLEWContextStruct
|
||||
{
|
||||
#endif /* GLEW_MX */
|
||||
|
||||
WGLEW_EXPORT PFNWGLSETSTEREOEMITTERSTATE3DLPROC __wglewSetStereoEmitterState3DL;
|
||||
|
||||
WGLEW_EXPORT PFNWGLCREATEBUFFERREGIONARBPROC __wglewCreateBufferRegionARB;
|
||||
WGLEW_EXPORT PFNWGLDELETEBUFFERREGIONARBPROC __wglewDeleteBufferRegionARB;
|
||||
WGLEW_EXPORT PFNWGLRESTOREBUFFERREGIONARBPROC __wglewRestoreBufferRegionARB;
|
||||
WGLEW_EXPORT PFNWGLSAVEBUFFERREGIONARBPROC __wglewSaveBufferRegionARB;
|
||||
|
||||
WGLEW_EXPORT PFNWGLGETEXTENSIONSSTRINGARBPROC __wglewGetExtensionsStringARB;
|
||||
|
||||
WGLEW_EXPORT PFNWGLGETCURRENTREADDCARBPROC __wglewGetCurrentReadDCARB;
|
||||
WGLEW_EXPORT PFNWGLMAKECONTEXTCURRENTARBPROC __wglewMakeContextCurrentARB;
|
||||
|
||||
WGLEW_EXPORT PFNWGLCREATEPBUFFERARBPROC __wglewCreatePbufferARB;
|
||||
WGLEW_EXPORT PFNWGLDESTROYPBUFFERARBPROC __wglewDestroyPbufferARB;
|
||||
WGLEW_EXPORT PFNWGLGETPBUFFERDCARBPROC __wglewGetPbufferDCARB;
|
||||
WGLEW_EXPORT PFNWGLQUERYPBUFFERARBPROC __wglewQueryPbufferARB;
|
||||
WGLEW_EXPORT PFNWGLRELEASEPBUFFERDCARBPROC __wglewReleasePbufferDCARB;
|
||||
|
||||
WGLEW_EXPORT PFNWGLCHOOSEPIXELFORMATARBPROC __wglewChoosePixelFormatARB;
|
||||
WGLEW_EXPORT PFNWGLGETPIXELFORMATATTRIBFVARBPROC __wglewGetPixelFormatAttribfvARB;
|
||||
WGLEW_EXPORT PFNWGLGETPIXELFORMATATTRIBIVARBPROC __wglewGetPixelFormatAttribivARB;
|
||||
|
||||
WGLEW_EXPORT PFNWGLBINDTEXIMAGEARBPROC __wglewBindTexImageARB;
|
||||
WGLEW_EXPORT PFNWGLRELEASETEXIMAGEARBPROC __wglewReleaseTexImageARB;
|
||||
WGLEW_EXPORT PFNWGLSETPBUFFERATTRIBARBPROC __wglewSetPbufferAttribARB;
|
||||
|
||||
WGLEW_EXPORT PFNWGLBINDDISPLAYCOLORTABLEEXTPROC __wglewBindDisplayColorTableEXT;
|
||||
WGLEW_EXPORT PFNWGLCREATEDISPLAYCOLORTABLEEXTPROC __wglewCreateDisplayColorTableEXT;
|
||||
WGLEW_EXPORT PFNWGLDESTROYDISPLAYCOLORTABLEEXTPROC __wglewDestroyDisplayColorTableEXT;
|
||||
WGLEW_EXPORT PFNWGLLOADDISPLAYCOLORTABLEEXTPROC __wglewLoadDisplayColorTableEXT;
|
||||
|
||||
WGLEW_EXPORT PFNWGLGETEXTENSIONSSTRINGEXTPROC __wglewGetExtensionsStringEXT;
|
||||
|
||||
WGLEW_EXPORT PFNWGLGETCURRENTREADDCEXTPROC __wglewGetCurrentReadDCEXT;
|
||||
WGLEW_EXPORT PFNWGLMAKECONTEXTCURRENTEXTPROC __wglewMakeContextCurrentEXT;
|
||||
|
||||
WGLEW_EXPORT PFNWGLCREATEPBUFFEREXTPROC __wglewCreatePbufferEXT;
|
||||
WGLEW_EXPORT PFNWGLDESTROYPBUFFEREXTPROC __wglewDestroyPbufferEXT;
|
||||
WGLEW_EXPORT PFNWGLGETPBUFFERDCEXTPROC __wglewGetPbufferDCEXT;
|
||||
WGLEW_EXPORT PFNWGLQUERYPBUFFEREXTPROC __wglewQueryPbufferEXT;
|
||||
WGLEW_EXPORT PFNWGLRELEASEPBUFFERDCEXTPROC __wglewReleasePbufferDCEXT;
|
||||
|
||||
WGLEW_EXPORT PFNWGLCHOOSEPIXELFORMATEXTPROC __wglewChoosePixelFormatEXT;
|
||||
WGLEW_EXPORT PFNWGLGETPIXELFORMATATTRIBFVEXTPROC __wglewGetPixelFormatAttribfvEXT;
|
||||
WGLEW_EXPORT PFNWGLGETPIXELFORMATATTRIBIVEXTPROC __wglewGetPixelFormatAttribivEXT;
|
||||
|
||||
WGLEW_EXPORT PFNWGLGETSWAPINTERVALEXTPROC __wglewGetSwapIntervalEXT;
|
||||
WGLEW_EXPORT PFNWGLSWAPINTERVALEXTPROC __wglewSwapIntervalEXT;
|
||||
|
||||
WGLEW_EXPORT PFNWGLGETDIGITALVIDEOPARAMETERSI3DPROC __wglewGetDigitalVideoParametersI3D;
|
||||
WGLEW_EXPORT PFNWGLSETDIGITALVIDEOPARAMETERSI3DPROC __wglewSetDigitalVideoParametersI3D;
|
||||
|
||||
WGLEW_EXPORT PFNWGLGETGAMMATABLEI3DPROC __wglewGetGammaTableI3D;
|
||||
WGLEW_EXPORT PFNWGLGETGAMMATABLEPARAMETERSI3DPROC __wglewGetGammaTableParametersI3D;
|
||||
WGLEW_EXPORT PFNWGLSETGAMMATABLEI3DPROC __wglewSetGammaTableI3D;
|
||||
WGLEW_EXPORT PFNWGLSETGAMMATABLEPARAMETERSI3DPROC __wglewSetGammaTableParametersI3D;
|
||||
|
||||
WGLEW_EXPORT PFNWGLDISABLEGENLOCKI3DPROC __wglewDisableGenlockI3D;
|
||||
WGLEW_EXPORT PFNWGLENABLEGENLOCKI3DPROC __wglewEnableGenlockI3D;
|
||||
WGLEW_EXPORT PFNWGLGENLOCKSAMPLERATEI3DPROC __wglewGenlockSampleRateI3D;
|
||||
WGLEW_EXPORT PFNWGLGENLOCKSOURCEDELAYI3DPROC __wglewGenlockSourceDelayI3D;
|
||||
WGLEW_EXPORT PFNWGLGENLOCKSOURCEEDGEI3DPROC __wglewGenlockSourceEdgeI3D;
|
||||
WGLEW_EXPORT PFNWGLGENLOCKSOURCEI3DPROC __wglewGenlockSourceI3D;
|
||||
WGLEW_EXPORT PFNWGLGETGENLOCKSAMPLERATEI3DPROC __wglewGetGenlockSampleRateI3D;
|
||||
WGLEW_EXPORT PFNWGLGETGENLOCKSOURCEDELAYI3DPROC __wglewGetGenlockSourceDelayI3D;
|
||||
WGLEW_EXPORT PFNWGLGETGENLOCKSOURCEEDGEI3DPROC __wglewGetGenlockSourceEdgeI3D;
|
||||
WGLEW_EXPORT PFNWGLGETGENLOCKSOURCEI3DPROC __wglewGetGenlockSourceI3D;
|
||||
WGLEW_EXPORT PFNWGLISENABLEDGENLOCKI3DPROC __wglewIsEnabledGenlockI3D;
|
||||
WGLEW_EXPORT PFNWGLQUERYGENLOCKMAXSOURCEDELAYI3DPROC __wglewQueryGenlockMaxSourceDelayI3D;
|
||||
|
||||
WGLEW_EXPORT PFNWGLASSOCIATEIMAGEBUFFEREVENTSI3DPROC __wglewAssociateImageBufferEventsI3D;
|
||||
WGLEW_EXPORT PFNWGLCREATEIMAGEBUFFERI3DPROC __wglewCreateImageBufferI3D;
|
||||
WGLEW_EXPORT PFNWGLDESTROYIMAGEBUFFERI3DPROC __wglewDestroyImageBufferI3D;
|
||||
WGLEW_EXPORT PFNWGLRELEASEIMAGEBUFFEREVENTSI3DPROC __wglewReleaseImageBufferEventsI3D;
|
||||
|
||||
WGLEW_EXPORT PFNWGLDISABLEFRAMELOCKI3DPROC __wglewDisableFrameLockI3D;
|
||||
WGLEW_EXPORT PFNWGLENABLEFRAMELOCKI3DPROC __wglewEnableFrameLockI3D;
|
||||
WGLEW_EXPORT PFNWGLISENABLEDFRAMELOCKI3DPROC __wglewIsEnabledFrameLockI3D;
|
||||
WGLEW_EXPORT PFNWGLQUERYFRAMELOCKMASTERI3DPROC __wglewQueryFrameLockMasterI3D;
|
||||
|
||||
WGLEW_EXPORT PFNWGLBEGINFRAMETRACKINGI3DPROC __wglewBeginFrameTrackingI3D;
|
||||
WGLEW_EXPORT PFNWGLENDFRAMETRACKINGI3DPROC __wglewEndFrameTrackingI3D;
|
||||
WGLEW_EXPORT PFNWGLGETFRAMEUSAGEI3DPROC __wglewGetFrameUsageI3D;
|
||||
WGLEW_EXPORT PFNWGLQUERYFRAMETRACKINGI3DPROC __wglewQueryFrameTrackingI3D;
|
||||
|
||||
WGLEW_EXPORT PFNWGLCREATEAFFINITYDCNVPROC __wglewCreateAffinityDCNV;
|
||||
WGLEW_EXPORT PFNWGLDELETEDCNVPROC __wglewDeleteDCNV;
|
||||
WGLEW_EXPORT PFNWGLENUMGPUDEVICESNVPROC __wglewEnumGpuDevicesNV;
|
||||
WGLEW_EXPORT PFNWGLENUMGPUSFROMAFFINITYDCNVPROC __wglewEnumGpusFromAffinityDCNV;
|
||||
WGLEW_EXPORT PFNWGLENUMGPUSNVPROC __wglewEnumGpusNV;
|
||||
|
||||
WGLEW_EXPORT PFNWGLALLOCATEMEMORYNVPROC __wglewAllocateMemoryNV;
|
||||
WGLEW_EXPORT PFNWGLFREEMEMORYNVPROC __wglewFreeMemoryNV;
|
||||
|
||||
WGLEW_EXPORT PFNWGLGETMSCRATEOMLPROC __wglewGetMscRateOML;
|
||||
WGLEW_EXPORT PFNWGLGETSYNCVALUESOMLPROC __wglewGetSyncValuesOML;
|
||||
WGLEW_EXPORT PFNWGLSWAPBUFFERSMSCOMLPROC __wglewSwapBuffersMscOML;
|
||||
WGLEW_EXPORT PFNWGLSWAPLAYERBUFFERSMSCOMLPROC __wglewSwapLayerBuffersMscOML;
|
||||
WGLEW_EXPORT PFNWGLWAITFORMSCOMLPROC __wglewWaitForMscOML;
|
||||
WGLEW_EXPORT PFNWGLWAITFORSBCOMLPROC __wglewWaitForSbcOML;
|
||||
WGLEW_EXPORT GLboolean __WGLEW_3DFX_multisample;
|
||||
WGLEW_EXPORT GLboolean __WGLEW_3DL_stereo_control;
|
||||
WGLEW_EXPORT GLboolean __WGLEW_ARB_buffer_region;
|
||||
WGLEW_EXPORT GLboolean __WGLEW_ARB_extensions_string;
|
||||
WGLEW_EXPORT GLboolean __WGLEW_ARB_make_current_read;
|
||||
WGLEW_EXPORT GLboolean __WGLEW_ARB_multisample;
|
||||
WGLEW_EXPORT GLboolean __WGLEW_ARB_pbuffer;
|
||||
WGLEW_EXPORT GLboolean __WGLEW_ARB_pixel_format;
|
||||
WGLEW_EXPORT GLboolean __WGLEW_ARB_pixel_format_float;
|
||||
WGLEW_EXPORT GLboolean __WGLEW_ARB_render_texture;
|
||||
WGLEW_EXPORT GLboolean __WGLEW_ATI_pixel_format_float;
|
||||
WGLEW_EXPORT GLboolean __WGLEW_ATI_render_texture_rectangle;
|
||||
WGLEW_EXPORT GLboolean __WGLEW_EXT_depth_float;
|
||||
WGLEW_EXPORT GLboolean __WGLEW_EXT_display_color_table;
|
||||
WGLEW_EXPORT GLboolean __WGLEW_EXT_extensions_string;
|
||||
WGLEW_EXPORT GLboolean __WGLEW_EXT_framebuffer_sRGB;
|
||||
WGLEW_EXPORT GLboolean __WGLEW_EXT_make_current_read;
|
||||
WGLEW_EXPORT GLboolean __WGLEW_EXT_multisample;
|
||||
WGLEW_EXPORT GLboolean __WGLEW_EXT_pbuffer;
|
||||
WGLEW_EXPORT GLboolean __WGLEW_EXT_pixel_format;
|
||||
WGLEW_EXPORT GLboolean __WGLEW_EXT_pixel_format_packed_float;
|
||||
WGLEW_EXPORT GLboolean __WGLEW_EXT_swap_control;
|
||||
WGLEW_EXPORT GLboolean __WGLEW_I3D_digital_video_control;
|
||||
WGLEW_EXPORT GLboolean __WGLEW_I3D_gamma;
|
||||
WGLEW_EXPORT GLboolean __WGLEW_I3D_genlock;
|
||||
WGLEW_EXPORT GLboolean __WGLEW_I3D_image_buffer;
|
||||
WGLEW_EXPORT GLboolean __WGLEW_I3D_swap_frame_lock;
|
||||
WGLEW_EXPORT GLboolean __WGLEW_I3D_swap_frame_usage;
|
||||
WGLEW_EXPORT GLboolean __WGLEW_NV_float_buffer;
|
||||
WGLEW_EXPORT GLboolean __WGLEW_NV_gpu_affinity;
|
||||
WGLEW_EXPORT GLboolean __WGLEW_NV_render_depth_texture;
|
||||
WGLEW_EXPORT GLboolean __WGLEW_NV_render_texture_rectangle;
|
||||
WGLEW_EXPORT GLboolean __WGLEW_NV_vertex_array_range;
|
||||
WGLEW_EXPORT GLboolean __WGLEW_OML_sync_control;
|
||||
|
||||
#ifdef GLEW_MX
|
||||
}; /* WGLEWContextStruct */
|
||||
#endif /* GLEW_MX */
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
#ifdef GLEW_MX
|
||||
|
||||
typedef struct WGLEWContextStruct WGLEWContext;
|
||||
GLEWAPI GLenum wglewContextInit (WGLEWContext* ctx);
|
||||
GLEWAPI GLboolean wglewContextIsSupported (WGLEWContext* ctx, const char* name);
|
||||
|
||||
#define wglewInit() wglewContextInit(wglewGetContext())
|
||||
#define wglewIsSupported(x) wglewContextIsSupported(wglewGetContext(), x)
|
||||
|
||||
#define WGLEW_GET_VAR(x) (*(const GLboolean*)&(wglewGetContext()->x))
|
||||
#define WGLEW_GET_FUN(x) wglewGetContext()->x
|
||||
|
||||
#else /* GLEW_MX */
|
||||
|
||||
#define WGLEW_GET_VAR(x) (*(const GLboolean*)&x)
|
||||
#define WGLEW_GET_FUN(x) x
|
||||
|
||||
GLEWAPI GLboolean wglewIsSupported (const char* name);
|
||||
|
||||
#endif /* GLEW_MX */
|
||||
|
||||
GLEWAPI GLboolean wglewGetExtension (const char* name);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#undef GLEWAPI
|
||||
|
||||
#endif /* __wglew_h__ */
|
||||
@@ -0,0 +1,611 @@
|
||||
#ifndef __wglext_h_
|
||||
#define __wglext_h_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
** License Applicability. Except to the extent portions of this file are
|
||||
** made subject to an alternative license as permitted in the SGI Free
|
||||
** Software License B, Version 1.1 (the "License"), the contents of this
|
||||
** file are subject only to the provisions of the License. You may not use
|
||||
** this file except in compliance with the License. You may obtain a copy
|
||||
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
|
||||
** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
|
||||
**
|
||||
** http://oss.sgi.com/projects/FreeB
|
||||
**
|
||||
** Note that, as provided in the License, the Software is distributed on an
|
||||
** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
|
||||
** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
|
||||
** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
|
||||
** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
|
||||
**
|
||||
** Original Code. The Original Code is: OpenGL Sample Implementation,
|
||||
** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
|
||||
** Inc. The Original Code is Copyright (c) 1991-2002 Silicon Graphics, Inc.
|
||||
** Copyright in any portions created by third parties is as indicated
|
||||
** elsewhere herein. All Rights Reserved.
|
||||
**
|
||||
** Additional Notice Provisions: This software was created using the
|
||||
** OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has
|
||||
** not been independently verified as being compliant with the OpenGL(R)
|
||||
** version 1.2.1 Specification.
|
||||
*/
|
||||
|
||||
#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__)
|
||||
#define WIN32_LEAN_AND_MEAN 1
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#ifndef APIENTRY
|
||||
#define APIENTRY
|
||||
#endif
|
||||
#ifndef APIENTRYP
|
||||
#define APIENTRYP APIENTRY *
|
||||
#endif
|
||||
#ifndef GLAPI
|
||||
#define GLAPI extern
|
||||
#endif
|
||||
|
||||
/*************************************************************/
|
||||
|
||||
/* Header file version number */
|
||||
/* wglext.h last updated 2002/03/22 */
|
||||
/* Current version at http://oss.sgi.com/projects/ogl-sample/registry/ */
|
||||
#define WGL_WGLEXT_VERSION 4
|
||||
|
||||
#ifndef WGL_ARB_buffer_region
|
||||
#define WGL_FRONT_COLOR_BUFFER_BIT_ARB 0x00000001
|
||||
#define WGL_BACK_COLOR_BUFFER_BIT_ARB 0x00000002
|
||||
#define WGL_DEPTH_BUFFER_BIT_ARB 0x00000004
|
||||
#define WGL_STENCIL_BUFFER_BIT_ARB 0x00000008
|
||||
#endif
|
||||
|
||||
#ifndef WGL_ARB_multisample
|
||||
#define WGL_SAMPLE_BUFFERS_ARB 0x2041
|
||||
#define WGL_SAMPLES_ARB 0x2042
|
||||
#endif
|
||||
|
||||
#ifndef WGL_ARB_extensions_string
|
||||
#endif
|
||||
|
||||
#ifndef WGL_ARB_pixel_format
|
||||
#define WGL_NUMBER_PIXEL_FORMATS_ARB 0x2000
|
||||
#define WGL_DRAW_TO_WINDOW_ARB 0x2001
|
||||
#define WGL_DRAW_TO_BITMAP_ARB 0x2002
|
||||
#define WGL_ACCELERATION_ARB 0x2003
|
||||
#define WGL_NEED_PALETTE_ARB 0x2004
|
||||
#define WGL_NEED_SYSTEM_PALETTE_ARB 0x2005
|
||||
#define WGL_SWAP_LAYER_BUFFERS_ARB 0x2006
|
||||
#define WGL_SWAP_METHOD_ARB 0x2007
|
||||
#define WGL_NUMBER_OVERLAYS_ARB 0x2008
|
||||
#define WGL_NUMBER_UNDERLAYS_ARB 0x2009
|
||||
#define WGL_TRANSPARENT_ARB 0x200A
|
||||
#define WGL_TRANSPARENT_RED_VALUE_ARB 0x2037
|
||||
#define WGL_TRANSPARENT_GREEN_VALUE_ARB 0x2038
|
||||
#define WGL_TRANSPARENT_BLUE_VALUE_ARB 0x2039
|
||||
#define WGL_TRANSPARENT_ALPHA_VALUE_ARB 0x203A
|
||||
#define WGL_TRANSPARENT_INDEX_VALUE_ARB 0x203B
|
||||
#define WGL_SHARE_DEPTH_ARB 0x200C
|
||||
#define WGL_SHARE_STENCIL_ARB 0x200D
|
||||
#define WGL_SHARE_ACCUM_ARB 0x200E
|
||||
#define WGL_SUPPORT_GDI_ARB 0x200F
|
||||
#define WGL_SUPPORT_OPENGL_ARB 0x2010
|
||||
#define WGL_DOUBLE_BUFFER_ARB 0x2011
|
||||
#define WGL_STEREO_ARB 0x2012
|
||||
#define WGL_PIXEL_TYPE_ARB 0x2013
|
||||
#define WGL_COLOR_BITS_ARB 0x2014
|
||||
#define WGL_RED_BITS_ARB 0x2015
|
||||
#define WGL_RED_SHIFT_ARB 0x2016
|
||||
#define WGL_GREEN_BITS_ARB 0x2017
|
||||
#define WGL_GREEN_SHIFT_ARB 0x2018
|
||||
#define WGL_BLUE_BITS_ARB 0x2019
|
||||
#define WGL_BLUE_SHIFT_ARB 0x201A
|
||||
#define WGL_ALPHA_BITS_ARB 0x201B
|
||||
#define WGL_ALPHA_SHIFT_ARB 0x201C
|
||||
#define WGL_ACCUM_BITS_ARB 0x201D
|
||||
#define WGL_ACCUM_RED_BITS_ARB 0x201E
|
||||
#define WGL_ACCUM_GREEN_BITS_ARB 0x201F
|
||||
#define WGL_ACCUM_BLUE_BITS_ARB 0x2020
|
||||
#define WGL_ACCUM_ALPHA_BITS_ARB 0x2021
|
||||
#define WGL_DEPTH_BITS_ARB 0x2022
|
||||
#define WGL_STENCIL_BITS_ARB 0x2023
|
||||
#define WGL_AUX_BUFFERS_ARB 0x2024
|
||||
#define WGL_NO_ACCELERATION_ARB 0x2025
|
||||
#define WGL_GENERIC_ACCELERATION_ARB 0x2026
|
||||
#define WGL_FULL_ACCELERATION_ARB 0x2027
|
||||
#define WGL_SWAP_EXCHANGE_ARB 0x2028
|
||||
#define WGL_SWAP_COPY_ARB 0x2029
|
||||
#define WGL_SWAP_UNDEFINED_ARB 0x202A
|
||||
#define WGL_TYPE_RGBA_ARB 0x202B
|
||||
#define WGL_TYPE_COLORINDEX_ARB 0x202C
|
||||
#endif
|
||||
|
||||
#ifndef WGL_ARB_make_current_read
|
||||
#define ERROR_INVALID_PIXEL_TYPE_ARB 0x2043
|
||||
#define ERROR_INCOMPATIBLE_DEVICE_CONTEXTS_ARB 0x2054
|
||||
#endif
|
||||
|
||||
#ifndef WGL_ARB_pbuffer
|
||||
#define WGL_DRAW_TO_PBUFFER_ARB 0x202D
|
||||
#define WGL_MAX_PBUFFER_PIXELS_ARB 0x202E
|
||||
#define WGL_MAX_PBUFFER_WIDTH_ARB 0x202F
|
||||
#define WGL_MAX_PBUFFER_HEIGHT_ARB 0x2030
|
||||
#define WGL_PBUFFER_LARGEST_ARB 0x2033
|
||||
#define WGL_PBUFFER_WIDTH_ARB 0x2034
|
||||
#define WGL_PBUFFER_HEIGHT_ARB 0x2035
|
||||
#define WGL_PBUFFER_LOST_ARB 0x2036
|
||||
#endif
|
||||
|
||||
#ifndef WGL_ARB_render_texture
|
||||
#define WGL_BIND_TO_TEXTURE_RGB_ARB 0x2070
|
||||
#define WGL_BIND_TO_TEXTURE_RGBA_ARB 0x2071
|
||||
#define WGL_TEXTURE_FORMAT_ARB 0x2072
|
||||
#define WGL_TEXTURE_TARGET_ARB 0x2073
|
||||
#define WGL_MIPMAP_TEXTURE_ARB 0x2074
|
||||
#define WGL_TEXTURE_RGB_ARB 0x2075
|
||||
#define WGL_TEXTURE_RGBA_ARB 0x2076
|
||||
#define WGL_NO_TEXTURE_ARB 0x2077
|
||||
#define WGL_TEXTURE_CUBE_MAP_ARB 0x2078
|
||||
#define WGL_TEXTURE_1D_ARB 0x2079
|
||||
#define WGL_TEXTURE_2D_ARB 0x207A
|
||||
#define WGL_MIPMAP_LEVEL_ARB 0x207B
|
||||
#define WGL_CUBE_MAP_FACE_ARB 0x207C
|
||||
#define WGL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB 0x207D
|
||||
#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB 0x207E
|
||||
#define WGL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB 0x207F
|
||||
#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB 0x2080
|
||||
#define WGL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB 0x2081
|
||||
#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB 0x2082
|
||||
#define WGL_FRONT_LEFT_ARB 0x2083
|
||||
#define WGL_FRONT_RIGHT_ARB 0x2084
|
||||
#define WGL_BACK_LEFT_ARB 0x2085
|
||||
#define WGL_BACK_RIGHT_ARB 0x2086
|
||||
#define WGL_AUX0_ARB 0x2087
|
||||
#define WGL_AUX1_ARB 0x2088
|
||||
#define WGL_AUX2_ARB 0x2089
|
||||
#define WGL_AUX3_ARB 0x208A
|
||||
#define WGL_AUX4_ARB 0x208B
|
||||
#define WGL_AUX5_ARB 0x208C
|
||||
#define WGL_AUX6_ARB 0x208D
|
||||
#define WGL_AUX7_ARB 0x208E
|
||||
#define WGL_AUX8_ARB 0x208F
|
||||
#define WGL_AUX9_ARB 0x2090
|
||||
#endif
|
||||
|
||||
#ifndef WGL_EXT_make_current_read
|
||||
#define ERROR_INVALID_PIXEL_TYPE_EXT 0x2043
|
||||
#endif
|
||||
|
||||
#ifndef WGL_EXT_pixel_format
|
||||
#define WGL_NUMBER_PIXEL_FORMATS_EXT 0x2000
|
||||
#define WGL_DRAW_TO_WINDOW_EXT 0x2001
|
||||
#define WGL_DRAW_TO_BITMAP_EXT 0x2002
|
||||
#define WGL_ACCELERATION_EXT 0x2003
|
||||
#define WGL_NEED_PALETTE_EXT 0x2004
|
||||
#define WGL_NEED_SYSTEM_PALETTE_EXT 0x2005
|
||||
#define WGL_SWAP_LAYER_BUFFERS_EXT 0x2006
|
||||
#define WGL_SWAP_METHOD_EXT 0x2007
|
||||
#define WGL_NUMBER_OVERLAYS_EXT 0x2008
|
||||
#define WGL_NUMBER_UNDERLAYS_EXT 0x2009
|
||||
#define WGL_TRANSPARENT_EXT 0x200A
|
||||
#define WGL_TRANSPARENT_VALUE_EXT 0x200B
|
||||
#define WGL_SHARE_DEPTH_EXT 0x200C
|
||||
#define WGL_SHARE_STENCIL_EXT 0x200D
|
||||
#define WGL_SHARE_ACCUM_EXT 0x200E
|
||||
#define WGL_SUPPORT_GDI_EXT 0x200F
|
||||
#define WGL_SUPPORT_OPENGL_EXT 0x2010
|
||||
#define WGL_DOUBLE_BUFFER_EXT 0x2011
|
||||
#define WGL_STEREO_EXT 0x2012
|
||||
#define WGL_PIXEL_TYPE_EXT 0x2013
|
||||
#define WGL_COLOR_BITS_EXT 0x2014
|
||||
#define WGL_RED_BITS_EXT 0x2015
|
||||
#define WGL_RED_SHIFT_EXT 0x2016
|
||||
#define WGL_GREEN_BITS_EXT 0x2017
|
||||
#define WGL_GREEN_SHIFT_EXT 0x2018
|
||||
#define WGL_BLUE_BITS_EXT 0x2019
|
||||
#define WGL_BLUE_SHIFT_EXT 0x201A
|
||||
#define WGL_ALPHA_BITS_EXT 0x201B
|
||||
#define WGL_ALPHA_SHIFT_EXT 0x201C
|
||||
#define WGL_ACCUM_BITS_EXT 0x201D
|
||||
#define WGL_ACCUM_RED_BITS_EXT 0x201E
|
||||
#define WGL_ACCUM_GREEN_BITS_EXT 0x201F
|
||||
#define WGL_ACCUM_BLUE_BITS_EXT 0x2020
|
||||
#define WGL_ACCUM_ALPHA_BITS_EXT 0x2021
|
||||
#define WGL_DEPTH_BITS_EXT 0x2022
|
||||
#define WGL_STENCIL_BITS_EXT 0x2023
|
||||
#define WGL_AUX_BUFFERS_EXT 0x2024
|
||||
#define WGL_NO_ACCELERATION_EXT 0x2025
|
||||
#define WGL_GENERIC_ACCELERATION_EXT 0x2026
|
||||
#define WGL_FULL_ACCELERATION_EXT 0x2027
|
||||
#define WGL_SWAP_EXCHANGE_EXT 0x2028
|
||||
#define WGL_SWAP_COPY_EXT 0x2029
|
||||
#define WGL_SWAP_UNDEFINED_EXT 0x202A
|
||||
#define WGL_TYPE_RGBA_EXT 0x202B
|
||||
#define WGL_TYPE_COLORINDEX_EXT 0x202C
|
||||
#endif
|
||||
|
||||
#ifndef WGL_EXT_pbuffer
|
||||
#define WGL_DRAW_TO_PBUFFER_EXT 0x202D
|
||||
#define WGL_MAX_PBUFFER_PIXELS_EXT 0x202E
|
||||
#define WGL_MAX_PBUFFER_WIDTH_EXT 0x202F
|
||||
#define WGL_MAX_PBUFFER_HEIGHT_EXT 0x2030
|
||||
#define WGL_OPTIMAL_PBUFFER_WIDTH_EXT 0x2031
|
||||
#define WGL_OPTIMAL_PBUFFER_HEIGHT_EXT 0x2032
|
||||
#define WGL_PBUFFER_LARGEST_EXT 0x2033
|
||||
#define WGL_PBUFFER_WIDTH_EXT 0x2034
|
||||
#define WGL_PBUFFER_HEIGHT_EXT 0x2035
|
||||
#endif
|
||||
|
||||
#ifndef WGL_EXT_depth_float
|
||||
#define WGL_DEPTH_FLOAT_EXT 0x2040
|
||||
#endif
|
||||
|
||||
#ifndef WGL_3DFX_multisample
|
||||
#define WGL_SAMPLE_BUFFERS_3DFX 0x2060
|
||||
#define WGL_SAMPLES_3DFX 0x2061
|
||||
#endif
|
||||
|
||||
#ifndef WGL_EXT_multisample
|
||||
#define WGL_SAMPLE_BUFFERS_EXT 0x2041
|
||||
#define WGL_SAMPLES_EXT 0x2042
|
||||
#endif
|
||||
|
||||
#ifndef WGL_I3D_digital_video_control
|
||||
#define WGL_DIGITAL_VIDEO_CURSOR_ALPHA_FRAMEBUFFER_I3D 0x2050
|
||||
#define WGL_DIGITAL_VIDEO_CURSOR_ALPHA_VALUE_I3D 0x2051
|
||||
#define WGL_DIGITAL_VIDEO_CURSOR_INCLUDED_I3D 0x2052
|
||||
#define WGL_DIGITAL_VIDEO_GAMMA_CORRECTED_I3D 0x2053
|
||||
#endif
|
||||
|
||||
#ifndef WGL_I3D_gamma
|
||||
#define WGL_GAMMA_TABLE_SIZE_I3D 0x204E
|
||||
#define WGL_GAMMA_EXCLUDE_DESKTOP_I3D 0x204F
|
||||
#endif
|
||||
|
||||
#ifndef WGL_I3D_genlock
|
||||
#define WGL_GENLOCK_SOURCE_MULTIVIEW_I3D 0x2044
|
||||
#define WGL_GENLOCK_SOURCE_EXTENAL_SYNC_I3D 0x2045
|
||||
#define WGL_GENLOCK_SOURCE_EXTENAL_FIELD_I3D 0x2046
|
||||
#define WGL_GENLOCK_SOURCE_EXTENAL_TTL_I3D 0x2047
|
||||
#define WGL_GENLOCK_SOURCE_DIGITAL_SYNC_I3D 0x2048
|
||||
#define WGL_GENLOCK_SOURCE_DIGITAL_FIELD_I3D 0x2049
|
||||
#define WGL_GENLOCK_SOURCE_EDGE_FALLING_I3D 0x204A
|
||||
#define WGL_GENLOCK_SOURCE_EDGE_RISING_I3D 0x204B
|
||||
#define WGL_GENLOCK_SOURCE_EDGE_BOTH_I3D 0x204C
|
||||
#endif
|
||||
|
||||
#ifndef WGL_I3D_image_buffer
|
||||
#define WGL_IMAGE_BUFFER_MIN_ACCESS_I3D 0x00000001
|
||||
#define WGL_IMAGE_BUFFER_LOCK_I3D 0x00000002
|
||||
#endif
|
||||
|
||||
#ifndef WGL_I3D_swap_frame_lock
|
||||
#endif
|
||||
|
||||
#ifndef WGL_NV_render_depth_texture
|
||||
#define WGL_BIND_TO_TEXTURE_DEPTH_NV 0x20A3
|
||||
#define WGL_BIND_TO_TEXTURE_RECTANGLE_DEPTH_NV 0x20A4
|
||||
#define WGL_DEPTH_TEXTURE_FORMAT_NV 0x20A5
|
||||
#define WGL_TEXTURE_DEPTH_COMPONENT_NV 0x20A6
|
||||
#define WGL_DEPTH_COMPONENT_NV 0x20A7
|
||||
#endif
|
||||
|
||||
#ifndef WGL_NV_render_texture_rectangle
|
||||
#define WGL_BIND_TO_TEXTURE_RECTANGLE_RGB_NV 0x20A0
|
||||
#define WGL_BIND_TO_TEXTURE_RECTANGLE_RGBA_NV 0x20A1
|
||||
#define WGL_TEXTURE_RECTANGLE_NV 0x20A2
|
||||
#endif
|
||||
|
||||
#ifndef WGL_NV_float_buffer
|
||||
#define WGL_FLOAT_COMPONENTS_NV 0x20B0
|
||||
#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_R_NV 0x20B1
|
||||
#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RG_NV 0x20B2
|
||||
#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGB_NV 0x20B3
|
||||
#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGBA_NV 0x20B4
|
||||
#define WGL_TEXTURE_FLOAT_R_NV 0x20B5
|
||||
#define WGL_TEXTURE_FLOAT_RG_NV 0x20B6
|
||||
#define WGL_TEXTURE_FLOAT_RGB_NV 0x20B7
|
||||
#define WGL_TEXTURE_FLOAT_RGBA_NV 0x20B8
|
||||
#endif
|
||||
|
||||
|
||||
/*************************************************************/
|
||||
|
||||
#ifndef WGL_ARB_pbuffer
|
||||
DECLARE_HANDLE(HPBUFFERARB);
|
||||
#endif
|
||||
#ifndef WGL_EXT_pbuffer
|
||||
DECLARE_HANDLE(HPBUFFEREXT);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_ARB_buffer_region
|
||||
#define WGL_ARB_buffer_region 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern HANDLE WINAPI wglCreateBufferRegionARB (HDC, int, UINT);
|
||||
extern VOID WINAPI wglDeleteBufferRegionARB (HANDLE);
|
||||
extern BOOL WINAPI wglSaveBufferRegionARB (HANDLE, int, int, int, int);
|
||||
extern BOOL WINAPI wglRestoreBufferRegionARB (HANDLE, int, int, int, int, int, int);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef HANDLE (WINAPI * PFNWGLCREATEBUFFERREGIONARBPROC) (HDC hDC, int iLayerPlane, UINT uType);
|
||||
typedef VOID (WINAPI * PFNWGLDELETEBUFFERREGIONARBPROC) (HANDLE hRegion);
|
||||
typedef BOOL (WINAPI * PFNWGLSAVEBUFFERREGIONARBPROC) (HANDLE hRegion, int x, int y, int width, int height);
|
||||
typedef BOOL (WINAPI * PFNWGLRESTOREBUFFERREGIONARBPROC) (HANDLE hRegion, int x, int y, int width, int height, int xSrc, int ySrc);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_ARB_multisample
|
||||
#define WGL_ARB_multisample 1
|
||||
#endif
|
||||
|
||||
#ifndef WGL_ARB_extensions_string
|
||||
#define WGL_ARB_extensions_string 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern const char * WINAPI wglGetExtensionsStringARB (HDC);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef const char * (WINAPI * PFNWGLGETEXTENSIONSSTRINGARBPROC) (HDC hdc);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_ARB_pixel_format
|
||||
#define WGL_ARB_pixel_format 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern BOOL WINAPI wglGetPixelFormatAttribivARB (HDC, int, int, UINT, const int *, int *);
|
||||
extern BOOL WINAPI wglGetPixelFormatAttribfvARB (HDC, int, int, UINT, const int *, FLOAT *);
|
||||
extern BOOL WINAPI wglChoosePixelFormatARB (HDC, const int *, const FLOAT *, UINT, int *, UINT *);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, int *piValues);
|
||||
typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBFVARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, FLOAT *pfValues);
|
||||
typedef BOOL (WINAPI * PFNWGLCHOOSEPIXELFORMATARBPROC) (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_ARB_make_current_read
|
||||
#define WGL_ARB_make_current_read 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern BOOL WINAPI wglMakeContextCurrentARB (HDC, HDC, HGLRC);
|
||||
extern HDC WINAPI wglGetCurrentReadDCARB (void);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef BOOL (WINAPI * PFNWGLMAKECONTEXTCURRENTARBPROC) (HDC hDrawDC, HDC hReadDC, HGLRC hglrc);
|
||||
typedef HDC (WINAPI * PFNWGLGETCURRENTREADDCARBPROC) (void);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_ARB_pbuffer
|
||||
#define WGL_ARB_pbuffer 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern HPBUFFERARB WINAPI wglCreatePbufferARB (HDC, int, int, int, const int *);
|
||||
extern HDC WINAPI wglGetPbufferDCARB (HPBUFFERARB);
|
||||
extern int WINAPI wglReleasePbufferDCARB (HPBUFFERARB, HDC);
|
||||
extern BOOL WINAPI wglDestroyPbufferARB (HPBUFFERARB);
|
||||
extern BOOL WINAPI wglQueryPbufferARB (HPBUFFERARB, int, int *);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef HPBUFFERARB (WINAPI * PFNWGLCREATEPBUFFERARBPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList);
|
||||
typedef HDC (WINAPI * PFNWGLGETPBUFFERDCARBPROC) (HPBUFFERARB hPbuffer);
|
||||
typedef int (WINAPI * PFNWGLRELEASEPBUFFERDCARBPROC) (HPBUFFERARB hPbuffer, HDC hDC);
|
||||
typedef BOOL (WINAPI * PFNWGLDESTROYPBUFFERARBPROC) (HPBUFFERARB hPbuffer);
|
||||
typedef BOOL (WINAPI * PFNWGLQUERYPBUFFERARBPROC) (HPBUFFERARB hPbuffer, int iAttribute, int *piValue);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_ARB_render_texture
|
||||
#define WGL_ARB_render_texture 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern BOOL WINAPI wglBindTexImageARB (HPBUFFERARB, int);
|
||||
extern BOOL WINAPI wglReleaseTexImageARB (HPBUFFERARB, int);
|
||||
extern BOOL WINAPI wglSetPbufferAttribARB (HPBUFFERARB, const int *);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef BOOL (WINAPI * PFNWGLBINDTEXIMAGEARBPROC) (HPBUFFERARB hPbuffer, int iBuffer);
|
||||
typedef BOOL (WINAPI * PFNWGLRELEASETEXIMAGEARBPROC) (HPBUFFERARB hPbuffer, int iBuffer);
|
||||
typedef BOOL (WINAPI * PFNWGLSETPBUFFERATTRIBARBPROC) (HPBUFFERARB hPbuffer, const int *piAttribList);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_EXT_display_color_table
|
||||
#define WGL_EXT_display_color_table 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern GLboolean WINAPI wglCreateDisplayColorTableEXT (GLushort);
|
||||
extern GLboolean WINAPI wglLoadDisplayColorTableEXT (const GLushort *, GLuint);
|
||||
extern GLboolean WINAPI wglBindDisplayColorTableEXT (GLushort);
|
||||
extern VOID WINAPI wglDestroyDisplayColorTableEXT (GLushort);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef GLboolean (WINAPI * PFNWGLCREATEDISPLAYCOLORTABLEEXTPROC) (GLushort id);
|
||||
typedef GLboolean (WINAPI * PFNWGLLOADDISPLAYCOLORTABLEEXTPROC) (const GLushort *table, GLuint length);
|
||||
typedef GLboolean (WINAPI * PFNWGLBINDDISPLAYCOLORTABLEEXTPROC) (GLushort id);
|
||||
typedef VOID (WINAPI * PFNWGLDESTROYDISPLAYCOLORTABLEEXTPROC) (GLushort id);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_EXT_extensions_string
|
||||
#define WGL_EXT_extensions_string 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern const char * WINAPI wglGetExtensionsStringEXT (void);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef const char * (WINAPI * PFNWGLGETEXTENSIONSSTRINGEXTPROC) (void);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_EXT_make_current_read
|
||||
#define WGL_EXT_make_current_read 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern BOOL WINAPI wglMakeContextCurrentEXT (HDC, HDC, HGLRC);
|
||||
extern HDC WINAPI wglGetCurrentReadDCEXT (void);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef BOOL (WINAPI * PFNWGLMAKECONTEXTCURRENTEXTPROC) (HDC hDrawDC, HDC hReadDC, HGLRC hglrc);
|
||||
typedef HDC (WINAPI * PFNWGLGETCURRENTREADDCEXTPROC) (void);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_EXT_pbuffer
|
||||
#define WGL_EXT_pbuffer 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern HPBUFFEREXT WINAPI wglCreatePbufferEXT (HDC, int, int, int, const int *);
|
||||
extern HDC WINAPI wglGetPbufferDCEXT (HPBUFFEREXT);
|
||||
extern int WINAPI wglReleasePbufferDCEXT (HPBUFFEREXT, HDC);
|
||||
extern BOOL WINAPI wglDestroyPbufferEXT (HPBUFFEREXT);
|
||||
extern BOOL WINAPI wglQueryPbufferEXT (HPBUFFEREXT, int, int *);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef HPBUFFEREXT (WINAPI * PFNWGLCREATEPBUFFEREXTPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList);
|
||||
typedef HDC (WINAPI * PFNWGLGETPBUFFERDCEXTPROC) (HPBUFFEREXT hPbuffer);
|
||||
typedef int (WINAPI * PFNWGLRELEASEPBUFFERDCEXTPROC) (HPBUFFEREXT hPbuffer, HDC hDC);
|
||||
typedef BOOL (WINAPI * PFNWGLDESTROYPBUFFEREXTPROC) (HPBUFFEREXT hPbuffer);
|
||||
typedef BOOL (WINAPI * PFNWGLQUERYPBUFFEREXTPROC) (HPBUFFEREXT hPbuffer, int iAttribute, int *piValue);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_EXT_pixel_format
|
||||
#define WGL_EXT_pixel_format 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern BOOL WINAPI wglGetPixelFormatAttribivEXT (HDC, int, int, UINT, int *, int *);
|
||||
extern BOOL WINAPI wglGetPixelFormatAttribfvEXT (HDC, int, int, UINT, int *, FLOAT *);
|
||||
extern BOOL WINAPI wglChoosePixelFormatEXT (HDC, const int *, const FLOAT *, UINT, int *, UINT *);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVEXTPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, int *piValues);
|
||||
typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBFVEXTPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, FLOAT *pfValues);
|
||||
typedef BOOL (WINAPI * PFNWGLCHOOSEPIXELFORMATEXTPROC) (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_EXT_swap_control
|
||||
#define WGL_EXT_swap_control 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern BOOL WINAPI wglSwapIntervalEXT (int);
|
||||
extern int WINAPI wglGetSwapIntervalEXT (void);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef BOOL (WINAPI * PFNWGLSWAPINTERVALEXTPROC) (int interval);
|
||||
typedef int (WINAPI * PFNWGLGETSWAPINTERVALEXTPROC) (void);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_EXT_depth_float
|
||||
#define WGL_EXT_depth_float 1
|
||||
#endif
|
||||
|
||||
#ifndef WGL_NV_vertex_array_range
|
||||
#define WGL_NV_vertex_array_range 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern void* WINAPI wglAllocateMemoryNV (GLsizei, GLfloat, GLfloat, GLfloat);
|
||||
extern void WINAPI wglFreeMemoryNV (void *);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef void* (WINAPI * PFNWGLALLOCATEMEMORYNVPROC) (GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority);
|
||||
typedef void (WINAPI * PFNWGLFREEMEMORYNVPROC) (void *pointer);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_3DFX_multisample
|
||||
#define WGL_3DFX_multisample 1
|
||||
#endif
|
||||
|
||||
#ifndef WGL_EXT_multisample
|
||||
#define WGL_EXT_multisample 1
|
||||
#endif
|
||||
|
||||
#ifndef WGL_OML_sync_control
|
||||
#define WGL_OML_sync_control 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern BOOL WINAPI wglGetSyncValuesOML (HDC, INT64 *, INT64 *, INT64 *);
|
||||
extern BOOL WINAPI wglGetMscRateOML (HDC, INT32 *, INT32 *);
|
||||
extern INT64 WINAPI wglSwapBuffersMscOML (HDC, INT64, INT64, INT64);
|
||||
extern INT64 WINAPI wglSwapLayerBuffersMscOML (HDC, int, INT64, INT64, INT64);
|
||||
extern BOOL WINAPI wglWaitForMscOML (HDC, INT64, INT64, INT64, INT64 *, INT64 *, INT64 *);
|
||||
extern BOOL WINAPI wglWaitForSbcOML (HDC, INT64, INT64 *, INT64 *, INT64 *);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef BOOL (WINAPI * PFNWGLGETSYNCVALUESOMLPROC) (HDC hdc, INT64 *ust, INT64 *msc, INT64 *sbc);
|
||||
typedef BOOL (WINAPI * PFNWGLGETMSCRATEOMLPROC) (HDC hdc, INT32 *numerator, INT32 *denominator);
|
||||
typedef INT64 (WINAPI * PFNWGLSWAPBUFFERSMSCOMLPROC) (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder);
|
||||
typedef INT64 (WINAPI * PFNWGLSWAPLAYERBUFFERSMSCOMLPROC) (HDC hdc, int fuPlanes, INT64 target_msc, INT64 divisor, INT64 remainder);
|
||||
typedef BOOL (WINAPI * PFNWGLWAITFORMSCOMLPROC) (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder, INT64 *ust, INT64 *msc, INT64 *sbc);
|
||||
typedef BOOL (WINAPI * PFNWGLWAITFORSBCOMLPROC) (HDC hdc, INT64 target_sbc, INT64 *ust, INT64 *msc, INT64 *sbc);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_I3D_digital_video_control
|
||||
#define WGL_I3D_digital_video_control 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern BOOL WINAPI wglGetDigitalVideoParametersI3D (HDC, int, int *);
|
||||
extern BOOL WINAPI wglSetDigitalVideoParametersI3D (HDC, int, const int *);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef BOOL (WINAPI * PFNWGLGETDIGITALVIDEOPARAMETERSI3DPROC) (HDC hDC, int iAttribute, int *piValue);
|
||||
typedef BOOL (WINAPI * PFNWGLSETDIGITALVIDEOPARAMETERSI3DPROC) (HDC hDC, int iAttribute, const int *piValue);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_I3D_gamma
|
||||
#define WGL_I3D_gamma 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern BOOL WINAPI wglGetGammaTableParametersI3D (HDC, int, int *);
|
||||
extern BOOL WINAPI wglSetGammaTableParametersI3D (HDC, int, const int *);
|
||||
extern BOOL WINAPI wglGetGammaTableI3D (HDC, int, USHORT *, USHORT *, USHORT *);
|
||||
extern BOOL WINAPI wglSetGammaTableI3D (HDC, int, const USHORT *, const USHORT *, const USHORT *);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef BOOL (WINAPI * PFNWGLGETGAMMATABLEPARAMETERSI3DPROC) (HDC hDC, int iAttribute, int *piValue);
|
||||
typedef BOOL (WINAPI * PFNWGLSETGAMMATABLEPARAMETERSI3DPROC) (HDC hDC, int iAttribute, const int *piValue);
|
||||
typedef BOOL (WINAPI * PFNWGLGETGAMMATABLEI3DPROC) (HDC hDC, int iEntries, USHORT *puRed, USHORT *puGreen, USHORT *puBlue);
|
||||
typedef BOOL (WINAPI * PFNWGLSETGAMMATABLEI3DPROC) (HDC hDC, int iEntries, const USHORT *puRed, const USHORT *puGreen, const USHORT *puBlue);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_I3D_genlock
|
||||
#define WGL_I3D_genlock 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern BOOL WINAPI wglEnableGenlockI3D (HDC);
|
||||
extern BOOL WINAPI wglDisableGenlockI3D (HDC);
|
||||
extern BOOL WINAPI wglIsEnabledGenlockI3D (HDC, BOOL *);
|
||||
extern BOOL WINAPI wglGenlockSourceI3D (HDC, UINT);
|
||||
extern BOOL WINAPI wglGetGenlockSourceI3D (HDC, UINT *);
|
||||
extern BOOL WINAPI wglGenlockSourceEdgeI3D (HDC, UINT);
|
||||
extern BOOL WINAPI wglGetGenlockSourceEdgeI3D (HDC, UINT *);
|
||||
extern BOOL WINAPI wglGenlockSampleRateI3D (HDC, UINT);
|
||||
extern BOOL WINAPI wglGetGenlockSampleRateI3D (HDC, UINT *);
|
||||
extern BOOL WINAPI wglGenlockSourceDelayI3D (HDC, UINT);
|
||||
extern BOOL WINAPI wglGetGenlockSourceDelayI3D (HDC, UINT *);
|
||||
extern BOOL WINAPI wglQueryGenlockMaxSourceDelayI3D (HDC, UINT *, UINT *);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef BOOL (WINAPI * PFNWGLENABLEGENLOCKI3DPROC) (HDC hDC);
|
||||
typedef BOOL (WINAPI * PFNWGLDISABLEGENLOCKI3DPROC) (HDC hDC);
|
||||
typedef BOOL (WINAPI * PFNWGLISENABLEDGENLOCKI3DPROC) (HDC hDC, BOOL *pFlag);
|
||||
typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEI3DPROC) (HDC hDC, UINT uSource);
|
||||
typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEI3DPROC) (HDC hDC, UINT *uSource);
|
||||
typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEEDGEI3DPROC) (HDC hDC, UINT uEdge);
|
||||
typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEEDGEI3DPROC) (HDC hDC, UINT *uEdge);
|
||||
typedef BOOL (WINAPI * PFNWGLGENLOCKSAMPLERATEI3DPROC) (HDC hDC, UINT uRate);
|
||||
typedef BOOL (WINAPI * PFNWGLGETGENLOCKSAMPLERATEI3DPROC) (HDC hDC, UINT *uRate);
|
||||
typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEDELAYI3DPROC) (HDC hDC, UINT uDelay);
|
||||
typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEDELAYI3DPROC) (HDC hDC, UINT *uDelay);
|
||||
typedef BOOL (WINAPI * PFNWGLQUERYGENLOCKMAXSOURCEDELAYI3DPROC) (HDC hDC, UINT *uMaxLineDelay, UINT *uMaxPixelDelay);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_I3D_image_buffer
|
||||
#define WGL_I3D_image_buffer 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern LPVOID WINAPI wglCreateImageBufferI3D (HDC, DWORD, UINT);
|
||||
extern BOOL WINAPI wglDestroyImageBufferI3D (HDC, LPVOID);
|
||||
extern BOOL WINAPI wglAssociateImageBufferEventsI3D (HDC, const HANDLE *, const LPVOID *, const DWORD *, UINT);
|
||||
extern BOOL WINAPI wglReleaseImageBufferEventsI3D (HDC, const LPVOID *, UINT);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef LPVOID (WINAPI * PFNWGLCREATEIMAGEBUFFERI3DPROC) (HDC hDC, DWORD dwSize, UINT uFlags);
|
||||
typedef BOOL (WINAPI * PFNWGLDESTROYIMAGEBUFFERI3DPROC) (HDC hDC, LPVOID pAddress);
|
||||
typedef BOOL (WINAPI * PFNWGLASSOCIATEIMAGEBUFFEREVENTSI3DPROC) (HDC hDC, const HANDLE *pEvent, const LPVOID *pAddress, const DWORD *pSize, UINT count);
|
||||
typedef BOOL (WINAPI * PFNWGLRELEASEIMAGEBUFFEREVENTSI3DPROC) (HDC hDC, const LPVOID *pAddress, UINT count);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_I3D_swap_frame_lock
|
||||
#define WGL_I3D_swap_frame_lock 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern BOOL WINAPI wglEnableFrameLockI3D (void);
|
||||
extern BOOL WINAPI wglDisableFrameLockI3D (void);
|
||||
extern BOOL WINAPI wglIsEnabledFrameLockI3D (BOOL *);
|
||||
extern BOOL WINAPI wglQueryFrameLockMasterI3D (BOOL *);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef BOOL (WINAPI * PFNWGLENABLEFRAMELOCKI3DPROC) (void);
|
||||
typedef BOOL (WINAPI * PFNWGLDISABLEFRAMELOCKI3DPROC) (void);
|
||||
typedef BOOL (WINAPI * PFNWGLISENABLEDFRAMELOCKI3DPROC) (BOOL *pFlag);
|
||||
typedef BOOL (WINAPI * PFNWGLQUERYFRAMELOCKMASTERI3DPROC) (BOOL *pFlag);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_I3D_swap_frame_usage
|
||||
#define WGL_I3D_swap_frame_usage 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern BOOL WINAPI wglGetFrameUsageI3D (float *);
|
||||
extern BOOL WINAPI wglBeginFrameTrackingI3D (void);
|
||||
extern BOOL WINAPI wglEndFrameTrackingI3D (void);
|
||||
extern BOOL WINAPI wglQueryFrameTrackingI3D (DWORD *, DWORD *, float *);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef BOOL (WINAPI * PFNWGLGETFRAMEUSAGEI3DPROC) (float *pUsage);
|
||||
typedef BOOL (WINAPI * PFNWGLBEGINFRAMETRACKINGI3DPROC) (void);
|
||||
typedef BOOL (WINAPI * PFNWGLENDFRAMETRACKINGI3DPROC) (void);
|
||||
typedef BOOL (WINAPI * PFNWGLQUERYFRAMETRACKINGI3DPROC) (DWORD *pFrameCount, DWORD *pMissedFrames, float *pLastMissedUsage);
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,58 @@
|
||||
#ifndef __win32_glx_h__
|
||||
#define __win32_glx_h__
|
||||
|
||||
/* Copyright (c) Nate Robins, 1997. */
|
||||
|
||||
/* This program is freely distributable without licensing fees
|
||||
and is provided without guarantee or warrantee expressed or
|
||||
implied. This program is -not- in the public domain. */
|
||||
|
||||
#include "win32_x11.h"
|
||||
|
||||
/* Type definitions (conversions). */
|
||||
typedef HGLRC GLXContext;
|
||||
|
||||
#define GLX_USE_GL 1 /* support GLX rendering */
|
||||
#define GLX_BUFFER_SIZE 2 /* depth of the color buffer */
|
||||
#define GLX_LEVEL 3 /* level in plane stacking */
|
||||
#define GLX_RGBA 4 /* true if RGBA mode */
|
||||
#define GLX_DOUBLEBUFFER 5 /* double buffering supported */
|
||||
#define GLX_STEREO 6 /* stereo buffering supported */
|
||||
#define GLX_AUX_BUFFERS 7 /* number of aux buffers */
|
||||
#define GLX_RED_SIZE 8 /* number of red component bits */
|
||||
#define GLX_GREEN_SIZE 9 /* number of green component bits */
|
||||
#define GLX_BLUE_SIZE 10 /* number of blue component bits */
|
||||
#define GLX_ALPHA_SIZE 11 /* number of alpha component bits */
|
||||
#define GLX_DEPTH_SIZE 12 /* number of depth bits */
|
||||
#define GLX_STENCIL_SIZE 13 /* number of stencil bits */
|
||||
#define GLX_ACCUM_RED_SIZE 14 /* number of red accum bits */
|
||||
#define GLX_ACCUM_GREEN_SIZE 15 /* number of green accum bits */
|
||||
#define GLX_ACCUM_BLUE_SIZE 16 /* number of blue accum bits */
|
||||
#define GLX_ACCUM_ALPHA_SIZE 17 /* number of alpha accum bits */
|
||||
|
||||
#define GLX_BAD_ATTRIB 2
|
||||
#define GLX_BAD_VISUAL 4
|
||||
|
||||
/* Functions emulated by macros. */
|
||||
|
||||
#define glXDestroyContext(display, context) \
|
||||
wglDeleteContext(context)
|
||||
|
||||
/* Function prototypes. */
|
||||
|
||||
extern GLXContext glXCreateContext(
|
||||
Display* display,
|
||||
XVisualInfo* visinfo,
|
||||
GLXContext share,
|
||||
Bool direct);
|
||||
extern int glXGetConfig(
|
||||
Display* display,
|
||||
XVisualInfo* visual,
|
||||
int attrib,
|
||||
int* value);
|
||||
extern XVisualInfo* glXChooseVisual(
|
||||
Display* display,
|
||||
int screen,
|
||||
int* attribList);
|
||||
|
||||
#endif /* __win32_glx_h__ */
|
||||
@@ -0,0 +1,319 @@
|
||||
#ifndef __win32_x11_h__
|
||||
#define __win32_x11_h__
|
||||
|
||||
/* Copyright (c) Nate Robins, 1997. */
|
||||
|
||||
/* This program is freely distributable without licensing fees
|
||||
and is provided without guarantee or warrantee expressed or
|
||||
implied. This program is -not- in the public domain. */
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <windows.h>
|
||||
|
||||
/* Type definitions (conversions) */
|
||||
typedef int Visual; /* Win32 equivalent of X11 type */
|
||||
typedef HWND Window;
|
||||
typedef HPALETTE Colormap;
|
||||
typedef PIXELFORMATDESCRIPTOR XVisualInfo;
|
||||
typedef BOOL Bool;
|
||||
typedef MSG XEvent;
|
||||
typedef HDC Display;
|
||||
typedef HCURSOR Cursor;
|
||||
|
||||
typedef int Atom; /* dummies */
|
||||
typedef int XDevice;
|
||||
typedef int Status;
|
||||
|
||||
#define True TRUE /* Win32 equivalents of X11 booleans */
|
||||
#define False FALSE
|
||||
|
||||
#define None 0L /* universal null resource or null atom */
|
||||
|
||||
/* Input Event Masks. Used as event-mask window attribute and as arguments
|
||||
to Grab requests. Not to be confused with event names. */
|
||||
|
||||
#define NoEventMask 0L
|
||||
#define KeyPressMask (1L<<0)
|
||||
#define KeyReleaseMask (1L<<1)
|
||||
#define ButtonPressMask (1L<<2)
|
||||
#define ButtonReleaseMask (1L<<3)
|
||||
#define EnterWindowMask (1L<<4)
|
||||
#define LeaveWindowMask (1L<<5)
|
||||
#define PointerMotionMask (1L<<6)
|
||||
#define PointerMotionHintMask (1L<<7)
|
||||
#define Button1MotionMask (1L<<8)
|
||||
#define Button2MotionMask (1L<<9)
|
||||
#define Button3MotionMask (1L<<10)
|
||||
#define Button4MotionMask (1L<<11)
|
||||
#define Button5MotionMask (1L<<12)
|
||||
#define ButtonMotionMask (1L<<13)
|
||||
#define KeymapStateMask (1L<<14)
|
||||
#define ExposureMask (1L<<15)
|
||||
#define VisibilityChangeMask (1L<<16)
|
||||
#define StructureNotifyMask (1L<<17)
|
||||
#define ResizeRedirectMask (1L<<18)
|
||||
#define SubstructureNotifyMask (1L<<19)
|
||||
#define SubstructureRedirectMask (1L<<20)
|
||||
#define FocusChangeMask (1L<<21)
|
||||
#define PropertyChangeMask (1L<<22)
|
||||
#define ColormapChangeMask (1L<<23)
|
||||
#define OwnerGrabButtonMask (1L<<24)
|
||||
|
||||
/* Key masks. Used as modifiers to GrabButton and GrabKey, results of
|
||||
QueryPointer, state in various key-, mouse-, and button-related
|
||||
events. */
|
||||
|
||||
#define ShiftMask (1<<0)
|
||||
#define LockMask (1<<1)
|
||||
#define ControlMask (1<<2)
|
||||
#define Mod1Mask (1<<3)
|
||||
#define Mod2Mask (1<<4)
|
||||
#define Mod3Mask (1<<5)
|
||||
#define Mod4Mask (1<<6)
|
||||
#define Mod5Mask (1<<7)
|
||||
|
||||
/* Window classes used by CreateWindow */
|
||||
/* Note that CopyFromParent is already defined as 0 above */
|
||||
|
||||
#define InputOutput 1
|
||||
#define InputOnly 2
|
||||
|
||||
/* Window attributes for CreateWindow and ChangeWindowAttributes */
|
||||
|
||||
#define CWBackPixmap (1L<<0)
|
||||
#define CWBackPixel (1L<<1)
|
||||
#define CWBorderPixmap (1L<<2)
|
||||
#define CWBorderPixel (1L<<3)
|
||||
#define CWBitGravity (1L<<4)
|
||||
#define CWWinGravity (1L<<5)
|
||||
#define CWBackingStore (1L<<6)
|
||||
#define CWBackingPlanes (1L<<7)
|
||||
#define CWBackingPixel (1L<<8)
|
||||
#define CWOverrideRedirect (1L<<9)
|
||||
#define CWSaveUnder (1L<<10)
|
||||
#define CWEventMask (1L<<11)
|
||||
#define CWDontPropagate (1L<<12)
|
||||
#define CWColormap (1L<<13)
|
||||
#define CWCursor (1L<<14)
|
||||
|
||||
/* ConfigureWindow structure */
|
||||
|
||||
#define CWX (1<<0)
|
||||
#define CWY (1<<1)
|
||||
#define CWWidth (1<<2)
|
||||
#define CWHeight (1<<3)
|
||||
#define CWBorderWidth (1<<4)
|
||||
#define CWSibling (1<<5)
|
||||
#define CWStackMode (1<<6)
|
||||
|
||||
|
||||
/* Used in GetWindowAttributes reply */
|
||||
|
||||
#define IsUnmapped 0
|
||||
#define IsUnviewable 1
|
||||
#define IsViewable 2
|
||||
|
||||
/* Window stacking method (in configureWindow) */
|
||||
|
||||
#define Above 0
|
||||
#define Below 1
|
||||
#define TopIf 2
|
||||
#define BottomIf 3
|
||||
#define Opposite 4
|
||||
|
||||
/* For CreateColormap */
|
||||
|
||||
#define AllocNone 0 /* create map with no entries */
|
||||
#define AllocAll 1 /* allocate entire map writeable */
|
||||
|
||||
|
||||
/* Flags used in StoreNamedColor, StoreColors */
|
||||
|
||||
#define DoRed (1<<0)
|
||||
#define DoGreen (1<<1)
|
||||
#define DoBlue (1<<2)
|
||||
|
||||
/*
|
||||
* Bitmask returned by XParseGeometry(). Each bit tells if the corresponding
|
||||
* value (x, y, width, height) was found in the parsed string.
|
||||
*/
|
||||
#define NoValue 0x0000
|
||||
#define XValue 0x0001
|
||||
#define YValue 0x0002
|
||||
#define WidthValue 0x0004
|
||||
#define HeightValue 0x0008
|
||||
#define AllValues 0x000F
|
||||
#define XNegative 0x0010
|
||||
#define YNegative 0x0020
|
||||
|
||||
/* flags argument in size hints */
|
||||
#define USPosition (1L << 0) /* user specified x, y */
|
||||
#define USSize (1L << 1) /* user specified width, height */
|
||||
|
||||
/* definitions for initial window state */
|
||||
#define WithdrawnState 0 /* for windows that are not mapped */
|
||||
#define NormalState 1 /* most applications want to start this way */
|
||||
#define IconicState 3 /* application wants to start as an icon */
|
||||
#define GameModeState 4 /* Win32 GLUT only (not in Xlib!). */
|
||||
|
||||
/* Type definitions */
|
||||
|
||||
typedef struct {
|
||||
unsigned int background_pixmap; /* background pixmap */
|
||||
unsigned long background_pixel; /* background pixel */
|
||||
unsigned long border_pixel; /* border pixel value */
|
||||
long event_mask; /* set of events that should be saved */
|
||||
long do_not_propagate_mask; /* set of events that should not propagate */
|
||||
Bool override_redirect; /* boolean value for override-redirect */
|
||||
Colormap colormap; /* color map to be associated with window */
|
||||
} XSetWindowAttributes;
|
||||
|
||||
typedef struct {
|
||||
unsigned long pixel;
|
||||
unsigned short red, green, blue;
|
||||
char flags; /* do_red, do_green, do_blue */
|
||||
} XColor;
|
||||
|
||||
typedef struct {
|
||||
unsigned char *value; /* same as Property routines */
|
||||
Atom encoding; /* prop type */
|
||||
int format; /* prop data format: 8, 16, or 32 */
|
||||
unsigned long nitems; /* number of data items in value */
|
||||
} XTextProperty;
|
||||
|
||||
typedef struct {
|
||||
long flags; /* marks which fields in this structure are defined */
|
||||
int x, y; /* obsolete for new window mgrs, but clients */
|
||||
int width, height; /* should set so old wm's don't mess up */
|
||||
} XSizeHints;
|
||||
|
||||
/* Functions emulated by macros. */
|
||||
|
||||
#define XFreeColormap(display, colormap) \
|
||||
DeleteObject(colormap)
|
||||
|
||||
#define XCreateFontCursor(display, shape) \
|
||||
LoadCursor(NULL, shape)
|
||||
|
||||
#define XDefineCursor(display, window, cursor) \
|
||||
SetCursor(cursor)
|
||||
|
||||
#define XFlush(display) \
|
||||
/* Nothing. */
|
||||
|
||||
#define DisplayWidth(display, screen) \
|
||||
GetSystemMetrics(SM_CXSCREEN)
|
||||
|
||||
#define DisplayHeight(display, screen) \
|
||||
GetSystemMetrics(SM_CYSCREEN)
|
||||
|
||||
#define XMapWindow(display, window) \
|
||||
ShowWindow(window, SW_SHOWNORMAL)
|
||||
|
||||
#define XUnmapWindow(display, window) \
|
||||
ShowWindow(window, SW_HIDE)
|
||||
|
||||
#define XIconifyWindow(display, window, screen) \
|
||||
ShowWindow(window, SW_MINIMIZE)
|
||||
|
||||
#define XWithdrawWindow(display, window, screen) \
|
||||
ShowWindow(window, SW_HIDE)
|
||||
|
||||
#define XLowerWindow(display, window) \
|
||||
SetWindowPos(window, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE)
|
||||
|
||||
#define XSetWMName(display, window, tp) \
|
||||
SetWindowText(window, (tp)->value)
|
||||
|
||||
/* There really isn't a way to set the icon name separate from the
|
||||
windows name in Win32, so, just set the windows name. */
|
||||
#define XSetWMIconName(display, window, tp) \
|
||||
XSetWMName(display, window, tp)
|
||||
|
||||
#define XDestroyWindow(display, window) \
|
||||
DestroyWindow(window)
|
||||
|
||||
/* Anything that needs to be freed was allocated with malloc in our
|
||||
fake X windows library for Win32, so free it with plain old
|
||||
free(). */
|
||||
#define XFree(data) \
|
||||
free(data)
|
||||
|
||||
/* Nothing to be done for this...the pointer is always 'ungrabbed'
|
||||
in Win32. */
|
||||
#define XUngrabPointer(display, time) \
|
||||
/* Nothing. */
|
||||
|
||||
/* Function prototypes. */
|
||||
|
||||
extern XVisualInfo* XGetVisualInfo(
|
||||
Display* display,
|
||||
long mask,
|
||||
XVisualInfo* ttemplate, /* Avoid class with C++ keyword. */
|
||||
int*nitems);
|
||||
|
||||
extern Colormap XCreateColormap(
|
||||
Display* display,
|
||||
Window root,
|
||||
Visual* visual,
|
||||
int alloc);
|
||||
|
||||
extern void XAllocColorCells(
|
||||
Display* display,
|
||||
Colormap colormap,
|
||||
Bool contig,
|
||||
unsigned long plane_masks_return[],
|
||||
unsigned int nplanes,
|
||||
unsigned long pixels_return[],
|
||||
unsigned int npixels);
|
||||
|
||||
extern void XStoreColor(
|
||||
Display* display,
|
||||
Colormap colormap,
|
||||
XColor* color);
|
||||
|
||||
extern void XSetWindowColormap(
|
||||
Display* display,
|
||||
Window window,
|
||||
Colormap colormap);
|
||||
|
||||
extern Bool XTranslateCoordinates(
|
||||
Display *display,
|
||||
Window src, Window dst,
|
||||
int src_x, int src_y,
|
||||
int* dest_x_return, int* dest_y_return,
|
||||
Window* child_return);
|
||||
|
||||
extern Status XGetGeometry(
|
||||
Display* display,
|
||||
Window window,
|
||||
Window* root_return,
|
||||
int* x_return, int* y_return,
|
||||
unsigned int* width_return, unsigned int* height_return,
|
||||
unsigned int *border_width_return,
|
||||
unsigned int* depth_return);
|
||||
|
||||
extern int DisplayWidthMM(
|
||||
Display* display,
|
||||
int screen);
|
||||
|
||||
extern int DisplayHeightMM(
|
||||
Display* display,
|
||||
int screen);
|
||||
|
||||
extern void XWarpPointer(
|
||||
Display* display,
|
||||
Window src, Window dst,
|
||||
int src_x, int src_y,
|
||||
int src_width, int src_height,
|
||||
int dst_x, int dst_y);
|
||||
|
||||
extern int XParseGeometry(
|
||||
char* string,
|
||||
int* x, int* y,
|
||||
unsigned int* width, unsigned int* height);
|
||||
|
||||
extern int XPending(
|
||||
Display* display);
|
||||
|
||||
#endif /* __win32_x11_h__ */
|
||||
@@ -0,0 +1,130 @@
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "Misc.h"
|
||||
|
||||
namespace W32Util
|
||||
{
|
||||
//shamelessly taken from http://www.catch22.org.uk/tuts/tips.asp
|
||||
void CenterWindow(HWND hwnd)
|
||||
{
|
||||
HWND hwndParent;
|
||||
RECT rect, rectP;
|
||||
int width, height;
|
||||
int screenwidth, screenheight;
|
||||
int x, y;
|
||||
|
||||
//make the window relative to its parent
|
||||
hwndParent = GetParent(hwnd);
|
||||
if (!hwndParent)
|
||||
return;
|
||||
|
||||
GetWindowRect(hwnd, &rect);
|
||||
GetWindowRect(hwndParent, &rectP);
|
||||
|
||||
width = rect.right - rect.left;
|
||||
height = rect.bottom - rect.top;
|
||||
|
||||
x = ((rectP.right-rectP.left) - width) / 2 + rectP.left;
|
||||
y = ((rectP.bottom-rectP.top) - height) / 2 + rectP.top;
|
||||
|
||||
screenwidth = GetSystemMetrics(SM_CXSCREEN);
|
||||
screenheight = GetSystemMetrics(SM_CYSCREEN);
|
||||
|
||||
//make sure that the dialog box never moves outside of
|
||||
//the screen
|
||||
if (x < 0) x = 0;
|
||||
if (y < 0) y = 0;
|
||||
if (x + width > screenwidth) x = screenwidth - width;
|
||||
if (y + height > screenheight) y = screenheight - height;
|
||||
|
||||
MoveWindow(hwnd, x, y, width, height, FALSE);
|
||||
}
|
||||
|
||||
HBITMAP CreateBitmapFromARGB(HWND someHwnd, DWORD *image, int w, int h)
|
||||
{
|
||||
BITMAPINFO *bitmap_header;
|
||||
static char bitmapbuffer[sizeof(BITMAPINFO)+16];
|
||||
memset(bitmapbuffer,0,sizeof(BITMAPINFO)+16);
|
||||
bitmap_header=(BITMAPINFO *)bitmapbuffer;
|
||||
bitmap_header->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
||||
bitmap_header->bmiHeader.biPlanes = 1;
|
||||
bitmap_header->bmiHeader.biBitCount = 32;
|
||||
bitmap_header->bmiHeader.biCompression = BI_RGB;
|
||||
bitmap_header->bmiHeader.biWidth = w;
|
||||
bitmap_header->bmiHeader.biHeight = -h;
|
||||
|
||||
((unsigned long *)bitmap_header->bmiColors)[0] = 0x00FF0000;
|
||||
((unsigned long *)bitmap_header->bmiColors)[1] = 0x0000FF00;
|
||||
((unsigned long *)bitmap_header->bmiColors)[2] = 0x000000FF;
|
||||
|
||||
HDC dc = GetDC(someHwnd);
|
||||
HBITMAP bitmap = CreateDIBitmap(dc,&bitmap_header->bmiHeader,CBM_INIT,image,bitmap_header,DIB_RGB_COLORS);
|
||||
ReleaseDC(someHwnd,dc);
|
||||
return bitmap;
|
||||
}
|
||||
|
||||
void NiceSizeFormat(size_t size, char *out)
|
||||
{
|
||||
char *sizes[] = {"b","KB","MB","GB","TB","PB","EB"};
|
||||
int s = 0;
|
||||
int frac = 0;
|
||||
while (size>1024)
|
||||
{
|
||||
s++;
|
||||
frac = (int)size & 1023;
|
||||
size /= 1024;
|
||||
}
|
||||
float f = (float)size + ((float)frac / 1024.0f);
|
||||
sprintf(out,"%3.1f %s",f,sizes[s]);
|
||||
}
|
||||
BOOL CopyTextToClipboard(HWND hwnd, TCHAR *text)
|
||||
{
|
||||
OpenClipboard(hwnd);
|
||||
EmptyClipboard();
|
||||
HANDLE hglbCopy = GlobalAlloc(GMEM_MOVEABLE, (strlen(text) + 1) * sizeof(TCHAR));
|
||||
if (hglbCopy == NULL)
|
||||
{
|
||||
CloseClipboard();
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// Lock the handle and copy the text to the buffer.
|
||||
|
||||
TCHAR *lptstrCopy = (TCHAR *)GlobalLock(hglbCopy);
|
||||
strcpy(lptstrCopy, text);
|
||||
lptstrCopy[strlen(text)] = (TCHAR) 0; // null character
|
||||
GlobalUnlock(hglbCopy);
|
||||
SetClipboardData(CF_TEXT,hglbCopy);
|
||||
CloseClipboard();
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
void SysMessage(char *fmt, ...)
|
||||
{
|
||||
va_list list;
|
||||
char tmp[512];
|
||||
|
||||
va_start(list,fmt);
|
||||
vsprintf(tmp,fmt,list);
|
||||
va_end(list);
|
||||
MessageBox(0, tmp, "Video-Plugin", 0);
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
namespace W32Util
|
||||
{
|
||||
void CenterWindow(HWND hwnd);
|
||||
HBITMAP CreateBitmapFromARGB(HWND someHwnd, DWORD *image, int w, int h);
|
||||
void NiceSizeFormat(size_t size, char *out);
|
||||
BOOL CopyTextToClipboard(HWND hwnd, TCHAR *text);
|
||||
}
|
||||
@@ -0,0 +1,244 @@
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include "Misc.h"
|
||||
#include "PropertySheet.h"
|
||||
|
||||
#include <commctrl.h>
|
||||
|
||||
namespace W32Util
|
||||
{
|
||||
bool centered;
|
||||
|
||||
PropSheet::PropSheet()
|
||||
{
|
||||
watermark = 0;
|
||||
header = 0;
|
||||
icon = 0;
|
||||
}
|
||||
|
||||
int CALLBACK PropSheet::Callback(HWND hwndDlg, UINT uMsg, LPARAM lParam)
|
||||
{
|
||||
switch (uMsg) {
|
||||
case PSCB_PRECREATE:
|
||||
{
|
||||
if (uMsg == PSCB_PRECREATE)
|
||||
{
|
||||
/*
|
||||
if (lParam)
|
||||
{
|
||||
DLGTEMPLATE *pDlgTemplate;
|
||||
DLGTEMPLATEEX *pDlgTemplateEx;
|
||||
|
||||
pDlgTemplateEx = (DLGTEMPLATEEX *)lParam;
|
||||
if (pDlgTemplateEx->signature == 0xFFFF)
|
||||
{
|
||||
// pDlgTemplateEx points to an extended
|
||||
// dialog template structure.
|
||||
|
||||
//pDlgTemplate->style |= DS_SETFONT;
|
||||
u8 *tmp1 = (u8*)&pDlgTemplateEx + sizeof(DLGTEMPLATEEX);
|
||||
u16 *tmp = (u16*)tmp1;
|
||||
tmp++; //skip menu
|
||||
tmp++; //skip dlg class
|
||||
//Crash();
|
||||
//Here we should bash in Segoe UI
|
||||
//It turns out to be way complicated though
|
||||
//Not worth it
|
||||
}
|
||||
else
|
||||
{
|
||||
// This is a standard dialog template
|
||||
// structure.
|
||||
pDlgTemplate = (DLGTEMPLATE *)lParam;
|
||||
}
|
||||
} */
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
case PSCB_INITIALIZED:
|
||||
{
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void PropSheet::Show(HINSTANCE hInstance, HWND hParent, std::string title, int startpage, bool floating, bool wizard)
|
||||
{
|
||||
HPROPSHEETPAGE *pages = new HPROPSHEETPAGE[list.size()];
|
||||
PROPSHEETPAGE page;
|
||||
//common settings
|
||||
memset((void*)&page,0,sizeof(PROPSHEETPAGE));
|
||||
page.dwSize = sizeof(PROPSHEETPAGE);
|
||||
page.hInstance = hInstance;
|
||||
|
||||
int i=0;
|
||||
for (DlgList::iterator iter = list.begin(); iter != list.end(); iter++, i++)
|
||||
{
|
||||
if (wizard)
|
||||
{
|
||||
if (i == 0 || i == list.size()-1)
|
||||
page.dwFlags = PSP_HIDEHEADER;
|
||||
else
|
||||
page.dwFlags = PSP_USEHEADERTITLE|PSP_USEHEADERSUBTITLE;
|
||||
}
|
||||
else
|
||||
{
|
||||
page.dwFlags = PSP_USETITLE;
|
||||
}
|
||||
page.pszTemplate = iter->resource;
|
||||
page.pfnDlgProc = Tab::TabDlgProc;
|
||||
page.pszTitle = iter->title;
|
||||
page.pszHeaderTitle = wizard?iter->title:0;
|
||||
page.pszHeaderSubTitle = wizard?iter->hdrSubTitle:0;
|
||||
page.lParam = (LPARAM)iter->tab;
|
||||
pages[i] = CreatePropertySheetPage(&page);
|
||||
}
|
||||
|
||||
PROPSHEETHEADER sheet;
|
||||
memset(&sheet,0,sizeof(sheet));
|
||||
sheet.dwSize = sizeof(PROPSHEETHEADER);
|
||||
sheet.hInstance = hInstance;
|
||||
sheet.hwndParent = hParent;
|
||||
sheet.pszbmWatermark = watermark;
|
||||
sheet.pszbmHeader = header;
|
||||
|
||||
if (icon)
|
||||
sheet.hIcon = icon;
|
||||
|
||||
if (wizard)
|
||||
sheet.dwFlags = PSH_USECALLBACK | PSH_WIZARD97 | (watermark?PSH_WATERMARK:0) | (header?PSH_HEADER:0);
|
||||
else
|
||||
sheet.dwFlags = PSH_USECALLBACK | PSH_PROPTITLE;
|
||||
|
||||
sheet.dwFlags |= PSH_NOCONTEXTHELP;
|
||||
|
||||
if (floating)
|
||||
sheet.dwFlags |= PSH_MODELESS;
|
||||
//else
|
||||
// sheet.dwFlags |= PSH_NOAPPLYNOW;
|
||||
|
||||
if (icon)
|
||||
sheet.dwFlags |= PSH_USEHICON;
|
||||
|
||||
sheet.pszCaption = title.c_str();
|
||||
sheet.nPages = (UINT)list.size();
|
||||
sheet.phpage = pages;
|
||||
sheet.nStartPage = startpage;
|
||||
sheet.pfnCallback = (PFNPROPSHEETCALLBACK)Callback;
|
||||
|
||||
NONCLIENTMETRICS ncm = {0};
|
||||
ncm.cbSize = sizeof(ncm);
|
||||
SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, &ncm, 0);
|
||||
hDialogFont = CreateFontIndirect(&ncm.lfMessageFont);
|
||||
|
||||
if (wizard)
|
||||
{
|
||||
|
||||
//Create the intro/end title font
|
||||
LOGFONT TitleLogFont = ncm.lfMessageFont;
|
||||
TitleLogFont.lfWeight = FW_BOLD;
|
||||
lstrcpy(TitleLogFont.lfFaceName, TEXT("Verdana Bold"));
|
||||
//StringCchCopy(TitleLogFont.lfFaceName, 32, TEXT("Verdana Bold"));
|
||||
|
||||
HDC hdc = GetDC(NULL); //gets the screen DC
|
||||
INT FontSize = 12;
|
||||
TitleLogFont.lfHeight = 0 - GetDeviceCaps(hdc, LOGPIXELSY) * FontSize / 72;
|
||||
hTitleFont = CreateFontIndirect(&TitleLogFont);
|
||||
ReleaseDC(NULL, hdc);
|
||||
}
|
||||
else
|
||||
hTitleFont = 0;
|
||||
|
||||
centered=false;
|
||||
PropertySheet(&sheet);
|
||||
if (!floating)
|
||||
{
|
||||
for (DlgList::iterator iter = list.begin(); iter != list.end(); iter++)
|
||||
{
|
||||
delete iter->tab;
|
||||
}
|
||||
DeleteObject(hTitleFont);
|
||||
}
|
||||
DeleteObject(hDialogFont);
|
||||
delete [] pages;
|
||||
}
|
||||
void PropSheet::Add(Tab *tab, LPCTSTR resource, LPCTSTR title, LPCTSTR subtitle)
|
||||
{
|
||||
tab->sheet = this;
|
||||
list.push_back(Page(tab,resource,title,subtitle));
|
||||
}
|
||||
|
||||
|
||||
void WizExteriorPage::Init(HWND hDlg)
|
||||
{
|
||||
HWND hwndControl = GetDlgItem(hDlg, captionID);
|
||||
//SetWindowFont(hwndControl, sheet->GetTitleFont(), TRUE);
|
||||
SendMessage(hwndControl,WM_SETFONT,(WPARAM)sheet->GetTitleFont(),0);
|
||||
}
|
||||
|
||||
INT_PTR Tab::TabDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
Tab *tab = (Tab *)GetWindowLongPtr(hDlg, GWLP_USERDATA);
|
||||
switch(message)
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
{
|
||||
if (!centered) //HACK
|
||||
{
|
||||
CenterWindow(GetParent(hDlg));
|
||||
centered=true;
|
||||
}
|
||||
LPARAM l = ((LPPROPSHEETPAGE)lParam)->lParam;
|
||||
tab = (Tab *)l;
|
||||
SetWindowLongPtr(hDlg, GWLP_USERDATA, (DWORD_PTR)l);
|
||||
tab->Init(hDlg);
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_COMMAND:
|
||||
tab->Command(hDlg,wParam);
|
||||
break;
|
||||
case WM_NOTIFY:
|
||||
{
|
||||
LPPSHNOTIFY lppsn = (LPPSHNOTIFY) lParam;
|
||||
HWND sheet = lppsn->hdr.hwndFrom;
|
||||
switch(lppsn->hdr.code) {
|
||||
case PSN_APPLY:
|
||||
tab->Apply(hDlg);
|
||||
break;
|
||||
case PSN_SETACTIVE:
|
||||
PropSheet_SetWizButtons(GetParent(hDlg),
|
||||
(tab->HasPrev()?PSWIZB_BACK:0) |
|
||||
(tab->HasNext()?PSWIZB_NEXT:0) |
|
||||
(tab->HasFinish()?PSWIZB_FINISH:0));
|
||||
break;
|
||||
case PSN_WIZNEXT:
|
||||
tab->Apply(hDlg); //maybe not always good
|
||||
break;
|
||||
case PSN_WIZBACK:
|
||||
case PSN_RESET: //cancel
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "stdafx.h"
|
||||
#include <vector>
|
||||
|
||||
namespace W32Util
|
||||
{
|
||||
class PropSheet;
|
||||
|
||||
class Tab
|
||||
{
|
||||
public:
|
||||
PropSheet *sheet; //back pointer ..
|
||||
virtual void Init(HWND hDlg) {}
|
||||
virtual void Command(HWND hDlg, WPARAM wParam) {}
|
||||
virtual void Apply(HWND hDlg) {}
|
||||
virtual bool HasPrev() {return true;}
|
||||
virtual bool HasFinish() {return false;}
|
||||
virtual bool HasNext() {return true;}
|
||||
static INT_PTR __stdcall TabDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
|
||||
};
|
||||
|
||||
|
||||
class WizExteriorPage : public Tab
|
||||
{
|
||||
INT captionID;
|
||||
public:
|
||||
WizExteriorPage(INT caption) {captionID = caption;}
|
||||
void Init(HWND hDlg);
|
||||
};
|
||||
|
||||
|
||||
class WizFirstPage : public WizExteriorPage
|
||||
{
|
||||
public:
|
||||
WizFirstPage(INT caption) : WizExteriorPage(caption) {}
|
||||
bool HasPrev() {return false;}
|
||||
};
|
||||
|
||||
|
||||
class WizLastPage : public WizExteriorPage
|
||||
{
|
||||
public:
|
||||
WizLastPage(INT caption) : WizExteriorPage(caption) {}
|
||||
bool HasNext() {return false;}
|
||||
bool HasFinish() {return true;}
|
||||
};
|
||||
|
||||
|
||||
class WizInteriorPage : public Tab
|
||||
{
|
||||
public:
|
||||
};
|
||||
|
||||
class PropSheet
|
||||
{
|
||||
LPCTSTR watermark;
|
||||
LPCTSTR header;
|
||||
HFONT hTitleFont;
|
||||
HFONT hDialogFont;
|
||||
HICON icon;
|
||||
struct Page
|
||||
{
|
||||
Page(Tab *_tab, LPCTSTR _resource, LPCTSTR _title, LPCTSTR _subtitle = 0)
|
||||
: tab(_tab), resource(_resource), title(_title), hdrSubTitle(_subtitle) {}
|
||||
Tab *tab;
|
||||
LPCTSTR resource;
|
||||
LPCTSTR title;
|
||||
LPCTSTR hdrSubTitle;
|
||||
};
|
||||
public:
|
||||
PropSheet();
|
||||
typedef std::vector<Page> DlgList;
|
||||
DlgList list;
|
||||
void SetWaterMark(LPCTSTR _watermark) {watermark=_watermark;}
|
||||
void SetHeader(LPCTSTR _header) {header=_header;}
|
||||
void SetIcon(HICON _icon) {icon = _icon;}
|
||||
void Add(Tab *tab, LPCTSTR resource, LPCTSTR title, LPCTSTR subtitle = 0);
|
||||
void Show(HINSTANCE hInstance, HWND hParent, std::string title, int startpage=0, bool floating = false, bool wizard = false);
|
||||
HFONT GetTitleFont() {return hTitleFont;}
|
||||
HFONT GetFont() {return hDialogFont;}
|
||||
static int CALLBACK Callback(HWND hwndDlg, UINT uMsg, LPARAM lParam);
|
||||
};
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,147 @@
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include "ShellUtil.h"
|
||||
|
||||
#include <commctrl.h>
|
||||
#include <commdlg.h>
|
||||
|
||||
#include "shlobj.h"
|
||||
|
||||
#include <xstring>
|
||||
#include <string>
|
||||
|
||||
|
||||
namespace W32Util
|
||||
{
|
||||
std::string BrowseForFolder(HWND parent, char *title)
|
||||
{
|
||||
BROWSEINFO info;
|
||||
memset(&info,0,sizeof(info));
|
||||
info.hwndOwner = parent;
|
||||
info.lpszTitle = title;
|
||||
info.ulFlags = BIF_EDITBOX | BIF_RETURNONLYFSDIRS;
|
||||
|
||||
//info.pszDisplayName
|
||||
LPCITEMIDLIST idList = SHBrowseForFolder(&info);
|
||||
|
||||
char temp[MAX_PATH];
|
||||
SHGetPathFromIDList(idList, temp);
|
||||
if (strlen(temp))
|
||||
{
|
||||
return temp;
|
||||
}
|
||||
else
|
||||
return "";
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------
|
||||
// function WinBrowseForFileName
|
||||
//---------------------------------------------------------------------------------------------------
|
||||
bool BrowseForFileName (bool _bLoad, HWND _hParent, const char *_pTitle,
|
||||
const char *_pInitialFolder,const char *_pFilter,const char *_pExtension,
|
||||
std::string& _strFileName)
|
||||
{
|
||||
char szFile [MAX_PATH+1];
|
||||
char szFileTitle [MAX_PATH+1];
|
||||
|
||||
strcpy (szFile,"");
|
||||
strcpy (szFileTitle,"");
|
||||
|
||||
OPENFILENAME ofn;
|
||||
|
||||
ZeroMemory (&ofn,sizeof (ofn));
|
||||
|
||||
ofn.lStructSize = sizeof (OPENFILENAME);
|
||||
ofn.lpstrInitialDir = _pInitialFolder;
|
||||
ofn.lpstrFilter = _pFilter;
|
||||
ofn.nMaxFile = sizeof (szFile);
|
||||
ofn.lpstrFile = szFile;
|
||||
ofn.lpstrFileTitle = szFileTitle;
|
||||
ofn.nMaxFileTitle = sizeof (szFileTitle);
|
||||
ofn.lpstrDefExt = _pExtension;
|
||||
ofn.hwndOwner = _hParent;
|
||||
ofn.Flags = OFN_NOCHANGEDIR | OFN_EXPLORER | OFN_HIDEREADONLY;
|
||||
|
||||
if (_strFileName.size () != 0)
|
||||
ofn.lpstrFile = (char *)_strFileName.c_str();
|
||||
|
||||
if (((_bLoad)?GetOpenFileName (&ofn):GetSaveFileName (&ofn)))
|
||||
{
|
||||
_strFileName = ofn.lpstrFile;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
std::vector<std::string> BrowseForFileNameMultiSelect(bool _bLoad, HWND _hParent, const char *_pTitle,
|
||||
const char *_pInitialFolder,const char *_pFilter,const char *_pExtension)
|
||||
{
|
||||
char szFile [MAX_PATH+1+2048*2];
|
||||
char szFileTitle [MAX_PATH+1];
|
||||
|
||||
strcpy (szFile,"");
|
||||
strcpy (szFileTitle,"");
|
||||
|
||||
OPENFILENAME ofn;
|
||||
|
||||
ZeroMemory (&ofn,sizeof (ofn));
|
||||
|
||||
ofn.lStructSize = sizeof (OPENFILENAME);
|
||||
ofn.lpstrInitialDir = _pInitialFolder;
|
||||
ofn.lpstrFilter = _pFilter;
|
||||
ofn.nMaxFile = sizeof (szFile);
|
||||
ofn.lpstrFile = szFile;
|
||||
ofn.lpstrFileTitle = szFileTitle;
|
||||
ofn.nMaxFileTitle = sizeof (szFileTitle);
|
||||
ofn.lpstrDefExt = _pExtension;
|
||||
ofn.hwndOwner = _hParent;
|
||||
ofn.Flags = OFN_NOCHANGEDIR | OFN_EXPLORER | OFN_HIDEREADONLY | OFN_ALLOWMULTISELECT ;
|
||||
|
||||
std::vector<std::string> files;
|
||||
|
||||
if (((_bLoad)?GetOpenFileName (&ofn):GetSaveFileName (&ofn)))
|
||||
{
|
||||
std::string directory = ofn.lpstrFile;
|
||||
char *temp = ofn.lpstrFile;
|
||||
char *oldtemp = temp;
|
||||
temp+=strlen(temp)+1;
|
||||
if (*temp==0)
|
||||
{
|
||||
//we only got one file
|
||||
files.push_back(std::string(oldtemp));
|
||||
}
|
||||
else
|
||||
{
|
||||
while (*temp)
|
||||
{
|
||||
files.push_back(directory+"\\"+std::string(temp));
|
||||
temp+=strlen(temp)+1;
|
||||
}
|
||||
}
|
||||
return files;
|
||||
}
|
||||
else
|
||||
return std::vector<std::string>(); // empty vector;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "stdafx.h"
|
||||
#include <xstring>
|
||||
#include <vector>
|
||||
|
||||
namespace W32Util
|
||||
{
|
||||
std::string BrowseForFolder(HWND parent, char *title);
|
||||
bool BrowseForFileName (bool _bLoad, HWND _hParent, const char *_pTitle,
|
||||
const char *_pInitialFolder,const char *_pFilter,const char *_pExtension,
|
||||
std::string& _strFileName);
|
||||
std::vector<std::string> BrowseForFileNameMultiSelect(bool _bLoad, HWND _hParent, const char *_pTitle,
|
||||
const char *_pInitialFolder,const char *_pFilter,const char *_pExtension);
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include "TabControl.h"
|
||||
#include <commctrl.h>
|
||||
|
||||
namespace W32Util
|
||||
{
|
||||
TabControl::TabControl(HINSTANCE _hInstance, HWND _hTabCtrl,DLGPROC _lpDialogFunc) :
|
||||
m_hInstance(_hInstance),
|
||||
m_hTabCtrl(_hTabCtrl),
|
||||
m_numDialogs(0)
|
||||
{
|
||||
for (int i=0; i<MAX_WIN_DIALOGS; i++)
|
||||
m_WinDialogs[i] = NULL;
|
||||
}
|
||||
|
||||
TabControl::~TabControl(void)
|
||||
{}
|
||||
|
||||
HWND TabControl::AddItem (char* _szText,int _iResource,DLGPROC _lpDialogFunc)
|
||||
{
|
||||
TCITEM tcItem;
|
||||
|
||||
ZeroMemory (&tcItem,sizeof (tcItem));
|
||||
|
||||
tcItem.mask = TCIF_TEXT | TCIF_IMAGE;
|
||||
tcItem.dwState = 0;
|
||||
tcItem.pszText = _szText;
|
||||
tcItem.cchTextMax = sizeof (_szText);
|
||||
tcItem.iImage = -1;
|
||||
|
||||
int nResult = TabCtrl_InsertItem (m_hTabCtrl,TabCtrl_GetItemCount (m_hTabCtrl),&tcItem);
|
||||
|
||||
|
||||
HWND hDialog = CreateDialog(m_hInstance,(LPCSTR)_iResource,m_hTabCtrl,_lpDialogFunc);
|
||||
RECT rectInnerWindow = {0,0,0,0};
|
||||
|
||||
GetWindowRect (m_hTabCtrl,&rectInnerWindow);
|
||||
|
||||
TabCtrl_AdjustRect (m_hTabCtrl,FALSE,&rectInnerWindow);
|
||||
|
||||
POINT pntPosition = {rectInnerWindow.left,rectInnerWindow.top};
|
||||
ScreenToClient(m_hTabCtrl, &pntPosition);
|
||||
|
||||
SetWindowPos(hDialog, 0,
|
||||
pntPosition.x, pntPosition.y,
|
||||
rectInnerWindow.right - rectInnerWindow.left,rectInnerWindow.bottom - rectInnerWindow.top,0);
|
||||
ShowWindow(hDialog,SW_NORMAL);
|
||||
|
||||
m_WinDialogs[m_numDialogs] = hDialog;
|
||||
m_numDialogs++;
|
||||
|
||||
SelectDialog (0);
|
||||
|
||||
return hDialog;
|
||||
}
|
||||
|
||||
void TabControl::SelectDialog (int _nDialogId)
|
||||
{
|
||||
for (int i = 0 ; i < m_numDialogs ; i ++)
|
||||
if (m_WinDialogs[i] != NULL)
|
||||
ShowWindow(m_WinDialogs[i],i == _nDialogId ? SW_NORMAL : SW_HIDE);
|
||||
}
|
||||
|
||||
void TabControl::MessageHandler(UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
if (message == WM_NOTIFY)
|
||||
{
|
||||
NMHDR* pNotifyMessage = NULL;
|
||||
pNotifyMessage = (LPNMHDR)lParam;
|
||||
if (pNotifyMessage->hwndFrom == m_hTabCtrl)
|
||||
{
|
||||
int iPage = TabCtrl_GetCurSel (m_hTabCtrl);
|
||||
SelectDialog (iPage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
namespace W32Util
|
||||
{
|
||||
#define MAX_WIN_DIALOGS 32
|
||||
|
||||
class TabControl
|
||||
{
|
||||
private:
|
||||
|
||||
HINSTANCE m_hInstance;
|
||||
HWND m_hWndParent;
|
||||
HWND m_hTabCtrl;
|
||||
|
||||
HWND m_WinDialogs[MAX_WIN_DIALOGS];
|
||||
int m_numDialogs;
|
||||
|
||||
public:
|
||||
|
||||
TabControl(HINSTANCE _hInstance, HWND _hTabCtrl,DLGPROC _lpDialogFunc);
|
||||
|
||||
~TabControl(void);
|
||||
|
||||
HWND AddItem (char* _szText,int _iResource,DLGPROC _lpDialogFunc);
|
||||
|
||||
void SelectDialog (int _nDialogId);
|
||||
|
||||
void MessageHandler(UINT message, WPARAM wParam, LPARAM lParam);
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include "Thread.h"
|
||||
|
||||
namespace W32Util
|
||||
{
|
||||
Thread::Thread ( DWORD (WINAPI * pFun) (void* arg), void* pArg)
|
||||
{
|
||||
_handle = CreateThread (
|
||||
0, // Security attributes
|
||||
0, // Stack size
|
||||
pFun,
|
||||
pArg,
|
||||
CREATE_SUSPENDED,
|
||||
&_tid);
|
||||
}
|
||||
|
||||
Thread::~Thread (void)
|
||||
{
|
||||
if (_handle != NULL)
|
||||
{
|
||||
if (CloseHandle (_handle) == FALSE)
|
||||
{
|
||||
Terminate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Thread::Resume (void)
|
||||
{
|
||||
if (_handle != NULL)
|
||||
ResumeThread (_handle);
|
||||
}
|
||||
|
||||
void Thread::WaitForDeath (void)
|
||||
{
|
||||
if (_handle != NULL)
|
||||
WaitForSingleObject (_handle, 100);
|
||||
}
|
||||
|
||||
void Thread::Terminate (void)
|
||||
{
|
||||
if (_handle != NULL)
|
||||
TerminateThread (_handle, 0);
|
||||
_handle = NULL;
|
||||
}
|
||||
|
||||
void Thread::SetPriority (int _nPriority)
|
||||
{
|
||||
if (_handle != NULL)
|
||||
SetThreadPriority(_handle, _nPriority);
|
||||
}
|
||||
|
||||
void Thread::Suspend (void)
|
||||
{
|
||||
if (_handle != NULL)
|
||||
SuspendThread(_handle);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
namespace W32Util
|
||||
{
|
||||
class Thread
|
||||
{
|
||||
private:
|
||||
HANDLE _handle;
|
||||
DWORD _tid; // thread id
|
||||
|
||||
public:
|
||||
Thread(DWORD (WINAPI * pFun) (void* arg), void* pArg);
|
||||
~Thread () ;
|
||||
|
||||
void Resume(void);
|
||||
void Suspend(void);
|
||||
void WaitForDeath(void);
|
||||
void Terminate(void);
|
||||
void SetPriority(int _nPriority);
|
||||
bool IsActive (void);
|
||||
|
||||
HANDLE GetHandle(void) {return _handle;}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -0,0 +1,625 @@
|
||||
// Windows Template Library - WTL version 7.0
|
||||
// Copyright (C) 1997-2002 Microsoft Corporation
|
||||
// All rights reserved.
|
||||
//
|
||||
// This file is a part of the Windows Template Library.
|
||||
// The code and information is provided "as-is" without
|
||||
// warranty of any kind, either expressed or implied.
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <tchar.h>
|
||||
//#include <tmschema.h>
|
||||
#include <uxtheme.h>
|
||||
#pragma comment(lib, "uxtheme.lib")
|
||||
|
||||
// Note: To create an application that also runs on older versions of Windows,
|
||||
// use delay load of uxtheme.dll and ensure that no calls to the Theme API are
|
||||
// made if theming is not supported. It is enough to check if m_hTheme is NULL.
|
||||
// Example:
|
||||
// if(m_hTheme != NULL)
|
||||
// {
|
||||
// DrawThemeBackground(dc, BP_PUSHBUTTON, PBS_NORMAL, &rect, NULL);
|
||||
// DrawThemeText(dc, BP_PUSHBUTTON, PBS_NORMAL, L"Button", -1, DT_SINGLELINE | DT_CENTER | DT_VCENTER, 0, &rect);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// dc.DrawFrameControl(&rect, DFC_BUTTON, DFCS_BUTTONPUSH);
|
||||
// dc.DrawText(_T("Button"), -1, &rect, DT_SINGLELINE | DT_CENTER | DT_VCENTER);
|
||||
// }
|
||||
//
|
||||
// Delay load is NOT AUTOMATIC for VC++ 7, you have to link to delayimp.lib,
|
||||
// and add uxtheme.dll in the Linker.Input.Delay Loaded DLLs section of the
|
||||
// project properties.
|
||||
#if (_MSC_VER < 1300) && !defined(_WTL_NO_THEME_DELAYLOAD)
|
||||
#pragma comment(lib, "delayimp.lib")
|
||||
#pragma comment(linker, "/delayload:uxtheme.dll")
|
||||
#endif //(_MSC_VER < 1300) && !defined(_WTL_NO_THEME_DELAYLOAD)
|
||||
|
||||
|
||||
// Classes in this file
|
||||
//
|
||||
// CTheme
|
||||
// CThemeImpl<T, TBase>
|
||||
|
||||
|
||||
namespace WTL
|
||||
{
|
||||
|
||||
// CTheme - wrapper for theme handle
|
||||
|
||||
class CTheme
|
||||
{
|
||||
public:
|
||||
// Data members
|
||||
HTHEME m_hTheme;
|
||||
static int m_nIsThemingSupported;
|
||||
|
||||
// Constructor
|
||||
CTheme() : m_hTheme(NULL)
|
||||
{
|
||||
IsThemingSupported();
|
||||
}
|
||||
|
||||
// Operators and helpers
|
||||
bool IsThemeNull() const
|
||||
{
|
||||
return (m_hTheme == NULL);
|
||||
}
|
||||
|
||||
CTheme& operator =(HTHEME hTheme)
|
||||
{
|
||||
m_hTheme = hTheme;
|
||||
return *this;
|
||||
}
|
||||
|
||||
operator HTHEME() const
|
||||
{
|
||||
return m_hTheme;
|
||||
}
|
||||
|
||||
void Attach(HTHEME hTheme)
|
||||
{
|
||||
m_hTheme = hTheme;
|
||||
}
|
||||
|
||||
HTHEME Detach()
|
||||
{
|
||||
HTHEME hTheme = m_hTheme;
|
||||
m_hTheme = NULL;
|
||||
return hTheme;
|
||||
}
|
||||
|
||||
// Theme support helper
|
||||
static bool IsThemingSupported()
|
||||
{
|
||||
if(m_nIsThemingSupported == -1)
|
||||
{
|
||||
// ::EnterCriticalSection(&_Module.m_csStaticDataInit);
|
||||
if(m_nIsThemingSupported == -1)
|
||||
{
|
||||
HMODULE hThemeDLL = ::LoadLibrary(_T("uxtheme.dll"));
|
||||
m_nIsThemingSupported = (hThemeDLL != NULL) ? 1 : 0;
|
||||
if(hThemeDLL != NULL)
|
||||
::FreeLibrary(hThemeDLL);
|
||||
}
|
||||
// ::LeaveCriticalSection(&_Module.m_csStaticDataInit);
|
||||
}
|
||||
|
||||
//ATLASSERT(m_nIsThemingSupported != -1);
|
||||
return (m_nIsThemingSupported == 1);
|
||||
}
|
||||
|
||||
// Operations and theme properties
|
||||
HTHEME OpenThemeData(HWND hWnd, LPCWSTR pszClassList)
|
||||
{
|
||||
if(!IsThemingSupported())
|
||||
return NULL;
|
||||
|
||||
//ATLASSERT(m_hTheme == NULL);
|
||||
m_hTheme = ::OpenThemeData(hWnd, pszClassList);
|
||||
return m_hTheme;
|
||||
}
|
||||
|
||||
HRESULT CloseThemeData()
|
||||
{
|
||||
HRESULT hRet = S_FALSE;
|
||||
if(m_hTheme != NULL)
|
||||
{
|
||||
hRet = ::CloseThemeData(m_hTheme);
|
||||
if(SUCCEEDED(hRet))
|
||||
m_hTheme = NULL;
|
||||
}
|
||||
return hRet;
|
||||
}
|
||||
|
||||
HRESULT DrawThemeBackground(HDC hDC, int nPartID, int nStateID, LPCRECT pRect, LPCRECT pClipRect = NULL)
|
||||
{
|
||||
return ::DrawThemeBackground(m_hTheme, hDC, nPartID, nStateID, pRect, pClipRect);
|
||||
}
|
||||
|
||||
HRESULT DrawThemeText(HDC hDC, int nPartID, int nStateID, LPCWSTR pszText, int nCharCount, DWORD dwTextFlags, DWORD dwTextFlags2, LPCRECT pRect)
|
||||
{
|
||||
return ::DrawThemeText(m_hTheme, hDC, nPartID, nStateID, pszText, nCharCount, dwTextFlags, dwTextFlags2, pRect);
|
||||
}
|
||||
|
||||
HRESULT GetThemeBackgroundContentRect(HDC hDC, int nPartID, int nStateID, LPCRECT pBoundingRect, LPRECT pContentRect) const
|
||||
{
|
||||
return ::GetThemeBackgroundContentRect(m_hTheme, hDC, nPartID, nStateID, pBoundingRect, pContentRect);
|
||||
}
|
||||
|
||||
HRESULT GetThemeBackgroundExtent(HDC hDC, int nPartID, int nStateID, LPCRECT pContentRect, LPRECT pExtentRect) const
|
||||
{
|
||||
return ::GetThemeBackgroundExtent(m_hTheme, hDC, nPartID, nStateID, pContentRect, pExtentRect);
|
||||
}
|
||||
|
||||
HRESULT GetThemePartSize(HDC hDC, int nPartID, int nStateID, LPRECT pRect, enum THEMESIZE eSize, LPSIZE pSize) const
|
||||
{
|
||||
//ATLASSERT(m_hTheme != NULL);
|
||||
return ::GetThemePartSize(m_hTheme, hDC, nPartID, nStateID, pRect, eSize, pSize);
|
||||
}
|
||||
|
||||
HRESULT GetThemeTextExtent(HDC hDC, int nPartID, int nStateID, LPCWSTR pszText, int nCharCount, DWORD dwTextFlags, LPCRECT pBoundingRect, LPRECT pExtentRect) const
|
||||
{
|
||||
//ATLASSERT(m_hTheme != NULL);
|
||||
return ::GetThemeTextExtent(m_hTheme, hDC, nPartID, nStateID, pszText, nCharCount, dwTextFlags, pBoundingRect, pExtentRect);
|
||||
}
|
||||
|
||||
HRESULT GetThemeTextMetrics(HDC hDC, int nPartID, int nStateID, PTEXTMETRIC pTextMetric) const
|
||||
{
|
||||
//ATLASSERT(m_hTheme != NULL);
|
||||
return ::GetThemeTextMetrics(m_hTheme, hDC, nPartID, nStateID, pTextMetric);
|
||||
}
|
||||
|
||||
HRESULT GetThemeBackgroundRegion(HDC hDC, int nPartID, int nStateID, LPCRECT pRect, HRGN* pRegion) const
|
||||
{
|
||||
//ATLASSERT(m_hTheme != NULL);
|
||||
return ::GetThemeBackgroundRegion(m_hTheme, hDC, nPartID, nStateID, pRect, pRegion);
|
||||
}
|
||||
|
||||
HRESULT HitTestThemeBackground(HDC hDC, int nPartID, int nStateID, DWORD dwOptions, LPCRECT pRect, HRGN hrgn, POINT ptTest, WORD* pwHitTestCode) const
|
||||
{
|
||||
//ATLASSERT(m_hTheme != NULL);
|
||||
return ::HitTestThemeBackground(m_hTheme, hDC, nPartID, nStateID, dwOptions, pRect, hrgn, ptTest, pwHitTestCode);
|
||||
}
|
||||
|
||||
HRESULT DrawThemeEdge(HDC hDC, int nPartID, int nStateID, LPCRECT pDestRect, UINT uEdge, UINT uFlags, LPRECT pContentRect = NULL)
|
||||
{
|
||||
//ATLASSERT(m_hTheme != NULL);
|
||||
return ::DrawThemeEdge(m_hTheme, hDC, nPartID, nStateID, pDestRect, uEdge, uFlags, pContentRect);
|
||||
}
|
||||
|
||||
HRESULT DrawThemeIcon(HDC hDC, int nPartID, int nStateID, LPCRECT pRect, HIMAGELIST himl, int nImageIndex)
|
||||
{
|
||||
//ATLASSERT(m_hTheme != NULL);
|
||||
return ::DrawThemeIcon(m_hTheme, hDC, nPartID, nStateID, pRect, himl, nImageIndex);
|
||||
}
|
||||
|
||||
BOOL IsThemePartDefined(int nPartID, int nStateID) const
|
||||
{
|
||||
//ATLASSERT(m_hTheme != NULL);
|
||||
return ::IsThemePartDefined(m_hTheme, nPartID, nStateID);
|
||||
}
|
||||
|
||||
BOOL IsThemeBackgroundPartiallyTransparent(int nPartID, int nStateID) const
|
||||
{
|
||||
//ATLASSERT(m_hTheme != NULL);
|
||||
return ::IsThemeBackgroundPartiallyTransparent(m_hTheme, nPartID, nStateID);
|
||||
}
|
||||
|
||||
HRESULT GetThemeColor(int nPartID, int nStateID, int nPropID, COLORREF* pColor) const
|
||||
{
|
||||
//ATLASSERT(m_hTheme != NULL);
|
||||
return ::GetThemeColor(m_hTheme, nPartID, nStateID, nPropID, pColor);
|
||||
}
|
||||
|
||||
HRESULT GetThemeMetric(HDC hDC, int nPartID, int nStateID, int nPropID, int* pnVal) const
|
||||
{
|
||||
//ATLASSERT(m_hTheme != NULL);
|
||||
return ::GetThemeMetric(m_hTheme, hDC, nPartID, nStateID, nPropID, pnVal);
|
||||
}
|
||||
|
||||
HRESULT GetThemeString(int nPartID, int nStateID, int nPropID, LPWSTR pszBuff, int cchMaxBuffChars) const
|
||||
{
|
||||
//ATLASSERT(m_hTheme != NULL);
|
||||
return ::GetThemeString(m_hTheme, nPartID, nStateID, nPropID, pszBuff, cchMaxBuffChars);
|
||||
}
|
||||
|
||||
HRESULT GetThemeBool(int nPartID, int nStateID, int nPropID, BOOL* pfVal) const
|
||||
{
|
||||
//ATLASSERT(m_hTheme != NULL);
|
||||
return ::GetThemeBool(m_hTheme, nPartID, nStateID, nPropID, pfVal);
|
||||
}
|
||||
|
||||
HRESULT GetThemeInt(int nPartID, int nStateID, int nPropID, int* pnVal) const
|
||||
{
|
||||
//ATLASSERT(m_hTheme != NULL);
|
||||
return ::GetThemeInt(m_hTheme, nPartID, nStateID, nPropID, pnVal);
|
||||
}
|
||||
|
||||
HRESULT GetThemeEnumValue(int nPartID, int nStateID, int nPropID, int* pnVal) const
|
||||
{
|
||||
//ATLASSERT(m_hTheme != NULL);
|
||||
return ::GetThemeEnumValue(m_hTheme, nPartID, nStateID, nPropID, pnVal);
|
||||
}
|
||||
|
||||
HRESULT GetThemePosition(int nPartID, int nStateID, int nPropID, LPPOINT pPoint) const
|
||||
{
|
||||
//ATLASSERT(m_hTheme != NULL);
|
||||
return ::GetThemePosition(m_hTheme, nPartID, nStateID, nPropID, pPoint);
|
||||
}
|
||||
|
||||
HRESULT GetThemeFont(int nPartID, HDC hDC, int nStateID, int nPropID, LOGFONT* pFont) const
|
||||
{
|
||||
//ATLASSERT(m_hTheme != NULL);
|
||||
return ::GetThemeFont(m_hTheme, hDC, nPartID, nStateID, nPropID, pFont);
|
||||
}
|
||||
|
||||
HRESULT GetThemeRect(int nPartID, int nStateID, int nPropID, LPRECT pRect) const
|
||||
{
|
||||
//ATLASSERT(m_hTheme != NULL);
|
||||
return ::GetThemeRect(m_hTheme, nPartID, nStateID, nPropID, pRect);
|
||||
}
|
||||
|
||||
HRESULT GetThemeMargins(HDC hDC, int nPartID, int nStateID, int nPropID, LPRECT pRect, PMARGINS pMargins) const
|
||||
{
|
||||
//ATLASSERT(m_hTheme != NULL);
|
||||
return ::GetThemeMargins(m_hTheme, hDC, nPartID, nStateID, nPropID, pRect, pMargins);
|
||||
}
|
||||
|
||||
HRESULT GetThemeIntList(int nPartID, int nStateID, int nPropID, INTLIST* pIntList) const
|
||||
{
|
||||
//ATLASSERT(m_hTheme != NULL);
|
||||
return ::GetThemeIntList(m_hTheme, nPartID, nStateID, nPropID, pIntList);
|
||||
}
|
||||
|
||||
HRESULT GetThemePropertyOrigin(int nPartID, int nStateID, int nPropID, enum PROPERTYORIGIN* pOrigin) const
|
||||
{
|
||||
//ATLASSERT(m_hTheme != NULL);
|
||||
return ::GetThemePropertyOrigin(m_hTheme, nPartID, nStateID, nPropID, pOrigin);
|
||||
}
|
||||
|
||||
HRESULT GetThemeFilename(int nPartID, int nStateID, int nPropID, LPWSTR pszThemeFileName, int cchMaxBuffChars) const
|
||||
{
|
||||
//ATLASSERT(m_hTheme != NULL);
|
||||
return ::GetThemeFilename(m_hTheme, nPartID, nStateID, nPropID, pszThemeFileName, cchMaxBuffChars);
|
||||
}
|
||||
|
||||
COLORREF GetThemeSysColor(int nColorID) const
|
||||
{
|
||||
//ATLASSERT(m_hTheme != NULL);
|
||||
return ::GetThemeSysColor(m_hTheme, nColorID);
|
||||
}
|
||||
|
||||
HBRUSH GetThemeSysColorBrush(int nColorID) const
|
||||
{
|
||||
//ATLASSERT(m_hTheme != NULL);
|
||||
return ::GetThemeSysColorBrush(m_hTheme, nColorID);
|
||||
}
|
||||
|
||||
int GetThemeSysSize(int nSizeID) const
|
||||
{
|
||||
//ATLASSERT(m_hTheme != NULL);
|
||||
return ::GetThemeSysSize(m_hTheme, nSizeID);
|
||||
}
|
||||
|
||||
BOOL GetThemeSysBool(int nBoolID) const
|
||||
{
|
||||
//ATLASSERT(m_hTheme != NULL);
|
||||
return ::GetThemeSysBool(m_hTheme, nBoolID);
|
||||
}
|
||||
|
||||
HRESULT GetThemeSysFont(int nFontID, LOGFONT* plf) const
|
||||
{
|
||||
//ATLASSERT(m_hTheme != NULL);
|
||||
return ::GetThemeSysFont(m_hTheme, nFontID, plf);
|
||||
}
|
||||
|
||||
HRESULT GetThemeSysString(int nStringID, LPWSTR pszStringBuff, int cchMaxStringChars) const
|
||||
{
|
||||
//ATLASSERT(m_hTheme != NULL);
|
||||
return ::GetThemeSysString(m_hTheme, nStringID, pszStringBuff, cchMaxStringChars);
|
||||
}
|
||||
|
||||
HRESULT GetThemeSysInt(int nIntID, int* pnValue) const
|
||||
{
|
||||
//ATLASSERT(m_hTheme != NULL);
|
||||
return ::GetThemeSysInt(m_hTheme, nIntID, pnValue);
|
||||
}
|
||||
};
|
||||
|
||||
__declspec(selectany) int CTheme::m_nIsThemingSupported = -1;
|
||||
|
||||
|
||||
// CThemeImpl - theme support implementation
|
||||
|
||||
// Derive from this class to implement window with theme support.
|
||||
// Example:
|
||||
// class CMyThemeWindow : public CWindowImpl<CMyThemeWindow>, public CThemeImpl<CMyThemeWindow>
|
||||
// {
|
||||
// ...
|
||||
// BEGIN_MSG_MAP(CMyThemeWindow)
|
||||
// CHAIN_MSG_MAP(CThemeImpl<CMyThemeWindow>)
|
||||
// ...
|
||||
// END_MSG_MAP()
|
||||
// ...
|
||||
// };
|
||||
//
|
||||
// If you set theme class list, the class will automaticaly open/close/reopen theme data.
|
||||
|
||||
|
||||
// Helper for drawing theme client edge
|
||||
#if 0
|
||||
inline bool AtlDrawThemeClientEdge(HTHEME hTheme, HWND hWnd, HRGN hRgnUpdate = NULL, HBRUSH hBrush = NULL, int nPartID = 0, int nStateID = 0)
|
||||
{
|
||||
//ATLASSERT(hTheme != NULL);
|
||||
//ATLASSERT(::IsWindow(hWnd));
|
||||
|
||||
CWindowDC dc(hWnd);
|
||||
if(dc.IsNull())
|
||||
return false;
|
||||
|
||||
// Get border size
|
||||
int cxBorder = GetSystemMetrics(SM_CXBORDER);
|
||||
int cyBorder = GetSystemMetrics(SM_CYBORDER);
|
||||
if(SUCCEEDED(::GetThemeInt(hTheme, nPartID, nStateID, TMT_SIZINGBORDERWIDTH, &cxBorder)))
|
||||
cyBorder = cxBorder;
|
||||
|
||||
RECT rect;
|
||||
::GetWindowRect(hWnd, &rect);
|
||||
|
||||
// Remove the client edge from the update region
|
||||
int cxEdge = GetSystemMetrics(SM_CXEDGE);
|
||||
int cyEdge = GetSystemMetrics(SM_CYEDGE);
|
||||
::InflateRect(&rect, -cxEdge, -cyEdge);
|
||||
CRgn rgn;
|
||||
rgn.CreateRectRgnIndirect(&rect);
|
||||
if(rgn.IsNull())
|
||||
return false;
|
||||
|
||||
if(hRgnUpdate != NULL)
|
||||
rgn.CombineRgn(hRgnUpdate, rgn, RGN_AND);
|
||||
|
||||
::OffsetRect(&rect, -rect.left, -rect.top);
|
||||
|
||||
::OffsetRect(&rect, cxEdge, cyEdge);
|
||||
dc.ExcludeClipRect(&rect);
|
||||
::InflateRect(&rect, cxEdge, cyEdge);
|
||||
|
||||
::DrawThemeBackground(hTheme, dc, nPartID, nStateID, &rect, NULL);
|
||||
|
||||
// Use background brush too, since theme border might not cover everything
|
||||
if(cxBorder < cxEdge && cyBorder < cyEdge)
|
||||
{
|
||||
if(hBrush == NULL)
|
||||
// need conditional code because types don't match in winuser.h
|
||||
#ifdef _WIN64
|
||||
hBrush = (HBRUSH)::GetClassLongPtr(hWnd, GCLP_HBRBACKGROUND);
|
||||
#else
|
||||
hBrush = (HBRUSH)UlongToPtr(::GetClassLongPtr(hWnd, GCLP_HBRBACKGROUND));
|
||||
#endif
|
||||
|
||||
::InflateRect(&rect, cxBorder - cxEdge, cyBorder - cyEdge);
|
||||
dc.FillRect(&rect, hBrush);
|
||||
}
|
||||
|
||||
::DefWindowProc(hWnd, WM_NCPAINT, (WPARAM)rgn.m_hRgn, 0L);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// Theme extended styles
|
||||
#define THEME_EX_3DCLIENTEDGE 0x00000001
|
||||
#define THEME_EX_THEMECLIENTEDGE 0x00000002
|
||||
|
||||
template <class T, class TBase = CTheme>
|
||||
class CThemeImpl : public TBase
|
||||
{
|
||||
public:
|
||||
// Data members
|
||||
LPWSTR m_lpstrThemeClassList;
|
||||
DWORD m_dwExtendedStyle; // theme specific extended styles
|
||||
|
||||
// Constructor & destructor
|
||||
CThemeImpl() : m_lpstrThemeClassList(NULL), m_dwExtendedStyle(0)
|
||||
{ }
|
||||
|
||||
~CThemeImpl()
|
||||
{
|
||||
delete m_lpstrThemeClassList;
|
||||
}
|
||||
|
||||
// Attributes
|
||||
bool SetThemeClassList(LPCWSTR lpstrThemeClassList)
|
||||
{
|
||||
if(m_lpstrThemeClassList != NULL)
|
||||
{
|
||||
delete m_lpstrThemeClassList;
|
||||
m_lpstrThemeClassList = NULL;
|
||||
}
|
||||
|
||||
if(lpstrThemeClassList == NULL)
|
||||
return true;
|
||||
|
||||
int cchLen = lstrlenW(lpstrThemeClassList) + 1;
|
||||
ATLTRY(m_lpstrThemeClassList = new WCHAR[cchLen]);
|
||||
if(m_lpstrThemeClassList == NULL)
|
||||
return false;
|
||||
|
||||
bool bRet = (lstrcpyW(m_lpstrThemeClassList, lpstrThemeClassList) != NULL);
|
||||
if(!bRet)
|
||||
{
|
||||
delete m_lpstrThemeClassList;
|
||||
m_lpstrThemeClassList = NULL;
|
||||
}
|
||||
return bRet;
|
||||
}
|
||||
|
||||
bool GetThemeClassList(LPWSTR lpstrThemeClassList, int cchListBuffer) const
|
||||
{
|
||||
int cchLen = lstrlenW(m_lpstrThemeClassList) + 1;
|
||||
if(cchListBuffer < cchLen)
|
||||
return false;
|
||||
|
||||
return (lstrcpyW(lpstrThemeClassList, m_lpstrThemeClassList) != NULL);
|
||||
}
|
||||
|
||||
LPCWSTR GetThemeClassList() const
|
||||
{
|
||||
return m_lpstrThemeClassList;
|
||||
}
|
||||
|
||||
DWORD SetThemeExtendedStyle(DWORD dwExtendedStyle, DWORD dwMask = 0)
|
||||
{
|
||||
DWORD dwPrevStyle = m_dwExtendedStyle;
|
||||
if(dwMask == 0)
|
||||
m_dwExtendedStyle = dwExtendedStyle;
|
||||
else
|
||||
m_dwExtendedStyle = (m_dwExtendedStyle & ~dwMask) | (dwExtendedStyle & dwMask);
|
||||
return dwPrevStyle;
|
||||
}
|
||||
|
||||
DWORD GetThemeExtendedStyle() const
|
||||
{
|
||||
return m_dwExtendedStyle;
|
||||
}
|
||||
|
||||
// Operations
|
||||
HTHEME OpenThemeData()
|
||||
{
|
||||
T* pT = static_cast<T*>(this);
|
||||
//ATLASSERT(::IsWindow(pT->m_hWnd));
|
||||
//ATLASSERT(m_lpstrThemeClassList != NULL);
|
||||
if(m_lpstrThemeClassList == NULL)
|
||||
return NULL;
|
||||
CloseThemeData();
|
||||
return TBase::OpenThemeData(pT->m_hWnd, m_lpstrThemeClassList);
|
||||
}
|
||||
|
||||
HTHEME OpenThemeData(LPCWSTR pszClassList)
|
||||
{
|
||||
if(!SetThemeClassList(pszClassList))
|
||||
return NULL;
|
||||
return OpenThemeData();
|
||||
}
|
||||
|
||||
HRESULT SetWindowTheme(LPCWSTR pszSubAppName, LPCWSTR pszSubIDList)
|
||||
{
|
||||
if(!IsThemingSupported())
|
||||
return S_FALSE;
|
||||
|
||||
T* pT = static_cast<T*>(this);
|
||||
//ATLASSERT(::IsWindow(pT->m_hWnd));
|
||||
return ::SetWindowTheme(pT->m_hWnd, pszSubAppName, pszSubIDList);
|
||||
}
|
||||
|
||||
HTHEME GetWindowTheme() const
|
||||
{
|
||||
if(!IsThemingSupported())
|
||||
return NULL;
|
||||
|
||||
const T* pT = static_cast<const T*>(this);
|
||||
//ATLASSERT(::IsWindow(pT->m_hWnd));
|
||||
return ::GetWindowTheme(pT->m_hWnd);
|
||||
}
|
||||
|
||||
HRESULT EnableThemeDialogTexture(BOOL bEnable)
|
||||
{
|
||||
if(!IsThemingSupported())
|
||||
return S_FALSE;
|
||||
|
||||
T* pT = static_cast<T*>(this);
|
||||
//ATLASSERT(::IsWindow(pT->m_hWnd));
|
||||
return ::EnableThemeDialogTexture(pT->m_hWnd, bEnable);
|
||||
}
|
||||
|
||||
BOOL IsThemeDialogTextureEnabled() const
|
||||
{
|
||||
if(!IsThemingSupported())
|
||||
return FALSE;
|
||||
|
||||
const T* pT = static_cast<const T*>(this);
|
||||
//ATLASSERT(::IsWindow(pT->m_hWnd));
|
||||
return ::IsThemeDialogTextureEnabled(pT->m_hWnd);
|
||||
}
|
||||
|
||||
HRESULT DrawThemeParentBackground(HDC hDC, LPRECT pRect = NULL)
|
||||
{
|
||||
if(!IsThemingSupported())
|
||||
return S_FALSE;
|
||||
|
||||
T* pT = static_cast<T*>(this);
|
||||
//ATLASSERT(::IsWindow(pT->m_hWnd));
|
||||
return ::DrawThemeParentBackground(pT->m_hWnd, hDC, pRect);
|
||||
}
|
||||
|
||||
// Message map and handlers
|
||||
// Note: If you handle any of these messages in your derived class,
|
||||
// it is better to put CHAIN_MSG_MAP at the start of your message map.
|
||||
BEGIN_MSG_MAP(CThemeImpl)
|
||||
MESSAGE_HANDLER(WM_CREATE, OnCreate)
|
||||
MESSAGE_HANDLER(WM_DESTROY, OnDestroy)
|
||||
MESSAGE_HANDLER(WM_THEMECHANGED, OnThemeChanged)
|
||||
MESSAGE_HANDLER(WM_NCPAINT, OnNcPaint)
|
||||
END_MSG_MAP()
|
||||
|
||||
LRESULT OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||
{
|
||||
if(m_lpstrThemeClassList != NULL)
|
||||
OpenThemeData();
|
||||
bHandled = FALSE;
|
||||
return 1;
|
||||
}
|
||||
|
||||
LRESULT OnDestroy(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& bHandled)
|
||||
{
|
||||
CloseThemeData();
|
||||
bHandled = FALSE;
|
||||
return 1;
|
||||
}
|
||||
|
||||
LRESULT OnThemeChanged(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled)
|
||||
{
|
||||
CloseThemeData();
|
||||
if(m_lpstrThemeClassList != NULL)
|
||||
OpenThemeData();
|
||||
bHandled = FALSE;
|
||||
return 1;
|
||||
}
|
||||
|
||||
LRESULT OnNcPaint(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||
{
|
||||
T* pT = static_cast<T*>(this);
|
||||
//ATLASSERT(::IsWindow(pT->m_hWnd));
|
||||
LRESULT lRet = 0;
|
||||
bHandled = FALSE;
|
||||
if(IsThemingSupported() && ((pT->GetExStyle() & WS_EX_CLIENTEDGE) != 0))
|
||||
{
|
||||
if((m_dwExtendedStyle & THEME_EX_3DCLIENTEDGE) != 0)
|
||||
{
|
||||
lRet = ::DefWindowProc(pT->m_hWnd, uMsg, wParam, lParam);
|
||||
bHandled = TRUE;
|
||||
}
|
||||
else if((m_hTheme != NULL) && ((m_dwExtendedStyle & THEME_EX_THEMECLIENTEDGE) != 0))
|
||||
{
|
||||
HRGN hRgn = (wParam != 1) ? (HRGN)wParam : NULL;
|
||||
if(pT->DrawThemeClientEdge(hRgn))
|
||||
bHandled = TRUE;
|
||||
}
|
||||
}
|
||||
return lRet;
|
||||
}
|
||||
|
||||
// Drawing helper
|
||||
bool DrawThemeClientEdge(HRGN hRgnUpdate)
|
||||
{
|
||||
T* pT = static_cast<T*>(this);
|
||||
return AtlDrawThemeClientEdge(m_hTheme, pT->m_hWnd, hRgnUpdate, NULL, 0, 0);
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
}; //namespace WTL
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
/* jconfig.mc6 --- jconfig.h for Microsoft C on MS-DOS, version 6.00A & up. */
|
||||
/* see jconfig.doc for explanations */
|
||||
|
||||
#define HAVE_PROTOTYPES
|
||||
#define HAVE_UNSIGNED_CHAR
|
||||
#define HAVE_UNSIGNED_SHORT
|
||||
/* #define void char */
|
||||
/* #define const */
|
||||
#undef CHAR_IS_UNSIGNED
|
||||
#define HAVE_STDDEF_H
|
||||
#define HAVE_STDLIB_H
|
||||
#undef NEED_BSD_STRINGS
|
||||
#undef NEED_SYS_TYPES_H
|
||||
//#define NEED_FAR_POINTERS /* for small or medium memory model */
|
||||
#undef NEED_SHORT_EXTERNAL_NAMES
|
||||
#undef INCOMPLETE_TYPES_BROKEN
|
||||
|
||||
#ifdef JPEG_INTERNALS
|
||||
|
||||
#undef RIGHT_SHIFT_IS_UNSIGNED
|
||||
|
||||
//#define USE_MSDOS_MEMMGR /* Define this if you use jmemdos.c */
|
||||
|
||||
#define MAX_ALLOC_CHUNK 65520L /* Maximum request to malloc() */
|
||||
|
||||
//#define USE_FMEM /* Microsoft has _fmemcpy() and _fmemset() */
|
||||
|
||||
#define NEED_FHEAPMIN /* far heap management routines are broken */
|
||||
|
||||
#define SHORTxLCONST_32 /* enable compiler-specific DCT optimization */
|
||||
/* Note: the above define is known to improve the code with Microsoft C 6.00A.
|
||||
* I do not know whether it is good for later compiler versions.
|
||||
* Please report any info on this point to jpeg-info@uunet.uu.net.
|
||||
*/
|
||||
|
||||
#endif /* JPEG_INTERNALS */
|
||||
|
||||
#ifdef JPEG_CJPEG_DJPEG
|
||||
|
||||
#define BMP_SUPPORTED /* BMP image file format */
|
||||
#define GIF_SUPPORTED /* GIF image file format */
|
||||
#define PPM_SUPPORTED /* PBMPLUS PPM/PGM image file format */
|
||||
#undef RLE_SUPPORTED /* Utah RLE image file format */
|
||||
#define TARGA_SUPPORTED /* Targa image file format */
|
||||
|
||||
#define TWO_FILE_COMMANDLINE
|
||||
#define USE_SETMODE /* Microsoft has setmode() */
|
||||
#define NEED_SIGNAL_CATCHER /* Define this if you use jmemdos.c */
|
||||
#undef DONT_USE_B_MODE
|
||||
#undef PROGRESS_REPORT /* optional */
|
||||
|
||||
#endif /* JPEG_CJPEG_DJPEG */
|
||||
@@ -0,0 +1,363 @@
|
||||
/*
|
||||
* jmorecfg.h
|
||||
*
|
||||
* Copyright (C) 1991-1997, Thomas G. Lane.
|
||||
* This file is part of the Independent JPEG Group's software.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
* This file contains additional configuration options that customize the
|
||||
* JPEG software for special applications or support machine-dependent
|
||||
* optimizations. Most users will not need to touch this file.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* Define BITS_IN_JSAMPLE as either
|
||||
* 8 for 8-bit sample values (the usual setting)
|
||||
* 12 for 12-bit sample values
|
||||
* Only 8 and 12 are legal data precisions for lossy JPEG according to the
|
||||
* JPEG standard, and the IJG code does not support anything else!
|
||||
* We do not support run-time selection of data precision, sorry.
|
||||
*/
|
||||
|
||||
#define BITS_IN_JSAMPLE 8 /* use 8 or 12 */
|
||||
|
||||
|
||||
/*
|
||||
* Maximum number of components (color channels) allowed in JPEG image.
|
||||
* To meet the letter of the JPEG spec, set this to 255. However, darn
|
||||
* few applications need more than 4 channels (maybe 5 for CMYK + alpha
|
||||
* mask). We recommend 10 as a reasonable compromise; use 4 if you are
|
||||
* really short on memory. (Each allowed component costs a hundred or so
|
||||
* bytes of storage, whether actually used in an image or not.)
|
||||
*/
|
||||
|
||||
#define MAX_COMPONENTS 10 /* maximum number of image components */
|
||||
|
||||
|
||||
/*
|
||||
* Basic data types.
|
||||
* You may need to change these if you have a machine with unusual data
|
||||
* type sizes; for example, "char" not 8 bits, "short" not 16 bits,
|
||||
* or "long" not 32 bits. We don't care whether "int" is 16 or 32 bits,
|
||||
* but it had better be at least 16.
|
||||
*/
|
||||
|
||||
/* Representation of a single sample (pixel element value).
|
||||
* We frequently allocate large arrays of these, so it's important to keep
|
||||
* them small. But if you have memory to burn and access to char or short
|
||||
* arrays is very slow on your hardware, you might want to change these.
|
||||
*/
|
||||
|
||||
#if BITS_IN_JSAMPLE == 8
|
||||
/* JSAMPLE should be the smallest type that will hold the values 0..255.
|
||||
* You can use a signed char by having GETJSAMPLE mask it with 0xFF.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_UNSIGNED_CHAR
|
||||
|
||||
typedef unsigned char JSAMPLE;
|
||||
#define GETJSAMPLE(value) ((int) (value))
|
||||
|
||||
#else /* not HAVE_UNSIGNED_CHAR */
|
||||
|
||||
typedef char JSAMPLE;
|
||||
#ifdef CHAR_IS_UNSIGNED
|
||||
#define GETJSAMPLE(value) ((int) (value))
|
||||
#else
|
||||
#define GETJSAMPLE(value) ((int) (value) & 0xFF)
|
||||
#endif /* CHAR_IS_UNSIGNED */
|
||||
|
||||
#endif /* HAVE_UNSIGNED_CHAR */
|
||||
|
||||
#define MAXJSAMPLE 255
|
||||
#define CENTERJSAMPLE 128
|
||||
|
||||
#endif /* BITS_IN_JSAMPLE == 8 */
|
||||
|
||||
|
||||
#if BITS_IN_JSAMPLE == 12
|
||||
/* JSAMPLE should be the smallest type that will hold the values 0..4095.
|
||||
* On nearly all machines "short" will do nicely.
|
||||
*/
|
||||
|
||||
typedef short JSAMPLE;
|
||||
#define GETJSAMPLE(value) ((int) (value))
|
||||
|
||||
#define MAXJSAMPLE 4095
|
||||
#define CENTERJSAMPLE 2048
|
||||
|
||||
#endif /* BITS_IN_JSAMPLE == 12 */
|
||||
|
||||
|
||||
/* Representation of a DCT frequency coefficient.
|
||||
* This should be a signed value of at least 16 bits; "short" is usually OK.
|
||||
* Again, we allocate large arrays of these, but you can change to int
|
||||
* if you have memory to burn and "short" is really slow.
|
||||
*/
|
||||
|
||||
typedef short JCOEF;
|
||||
|
||||
|
||||
/* Compressed datastreams are represented as arrays of JOCTET.
|
||||
* These must be EXACTLY 8 bits wide, at least once they are written to
|
||||
* external storage. Note that when using the stdio data source/destination
|
||||
* managers, this is also the data type passed to fread/fwrite.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_UNSIGNED_CHAR
|
||||
|
||||
typedef unsigned char JOCTET;
|
||||
#define GETJOCTET(value) (value)
|
||||
|
||||
#else /* not HAVE_UNSIGNED_CHAR */
|
||||
|
||||
typedef char JOCTET;
|
||||
#ifdef CHAR_IS_UNSIGNED
|
||||
#define GETJOCTET(value) (value)
|
||||
#else
|
||||
#define GETJOCTET(value) ((value) & 0xFF)
|
||||
#endif /* CHAR_IS_UNSIGNED */
|
||||
|
||||
#endif /* HAVE_UNSIGNED_CHAR */
|
||||
|
||||
|
||||
/* These typedefs are used for various table entries and so forth.
|
||||
* They must be at least as wide as specified; but making them too big
|
||||
* won't cost a huge amount of memory, so we don't provide special
|
||||
* extraction code like we did for JSAMPLE. (In other words, these
|
||||
* typedefs live at a different point on the speed/space tradeoff curve.)
|
||||
*/
|
||||
|
||||
/* UINT8 must hold at least the values 0..255. */
|
||||
|
||||
#ifdef HAVE_UNSIGNED_CHAR
|
||||
typedef unsigned char UINT8;
|
||||
#else /* not HAVE_UNSIGNED_CHAR */
|
||||
#ifdef CHAR_IS_UNSIGNED
|
||||
typedef char UINT8;
|
||||
#else /* not CHAR_IS_UNSIGNED */
|
||||
typedef short UINT8;
|
||||
#endif /* CHAR_IS_UNSIGNED */
|
||||
#endif /* HAVE_UNSIGNED_CHAR */
|
||||
|
||||
/* UINT16 must hold at least the values 0..65535. */
|
||||
|
||||
#ifdef HAVE_UNSIGNED_SHORT
|
||||
typedef unsigned short UINT16;
|
||||
#else /* not HAVE_UNSIGNED_SHORT */
|
||||
typedef unsigned int UINT16;
|
||||
#endif /* HAVE_UNSIGNED_SHORT */
|
||||
|
||||
/* INT16 must hold at least the values -32768..32767. */
|
||||
|
||||
#ifndef XMD_H /* X11/xmd.h correctly defines INT16 */
|
||||
typedef short INT16;
|
||||
#endif
|
||||
|
||||
/* INT32 must hold at least signed 32-bit values. */
|
||||
|
||||
#ifndef XMD_H /* X11/xmd.h correctly defines INT32 */
|
||||
typedef long INT32;
|
||||
#endif
|
||||
|
||||
/* Datatype used for image dimensions. The JPEG standard only supports
|
||||
* images up to 64K*64K due to 16-bit fields in SOF markers. Therefore
|
||||
* "unsigned int" is sufficient on all machines. However, if you need to
|
||||
* handle larger images and you don't mind deviating from the spec, you
|
||||
* can change this datatype.
|
||||
*/
|
||||
|
||||
typedef unsigned int JDIMENSION;
|
||||
|
||||
#define JPEG_MAX_DIMENSION 65500L /* a tad under 64K to prevent overflows */
|
||||
|
||||
|
||||
/* These macros are used in all function definitions and extern declarations.
|
||||
* You could modify them if you need to change function linkage conventions;
|
||||
* in particular, you'll need to do that to make the library a Windows DLL.
|
||||
* Another application is to make all functions global for use with debuggers
|
||||
* or code profilers that require it.
|
||||
*/
|
||||
|
||||
/* a function called through method pointers: */
|
||||
#define METHODDEF(type) static type
|
||||
/* a function used only in its module: */
|
||||
#define LOCAL(type) static type
|
||||
/* a function referenced thru EXTERNs: */
|
||||
#define GLOBAL(type) type
|
||||
/* a reference to a GLOBAL function: */
|
||||
#define EXTERN(type) extern type
|
||||
|
||||
|
||||
/* This macro is used to declare a "method", that is, a function pointer.
|
||||
* We want to supply prototype parameters if the compiler can cope.
|
||||
* Note that the arglist parameter must be parenthesized!
|
||||
* Again, you can customize this if you need special linkage keywords.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_PROTOTYPES
|
||||
#define JMETHOD(type,methodname,arglist) type (*methodname) arglist
|
||||
#else
|
||||
#define JMETHOD(type,methodname,arglist) type (*methodname) ()
|
||||
#endif
|
||||
|
||||
|
||||
/* Here is the pseudo-keyword for declaring pointers that must be "far"
|
||||
* on 80x86 machines. Most of the specialized coding for 80x86 is handled
|
||||
* by just saying "FAR *" where such a pointer is needed. In a few places
|
||||
* explicit coding is needed; see uses of the NEED_FAR_POINTERS symbol.
|
||||
*/
|
||||
|
||||
#ifdef NEED_FAR_POINTERS
|
||||
#define FAR far
|
||||
#else
|
||||
#define FAR
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* On a few systems, type boolean and/or its values FALSE, TRUE may appear
|
||||
* in standard header files. Or you may have conflicts with application-
|
||||
* specific header files that you want to include together with these files.
|
||||
* Defining HAVE_BOOLEAN before including jpeglib.h should make it work.
|
||||
*/
|
||||
|
||||
#ifndef HAVE_BOOLEAN
|
||||
typedef int boolean;
|
||||
#endif
|
||||
#ifndef FALSE /* in case these macros already exist */
|
||||
#define FALSE 0 /* values of boolean */
|
||||
#endif
|
||||
#ifndef TRUE
|
||||
#define TRUE 1
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* The remaining options affect code selection within the JPEG library,
|
||||
* but they don't need to be visible to most applications using the library.
|
||||
* To minimize application namespace pollution, the symbols won't be
|
||||
* defined unless JPEG_INTERNALS or JPEG_INTERNAL_OPTIONS has been defined.
|
||||
*/
|
||||
|
||||
#ifdef JPEG_INTERNALS
|
||||
#define JPEG_INTERNAL_OPTIONS
|
||||
#endif
|
||||
|
||||
#ifdef JPEG_INTERNAL_OPTIONS
|
||||
|
||||
|
||||
/*
|
||||
* These defines indicate whether to include various optional functions.
|
||||
* Undefining some of these symbols will produce a smaller but less capable
|
||||
* library. Note that you can leave certain source files out of the
|
||||
* compilation/linking process if you've #undef'd the corresponding symbols.
|
||||
* (You may HAVE to do that if your compiler doesn't like null source files.)
|
||||
*/
|
||||
|
||||
/* Arithmetic coding is unsupported for legal reasons. Complaints to IBM. */
|
||||
|
||||
/* Capability options common to encoder and decoder: */
|
||||
|
||||
#define DCT_ISLOW_SUPPORTED /* slow but accurate integer algorithm */
|
||||
#define DCT_IFAST_SUPPORTED /* faster, less accurate integer method */
|
||||
#define DCT_FLOAT_SUPPORTED /* floating-point: accurate, fast on fast HW */
|
||||
|
||||
/* Encoder capability options: */
|
||||
|
||||
#undef C_ARITH_CODING_SUPPORTED /* Arithmetic coding back end? */
|
||||
#define C_MULTISCAN_FILES_SUPPORTED /* Multiple-scan JPEG files? */
|
||||
#define C_PROGRESSIVE_SUPPORTED /* Progressive JPEG? (Requires MULTISCAN)*/
|
||||
#define ENTROPY_OPT_SUPPORTED /* Optimization of entropy coding parms? */
|
||||
/* Note: if you selected 12-bit data precision, it is dangerous to turn off
|
||||
* ENTROPY_OPT_SUPPORTED. The standard Huffman tables are only good for 8-bit
|
||||
* precision, so jchuff.c normally uses entropy optimization to compute
|
||||
* usable tables for higher precision. If you don't want to do optimization,
|
||||
* you'll have to supply different default Huffman tables.
|
||||
* The exact same statements apply for progressive JPEG: the default tables
|
||||
* don't work for progressive mode. (This may get fixed, however.)
|
||||
*/
|
||||
#define INPUT_SMOOTHING_SUPPORTED /* Input image smoothing option? */
|
||||
|
||||
/* Decoder capability options: */
|
||||
|
||||
#undef D_ARITH_CODING_SUPPORTED /* Arithmetic coding back end? */
|
||||
#define D_MULTISCAN_FILES_SUPPORTED /* Multiple-scan JPEG files? */
|
||||
#define D_PROGRESSIVE_SUPPORTED /* Progressive JPEG? (Requires MULTISCAN)*/
|
||||
#define SAVE_MARKERS_SUPPORTED /* jpeg_save_markers() needed? */
|
||||
#define BLOCK_SMOOTHING_SUPPORTED /* Block smoothing? (Progressive only) */
|
||||
#define IDCT_SCALING_SUPPORTED /* Output rescaling via IDCT? */
|
||||
#undef UPSAMPLE_SCALING_SUPPORTED /* Output rescaling at upsample stage? */
|
||||
#define UPSAMPLE_MERGING_SUPPORTED /* Fast path for sloppy upsampling? */
|
||||
#define QUANT_1PASS_SUPPORTED /* 1-pass color quantization? */
|
||||
#define QUANT_2PASS_SUPPORTED /* 2-pass color quantization? */
|
||||
|
||||
/* more capability options later, no doubt */
|
||||
|
||||
|
||||
/*
|
||||
* Ordering of RGB data in scanlines passed to or from the application.
|
||||
* If your application wants to deal with data in the order B,G,R, just
|
||||
* change these macros. You can also deal with formats such as R,G,B,X
|
||||
* (one extra byte per pixel) by changing RGB_PIXELSIZE. Note that changing
|
||||
* the offsets will also change the order in which colormap data is organized.
|
||||
* RESTRICTIONS:
|
||||
* 1. The sample applications cjpeg,djpeg do NOT support modified RGB formats.
|
||||
* 2. These macros only affect RGB<=>YCbCr color conversion, so they are not
|
||||
* useful if you are using JPEG color spaces other than YCbCr or grayscale.
|
||||
* 3. The color quantizer modules will not behave desirably if RGB_PIXELSIZE
|
||||
* is not 3 (they don't understand about dummy color components!). So you
|
||||
* can't use color quantization if you change that value.
|
||||
*/
|
||||
|
||||
#define RGB_RED 0 /* Offset of Red in an RGB scanline element */
|
||||
#define RGB_GREEN 1 /* Offset of Green */
|
||||
#define RGB_BLUE 2 /* Offset of Blue */
|
||||
#define RGB_PIXELSIZE 3 /* JSAMPLEs per RGB scanline element */
|
||||
|
||||
|
||||
/* Definitions for speed-related optimizations. */
|
||||
|
||||
|
||||
/* If your compiler supports inline functions, define INLINE
|
||||
* as the inline keyword; otherwise define it as empty.
|
||||
*/
|
||||
|
||||
#ifndef INLINE
|
||||
#ifdef __GNUC__ /* for instance, GNU C knows about inline */
|
||||
#define INLINE __inline__
|
||||
#endif
|
||||
#ifndef INLINE
|
||||
#define INLINE /* default is to define it as empty */
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
/* On some machines (notably 68000 series) "int" is 32 bits, but multiplying
|
||||
* two 16-bit shorts is faster than multiplying two ints. Define MULTIPLIER
|
||||
* as short on such a machine. MULTIPLIER must be at least 16 bits wide.
|
||||
*/
|
||||
|
||||
#ifndef MULTIPLIER
|
||||
#define MULTIPLIER int /* type for fastest integer multiply */
|
||||
#endif
|
||||
|
||||
|
||||
/* FAST_FLOAT should be either float or double, whichever is done faster
|
||||
* by your compiler. (Note that this type is only used in the floating point
|
||||
* DCT routines, so it only matters if you've defined DCT_FLOAT_SUPPORTED.)
|
||||
* Typically, float is faster in ANSI C compilers, while double is faster in
|
||||
* pre-ANSI compilers (because they insist on converting to double anyway).
|
||||
* The code below therefore chooses float if we have ANSI-style prototypes.
|
||||
*/
|
||||
|
||||
#ifndef FAST_FLOAT
|
||||
#ifdef HAVE_PROTOTYPES
|
||||
#define FAST_FLOAT float
|
||||
#else
|
||||
#define FAST_FLOAT double
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* JPEG_INTERNAL_OPTIONS */
|
||||
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,61 @@
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Visual C++ generated include file.
|
||||
// Used by resource.rc
|
||||
//
|
||||
#define IDD_ABOUT 101
|
||||
#define IDD_SETTINGS 102
|
||||
#define IDD_DEBUGGER 103
|
||||
#define IDD_ADVANCED 104
|
||||
#define IDD_ENHANCEMENTS 105
|
||||
#define IDC_ENABLETEXTURING 1001
|
||||
#define IDC_CHECK2 1002
|
||||
#define IDC_WIREFRAME 1002
|
||||
#define IDC_USESHADERS 1002
|
||||
#define IDC_FORCEANISOTROPY 1002
|
||||
#define IDC_FULLSCREENENABLE 1002
|
||||
#define IDC_LIST1 1003
|
||||
#define IDC_DEBUGSTEP 1004
|
||||
#define IDC_REGISTERS 1005
|
||||
#define IDC_ENABLEDEBUGGING 1006
|
||||
#define IDC_TAB1 1007
|
||||
#define IDC_REGISTERSELECT 1007
|
||||
#define IDC_ADAPTER 1008
|
||||
#define IDC_DEVICE 1009
|
||||
#define IDC_RESOLUTION 1010
|
||||
#define IDC_RESOLUTIONWINDOWED 1011
|
||||
#define IDC_ANTIALIASMODE 1012
|
||||
#define IDC_PPPARAM1 1013
|
||||
#define IDC_SHADERVERSION 1013
|
||||
#define IDC_PPPARAM2 1014
|
||||
#define IDC_CHECK1 1015
|
||||
#define IDC_POSTPROCESS 1016
|
||||
#define IDC_TRUFORM 1016
|
||||
#define IDC_PPPARAM1LABEL 1017
|
||||
#define IDC_POSTPROCESSEFFECT 1017
|
||||
#define IDC_PPPARAM2LABEL 1018
|
||||
#define IDC_PPPARAM1LABEL2 1018
|
||||
#define IDC_ANTIALIASQUALITY 1019
|
||||
#define IDC_ENABLEPOSTPROCESS 1020
|
||||
#define IDC_ANIMATE1 1021
|
||||
#define IDC_OVERLAYSTATS 1022
|
||||
#define IDC_DLOPTLEVEL 1023
|
||||
#define IDC_PREUPSCALETYPE 1024
|
||||
#define IDC_TRUFORMLEVEL 1025
|
||||
#define IDC_PREUPSCALE 1026
|
||||
#define IDC_SLIDER1 1027
|
||||
#define IDC_TEXDUMPPATH 1028
|
||||
#define IDC_TEXDUMP 1029
|
||||
#define IDC_FORCEFILTERING 1030
|
||||
#define IDC_BROWSETEXDUMPPATH 1031
|
||||
#define IDC_SHOWSHADERERRORS 1033
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 106
|
||||
#define _APS_NEXT_COMMAND_VALUE 40001
|
||||
#define _APS_NEXT_CONTROL_VALUE 1034
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
#endif
|
||||
@@ -0,0 +1,206 @@
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
//
|
||||
#include "resource.h"
|
||||
|
||||
#define APSTUDIO_READONLY_SYMBOLS
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 2 resource.
|
||||
//
|
||||
#include "afxres.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#undef APSTUDIO_READONLY_SYMBOLS
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// English (U.S.) resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
||||
#ifdef _WIN32
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
#pragma code_page(1252)
|
||||
#endif //_WIN32
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// TEXTINCLUDE
|
||||
//
|
||||
|
||||
1 TEXTINCLUDE
|
||||
BEGIN
|
||||
"resource.h\0"
|
||||
END
|
||||
|
||||
2 TEXTINCLUDE
|
||||
BEGIN
|
||||
"#include ""afxres.h""\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
3 TEXTINCLUDE
|
||||
BEGIN
|
||||
"\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
#endif // English (U.S.) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Swedish resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_SVE)
|
||||
#ifdef _WIN32
|
||||
LANGUAGE LANG_SWEDISH, SUBLANG_DEFAULT
|
||||
#pragma code_page(1252)
|
||||
#endif //_WIN32
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Dialog
|
||||
//
|
||||
|
||||
IDD_ABOUT DIALOGEX 0, 0, 188, 81
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Dolphin OpenGL Video Plugin"
|
||||
FONT 8, "MS Shell Dlg", 400, 0, 0x1
|
||||
BEGIN
|
||||
DEFPUSHBUTTON "Close",IDOK,131,60,50,14
|
||||
LTEXT "Author: zerofrog(@gmail.com)",IDC_STATIC,7,7,126,9
|
||||
LTEXT "Vertex/Pixel Shader 2.0 or higher, framebuffer objects, multiple render targets",IDC_STATIC,7,19,174,26
|
||||
END
|
||||
|
||||
IDD_SETTINGS DIALOGEX 0, 0, 231, 141
|
||||
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_SYSMENU
|
||||
FONT 8, "MS Shell Dlg", 0, 0, 0x0
|
||||
BEGIN
|
||||
LTEXT "&Fullscreen video mode:",IDC_STATIC,7,22,74,8
|
||||
LTEXT "&Antialias mode:",IDC_STATIC,7,60,61,8
|
||||
COMBOBOX IDC_ANTIALIASMODE,68,57,156,73,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||
LTEXT "&Windowed resolution:",IDC_STATIC,7,41,74,8
|
||||
COMBOBOX IDC_RESOLUTIONWINDOWED,87,39,137,73,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||
CONTROL "&Fullscreen",IDC_FULLSCREENENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,87,7,84,8
|
||||
COMBOBOX IDC_RESOLUTION,87,20,137,73,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||
END
|
||||
|
||||
IDD_DEBUGGER DIALOGEX 0, 0, 234, 254
|
||||
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_SYSMENU
|
||||
FONT 8, "MS Shell Dlg", 400, 0, 0x1
|
||||
BEGIN
|
||||
LISTBOX IDC_LIST1,7,16,70,231,LBS_SORT | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
|
||||
LTEXT "&Command Stream",IDC_STATIC,7,7,70,8
|
||||
PUSHBUTTON "&Step",IDC_DEBUGSTEP,81,16,35,15
|
||||
CONTROL "",IDC_REGISTERS,"SysListView32",LVS_REPORT | LVS_ALIGNLEFT | WS_BORDER | WS_TABSTOP,81,68,146,179
|
||||
LTEXT "&Registers",IDC_STATIC,81,41,137,9
|
||||
CONTROL "&Enable debugging",IDC_ENABLEDEBUGGING,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,121,19,70,8
|
||||
CONTROL "",IDC_REGISTERSELECT,"SysTabControl32",TCS_BUTTONS,80,52,145,13
|
||||
END
|
||||
|
||||
IDD_ADVANCED DIALOGEX 0, 0, 206, 144
|
||||
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_SYSMENU
|
||||
FONT 8, "MS Shell Dlg", 0, 0, 0x0
|
||||
BEGIN
|
||||
GROUPBOX "&Settings",IDC_STATIC,7,7,192,81
|
||||
CONTROL "&Wireframe",IDC_WIREFRAME,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,19,79,9
|
||||
CONTROL "&Overlay some statistics",IDC_OVERLAYSTATS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,31,88,9
|
||||
LTEXT "&Default display list optimization level:",IDC_STATIC,14,57,137,9,WS_DISABLED
|
||||
COMBOBOX IDC_DLOPTLEVEL,14,67,178,63,CBS_DROPDOWNLIST | WS_DISABLED | WS_VSCROLL | WS_TABSTOP
|
||||
CONTROL "&Dump textures to:",IDC_TEXDUMP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,104,70,9
|
||||
EDITTEXT IDC_TEXDUMPPATH,25,116,148,12,ES_AUTOHSCROLL
|
||||
GROUPBOX "&Data dumping",IDC_STATIC,7,91,192,44
|
||||
PUSHBUTTON "...",IDC_BROWSETEXDUMPPATH,176,116,14,13
|
||||
CONTROL "Show s&hader compilation errors",IDC_SHOWSHADERERRORS,
|
||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,43,127,9
|
||||
END
|
||||
|
||||
IDD_ENHANCEMENTS DIALOGEX 0, 0, 207, 175
|
||||
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_SYSMENU
|
||||
FONT 8, "MS Shell Dlg", 400, 0, 0x1
|
||||
BEGIN
|
||||
GROUPBOX "Texture &enhancements",IDC_STATIC,7,61,193,34
|
||||
CONTROL "&Pre-upscale:",IDC_PREUPSCALE,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,16,76,54,10
|
||||
COMBOBOX IDC_PREUPSCALETYPE,74,74,117,49,CBS_DROPDOWNLIST | CBS_SORT | WS_DISABLED | WS_VSCROLL | WS_TABSTOP
|
||||
GROUPBOX "Texture &filtering",IDC_STATIC,7,7,193,50
|
||||
CONTROL "&Force bi/trilinear (may cause very small glitches)",IDC_FORCEFILTERING,
|
||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,20,170,9
|
||||
CONTROL "&Force maximum anisotropy filtering",IDC_FORCEANISOTROPY,
|
||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,35,127,10
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// DESIGNINFO
|
||||
//
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
GUIDELINES DESIGNINFO
|
||||
BEGIN
|
||||
IDD_ABOUT, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 181
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 74
|
||||
END
|
||||
|
||||
IDD_SETTINGS, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 224
|
||||
VERTGUIDE, 7
|
||||
VERTGUIDE, 68
|
||||
VERTGUIDE, 81
|
||||
VERTGUIDE, 87
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 134
|
||||
END
|
||||
|
||||
IDD_DEBUGGER, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 227
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 247
|
||||
END
|
||||
|
||||
IDD_ADVANCED, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 199
|
||||
VERTGUIDE, 14
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 137
|
||||
END
|
||||
|
||||
IDD_ENHANCEMENTS, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 200
|
||||
VERTGUIDE, 16
|
||||
VERTGUIDE, 74
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 168
|
||||
END
|
||||
END
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
#endif // Swedish resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
#ifndef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 3 resource.
|
||||
//
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#endif // not APSTUDIO_INVOKED
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#pragma once
|
||||
|
||||
#define _WIN32_WINNT 0x501
|
||||
#ifndef _WIN32_IE
|
||||
#define _WIN32_IE 0x0500 // Default value is 0x0400
|
||||
#endif
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
|
||||
|
||||
#define _CRT_SECURE_NO_DEPRECATE 1
|
||||
#define _CRT_NONSTDC_NO_DEPRECATE 1
|
||||
|
||||
#include <windows.h>
|
||||
#include <tchar.h>
|
||||
#include <vector>
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include "Common.h"
|
||||
#include "Globals.h"
|
||||
|
||||
// __________________________________________________________________________________________________
|
||||
// Video_UpdateXFB
|
||||
//
|
||||
|
||||
// TODO(ector): Write protect XFB. As soon as something pokes there,
|
||||
// switch to a mode where we actually display the XFB on top of the 3D.
|
||||
// If no writes have happened within 5 frames, revert to normal mode.
|
||||
|
||||
// Also, write a crazy SSE2 optimized version of this :P
|
||||
|
||||
int bound(int i)
|
||||
{
|
||||
return (i>255)?255:((i<0)?0:i);
|
||||
}
|
||||
void yuv2rgb(int y, int u, int v, int &r, int &g, int &b)
|
||||
{
|
||||
b = bound((76283*(y - 16) + 132252*(u - 128))>>16);
|
||||
g = bound((76283*(y - 16) - 53281 *(v - 128) - 25624*(u - 128))>>16); //last one u?
|
||||
r = bound((76283*(y - 16) + 104595*(v - 128))>>16);
|
||||
}
|
||||
|
||||
void ConvertXFB(int *dst, const u8* _pXFB, int width, int height)
|
||||
{
|
||||
const unsigned char *src = _pXFB;
|
||||
for (int y = 0; y < height; y++)
|
||||
{
|
||||
for (int x = 0; x < width; x++)
|
||||
{
|
||||
int Y1 = *src++;
|
||||
int U = *src++;
|
||||
int Y2 = *src++;
|
||||
int V = *src++;
|
||||
|
||||
int r,g,b;
|
||||
yuv2rgb(Y1, U, V, r, g, b);
|
||||
*dst++ = 0xFF000000 | (r<<16) | (g<<8) | (b);
|
||||
yuv2rgb(Y2, U, V, r, g, b);
|
||||
*dst++ = 0xFF000000 | (r<<16) | (g<<8) | (b);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#ifndef _XFB_H
|
||||
#define _XFB_H
|
||||
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,195 @@
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include <stdarg.h>
|
||||
#include "Globals.h"
|
||||
|
||||
#include "Render.h"
|
||||
#include "GLInit.h"
|
||||
#include "Fifo.h"
|
||||
#include "OpcodeDecoding.h"
|
||||
#include "TextureMngr.h"
|
||||
#include "BPStructs.h"
|
||||
#ifdef _WIN32
|
||||
#include "DlgSettings.h"
|
||||
#include "Misc.h"
|
||||
#include "EmuWindow.h"
|
||||
#endif
|
||||
#include "VertexLoader.h"
|
||||
#include "VertexShader.h"
|
||||
#include "PixelShader.h"
|
||||
|
||||
|
||||
HINSTANCE g_hInstance = NULL;
|
||||
SVideoInitialize g_VideoInitialize;
|
||||
#define VERSION_STRING "0.1"
|
||||
|
||||
#ifdef _WIN32
|
||||
BOOL APIENTRY DllMain( HINSTANCE hinstDLL, // DLL module handle
|
||||
DWORD dwReason, // reason called
|
||||
LPVOID lpvReserved) // reserved
|
||||
{
|
||||
switch (dwReason)
|
||||
{
|
||||
case DLL_PROCESS_ATTACH:
|
||||
break;
|
||||
case DLL_PROCESS_DETACH:
|
||||
CloseConsole();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
g_hInstance = hinstDLL;
|
||||
return TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
void GetDllInfo (PLUGIN_INFO* _PluginInfo)
|
||||
{
|
||||
_PluginInfo->Version = 0x0100;
|
||||
_PluginInfo->Type = PLUGIN_TYPE_VIDEO;
|
||||
#ifdef DEBUGFAST
|
||||
sprintf(_PluginInfo->Name, "Dolphin OGL (DebugFast)" VERSION_STRING);
|
||||
#else
|
||||
#ifndef _DEBUG
|
||||
sprintf(_PluginInfo->Name, "Dolphin OGL " VERSION_STRING);
|
||||
#else
|
||||
sprintf(_PluginInfo->Name, "Dolphin OGL Debug " VERSION_STRING);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
void DllAbout(HWND _hParent)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
DialogBox(g_hInstance,(LPCSTR)IDD_ABOUT,_hParent,(DLGPROC)AboutProc);
|
||||
#endif
|
||||
}
|
||||
|
||||
void DllConfig(HWND _hParent)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
DlgSettings_Show(g_hInstance,_hParent);
|
||||
#endif
|
||||
}
|
||||
|
||||
void Video_Initialize(SVideoInitialize* _pVideoInitialize)
|
||||
{
|
||||
if (_pVideoInitialize == NULL)
|
||||
return;
|
||||
|
||||
#ifdef _WIN32
|
||||
// OpenConsole();
|
||||
#endif
|
||||
|
||||
frameCount = 0;
|
||||
g_VideoInitialize = *_pVideoInitialize;
|
||||
InitLUTs();
|
||||
g_Config.Load();
|
||||
|
||||
if (!OpenGL_Create(g_VideoInitialize, g_Res[g_Config.iWindowedRes][0], g_Res[g_Config.iWindowedRes][1])) {
|
||||
g_VideoInitialize.pLog("Renderer::Create failed\n", TRUE);
|
||||
return;
|
||||
}
|
||||
_pVideoInitialize->pPeekMessages = g_VideoInitialize.pPeekMessages;
|
||||
_pVideoInitialize->pUpdateFPSDisplay = g_VideoInitialize.pUpdateFPSDisplay;
|
||||
_pVideoInitialize->pWindowHandle = g_VideoInitialize.pWindowHandle;
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
HANDLE g_hthread;
|
||||
#endif
|
||||
|
||||
void Video_Prepare(void)
|
||||
{
|
||||
OpenGL_MakeCurrent();
|
||||
if (!Renderer::Create2()) {
|
||||
g_VideoInitialize.pLog("Renderer::Create2 failed\n", TRUE);
|
||||
return;
|
||||
}
|
||||
|
||||
TextureMngr::Init();
|
||||
|
||||
BPInit();
|
||||
VertexManager::Init();
|
||||
OpcodeDecoder_Init();
|
||||
Fifo_Init();
|
||||
VertexShaderMngr::Init();
|
||||
PixelShaderMngr::Init();
|
||||
GL_REPORT_ERRORD();
|
||||
}
|
||||
|
||||
void Video_Shutdown(void)
|
||||
{
|
||||
VertexShaderMngr::Shutdown();
|
||||
PixelShaderMngr::Shutdown();
|
||||
Fifo_Shutdown();
|
||||
VertexManager::Destroy();
|
||||
TextureMngr::Shutdown();
|
||||
OpcodeDecoder_Shutdown();
|
||||
Renderer::Shutdown();
|
||||
OpenGL_Shutdown();
|
||||
}
|
||||
|
||||
|
||||
void DebugLog(const char* _fmt, ...)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
|
||||
char* Msg = (char*)alloca(strlen(_fmt)+512);
|
||||
va_list ap;
|
||||
|
||||
va_start( ap, _fmt );
|
||||
vsnprintf( Msg, strlen(_fmt)+512, _fmt, ap );
|
||||
va_end( ap );
|
||||
|
||||
g_VideoInitialize.pLog(Msg, FALSE);
|
||||
#endif
|
||||
}
|
||||
|
||||
bool ScreenShot(TCHAR *File)
|
||||
{
|
||||
char str[64];
|
||||
int left = 200, top = 15;
|
||||
sprintf(str, "Dolphin OGL " VERSION_STRING);
|
||||
|
||||
Renderer::ResetGLState();
|
||||
Renderer::DrawText(str, left+1, top+1, 0xff000000);
|
||||
Renderer::DrawText(str, left, top, 0xffc0ffff);
|
||||
Renderer::RestoreGLState();
|
||||
|
||||
if (Renderer::SaveRenderTarget(File, 0)) {
|
||||
char str[255];
|
||||
sprintf(str, "saved %s\n", File);
|
||||
Renderer::AddMessage(str, 500);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
BOOL Video_Screenshot(TCHAR* _szFilename)
|
||||
{
|
||||
if (ScreenShot(_szFilename))
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void Video_UpdateXFB(BYTE* _pXFB, DWORD _dwWidth, DWORD _dwHeight)
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#ifndef _MAIN_H
|
||||
#define _MAIN_H
|
||||
|
||||
#include "pluginspecs_video.h"
|
||||
|
||||
extern SVideoInitialize g_VideoInitialize;
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,473 @@
|
||||
/******************************************************************************
|
||||
|
||||
Copyright (c) 2001 Advanced Micro Devices, Inc.
|
||||
|
||||
LIMITATION OF LIABILITY: THE MATERIALS ARE PROVIDED *AS IS* WITHOUT ANY
|
||||
EXPRESS OR IMPLIED WARRANTY OF ANY KIND INCLUDING WARRANTIES OF MERCHANTABILITY,
|
||||
NONINFRINGEMENT OF THIRD-PARTY INTELLECTUAL PROPERTY, OR FITNESS FOR ANY
|
||||
PARTICULAR PURPOSE. IN NO EVENT SHALL AMD OR ITS SUPPLIERS BE LIABLE FOR ANY
|
||||
DAMAGES WHATSOEVER (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF PROFITS,
|
||||
BUSINESS INTERRUPTION, LOSS OF INFORMATION) ARISING OUT OF THE USE OF OR
|
||||
INABILITY TO USE THE MATERIALS, EVEN IF AMD HAS BEEN ADVISED OF THE POSSIBILITY
|
||||
OF SUCH DAMAGES. BECAUSE SOME JURISDICTIONS PROHIBIT THE EXCLUSION OR LIMITATION
|
||||
OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES, THE ABOVE LIMITATION MAY
|
||||
NOT APPLY TO YOU.
|
||||
|
||||
AMD does not assume any responsibility for any errors which may appear in the
|
||||
Materials nor any responsibility to support or update the Materials. AMD retains
|
||||
the right to make changes to its test specifications at any time, without notice.
|
||||
|
||||
NO SUPPORT OBLIGATION: AMD is not obligated to furnish, support, or make any
|
||||
further information, software, technical information, know-how, or show-how
|
||||
available to you.
|
||||
|
||||
So that all may benefit from your experience, please report any problems
|
||||
or suggestions about this software to 3dsdk.support@amd.com
|
||||
|
||||
AMD Developer Technologies, M/S 585
|
||||
Advanced Micro Devices, Inc.
|
||||
5900 E. Ben White Blvd.
|
||||
Austin, TX 78741
|
||||
3dsdk.support@amd.com
|
||||
******************************************************************************/
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
/*****************************************************************************
|
||||
MEMCPY_AMD.CPP
|
||||
******************************************************************************/
|
||||
|
||||
// Very optimized memcpy() routine for AMD Athlon and Duron family.
|
||||
// This code uses any of FOUR different basic copy methods, depending
|
||||
// on the transfer size.
|
||||
// NOTE: Since this code uses MOVNTQ (also known as "Non-Temporal MOV" or
|
||||
// "Streaming Store"), and also uses the software prefetch instructions,
|
||||
// be sure you're running on Athlon/Duron or other recent CPU before calling!
|
||||
|
||||
#define TINY_BLOCK_COPY 64 // upper limit for movsd type copy
|
||||
// The smallest copy uses the X86 "movsd" instruction, in an optimized
|
||||
// form which is an "unrolled loop".
|
||||
|
||||
#define IN_CACHE_COPY 2 * 1024 // upper limit for movq/movq copy w/SW prefetch
|
||||
// Next is a copy that uses the MMX registers to copy 8 bytes at a time,
|
||||
// also using the "unrolled loop" optimization. This code uses
|
||||
// the software prefetch instruction to get the data into the cache.
|
||||
|
||||
#define UNCACHED_COPY 4 * 1024 // upper limit for movq/movntq w/SW prefetch
|
||||
// For larger blocks, which will spill beyond the cache, it's faster to
|
||||
// use the Streaming Store instruction MOVNTQ. This write instruction
|
||||
// bypasses the cache and writes straight to main memory. This code also
|
||||
// uses the software prefetch instruction to pre-read the data.
|
||||
// USE 64 * 1024 FOR THIS VALUE IF YOU'RE ALWAYS FILLING A "CLEAN CACHE"
|
||||
|
||||
#define BLOCK_PREFETCH_COPY infinity // no limit for movq/movntq w/block prefetch
|
||||
#define CACHEBLOCK 80h // number of 64-byte blocks (cache lines) for block prefetch
|
||||
// For the largest size blocks, a special technique called Block Prefetch
|
||||
// can be used to accelerate the read operations. Block Prefetch reads
|
||||
// one address per cache line, for a series of cache lines, in a short loop.
|
||||
// This is faster than using software prefetch. The technique is great for
|
||||
// getting maximum read bandwidth, especially in DDR memory systems.
|
||||
|
||||
//#include <stddef.h>
|
||||
|
||||
// Inline assembly syntax for use with Visual C++
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER) && !defined(__x86_64__) && !defined(_M_X64)
|
||||
|
||||
void * memcpy_amd(void *dest, const void *src, size_t n)
|
||||
{
|
||||
__asm {
|
||||
mov ecx, [n] ; number of bytes to copy
|
||||
mov edi, [dest] ; destination
|
||||
mov esi, [src] ; source
|
||||
mov ebx, ecx ; keep a copy of count
|
||||
|
||||
cld
|
||||
cmp ecx, TINY_BLOCK_COPY
|
||||
jb $memcpy_ic_3 ; tiny? skip mmx copy
|
||||
|
||||
cmp ecx, 32*1024 ; don't align between 32k-64k because
|
||||
jbe $memcpy_do_align ; it appears to be slower
|
||||
cmp ecx, 64*1024
|
||||
jbe $memcpy_align_done
|
||||
$memcpy_do_align:
|
||||
mov ecx, 8 ; a trick that's faster than rep movsb...
|
||||
sub ecx, edi ; align destination to qword
|
||||
and ecx, 111b ; get the low bits
|
||||
sub ebx, ecx ; update copy count
|
||||
neg ecx ; set up to jump into the array
|
||||
add ecx, offset $memcpy_align_done
|
||||
jmp ecx ; jump to array of movsb's
|
||||
|
||||
align 4
|
||||
movsb
|
||||
movsb
|
||||
movsb
|
||||
movsb
|
||||
movsb
|
||||
movsb
|
||||
movsb
|
||||
movsb
|
||||
|
||||
$memcpy_align_done: ; destination is dword aligned
|
||||
mov ecx, ebx ; number of bytes left to copy
|
||||
shr ecx, 6 ; get 64-byte block count
|
||||
jz $memcpy_ic_2 ; finish the last few bytes
|
||||
|
||||
cmp ecx, IN_CACHE_COPY/64 ; too big 4 cache? use uncached copy
|
||||
jae $memcpy_uc_test
|
||||
|
||||
// This is small block copy that uses the MMX registers to copy 8 bytes
|
||||
// at a time. It uses the "unrolled loop" optimization, and also uses
|
||||
// the software prefetch instruction to get the data into the cache.
|
||||
align 16
|
||||
$memcpy_ic_1: ; 64-byte block copies, in-cache copy
|
||||
|
||||
prefetchnta [esi + (200*64/34+192)] ; start reading ahead
|
||||
|
||||
movq mm0, [esi+0] ; read 64 bits
|
||||
movq mm1, [esi+8]
|
||||
movq [edi+0], mm0 ; write 64 bits
|
||||
movq [edi+8], mm1 ; note: the normal movq writes the
|
||||
movq mm2, [esi+16] ; data to cache; a cache line will be
|
||||
movq mm3, [esi+24] ; allocated as needed, to store the data
|
||||
movq [edi+16], mm2
|
||||
movq [edi+24], mm3
|
||||
movq mm0, [esi+32]
|
||||
movq mm1, [esi+40]
|
||||
movq [edi+32], mm0
|
||||
movq [edi+40], mm1
|
||||
movq mm2, [esi+48]
|
||||
movq mm3, [esi+56]
|
||||
movq [edi+48], mm2
|
||||
movq [edi+56], mm3
|
||||
|
||||
add esi, 64 ; update source pointer
|
||||
add edi, 64 ; update destination pointer
|
||||
dec ecx ; count down
|
||||
jnz $memcpy_ic_1 ; last 64-byte block?
|
||||
|
||||
$memcpy_ic_2:
|
||||
mov ecx, ebx ; has valid low 6 bits of the byte count
|
||||
$memcpy_ic_3:
|
||||
shr ecx, 2 ; dword count
|
||||
and ecx, 1111b ; only look at the "remainder" bits
|
||||
neg ecx ; set up to jump into the array
|
||||
add ecx, offset $memcpy_last_few
|
||||
jmp ecx ; jump to array of movsd's
|
||||
|
||||
$memcpy_uc_test:
|
||||
cmp ecx, UNCACHED_COPY/64 ; big enough? use block prefetch copy
|
||||
jae $memcpy_bp_1
|
||||
|
||||
$memcpy_64_test:
|
||||
or ecx, ecx ; tail end of block prefetch will jump here
|
||||
jz $memcpy_ic_2 ; no more 64-byte blocks left
|
||||
|
||||
// For larger blocks, which will spill beyond the cache, it's faster to
|
||||
// use the Streaming Store instruction MOVNTQ. This write instruction
|
||||
// bypasses the cache and writes straight to main memory. This code also
|
||||
// uses the software prefetch instruction to pre-read the data.
|
||||
align 16
|
||||
$memcpy_uc_1: ; 64-byte blocks, uncached copy
|
||||
|
||||
prefetchnta [esi + (200*64/34+192)] ; start reading ahead
|
||||
|
||||
movq mm0,[esi+0] ; read 64 bits
|
||||
add edi,64 ; update destination pointer
|
||||
movq mm1,[esi+8]
|
||||
add esi,64 ; update source pointer
|
||||
movq mm2,[esi-48]
|
||||
movntq [edi-64], mm0 ; write 64 bits, bypassing the cache
|
||||
movq mm0,[esi-40] ; note: movntq also prevents the CPU
|
||||
movntq [edi-56], mm1 ; from READING the destination address
|
||||
movq mm1,[esi-32] ; into the cache, only to be over-written
|
||||
movntq [edi-48], mm2 ; so that also helps performance
|
||||
movq mm2,[esi-24]
|
||||
movntq [edi-40], mm0
|
||||
movq mm0,[esi-16]
|
||||
movntq [edi-32], mm1
|
||||
movq mm1,[esi-8]
|
||||
movntq [edi-24], mm2
|
||||
movntq [edi-16], mm0
|
||||
dec ecx
|
||||
movntq [edi-8], mm1
|
||||
jnz $memcpy_uc_1 ; last 64-byte block?
|
||||
|
||||
jmp $memcpy_ic_2 ; almost done
|
||||
|
||||
// For the largest size blocks, a special technique called Block Prefetch
|
||||
// can be used to accelerate the read operations. Block Prefetch reads
|
||||
// one address per cache line, for a series of cache lines, in a short loop.
|
||||
// This is faster than using software prefetch. The technique is great for
|
||||
// getting maximum read bandwidth, especially in DDR memory systems.
|
||||
$memcpy_bp_1: ; large blocks, block prefetch copy
|
||||
|
||||
cmp ecx, CACHEBLOCK ; big enough to run another prefetch loop?
|
||||
jl $memcpy_64_test ; no, back to regular uncached copy
|
||||
|
||||
mov eax, CACHEBLOCK / 2 ; block prefetch loop, unrolled 2X
|
||||
add esi, CACHEBLOCK * 64 ; move to the top of the block
|
||||
align 16
|
||||
$memcpy_bp_2:
|
||||
mov edx, [esi-64] ; grab one address per cache line
|
||||
mov edx, [esi-128] ; grab one address per cache line
|
||||
sub esi, 128 ; go reverse order to suppress HW prefetcher
|
||||
dec eax ; count down the cache lines
|
||||
jnz $memcpy_bp_2 ; keep grabbing more lines into cache
|
||||
|
||||
mov eax, CACHEBLOCK ; now that it's in cache, do the copy
|
||||
align 16
|
||||
$memcpy_bp_3:
|
||||
movq mm0, [esi ] ; read 64 bits
|
||||
movq mm1, [esi+ 8]
|
||||
movq mm2, [esi+16]
|
||||
movq mm3, [esi+24]
|
||||
movq mm4, [esi+32]
|
||||
movq mm5, [esi+40]
|
||||
movq mm6, [esi+48]
|
||||
movq mm7, [esi+56]
|
||||
add esi, 64 ; update source pointer
|
||||
movntq [edi ], mm0 ; write 64 bits, bypassing cache
|
||||
movntq [edi+ 8], mm1 ; note: movntq also prevents the CPU
|
||||
movntq [edi+16], mm2 ; from READING the destination address
|
||||
movntq [edi+24], mm3 ; into the cache, only to be over-written,
|
||||
movntq [edi+32], mm4 ; so that also helps performance
|
||||
movntq [edi+40], mm5
|
||||
movntq [edi+48], mm6
|
||||
movntq [edi+56], mm7
|
||||
add edi, 64 ; update dest pointer
|
||||
|
||||
dec eax ; count down
|
||||
|
||||
jnz $memcpy_bp_3 ; keep copying
|
||||
sub ecx, CACHEBLOCK ; update the 64-byte block count
|
||||
jmp $memcpy_bp_1 ; keep processing chunks
|
||||
|
||||
// The smallest copy uses the X86 "movsd" instruction, in an optimized
|
||||
// form which is an "unrolled loop". Then it handles the last few bytes.
|
||||
align 4
|
||||
movsd
|
||||
movsd ; perform last 1-15 dword copies
|
||||
movsd
|
||||
movsd
|
||||
movsd
|
||||
movsd
|
||||
movsd
|
||||
movsd
|
||||
movsd
|
||||
movsd ; perform last 1-7 dword copies
|
||||
movsd
|
||||
movsd
|
||||
movsd
|
||||
movsd
|
||||
movsd
|
||||
movsd
|
||||
|
||||
$memcpy_last_few: ; dword aligned from before movsd's
|
||||
mov ecx, ebx ; has valid low 2 bits of the byte count
|
||||
and ecx, 11b ; the last few cows must come home
|
||||
jz $memcpy_final ; no more, let's leave
|
||||
rep movsb ; the last 1, 2, or 3 bytes
|
||||
|
||||
$memcpy_final:
|
||||
emms ; clean up the MMX state
|
||||
sfence ; flush the write buffer
|
||||
mov eax, [dest] ; ret value = destination pointer
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// mmx memcmp implementation, size has to be a multiple of 8
|
||||
// returns 0 is equal, nonzero value if not equal
|
||||
// ~10 times faster than standard memcmp
|
||||
// (zerofrog)
|
||||
unsigned char memcmp_mmx(const void* src1, const void* src2, int cmpsize)
|
||||
{
|
||||
assert( (cmpsize&7) == 0 );
|
||||
|
||||
__asm {
|
||||
push esi
|
||||
mov ecx, cmpsize
|
||||
mov edx, src1
|
||||
mov esi, src2
|
||||
|
||||
cmp ecx, 32
|
||||
jl Done4
|
||||
|
||||
// custom test first 8 to make sure things are ok
|
||||
movq mm0, [esi]
|
||||
movq mm1, [esi+8]
|
||||
pcmpeqd mm0, [edx]
|
||||
pcmpeqd mm1, [edx+8]
|
||||
pand mm0, mm1
|
||||
movq mm2, [esi+16]
|
||||
pmovmskb eax, mm0
|
||||
movq mm3, [esi+24]
|
||||
|
||||
// check if eq
|
||||
cmp eax, 0xff
|
||||
je NextComp
|
||||
mov eax, 1
|
||||
jmp End
|
||||
|
||||
NextComp:
|
||||
pcmpeqd mm2, [edx+16]
|
||||
pcmpeqd mm3, [edx+24]
|
||||
pand mm2, mm3
|
||||
pmovmskb eax, mm2
|
||||
|
||||
sub ecx, 32
|
||||
add esi, 32
|
||||
add edx, 32
|
||||
|
||||
// check if eq
|
||||
cmp eax, 0xff
|
||||
je ContinueTest
|
||||
mov eax, 1
|
||||
jmp End
|
||||
|
||||
cmp ecx, 64
|
||||
jl Done8
|
||||
|
||||
Cmp8:
|
||||
movq mm0, [esi]
|
||||
movq mm1, [esi+8]
|
||||
movq mm2, [esi+16]
|
||||
movq mm3, [esi+24]
|
||||
movq mm4, [esi+32]
|
||||
movq mm5, [esi+40]
|
||||
movq mm6, [esi+48]
|
||||
movq mm7, [esi+56]
|
||||
pcmpeqd mm0, [edx]
|
||||
pcmpeqd mm1, [edx+8]
|
||||
pcmpeqd mm2, [edx+16]
|
||||
pcmpeqd mm3, [edx+24]
|
||||
pand mm0, mm1
|
||||
pcmpeqd mm4, [edx+32]
|
||||
pand mm0, mm2
|
||||
pcmpeqd mm5, [edx+40]
|
||||
pand mm0, mm3
|
||||
pcmpeqd mm6, [edx+48]
|
||||
pand mm0, mm4
|
||||
pcmpeqd mm7, [edx+56]
|
||||
pand mm0, mm5
|
||||
pand mm0, mm6
|
||||
pand mm0, mm7
|
||||
pmovmskb eax, mm0
|
||||
|
||||
// check if eq
|
||||
cmp eax, 0xff
|
||||
je Continue
|
||||
mov eax, 1
|
||||
jmp End
|
||||
|
||||
Continue:
|
||||
sub ecx, 64
|
||||
add esi, 64
|
||||
add edx, 64
|
||||
ContinueTest:
|
||||
cmp ecx, 64
|
||||
jge Cmp8
|
||||
|
||||
Done8:
|
||||
test ecx, 0x20
|
||||
jz Done4
|
||||
movq mm0, [esi]
|
||||
movq mm1, [esi+8]
|
||||
movq mm2, [esi+16]
|
||||
movq mm3, [esi+24]
|
||||
pcmpeqd mm0, [edx]
|
||||
pcmpeqd mm1, [edx+8]
|
||||
pcmpeqd mm2, [edx+16]
|
||||
pcmpeqd mm3, [edx+24]
|
||||
pand mm0, mm1
|
||||
pand mm0, mm2
|
||||
pand mm0, mm3
|
||||
pmovmskb eax, mm0
|
||||
sub ecx, 32
|
||||
add esi, 32
|
||||
add edx, 32
|
||||
|
||||
// check if eq
|
||||
cmp eax, 0xff
|
||||
je Done4
|
||||
mov eax, 1
|
||||
jmp End
|
||||
|
||||
Done4:
|
||||
cmp ecx, 24
|
||||
jne Done2
|
||||
movq mm0, [esi]
|
||||
movq mm1, [esi+8]
|
||||
movq mm2, [esi+16]
|
||||
pcmpeqd mm0, [edx]
|
||||
pcmpeqd mm1, [edx+8]
|
||||
pcmpeqd mm2, [edx+16]
|
||||
pand mm0, mm1
|
||||
pand mm0, mm2
|
||||
pmovmskb eax, mm0
|
||||
|
||||
// check if eq
|
||||
cmp eax, 0xff
|
||||
setne al
|
||||
jmp End
|
||||
|
||||
Done2:
|
||||
cmp ecx, 16
|
||||
jne Done1
|
||||
|
||||
movq mm0, [esi]
|
||||
movq mm1, [esi+8]
|
||||
pcmpeqd mm0, [edx]
|
||||
pcmpeqd mm1, [edx+8]
|
||||
pand mm0, mm1
|
||||
pmovmskb eax, mm0
|
||||
|
||||
// check if eq
|
||||
cmp eax, 0xff
|
||||
setne al
|
||||
jmp End
|
||||
|
||||
Done1:
|
||||
cmp ecx, 8
|
||||
jne Done
|
||||
|
||||
mov eax, [esi]
|
||||
mov esi, [esi+4]
|
||||
cmp eax, [edx]
|
||||
je Next
|
||||
mov eax, 1
|
||||
jmp End
|
||||
|
||||
Next:
|
||||
cmp esi, [edx+4]
|
||||
setne al
|
||||
jmp End
|
||||
|
||||
Done:
|
||||
xor eax, eax
|
||||
|
||||
End:
|
||||
pop esi
|
||||
emms
|
||||
}
|
||||
}
|
||||
|
||||
#else // _MSC_VER
|
||||
// assume gcc or mingw or win x64
|
||||
|
||||
#include <memory.h>
|
||||
#include <string.h>
|
||||
|
||||
void * memcpy_amd(void *dest, const void *src, size_t n)
|
||||
{
|
||||
memcpy(dest, src, n);
|
||||
return dest;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,165 @@
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include "Globals.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#include <GL/gl.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "rasterfont.h"
|
||||
// globals
|
||||
|
||||
GLubyte rasters[][13] = {
|
||||
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18},
|
||||
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x36, 0x36, 0x36},
|
||||
{0x00, 0x00, 0x00, 0x66, 0x66, 0xff, 0x66, 0x66, 0xff, 0x66, 0x66, 0x00, 0x00},
|
||||
{0x00, 0x00, 0x18, 0x7e, 0xff, 0x1b, 0x1f, 0x7e, 0xf8, 0xd8, 0xff, 0x7e, 0x18},
|
||||
{0x00, 0x00, 0x0e, 0x1b, 0xdb, 0x6e, 0x30, 0x18, 0x0c, 0x76, 0xdb, 0xd8, 0x70},
|
||||
{0x00, 0x00, 0x7f, 0xc6, 0xcf, 0xd8, 0x70, 0x70, 0xd8, 0xcc, 0xcc, 0x6c, 0x38},
|
||||
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x1c, 0x0c, 0x0e},
|
||||
{0x00, 0x00, 0x0c, 0x18, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x18, 0x0c},
|
||||
{0x00, 0x00, 0x30, 0x18, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x18, 0x30},
|
||||
{0x00, 0x00, 0x00, 0x00, 0x99, 0x5a, 0x3c, 0xff, 0x3c, 0x5a, 0x99, 0x00, 0x00},
|
||||
{0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0xff, 0xff, 0x18, 0x18, 0x18, 0x00, 0x00},
|
||||
{0x00, 0x00, 0x30, 0x18, 0x1c, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x00, 0x00, 0x00, 0x38, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x00, 0x60, 0x60, 0x30, 0x30, 0x18, 0x18, 0x0c, 0x0c, 0x06, 0x06, 0x03, 0x03},
|
||||
{0x00, 0x00, 0x3c, 0x66, 0xc3, 0xe3, 0xf3, 0xdb, 0xcf, 0xc7, 0xc3, 0x66, 0x3c},
|
||||
{0x00, 0x00, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x78, 0x38, 0x18},
|
||||
{0x00, 0x00, 0xff, 0xc0, 0xc0, 0x60, 0x30, 0x18, 0x0c, 0x06, 0x03, 0xe7, 0x7e},
|
||||
{0x00, 0x00, 0x7e, 0xe7, 0x03, 0x03, 0x07, 0x7e, 0x07, 0x03, 0x03, 0xe7, 0x7e},
|
||||
{0x00, 0x00, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0xff, 0xcc, 0x6c, 0x3c, 0x1c, 0x0c},
|
||||
{0x00, 0x00, 0x7e, 0xe7, 0x03, 0x03, 0x07, 0xfe, 0xc0, 0xc0, 0xc0, 0xc0, 0xff},
|
||||
{0x00, 0x00, 0x7e, 0xe7, 0xc3, 0xc3, 0xc7, 0xfe, 0xc0, 0xc0, 0xc0, 0xe7, 0x7e},
|
||||
{0x00, 0x00, 0x30, 0x30, 0x30, 0x30, 0x18, 0x0c, 0x06, 0x03, 0x03, 0x03, 0xff},
|
||||
{0x00, 0x00, 0x7e, 0xe7, 0xc3, 0xc3, 0xe7, 0x7e, 0xe7, 0xc3, 0xc3, 0xe7, 0x7e},
|
||||
{0x00, 0x00, 0x7e, 0xe7, 0x03, 0x03, 0x03, 0x7f, 0xe7, 0xc3, 0xc3, 0xe7, 0x7e},
|
||||
{0x00, 0x00, 0x00, 0x38, 0x38, 0x00, 0x00, 0x38, 0x38, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x00, 0x00, 0x30, 0x18, 0x1c, 0x1c, 0x00, 0x00, 0x1c, 0x1c, 0x00, 0x00, 0x00},
|
||||
{0x00, 0x00, 0x06, 0x0c, 0x18, 0x30, 0x60, 0xc0, 0x60, 0x30, 0x18, 0x0c, 0x06},
|
||||
{0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x00, 0x00, 0x60, 0x30, 0x18, 0x0c, 0x06, 0x03, 0x06, 0x0c, 0x18, 0x30, 0x60},
|
||||
{0x00, 0x00, 0x18, 0x00, 0x00, 0x18, 0x18, 0x0c, 0x06, 0x03, 0xc3, 0xc3, 0x7e},
|
||||
{0x00, 0x00, 0x3f, 0x60, 0xcf, 0xdb, 0xd3, 0xdd, 0xc3, 0x7e, 0x00, 0x00, 0x00},
|
||||
{0x00, 0x00, 0xc3, 0xc3, 0xc3, 0xc3, 0xff, 0xc3, 0xc3, 0xc3, 0x66, 0x3c, 0x18},
|
||||
{0x00, 0x00, 0xfe, 0xc7, 0xc3, 0xc3, 0xc7, 0xfe, 0xc7, 0xc3, 0xc3, 0xc7, 0xfe},
|
||||
{0x00, 0x00, 0x7e, 0xe7, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xe7, 0x7e},
|
||||
{0x00, 0x00, 0xfc, 0xce, 0xc7, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc7, 0xce, 0xfc},
|
||||
{0x00, 0x00, 0xff, 0xc0, 0xc0, 0xc0, 0xc0, 0xfc, 0xc0, 0xc0, 0xc0, 0xc0, 0xff},
|
||||
{0x00, 0x00, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xfc, 0xc0, 0xc0, 0xc0, 0xff},
|
||||
{0x00, 0x00, 0x7e, 0xe7, 0xc3, 0xc3, 0xcf, 0xc0, 0xc0, 0xc0, 0xc0, 0xe7, 0x7e},
|
||||
{0x00, 0x00, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xff, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3},
|
||||
{0x00, 0x00, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x7e},
|
||||
{0x00, 0x00, 0x7c, 0xee, 0xc6, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06},
|
||||
{0x00, 0x00, 0xc3, 0xc6, 0xcc, 0xd8, 0xf0, 0xe0, 0xf0, 0xd8, 0xcc, 0xc6, 0xc3},
|
||||
{0x00, 0x00, 0xff, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0},
|
||||
{0x00, 0x00, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xdb, 0xff, 0xff, 0xe7, 0xc3},
|
||||
{0x00, 0x00, 0xc7, 0xc7, 0xcf, 0xcf, 0xdf, 0xdb, 0xfb, 0xf3, 0xf3, 0xe3, 0xe3},
|
||||
{0x00, 0x00, 0x7e, 0xe7, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xe7, 0x7e},
|
||||
{0x00, 0x00, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xfe, 0xc7, 0xc3, 0xc3, 0xc7, 0xfe},
|
||||
{0x00, 0x00, 0x3f, 0x6e, 0xdf, 0xdb, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0x66, 0x3c},
|
||||
{0x00, 0x00, 0xc3, 0xc6, 0xcc, 0xd8, 0xf0, 0xfe, 0xc7, 0xc3, 0xc3, 0xc7, 0xfe},
|
||||
{0x00, 0x00, 0x7e, 0xe7, 0x03, 0x03, 0x07, 0x7e, 0xe0, 0xc0, 0xc0, 0xe7, 0x7e},
|
||||
{0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xff},
|
||||
{0x00, 0x00, 0x7e, 0xe7, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3},
|
||||
{0x00, 0x00, 0x18, 0x3c, 0x3c, 0x66, 0x66, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3},
|
||||
{0x00, 0x00, 0xc3, 0xe7, 0xff, 0xff, 0xdb, 0xdb, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3},
|
||||
{0x00, 0x00, 0xc3, 0x66, 0x66, 0x3c, 0x3c, 0x18, 0x3c, 0x3c, 0x66, 0x66, 0xc3},
|
||||
{0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x3c, 0x66, 0x66, 0xc3},
|
||||
{0x00, 0x00, 0xff, 0xc0, 0xc0, 0x60, 0x30, 0x7e, 0x0c, 0x06, 0x03, 0x03, 0xff},
|
||||
{0x00, 0x00, 0x3c, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x3c},
|
||||
{0x00, 0x03, 0x03, 0x06, 0x06, 0x0c, 0x0c, 0x18, 0x18, 0x30, 0x30, 0x60, 0x60},
|
||||
{0x00, 0x00, 0x3c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x3c},
|
||||
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc3, 0x66, 0x3c, 0x18},
|
||||
{0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x38, 0x30, 0x70},
|
||||
{0x00, 0x00, 0x7f, 0xc3, 0xc3, 0x7f, 0x03, 0xc3, 0x7e, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x00, 0x00, 0xfe, 0xc3, 0xc3, 0xc3, 0xc3, 0xfe, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0},
|
||||
{0x00, 0x00, 0x7e, 0xc3, 0xc0, 0xc0, 0xc0, 0xc3, 0x7e, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x00, 0x00, 0x7f, 0xc3, 0xc3, 0xc3, 0xc3, 0x7f, 0x03, 0x03, 0x03, 0x03, 0x03},
|
||||
{0x00, 0x00, 0x7f, 0xc0, 0xc0, 0xfe, 0xc3, 0xc3, 0x7e, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x00, 0x00, 0x30, 0x30, 0x30, 0x30, 0x30, 0xfc, 0x30, 0x30, 0x30, 0x33, 0x1e},
|
||||
{0x7e, 0xc3, 0x03, 0x03, 0x7f, 0xc3, 0xc3, 0xc3, 0x7e, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x00, 0x00, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xfe, 0xc0, 0xc0, 0xc0, 0xc0},
|
||||
{0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x18, 0x00},
|
||||
{0x38, 0x6c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x00, 0x00, 0x0c, 0x00},
|
||||
{0x00, 0x00, 0xc6, 0xcc, 0xf8, 0xf0, 0xd8, 0xcc, 0xc6, 0xc0, 0xc0, 0xc0, 0xc0},
|
||||
{0x00, 0x00, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x78},
|
||||
{0x00, 0x00, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0xfe, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xfc, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00},
|
||||
{0xc0, 0xc0, 0xc0, 0xfe, 0xc3, 0xc3, 0xc3, 0xc3, 0xfe, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x03, 0x03, 0x03, 0x7f, 0xc3, 0xc3, 0xc3, 0xc3, 0x7f, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x00, 0x00, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xe0, 0xfe, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x00, 0x00, 0xfe, 0x03, 0x03, 0x7e, 0xc0, 0xc0, 0x7f, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x00, 0x00, 0x1c, 0x36, 0x30, 0x30, 0x30, 0x30, 0xfc, 0x30, 0x30, 0x30, 0x00},
|
||||
{0x00, 0x00, 0x7e, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x00, 0x00, 0x18, 0x3c, 0x3c, 0x66, 0x66, 0xc3, 0xc3, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x00, 0x00, 0xc3, 0xe7, 0xff, 0xdb, 0xc3, 0xc3, 0xc3, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x00, 0x00, 0xc3, 0x66, 0x3c, 0x18, 0x3c, 0x66, 0xc3, 0x00, 0x00, 0x00, 0x00},
|
||||
{0xc0, 0x60, 0x60, 0x30, 0x18, 0x3c, 0x66, 0x66, 0xc3, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x00, 0x00, 0xff, 0x60, 0x30, 0x18, 0x0c, 0x06, 0xff, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x00, 0x00, 0x0f, 0x18, 0x18, 0x18, 0x38, 0xf0, 0x38, 0x18, 0x18, 0x18, 0x0f},
|
||||
{0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18},
|
||||
{0x00, 0x00, 0xf0, 0x18, 0x18, 0x18, 0x1c, 0x0f, 0x1c, 0x18, 0x18, 0x18, 0xf0},
|
||||
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x8f, 0xf1, 0x60, 0x00, 0x00, 0x00}
|
||||
};
|
||||
|
||||
RasterFont::RasterFont()
|
||||
{
|
||||
// set GL modes
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||
|
||||
// create the raster font
|
||||
fontOffset = glGenLists (128);
|
||||
for (int i = 32; i < 127; i++) {
|
||||
glNewList(i+fontOffset, GL_COMPILE);
|
||||
glBitmap(8, 13, 0.0f, 2.0f, 10.0f, 0.0f, rasters[i-32]);
|
||||
glEndList();
|
||||
}
|
||||
}
|
||||
|
||||
RasterFont::~RasterFont()
|
||||
{
|
||||
glDeleteLists(fontOffset, 128);
|
||||
}
|
||||
|
||||
void RasterFont::printString(const char *s, double x, double y, double z)
|
||||
{
|
||||
// go to the right spot
|
||||
glRasterPos3d(x, y, z);
|
||||
|
||||
glPushAttrib (GL_LIST_BIT);
|
||||
glListBase(fontOffset);
|
||||
glCallLists((GLsizei)strlen(s), GL_UNSIGNED_BYTE, (GLubyte *) s);
|
||||
glPopAttrib ();
|
||||
}
|
||||
|
||||
void RasterFont::printCenteredString(const char *s, double y, int screen_width, double z)
|
||||
{
|
||||
int length = (int)strlen(s);
|
||||
int x = int(screen_width/2.0 - (length/2.0)*char_width);
|
||||
|
||||
printString(s, x, y, z);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#ifndef RasterFont_Header
|
||||
#define RasterFont_Header
|
||||
|
||||
class RasterFont {
|
||||
protected:
|
||||
int fontOffset;
|
||||
|
||||
public:
|
||||
RasterFont();
|
||||
~RasterFont(void);
|
||||
static int debug;
|
||||
|
||||
// some useful constants
|
||||
enum {char_width = 10};
|
||||
enum {char_height = 15};
|
||||
|
||||
// and the happy helper functions
|
||||
void printString(const char *s, double x, double y, double z=0.0);
|
||||
void printCenteredString(const char *s, double y, int screen_width, double z=0.0);
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user