add more initialization correctness and advertise support in emuInfo

This commit is contained in:
Cass Everitt 2014-01-29 13:29:54 -06:00
parent 554daeeec4
commit ca74b29245
19 changed files with 148 additions and 12 deletions

View file

@ -85,7 +85,11 @@ void InitLayers( RegalContext * ctx ) {
out.write( " layer = constr( ctx );\n" )
out.write( " bool success = layer->Initialize( \"%s\" );\n" % instInf )
out.write( " if( success ) {\n" )
out.write( " Info(\"%s initialization succeeded.\");\n" % c )
out.write( " ctx->layer.push_back( layer );\n" )
out.write( " } else {\n" )
out.write( " Info(\"%s initialization failed.\");\n" % c )
out.write( " delete layer;\n" )
out.write( " }\n" )
out.write( " }\n" )

View file

@ -199,6 +199,7 @@ REGAL_NAMESPACE_BEGIN
struct Layer {
Layer( RegalContext * context ) : ctx( context ) {}
virtual ~Layer() {}
RegalContext * GetContext() { return ctx; }
virtual std::string GetName() const = 0;
virtual bool Initialize( const std::string & instanceInfo ) = 0;

View file

@ -55,6 +55,7 @@ REGAL_NAMESPACE_BEGIN
struct Layer {
Layer( RegalContext * context ) : ctx( context ) {}
virtual ~Layer() {}
RegalContext * GetContext() { return ctx; }
virtual std::string GetName() const = 0;
virtual bool Initialize( const std::string & instanceInfo ) = 0;

View file

@ -65,7 +65,11 @@ void InitLayers( RegalContext * ctx ) {
layer = constr( ctx );
bool success = layer->Initialize( "" );
if( success ) {
Info("createLog initialization succeeded.");
ctx->layer.push_back( layer );
} else {
Info("createLog initialization failed.");
delete layer;
}
}
constr = createFilt;
@ -73,7 +77,11 @@ void InitLayers( RegalContext * ctx ) {
layer = constr( ctx );
bool success = layer->Initialize( "" );
if( success ) {
Info("createFilt initialization succeeded.");
ctx->layer.push_back( layer );
} else {
Info("createFilt initialization failed.");
delete layer;
}
}
constr = createTexC;
@ -81,7 +89,11 @@ void InitLayers( RegalContext * ctx ) {
layer = constr( ctx );
bool success = layer->Initialize( "" );
if( success ) {
Info("createTexC initialization succeeded.");
ctx->layer.push_back( layer );
} else {
Info("createTexC initialization failed.");
delete layer;
}
}
constr = createVao;
@ -89,7 +101,11 @@ void InitLayers( RegalContext * ctx ) {
layer = constr( ctx );
bool success = layer->Initialize( "" );
if( success ) {
Info("createVao initialization succeeded.");
ctx->layer.push_back( layer );
} else {
Info("createVao initialization failed.");
delete layer;
}
}
constr = createDsa;
@ -97,7 +113,11 @@ void InitLayers( RegalContext * ctx ) {
layer = constr( ctx );
bool success = layer->Initialize( "" );
if( success ) {
Info("createDsa initialization succeeded.");
ctx->layer.push_back( layer );
} else {
Info("createDsa initialization failed.");
delete layer;
}
}
constr = createSo;
@ -105,7 +125,11 @@ void InitLayers( RegalContext * ctx ) {
layer = constr( ctx );
bool success = layer->Initialize( "" );
if( success ) {
Info("createSo initialization succeeded.");
ctx->layer.push_back( layer );
} else {
Info("createSo initialization failed.");
delete layer;
}
}
constr = createQuads;
@ -113,7 +137,11 @@ void InitLayers( RegalContext * ctx ) {
layer = constr( ctx );
bool success = layer->Initialize( "" );
if( success ) {
Info("createQuads initialization succeeded.");
ctx->layer.push_back( layer );
} else {
Info("createQuads initialization failed.");
delete layer;
}
}
constr = createIff;
@ -121,7 +149,11 @@ void InitLayers( RegalContext * ctx ) {
layer = constr( ctx );
bool success = layer->Initialize( "" );
if( success ) {
Info("createIff initialization succeeded.");
ctx->layer.push_back( layer );
} else {
Info("createIff initialization failed.");
delete layer;
}
}
constr = createTexSto;
@ -129,7 +161,11 @@ void InitLayers( RegalContext * ctx ) {
layer = constr( ctx );
bool success = layer->Initialize( "" );
if( success ) {
Info("createTexSto initialization succeeded.");
ctx->layer.push_back( layer );
} else {
Info("createTexSto initialization failed.");
delete layer;
}
}
constr = createBaseVertex;
@ -137,7 +173,11 @@ void InitLayers( RegalContext * ctx ) {
layer = constr( ctx );
bool success = layer->Initialize( "" );
if( success ) {
Info("createBaseVertex initialization succeeded.");
ctx->layer.push_back( layer );
} else {
Info("createBaseVertex initialization failed.");
delete layer;
}
}
constr = createPpca;
@ -145,7 +185,11 @@ void InitLayers( RegalContext * ctx ) {
layer = constr( ctx );
bool success = layer->Initialize( "" );
if( success ) {
Info("createPpca initialization succeeded.");
ctx->layer.push_back( layer );
} else {
Info("createPpca initialization failed.");
delete layer;
}
}
constr = createPpa;
@ -153,7 +197,11 @@ void InitLayers( RegalContext * ctx ) {
layer = constr( ctx );
bool success = layer->Initialize( "" );
if( success ) {
Info("createPpa initialization succeeded.");
ctx->layer.push_back( layer );
} else {
Info("createPpa initialization failed.");
delete layer;
}
}
constr = createHint;
@ -161,7 +209,11 @@ void InitLayers( RegalContext * ctx ) {
layer = constr( ctx );
bool success = layer->Initialize( "" );
if( success ) {
Info("createHint initialization succeeded.");
ctx->layer.push_back( layer );
} else {
Info("createHint initialization failed.");
delete layer;
}
}
constr = createObj;
@ -169,7 +221,11 @@ void InitLayers( RegalContext * ctx ) {
layer = constr( ctx );
bool success = layer->Initialize( "" );
if( success ) {
Info("createObj initialization succeeded.");
ctx->layer.push_back( layer );
} else {
Info("createObj initialization failed.");
delete layer;
}
}
constr = createHttp;
@ -177,7 +233,11 @@ void InitLayers( RegalContext * ctx ) {
layer = constr( ctx );
bool success = layer->Initialize( "" );
if( success ) {
Info("createHttp initialization succeeded.");
ctx->layer.push_back( layer );
} else {
Info("createHttp initialization failed.");
delete layer;
}
}

View file

@ -77,7 +77,18 @@ namespace Emu {
}
virtual bool Initialize( const std::string & instanceInfo ) {
ResetInterception();
RegalContext * ctx = GetContext();
orig.Initialize( ctx->dispatchGL );
bool from_core = ctx->info->gl_version_3_2;
bool from_ext = ctx->info->gl_arb_draw_elements_base_vertex;
bool emulationNeeded = from_core == false && from_ext == false;
if( emulationNeeded == false ) {
return false;
}
BaseVertexIntercept( this, ctx->dispatchGL );
return true;
}

View file

@ -1,5 +1,5 @@
/* NOTE: Do not edit this file, it is generated by a script:
Err.py --api gl 4.4 --api wgl 4.4 --api glx 4.4 --api cgl 1.4 --api egl 1.0 --outdir .
Export.py --api gl 4.4 --api wgl 4.4 --api glx 4.4 --api cgl 1.4 --api egl 1.0 --outdir .
*/
/*

View file

@ -88,8 +88,8 @@ struct Hint : public Layer
RegalContext * ctx = GetContext();
orig.Initialize( ctx->dispatchGL );
// check whether we can init
bool canInit = true;
if( canInit == false ) {
bool emulationNeeded = ctx->info->es2;
if( emulationNeeded == false ) {
return false;
}
HintIntercept( this, ctx->dispatchGL );

View file

@ -1,5 +1,5 @@
/* NOTE: Do not edit this file, it is generated by a script:
H.py --api gl 4.4 --api wgl 4.4 --api glx 4.4 --api cgl 1.4 --api egl 1.0 --outdir .
Export.py --api gl 4.4 --api wgl 4.4 --api glx 4.4 --api cgl 1.4 --api egl 1.0 --outdir .
*/
/*

View file

@ -3381,6 +3381,14 @@ namespace Emu
orig.Initialize( ctx.dispatchGL );
instProcs.Initialize( ctx.dispatchGL );
bool emulationNeeded = ctx.info->es2 || ctx.info->core;
bool has_glsl = ( ctx.info->gl_version_major >= 2
|| ctx.info->gles_version_major >= 2 );
bool has_vao = ctx.emuInfo->gl_arb_vertex_array_object;
bool emulationSupported = has_glsl && has_vao;
if( emulationNeeded == false || emulationSupported == false ) {
return false;
}
IffIntercept( this, ctx.dispatchGL );
shadowMatrixMode = GL_MODELVIEW;

View file

@ -1,5 +1,5 @@
/* NOTE: Do not edit this file, it is generated by a script:
L.py --api gl 4.4 --api wgl 4.4 --api glx 4.4 --api cgl 1.4 --api egl 1.0 --outdir .
Export.py --api gl 4.4 --api wgl 4.4 --api glx 4.4 --api cgl 1.4 --api egl 1.0 --outdir .
*/
/*

View file

@ -1,5 +1,5 @@
/* NOTE: Do not edit this file, it is generated by a script:
Log.py --api gl 4.4 --api wgl 4.4 --api glx 4.4 --api cgl 1.4 --api egl 1.0 --outdir .
Export.py --api gl 4.4 --api wgl 4.4 --api glx 4.4 --api cgl 1.4 --api egl 1.0 --outdir .
*/
/*

View file

@ -79,6 +79,10 @@ struct Ppa : public Layer, public State::Stencil, State::Depth, State::Polygon,
{
RegalContext &ctx = *GetContext();
orig.Initialize( ctx.dispatchGL );
bool emulationNeeded = ctx.info->compat == false;
if( emulationNeeded == false ) {
return false;
}
PpaIntercept( this, ctx.dispatchGL );
activeTextureUnit = 0;

View file

@ -78,7 +78,13 @@ struct Ppca : public Layer, public ClientState::VertexArray, ClientState::PixelS
virtual bool Initialize( const std::string & instanceInfo )
{
ResetInterception();
RegalContext * ctx = GetContext();
orig.Initialize( ctx->dispatchGL );
bool emulationNeeded = ctx->info->es1 || ctx->info->es2 || ctx->info->core;
if( emulationNeeded == false ) {
return false;
}
PpcaIntercept( this, ctx->dispatchGL );
Reset();
return true;
}

View file

@ -102,7 +102,10 @@ namespace Emu
RegalContext * ctx = GetContext();
orig.Initialize( ctx->dispatchGL );
// if not supported, return false here
bool emulationNeeded = ctx->info->es1 || ctx->info->es2 || ctx->info->core;
if( emulationNeeded == false ) {
return false;
}
QuadsIntercept( this, ctx->dispatchGL );
elementArrayBuffer = 0;
RglGenBuffers( orig, 1, &quadIndexBuffer);

View file

@ -89,7 +89,13 @@ namespace Emu {
virtual std::string GetName() const { return "rect"; }
virtual bool Initialize( const std::string & instanceInfo ) {
ResetInterception();
RegalContext * ctx = GetContext();
orig.Initialize( ctx->dispatchGL );
bool emulationNeeded = ctx->info->es1 || ctx->info->es2 || ctx->info->core;
if( emulationNeeded == false ) {
return false;
}
RectIntercept( this, ctx->dispatchGL );
return true;
}

View file

@ -83,7 +83,12 @@ namespace Emu {
orig.Initialize( ctx->dispatchGL );
// if not needed or not supported, return false now
bool from_core = ctx->info->gl_version_3_3 == GL_TRUE || ctx->info->gles_version_major >= 3;
bool from_ext = ctx->info->gl_arb_sampler_objects == GL_TRUE;
bool emulationNeeded = ! ( from_core || from_ext );
if( emulationNeeded == false ) {
return false;
}
SoIntercept( this, ctx->dispatchGL );
activeTextureUnit = 0;
nextSamplerObjectId = 1;

View file

@ -319,6 +319,10 @@ namespace Emu {
orig.Initialize( ctx->dispatchGL );
// if not supported or not needed return false here
bool emulationNeeded = ctx->info->es2;
if( emulationNeeded == false ) {
return false;
}
TexCIntercept( this, ctx->dispatchGL );
RegalContext * sharingWith = ctx->shareGroup->front();

View file

@ -66,7 +66,19 @@ namespace Emu {
virtual std::string GetName() const { return "texsto"; }
bool Initialize( const std::string & instanceInfo ) {
ResetInterception();
RegalContext * ctx = GetContext();
orig.Initialize( ctx->dispatchGL );
TexStoIntercept( this, ctx->dispatchGL );
bool from_core = ctx->info->gl_version_4_2;
bool from_ext = ctx->info->gl_arb_texture_storage || ctx->info->gl_ext_texture_storage;
bool emulationNeeded = from_core == false && from_ext == false;
if( emulationNeeded ) {
return false;
}
TexStoIntercept( this, ctx->dispatchGL );
return true;
}

View file

@ -129,8 +129,19 @@ namespace Emu
clientActiveTexture = GL_TEXTURE0;
orig.Initialize( ctx->dispatchGL );
// if not supported or not needed return false here
bool from_core = ( ctx->info->gl_version_major >= 3
|| ctx->info->gles_version_major >= 3 );
bool from_ext = ctx->info->gl_arb_vertex_array_object;
// need to handle the default vao case, which core profile doesn't handle...
bool emulationNeeded = ctx->info->core || ( from_core == false && from_ext == false );
if( emulationNeeded == false ) {
return false;
}
VaoIntercept( this, ctx->dispatchGL );
ctx->emuInfo->gl_arb_vertex_array_object = GL_TRUE;
max_vertex_attribs = ctx->emuInfo->gl_max_vertex_attribs;
RegalAssert( max_vertex_attribs <= REGAL_EMU_MAX_VERTEX_ATTRIBS );
if (max_vertex_attribs > REGAL_EMU_MAX_VERTEX_ATTRIBS)