mirror of https://github.com/PCSX2/pcsx2.git
gsdx-ogl-wnd:
* Fix shader alpha issue. Hoppefully fix lots of glitches. * Use glBufferSubData to upload data into the constant buffer instead of map/unmap. More fps :) * Fix wrong api setup on EGL * Be more portable on glsl2h git-svn-id: http://pcsx2.googlecode.com/svn/branches/gsdx-ogl-wnd@5650 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
parent
efcb015361
commit
65b5a376ed
|
@ -2,9 +2,10 @@
|
|||
|
||||
use strict;
|
||||
use warnings;
|
||||
use File::Spec;
|
||||
|
||||
my @res = qw/convert interlace merge shadeboost tfx/;
|
||||
my $path = "plugins/GSdx/res";
|
||||
my $path = File::Spec->catdir("plugins", "GSdx", "res");
|
||||
|
||||
foreach my $r (@res) {
|
||||
glsl2h($path, $r);
|
||||
|
@ -14,8 +15,10 @@ sub glsl2h {
|
|||
my $path = shift;
|
||||
my $glsl = shift;
|
||||
|
||||
open(my $GLSL, "<$path/${glsl}.glsl");
|
||||
open(my $H, ">$path/${glsl}.h");
|
||||
my $in = File::Spec->catfile($path, "${glsl}.glsl");
|
||||
my $out = File::Spec->catfile($path, "${glsl}.h");
|
||||
open(my $GLSL, "<$in") or die;
|
||||
open(my $H, ">$out") or die;
|
||||
|
||||
my $header = <<EOS;
|
||||
/*
|
||||
|
|
|
@ -18,7 +18,6 @@ set(CommonFlags
|
|||
-Wunused-variable
|
||||
-std=c++0x
|
||||
-fno-strict-aliasing
|
||||
#-DENABLE_OGL_DEBUG # FIXME remove me when code is ready
|
||||
)
|
||||
|
||||
set(OptimizationFlags
|
||||
|
@ -28,7 +27,7 @@ set(OptimizationFlags
|
|||
|
||||
# Debug - Build
|
||||
if(CMAKE_BUILD_TYPE STREQUAL Debug)
|
||||
add_definitions(${CommonFlags} -DENABLE_OGL_DEBUG -g -Wall)
|
||||
add_definitions(${CommonFlags} -D_DEBUG -g -Wall)
|
||||
endif(CMAKE_BUILD_TYPE STREQUAL Debug)
|
||||
|
||||
# Devel - Build
|
||||
|
|
|
@ -85,6 +85,7 @@ PFNGLUSEPROGRAMSTAGESPROC gl_UseProgramStages = NULL;
|
|||
PFNGLVERTEXATTRIBIPOINTERPROC gl_VertexAttribIPointer = NULL;
|
||||
PFNGLVERTEXATTRIBPOINTERPROC gl_VertexAttribPointer = NULL;
|
||||
PFNGLTEXSTORAGE2DPROC gl_TexStorage2D = NULL;
|
||||
PFNGLBUFFERSUBDATAPROC gl_BufferSubData = NULL;
|
||||
// NO GL4.1
|
||||
PFNGLUSEPROGRAMPROC gl_UseProgram = NULL;
|
||||
PFNGLGETSHADERINFOLOGPROC gl_GetShaderInfoLog = NULL;
|
||||
|
@ -207,6 +208,7 @@ namespace GLLoader {
|
|||
GL_LOADFN(gl_VertexAttribIPointer, glVertexAttribIPointer);
|
||||
GL_LOADFN(gl_VertexAttribPointer, glVertexAttribPointer);
|
||||
GL_LOADFN(gl_TexStorage2D, glTexStorage2D);
|
||||
GL_LOADFN(gl_BufferSubData, glBufferSubData);
|
||||
// NO GL4.1
|
||||
GL_LOADFN(gl_UseProgram, glUseProgram);
|
||||
GL_LOADFN(gl_GetShaderInfoLog, glGetShaderInfoLog);
|
||||
|
|
|
@ -111,6 +111,7 @@ extern PFNGLUSEPROGRAMSTAGESPROC gl_UseProgramStages;
|
|||
extern PFNGLVERTEXATTRIBIPOINTERPROC gl_VertexAttribIPointer;
|
||||
extern PFNGLVERTEXATTRIBPOINTERPROC gl_VertexAttribPointer;
|
||||
extern PFNGLTEXSTORAGE2DPROC gl_TexStorage2D;
|
||||
extern PFNGLBUFFERSUBDATAPROC gl_BufferSubData;
|
||||
// NO GL4.1
|
||||
extern PFNGLUSEPROGRAMPROC gl_UseProgram;
|
||||
extern PFNGLGETSHADERINFOLOGPROC gl_GetShaderInfoLog;
|
||||
|
|
|
@ -55,10 +55,10 @@ public:
|
|||
|
||||
void upload(const void* src)
|
||||
{
|
||||
uint32 flags = GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_BUFFER_BIT;
|
||||
uint8* dst = (uint8*) gl_MapBufferRange(target, 0, size, flags);
|
||||
memcpy(dst, src, size);
|
||||
gl_UnmapBuffer(target);
|
||||
// glMapBufferRange allow to set various parameter but the call is
|
||||
// synchronous whereas glBufferSubData could be asynchronous.
|
||||
// TODO: investigate the extension ARB_invalidate_subdata
|
||||
gl_BufferSubData(target, 0, size, src);
|
||||
}
|
||||
|
||||
~GSUniformBufferOGL() {
|
||||
|
|
|
@ -103,6 +103,10 @@ bool GSWndEGL::CreateContext(int major, int minor)
|
|||
void GSWndEGL::AttachContext()
|
||||
{
|
||||
if (!IsContextAttached()) {
|
||||
// The setting of the API is local to a thread. This function
|
||||
// can be called from 2 threads.
|
||||
eglBindAPI(EGL_OPENGL_API);
|
||||
|
||||
//fprintf(stderr, "Attach the context\n");
|
||||
eglMakeCurrent(m_eglDisplay, m_eglSurface, m_eglSurface, m_eglContext);
|
||||
m_ctx_attached = true;
|
||||
|
|
|
@ -526,14 +526,14 @@ vec4 sample_color(vec2 st, float q)
|
|||
if((PS_FMT & ~FMT_PAL) == FMT_24)
|
||||
{
|
||||
// FIXME GLSL any only support bvec so try to mix it with notEqual
|
||||
bvec3 rgb_check = notEqual( t.rgb, vec3(0.0f, 0.0f, 0.0f) );
|
||||
t.a = ( (PS_AEM == 0) || any(rgb_check) ) ? TA.x : 0.0f;
|
||||
bvec3 rgb_check = notEqual( c[i].rgb, vec3(0.0f, 0.0f, 0.0f) );
|
||||
c[i].a = ( (PS_AEM == 0) || any(rgb_check) ) ? TA.x : 0.0f;
|
||||
}
|
||||
else if((PS_FMT & ~FMT_PAL) == FMT_16)
|
||||
{
|
||||
// FIXME GLSL any only support bvec so try to mix it with notEqual
|
||||
bvec3 rgb_check = notEqual( t.rgb, vec3(0.0f, 0.0f, 0.0f) );
|
||||
t.a = t.a >= 0.5 ? TA.y : ( (PS_AEM == 0) || any(rgb_check) ) ? TA.x : 0.0f;
|
||||
bvec3 rgb_check = notEqual( c[i].rgb, vec3(0.0f, 0.0f, 0.0f) );
|
||||
c[i].a = c[i].a >= 0.5 ? TA.y : ( (PS_AEM == 0) || any(rgb_check) ) ? TA.x : 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -554,14 +554,14 @@ static const char* tfx_glsl =
|
|||
" if((PS_FMT & ~FMT_PAL) == FMT_24)\n"
|
||||
" {\n"
|
||||
" // FIXME GLSL any only support bvec so try to mix it with notEqual\n"
|
||||
" bvec3 rgb_check = notEqual( t.rgb, vec3(0.0f, 0.0f, 0.0f) );\n"
|
||||
" t.a = ( (PS_AEM == 0) || any(rgb_check) ) ? TA.x : 0.0f;\n"
|
||||
" bvec3 rgb_check = notEqual( c[i].rgb, vec3(0.0f, 0.0f, 0.0f) );\n"
|
||||
" c[i].a = ( (PS_AEM == 0) || any(rgb_check) ) ? TA.x : 0.0f;\n"
|
||||
" }\n"
|
||||
" else if((PS_FMT & ~FMT_PAL) == FMT_16)\n"
|
||||
" {\n"
|
||||
" // FIXME GLSL any only support bvec so try to mix it with notEqual\n"
|
||||
" bvec3 rgb_check = notEqual( t.rgb, vec3(0.0f, 0.0f, 0.0f) );\n"
|
||||
" t.a = t.a >= 0.5 ? TA.y : ( (PS_AEM == 0) || any(rgb_check) ) ? TA.x : 0.0f;\n"
|
||||
" bvec3 rgb_check = notEqual( c[i].rgb, vec3(0.0f, 0.0f, 0.0f) );\n"
|
||||
" c[i].a = c[i].a >= 0.5 ? TA.y : ( (PS_AEM == 0) || any(rgb_check) ) ? TA.x : 0.0f;\n"
|
||||
" }\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
|
|
Loading…
Reference in New Issue