Back out 4b82f26f8593:2fcf9cbedd48 (bug 743393, bug 719776) for bustage

This commit is contained in:
Phil Ringnalda 2012-04-11 09:06:40 -07:00
parent 311851c7a5
commit 4348c0ace3
8 changed files with 74 additions and 140 deletions

View File

@ -537,18 +537,6 @@ LayerManagerD3D10::SetViewport(const nsIntSize &aViewport)
}
}
void
LayerManagerD3D10::SetupInputAssembler()
{
mDevice->IASetInputLayout(mInputLayout);
UINT stride = sizeof(Vertex);
UINT offset = 0;
ID3D10Buffer *buffer = mVertexBuffer;
mDevice->IASetVertexBuffers(0, 1, &buffer, &stride, &offset);
mDevice->IASetPrimitiveTopology(D3D10_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP);
}
void
LayerManagerD3D10::SetupPipeline()
{
@ -570,8 +558,13 @@ LayerManagerD3D10::SetupPipeline()
ID3D10RenderTargetView *view = mRTView;
mDevice->OMSetRenderTargets(1, &view, NULL);
mDevice->IASetInputLayout(mInputLayout);
SetupInputAssembler();
UINT stride = sizeof(Vertex);
UINT offset = 0;
ID3D10Buffer *buffer = mVertexBuffer;
mDevice->IASetVertexBuffers(0, 1, &buffer, &stride, &offset);
mDevice->IASetPrimitiveTopology(D3D10_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP);
SetViewport(nsIntSize(rect.width, rect.height));
}

View File

@ -184,7 +184,6 @@ public:
ReadbackManagerD3D10 *readbackManager();
void SetupInputAssembler();
void SetViewport(const nsIntSize &aViewport);
const nsIntSize &GetViewport() { return mViewport; }

View File

@ -365,6 +365,36 @@ ThebesLayerD3D10::VerifyContentType(SurfaceMode aMode)
}
}
void
ThebesLayerD3D10::SetupDualViewports(const gfxIntSize &aSize)
{
D3D10_VIEWPORT viewport;
viewport.MaxDepth = 1.0f;
viewport.MinDepth = 0;
viewport.Width = aSize.width;
viewport.Height = aSize.height;
viewport.TopLeftX = 0;
viewport.TopLeftY = 0;
D3D10_VIEWPORT vps[2] = { viewport, viewport };
device()->RSSetViewports(2, vps);
gfx3DMatrix projection;
/*
* Matrix to transform to viewport space ( <-1.0, 1.0> topleft,
* <1.0, -1.0> bottomright)
*/
projection._11 = 2.0f / aSize.width;
projection._22 = -2.0f / aSize.height;
projection._33 = 0.0f;
projection._41 = -1.0f;
projection._42 = 1.0f;
projection._44 = 1.0f;
effect()->GetVariableByName("mProjection")->
SetRawValue(&projection._11, 0, 64);
}
void
ThebesLayerD3D10::FillTexturesBlackWhite(const nsIntRegion& aRegion, const nsIntPoint& aOffset)
{
@ -380,20 +410,12 @@ ThebesLayerD3D10::FillTexturesBlackWhite(const nsIntRegion& aRegion, const nsInt
device()->CreateRenderTargetView(mTexture, NULL, getter_AddRefs(viewBlack));
device()->CreateRenderTargetView(mTextureOnWhite, NULL, getter_AddRefs(viewWhite));
D3D10_RECT oldScissor;
UINT numRects = 1;
device()->RSGetScissorRects(&numRects, &oldScissor);
D3D10_TEXTURE2D_DESC desc;
mTexture->GetDesc(&desc);
D3D10_RECT scissor = { 0, 0, desc.Width, desc.Height };
device()->RSSetScissorRects(1, &scissor);
mD3DManager->SetupInputAssembler();
nsIntSize oldVP = mD3DManager->GetViewport();
mD3DManager->SetViewport(nsIntSize(desc.Width, desc.Height));
SetupDualViewports(gfxIntSize(desc.Width, desc.Height));
ID3D10RenderTargetView *views[2] = { viewBlack, viewWhite };
device()->OMSetRenderTargets(2, views, NULL);
@ -425,7 +447,6 @@ ThebesLayerD3D10::FillTexturesBlackWhite(const nsIntRegion& aRegion, const nsInt
views[0] = oldRT;
device()->OMSetRenderTargets(1, views, NULL);
mD3DManager->SetViewport(oldVP);
device()->RSSetScissorRects(1, &oldScissor);
}
}

View File

@ -97,6 +97,8 @@ private:
/* Create a new texture */
void CreateNewTextures(const gfxIntSize &aSize, SurfaceMode aMode);
void SetupDualViewports(const gfxIntSize &aSize);
// Fill textures with opaque black and white in the specified region.
void FillTexturesBlackWhite(const nsIntRegion& aRegion, const nsIntPoint& aOffset);

View File

@ -332,6 +332,22 @@ __BitScanReverse64(unsigned __int64 val)
JS_END_MACRO
#endif
/*
* Internal function.
* Compute the log of the least power of 2 greater than or equal to n. This is
* a version of JS_CeilingLog2 that operates on unsigned integers with
* CPU-dependant size.
*/
#define JS_CEILING_LOG2W(n) ((n) <= 1 ? 0 : 1 + JS_FLOOR_LOG2W((n) - 1))
/*
* Internal function.
* Compute the log of the greatest power of 2 less than or equal to n.
* This is a version of JS_FloorLog2 that operates on unsigned integers with
* CPU-dependant size and requires that n != 0.
*/
#define JS_FLOOR_LOG2W(n) (JS_ASSERT((n) != 0), js_FloorLog2wImpl(n))
#if JS_BYTES_PER_WORD == 4
# ifdef JS_HAS_BUILTIN_BITSCAN32
# define js_FloorLog2wImpl(n) \
@ -350,27 +366,6 @@ JS_PUBLIC_API(size_t) js_FloorLog2wImpl(size_t n);
# error "NOT SUPPORTED"
#endif
/*
* Internal function.
* Compute the log of the least power of 2 greater than or equal to n. This is
* a version of JS_CeilingLog2 that operates on unsigned integers with
* CPU-dependant size.
*/
#define JS_CEILING_LOG2W(n) ((n) <= 1 ? 0 : 1 + JS_FLOOR_LOG2W((n) - 1))
/*
* Internal function.
* Compute the log of the greatest power of 2 less than or equal to n.
* This is a version of JS_FloorLog2 that operates on unsigned integers with
* CPU-dependant size and requires that n != 0.
*/
static MOZ_ALWAYS_INLINE size_t
JS_FLOOR_LOG2W(size_t n)
{
JS_ASSERT(n != 0);
return js_FloorLog2wImpl(n);
}
JS_END_EXTERN_C
#ifdef __cplusplus

View File

@ -38,12 +38,9 @@
#endif
#define ASSERT(assertion) MOZ_ASSERT(assertion)
#define ASSERT_UNUSED(variable, assertion) do { \
(void)variable; \
ASSERT(assertion); \
} while (0)
#define ASSERT_UNUSED(variable, assertion) (((void)variable), ASSERT(assertion))
#define ASSERT_NOT_REACHED() MOZ_NOT_REACHED("")
#define CRASH() MOZ_CRASH()
#define CRASH() MOZ_Crash()
#define COMPILE_ASSERT(exp, name) MOZ_STATIC_ASSERT(exp, #name)
#endif

View File

@ -1535,6 +1535,15 @@ extern JSErrorFormatString js_ErrorFormatString[JSErr_Limit];
# define JS_ASSERT_REQUEST_DEPTH(cx) ((void) 0)
#endif
/*
* If the operation callback flag was set, call the operation callback.
* This macro can run the full GC. Return true if it is OK to continue and
* false otherwise.
*/
#define JS_CHECK_OPERATION_LIMIT(cx) \
(JS_ASSERT_REQUEST_DEPTH(cx), \
(!cx->runtime->interrupt || js_InvokeOperationCallback(cx)))
/*
* Invoke the operation callback and return false if the current execution
* is to be terminated.
@ -1551,18 +1560,6 @@ js_GetCurrentBytecodePC(JSContext* cx);
extern JSScript *
js_GetCurrentScript(JSContext* cx);
/*
* If the operation callback flag was set, call the operation callback.
* This macro can run the full GC. Return true if it is OK to continue and
* false otherwise.
*/
static MOZ_ALWAYS_INLINE bool
JS_CHECK_OPERATION_LIMIT(JSContext *cx)
{
JS_ASSERT_REQUEST_DEPTH(cx);
return !cx->runtime->interrupt || js_InvokeOperationCallback(cx);
}
namespace js {
#ifdef JS_METHODJIT

View File

@ -1,4 +1,4 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* vim: set ts=8 sw=4 et tw=99 ft=cpp:
*
* ***** BEGIN LICENSE BLOCK *****
@ -46,15 +46,6 @@
#include "mozilla/Attributes.h"
#include "mozilla/Types.h"
#include <stdio.h>
#include <stdlib.h>
#ifndef WIN32
# include <signal.h>
#endif
#ifdef ANDROID
# include <android/log.h>
#endif
/*
* MOZ_STATIC_ASSERT may be used to assert a condition *at compile time*. This
* can be useful when you make certain assumptions about what must hold for
@ -140,59 +131,12 @@
extern "C" {
#endif
#if defined(WIN32)
/*
* We used to call DebugBreak() on Windows, but amazingly, it causes
* the MSVS 2010 debugger not to be able to recover a call stack.
*/
# define MOZ_CRASH() \
do { \
*((volatile int *) NULL) = 123; \
exit(3); \
} while (0)
#elif defined(ANDROID)
/*
* On Android, raise(SIGABRT) is handled asynchronously. Seg fault now
* so we crash immediately and capture the current call stack.
*/
# define MOZ_CRASH() \
do { \
*((volatile int *) NULL) = 123; \
abort(); \
} while (0)
#elif defined(__APPLE__)
/*
* On Mac OS X, Breakpad ignores signals. Only real Mach exceptions are
* trapped.
*/
# define MOZ_CRASH() \
do { \
*((volatile int *) NULL) = 123; \
raise(SIGABRT); /* In case above statement gets nixed by the optimizer. */ \
} while (0)
#else
# define MOZ_CRASH() \
do { \
raise(SIGABRT); /* To continue from here in GDB: "signal 0". */ \
} while (0)
#endif
extern MFBT_API(void)
MOZ_Crash(void);
extern MFBT_API(void)
MOZ_Assert(const char* s, const char* file, int ln);
static MOZ_ALWAYS_INLINE void
MOZ_OutputAssertMessage(const char* s, const char *file, int ln)
{
#ifdef ANDROID
__android_log_print(ANDROID_LOG_FATAL, "MOZ_Assert",
"Assertion failure: %s, at %s:%d\n", s, file, ln);
#else
fprintf(stderr, "Assertion failure: %s, at %s:%d\n", s, file, ln);
fflush(stderr);
#endif
}
#ifdef __cplusplus
} /* extern "C" */
#endif
@ -232,20 +176,10 @@ MOZ_OutputAssertMessage(const char* s, const char *file, int ln)
#ifdef DEBUG
/* First the single-argument form. */
# define MOZ_ASSERT_HELPER1(expr) \
do { \
if (expr) { \
MOZ_OutputAssertMessage(#expr, __FILE__, __LINE__); \
MOZ_CRASH(); \
} \
} while (0)
((expr) ? ((void)0) : MOZ_Assert(#expr, __FILE__, __LINE__))
/* Now the two-argument form. */
# define MOZ_ASSERT_HELPER2(expr, explain) \
do { \
if (expr) { \
MOZ_OutputAssertMessage(#expr " (" explain ")", __FILE__, __LINE__); \
MOZ_CRASH(); \
} \
} while (0)
((expr) ? ((void)0) : MOZ_Assert(#expr " (" explain ")", __FILE__, __LINE__))
/* And now, helper macrology up the wazoo. */
/*
* Count the number of arguments passed to MOZ_ASSERT, very carefully
@ -271,7 +205,7 @@ MOZ_OutputAssertMessage(const char* s, const char *file, int ln)
MOZ_ASSERT_GLUE(MOZ_ASSERT_CHOOSE_HELPER(MOZ_COUNT_ASSERT_ARGS(__VA_ARGS__)), \
(__VA_ARGS__))
#else
# define MOZ_ASSERT(...) do { } while(0)
# define MOZ_ASSERT(...) ((void)0)
#endif /* DEBUG */
/*
@ -284,13 +218,9 @@ MOZ_OutputAssertMessage(const char* s, const char *file, int ln)
* designed to catch bugs during debugging, not "in the field".
*/
#ifdef DEBUG
# define MOZ_ASSERT_IF(cond, expr) \
do { \
if ((cond)) \
MOZ_ASSERT(expr); \
} while (0)
# define MOZ_ASSERT_IF(cond, expr) ((cond) ? MOZ_ASSERT(expr) : ((void)0))
#else
# define MOZ_ASSERT_IF(cond, expr) do { } while (0)
# define MOZ_ASSERT_IF(cond, expr) ((void)0)
#endif
/* MOZ_NOT_REACHED_MARKER() expands (in compilers which support it) to an