Commit Graph

59 Commits

Author SHA1 Message Date
Liran
8ee217f9cc opengles emulator: fix glGetUnifrom
added state tracking for uniforms in program objects
for each active uniform in index i we will save its starting location
,size and type, so when calling glGetUniform on its location,
we can tell how many bytes we should read from the stream according to
the uniform's type

add some type and size definitions to functions
that calculate size from enum

some other fixes to the codec

Change-Id: I4ecdf41e752454a908d131e76bab113a616f2bc8
2011-08-10 10:08:05 +02:00
Amit Feller
cd359e5718 opengles emulator: fixing pointer size bug.
Fix for a bug in pointer size of shaders param in
glGetAttachedShaders function

Change-Id: I647032b2bfcc9d341214accd72700adce07e6e4c
2011-08-10 10:08:05 +02:00
Guy Zadickario
467e5fb162 opengles emulator: fixed renderer termination flow
Handling clean exit of the renderer when stopOpenGLRenderer
is called. This is done by openning a connection to the renderer
and flag that it should exit. Added 'clientFlags' field which must
be send after every connection is made to the renderer for this purpose.
The server will wait for running rendering threads to exit and then will
close all EGL/GL resources and will exit. The stopOpenGLRenderer will
return only when the renderer has exited.

Change-Id: I8272b8ea59d5fc78453bb7bd2d25908068869fa7
2011-08-10 10:03:07 +02:00
Stas Gurtovoy
0710435277 emulator opengl: fixed encoding of glGenRendebuffer
Fixed pointer direction to be out (receives info from host).

Change-Id: I881b68393232cd262dd06eb1c124cf305ba28f31
2011-08-09 17:36:35 +02:00
Liran
ca5e9825a4 opengles emulator: fix glGetShaderSource
added NullAllowed flag to length parameter of glGetShaderSource
calling glGetShaderSource with NULL length caused length data
from the host get left on the stream and get the stream out of sync

Change-Id: I45e8e523a67698c9b0cd003e2af7e15c76ed22b7
2011-08-09 17:29:17 +02:00
Stas Gurtovoy
0111043202 opengles emulator: fix the mixing between pack/unpack alignments
The was a bug in the calculation of the pixels data size, caused by wrong usage
of pack/unpack alignment.
Pack should be used for glReadPixels, while unpack should be used for glTexImage and such.
Also fixes crash in "Angry Birds" & "Angry Birds Rio"

Change-Id: I099308a57a1ea907d38c59bad056429bc107de98
2011-08-09 17:14:20 +02:00
Stas Gurtovoy
e99305dd9f opengles emulator: cache all buffer on the guest
This is needed to support the rare, but still legal scenario,
when glDrawElemets is used with some index array data is stored in VBO's
while the actual attributes (vertices) data is in immediate mode.
When in immediate mode, we need to process the incodes, in order to know
which vertex data to send, which was impossible without the caching.
This commit introduces a new class GLSharedGroup, which will hold all data
that can be shared by shared contexts (buffers are such data).
This also makes the "Jet Cars Stunts" app work properly.

Change-Id: Ic937080dae461bc8cdf4d10cf37066a6e847f464
2011-08-09 17:14:20 +02:00
Stas Gurtovoy
8f887e6f08 opengles emulator: fix eglGetError
eglGetError should set it's internal state to EGL_SUCCESS after every call

Change-Id: I55d1e5b2a03bae8b332c78e8179edd79c9e8e79e
2011-08-09 16:46:25 +02:00
Stas Gurtovoy
39c53186b9 opengles emulator: inc/dec ref-count of buffer on SwapBuffers
On every swapBuffers, we make sure to decRef on the prev buffer,
and incRef on the current buffer. This fixes all the anoying
crashes on application exit, and also after the speech windows
on Replica Island

Change-Id: I1981fbf17a24ef6f60cdcf6d7ec3a5e7eef5377f
2011-08-09 16:46:09 +02:00
Vladimir Chtchetkine
b2b6f2f9da Get rid of libqemu library.
Its implementation has been inlined in hardware/libhardware/include/hardware/qemu_pipe.h

Change-Id: I355764f87047c915ac43b85cd18bf0f27f06ede3
2011-08-03 09:10:14 -07:00
Stas Gurtovoy
d9d1006222 opengles emulator: support for null in data parameter of glCompressedTexImage2D
Thought the spec doesn't speak about null in data parameter,
it is checked in covgl - so we'll base it on glTexImage2D and allow
null in data.

Change-Id: I9bf5131852bf795acc7ab89bd17b9df90ac99460
2011-07-13 11:26:37 +03:00
Stas Gurtovoy
c99d4a0594 opengles emulator: support NULL as parameter to glTexImage2D (gles1)
This is implemented using the nullAllowed attrib (same as gles2 in gl2.attrib)

Change-Id: I6d359a112daa8acf36dfa05403df42e921f3502c
2011-07-13 11:26:37 +03:00
Stas Gurtovoy
201584b1d4 egl emulator: fixes for covegl conformance test
Support for eglChooseConfig with configs==NULL.
Also added small change to query EGL_LARGEST_PBUFFER attrib of surfaces.
Fixed error print in QemuPipeStream::readFully.

Those changes make sure that covegl completes & passes on the emulator with Translator
on linux in the backend.

Change-Id: I892917ec102ae85d56a16a7cb321e8c12e7083f1
2011-07-12 00:46:06 +02:00
Stas Gurtovoy
d6f18cdf80 opengl emulator: Added gl error tracking on the guest (encoder)
Sometimes we need to check parameter values before encoding
to prevent crashes, for example:
glDeleteBufferes(-1, ptr); - would crash
For that we need to check some gl errors on the guest.

The change adds error state to the encoder and also
adds new feature to emugen which allows to insert
parameter check code into the attribute file.
Added such parameter check code in the appropiate
gl functions in gl.attrib and gl2.attrib

Change-Id: I7f317df52ac8fbd96979100a1031cf023a0b49d3
2011-07-07 16:35:16 +03:00
Liran
2782c5a061 System egl: fix eglInitialize
fix eglInitialize to accept NULL in major/minor parameters
2011-07-03 15:35:12 +03:00
Stas Gurtovoy
304a1c21ca opengles Translator: Omit precision macros from shaders
The shaders fail to compile if we don't omit those changes (Cordy game for example).
Anyways, they have no semantic meaning in GLSL, quote for GLSL 4.1 spec:
"Precision qualifiers are added for code portability with OpenGL ES, not for functionality. They have the
same syntax as in OpenGL ES, as described below, but they have no semantic meaning, which includes no
effect on the precision used to store or operate on variables."
Also removed an anoying print in the encoder.
2011-07-03 15:35:11 +03:00
Stas Gurtovoy
5d355b71c5 opengles emulator: Init eglError to EGL_SUCCESS 2011-07-03 15:28:01 +03:00
Stas Gurtovoy
33e95e85fd emulotor gralloc: fixed HAL_PIXEL_FORMAT_RGB_565
set its glFormat to GL_RGB since GL_RGB565_OES is not supported on the host.
This also fixes the wallpaper issue, making it visible.

Change-Id: Icf616e70d8f41ca0d01e7cdeb9585107dc8ebc31
2011-07-01 12:06:07 +02:00
Stas Gurtovoy
8793e54e60 emulator gralloc: Make the cb_handle_t::validate static
This is nicer, since it checks the handle itself, not counting on the caller to check it

Change-Id: I7eba6292dee8e0832a8c0074f508c07c3bc43ff2
2011-06-30 09:14:16 +03:00
Stas Gurtovoy
118af85051 emulator GLESv2: fixed (#16) NenaMark crashes on exit
The GL2Encoder::m_compressedTextureFormats  member wasn't initialized, so the d'tor
would sometimes crash trying to delete it. Also init m_num_compressedTextureFormats.

Change-Id: Iae423c16a84a4e454e0e1167f7478f9e2f6183c0
2011-06-30 09:14:16 +03:00
Stas Gurtovoy
62d074d9f8 emulator opengl: add GLESv2 support to driver + renderer
Added GLESv2 library to system.
Made fixes to the host libOpenGLRender to
compile and support GLESv2 (defined WITH_GLES2).
Other fixes required to make GLESv2 to work.

Change-Id: I9eb198e6092e7fa3550342c50929dd1714282cb3
2011-06-30 09:14:12 +03:00
Guy Zadikario
0536060b40 emulator opengl: guest/host rendering syncronization.
Added a return value for rcFlushWindowColorBuffer and
rcUpdateColorBuffer in order to make those calls to block
with a round-trip to the host. This is to make sure that
the color buffer is up-to-date before the flinger use it
for rendering.
Also added a call to the native windows's lock function after
EGL is attached and bound to render on the window. This call
was missed before.

This syncronization can be optimized by removing the round-trip
and insert sync primitive to the stream at every draw command that
reads from a color buffer to make the sync happen on the host
before rendering the color buffer and remove the need for the
guest to wait for that update.

Change-Id: I1c2d8bc407b69663e992a68d5aa755f19bbe0ec3
2011-06-25 16:56:08 +03:00
Stas Gurtovoy
88ad268dd9 emulator opengles: Fixed bug in gralloc unregister_buffer
Reset the ashmemBase & mappedPid on unregister_buffer

Change-Id: Ia209f88a15eb51edb39b1a799500d835b944bc87
2011-06-25 16:30:30 +03:00
Stas Gurtovoy
128f401e4f emulator opengles: Fixed a bug in eglChooseConfig implementation.
The config_size argument in rcChooseConfig should match the number
of requested configs and not the size in bytes to store it.
Moved the configs array size computation into rendeerControl.attrib.

Change-Id: I9e797024522965a656764c20252b25ff5ae657f5
2011-06-25 16:30:30 +03:00
David 'Digit' Turner
8422a11a21 emulator: opengl: Update/simplify build scripts
This patch is a major rework of the build opengl-emulation
build scripts. See README for details.

In a nutshell, this introduces various functions that considerably
simplify the declaration of the 26+ modules in this implementation,
by handling auto-generation of sources and module imports/exports.

Change-Id: I827522d783c7b6cf5eafd37204a1025c235458cd
2011-06-23 00:35:54 +02:00
Guy Zadikario
22a288abf8 emulator gralloc: removed compilation warnings.
just removes anoying compliation warnings in the HMI
initialization.

Change-Id: I23377a7cae774cf436f89e25edb78c10ff5b5c78
2011-06-21 20:47:43 +02:00
Guy Zadikario
7d39ef3772 emulator opengl: Fix gralloc color buffer uploads
Use the correct OpenGL pixel type enum when uploading
color buffer content to host.

Change-Id: Idc859306c0398850505f0f348796bc4f12b63b6a
2011-06-21 20:47:43 +02:00
Stas Gurtovoy
ca629bd28e emulator opengl: fix crash in gralloc_free
Fixed bug in list implementation in gralloc_free which caused a crash,
also removed some log prints.

Change-Id: Ie932c838086c99567643868682419ceb122cf787
2011-06-21 20:47:43 +02:00
Guy Zadikario
1ef706f96f emulator opengl: implement glGetString
Added rcGetGLString token to renderControl to query
a GL string constant from the current context from the host.
Implement glGetString functinality in EGL so that the string
value can be cached in the context structure and also
implementation can be shared between GLESv1 and GLESv2.

Also, fixed clientAPI context initialization check in
eglMakeCurrent. The check was for the previously bounded
context instead for the newly bounded context.

Change-Id: I41c0b4ad462c9ad5bd5c66719b41509bb1b7a947
2011-06-21 20:47:43 +02:00
Stas Gurtovoy
6a79e88f01 emulator opengl: pool of fixups to the system components.
Those fixes make the system load without failure.
Also the flinger and bootanimation are running.

Change-Id: Ieb7039e76c444df778a421a07bccc48514199245
2011-06-21 01:41:50 +03:00
Stas Gurtovoy
2220d27302 emulator opengl: added Bind texture to EGLImage/surface
added functionality to bind an EGLImage to a texture both
in the system and host sides.

Change-Id: I2dc26090b45da080ac4d0e8f5799c95f7cc54634
2011-06-21 01:41:50 +03:00
Stas Gurtovoy
a26f6f221b emulator opengl: Added glFinishRoundTrip to GLESv2
Change-Id: Ia1c6cb7e75a1769040d13e81d0da7db5f5c28435
2011-06-21 01:41:50 +03:00
Stas Gurtovoy
de40cd3cc8 emulator opengl: Small change to support more surface attributes
Change-Id: I14d630d50c8505dabcd065e6187bd6d6509c312b
2011-06-17 17:27:19 +03:00
Stas Gurtovoy
a6882bf79d emulator opengl: Added glFinishRoundTrip implementation.
This is to allow glFinish to wait for the host render to finish.

Change-Id: I43e23aee19700b79bc70c89e791df180c6c1fb91
2011-06-17 17:27:19 +03:00
Stas Gurtovoy
903945c963 emulator opengl: implemented getProcAddress in GLESv1.
Also changed emugen to generates gl_ftable.h needed for
getProcAddress implementation.
Added not_api attrib to emugen's gl.attrib to exclude from the
generated ftable.

Change-Id: I03786ea5d5a640bbcf5efccadca5bf2ec3e09fca
2011-06-17 17:27:15 +03:00
Stas Gurtovoy
d32c2d9633 emulator opengl: system GLESv1 first commit.
This is the first commit for the GLESv1 implementation.
It also includes needed fixes in emugen to support const types.
Also, changed glFinish definition in gl.in to match the
definition as in gl.h.

Change-Id: I90262a1db6035a90af8db17984acecef6499847a
2011-06-17 17:18:45 +03:00
Stas Gurtovoy
a7b7e95b03 emulator opengl: implement eglChooseConfig functionality.
Added new RenderControl command to request the host to execute
the ChooseConfig functionality.

Change-Id: Ib92be313a6df740de69d671c6994ec6cae17ea13
2011-06-11 00:16:21 +03:00
Stas Gurtovoy
33dc9add2a emulator opengl: some system egl fixes after a review.
Change-Id: I4a0c72319e8c69fba8ac00ed7bfff7667ae07269
2011-06-11 00:16:21 +03:00
Stas Gurtovoy
c36ac6ed2f emulator opengl: moved gralloc buffer handle struct to be shared.
We need to share the cb_hande_t between gralloc/EGL/GLES, moved it
into the opengl system common lib.
Also added eglSwapBuffers implementation.

Change-Id: Ia461a48c273af42293aafcf084e457adf03cbed3
2011-06-11 00:16:21 +03:00
Stas Gurtovoy
dd0a3777bc Handle egl context
Added EGLContext functionality to emulator's accelerated EGL implementation.

Change-Id: Idde7d701808839f8d89c6c081a9f3216bdea7a52
2011-06-11 00:16:20 +03:00
Stas Gurtovoy
8a8c601c4f emulator opengl: Create and destroy Surfaces
Also fixed link failure.

Change-Id: I4cbe28b2d51a5d4e48c4cba72df64f9df0898da5
2011-06-11 00:15:19 +03:00
Stas Gurtovoy
37db3deb7b First commit of the system egl implementation.
At this point system/egl should build without errors

Change-Id: Ieabae930fc20a8df4f3d68f179d685401e946e74
2011-06-09 21:24:26 +03:00
David 'Digit' Turner
892a6306e7 emulator: opengl: Use QEMU pipe.
This patch modifies the guest libraries to use the new
fast qemu "opengles" pipe to communicate with the host
renderer process.

Note that the renderer is still listening on a TCP socket
on port 22468.

Change-Id: I6ab84f972a8024e1fdababa4615d0650c8d461bf

Conflicts:

	tools/emulator/opengl/tests/gles_android_wrapper/Android.mk
	tools/emulator/opengl/tests/gles_android_wrapper/ServerConnection.h
2011-05-03 16:21:12 +02:00
Jacky Romano
59ad4dfd2b emulator opengl: handle NULL pointers
glTexImage[2,3]D and glBufferData properly handle NULL pointer
parameter

Change-Id: If799d41966b700b8fae3e7a68cac5b3a488b0146
2011-05-03 16:04:34 +02:00
Jacky Romano
0c814b227c emulator opengl - encode glShaderSource
glShaderSource strings are concatenated into a single string
before sent over the wire protocol. The wire protocol transfer is
done using a special api call 'glShaderString'

Change-Id: I90c157df66fe82fee17c460a1e7852d370c77088
2011-05-03 15:25:25 +02:00
Jacky Romano
68e7ee63f5 opengl emulator - handle shader string decoding
Shader strings are sent over the wire protocal as one concatenated
string. a special api call - glShaderString is used to handle the
encoding and decoding of this string.

Change-Id: Id682763f35e9fcc6215559931db2112a4fa981a9
2011-05-03 15:15:25 +02:00
Jacky Romano
318ffd3798 Emulator Opengl - adding preliminary version of GLESv2 encoder
This preliminary version includes the API definition, and the
GL2Encoder implementation class

Change-Id: I7ef9cfeb98c1e85097287ab26733825087368ee0
2011-05-03 14:54:03 +02:00
Jacky Romano
254492ffd6 Add GLESv2 functionality to GLESv1/GLESv2 shared code
Extends GLClientState to support additional state data
that is required by GLESv2. this includes:
* normalized flag in vertex attribute arrays
* getter for vertex attribute arrays state
* glParamSize now knows about the result size of GL2 parameters
* utility functions required for a GLESv2 encoder

Change-Id: I7e57d978bed5b8b929b918aee66c7f71dc5df3b1
2011-05-02 18:23:13 +03:00
Jacky Romano
3c2aa9b931 Move utility functions into glUtils
Move utility functions into glUtils so they can be shared
between GLESv1 and GLESv2 codecs.

Change-Id: I673b316395604e4288412e7ace328076812d4cc1
2011-05-02 18:23:13 +03:00
Liran
fb06a28c30 GLESv1 extensions
This fix adds support for OpenGLES 1.1 extensions in the codec
layer. This fix also includes bug fixes in GLEncoder (client-state)
and gles android wrapper modules.

Change-Id: I512649724d43e4af9d3ce5d49ae66d9f4da0b823
2011-04-28 09:24:46 +03:00