mirror of
https://github.com/libretro/ppsspp.git
synced 2024-11-27 10:20:49 +00:00
Add glViewport to cached gl state. Add a couple of missing VFPU ops.
This commit is contained in:
parent
7a7c92edeb
commit
9363a867e2
@ -475,8 +475,8 @@ namespace MIPSInt
|
|||||||
case 21: d[i] = logf(s[i])/log(2.0f); break;
|
case 21: d[i] = logf(s[i])/log(2.0f); break;
|
||||||
case 22: d[i] = sqrtf(s[i]); break; //vsqrt
|
case 22: d[i] = sqrtf(s[i]); break; //vsqrt
|
||||||
case 23: d[i] = asinf(s[i] * (float)M_2_PI); break; //vasin
|
case 23: d[i] = asinf(s[i] * (float)M_2_PI); break; //vasin
|
||||||
// case 24: vnrcp
|
case 24: d[i] = -1.0f / s[i]; break; // vnrcp
|
||||||
// case 26: vnsin
|
case 26: d[i] = -sinf((float)M_PI_2 * s[i]); break; // vnsin
|
||||||
case 28: d[i] = 1.0f / expf(s[i] * (float)M_LOG2E); break; // vrexp2
|
case 28: d[i] = 1.0f / expf(s[i] * (float)M_LOG2E); break; // vrexp2
|
||||||
default:
|
default:
|
||||||
_dbg_assert_msg_(CPU,0,"Trying to interpret VV2Op instruction that can't be interpreted");
|
_dbg_assert_msg_(CPU,0,"Trying to interpret VV2Op instruction that can't be interpreted");
|
||||||
|
@ -36,7 +36,7 @@ static int atlasHeight;
|
|||||||
struct PPGeVertex {
|
struct PPGeVertex {
|
||||||
u16 u, v;
|
u16 u, v;
|
||||||
u32 color;
|
u32 color;
|
||||||
s16 x, y; u16 z;
|
float x, y, z;
|
||||||
};
|
};
|
||||||
|
|
||||||
static u32 savedContextPtr;
|
static u32 savedContextPtr;
|
||||||
@ -209,7 +209,7 @@ void PPGeBegin()
|
|||||||
WriteCmd(GE_CMD_MAXZ, 0xFFFF);
|
WriteCmd(GE_CMD_MAXZ, 0xFFFF);
|
||||||
|
|
||||||
// Through mode, so we don't have to bother with matrices
|
// Through mode, so we don't have to bother with matrices
|
||||||
WriteCmd(GE_CMD_VERTEXTYPE, GE_VTYPE_TC_16BIT | GE_VTYPE_COL_8888 | GE_VTYPE_POS_16BIT | GE_VTYPE_THROUGH);
|
WriteCmd(GE_CMD_VERTEXTYPE, GE_VTYPE_TC_16BIT | GE_VTYPE_COL_8888 | GE_VTYPE_POS_FLOAT | GE_VTYPE_THROUGH);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PPGeEnd()
|
void PPGeEnd()
|
||||||
@ -340,6 +340,21 @@ void PPGeDraw4Patch(int atlasImage, float x, float y, float w, float h, u32 colo
|
|||||||
EndVertexDataAndDraw(GE_PRIM_RECTANGLES);
|
EndVertexDataAndDraw(GE_PRIM_RECTANGLES);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PPGeDrawRect(float x1, float y1, float x2, float y2, u32 color)
|
||||||
|
{
|
||||||
|
if (!dlPtr)
|
||||||
|
return;
|
||||||
|
|
||||||
|
WriteCmd(GE_CMD_TEXTUREMAPENABLE, 0);
|
||||||
|
|
||||||
|
BeginVertexData();
|
||||||
|
Vertex(x1, y1, 0, 0, 0, 0, color);
|
||||||
|
Vertex(x2, y2, 0, 0, 0, 0, color);
|
||||||
|
EndVertexDataAndDraw(GE_PRIM_RECTANGLES);
|
||||||
|
|
||||||
|
WriteCmd(GE_CMD_TEXTUREMAPENABLE, 1);
|
||||||
|
}
|
||||||
|
|
||||||
// Just blits an image to the screen, multiplied with the color.
|
// Just blits an image to the screen, multiplied with the color.
|
||||||
void PPGeDrawImage(int atlasImage, float x, float y, int align, u32 color)
|
void PPGeDrawImage(int atlasImage, float x, float y, int align, u32 color)
|
||||||
{
|
{
|
||||||
|
@ -74,6 +74,8 @@ void PPGeDrawImage(int atlasImage, float x, float y, int align, u32 color = 0xFF
|
|||||||
void PPGeDrawImage(int atlasImage, float x, float y, float w, float h, int align, u32 color = 0xFFFFFFFF);
|
void PPGeDrawImage(int atlasImage, float x, float y, float w, float h, int align, u32 color = 0xFFFFFFFF);
|
||||||
void PPGeDrawImage(float x, float y, float w, float h, float u1, float v1, float u2, float v2, int tw, int th, u32 color);
|
void PPGeDrawImage(float x, float y, float w, float h, float u1, float v1, float u2, float v2, int tw, int th, u32 color);
|
||||||
|
|
||||||
|
void PPGeDrawRect(float x1, float y1, float x2, float y2, u32 color);
|
||||||
|
|
||||||
void PPGeSetDefaultTexture();
|
void PPGeSetDefaultTexture();
|
||||||
void PPGeSetTexture(u32 dataAddr, int width, int height);
|
void PPGeSetTexture(u32 dataAddr, int width, int height);
|
||||||
void PPGeDisableTexture();
|
void PPGeDisableTexture();
|
||||||
|
@ -191,7 +191,7 @@ void GLES_GPU::InitClear() {
|
|||||||
// glClearColor(1,0,1,1);
|
// glClearColor(1,0,1,1);
|
||||||
glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
|
glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
|
||||||
}
|
}
|
||||||
glViewport(0, 0, PSP_CoreParameter().pixelWidth, PSP_CoreParameter().pixelHeight);
|
glstate.viewport.set(0, 0, PSP_CoreParameter().pixelWidth, PSP_CoreParameter().pixelHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLES_GPU::DumpNextFrame() {
|
void GLES_GPU::DumpNextFrame() {
|
||||||
@ -247,7 +247,7 @@ void GLES_GPU::CopyDisplayToOutput() {
|
|||||||
VirtualFramebuffer *vfb = GetDisplayFBO();
|
VirtualFramebuffer *vfb = GetDisplayFBO();
|
||||||
fbo_unbind();
|
fbo_unbind();
|
||||||
|
|
||||||
glViewport(0, 0, PSP_CoreParameter().pixelWidth, PSP_CoreParameter().pixelHeight);
|
glstate.viewport.set(0, 0, PSP_CoreParameter().pixelWidth, PSP_CoreParameter().pixelHeight);
|
||||||
|
|
||||||
currentRenderVfb_ = 0;
|
currentRenderVfb_ = 0;
|
||||||
|
|
||||||
@ -347,7 +347,7 @@ void GLES_GPU::SetRenderFrameBuffer() {
|
|||||||
vfb->fbo = fbo_create(vfb->width * renderWidthFactor_, vfb->height * renderHeightFactor_, 1, true);
|
vfb->fbo = fbo_create(vfb->width * renderWidthFactor_, vfb->height * renderHeightFactor_, 1, true);
|
||||||
vfbs_.push_back(vfb);
|
vfbs_.push_back(vfb);
|
||||||
fbo_bind_as_render_target(vfb->fbo);
|
fbo_bind_as_render_target(vfb->fbo);
|
||||||
glViewport(0, 0, renderWidth_, renderHeight_);
|
glstate.viewport.set(0, 0, renderWidth_, renderHeight_);
|
||||||
currentRenderVfb_ = vfb;
|
currentRenderVfb_ = vfb;
|
||||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
|
||||||
INFO_LOG(HLE, "Creating FBO for %08x : %i x %i", vfb->fb_address, vfb->width, vfb->height);
|
INFO_LOG(HLE, "Creating FBO for %08x : %i x %i", vfb->fb_address, vfb->width, vfb->height);
|
||||||
@ -360,7 +360,7 @@ void GLES_GPU::SetRenderFrameBuffer() {
|
|||||||
DEBUG_LOG(HLE, "Switching render target to FBO for %08x", vfb->fb_address);
|
DEBUG_LOG(HLE, "Switching render target to FBO for %08x", vfb->fb_address);
|
||||||
gstate_c.textureChanged = true;
|
gstate_c.textureChanged = true;
|
||||||
fbo_bind_as_render_target(vfb->fbo);
|
fbo_bind_as_render_target(vfb->fbo);
|
||||||
glViewport(0, 0, renderWidth_, renderHeight_);
|
glstate.viewport.set(0, 0, renderWidth_, renderHeight_);
|
||||||
currentRenderVfb_ = vfb;
|
currentRenderVfb_ = vfb;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -181,7 +181,7 @@ void UpdateViewportAndProjection() {
|
|||||||
|
|
||||||
if (throughmode) {
|
if (throughmode) {
|
||||||
// No viewport transform here. Let's experiment with using region.
|
// No viewport transform here. Let's experiment with using region.
|
||||||
glViewport((0 + regionX1) * renderWidthFactor, (0 - regionY1) * renderHeightFactor, (regionX2 - regionX1) * renderWidthFactor, (regionY2 - regionY1) * renderHeightFactor);
|
glstate.viewport.set((0 + regionX1) * renderWidthFactor, (0 - regionY1) * renderHeightFactor, (regionX2 - regionX1) * renderWidthFactor, (regionY2 - regionY1) * renderHeightFactor);
|
||||||
} else {
|
} else {
|
||||||
// These we can turn into a glViewport call, offset by offsetX and offsetY. Math after.
|
// These we can turn into a glViewport call, offset by offsetX and offsetY. Math after.
|
||||||
float vpXa = getFloat24(gstate.viewportx1);
|
float vpXa = getFloat24(gstate.viewportx1);
|
||||||
@ -216,7 +216,7 @@ void UpdateViewportAndProjection() {
|
|||||||
|
|
||||||
// Flip vpY0 to match the OpenGL coordinate system.
|
// Flip vpY0 to match the OpenGL coordinate system.
|
||||||
vpY0 = renderHeight - (vpY0 + vpHeight);
|
vpY0 = renderHeight - (vpY0 + vpHeight);
|
||||||
glViewport(vpX0, vpY0, vpWidth, vpHeight);
|
glstate.viewport.set(vpX0, vpY0, vpWidth, vpHeight);
|
||||||
// Sadly, as glViewport takes integers, we will not be able to support sub pixel offsets this way. But meh.
|
// Sadly, as glViewport takes integers, we will not be able to support sub pixel offsets this way. But meh.
|
||||||
// shaderManager_->DirtyUniform(DIRTY_PROJMATRIX);
|
// shaderManager_->DirtyUniform(DIRTY_PROJMATRIX);
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,8 @@ void GL_Resized() // Resize And Initialize The GL Window
|
|||||||
{
|
{
|
||||||
yres=1; // Making Height Equal One
|
yres=1; // Making Height Equal One
|
||||||
}
|
}
|
||||||
glViewport(0,0,xres,yres); // Reset The Current Viewport
|
glstate.viewport.set(0, 0, xres, yres);
|
||||||
|
glstate.viewport.restore();
|
||||||
glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
|
glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
|
||||||
glLoadIdentity(); // Reset The Projection Matrix
|
glLoadIdentity(); // Reset The Projection Matrix
|
||||||
glOrtho(0.0f,xres,yres,0.0f,-1.0f,1.0f); // Create Ortho 640x480 View (0,0 At Top Left)
|
glOrtho(0.0f,xres,yres,0.0f,-1.0f,1.0f); // Create Ortho 640x480 View (0,0 At Top Left)
|
||||||
|
@ -176,7 +176,8 @@ void EmuScreen::render()
|
|||||||
|
|
||||||
uiTexture->Bind(0);
|
uiTexture->Bind(0);
|
||||||
|
|
||||||
glViewport(0, 0, pixel_xres, pixel_yres);
|
glstate.viewport.set(0, 0, pixel_xres, pixel_yres);
|
||||||
|
glstate.viewport.restore();
|
||||||
|
|
||||||
ui_draw2d.Begin(DBMODE_NORMAL);
|
ui_draw2d.Begin(DBMODE_NORMAL);
|
||||||
|
|
||||||
|
@ -154,7 +154,8 @@ bool WindowsHeadlessHost::ResizeGL()
|
|||||||
RECT rc;
|
RECT rc;
|
||||||
GetWindowRect(hWnd, &rc);
|
GetWindowRect(hWnd, &rc);
|
||||||
|
|
||||||
glViewport(0, 0, WINDOW_WIDTH, WINDOW_HEIGHT);
|
glstate.viewport.set(0, 0, WINDOW_WIDTH, WINDOW_HEIGHT);
|
||||||
|
glstate.viewport.restore();
|
||||||
glMatrixMode(GL_PROJECTION);
|
glMatrixMode(GL_PROJECTION);
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
glOrtho(0.0f, WINDOW_WIDTH, WINDOW_HEIGHT, 0.0f, -1.0f, 1.0f);
|
glOrtho(0.0f, WINDOW_WIDTH, WINDOW_HEIGHT, 0.0f, -1.0f, 1.0f);
|
||||||
|
2
native
2
native
@ -1 +1 @@
|
|||||||
Subproject commit dbda5f8037e3da7fda5e5ec4cb59a8047c319e38
|
Subproject commit 8f7fa5e4e2738a1da83b2f52540b359c801ea3c0
|
Loading…
Reference in New Issue
Block a user