Commit Graph

37 Commits

Author SHA1 Message Date
David 'Digit' Turner
3d76ec1e3c emulator: opengl: Add support for unix sockets.
This patch allows the OpenGLES rendering library to use Unix
sockets instead of TCP ones when communicating with its clients.
On certain benchmarks (e.g. 0xBench teapot), this provides a
noticeable improvement (x1.05 fps) without any other changes.

On practice, Unix sockets are faster than TCP sockets, even
local ones. Also, this introduces a moderate amount of
abstraction that will allow us to use Win32 named pipes
on Windows (where TCP sockets are much slower than they
are on Unix).

Note that by default, TCP streams are still used.
The client (emulator) must call the new API 'setStreamMode'
to change it to STREAM_MODE_UNIX between 'initLibrary' and
'startOpenglRenderer' calls.

+ Adjust callers / user appropriately.

Change-Id: I4105bbf07541f3146b50a58d1a5b51e8cf044fab
2011-09-13 14:03:32 +02:00
David 'Digit' Turner
47cbdfb291 emulator: opengl: remove debug traces.
You can still re-enable them by uncommenting one line in
development/tools/emulator/opengl/Android.mk

Change-Id: Ie0a640b6f3359b437aba40b124da0892defb00ef
2011-08-24 16:06:21 +02:00
David Turner
3ae6928d8d emulator opengles: improve TcpStream throughput
This patch improves the performance of the TcpStream implementation
on the host by disabling the Nagle algorithm, thus improving the
bandwidth of small packets.

When used with the corresponding change in the emulator, this
significantly improves the speed of OpenGLES emulation for many
applications.

Change-Id: Ic09e51ecddf04bc7d667f46e1d260030d5fcad88
2011-08-16 00:55:43 +02:00
Guy Zadickario
7944edcdb2 opengles emulator: fix the uniform location WAR for intel platforms
Fixed the location shift WAR to work for arrays that starts at
location 0. Fixed conformance regressions made by this workaround.
The conversion should be smarter than just shifting 16-bits back
and forth, it should take into account if array element is being
accessed.

Change-Id: Icb746c67e16edfacb8264a1e687fd24ac6e868e7
2011-08-11 17:36:03 +03:00
Liran
2ec2fa1a68 opengles emulator: fix uniform name translation to apps
add special handling of locations smaller or equal to 0
do not translate location -1 (this location means the
uniform is not found)

location 0 does not need translation, it has no effect

Change-Id: Idbde51f08433ed70a5a1a2cf1ede51043f3cca76
2011-08-10 11:00:10 +02:00
Guy Zadickario
52829d82ab opengles emulator: Workaround Cordy (Unity) bug with intel driver.
Uniform locations are 32-bit values which the application queries
from the driver after a shader program is linked. It seems that Cordy
game (possibly all Unity based apps) store the returned location as
16-bit value. Intel driver returns location values in the upper 16-bit
range :(
This is a workaround for this issue, when a program is linked we check
the locations of all uniforms, if all locations are within the upper
16-bit range (as with Intel driver) we shift the location value before
returning to the application. Also override all functions which take
a location parameter and do the reverse shift before sending a location
value to the host.

Change-Id: I234aaafe3313774b5da79eb1dac713b89b10ad60
2011-08-10 10:53:06 +02:00
Guy Zadickario
ded8587d2d opengles emulator: Fixed Windows renderer termination
Make the event pump loop in the renderer process we do on Windows
exit when the Framebuffer's subwindow is destroyed.
Fixed TcpStream to close the socket using 'closesocket' on windows,
otherwise the other end of the socket does not sense that the socket
is closed.

+ Use WS_DISABLED to ensure that our GL subwindow doesn't receive
  any input events.

Change-Id: Icb477b3e1d7993a8880acb5e01bc5da29309ae50
2011-08-10 10:11:13 +02:00
Liran
5018365268 opengles emulator: GLES memory leaks
fix some memory leaks detected in valgrind

Change-Id: I48d91223c520c9c10b797a89a679eed7a950a3e6
2011-08-10 10:08:05 +02:00
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
e993528d8e opengles emulator: fixing GL_HALF_FLOAT_OES bug
when calculating the data size to pack, the type GL_HALF_FLOAT_OES,
wasn't recognized at all and therefore was by default 0, while it
should be 2 bytes.

Change-Id: Ib1f0dcdb837dd1b9cfebd1090cabfb59de472c53
2011-08-09 17:38:48 +02:00
Liran
0a190be2bc opengles emulator: fix GLESv2 shader source packing
fix segfault when calling glShaderSouce with
empty shader string, length=NULL and count>0

Change-Id: I4c9738d7726fbce22d1e84420faa2bfd772943c5
2011-08-09 17:29:17 +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
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
Stas Gurtovoy
170eb97393 opengles renderer: added CHECK_GL_ERROR defie for gl debugging
This commit add CHECK_GL_ERROR define to decoders/renderer which enables various
glGetError() calls. Also changed emugen to add glGetError() after every dispatch call (based on
defintion of CHECK_GL_ERROR). Also cleaned some annoying printf's.
2011-07-03 15:21:48 +03:00
Amit Feller
87363ca283 opengl translator: Fix windows runtime problems
fixed functions calling conventions in dispatch tables,
added link flag to translator libraries to produce an alias
function for all exported functions with stdcall name mangling.

Change-Id: I4360f26da1f897764ba6d4dd02c365ed00420b51
2011-06-30 09:14:16 +03:00
Amit Feller
efcbbc3f28 emulator opengl: fix windows build
Change-Id: I145c7bf3a664fdb2c9e113cd977b4b2431d0668d
2011-06-30 09:14:16 +03:00
Guy Zadikario
a0b0d08e17 emulator opengl: fixed wrong delete
Solves a crash in Replica Island.

Change-Id: Id085cc2c88d0e3bdbf59f43882b7397b15ded05c
2011-06-25 16:56:08 +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
Stas Gurtovoy
5def410ff5 emulator opengl: more few fixups needed for the system to load.
Change-Id: I698b14d0f594c091c237a605aeefbb048bf746ca
2011-06-21 14:48:44 +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
Liran
da84d440c6 add gles2 extensions
implement extensions for gles2
add missing entry point for gles1 EGLImage extension

Change-Id: I7cf0118fdf69f3fb2a7023cf97134efd6aabbf59
2011-06-06 13:22:38 +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
a003fb6596 emulator opengl: missing constant in glUtilsParamSize
GL_MAX_TEXTURE_IMAGE_UNITS

Change-Id: I5cb5747fcb94fe919600f8f0f18e72fc2e94e51f
2011-05-03 16:02:58 +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
804809556d emulator opengl: typo caused the decoder to crash
embarrassing :-)

Change-Id: I4da948bba0cd16b6e8289c3c79e0daefb41f90e4
2011-05-03 14:54:04 +02:00
Jacky Romano
139308015e emulator Opengl - slight type change for GLESv2
Match the location type in the decoder context data to take
int locations rather then symbolic constants.

Change-Id: I353e43315c90dbeafe4820a3749a0d1cf0848d4b
2011-05-03 14:39:11 +02:00
Jacky Romano
68367ae969 emulator Opengl - number of supported vertex attributes
make the number of suppoted vertex attributes (by the codec)
common across the encoder and the decoder.

Change-Id: I699ef62821566cec0764982872adb92ebb8861e9
2011-05-03 14:38:29 +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
Guy Zadikario
1f0d3939ed emulatgor opengl: First commit of the host renderer library.
This is a library which includes all the OpenGL renderer functionality,
it is packaged in a library so that both the renderer process and the emulator
program will be able to use that functionality.

NOTES:
   1) gl_proc.h and GLDispatch.{h,cpp} in this commit will be replaced
      with the decoder auto-generated dispatch in a later commit, the
      auto-generated dispatch is currently missing some extension functions
      required for the renderer.
   2) look at host/include/libOpenglRender/render_api.h for the external
      interface defined for this library (to be used by the emulator).

The following is a description of each component:

FrameBuffer - The main object which manages the framebuffer and color buffers.
              This is a singleton which get initialized through its initialize
              static function. It initializes the OpenGL renderer and must be
              called first. This initialization function is not thread safe so
              it must be called before any thread that is calling to this
              library is created.

FBConfig - Includes a static set of configs supported by the renderer which get
           initialized during FrameBuffer initialization phase. Also,
           an instance of this class includes the a description of one frame
           buffer configuration supported by the renderer.

RenderContext - encapsulate a rendering context state.

ColorBuffer - implements a color buffer object as a texture which can be bind
              as render target or source.

WindowSurface - implements the functionality of a native window which can be
                bound to a rendering context and its target ColorBuffer can
                be specified and replaced.

ThreadInfo - holds per-thread information.

EGLDispatch - loads the EGL plugin library, all egl calls are made through
              this dispatch table which get initialized during initialization
              phase.

GLDispatch - loads the GLES plugin library, all GLES calls are made through
             this dispatch table which get initialized during initialization
             phase - This will be replaced by the auto-generated code of the
             decoder ...

RenderThread - implements a thread that reads command tokens from an IOStream
               and decode it.

RenderControl - implements the host side implementation of the renderControl
                API, when a renderControl token is decoded from the stream
                it is dispatched to this implementation.

RenderServer - implements a TCP server which listens to port number and
               launcges a RenderThread for each new connection.

Change-Id: I9f34d17bdfcb715893a13cd30086c767f499df87
2011-04-16 10:45:39 +03:00
David 'Digit' Turner
f85c358b27 Fix Mac build
Change-Id: I030c9903f073aced6c2778665f7961f3e9f9804d
2011-04-15 16:30:26 +02:00
Guy Zadikario
fc2d0b09ec emulator opengl: Added glUtilsPixelBitSize function to glUtils.
moved pixel size calculation from GLClientState to glUtils to be used
outside the client state scope. (needed for the renderControl encoder
which will follow in next commit).

Change-Id: I5adbc40b241537054c6743e2afc52ba44454664f
2011-04-13 13:33:26 +03:00
Guy Zadikario
caafd4df2e Moved IOStream.h to be used in external API for libOpenGLRender.
This change includes four changes:
1) moved IOStream.h into host/include/libOpenGLRender, this directory
   will include the api interface into the libOpenGLRender which will be
   used later by the emulator and we need this interface to use IOStream.h
2) Updated Andorid.mk files to include the new directory location of IOStream.h
   in the LOCAL_C_INCLUDE.
3) Added new function "read" to IOStream which reads a message without a givven
   size.
4) Updated TcpStream to use "cutils/sockets.h" instead of using directly the socket api for portability reasons. (It now compiles on windows as well).

Change-Id: I30eb40c8dcd5aacf0d993aff9cdb90b283b12dde
2011-04-13 13:33:05 +03:00
David 'Digit' Turner
45c722023d Really fix the Mac SDK build this time. Doh.
Change-Id: I529c42f89e752b245f76d7ea0d55ad6c676936b0
2011-04-05 17:23:55 +02:00
David 'Digit' Turner
c29456a000 Fix Mac sdk builds
Change-Id: Ia90be6b2ef10520ab2efb70fc03332a36e531ddc
2011-04-05 15:37:31 +02:00
Jacky Romano
81c015740c emulator opengl - directory rearrangment
Move system/OpenglCodecCommon into shared/OpenglCodecCommon so it's code
can be shared among more components of the project.

Move tests/ut_renderer/TimeUtils.* into a the common area

Annotate ErrLog.h and GLDecoderContextData.h with the project license statement

Change-Id: Ieea42e95edd5ad89fda4cfa40356a012304ee976
2011-04-04 12:20:49 +03:00