Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
f576c59
Fumbling toward a transformation on CoronaTotalTime, so far the comma…
ggcrunchy Feb 7, 2019
6626191
Moved some of the time transform stuff into ShaderResource with link …
ggcrunchy Feb 8, 2019
e59f04a
Better argument checking for time transforms
ggcrunchy Feb 9, 2019
e05f972
Whoops, wasn't always linking Program back to ShaderResource
ggcrunchy Feb 10, 2019
c7af750
Removed notes to self about changes
ggcrunchy Feb 11, 2019
9058c1f
timeTransform ignored if no time dependency
ggcrunchy Feb 11, 2019
c01d916
Minor changes
ggcrunchy May 29, 2020
08dc3b6
Maintenance Revert Test
scottrules44 Sep 20, 2021
05b91fb
Simulator: Adding Samsung Galaxy 21 as a skin
scottrules44 Sep 22, 2021
f44be24
Maintenance
scottrules44 Sep 22, 2021
581d844
Android: adding rest of media intents for Android 11
scottrules44 Sep 22, 2021
265be3c
Merge
ggcrunchy Sep 23, 2021
e217c80
Merge
ggcrunchy Oct 4, 2021
ca300c1
Merge branch 'master' of https://github.com/coronalabs/corona
ggcrunchy Oct 19, 2021
0b5e1e9
First go at graphics.undefineEffect()
ggcrunchy Nov 9, 2021
b41e624
Revert "First go at graphics.undefineEffect()"
ggcrunchy Nov 10, 2021
5be6193
Merging upstream
ggcrunchy Aug 18, 2022
f38ecec
Merge branch 'master' of https://github.com/ggcrunchy/corona
ggcrunchy Aug 18, 2022
bb395b8
Merge branch 'master' of https://github.com/coronalabs/corona
ggcrunchy Dec 16, 2022
0bf47a5
Merge remote-tracking branch 'upstream/master'
ggcrunchy Jun 12, 2025
27ad840
Merge branch 'master' of https://github.com/coronalabs/corona
ggcrunchy May 4, 2026
6b59610
Merge branch 'master' of https://github.com/coronalabs/corona into GP…
ggcrunchy May 4, 2026
5b1a4c7
Disabled some seemingly dead code (offscreen GPU surfaces)
ggcrunchy May 5, 2026
8c2ea26
glActiveTexture() and glClientActiveTexture() were still getting drag…
ggcrunchy May 6, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions librtt/Renderer/Rtt_FrameBufferObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
namespace Rtt
{

class BufferBitmap;
class Texture;

// ----------------------------------------------------------------------------
Expand All @@ -42,6 +43,8 @@ class FrameBufferObject : public CPUResource
U8 GetDepthBits() const { return fDepthBits; }
U8 GetStencilBits() const { return fStencilBits; }
bool GetMustClear() const { return fMustClear; }

static void Capture( BufferBitmap& bitmap, S32 x_in_pixels, S32 y_in_pixels, S32 w_in_pixels, S32 h_in_pixels );

private:
Texture* fTexture;
Expand Down
113 changes: 112 additions & 1 deletion librtt/Renderer/Rtt_GLFrameBufferObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
#include <cstring>
#include "Rtt_Profiling.h"

#include "Display/Rtt_BufferBitmap.h"

// ----------------------------------------------------------------------------

#define ENABLE_DEBUG_PRINT 0
Expand Down Expand Up @@ -272,8 +274,117 @@ GLFrameBufferObject::Blit( int srcX0, int srcY0, int srcX1, int srcY1, int dstX0
sBlitFramebuffer( srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter );
}

static GLenum
GPU_GetPixelFormat( PlatformBitmap::Format format )
{
# ifdef Rtt_OPENGLES

switch ( format )
{
case PlatformBitmap::kRGBA:
return GL_RGBA;
case PlatformBitmap::kMask:
return GL_ALPHA;
case PlatformBitmap::kRGB:
case PlatformBitmap::kBGRA:
case PlatformBitmap::kARGB:
default:
Rtt_ASSERT_NOT_IMPLEMENTED();
return GL_ALPHA;
}

# else // Not Rtt_OPENGLES.

switch ( format )
{
case PlatformBitmap::kBGRA:
case PlatformBitmap::kARGB:
return GL_BGRA;
case PlatformBitmap::kRGBA:
return GL_RGBA;
case PlatformBitmap::kRGB:
return GL_BGR;
case PlatformBitmap::kMask:
return GL_ALPHA;
default:
Rtt_ASSERT_NOT_IMPLEMENTED();
return GL_ALPHA;
}

# endif // Rtt_OPENGLES
}

static GLenum
GPU_GetPixelType( PlatformBitmap::Format format )
{
# ifdef Rtt_OPENGLES

switch( format )
{
case PlatformBitmap::kMask:
return GL_UNSIGNED_BYTE;
case PlatformBitmap::kBGRA:
case PlatformBitmap::kARGB:
case PlatformBitmap::kRGBA:
default:
Rtt_ASSERT_NOT_IMPLEMENTED();
return GL_UNSIGNED_BYTE;
}

# else // Not Rtt_OPENGLES.

switch( format )
{
case PlatformBitmap::kBGRA:
#ifdef Rtt_BIG_ENDIAN
return GL_UNSIGNED_INT_8_8_8_8_REV;
#else
return GL_UNSIGNED_INT_8_8_8_8;
#endif
case PlatformBitmap::kARGB:
#ifdef Rtt_BIG_ENDIAN
return GL_UNSIGNED_INT_8_8_8_8;
#else
return GL_UNSIGNED_INT_8_8_8_8_REV;
#endif
case PlatformBitmap::kRGBA:
#ifdef Rtt_BIG_ENDIAN
return GL_UNSIGNED_INT_8_8_8_8_REV;
#else
return GL_UNSIGNED_INT_8_8_8_8;
#endif
case PlatformBitmap::kMask:
return GL_UNSIGNED_BYTE;
default:
Rtt_ASSERT_NOT_IMPLEMENTED();
return GL_UNSIGNED_BYTE;
}

# endif // Rtt_OPENGLES
}

void FrameBufferObject::Capture( BufferBitmap& bitmap, S32 x_in_pixels, S32 y_in_pixels, S32 w_in_pixels, S32 h_in_pixels )
{
#ifdef Rtt_OPENGLES
const GLenum kFormat = GL_RGBA;
const GLenum kType = GL_UNSIGNED_BYTE;
#else
PlatformBitmap::Format format = bitmap.GetFormat();
const GLenum kFormat = GPU_GetPixelFormat( format );
GLenum kType = GPU_GetPixelType( format );
#endif

glReadPixels( x_in_pixels,
y_in_pixels,
w_in_pixels,
h_in_pixels,
kFormat,
kType,
bitmap.WriteAccess() );
}

// ----------------------------------------------------------------------------

} // namespace Rtt

// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
3 changes: 3 additions & 0 deletions librtt/Renderer/Rtt_Renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -300,11 +300,14 @@ Renderer::BeginDrawing()
void
Renderer::CaptureFrameBuffer( RenderingStream & stream, BufferBitmap & bitmap, S32 x_in_pixels, S32 y_in_pixels, S32 w_in_pixels, S32 h_in_pixels )
{
/*
stream.CaptureFrameBuffer( bitmap,
x_in_pixels,
y_in_pixels,
w_in_pixels,
h_in_pixels );
*/
FrameBufferObject::Capture(bitmap, x_in_pixels, y_in_pixels, w_in_pixels, h_in_pixels);
}

void
Expand Down
4 changes: 4 additions & 0 deletions librtt/Rtt_GPU.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,10 @@ class GPU
#define GPUError() do {} while(0)
#endif

#ifdef OLD_GRAPHICS
#error Details now moved to non-librtt code (tachyon)
#endif

// ----------------------------------------------------------------------------

} // namespace Rtt
Expand Down
19 changes: 17 additions & 2 deletions librtt/Rtt_GPUStream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include "Display/Rtt_VertexCache.h"
#include "Renderer/Rtt_RenderTypes.h"

#if defined( Rtt_WIN_DESKTOP_ENV ) && !defined( Rtt_POWERVR_ENV )
#if defined( OLD_GRAPHICS ) && defined( Rtt_WIN_DESKTOP_ENV ) && !defined( Rtt_POWERVR_ENV )
#if defined(Rtt_EMSCRIPTEN_ENV)
#include <GL/glew.h>
#elif defined(Rtt_LINUX_ENV)
Expand Down Expand Up @@ -140,6 +140,8 @@ GLModeForMode( RenderTypes::Mode mode )
#endif
// ----------------------------------------------------------------------------

#ifdef OLD_GRAPHICS

int
GPUStream::GetMaxTextureUnits()
{
Expand All @@ -161,16 +163,22 @@ GPUStream::GetMaxTextureUnits()
static const GLenum kDataType = GL_FLOAT;
#endif

#endif

#ifdef Rtt_DEBUG
static int sTextureStackSize = -1;
#endif

#ifdef OLD_GRAPHICS

GLenum
GPUStream::GetDataType()
{
return kDataType;
}

#endif

GPUStream::GPUStream( Rtt_Allocator* pAllocator )
: Super(),
fCurrentPaint( NULL ),
Expand Down Expand Up @@ -200,7 +208,7 @@ GPUStream::GPUStream( Rtt_Allocator* pAllocator )
{
memset( & fColor, 0xFF, sizeof( fColor ) );

#if defined( Rtt_WIN_DESKTOP_ENV ) && !defined( Rtt_POWERVR_ENV )
#if defined( OLD_GRAPHICS ) && defined( Rtt_WIN_DESKTOP_ENV ) && !defined( Rtt_POWERVR_ENV )
if ( glActiveTexture == NULL ) {
glActiveTexture = (PFNGLACTIVETEXTUREPROC) wglGetProcAddress("glActiveTexture");
glClientActiveTexture = (PFNGLCLIENTACTIVETEXTUREPROC) wglGetProcAddress("glClientActiveTexture");
Expand Down Expand Up @@ -1373,6 +1381,8 @@ GPUStream::SetAlpha( U8 newValue, bool accumuluate )
return result;
}

#ifdef OLD_GRAPHICS

GLenum
GPU_GetPixelFormat( PlatformBitmap::Format format )
{
Expand Down Expand Up @@ -1462,10 +1472,14 @@ GPU_GetPixelType( PlatformBitmap::Format format )
# endif // Rtt_OPENGLES
}

#endif

// Performs a screen capture and outputs the image to the given "outBuffer" bitmap.
void
GPUStream::CaptureFrameBuffer( BufferBitmap& outBuffer, S32 xScreen, S32 yScreen, S32 wScreen, S32 hScreen )
{
#ifdef OLD_GRAPHICS /* details moved to Rtt_FrameBufferObject / Rtt_GLFrameBufferObject */

// GLint x = Rtt_RealToInt( bounds.xMin );
// GLint y = Rtt_RealToInt( bounds.yMin );
// GLint w = Rtt_RealToInt( bounds.xMax ) - x;
Expand All @@ -1486,6 +1500,7 @@ GPUStream::CaptureFrameBuffer( BufferBitmap& outBuffer, S32 xScreen, S32 yScreen
kFormat,
kType,
outBuffer.WriteAccess() );
#endif
}

void
Expand Down
26 changes: 19 additions & 7 deletions librtt/Rtt_GPUStream.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include "Rtt_RenderingStream.h"

#include "Display/Rtt_Paint.h"
#include "Rtt_GPU.h"
/* #include "Rtt_GPU.h" */ // TODO: created annoying dependencies, and seemed to be mostly dead code (probably safe to remove)

#if defined( Rtt_AUTHORING_SIMULATOR ) || defined( Rtt_ANDROID_ENV )
#define RTT_SURFACE_ROTATION
Expand Down Expand Up @@ -48,12 +48,16 @@ class GPUStream : public RenderingStream
kMaxTextureStackDepth = 32
};

#ifdef OLD_GRAPHICS

public:
static int GetMaxTextureUnits();

public:
static GLenum GetDataType();

#endif

public:
GPUStream( Rtt_Allocator* );
virtual ~GPUStream();
Expand Down Expand Up @@ -176,8 +180,16 @@ class GPUStream : public RenderingStream
TextureStackFrame fTextureStack[kMaxTextureStackDepth];

private:
GLint fWindowWidth;
GLint fWindowHeight;
#ifdef OLD_GRAPHICS /* window dimensions and clear components; the old versions drag in GL dependencies */
typedef GLint wdInt;
typedef GLclampf ccFloat;
#else
typedef int wdInt;
typedef float ccFloat;
#endif

wdInt fWindowWidth;
wdInt fWindowHeight;
S32 fRenderedContentWidth; // width of rect in which content is rendered (not necessarily same as content width)
S32 fRenderedContentHeight; // height of rect in which content is rendered (not necessarily same as content height)

Expand All @@ -196,10 +208,10 @@ class GPUStream : public RenderingStream
TextureFunction fTextureFunction;

// Clear color
GLclampf fClearR;
GLclampf fClearG;
GLclampf fClearB;
GLclampf fClearA;
ccFloat fClearR;
ccFloat fClearG;
ccFloat fClearB;
ccFloat fClearA;

protected:
Rtt_Allocator* fAllocator;
Expand Down
2 changes: 1 addition & 1 deletion librtt/Rtt_LuaLibSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include "Rtt_MPlatformDevice.h"

#include "Rtt_Runtime.h"
#include "Rtt_GPU.h"
/* #include "Rtt_GPU.h" */ // TODO: created annoying dependencies, and seemed to be mostly dead code (probably safe to remove)
#include "Rtt_GPUStream.h"
#include "Rtt_PhysicsWorld.h"
#include "Rtt_PlatformInAppStore.h"
Expand Down
4 changes: 3 additions & 1 deletion librtt/Rtt_PlatformSurface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,9 @@ PlatformSurface::SetDelegate( PlatformSurfaceDelegate* delegate )
// ----------------------------------------------------------------------------

// TODO: Replace platform ifdef's with a feature ifdef: Rtt_OFFSCREEN_SURFACE in Rtt_Config.h
#if ! defined( Rtt_ANDROID_ENV ) && !defined( Rtt_WIN_ENV ) && !defined( Rtt_EMSCRIPTEN_ENV ) && !defined( Rtt_NXS_ENV )
// TODO (follow-up): seems to be dead code; probably can be removed altogether
#if defined( OLD_GRAPHICS ) && \
! defined( Rtt_ANDROID_ENV ) && !defined( Rtt_WIN_ENV ) && !defined( Rtt_EMSCRIPTEN_ENV ) && !defined( Rtt_NXS_ENV )

OffscreenGPUSurface::OffscreenGPUSurface( const PlatformSurface& parent )
: fWidth( parent.Width() ),
Expand Down
7 changes: 5 additions & 2 deletions librtt/Rtt_PlatformSurface.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,16 +92,19 @@ class PlatformSurface
// ----------------------------------------------------------------------------

// TODO: Remove this when OffscreenGPUSurface is moved to a separate file
#include "Rtt_GPU.h"
// TODO (follow-up): was dead code anyway?
/* #include "Rtt_GPU.h" */

namespace Rtt
{

// ----------------------------------------------------------------------------

#if ! defined( Rtt_ANDROID_ENV ) && ! defined( Rtt_EMSCRIPTEN_ENV )
#if defined( OLD_GRAPHICS) && \
! defined( Rtt_ANDROID_ENV ) && ! defined( Rtt_EMSCRIPTEN_ENV )

// TODO: Move to a separate file
// TODO (follow-up): seems to be dead code; probably can be removed altogether
// GPU-specific
class OffscreenGPUSurface : public PlatformSurface
{
Expand Down
2 changes: 1 addition & 1 deletion platform/apple/Rtt_ApplePlatform.mm
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,7 @@ - (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)err
PlatformSurface*
ApplePlatform::CreateOffscreenSurface( const PlatformSurface& parent ) const
{
#ifdef Rtt_NO_GUI
#if defined( Rtt_NO_GUI ) || !defined( OLD_GRAPHICS ) // n.b. seems to be dead code
return NULL;
#else
OffscreenGPUSurface *result = Rtt_NEW( Allocator(), OffscreenGPUSurface( parent ) );
Expand Down