Fix OS X nowx.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7321 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Soren Jorvang 2011-03-08 23:25:37 +00:00
parent 431f6b596a
commit 610df4ab78
4 changed files with 1697 additions and 1696 deletions

View File

@ -274,6 +274,13 @@ void X11_MainLoop()
int main(int argc, char* argv[]) int main(int argc, char* argv[])
{ {
#ifdef __APPLE__
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSEvent *event = [[NSEvent alloc] init];
[NSApplication sharedApplication];
[NSApp activateIgnoringOtherApps: YES];
[NSApp finishLaunching];
#endif
int ch, help = 0; int ch, help = 0;
struct option longopts[] = { struct option longopts[] = {
{ "exec", no_argument, NULL, 'e' }, { "exec", no_argument, NULL, 'e' },
@ -317,12 +324,6 @@ int main(int argc, char* argv[])
if (BootManager::BootCore(argv[optind])) if (BootManager::BootCore(argv[optind]))
{ {
#ifdef __APPLE__ #ifdef __APPLE__
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSEvent *event = [[NSEvent alloc] init];
[NSApplication sharedApplication];
[NSApp activateIgnoringOtherApps: YES];
[NSApp finishLaunching];
while (running) while (running)
{ {
event = [NSApp nextEventMatchingMask: NSAnyEventMask event = [NSApp nextEventMatchingMask: NSAnyEventMask

File diff suppressed because it is too large Load Diff

View File

@ -1,119 +1,119 @@
// Copyright (C) 2003 Dolphin Project. // Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0. // the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details. // GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _PSTEXTUREENCODER_H #ifndef _PSTEXTUREENCODER_H
#define _PSTEXTUREENCODER_H #define _PSTEXTUREENCODER_H
#include "TextureEncoder.h" #include "TextureEncoder.h"
struct ID3D11Texture2D; struct ID3D11Texture2D;
struct ID3D11RenderTargetView; struct ID3D11RenderTargetView;
struct ID3D11Buffer; struct ID3D11Buffer;
struct ID3D11InputLayout; struct ID3D11InputLayout;
struct ID3D11VertexShader; struct ID3D11VertexShader;
struct ID3D11PixelShader; struct ID3D11PixelShader;
struct ID3D11ClassLinkage; struct ID3D11ClassLinkage;
struct ID3D11ClassInstance; struct ID3D11ClassInstance;
struct ID3D11BlendState; struct ID3D11BlendState;
struct ID3D11DepthStencilState; struct ID3D11DepthStencilState;
struct ID3D11RasterizerState; struct ID3D11RasterizerState;
struct ID3D11SamplerState; struct ID3D11SamplerState;
namespace DX11 namespace DX11
{ {
class PSTextureEncoder : public TextureEncoder class PSTextureEncoder : public TextureEncoder
{ {
public: public:
PSTextureEncoder(); PSTextureEncoder();
void Init(); void Init();
void Shutdown(); void Shutdown();
size_t Encode(u8* dst, unsigned int dstFormat, size_t Encode(u8* dst, unsigned int dstFormat,
unsigned int srcFormat, const EFBRectangle& srcRect, bool isIntensity, unsigned int srcFormat, const EFBRectangle& srcRect, bool isIntensity,
bool scaleByHalf); bool scaleByHalf);
private: private:
bool m_ready; bool m_ready;
ID3D11Texture2D* m_out; ID3D11Texture2D* m_out;
ID3D11RenderTargetView* m_outRTV; ID3D11RenderTargetView* m_outRTV;
ID3D11Texture2D* m_outStage; ID3D11Texture2D* m_outStage;
ID3D11Buffer* m_encodeParams; ID3D11Buffer* m_encodeParams;
ID3D11Buffer* m_quad; ID3D11Buffer* m_quad;
ID3D11VertexShader* m_vShader; ID3D11VertexShader* m_vShader;
ID3D11InputLayout* m_quadLayout; ID3D11InputLayout* m_quadLayout;
ID3D11BlendState* m_efbEncodeBlendState; ID3D11BlendState* m_efbEncodeBlendState;
ID3D11DepthStencilState* m_efbEncodeDepthState; ID3D11DepthStencilState* m_efbEncodeDepthState;
ID3D11RasterizerState* m_efbEncodeRastState; ID3D11RasterizerState* m_efbEncodeRastState;
ID3D11SamplerState* m_efbSampler; ID3D11SamplerState* m_efbSampler;
// Stuff only used in static-linking mode (SM4.0-compatible) // Stuff only used in static-linking mode (SM4.0-compatible)
bool InitStaticMode(); bool InitStaticMode();
bool SetStaticShader(unsigned int dstFormat, unsigned int srcFormat, bool SetStaticShader(unsigned int dstFormat, unsigned int srcFormat,
bool isIntensity, bool scaleByHalf); bool isIntensity, bool scaleByHalf);
typedef unsigned int ComboKey; // Key for a shader combination typedef unsigned int ComboKey; // Key for a shader combination
ComboKey MakeComboKey(unsigned int dstFormat, unsigned int srcFormat, ComboKey MakeComboKey(unsigned int dstFormat, unsigned int srcFormat,
bool isIntensity, bool scaleByHalf) bool isIntensity, bool scaleByHalf)
{ {
return (dstFormat << 4) | (srcFormat << 2) | (isIntensity ? (1<<1) : 0) return (dstFormat << 4) | (srcFormat << 2) | (isIntensity ? (1<<1) : 0)
| (scaleByHalf ? (1<<0) : 0); | (scaleByHalf ? (1<<0) : 0);
} }
typedef std::map<ComboKey, ID3D11PixelShader*> ComboMap; typedef std::map<ComboKey, ID3D11PixelShader*> ComboMap;
ComboMap m_staticShaders; ComboMap m_staticShaders;
// Stuff only used for dynamic-linking mode (SM5.0+, available as soon as // Stuff only used for dynamic-linking mode (SM5.0+, available as soon as
// Microsoft fixes their bloody HLSL compiler) // Microsoft fixes their bloody HLSL compiler)
bool InitDynamicMode(); bool InitDynamicMode();
bool SetDynamicShader(unsigned int dstFormat, unsigned int srcFormat, bool SetDynamicShader(unsigned int dstFormat, unsigned int srcFormat,
bool isIntensity, bool scaleByHalf); bool isIntensity, bool scaleByHalf);
ID3D11PixelShader* m_dynamicShader; ID3D11PixelShader* m_dynamicShader;
ID3D11ClassLinkage* m_classLinkage; ID3D11ClassLinkage* m_classLinkage;
// Interface slots // Interface slots
UINT m_fetchSlot; UINT m_fetchSlot;
UINT m_scaledFetchSlot; UINT m_scaledFetchSlot;
UINT m_intensitySlot; UINT m_intensitySlot;
UINT m_generatorSlot; UINT m_generatorSlot;
// Class instances // Class instances
// Fetch: 0 is RGB, 1 is RGBA, 2 is RGB565, 3 is Z // Fetch: 0 is RGB, 1 is RGBA, 2 is RGB565, 3 is Z
ID3D11ClassInstance* m_fetchClass[4]; ID3D11ClassInstance* m_fetchClass[4];
// ScaledFetch: 0 is off, 1 is on // ScaledFetch: 0 is off, 1 is on
ID3D11ClassInstance* m_scaledFetchClass[2]; ID3D11ClassInstance* m_scaledFetchClass[2];
// Intensity: 0 is off, 1 is on // Intensity: 0 is off, 1 is on
ID3D11ClassInstance* m_intensityClass[2]; ID3D11ClassInstance* m_intensityClass[2];
// Generator: one for each dst format, 16 total // Generator: one for each dst format, 16 total
ID3D11ClassInstance* m_generatorClass[16]; ID3D11ClassInstance* m_generatorClass[16];
std::vector<ID3D11ClassInstance*> m_linkageArray; std::vector<ID3D11ClassInstance*> m_linkageArray;
}; };
} }
#endif #endif

View File

@ -1,135 +1,135 @@
// Copyright (C) 2003 Dolphin Project. // Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0. // the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details. // GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#ifndef _TEXTUREENCODER_H #ifndef _TEXTUREENCODER_H
#define _TEXTUREENCODER_H #define _TEXTUREENCODER_H
#include "VideoCommon.h" #include "VideoCommon.h"
namespace DX11 namespace DX11
{ {
// 4-bit format: 8x8 texels / cache line // 4-bit format: 8x8 texels / cache line
// 8-bit format: 8x4 texels / cache line // 8-bit format: 8x4 texels / cache line
// 16-bit format: 4x4 texels / cache line // 16-bit format: 4x4 texels / cache line
// 32-bit format: 4x4 texels / 2 cache lines // 32-bit format: 4x4 texels / 2 cache lines
// Compressed format: 8x8 texels / cache line // Compressed format: 8x8 texels / cache line
// Document EFB encoding formats here with examples of where they are used. // Document EFB encoding formats here with examples of where they are used.
// Format: 0 - R4 // Format: 0 - R4
// Used in The Legend of Zelda: The Wind Waker for character shadows (srcFormat 1, // Used in The Legend of Zelda: The Wind Waker for character shadows (srcFormat 1,
// isIntensity 1, scaleByHalf 1). // isIntensity 1, scaleByHalf 1).
// Format: 1 - R8 // Format: 1 - R8
// FIXME: Unseen. May or may not be a duplicate of format 8. // FIXME: Unseen. May or may not be a duplicate of format 8.
// Format: 2 - A4 R4 // Format: 2 - A4 R4
// FIXME: Unseen. // FIXME: Unseen.
// Format: 3 - A8 R8 // Format: 3 - A8 R8
// FIXME: Unseen. // FIXME: Unseen.
// Format: 4 - R5 G6 B5 // Format: 4 - R5 G6 B5
// Used in Wind Waker for most render-to-texture effects like heat shimmer and // Used in Wind Waker for most render-to-texture effects like heat shimmer and
// depth-of-field. // depth-of-field.
// Format: 5 - 1 R5 G5 B5 or 0 A3 R4 G4 B4 // Format: 5 - 1 R5 G5 B5 or 0 A3 R4 G4 B4
// Used in Twilight Princess for character shadows. // Used in Twilight Princess for character shadows.
// Format: 6 - A8 R8 A8 R8 | G8 B8 G8 B8 // Format: 6 - A8 R8 A8 R8 | G8 B8 G8 B8
// Used in Twilight Princess for bloom effect. // Used in Twilight Princess for bloom effect.
// Format: 7 - A8 // Format: 7 - A8
// Used in Metroid Prime 2 for the scan visor. // Used in Metroid Prime 2 for the scan visor.
// Format: 8 - R8 // Format: 8 - R8
// Used in Twilight Princess for the map. // Used in Twilight Princess for the map.
// Format: 9 - G8 // Format: 9 - G8
// FIXME: Unseen. // FIXME: Unseen.
// Format: A - B8 // Format: A - B8
// Used in Metroid Prime 2 for the scan visor. // Used in Metroid Prime 2 for the scan visor.
// Format: B - G8 R8 // Format: B - G8 R8
// Used in Wind Waker for depth-of-field. Usually used with srcFormat 3 to // Used in Wind Waker for depth-of-field. Usually used with srcFormat 3 to
// render depth textures. The bytes are swapped, so games have to correct it // render depth textures. The bytes are swapped, so games have to correct it
// in RAM before using it as a texture. // in RAM before using it as a texture.
// Format: C - B8 G8 // Format: C - B8 G8
// FIXME: Unseen. // FIXME: Unseen.
const unsigned int BLOCK_WIDTHS[16] = { const unsigned int BLOCK_WIDTHS[16] = {
8, // R4 8, // R4
8, // R8 (FIXME: duplicate of R8 below?) 8, // R8 (FIXME: duplicate of R8 below?)
8, // A4 R4 8, // A4 R4
4, // A8 R8 4, // A8 R8
4, // R5 G6 B5 4, // R5 G6 B5
4, // 1 R5 G5 B5 or 0 A3 R4 G4 B4 4, // 1 R5 G5 B5 or 0 A3 R4 G4 B4
4, // A8 R8 A8 R8 | G8 B8 G8 B8 (two cache lines) 4, // A8 R8 A8 R8 | G8 B8 G8 B8 (two cache lines)
8, // A8 8, // A8
8, // R8 (FIXME: duplicate of R8 above?) 8, // R8 (FIXME: duplicate of R8 above?)
8, // G8 8, // G8
8, // B8 8, // B8
4, // G8 R8 4, // G8 R8
4, // B8 G8 4, // B8 G8
0, 0, 0 // Unknown formats 0, 0, 0 // Unknown formats
}; };
const unsigned int BLOCK_HEIGHTS[16] = { const unsigned int BLOCK_HEIGHTS[16] = {
8, // R4 8, // R4
4, // R8 (FIXME: duplicate of R8 below?) 4, // R8 (FIXME: duplicate of R8 below?)
4, // A4 R4 4, // A4 R4
4, // A8 R8 4, // A8 R8
4, // R5 G6 B5 4, // R5 G6 B5
4, // 1 R5 G5 B5 or 0 A3 R4 G4 B4 4, // 1 R5 G5 B5 or 0 A3 R4 G4 B4
4, // A8 R8 A8 R8 | G8 B8 G8 B8 (two cache lines) 4, // A8 R8 A8 R8 | G8 B8 G8 B8 (two cache lines)
4, // A8 4, // A8
4, // R8 (FIXME: duplicate of R8 above?) 4, // R8 (FIXME: duplicate of R8 above?)
4, // G8 4, // G8
4, // B8 4, // B8
4, // G8 R8 4, // G8 R8
4, // B8 G8 4, // B8 G8
0, 0, 0 // Unknown formats 0, 0, 0 // Unknown formats
}; };
// Maximum number of bytes that can occur in a texture block-row generated by // Maximum number of bytes that can occur in a texture block-row generated by
// the encoder // the encoder
static const UINT MAX_BYTES_PER_BLOCK_ROW = (EFB_WIDTH/4)*64; static const UINT MAX_BYTES_PER_BLOCK_ROW = (EFB_WIDTH/4)*64;
// The maximum amount of data that the texture encoder can generate in one call // The maximum amount of data that the texture encoder can generate in one call
static const UINT MAX_BYTES_PER_ENCODE = MAX_BYTES_PER_BLOCK_ROW*(EFB_HEIGHT/4); static const UINT MAX_BYTES_PER_ENCODE = MAX_BYTES_PER_BLOCK_ROW*(EFB_HEIGHT/4);
class TextureEncoder class TextureEncoder
{ {
public: public:
virtual ~TextureEncoder() { } virtual ~TextureEncoder() { }
virtual void Init() = 0; virtual void Init() = 0;
virtual void Shutdown() = 0; virtual void Shutdown() = 0;
// Returns size in bytes of encoded block of memory // Returns size in bytes of encoded block of memory
virtual size_t Encode(u8* dst, unsigned int dstFormat, virtual size_t Encode(u8* dst, unsigned int dstFormat,
unsigned int srcFormat, const EFBRectangle& srcRect, bool isIntensity, unsigned int srcFormat, const EFBRectangle& srcRect, bool isIntensity,
bool scaleByHalf) = 0; bool scaleByHalf) = 0;
}; };
} }
#endif #endif