Commit graph

6 commits

Author SHA1 Message Date
Sam Clegg
5a0772573f Fix warnings 2013-03-29 15:36:43 -07:00
Lloyd Pique
9d8f6bdc95 Cleanups and fixes to PixelConversions
Fixes:

  I had the bad luck of testing this change originally with a brightly
  colored abstract block game, and I didn't noticed that the red and
  blue channels were swapped. I tracked it down to a confusion on my
  part about the order of the packed components in each integer, and how
  it worked for bit-packed and non-bit-packed forms.

  This quick fix is to just swap around masks for the Red and Blue
  components for the packed-pixel types (such as
  GL_UNSIGNED_SHORT_5_6_5), and adjust the corresponding tests to go
  along with it.

  This looks inconsistent with the surrounding declarations, as the
  bit-packed forms say that red (or at least the first component) is in
  the highest bits, while the non-bit-packed forms seem to say that red
  is in the lowest bits. Both however are correct due to the way the
  values are read out of memory.

  I spent an extra day trying to make this consistent, and also
  properly handle endian swapping. However I got bogged down in the
  clean up, and I ran out of time to do it for now. I left some comments
  around it in the code, and I'll keep my work in progress patch, but I
  won't have time in the near future to do anything on it.

  Along the way, I also noticed that the intensity-alpha format
  specification was using the first byte for both values, instead of
  using the second byte for alpha as it was supposed to.

Cleanups:

  * I removed some dead declarations that I left behind before submitting.
    I had meant to take them out, and missed them.

  * I added some comments to document the RegalPixelConversions header.

  * Removed a TODO comment around using memcpy when dealing with
    conversions of <GL_RGBA, GL_UNSIGNED_BYTE> to/from the intermediate
    format. There is an opportunity to use a memcpy for some formats,
    but for the format I called out it may not be possible (depends on
    endian).
2013-03-05 17:05:20 -08:00
Nigel Stewart
7e6ab781e5 Prune back RegalDispatchGMock interface for better build turn-around time.
Refresh GLEW sources.
Add freeglut sources.
Logging refinements for glPush/PopMatrix and display list compilation.
boost::print::string_list::pop_front and pop_back added.
Utility function for loading a file into a std::string added.
Refresh VC10 projects for regaltest purposes.
2013-01-18 09:43:09 -06:00
Nigel Stewart
59ccca97ee Rename Regal::RegalTexC to Regal::Emu::TexC
RegalSo sRGB support for ES 2.0
Add support for masking the buffer bits used for MD5 hashing purposes
RegalSo fixes and optimizations.
Helper functions for pixel components and bytes per component.
2013-01-09 21:55:57 -06: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
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