Qt 4.8
Macros | Typedefs | Functions
main.cpp File Reference
#include <QtCore/qdebug.h>
#include "../../gl2paintengineex/qglshadercache_meego_p.h"
#include <stdlib.h>
#include <stdio.h>

Go to the source code of this file.

Macros

#define QT_BOOTSTRAPPED
 
#define QT_DEBUG_SHADER_CACHE
 
#define QT_MEEGO_EXPERIMENTAL_SHADERCACHE
 
#define QT_OPENGL_ES_2
 

Typedefs

typedef unsigned int GLenum
 
typedef int GLsizei
 

Functions

int main ()
 

Macro Definition Documentation

◆ QT_BOOTSTRAPPED

#define QT_BOOTSTRAPPED

Definition at line 47 of file main.cpp.

◆ QT_DEBUG_SHADER_CACHE

#define QT_DEBUG_SHADER_CACHE

Definition at line 44 of file main.cpp.

◆ QT_MEEGO_EXPERIMENTAL_SHADERCACHE

#define QT_MEEGO_EXPERIMENTAL_SHADERCACHE

Definition at line 45 of file main.cpp.

◆ QT_OPENGL_ES_2

#define QT_OPENGL_ES_2

Definition at line 46 of file main.cpp.

Typedef Documentation

◆ GLenum

typedef unsigned int GLenum

Definition at line 50 of file main.cpp.

◆ GLsizei

typedef int GLsizei

Definition at line 49 of file main.cpp.

Function Documentation

◆ main()

int main ( )

Definition at line 57 of file main.cpp.

58 {
59  ShaderCacheSharedMemory shm;
60 
61  if (!shm.isAttached()) {
62  fprintf(stderr, "Unable to attach to shared memory\n");
63  return EXIT_FAILURE;
64  }
65 
66  ShaderCacheLocker locker(&shm);
67  if (!locker.isLocked()) {
68  fprintf(stderr, "Unable to lock shared memory\n");
69  return EXIT_FAILURE;
70  }
71 
72  void *data = shm.data();
73  Q_ASSERT(data);
74 
75  CachedShaders *cache = reinterpret_cast<CachedShaders *>(data);
76 
77  for (int i = 0; i < cache->shaderCount; ++i) {
78  printf("Shader %d: %d bytes\n", i, cache->headers[i].size);
79  }
80 
81  printf("\nSummary:\n\n"
82  " Amount of cached shaders: %d\n"
83  " Bytes used: %d\n"
84  " Bytes available: %d\n",
85  cache->shaderCount, cache->dataSize, cache->availableSize());
86 
87  return EXIT_SUCCESS;
88 }
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
static const char * data(const QByteArray &arr)