Merge pull request #8337 from unknownbrackets/minor

Fix glCopyImageSubData even more
This commit is contained in:
Henrik Rydgård 2015-12-30 21:56:55 +01:00
commit f7c6a98d5c
6 changed files with 16 additions and 18 deletions

View File

@ -423,8 +423,6 @@ void __DisplayGetDebugStats(char stats[], size_t bufsize) {
"Most active syscall: %s : %0.2f ms\n"
"Draw calls: %i, flushes %i\n"
"Cached Draw calls: %i\n"
"Alpha Tested draws: %i\n"
"Non Alpha Tested draws: %i\n"
"Num Tracked Vertex Arrays: %i\n"
"Cycles executed: %d (%f per vertex)\n"
"Commands per call level: %i %i %i %i\n"
@ -447,8 +445,6 @@ void __DisplayGetDebugStats(char stats[], size_t bufsize) {
gpuStats.numDrawCalls,
gpuStats.numFlushes,
gpuStats.numCachedDrawCalls,
gpuStats.numAlphaTestedDraws,
gpuStats.numNonAlphaTestedDraws,
gpuStats.numTrackedVertexArrays,
gpuStats.vertexGPUCycles + gpuStats.otherGPUCycles,
vertexAverageCycles,

View File

@ -257,11 +257,6 @@ void ComputeFragmentShaderID(ShaderID *id_out, uint32_t vertType) {
id.SetBits(FS_BIT_REPLACE_ALPHA_WITH_STENCIL_TYPE, 4, ReplaceAlphaWithStencilType());
}
if (enableAlphaTest)
gpuStats.numAlphaTestedDraws++;
else
gpuStats.numNonAlphaTestedDraws++;
// 2 bits.
id.SetBits(FS_BIT_REPLACE_LOGIC_OP_TYPE, 2, ReplaceLogicOpType());

View File

@ -1374,13 +1374,22 @@ void FramebufferManager::BlitFramebuffer(VirtualFramebuffer *dst, int dstX, int
int dstY1 = dstY * dstYFactor;
int dstY2 = (dstY + h) * dstYFactor;
if (src == dst && srcX == dstX && srcY == dstY) {
// Let's just skip a copy where the destination is equal to the source.
WARN_LOG_REPORT_ONCE(blitSame, G3D, "Skipped blit with equal dst and src");
return;
}
if (gstate_c.Supports(GPU_SUPPORTS_ANY_COPY_IMAGE)) {
// glBlitFramebuffer can clip, but glCopyImageSubData is more restricted.
// In case the src goes outside, we just skip the optimization in that case.
const bool sameSize = dstX2 - dstX1 == srcX2 - srcX1 && dstY2 - dstY1 == srcY2 - srcY1;
const bool sameDepth = dst->colorDepth == src->colorDepth;
const bool srcInsideBounds = srcX2 <= src->renderWidth && srcY2 <= src->renderHeight;
const bool dstInsideBounds = dstX2 <= dst->renderWidth && dstY2 <= dst->renderHeight;
if (sameSize && srcInsideBounds && dstInsideBounds) {
const bool xOverlap = src == dst && srcX2 > dstX1 && srcX1 < dstX2;
const bool yOverlap = src == dst && srcY2 > dstY1 && srcY1 < dstY2;
if (sameSize && sameDepth && srcInsideBounds && dstInsideBounds && !(xOverlap && yOverlap)) {
#if defined(USING_GLES2)
#ifndef IOS
glCopyImageSubDataOES(

View File

@ -66,8 +66,6 @@ struct GPUStatistics {
numShaderSwitches = 0;
numFlushes = 0;
numTexturesDecoded = 0;
numAlphaTestedDraws = 0;
numNonAlphaTestedDraws = 0;
msProcessingDisplayLists = 0;
vertexGPUCycles = 0;
otherGPUCycles = 0;
@ -91,9 +89,6 @@ struct GPUStatistics {
int otherGPUCycles;
int gpuCommandsAtCallLevel[4];
int numAlphaTestedDraws;
int numNonAlphaTestedDraws;
// Total statistics, updated by the GPU core in UpdateStats
int numVBlanks;
int numFlips;

View File

@ -311,6 +311,12 @@ void SoftGPU::CopyToCurrentFboFromDisplayRam(int srcwidth, int srcheight)
glDisableVertexAttribArray(attr_tex);
glBindTexture(GL_TEXTURE_2D, 0);
if (vao != 0) {
glBindVertexArray(0);
glBindBuffer(GL_ARRAY_BUFFER, 0);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
}
}
void SoftGPU::CopyDisplayToOutput()

View File

@ -28,9 +28,6 @@ static HWND hWnd; // Holds Our Window Handle
static D3DPRESENT_PARAMETERS pp;
static HMODULE hD3D9;
// TODO: Make config?
static bool enableGLDebug = true;
void D3D9_SwapBuffers() {
if (has9Ex) {
deviceEx->EndScene();