A lot of buildfixes

This commit is contained in:
Henrik Rydgard 2017-02-06 11:55:54 +01:00
parent be557fc323
commit 55aa879216
12 changed files with 41 additions and 29 deletions

View File

@ -1082,8 +1082,6 @@ endif()
set(GPU_GLES
GPU/GLES/DepalettizeShaderGLES.cpp
GPU/GLES/DepalettizeShaderGLES.h
GPU/GLES/FBO.cpp
GPU/GLES/FBO.h
GPU/GLES/GPU_GLES.cpp
GPU/GLES/GPU_GLES.h
GPU/GLES/FragmentShaderGeneratorGLES.cpp

View File

@ -21,7 +21,7 @@
#include "profiler/profiler.h"
#include "gfx_es2/glsl_program.h"
#include "native/thin3d/thin3d.h"
#include "thin3d/thin3d.h"
#include "base/timeutil.h"
#include "math/lin/matrix4x4.h"

View File

@ -35,6 +35,9 @@ public:
GPUCommon(GraphicsContext *gfxCtx, Draw::DrawContext *draw);
virtual ~GPUCommon();
Draw::DrawContext *GetDrawContext() override {
return draw_;
}
void Reinitialize() override;
void BeginHostFrame() override;

View File

@ -204,12 +204,18 @@ struct GPUEvent {
}
};
namespace Draw {
class DrawContext;
}
class GPUInterface {
public:
virtual ~GPUInterface() {}
static const int DisplayListMaxCount = 64;
virtual Draw::DrawContext *GetDrawContext() = 0;
// Initialization
virtual void InitClear() = 0;
virtual void Reinitialize() = 0;

View File

@ -14,10 +14,11 @@
//commented out until someone bothers to maintain it
//#include "GPU/GLES/VertexDecoder.h"
Debugger_DisplayList::Debugger_DisplayList(DebugInterface *_cpu, MainWindow* mainWindow_, QWidget *parent) :
Debugger_DisplayList::Debugger_DisplayList(DebugInterface *_cpu, Draw::DrawContext *draw, MainWindow* mainWindow_, QWidget *parent) :
QDialog(parent),
ui(new Ui::Debugger_DisplayList),
cpu(_cpu),
draw_(draw),
mainWindow(mainWindow_),
currentRenderFrameDisplay(0),
currentTextureDisplay(0),
@ -1348,12 +1349,12 @@ void Debugger_DisplayList::UpdateRenderBufferGUI()
}
else
{
fbo_get_dimensions(currentTextureDisplay, &FRAME_WIDTH, &FRAME_HEIGHT);
draw_->GetFramebufferDimensions(currentTextureDisplay, &FRAME_WIDTH, &FRAME_HEIGHT);
data = new u8[FRAME_WIDTH * FRAME_HEIGHT * 4];
memset(data,0,FRAME_WIDTH * FRAME_HEIGHT * 4);
if(currentRenderFrameDisplay == 0)
{
fbo_bind_as_texture(currentTextureDisplay, 0, FB_COLOR_BIT, 0);
draw_->BindFramebufferAsTexture(currentTextureDisplay, 0, Draw::FB_COLOR_BIT, 0);
glGetTexImage(GL_TEXTURE_2D, 0, GL_BGRA, GL_UNSIGNED_BYTE, data);
}
}
@ -1439,7 +1440,7 @@ void Debugger_DisplayList::UpdateRenderBufferListGUI()
void Debugger_DisplayList::on_fboList_itemClicked(QTreeWidgetItem *item, int column)
{
u64 addr = item->data(0,Qt::UserRole).toULongLong();
FBO* fbo = (FBO*)addr;
Draw::Framebuffer * fbo = (Draw::Framebuffer *)addr;
currentTextureDisplay = fbo;
UpdateRenderBufferGUI();
}

View File

@ -1,5 +1,4 @@
#ifndef DEBUGGER_DISPLAYLIST_H
#define DEBUGGER_DISPLAYLIST_H
#pragma once
#include "Core/Debugger/DebugInterface.h"
@ -7,7 +6,7 @@
#include <QTreeWidgetItem>
#include "GPU/GPUState.h"
#include "GPU/GLES/FBO.h"
#include "thin3d/thin3d.h"
class MainWindow;
namespace Ui {
@ -38,7 +37,7 @@ class Debugger_DisplayList : public QDialog
Q_OBJECT
public:
explicit Debugger_DisplayList(DebugInterface *_cpu, MainWindow *mainWindow_, QWidget *parent = 0);
Debugger_DisplayList(DebugInterface *_cpu, Draw::DrawContext *draw, MainWindow *mainWindow_, QWidget *parent = 0);
~Debugger_DisplayList();
void UpdateDisplayList();
@ -88,12 +87,13 @@ private:
Ui::Debugger_DisplayList *ui;
DebugInterface* cpu;
Draw::DrawContext* draw_;
MainWindow* mainWindow;
QTreeWidgetItem* displayListRowSelected;
QTreeWidgetItem* displayListDataSelected;
QTreeWidgetItem* textureDataSelected;
int currentRenderFrameDisplay;
FBO* currentTextureDisplay;
Draw::Framebuffer *currentTextureDisplay;
float fboZoomFactor;
int maxVtxDisplay;
int maxIdxDisplay;
@ -102,5 +102,3 @@ private:
std::map<u32, int> vtxBufferSize;
std::map<u32, int> idxBufferSize;
};
#endif // DEBUGGER_DISPLAYLIST_H

View File

@ -140,7 +140,7 @@ void MainWindow::Boot()
memoryWindow = new Debugger_Memory(currentDebugMIPS, this, this);
memoryTexWindow = new Debugger_MemoryTex(this);
displaylistWindow = new Debugger_DisplayList(currentDebugMIPS, this, this);
displaylistWindow = new Debugger_DisplayList(currentDebugMIPS, gpu->GetDrawContext(), this, this);
notifyMapsLoaded();

View File

@ -122,20 +122,22 @@ bool ManagedTexture::LoadFromFile(const std::string &filename, ImageFileType typ
size_t fileSize;
uint8_t *buffer = VFSReadFile(filename.c_str(), &fileSize);
if (!buffer) {
ELOG("Failed to read file %s", filename.c_str());
return false;
}
bool retval = LoadFromFileData(buffer, fileSize, type);
if (retval) {
filename_ = filename;
}
else {
ELOG("%s: Failed to load texture %s", __FUNCTION__, filename.c_str());
} else {
ELOG("Failed to load texture %s", filename.c_str());
}
delete[] buffer;
return retval;
}
ManagedTexture *CreateTextureFromFile(Draw::DrawContext *draw, const char *filename, ImageFileType type) {
if (!draw)
return nullptr;
ManagedTexture *mtex = new ManagedTexture(draw);
if (!mtex->LoadFromFile(filename, type)) {
delete mtex;
@ -146,6 +148,8 @@ ManagedTexture *CreateTextureFromFile(Draw::DrawContext *draw, const char *filen
// TODO: Remove the code duplication between this and LoadFromFileData
ManagedTexture *CreateTextureFromFileData(Draw::DrawContext *draw, const uint8_t *data, int size, ImageFileType type) {
if (!draw)
return nullptr;
ManagedTexture *mtex = new ManagedTexture(draw);
mtex->LoadFromFileData(data, size, type);
return mtex;

View File

@ -144,16 +144,14 @@ void AndroidEGLGraphicsContext::SwapBuffers() {
// Doesn't do much. Just to fit in.
class AndroidJavaEGLGraphicsContext : public GraphicsContext {
public:
AndroidJavaEGLGraphicsContext() : draw_(nullptr) {}
bool Init(ANativeWindow *wnd, int desiredBackbufferSizeX, int desiredBackbufferSizeY, int backbufferFormat, int androidVersion) {
AndroidJavaEGLGraphicsContext() {
CheckGLExtensions();
draw_ = Draw::T3DCreateGLContext();
return true;
}
void Shutdown() override {
~AndroidJavaEGLGraphicsContext() {
delete draw_;
draw_ = nullptr;
}
void Shutdown() override {}
void SwapBuffers() override {}
void SwapInterval(int interval) override {}
void Resize() override {}
@ -617,10 +615,10 @@ extern "C" void Java_org_ppsspp_ppsspp_NativeApp_shutdown(JNIEnv *, jclass) {
// JavaEGL
extern "C" void Java_org_ppsspp_ppsspp_NativeRenderer_displayInit(JNIEnv * env, jobject obj) {
ILOG("NativeApp.displayInit()");
if (javaGL && !graphicsContext) {
graphicsContext = new AndroidJavaEGLGraphicsContext();
}
ILOG("NativeApp.displayInit() (graphicsContext=%p)", graphicsContext);
if (!renderer_inited) {
NativeInitGraphics(graphicsContext);
@ -722,6 +720,9 @@ extern "C" void Java_org_ppsspp_ppsspp_NativeRenderer_displayShutdown(JNIEnv *en
if (renderer_inited) {
NativeDeviceLost();
NativeShutdownGraphics();
graphicsContext->Shutdown();
delete graphicsContext;
graphicsContext = nullptr;
renderer_inited = false;
NativeMessageReceived("recreateviews", "");
}
@ -1094,6 +1095,7 @@ extern "C" bool JNICALL Java_org_ppsspp_ppsspp_NativeActivity_runEGLRenderLoop(J
graphicsContext->Shutdown();
delete graphicsContext;
graphicsContext = nullptr;
renderLoopRunning = false;
WLOG("Render loop function exited.");
return true;

View File

@ -1,6 +1,7 @@
#pragma once
#include <functional>
#include <cstring> // for memcmp
#include "gfx/gl_common.h"
#include "gfx_es2/gpu_features.h"

View File

@ -12,6 +12,10 @@
#include "gfx_es2/gpu_features.h"
#include "gfx/gl_lost_manager.h"
#ifdef IOS
extern void bindDefaultFBO();
#endif
namespace Draw {
static const unsigned short compToGL[] = {
@ -1224,10 +1228,6 @@ public:
FBColorDepth colorDepth;
};
#ifdef IOS
extern void bindDefaultFBO();
#endif
// On PC, we always use GL_DEPTH24_STENCIL8.
// On Android, we try to use what's available.

View File

@ -21,7 +21,6 @@
#include "Core/Config.h"
#include "Common/GraphicsContext.h"
#include "GPU/GLES/FBO.h"
#include <sys/types.h>
#include <sys/sysctl.h>