checkpoint - filt compiles

This commit is contained in:
Cass Everitt 2014-01-25 12:14:47 -06:00
parent fe33e413a6
commit 4c31cdc3a9
4 changed files with 428 additions and 464 deletions

View file

@ -78,7 +78,7 @@ formulae = {
'glBlitFramebufferANGLE' # Emulate glBlitFramebuffer?
],
'impl' : [
'if (_context->isES2())',
'if (self->GetContext()->isES2())',
'{',
' Warning("Regal does not support ${name} for ES 2.0 - skipping.");',
' #if REGAL_BREAK',
@ -94,7 +94,7 @@ formulae = {
'filterOutCore' : {
'entries' : [ 'glLineWidth', ],
'impl' : [
'if (_context->isCore())',
'if (self->GetContext()->isCore())',
'{',
' Warning("Regal does not support ${name} for core profile - skipping.");',
' #if REGAL_BREAK',
@ -133,7 +133,7 @@ formulae = {
'glWindowPos(2|3)(d|f|i|s)(v|)',
],
'impl' : [
'if (_context->isES2() || _context->isCore())',
'if (self->GetContext()->isES2() || self->GetContext()->isCore())',
'{',
' Warning("Regal does not support ${name} for core or ES2 profiles - skipping.");',
' #if REGAL_BREAK',
@ -158,7 +158,7 @@ formulae = {
'gl(TexImage2D)',
],
'impl' : [
'if (_context->filt->${m1}(*_context, ${arg0plus}))',
'if (self->${m1}(${arg0plus}))',
'{',
' #if REGAL_BREAK',
' Break::Filter();',
@ -173,13 +173,13 @@ formulae = {
'glTexParameter(i|f)',
],
'impl' : '''
if (_context->filt->TexParameter(*_context, ${arg0}, ${arg1}))
if (self->TexParameter(${arg0}, ${arg1}))
return;
GLfloat newparam;
if (_context->filt->FilterTexParameter(*_context, ${arg0}, ${arg1}, static_cast<GLfloat>(${arg2}), newparam))
orig.glTexParameterf( _context, ${arg0}, ${arg1}, newparam);
if (self->FilterTexParameter(${arg0}, ${arg1}, static_cast<GLfloat>(${arg2}), newparam))
RglTexParameterf( orig, ${arg0}, ${arg1}, newparam);
else
orig.glTexParameter${m1}( _context, ${arg0plus});
RglTexParameter${m1}( orig, ${arg0plus});
return;'''
},
@ -188,13 +188,13 @@ return;'''
'glTexParameter(i|f)v',
],
'impl' : '''
if (_context->filt->TexParameter(*_context, ${arg0}, ${arg1}))
if (self->TexParameter(${arg0}, ${arg1}))
return;
GLfloat newparam;
if (${arg2} && _context->filt->FilterTexParameter(*_context, ${arg0}, ${arg1}, static_cast<GLfloat>(${arg2}[0]), newparam))
orig.glTexParameterf( _context, ${arg0}, ${arg1}, newparam);
if (${arg2} && self->FilterTexParameter(${arg0}, ${arg1}, static_cast<GLfloat>(${arg2}[0]), newparam))
RglTexParameterf( orig, ${arg0}, ${arg1}, newparam);
else
orig.glTexParameter${m1}v( _context, ${arg0plus});
RglTexParameter${m1}v( orig, ${arg0plus});
return;'''
},
@ -204,10 +204,10 @@ return;'''
'blitFBO' : {
'entries' : [ 'glBlitFramebuffer' ],
'impl' : [
'if (_context->isES2())',
'if (self->GetContext()->isES2())',
'{',
' if (_context->info->gl_nv_framebuffer_blit) return orig.${m0}NV( _context, ${arg0plus});',
' if (_context->info->gl_ext_framebuffer_blit) return orig.${m0}EXT( _context, ${arg0plus});',
' if (self->GetContext()->info->gl_nv_framebuffer_blit) return R${m0}NV( orig, ${arg0plus});',
' if (self->GetContext()->info->gl_ext_framebuffer_blit) return R${m0}EXT( orig, ${arg0plus});',
'}'
]
},
@ -218,10 +218,10 @@ return;'''
'blitDrawRead' : {
'entries' : [ 'glDrawBuffer' ],
'impl' : [
'if (_context->isES2())',
'if (self->GetContext()->isES2())',
'{',
' if (_context->info->gl_nv_framebuffer_blit || _context->info->gl_ext_framebuffer_blit)',
' return orig.${m0}( _context, ${arg0plus} );',
' if (self->GetContext()->info->gl_nv_framebuffer_blit || self->GetContext()->info->gl_ext_framebuffer_blit)',
' return R${m0}( orig, ${arg0plus} );',
'}'
]
},
@ -231,9 +231,9 @@ return;'''
'glDrawRangeElements' : {
'entries' : [ 'glDrawRangeElements' ],
'impl' : [
'if (_context->isES2())',
'if (self->GetContext()->isES2())',
'{',
' return orig.glDrawElements( _context,${arg0}, ${arg3plus});',
' return RglDrawElements( orig,${arg0}, ${arg3plus});',
'}'
]
},
@ -245,11 +245,11 @@ return;'''
'glDrawRangeElementsBaseVertex' : {
'entries' : [ 'glDrawRangeElementsBaseVertex' ],
'impl' : [
'if (REGAL_FORCE_ES2_PROFILE || !_context->info->gl_arb_draw_elements_base_vertex)',
'if (REGAL_FORCE_ES2_PROFILE || !self->GetContext()->info->gl_arb_draw_elements_base_vertex)',
'{',
' if (basevertex==0)',
' {',
' return orig.glDrawElements( _context,${arg0}, ${arg3}, ${arg4}, ${arg5});',
' return RglDrawElements( orig,${arg0}, ${arg3}, ${arg4}, ${arg5});',
' }',
' else',
' {',
@ -263,18 +263,18 @@ return;'''
'glDrawBuffers' : {
'entries' : [ 'glDrawBuffers' ],
'impl' : [
'if (_context->filt->DrawBuffers(*_context, ${arg0plus}))',
'if (self->DrawBuffers(${arg0plus}))',
'{',
' #if REGAL_BREAK',
' Break::Filter();',
' #endif',
' return ${dummyretval};',
'}',
'if (_context->isES2())',
'if (self->GetContext()->isES2())',
'{',
' if (_context->info->gl_nv_draw_buffers)',
' if (self->GetContext()->info->gl_nv_draw_buffers)',
' {',
' orig.${name}NV( _context, ${arg0plus} );',
' R${name}NV( orig, ${arg0plus} );',
' return;',
' }',
'}'
@ -285,10 +285,9 @@ return;'''
'GL_ATI_draw_buffers' : {
'entries' : [ 'glDrawBuffersATI' ],
'impl' : [
'if (!_context->info->gl_ati_draw_buffers)',
'if (!self->GetContext()->info->gl_ati_draw_buffers)',
'{',
' _context->emuLevel++;',
' orig.glDrawBuffers( _context,${arg0plus});',
' RglDrawBuffers( orig,${arg0plus});',
' return;',
'}'
]
@ -298,10 +297,9 @@ return;'''
'GL_ARB_draw_buffers' : {
'entries' : [ 'glDrawBuffersARB'],
'impl' : [
'if (!_context->info->gl_arb_draw_buffers)',
'if (!self->GetContext()->info->gl_arb_draw_buffers)',
'{',
' _context->emuLevel++;',
' orig.glDrawBuffers( _context,${arg0plus});',
' RglDrawBuffers( orig,${arg0plus});',
' return;',
'}'
]
@ -313,7 +311,7 @@ return;'''
'GL_ARB_vertex_program' : {
'entries' : [ 'glGenProgramsARB', 'glBindProgramARB', 'glProgramStringARB', 'glGetProgramivARB' ],
'impl' : [
'if (_context->isES2())',
'if (self->GetContext()->isES2())',
'{',
' Warning("Regal does not support ${name} (GL_ARB_vertex_program) for ES 2.0 context - skipping.");',
' return;',
@ -330,10 +328,10 @@ return;'''
# 'entries' : [ 'glCreateShaderObjectARB' ],
# 'impl' : [
# '#if !REGAL_FORCE_ES2_PROFILE',
# 'if (_context->info->es2)',
# 'if (self->GetContext()->info->es2)',
# '#endif',
# '{',
# ' return orig.glCreateShader( _context,${arg0plus});',
# ' return RglCreateShader( orig,${arg0plus});',
# '}'
# ]
# },
@ -341,9 +339,9 @@ return;'''
'glCreateProgramObjectARB' : {
'entries' : [ 'glCreateProgramObjectARB' ],
'impl' : [
'if (_context->isES2() || !_context->info->gl_arb_shader_objects)',
'if (self->GetContext()->isES2() || !self->GetContext()->info->gl_arb_shader_objects)',
'{',
' return orig.glCreateProgram( _context );',
' return RglCreateProgram( orig );',
'}'
]
},
@ -352,10 +350,10 @@ return;'''
# 'entries' : [ 'glShaderSourceARB' ],
# 'impl' : [
# '#if !REGAL_FORCE_ES2_PROFILE',
# 'if (_context->info->es2)',
# 'if (self->GetContext()->info->es2)',
# '#endif',
# '{',
# ' orig.glShaderSource( _context,${arg0plus});',
# ' RglShaderSource( orig,${arg0plus});',
# ' return;',
# '}'
# ]
@ -364,9 +362,9 @@ return;'''
'glCompileShaderARB' : {
'entries' : [ 'glCompileShaderARB' ],
'impl' : [
'if (_context->isES2() || !_context->info->gl_arb_shader_objects)',
'if (self->GetContext()->isES2() || !self->GetContext()->info->gl_arb_shader_objects)',
'{',
' orig.glCompileShader( _context,${arg0plus});',
' RglCompileShader( orig,${arg0plus});',
' return;',
'}'
]
@ -375,9 +373,9 @@ return;'''
'glActiveTextureARB' : {
'entries' : [ 'glActiveTextureARB' ],
'impl' : [
'if (!_context->info->gl_arb_multitexture)',
'if (!self->GetContext()->info->gl_arb_multitexture)',
'{',
' orig.glActiveTexture( _context,${arg0plus});',
' RglActiveTexture( orig,${arg0plus});',
' return;',
'}'
]
@ -386,10 +384,9 @@ return;'''
'glClientActiveTextureARB' : {
'entries' : [ 'glClientActiveTextureARB' ],
'impl' : [
'if (!_context->info->gl_arb_multitexture)',
'if (!self->GetContext()->info->gl_arb_multitexture)',
'{',
' _context->emuLevel++;',
' orig.glClientActiveTexture( _context,${arg0plus});',
' RglClientActiveTexture( orig,${arg0plus});',
' return;',
'}'
]
@ -398,9 +395,9 @@ return;'''
'glAttachObjectARB' : {
'entries' : [ 'glAttachObjectARB' ],
'impl' : [
'if (_context->isES2() || !_context->info->gl_arb_shader_objects)',
'if (self->GetContext()->isES2() || !self->GetContext()->info->gl_arb_shader_objects)',
'{',
' orig.glAttachShader( _context,${arg0plus});',
' RglAttachShader( orig,${arg0plus});',
' return;',
'}'
]
@ -409,9 +406,9 @@ return;'''
'glBindAttribLocationARB' : {
'entries' : [ 'glBindAttribLocationARB' ],
'impl' : [
'if (_context->isES2() || !_context->info->gl_arb_shader_objects)',
'if (self->GetContext()->isES2() || !self->GetContext()->info->gl_arb_shader_objects)',
'{',
' orig.glBindAttribLocation( _context,${arg0plus});',
' RglBindAttribLocation( orig,${arg0plus});',
' return;',
'}'
]
@ -420,9 +417,9 @@ return;'''
'glGetUniformLocationARB' : {
'entries' : [ 'glGetUniformLocationARB' ],
'impl' : [
'if (_context->isES2() || !_context->info->gl_arb_shader_objects)',
'if (self->GetContext()->isES2() || !self->GetContext()->info->gl_arb_shader_objects)',
'{',
' return orig.glGetUniformLocation( _context,${arg0plus});',
' return RglGetUniformLocation( orig,${arg0plus});',
'}'
]
},
@ -430,9 +427,9 @@ return;'''
'glUniform1iARB' : {
'entries' : [ 'glUniform1iARB' ],
'impl' : [
'if (_context->isES2() || !_context->info->gl_arb_shader_objects)',
'if (self->GetContext()->isES2() || !self->GetContext()->info->gl_arb_shader_objects)',
'{',
' orig.glUniform1i( _context,${arg0plus});',
' RglUniform1i( orig,${arg0plus});',
' return;',
'}'
]
@ -441,12 +438,12 @@ return;'''
'glGetObjectParameterivARB' : {
'entries' : [ 'glGetObjectParameterivARB' ],
'impl' : [
'if (_context->isES2() || !_context->info->gl_arb_shader_objects)',
'if (self->GetContext()->isES2() || !self->GetContext()->info->gl_arb_shader_objects)',
'{',
' if (orig.glIsProgram( _context,obj))',
' orig.glGetProgramiv( _context,${arg0plus});',
' if (RglIsProgram( orig,obj))',
' RglGetProgramiv( orig,${arg0plus});',
' else',
' orig.glGetShaderiv( _context,${arg0plus});',
' RglGetShaderiv( orig,${arg0plus});',
' return;',
'}'
]
@ -455,12 +452,12 @@ return;'''
'glGetInfoLogARB' : {
'entries' : [ 'glGetInfoLogARB' ],
'impl' : [
'if (_context->isES2() || !_context->info->gl_arb_shader_objects)',
'if (self->GetContext()->isES2() || !self->GetContext()->info->gl_arb_shader_objects)',
'{',
' if (orig.glIsProgram( _context,obj))',
' orig.glGetProgramInfoLog( _context,${arg0plus});',
' if (RglIsProgram( orig,obj))',
' RglGetProgramInfoLog( orig,${arg0plus});',
' else',
' orig.glGetShaderInfoLog( _context,${arg0plus});',
' RglGetShaderInfoLog( orig,${arg0plus});',
' return;',
'}'
]
@ -471,9 +468,9 @@ return;'''
'glBlendEquationEXT' : {
'entries' : [ 'glBlendEquationEXT' ],
'impl' : [
'if (_context->isES2())',
'if (self->GetContext()->isES2())',
'{',
' orig.glBlendEquation( _context,${arg0plus});',
' RglBlendEquation( orig,${arg0plus});',
' return;',
'}'
]
@ -484,9 +481,9 @@ return;'''
'glBlendColorEXT' : {
'entries' : [ 'glBlendColorEXT' ],
'impl' : [
'if (_context->isES2())',
'if (self->GetContext()->isES2())',
'{',
' orig.glBlendColor( _context,${arg0plus});',
' RglBlendColor( orig,${arg0plus});',
' return;',
'}'
]
@ -498,9 +495,9 @@ return;'''
'MapUnmap' : {
'entries' : [ 'gl(Map|Unmap)Buffer(ARB|)' ],
'impl' : [
'if (_context->isES2())',
'if (self->GetContext()->isES2())',
'{',
' return orig.gl${m1}BufferOES( _context,${arg0plus});',
' return Rgl${m1}BufferOES( orig,${arg0plus});',
'}'
]
},
@ -508,9 +505,9 @@ return;'''
'glBufferDataARB' : {
'entries' : [ 'glBufferDataARB' ],
'impl' : [
'if (_context->isES2())',
'if (self->GetContext()->isES2())',
'{',
' orig.glBufferData( _context,${arg0plus});',
' RglBufferData( orig,${arg0plus});',
' return;',
'}'
]
@ -522,12 +519,12 @@ return;'''
'glBindFramebuffer' : {
'entries' : [ 'glBindFramebuffer','glBindFramebufferOES' ],
'impl' : [
'if (_context->isES2())',
'if (self->GetContext()->isES2())',
'{',
' const bool hasFBBlit = _context->info->gl_ext_framebuffer_blit || _context->info->gl_nv_framebuffer_blit || _context->info->gl_version_major >= 3;',
' const bool hasFBBlit = self->GetContext()->info->gl_ext_framebuffer_blit || self->GetContext()->info->gl_nv_framebuffer_blit || self->GetContext()->info->gl_version_major >= 3;',
' if (!hasFBBlit && (target==GL_DRAW_FRAMEBUFFER || target==GL_READ_FRAMEBUFFER)) target = GL_FRAMEBUFFER;',
'}',
'if (_context->filt->BindFramebuffer(*_context, ${arg0plus}))',
'if (self->BindFramebuffer(${arg0plus}))',
'{',
' #if REGAL_BREAK',
' Break::Filter();',
@ -542,8 +539,8 @@ return;'''
'framebuffer_object_attachment' : {
'entries' : [ 'glFramebuffer(Texture1D|Texture3D|Renderbuffer)' ],
'impl' : [
'if (_context->filt->FramebufferAttachmentSupported(*_context, ${arg1}))',
' orig.glFramebuffer${m1}( _context,${arg0plus});',
'if (self->FramebufferAttachmentSupported(${arg1}))',
' RglFramebuffer${m1}( orig,${arg0plus});',
'return;'
]
},
@ -554,10 +551,10 @@ return;'''
'glGetFramebufferAttachmentParameteriv' : {
'entries' : [ 'glGetFramebufferAttachmentParameteriv' ],
'impl' : [
'if (!_context->filt->FramebufferAttachmentSupported(*_context, ${arg1}))',
'if (!self->FramebufferAttachmentSupported(${arg1}))',
' *${arg3} = 0;',
'else',
' orig.glGetFramebufferAttachmentParameteriv( _context,${arg0plus});',
' RglGetFramebufferAttachmentParameteriv( orig,${arg0plus});',
'return;'
]
},
@ -577,10 +574,9 @@ return;'''
'gl(FramebufferRenderbuffer)EXT'
],
'impl' : [
'if (!_context->info->gl_ext_framebuffer_object)',
'if (!self->GetContext()->info->gl_ext_framebuffer_object)',
'{',
' _context->emuLevel++;',
' orig.gl${m1}( _context,${arg0plus});',
' Rgl${m1}( orig,${arg0plus});',
' return;',
'}'
]
@ -589,10 +585,9 @@ return;'''
'EXT_framebuffer_object_returning' : {
'entries' : [ 'gl(CheckFramebufferStatus|IsFramebuffer|IsRenderbuffer)EXT' ],
'impl' : [
'if (!_context->info->gl_ext_framebuffer_object)',
'if (!self->GetContext()->info->gl_ext_framebuffer_object)',
'{',
' _context->emuLevel++;',
' return orig.gl${m1}( _context,${arg0plus});',
' return Rgl${m1}( orig,${arg0plus});',
'}'
]
},
@ -602,10 +597,9 @@ return;'''
'glBlitFramebufferEXT' : {
'entries' : [ 'glBlitFramebufferEXT' ],
'impl' : [
'if (!_context->info->gl_ext_framebuffer_blit)',
'if (!self->GetContext()->info->gl_ext_framebuffer_blit)',
'{',
' _context->emuLevel++;',
' orig.glBlitFramebuffer( _context,${arg0plus});',
' RglBlitFramebuffer( orig,${arg0plus});',
' return;',
'}'
]
@ -616,17 +610,17 @@ return;'''
'glReadBuffer' : {
'entries' : [ 'glReadBuffer' ],
'impl' : [
'if (_context->filt->ReadBuffer(*_context, ${arg0plus}))',
'if (self->ReadBuffer(${arg0plus}))',
'{',
' #if REGAL_BREAK',
' Break::Filter();',
' #endif',
' return ${dummyretval};',
'}',
'if (_context->isES2() && _context->info->gl_nv_read_buffer)',
' orig.glReadBufferNV( _context,${arg0plus});',
'if (self->GetContext()->isES2() && self->GetContext()->info->gl_nv_read_buffer)',
' RglReadBufferNV( orig,${arg0plus});',
'else',
' orig.glReadBuffer( _context,${arg0plus});',
' RglReadBuffer( orig,${arg0plus});',
'return;'
]
},
@ -643,11 +637,11 @@ return;'''
'glColorMaskIndexedEXT' : {
'entries' : [ 'glColorMaskIndexedEXT' ],
'impl' : [
'if (REGAL_FORCE_ES2_PROFILE || !_context->info->gl_ext_draw_buffers2)',
'if (REGAL_FORCE_ES2_PROFILE || !self->GetContext()->info->gl_ext_draw_buffers2)',
'{',
' if (!buf)'
' {',
' orig.glColorMask( _context,${arg1plus});',
' RglColorMask( orig,${arg1plus});',
' }',
' return;',
'}'
@ -657,11 +651,11 @@ return;'''
'glGetBooleanIndexedvEXT' : {
'entries' : [ 'glGetBooleanIndexedvEXT' ],
'impl' : [
'if (REGAL_FORCE_ES2_PROFILE || !_context->info->gl_ext_draw_buffers2)',
'if (REGAL_FORCE_ES2_PROFILE || !self->GetContext()->info->gl_ext_draw_buffers2)',
'{',
' if (!index)'
' {',
' orig.glGetBooleanv( _context,${arg0},${arg2});',
' RglGetBooleanv( orig,${arg0},${arg2});',
' }',
' return;',
'}'
@ -671,11 +665,11 @@ return;'''
'glGetIntegerIndexedvEXT' : {
'entries' : [ 'glGetIntegerIndexedvEXT' ],
'impl' : [
'if (REGAL_FORCE_ES2_PROFILE || !_context->info->gl_ext_draw_buffers2)',
'if (REGAL_FORCE_ES2_PROFILE || !self->GetContext()->info->gl_ext_draw_buffers2)',
'{',
' if (!index)'
' {',
' orig.glGetIntegerv( _context,${arg0},${arg2});',
' RglGetIntegerv( orig,${arg0},${arg2});',
' }',
' return;',
'}'
@ -685,11 +679,11 @@ return;'''
'glEnableIndexedEXT' : {
'entries' : [ 'glEnableIndexedEXT' ],
'impl' : [
'if (${arg0}==GL_BLEND && (REGAL_FORCE_ES2_PROFILE || !_context->info->gl_ext_draw_buffers2))',
'if (${arg0}==GL_BLEND && (REGAL_FORCE_ES2_PROFILE || !self->GetContext()->info->gl_ext_draw_buffers2))',
'{',
' if (!index)'
' {',
' orig.glEnable( _context,${arg0});',
' RglEnable( orig,${arg0});',
' }',
' return;',
'}'
@ -699,11 +693,11 @@ return;'''
'glDisableIndexedEXT' : {
'entries' : [ 'glDisableIndexedEXT' ],
'impl' : [
'if (${arg0}==GL_BLEND && (REGAL_FORCE_ES2_PROFILE || !_context->info->gl_ext_draw_buffers2))',
'if (${arg0}==GL_BLEND && (REGAL_FORCE_ES2_PROFILE || !self->GetContext()->info->gl_ext_draw_buffers2))',
'{',
' if (!index)'
' {',
' orig.glDisable( _context,${arg0});',
' RglDisable( orig,${arg0});',
' }',
' return;',
'}'
@ -713,11 +707,11 @@ return;'''
'glIsEnabledIndexedEXT' : {
'entries' : [ 'glIsEnabledIndexedEXT' ],
'impl' : [
'if (${arg0}==GL_BLEND && !_context->info->gl_ext_draw_buffers2)',
'if (${arg0}==GL_BLEND && !self->GetContext()->info->gl_ext_draw_buffers2)',
'{',
' if (!index)'
' {',
' return orig.glIsEnabled( _context,${arg0});',
' return RglIsEnabled( orig,${arg0});',
' }',
' return GL_FALSE;',
'}'
@ -727,7 +721,7 @@ return;'''
'GroupMarker' : {
'entries' : [ 'gl(Push|Pop)GroupMarkerEXT', ],
'impl' : [
'if( ! _context->info->gl_ext_debug_marker ) {',
'if( ! self->GetContext()->info->gl_ext_debug_marker ) {',
' return;',
'}',
],

View file

@ -37,7 +37,7 @@
REGAL_GLOBAL_BEGIN
#include "RegalLog.h"
#include "RegalFilt.h"
#include "Filt.h"
#include "RegalEmuInfo.h"
#include "RegalToken.h"
@ -50,13 +50,13 @@ namespace Emu {
using namespace ::REGAL_NAMESPACE_INTERNAL::Logging;
using namespace ::REGAL_NAMESPACE_INTERNAL::Token;
bool Filt::BindTexture(const RegalContext &ctx, GLenum target, GLuint name)
bool Filt::BindTexture(GLenum target, GLuint name)
{
UNUSED_PARAMETER(ctx);
UNUSED_PARAMETER(target);
UNUSED_PARAMETER(name);
if (ctx.isES2())
if (GetContext()->isES2())
{
switch ( target )
{
@ -72,7 +72,7 @@ namespace Emu {
return false;
}
bool Filt::BindFramebuffer(const RegalContext &ctx, GLenum target, GLuint framebuffer)
bool Filt::BindFramebuffer(GLenum target, GLuint framebuffer)
{
UNUSED_PARAMETER(ctx);
UNUSED_PARAMETER(target);
@ -83,11 +83,11 @@ namespace Emu {
return false;
}
bool Filt::DrawBuffers(const RegalContext &ctx, GLsizei n, const GLenum *bufs)
bool Filt::DrawBuffers(GLsizei n, const GLenum *bufs)
{
UNUSED_PARAMETER(ctx);
if (!ctx.isES2())
if (!GetContext()->isES2())
return false;
for (GLsizei i = 0; i < n; ++i)
@ -102,16 +102,14 @@ namespace Emu {
return false;
}
bool Filt::TexParameter(const RegalContext &ctx, GLenum target, GLenum pname)
bool Filt::TexParameter(GLenum target, GLenum pname)
{
UNUSED_PARAMETER(target);
RegalAssert(ctx.info.get());
// ES 2.0 does not support GL_TEXTURE_WRAP_R, filter it out
// See: http://www.khronos.org/opengles/sdk/docs/man/xhtml/glTexParameter.xml
if (ctx.isES2())
if (GetContext()->isES2())
switch (pname)
{
case GL_TEXTURE_MIN_FILTER:
@ -123,7 +121,7 @@ namespace Emu {
// sRGB is supported for Tegra 4 onwards
case GL_TEXTURE_SRGB_DECODE_EXT:
if (ctx.info->gl_ext_texture_srgb_decode)
if (GetContext()->info->gl_ext_texture_srgb_decode)
return false;
// GL_EXT_shadow_samplers for Tegra 4
@ -131,7 +129,7 @@ namespace Emu {
case GL_TEXTURE_COMPARE_MODE_EXT:
case GL_TEXTURE_COMPARE_FUNC_EXT:
if (ctx.info->gl_ext_shadow_samplers)
if (GetContext()->info->gl_ext_shadow_samplers)
return false;
default:
@ -142,12 +140,12 @@ namespace Emu {
return false;
}
bool Filt::FilterTexParameter(const RegalContext &ctx, GLenum target, GLenum pname, GLfloat param, GLfloat &newParam)
bool Filt::FilterTexParameter(GLenum target, GLenum pname, GLfloat param, GLfloat &newParam)
{
UNUSED_PARAMETER(ctx);
UNUSED_PARAMETER(target);
if (!ctx.isES2() && !ctx.isCore())
if (!GetContext()->isES2() && !GetContext()->isCore())
return false;
switch (pname)
@ -171,14 +169,14 @@ namespace Emu {
return false;
}
bool Filt::GetTexParameteriv(const RegalContext &ctx, GLenum target, GLenum pname, GLint *params)
bool Filt::GetTexParameteriv(GLenum target, GLenum pname, GLint *params)
{
UNUSED_PARAMETER(ctx);
UNUSED_PARAMETER(target);
UNUSED_PARAMETER(pname);
UNUSED_PARAMETER(params);
if (!ctx.isES2())
if (!GetContext()->isES2())
return false;
switch (target)
@ -194,25 +192,24 @@ namespace Emu {
return false;
}
bool Filt::FramebufferTexture2D(const RegalContext &ctx, GLenum target, GLenum attachment,
bool Filt::FramebufferTexture2D(GLenum target, GLenum attachment,
GLenum textarget, GLuint texture, GLint level)
{
UNUSED_PARAMETER(ctx);
UNUSED_PARAMETER(target);
UNUSED_PARAMETER(attachment);
UNUSED_PARAMETER(textarget);
UNUSED_PARAMETER(texture);
UNUSED_PARAMETER(level);
if (!FramebufferAttachmentSupported(ctx, attachment))
if (!FramebufferAttachmentSupported(attachment))
{
return true;
}
if (!ctx.isES2())
if (!GetContext()->isES2())
return false;
if ((level > 0) && !ctx.info->gl_oes_fbo_render_mipmap)
if ((level > 0) && !GetContext()->info->gl_oes_fbo_render_mipmap)
{
Warning("glFramebufferTexture2D with level > 0 not supported for ES 2.0 without OES_fbo_render_mipmap.");
return true;
@ -240,12 +237,12 @@ namespace Emu {
return false;
}
bool Filt::GenerateMipmap(const RegalContext &ctx, GLenum target)
bool Filt::GenerateMipmap(GLenum target)
{
UNUSED_PARAMETER(ctx);
UNUSED_PARAMETER(target);
if (!ctx.isES2())
if (!GetContext()->isES2())
return false;
switch (target)
@ -255,7 +252,7 @@ namespace Emu {
break;
case GL_TEXTURE_2D_ARRAY:
if (!ctx.info->gl_nv_texture_array)
if (!GetContext()->info->gl_nv_texture_array)
{
Warning("glGenerateMipmap(GL_TEXTURE_2D_ARRAY) not supported for ES 2.0 without NV_texture_array.");
return true;
@ -270,12 +267,12 @@ namespace Emu {
return false;
}
bool Filt::ReadBuffer(const RegalContext &ctx, GLenum src)
bool Filt::ReadBuffer(GLenum src)
{
UNUSED_PARAMETER(ctx);
UNUSED_PARAMETER(src);
if (!ctx.isES2() || !ctx.info->gl_nv_read_buffer)
if (!GetContext()->isES2() || !GetContext()->info->gl_nv_read_buffer)
return false;
switch (src)
@ -288,7 +285,7 @@ namespace Emu {
// GL_FRONT may require NV_read_buffer_front, depending whether the context is
// double buffered. Let's output a warning but still pass it through
case GL_FRONT:
if (!ctx.info->gl_nv_read_buffer_front)
if (!GetContext()->info->gl_nv_read_buffer_front)
Warning("glReadBuffer(GL_FRONT) may not work on ES 2 without NV_read_buffer_front, depending on context buffering.");
break;
@ -307,7 +304,7 @@ namespace Emu {
case GL_COLOR_ATTACHMENT13:
case GL_COLOR_ATTACHMENT14:
case GL_COLOR_ATTACHMENT15:
if (!ctx.info->gl_nv_draw_buffers)
if (!GetContext()->info->gl_nv_draw_buffers)
{
Warning("glReadBuffer(GL_COLOR_ATTACHMENT1+) not supported for ES 2 without NV_draw_buffers.");
return true;
@ -322,12 +319,12 @@ namespace Emu {
return false;
}
bool Filt::RenderMode(const RegalContext &ctx, GLenum mode)
bool Filt::RenderMode(GLenum mode)
{
UNUSED_PARAMETER(ctx);
UNUSED_PARAMETER(mode);
if (ctx.isCore() || ctx.isES2())
if (GetContext()->isCore() || GetContext()->isES2())
if (mode!=GL_RENDER)
{
Warning("Regal does not support ", GLenumToString(mode), " render mode for core or ES 2.0 profiles, only GL_RENDER is supported in those profiles - skipping.");
@ -337,21 +334,21 @@ namespace Emu {
return false;
}
bool Filt::FramebufferAttachmentSupported(const RegalContext &ctx, GLenum attachment)
bool Filt::FramebufferAttachmentSupported(GLenum attachment)
{
UNUSED_PARAMETER(ctx);
UNUSED_PARAMETER(attachment);
// If we're running on a non-ES context, then all attachments from EXT_framebuffer_object
// are supported
if (!ctx.isES2())
if (!GetContext()->isES2())
return true;
// COLOR_ATTACHMENT1 and up not supported in base ES 2.0. Need either
// NV_fbo_color_attachments, or EXT_draw_buffers (not yet checked by Regal)
if ((attachment > GL_COLOR_ATTACHMENT0) &&
(attachment <= GL_COLOR_ATTACHMENT15) &&
!(ctx.info->gl_nv_fbo_color_attachments /*|| ctx.info->gl_ext_draw_buffers*/))
!(GetContext()->info->gl_nv_fbo_color_attachments /*|| GetContext()->info->gl_ext_draw_buffers*/))
{
Warning("GL_COLOR_ATTACHMENT1+ not supported for ES 2.0 without NV_fbo_color_attachments or EXT_draw_buffers.");
return false;
@ -360,13 +357,13 @@ namespace Emu {
return true;
}
bool Filt::PixelStorei(const RegalContext &ctx, GLenum pname, GLint param)
bool Filt::PixelStorei(GLenum pname, GLint param)
{
UNUSED_PARAMETER(ctx);
UNUSED_PARAMETER(pname);
UNUSED_PARAMETER(param);
if (ctx.isES2())
if (GetContext()->isES2())
{
switch (pname)
{
@ -377,7 +374,7 @@ namespace Emu {
case GL_UNPACK_ROW_LENGTH_EXT:
case GL_UNPACK_SKIP_ROWS_EXT:
case GL_UNPACK_SKIP_PIXELS_EXT:
if (!ctx.info->gl_ext_unpack_subimage)
if (!GetContext()->info->gl_ext_unpack_subimage)
{
Warning("glPixelStorei ", GLenumToString(pname),
" not supported for ES 2.0 without EXT_unpack_subimage.");
@ -387,7 +384,7 @@ namespace Emu {
case GL_UNPACK_SKIP_IMAGES_NV:
case GL_UNPACK_IMAGE_HEIGHT_NV:
if (!ctx.info->gl_ext_unpack_subimage || !ctx.info->gl_nv_texture_array)
if (!GetContext()->info->gl_ext_unpack_subimage || !GetContext()->info->gl_nv_texture_array)
{
Warning("glPixelStorei ", GLenumToString(pname),
" not supported for ES 2.0 without EXT_unpack_subimage and NV_texture_array.");
@ -398,7 +395,7 @@ namespace Emu {
case GL_PACK_ROW_LENGTH_NV:
case GL_PACK_SKIP_ROWS_NV:
case GL_PACK_SKIP_PIXELS_NV:
if (!ctx.info->gl_nv_pack_subimage)
if (!GetContext()->info->gl_nv_pack_subimage)
{
Warning("glPixelStorei ", GLenumToString(pname),
" not supported for ES 2.0 without NV_pack_subimage.");
@ -408,7 +405,7 @@ namespace Emu {
case GL_PACK_IMAGE_HEIGHT:
case GL_PACK_SKIP_IMAGES:
if (!ctx.info->gl_nv_pack_subimage || !ctx.info->gl_nv_texture_array)
if (!GetContext()->info->gl_nv_pack_subimage || !GetContext()->info->gl_nv_texture_array)
{
Warning("glPixelStorei ", GLenumToString(pname),
" not supported for ES 2.0 without NV_pack_subimage and NV_texture_array.");
@ -425,13 +422,13 @@ namespace Emu {
return false;
}
bool Filt::PolygonMode(const RegalContext &ctx, GLenum face, GLenum mode)
bool Filt::PolygonMode(GLenum face, GLenum mode)
{
UNUSED_PARAMETER(ctx);
UNUSED_PARAMETER(face);
UNUSED_PARAMETER(mode);
if (ctx.isCore())
if (GetContext()->isCore())
{
if (face!=GL_FRONT_AND_BACK)
{
@ -440,7 +437,7 @@ namespace Emu {
}
}
if (ctx.isES2())
if (GetContext()->isES2())
{
Warning("Regal does not support glPolygonMode for ES 2.0 - skipping.");
return true;
@ -449,13 +446,12 @@ namespace Emu {
return false;
}
bool Filt::FilterGet(const RegalContext &ctx, GLenum pname, int &retVal)
bool Filt::FilterGet(GLenum pname, int &retVal)
{
UNUSED_PARAMETER(ctx);
UNUSED_PARAMETER(pname);
bool filtered = false;
if (ctx.isCore() || ctx.isES2())
if (GetContext()->isCore() || GetContext()->isES2())
{
filtered = true;
switch (pname )
@ -463,8 +459,8 @@ namespace Emu {
case GL_MAX_PIXEL_MAP_TABLE: retVal = 256; break;
case GL_MAX_NAME_STACK_DEPTH: retVal = 128; break;
case GL_MAX_LIST_NESTING: retVal = 64; break;
case GL_MAX_CLIENT_ATTRIB_STACK_DEPTH: retVal = ctx.emuInfo->gl_max_client_attrib_stack_depth; break;
case GL_MAX_ATTRIB_STACK_DEPTH: retVal = ctx.emuInfo->gl_max_attrib_stack_depth; break;
case GL_MAX_CLIENT_ATTRIB_STACK_DEPTH: retVal = GetContext()->emuInfo->gl_max_client_attrib_stack_depth; break;
case GL_MAX_ATTRIB_STACK_DEPTH: retVal = GetContext()->emuInfo->gl_max_attrib_stack_depth; break;
case GL_DEPTH_BITS: retVal = 24; break;
@ -496,7 +492,7 @@ namespace Emu {
}
}
if (ctx.isCore())
if (GetContext()->isCore())
{
filtered = true;
#if 0
@ -521,12 +517,12 @@ namespace Emu {
}
}
if (ctx.isES2())
if (GetContext()->isES2())
{
filtered = true;
switch (pname) {
case GL_MAX_COLOR_ATTACHMENTS:
if (ctx.info->gl_nv_fbo_color_attachments)
if (GetContext()->info->gl_nv_fbo_color_attachments)
filtered = false;
else
retVal = 1;
@ -535,7 +531,7 @@ namespace Emu {
case GL_PACK_ROW_LENGTH_NV:
case GL_PACK_SKIP_ROWS_NV:
case GL_PACK_SKIP_PIXELS_NV:
if (ctx.info->gl_nv_pack_subimage)
if (GetContext()->info->gl_nv_pack_subimage)
filtered = false;
else
retVal = 0;
@ -543,7 +539,7 @@ namespace Emu {
case GL_PACK_IMAGE_HEIGHT:
case GL_PACK_SKIP_IMAGES:
if (ctx.info->gl_nv_pack_subimage && ctx.info->gl_nv_texture_array)
if (GetContext()->info->gl_nv_pack_subimage && GetContext()->info->gl_nv_texture_array)
filtered = false;
else
retVal = 0;
@ -552,7 +548,7 @@ namespace Emu {
case GL_UNPACK_ROW_LENGTH_EXT:
case GL_UNPACK_SKIP_ROWS_EXT:
case GL_UNPACK_SKIP_PIXELS_EXT:
if (ctx.info->gl_ext_unpack_subimage)
if (GetContext()->info->gl_ext_unpack_subimage)
filtered = false;
else
retVal = 0;
@ -560,7 +556,7 @@ namespace Emu {
case GL_UNPACK_IMAGE_HEIGHT_NV:
case GL_UNPACK_SKIP_IMAGES_NV:
if (ctx.info->gl_ext_unpack_subimage && ctx.info->gl_nv_texture_array)
if (GetContext()->info->gl_ext_unpack_subimage && GetContext()->info->gl_nv_texture_array)
filtered = false;
else
retVal = 0;
@ -584,7 +580,7 @@ namespace Emu {
case GL_DRAW_BUFFER13:
case GL_DRAW_BUFFER14:
case GL_DRAW_BUFFER15:
if (ctx.info->gl_nv_draw_buffers)
if (GetContext()->info->gl_nv_draw_buffers)
{
if (fboID == 0)
retVal = GL_NONE;
@ -616,7 +612,7 @@ namespace Emu {
return false;
}
bool Filt::TexImage2D(const RegalContext &ctx, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* data)
bool Filt::TexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* data)
{
UNUSED_PARAMETER(ctx);
UNUSED_PARAMETER(target);
@ -629,7 +625,7 @@ namespace Emu {
UNUSED_PARAMETER(type);
UNUSED_PARAMETER(data);
if (ctx.isES2())
if (GetContext()->isES2())
{
switch ( target )
{

View file

@ -47,7 +47,7 @@ REGAL_GLOBAL_BEGIN
#include "RegalEmu.h"
#include "RegalContext.h"
#include "RegalContextInfo.h"
#include "RegalEmuProcsFilt.h"
#include "FiltProcs.h"
#include "RegalBreak.h"
REGAL_GLOBAL_END
@ -56,56 +56,51 @@ REGAL_NAMESPACE_BEGIN
namespace Emu {
struct Filt
struct Filt : public Layer
{
Filt()
: fboID(0)
{
Filt( RegalContext * ctx ) : Layer( ctx ), fboID(0) {}
virtual std::string GetName() { return "filt"; }
virtual bool Initialize( const std::string & instanceInfo ) {
ResetInterception();
return true;
}
void
Init(RegalContext &ctx)
{
orig.Initialize( ctx.dispatchGL );
EmuProcsInterceptFilt( ctx.dispatchGL );
virtual void ResetInterception() {
RegalContext * ctx = this->GetContext();
orig.Initialize( ctx->dispatchGL );
FiltIntercept( this, ctx->dispatchGL );
}
bool BindTexture(GLenum target, GLuint name );
bool BindFramebuffer(GLenum target, GLuint framebuffer);
bool DrawBuffers(GLsizei n, const GLenum *bufs);
void
Cleanup(RegalContext &ctx)
{
UNUSED_PARAMETER(ctx);
}
bool BindTexture(const RegalContext &ctx, GLenum target, GLuint name );
bool BindFramebuffer(const RegalContext &ctx, GLenum target, GLuint framebuffer);
bool DrawBuffers(const RegalContext &ctx, GLsizei n, const GLenum *bufs);
template <typename T> bool Get(const RegalContext &ctx, GLenum pname, T *params)
template <typename T> bool Get(GLenum pname, T *params)
{
int retVal;
if (FilterGet(ctx,pname,retVal)) {
if (FilterGet(pname,retVal)) {
params[0] = T(retVal);
return true;
}
return false;
}
bool GetTexParameteriv (const RegalContext &ctx, GLenum target, GLenum pname, GLint *params);
bool TexParameter (const RegalContext &ctx, GLenum target, GLenum pname);
bool FilterTexParameter (const RegalContext &ctx, GLenum target, GLenum pname, GLfloat param, GLfloat &newParam);
bool FramebufferTexture2D(const RegalContext &ctx, GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
bool GenerateMipmap(const RegalContext &ctx, GLenum target);
bool PolygonMode (const RegalContext &ctx, GLenum face, GLenum mode);
bool ReadBuffer (const RegalContext &ctx, GLenum src);
bool RenderMode (const RegalContext &ctx, GLenum mode);
bool PixelStorei (const RegalContext &ctx, GLenum pname, GLint param);
bool FramebufferAttachmentSupported(const RegalContext &ctx, GLenum attachment);
bool GetTexParameteriv (GLenum target, GLenum pname, GLint *params);
bool TexParameter (GLenum target, GLenum pname);
bool FilterTexParameter (GLenum target, GLenum pname, GLfloat param, GLfloat &newParam);
bool FramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
bool GenerateMipmap(GLenum target);
bool PolygonMode (GLenum face, GLenum mode);
bool ReadBuffer (GLenum src);
bool RenderMode (GLenum mode);
bool PixelStorei (GLenum pname, GLint param);
bool FramebufferAttachmentSupported(GLenum attachment);
bool FilterGet (const RegalContext &ctx, GLenum pname, int &retVal);
bool FilterGet (GLenum pname, int &retVal);
bool TexImage2D (const RegalContext &ctx, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* data);
bool TexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* data);
EmuProcsOriginateFilt orig;
FiltOriginate orig;
private:
GLuint fboID;

File diff suppressed because it is too large Load diff