Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fef0451f authored by David Li's avatar David Li Committed by Android (Google) Code Review
Browse files

Merge "GLES2Dbg: added SETPROP expectResponse"

parents 3f9c90c1 ebcfe2d6
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -8,7 +8,6 @@ LOCAL_SRC_FILES := \
    src/debugger_message.pb.cpp \
    src/egl.cpp \
    src/server.cpp \
    src/texture.cpp \
    src/vertex.cpp

LOCAL_C_INCLUDES :=	\
+6 −7
Original line number Diff line number Diff line
@@ -31,11 +31,11 @@ def generate_api(lines):
    externs = []
    i = 0
    # these have been hand written
    skipFunctions = ["glTexImage2D", "glTexSubImage2D", "glReadPixels",
"glDrawArrays", "glDrawElements"]
    skipFunctions = ["glReadPixels", "glDrawArrays", "glDrawElements"]
    
    # these have an EXTEND_Debug_* macro for getting data
    extendFunctions = ["glCopyTexImage2D", "glCopyTexSubImage2D", "glShaderSource"]
    extendFunctions = ["glCopyTexImage2D", "glCopyTexSubImage2D", "glShaderSource",
"glTexImage2D", "glTexSubImage2D"]
    
    # these also needs to be forwarded to DbgContext
    contextFunctions = ["glUseProgram", "glEnableVertexAttribArray", "glDisableVertexAttribArray", 
@@ -67,8 +67,7 @@ def generate_api(lines):
                    externs.append(extern)
                
            print "%s Debug_%s(%s)\n{" % (returnType, functionName, RemoveAnnotation(parameterList))
            print """    glesv2debugger::Message msg;
    const bool expectResponse = false;"""
            print "    glesv2debugger::Message msg;"
    
            if parameterList == "void":
                parameters = []
@@ -159,8 +158,8 @@ def generate_api(lines):
                print getData
            if functionName in extendFunctions:
                print "    EXTEND_Debug_%s;" % (functionName) 
            print "    int * ret = MessageLoop(caller, msg, expectResponse,"
            print "                            glesv2debugger::Message_Function_%s);" % (functionName)
            print "    int * ret = MessageLoop(caller, msg, glesv2debugger::Message_Function_%s);"\
                % (functionName)
            if returnType != "void":
                if returnType == "GLboolean":
                    print "    return static_cast<GLboolean>(reinterpret_cast<int>(ret));"
+1 −0
Original line number Diff line number Diff line
@@ -134,6 +134,7 @@ message Message
    {
        Capture = 0; // arg0 = true | false
        TimeMode = 1; // arg0 = SYSTEM_TIME_* in utils/Timers.h
        ExpectResponse = 2; // arg0 = enum Function, arg1 = true/false
    };
    optional Prop prop = 21; // used with SETPROP, value in arg0
    optional float clock = 22; // wall clock in seconds
+225 −411

File changed.

Preview size limit exceeded, changes collapsed.

+22 −5
Original line number Diff line number Diff line
@@ -15,12 +15,18 @@
 */

#define EXTEND_Debug_glCopyTexImage2D \
    void * pixels = malloc(width * height * 4); \
    getGLTraceThreadSpecific()->gl.glReadPixels(x, y, width, height, GL_RGBA, GL_UNSIGNED_BYTE, pixels); \
    DbgContext * const dbg = getDbgContextThreadSpecific(); \
    const unsigned compressed = dbg->Compress(pixels, width * height * 4); \
    msg.set_data(dbg->lzf_buf, compressed); \
    free(pixels);
    GLint readFormat, readType; \
    dbg->hooks->gl.glGetIntegerv(GL_IMPLEMENTATION_COLOR_READ_FORMAT, &readFormat); \
    dbg->hooks->gl.glGetIntegerv(GL_IMPLEMENTATION_COLOR_READ_TYPE, &readType); \
    unsigned readSize = GetBytesPerPixel(readFormat, readType) * width * height; \
    void * readData = dbg->GetReadPixelsBuffer(readSize); \
    dbg->hooks->gl.glReadPixels(x, y, width, height, readFormat, readType, readData); \
    const unsigned compressedSize = dbg->CompressReadPixelBuffer(); \
    msg.set_data(dbg->lzf_buf, compressedSize); \
    msg.set_data_type(msg.ReferencedImage); \
    msg.set_pixel_format(readFormat); \
    msg.set_pixel_type(readType);

#define EXTEND_Debug_glCopyTexSubImage2D EXTEND_Debug_glCopyTexImage2D

@@ -31,3 +37,14 @@
            data->append(string[i]); \
        else \
            data->append(string[i], length[i]);

#define EXTEND_Debug_glTexImage2D \
    if (pixels) { \
        DbgContext * const dbg = getDbgContextThreadSpecific(); \
        const unsigned size = GetBytesPerPixel(format, type) * width * height; \
        assert(0 < size); \
        unsigned compressedSize = dbg->Compress(pixels, size); \
        msg.set_data(dbg->lzf_buf, compressedSize); \
    }

#define EXTEND_Debug_glTexSubImage2D EXTEND_Debug_glTexImage2D
Loading