Copy changes faaf1553cf and
f37a7ed6c5 from the GLESv1 translator to
the GLESv2 translator. After this, both translators use the same logic
for glEGLImageTargetTexture2DOES().
Change-Id: I0a95bf2301df7b7428abc593f38170edf4cbda30
The data pointer argument to glBufferData can be NULL; this
[re]allocates the buffer while leaving the contents undefined.
Bug: 5833436
Change-Id: Ia1ddf62e2cd2c59d3d631e01d23d7c557ca5a52e
* Disable verbose debug spam.
* Add missing GL enum to utility function. The default case was
returning the correct size, so this doesn't fix any bugs, just
removes some logcat spam.
* Comment and whitespace corrections.
Change-Id: I83fb8644331ae1072d6a8dae9c041da92073089f
When remapping a GLES texture to a different GL texture in
glEGLImageTargetTexture2DOES(), the GLES texture's previous GL texture was
deleted unconditionally. This is bad when it came from an EGLImage and is
therefore owned by (and will continue to be used by) some other object.
The code now skips deleting the old GL texture if it came from an EGLImage.
This mirrors the logic in glDeleteTextures().
Change-Id: I5b650334a7019d824517c2915b1f23961fbbd809
The EGL->GL translator implementation of glEGLImageTargetTexture2DOES was
properly replacing uses of the target texture object with the texture object
associated with the EGLImage in the host GL library, but wasn't updating its
own info about the texture (dimensions, etc.). This broke places where the
translator relied on knowing this, e.g. when implementing the GLES glDrawTexi
call on top of GL glDrawArrays.
Change-Id: Ia4aefd89852a2609221c56da76bfac927464c0b2
This patch modifies GLDispatch.cpp in the translator libraries
to open the Darwin GL library as a framework. Using a hard-coded
system path prevents the requirement to modify LD_LIBRARY_PATH
or DYLD_LIBRARY_PATH to point to the directory that contains the
library.
In this specific case, this is equivalent to
/System/Frameworks/OpenGL.framework/Libraries/libGL.dylib
But is the "kosher" way to open it the library.
Change-Id: Iccd6568d36fc97200617c268f05d7b4ea85f918e
add drawValidate when calling glCheckFramebufferStatus
in the draw validate, a color attachement will be added to the
framebuffer if there is no target attached to COLOR_ATTACHMENT
of the framebuffer.
opengl does not allow framebuffer with no color attachement
so CheckFramebufferStatus would return INCOMPLETE status.
We already call drawValidate before any draw, the call was
missing at glCheckFramebufferStatus.
Change-Id: I94b930024c3076ac5fe0f8662d11884729c4f953
Wrong share group was set up when two user contexts are sharing !
That means that shared context was not really worked before, now it does.
Change-Id: Ia4edbba0441e309902b2c48c44865342410bae3d
on eglCreateContext the translator created a window for the
specified config with a matching pixelformat and saved it's
device context for future use.
however when the thread exited the window was destroyed by windows
and the handle saved became invalid.
the next call to wglCreateContext with the handle saved failed.
fixed the problem by creating windows per thread and not in a
global pool.
each thread will create its own window for each config when asked
the window will be destroyed when the thread exits.
Change-Id: I63668a20e8c30c42c4cfcaca664938683600b28e
On Mac it happens that when a context is bound to a pbuffer
and you want to bind it to a window (NSView) instead you must
release it from the pbuffer before binding the window by calling
clearDrawable handle of NSOpenGLContext.
This change added an override of NSOpenGLContext in order to track
to which drawable type the context was previously bound and
call clearDrawable when necessary.
Change-Id: Iece5ab16a46aa0d107ccb773986a6b280d09d181
Workaround to intel/linux driver issue.
Desktop OpenGL does not support precision qulifiers in shaders,
so we remove them by defining "precision" "mediump" "lowp" and
"highp" to blank.
That translates the line "precision mediump float;" to "float;" which
is a valid command according to the GLSL spec however it fails
to compile using the intel/linux driver.
This change adds a parser which removes completely the
precision command from the shader source.
Change-Id: I29a16bb78ac0000d624aa2f83e93ef5c6ad60345
on some platforms info log length of programs and shaders was
not returned correctly, we now cache the info log for these objects
and calculate info log length intenrally to be both correct and
compliant to the spec and conformance tests.
Change-Id: I017932482ba36f9e2e1858fe372683f7ac3a98ca
In GLES, a vertex shader attribute can be at location 0 and have
a current value. In OpenGL, the spec is not clear, resulting in
absurdities like the ATI driver binding an attribute to location
0, does not give an erro when you set it, but gives an error when
you try to get it back. And it doesn't actually set the value in
the shader.
So, in this patch we:
1. Track attribute 0 value internally, setting and getting it
as necessary.
2. Upon glDrawArrays and glDrawElements, if attribute 0 is not
"array enabled" (that is, it should use a current value) we
create a dummy array, fill it with the intended current value,
and attach and enable it. After the draw, we disable it.
Change-Id: I35f3e8a924e6fba236f4f4d85423b04ae448dad4
adding more params validations to some GL functions
which the OpenGL layer below us should check , but using Intel
Graphic driver those checks are ignored
Change-Id: I3ca2a891f1d9f988a7b662d6bc32b81e12cc333d
fixin a bug when we declared that our implementation supports
OES_standard_derivatives without checking that the
openGL layer below supports this extention
Change-Id: Ic74f18eb753f0cfe067e23c3bf83905e40b17665
fix glGetAttachedShaders
NULL is allowed in count parameter
fix problem with nvidia driver which returned invalid count
Change-Id: Icfaa5688b04325de2890486eb87b163babaddf30
The GLES and OpenGL specs for glFramebufferTexture2D are different, which
caused valid GLES calls to fail when moved over to OpenGL. Specifically,
a framebuffer in OpenGL must have a color attachment in order to be valid
for draw, while in GLES it doesn't. So add a validate function, and call
it from each drawing API call.
This patch also contains a workaround for a bug in the ATI driver, where
changing the framebuffer attachments requires a rebind of the framebuffer.
Change-Id: I011fbe0e2b1c66564322268868a24a9d5958a434
to overcome a bug in intel driver which returnes incorrect precision
and range for integers. query the driver for precision format only
for floats. for integers, we return values defined in gles spec.
Change-Id: Idfec2826d811220873c18f301cf4268fc54dabee
fix the default values of vertex attrib array to match gles spec
size should be initialized to 4, and type should be initialized to GL_FLOAT
Change-Id: If23b3aec574ca660181be2ef1c91de1de2b07a70
genName in the globalNameSpace now calls the glGen* function of opengl
to generate a global name instead of inventing one.
this is to overcome a bug in intel driver which raises glError when
binding a framebuffer/renderbuffer with a name that was not generated
by opengl.
Change-Id: Ia0c2fefbf3538c185c380ba62d74eb94f2b28254
When an intersection is found, we want to add it to the output list, if splitting is needed and if not.
Change-Id: I9c9827b1c0ecd434925ff5698dd42bc1025dbedf
Removed calling into opengl/wgl from the initialiation code
of libEGL (was made during creation for the EglGlobalInfo object
during global variable initialization) !
That causes issues on ATI driver on windows since we might call into
the driver before it gets initialized. Instead we initialie the EglGlobalInfo
during the first call into libEGL.
Also ATI's version of wglChoosePixelFormatARB does not accept
NULL in the attribute list arguments.
Change-Id: I508263dc0440561ee1cd1311ed5ce37cee4d407e
On Linux/Intel, some configurations are returned which make no sense.
Also, no use for single buffer config, and we don't support pixmap
visuals.
Change-Id: I11f37c8ba612ee10dd654141e6f167add1675dce
There was very few compilation warning on Windows and Linux.
This change just fixes those warnings.
Change-Id: I0428aa3dd33b2add40aa6cd12da76910950533b8
GLSL ES 1.0.17 spec states that its written against
OpenGL GLSL version 1.2, that means that #version 100
in GLSL ES should be mapped to #version 120 in OpenGL
GLSL.
We now force "$version 120" in all shaders except if
higher version has been requested in the shader source
or when GOOGLE_GLES_FORCE_GLSL_VERSION is defines.
(Note that GOOGLE_GLES_DEFAULT_GLSL_VERSION is renamed
to GOOGLE_GLES_FORCE_GLSL_VERSION).
That fixes "Aqua Slash GL Demo" application !!
Change-Id: I0f61ba3aa1c5591df3dacd3afd7f216dba13b56e
That adds support to create a renderbuffer storage from an EGL
image (previously only texture was supported).
For that we have added Renderbuffer and Framebuffer attachment points
state tracking and when a renderbuffer which attached to an EGLImage
get attached to a framebuffer we attach the underlying EGLImage's
texture instead.
Also fixed some egl_image related bugs.
That makes the egl_image conformance test to pass on host.
Change-Id: I4e8c4935e45b27214038ecf1c1187ed96c5cea5b
We save the texData->target in original format, but use our internal format
(using GLTextureTargetToLocal) to make sure we're not mixing 2D and CUBE_MAP textures on
glBindTexture.
Also added the GL_S/R/T/Q constants where needed.
This fixes the Cube Map test in Api Demos.
Change-Id: Id5de45581f2227fe0978d7982a147cb6b4b595c4
It used to be a GL_NV_packed_depth_stencil string extension, but
now it's GL_EXT_packed_depth_stencil and implemented by everyone. on
nVidia drivers both are exported.
Change-Id: I1b4af8a776f9957838d466b24fe73fa873ea85e4
texture=0 has a special meaning - detach texture. Therefore we should pass
it on as 0 rather than look for the global name in the name space.
Change-Id: If7d0174a7fd07fc13a75430312b605497653f01b
A bug in the ATI OpenGL driver causes glGet(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS)
to return 32, although the driver supports only 16. The minimum required
by the spec is 2, so limit the number to 16.
Change-Id: Ife99dc5544f80ad872362414e9a5d9d2722d8a42
eglGetProcAddress should return a function pointer that does not
depends on the current bounded context (if any), when the user
calls one of the function pointers returned from eglGetProcAddress
for one of the GLES extension functions, the GLESv1 or GLESv2
version of the extension function shold be called depending on
the current bounded context.
For this we have added a ClientAPI (GLES) extension dispatch
table in the EGL level which points to static functions in libEGL
where each function checks in runtime the current bound context and
calls down to the GLES_CM -or- GLESv2 library function.
See ClientAPIExts.cpp, when new GLES extension functions are added
to GLESv1 or GLESv2 its definition should be added to
ClientAPIExts.in as well.
This fixes the segfault in egl_image conformance test.
Change-Id: I8464d87c2fcbe57d67bd8b891b695a690dec89f3
Handle EGL context and surfaces destrouction using ref counting
pointer (SmartPtr) rather then maintaining a "markForDeletion" flag.
This has required to re-arrange the ThreadInfo structure to be local
to EGL rather then in the GLcommon area so that we will be able to
place a ref-counted pointer to the current context in the TLS.
That fixes the crash during exit of covgl conformance test.
Change-Id: I6f0a2e49c6f21eb75b654cab4346c764715c449b
Adds GLSL built in constants defined in GLSL ES but not in GLSL.
Makes biConstant conformance test to pass on Mac (where ES2_compatability is not
present).
Also fixed the GLSL parser to insert our additions to the shader
only after the "#version" token if exist in the original shader.
Also renamed env var GOOGLE_GLES_FORCE_GLSL_VERSION to
GOOGLE_GLES_DEFAULT_GLSL_VERSION to better match its functionality since
we use it only if no specific version exist in the shader code.
Change-Id: If9485da16da2808245943a7295f8fb22a6f631aa
Both the ATI and nVidia OpenGL drivers return the wrong answer on
glGetIntegerv(GL_ALPHA_TEST_REF). So Implement this functionality
in our code.
Change-Id: I022b1475f7edb9f1d0f48ebcaf9f6e9f5c4f344e
enable workarounds by default
added environemnt variable GOOGLE_GLSL_FORCE_GLES_VERSION
to the shader parser
Change-Id: If1dbc10722436659295c40a40bd630a72e575799
nvidia may return GL_VALIDATE_STATUS = GL_TRUE even when the program does not link
this change checks for GL_LINK_STATUS when GL_VALIDATE_STATUS is queried
Change-Id: Ia9f5da9c71b8666ce929d8cc2a44639bc947eecb
This is not really a bug, but the nVidia shader compiler is much more
liberal than the GLSL spec, and allows compilation of shaders which
do not comply with the spec. This is an issue for passing the
conformance tests, but more importantly it will allow bad shader written
by the app developer to pass on the emulator and then to fail on the device.
Adding "#version 100" definition to the head of a shader source disables
this liberal behavior. For now this is activated in run time by the "NV_WAR"
environment variable.
Change-Id: I1c322d4221d313d3ee70592bc15ea0e340853990
When calling RenderbufferStorage with internalformat=GL_RGB565
we will create one with internal format GL_RGB
the same for glTexImage2D
Change-Id: I1e464dd36142f586beef6bf895456c7aab1b8237
support different binding to GL_TEXTURE_2D and GL_TEXTURE_CUBE_MAP
targets
create 2 default texture object, to be bound when BindTexture( ... ,0)
is called.
in order to do this, we must ensure their names are internal only, so the user can't
use these names by accident.
the object name manager local name is now 64 bit to allow generation of internal names
Change-Id: I29d000a67042051706e13dc3ef3aa34a1a24f8ca
Do not allow glLinkProgram to succeed if only one shader type has been
attached to the program, GL allows this, but GLES2 does not.
added state tracking for program objects to check which shaders are
attached to the program object.
add a way to define object data type being held for each object in objectNameManager
ProgramData and ShaderParser are both valid objectData for objects in SHADER namespace
we need a way to determine object type to generate correct errors
Change-Id: Ic232549df0bb6daf6ec528cb039482cd68e896bb
Instead of calling the dispatcher directly. This will make sure all Translator's
internals (such as TextureData data) are updated properly.
This also fixes the bug in "Replica Island" - when the green robot was invisible,
because it's TextureData wasn't updated by doCompressedTexImage2D
The pointer to glTexImage2D is passed as a parameter to doCompressedTexImage2D,
otherwise Windows resolve the glTexImage2D symbol in the external libGL rather
than the translator's code. Longer term, we will remove the translator's link
to libGL, at which point this parameter will be removed.
The getGlobalName function returns 0 on error. There are many places
were no error checking is done after calling it to get a shader or
program name. Typically this shouldn't be an issue, since the follwing
OpenGL call using a value of 0 will generated the required GL_INVALID_VALUE,
but this does not always happen.
Change-Id: I8edf2b152978ffd8626f8b4d778cc624f2a3bec3
This fixes a crash caused by covgl (on Nvidia linux driver) when our implementation
of glDrawTexOES calls glDrawArrays with GL_TEXTURE_COORD_ARRAY enabled - but none of texture
units are enabled and no data passed by glTexCoordPointer
Change-Id: Id28b0c35a5a17b139ab196db0e434d2f0a490132