Commit graph

72 commits

Author SHA1 Message Date
Nigel Stewart
b1128f1a0c Reorganize Makefile build into a more modular scheme.
Cleanup of RegalDispatchTraceExclude.py for better clarity / TODO purposes.
2013-08-05 14:58:34 -05:00
Nigel Stewart
8969282b18 Add GL_ARB_multi_bind
Merge and harmonize src/apitrace with upstream
Merging Emscripten changes from Vladimir Vukicevic, except Makefile
More entry points for RegalDispatchGMock
2013-07-26 10:36:56 -05:00
Vladimir Vukicevic
97d0fd3f06 Update Makefiles to support Emscripten
- Use BIN.SUFFIX instead of BIN_EXTENSION for consistency
- Don't build static/shared lib if the filename isn't specified
- Examples should depend on static lib if shared isn't built
- Allow overriding release-mode defines for LOG/TLS
- Add SYSTEM=emscripten config
2013-07-24 15:30:42 -04:00
Nigel Stewart
b79468111a Initial integration of apitrace as Regal dispatch layer
http://apitrace.github.io/
Update current context only when MakeCurrent call succeeds
Check parsed ES version number
2013-07-21 23:51:29 -05:00
Nigel Stewart
47bbe699cd Add Regal support for GL_ANGLE_timer_query and GL_INTEL_map_texture
GLEW refresh to Sourceforge top-of-tree
Codegen refinement - sort enums by name for switch statements, etc
ARB_multitexture emulation for ES 2.0
(ARB|EXT)_texture_env_combine and (ARB|EXT)_texture_env_dot3 for ES 2.0
2013-07-17 16:40:10 -05:00
Nigel Stewart
0c089bf5bc DispatcherGlobal added for global (GLX/WGL/EGL) API dispatch layering.
Work-in-progress: apitrace dispatch layer for Regal, not enabled yet.
Added All.sln for VC10 purposes.
2013-06-05 23:06:03 -05:00
Nigel Stewart
21ad75c27b Revamp TLS (thread local storage) for storing more than context pointer per thread.
Add RegalPlugin private API for plugin dispatch layers to call back into Regal.
Resolve snappy library Windows compilation warnings.
Improvements for filtering emulation.
Support EXT_framebuffer_object on ES 2
2013-05-26 14:19:58 -05:00
Nigel Stewart
1f4c135d78 Add google snappy compression library sources, for apitrace purposes.
GLX: __GLXextFuncPtr
Code dispatch refinements.
Fixups for iOS XCode projects.
2013-05-22 18:42:49 -05:00
Sam Clegg
64d847d9e1 [NaCl] Add glibc support 2013-05-17 21:51:39 -07:00
Sam Clegg
1adc4b4207 Use CXX compiler for building C++ code.
Use CC as a fallback.
2013-04-25 18:40:46 -07:00
Sam Clegg
675b95b113 Build and run tests on NaCl 2013-03-29 15:52:02 -07:00
Nigel Stewart
ac07860107 RegalJson for parsing Config and Logging state from JSON
Added RegalConfigure Regal API
Refresh VC and XCode projects
Regal builds need jsonsl library now
2013-03-27 13:55:59 -05:00
Nigel Stewart
7d91dfed26 Regal::helper::getInfoLog for accessing various GL info logs.
Add regaltest test coverage for Regal::helper::size::get
Eliminate global/static data in RegalIff.cpp
GL_VERSION_1_2 enums that GLEW missed out on: GL_MAX_ELEMENTS_VERTICES, GL_MAX_ELEMENTS_INDICES
Add GL_SGIS_detail_texture enums to gl.py
Add GL_ARB_viewport_array enums to gl.py
Regal::Config string variables for code generation dispatch layers.
For RegalDispatchCode - name shader and program return variables, rather than generic o output.
Add extra cast through void* to avoid -Wcast-align warning
Fixups for glShaderSource support in RegalDispatchCode
2013-03-25 22:33:16 -05:00
Nigel Stewart
a1c1fc05ad Makefile build refinements for NaCl pepper25 - working for newlib only. 2013-03-18 13:36:43 -05:00
Sam Clegg
23244203d1 Enable -Werror for linux builds 2013-03-15 11:05:01 -07:00
Sam Clegg
9d88db9c6e Enable -Werror for nacl build 2013-03-15 11:05:01 -07:00
Sam Clegg
d951bb8d2f [NaCl] Add sanity checks to nacl-regal.sh
Update NaCl build in accordance with recent Makefile changes.
NaCl binaryes all live in the same folder and have architecutre
in thier filename.

Automatically create nmf file.

Add LOG_CC to Makefile.
2013-03-15 11:04:57 -07:00
Sam Clegg
91c718370b Makefile: Use immediate assignement when calculating SYSTEM
This makes null builds run with just "make" go from 4.6 seconds
to 73ms, since it only calls config.guess once.
2013-03-15 10:27:08 -07:00
Nigel Stewart
990380a9a7 Merge branch nacl_updates of https://github.com/sbc100/regal
Move zlib, libpng, GLU and GLUT source lists into build/foo.inc for Makefile build.
Move NACL_SDK_ROOT logic into config/Makefile.nacl
Makefile revamp - put libs in lib/$(SYSTEM) and binaries in bin/$(SYSTEM)
Add clobber target for wiping out all temps, libs and binaries
Fixups for core and compat profiles.
2013-03-14 14:10:07 -05:00
Nigel Stewart
68a81df576 Add Regal::Emu::Xfer ES2-only texture conversion emulation layer.
DXT1 and DXT5 via squishlib, disabled by default.
Per emulation layer force flag REGAL_FORCE_EMU_FOO for Regal::Config.
build/regal.inc for GNU make list of sources and headers.
Updated VC projects.
Extend RegalUtil.h to ensure that REGAL_NO_ASSERT, REGAL_NO_PNG, REGAL_NO_SQUISH, REGAL_NO_TLS are always defined - 0 or 1.
Update boost (subset) to 1.53.0 release.
2013-03-11 10:58:27 -05:00
Nigel Stewart
1ab8165ef4 Further emulation API filtering for core contexts.
Add Regal::Break::Filter for debugger breakpoints on filtered functions.
Mac XCode project updates.
Windows VC10 project updates.
2013-03-01 15:07:31 -06:00
Nigel Stewart
8fc3965ed5 Initial pass-through ES1 support.
Regal::Emu::So optimizations.
2013-02-21 17:54:27 -06:00
Nigel Stewart
77651c2580 Optional pointer logging for wgl API.
X11 window manager state logging support added.
Do not auto-detect REGAL_SYS_GLX if REGAL_SYS_X11=0.
GL api database corrections for GL_VERSION_x_y.
2013-02-08 20:44:08 -06:00
Lloyd Pique
2c3443e573 Implement RegalPpca
Add Push/PopClientAttribute emulation for Regal, allowing the full
OpenGL 4.3 compatability profile pixel and vertex array states to be
saved and restored.

These notes and the implementation are based on
glspec43.compatability.20120806.pdf, as well as
http://www.opengl.org/registry/specs/EXT/direct_state_access.txt

This is needed when running on top of a back-end which does not support it
(GLES2), when the caller is an more general OpenGL client.

Specifically, the state mentioned in Tables 23.4 - 23.8 identified as
"vertex array", and the state in Tables 23.34 and 23.35 identified as
"pixel-store" is what is saved and restored.

For the pixel store state, this was straightforward. For the vertex
array state, this was more involved than I initially expected, leading
to this rather large patch. Sorry.

I implemented this version with the following in mind:

  * The client state tracking should not constrain itself to the client
    state actually supported by the back-end. If the client for example
    calls glPixelStorei(GL_UNPACK_SWAP_BYTES, GL_TRUE), we record and
    attempt to restore this change in state even if the back-end is
    GLES2 which does not support it. If the client never makes this
    call, then we never attempt to touch this state on restore.

    It is assumed that for GLES2 and other similarly restrictive
    back-ends that some other emulation layer will handle it as needed.

  * Primarily this change is about implementing emulated versions of
    glPushClientAttrib and glPopClientAttrib. All "global" client state
    is tracked. Note that some calls would set state inside a Vertex
    Array Object if one is bound, and this code ignores those calls
    since that goes beyond what was needed. Also, while it implements
    glGet for the purposes of constraining certain attribute count
    limits and other maximums, it does not otherwise implement any
    real functionality to get the shadowed client state.

  * Beyond the compatability profile specification, I only handled the
    Direct State Access extension, as there was already the RegalDsa
    module present to emulate it. I pass the calls through after
    shadowing the state, but in restoring state, I went and made the
    more stateful calls without using that extension.

  * I did my best to track the spec properly. There are a few corner
    cases I did not properly handle.

      1. This code does not know what buffers and vertex array objects,
         etc. are properly allocated. The specification calls for the
         interface to not allow an unallocated named object to be bound,
         which should mean that this shadowing interface should ignore
         the attempt.

      2. Between the glBegin() / glEnd() call pair, calls other than
         those to set single vertex attributes should fail. The
         specification calls out a limited set of functions which might
         not (10.8.5, after the errors box).

      3. I was uncertain what to do if a state saved on the stack
         contained a named object that was deleted. While I check the
         current state, and effectively unbind, I did not do so for the
         state stack. Some similar handling might need to be done for
         bound objects stored inside a Vertex Array Object.

As I neared the end of the work on this patch, I strongly felt that the
following should really be done further down the line:

  * With this change, Regal now has much redundancy in code that tracks
    client state. I was really tempted to help clean this up, but I
    don't feel like I have the time.

    I feel like the emulation layer should implement one or more modules
    to shadow OpenGL state, which should be all they do. I could see
    making them configurable so that for example if vertex array state
    was not needed, no attempt would be made to shadow it.

    Other modules can then "require" this layer to work. RegalPpca would
    then just implement the state stacks, and the Push/pop
    functionality.

    I'm hoping at least that you will find my implementation at least a
    good starting point for this unification. I checked it numerous
    times.

  * In working through this patch, I looked briefly at the code in
    RegalIff, RegalVao, and RegalPpc (the last of which is not
    apparently used, and appeared to be the closest to what I wanted to
    do in this patch). I used them to cross check my version, but I did
    not directly use them as I felt each of them was incomplete (not
    implementing all the interfaces, not consistently checking for bad
    parameters, ...)

    There are still some differences to call out, which should be
    resolved at part of the unification:

      1. RegalVao implements Vertex Array Objects assuming the back-end
         does not. If vertex array state were unified, it would still
         perform this function.
      2. RegalIff includes some code to handle the having only
         8 vertex attributes, and also maps the fixed-function
         attributes into generic attribute entries. The mapping seemed
         wrong, so I did not do it, but I'm sure the 8 vertex attribute
         restriction is important for some platform. Integrating the
         state tracking done by this module would also seem like the
         most work involved in a unification effort.
      3. RegalPpc implements state query functionality, which RegalPpca
         does not.
2013-01-31 17:01:01 -08:00
Lloyd Pique
c0c20521a2 Implement glPopAttrib(GL_TRANFORM_BIT)
Extend the existing RegalPPa/RegalState functionality to add support for
saving and restoring the server side transform state.

Unlike the other emulated functionlity in RegalState, the code I added
does minimize the state transitions, which is especially a good idea if
the backend does not support certain state (such as clip planes) that
may not be actually set by the Regal client.

Extends the testRegalState test to fully cover the new state code. Adds
a quick test for the PushAttrib/PopAttrib calls.

Half of the fix for Regal Issue #27.
2013-01-16 14:16:16 -08:00
Lloyd Pique
e665896705 Bring in Google Mock
* Integrate Google Mock (at their trunk SVN revision 410 --
    http://code.google.com/p/googlemock/source/detail?r=410). Note only
    a subset of files are included (things like the LICENSE file, the include/
    directory, and the src/ directory)

  * Revise the build rules for libgtest. Just compile gmock-all.cc, and
    also compile gmock-all.cc to build a libgtest that includes both
    Google Test and Google Mock. Initially I had a separate library, but
    I didn't think it made sense to keep them separate.

  * Add a RegalDispatchGMock.py dispatch generator, which generates
    test/RegalDispatchGMock.cpp/.h, which in turn takes the C style
    functions used by the Regal dispatch table and turns them into calls on
    a Google Mock implementation. Modifies scripts/Export.py to know about
    a test source code directory, and to invoke the new code generator.

  * Add testRegalState.cpp which requires Google Mock work correctly, and
    which adds a simple test that Regal::State::Depth::Set() invokes
    the right series of calls in the dispatch layer in order to set a new
    depth state.

  * Remove the demonstrative test I added to tests/test_main.cpp, as there
    are now many tests and this one was not valuable beyond the "Google
    Test works" stage.

  * Fix the null build. `make` and then `make` immediately afterwards
    was rebuilding libraries since the libraries depended on the lib/
    subdirectory, but that directory ended up with a modification time
    later than that of the library, causing make to think it needed to
    build the library again on the next round. Likewise there were
    dependencies on bin/ for things that were then built into bin/.
    Rather than having a rule `bin: mkdir -p bin`, I modified other
    rules to do a `mkdir -p $(dir $@)` to ensure the destination
    directory existed before running the linker or archiver.

  * Fix a few other dependency issues I uncovered when doing `make clean
    && make -j20`, where some libraries were being used before being
    built.

Caveats -- Please read!

  1. Google Mock does quite a bit of code generation through its macros
     and templated implementation. RegalDispatchGMock.cpp can take
     minutes to compile, due to the size of the API. On my machine,
     the output .o file is a huge 24 megabyte binary.

  2. The incremental compile time is also unfortunately a bit large.
     Touching testRegalState.cpp means reading and expanding the macros
     in RegalDispatchMock.h, which takes tens of seconds to do.

     Unfortunately with the way that Google Mock interfaces are defined,
     there is no seperation of the mock interface from its
     implementation. All tests that include RegalDispatchMock.h will
     incur overhead in expanding macros and setting up class data for the
     full API.

  3. Google Mock by default only supports functions with at most ten
     arguments. There were a handful of functions that are larger than
     this in the dispatch interface. I chose to set up the code
     generator to silently ignore these calls rather than forwarding
     them to the generated mock interface.

     Google Mock contains a number of .pump files which define a default
     call arity of 10, and it is perfectly possible to invoke
     googletest/scripts/pump.py to regenerate these files to allow for a
     larger arity, but I felt that keeping the default for now was fine.

     Regal looks like it needs an arity of 15 if all functions are to be
     mocked.
2013-01-14 14:35:44 -08:00
Nigel Stewart
e5be2b031b VC10 projects for building regaltest.
Move Regal::Thread dependency from RegalPrivate.h to RegalContext.h
Add jsonsl to src tree, for parsing JSON data.
Extend boost::print to support pad(width) operator for indentation.
Info logging for shader caching.
Logging enhancement for texture parameter.
shaderSourceStrings - to NUL-terminated string.
Build regaltest as part of all Makefile target.
2013-01-04 14:08:55 -06:00
Nigel Stewart
eeca54dea1 Merge branch 'master' of git://github.com/techtonik/regal
make export - Export.py command-line has changed.
Makefile defaults to MODE=release
Texture parameter logging improvements.
boost::string_list support for splitting glShaderSource string arrays, with optional delimiter
Optional logging of pointers - REGAL_LOG_POINTERS=1 by default
Optional logging of thread, per line of log output - REGAL_LOG_THREAD=0 by default
In Init::context, avoid assertion if thread was previously associated with the context
Optional writing to shader cache - REGAL_CACHE_SHADER_WRITE=1 by default in debug mode
Initial test coverage added for boost::string_list
Add makePath utility function for joining a directory and filename.
2012-12-31 18:47:45 -06:00
anatoly techtonik
61849537d6 scripts: Outdir should contain src and includes. 2012-12-24 22:21:04 +03:00
Nigel Stewart
e668a3d80f Merged texture conversion emulation layer.
Logging refinements

Per-toolchain debug and release flags for Makefile build.

Regal sampler object refinements.

Logging refinements - REGAL_LOG_MAX_BYTES=n for limiiting raw bytes, REGAL_LOG_MAX_BYTES=0 to omit pointers.

Extend boost::print to support optional output.
2012-12-22 10:03:45 -06:00
Nigel Stewart
4320059302 Merge from git://github.com/adhoc-bobcat/regal.git gles2_texture_conversions - some conflicts resolved manually. 2012-12-20 12:00:10 -06:00
Lloyd Pique
f7793586a8 Implement a Texture Conversion Emulation recipe
A patch for issue #31.

Under an GLES2 API (and specifically Pepper implementation of GLES2),
calls to glTexSubImage2D may be required to use a type and format for
the new data that matches the underlying texture type/format, so that
the GLES2 implementation is a simple, straight copy of the data.

This means that in order for Regal to emulate the less strict OpenGL
interface, it must perform texture format conversions when calling a
GLES2 backend.

This patch adds such an emulation recipe, that:

1) Shadows the state of textures, so that Regal knows the underlying
formats, and
2) On a call to glTexSubImage2D, if the caller is passing something that
doesn't match the underlying texture format, Regal will handle the
conversion.

This patch makes a few assumptions that may need to be relaxed with
further changes:

* Only OpenGLES 2.0 compatible texture types and formats are supported.
  GL_BGRA and GL_UNSIGNED_BYTE_3_2_2 for example, while easy to add, are
  not. Other more general OpenGL formats could be added to, with a bit
  more work.
* As per the GLES2.x spec, only GL_UNPACK_ALIGNMENT is assumed to be
  relevant.
* To avoid a combinatorial explosion, all texture conversions are too
  and from a simple GL_RGBA, GL_UNSIGNED_BYTE intermedate format.
2012-12-19 13:34:36 -08:00
Nigel Stewart
23dfaeec15 RegalDispatchCode for direct C code output - initial implementation.
RegalSo optimizations.
Merged GLX/EGL and GL/GLES entry-point loading for Linux.  x86, x86_64 and ARM.
GLenum to string conversion refinements, prefer non-extension, ARB, KHR and so on.
GL spec database entries for maxSize of input parameters.  (vs output size)
2012-12-16 11:16:12 -06:00
Nigel Stewart
ef137d3953 Logging refinements
REGAL_SYS_FOO variables are always defined. (0 or 1)
Initialization refinement for EGL - EmuInit.py added.
Regal::Config support for EGL and GLX at runtime.
Complete list of extensions in Regal::ContextInfo
REGAL_LOG_ONCE for logging warnings and errors once only
Sampler object emulation refinements.
2012-12-12 08:17:22 -06:00
Nigel Stewart
0dbaa1c8ab Merge pull request #33 from adhoc-bobcat/master
Add Google Test unit testing framework.
2012-12-12 06:13:30 -08:00
Lloyd Pique
47f7086c39 Add a unit testing framework.
Add the head version of GoogleTest (using
https://git.chromium.org/git/external/googletest.git), with a version
equivalent to Subversion change #625. Note that I've trimmed out some
parts of the tree that aren't directly related to building a working
library (such as their self-tests), but I preserved the special files in
the root directory of the project (such as LICENSE).

Modifies the Makefile to build "lib/libgtest.a" from the Google Test sources.

Adds a tests/ subdirectory for Regal tests. Adds a test_main.cpp file,
which will run all the tests, and contains a trivial test for
verification.

Modifies the Makefile to build and run "bin/RegalTests" from the
tests/ source code if "make tests" is run. The tests however are not
built/run by the "make all"
2012-12-07 17:46:28 -08:00
Nigel Stewart
067e24bf16 Initial implementation of sampler object emulation.
Further logging refinements.
Redbook example programs.
2012-12-07 19:21:24 -06:00
Igor Chernyshev
2c1c9cf539 Rename NACL to PPAPI in GL-related contexts.
PPAPI is an API which contains GLES2 calls. The Chrome plugin,
on the other hand, could be NaCl-based or Trusted (for Windows,
Linux and perhaps Mac). So, the API name (PPAPI in our case)
is somewhat orthogonal to the target platform.

See https://github.com/p3/regal/pull/30
2012-12-06 16:50:49 -08:00
Nigel Stewart
43bac83529 GLSL shader caching to disk.
Application-side shaders in Regal.cpp via EmuCache.py
Driver-side shaders via RegalDispatchCache.cpp
Regal::Config support for shader chaching and readback.
REGAL_CACHE=1 global enable/disable of caching in general.
REGAL_CACHE_SHADER=1 enable/disable of shader caching (GLSL only, so far).
REGAL_CACHE_SHADER_READ=1 enable/disable readback from disk cache.
REGAL_CACHE_DIRECTORY directory for caching shaders.
Additional documentation for Regal logging.
For glUseProgram also log glGetAttachedShaders, if applicable.
Fixup for driver logging dispatch - log contents of output parameters too.
Consolidate driver logging dispatch to one line per call, including return value.
2012-12-04 12:11:25 -06:00
Nigel Stewart
fcf8e606de For Makefile build, specify MODE=debug for debug-mode build.
Fixup: exit glFrameTerminatorGREMEDY appropriately whether Regal::Frame is in use, or not.
Use -O1 for linux-arm Makefile build, to workaround goofy assembler error.
Fixes for Regal extensions handling.
eglGetProcAddress fix.
Improved EGL logging.
2012-11-29 11:03:15 -06:00
Nigel Stewart
fab8906ef3 Initial import of EGL extensions from opengl.org via GLEW.
Makefile support for CFLAGS on gmake command line.

Better handling of lib and bin dependencies.
GetProcAddress implementation for REGAL_SYS_GLX && REGAL_SYS_EGL - both GL ES and EGL.
2012-11-27 12:24:52 -06:00
Nigel Stewart
ec8dc4919f Fixup for 64-bit NaCL Makefile build.
Mac build fixes.
For Regal::Dispatcher cache size() and front() to avoid the mess of calling into STL.
2012-11-19 16:50:04 -06:00
Sam Clegg
589b4a3ced rename Makefile nacl target 2012-11-16 16:15:47 -08:00
Sam Clegg
77a1eb00bb Add nmf generation to Makefile
Also, fix file suffix for nacl builds.
2012-11-16 16:15:39 -08:00
Sam Clegg
a03190055d fix dependancies for nacl examples to make -j works 2012-11-15 16:32:05 -08:00
Sam Clegg
304f27eeb9 merge Makefile.nacl into Makefile 2012-11-15 16:19:59 -08:00
Nigel Stewart
79f4316f0e Consolidate frame hashing and capture into Regal::Frame
Add support to use glXSwapBuffers for frame counting
Support for wglSwapBuffers, eglSwapBuffers and CGLFlushDrawable too
VC and XCode project updates
Bug fix for Init::destroyContext, set TLS for NULL context, as necessary
2012-11-15 13:47:18 -06:00
Nigel Stewart
bb2967cdbc Destroy the regal context via glXDestroyContext etc.
-DHAVE_UNISTD_H for NaCL too - Makefile build.
2012-11-13 11:04:51 -06:00
Nigel Stewart
72d2b6fb55 Fixup for RegalInit.cpp 2012-11-08 11:34:37 -06:00
Nigel Stewart
a79fb8519e Add configuration for Linux ARM Makefile build.
Reshuffle of RegalInit.cpp to distinguish Regal API entry points and internally available methods.
Rename GET_REGAL_CONTEXT macro to REGAL_GET_CONTEXT, and move from RegalPrivate.h to RegalThread.h
Rename RegalCheckForGLErrors to Regal::Init::checkForGLErrors.
2012-11-08 08:58:41 -06:00