mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-26 07:39:45 -06:00
Merge remote-tracking branch 'origin/master' into Android-trash
This commit is contained in:
@ -1351,7 +1351,7 @@ bool PSTextureEncoder::InitDynamicMode()
|
||||
var = reflect->GetVariableByName("g_generator");
|
||||
m_generatorSlot = var->GetInterfaceSlot(0);
|
||||
|
||||
INFO_LOG(VIDEO, "fetch slot %d, scaledFetch slot %d, intensity slot %d, generator slot %d",
|
||||
INFO_LOG(VIDEO, "Fetch slot %d, scaledFetch slot %d, intensity slot %d, generator slot %d",
|
||||
m_fetchSlot, m_scaledFetchSlot, m_intensitySlot, m_generatorSlot);
|
||||
|
||||
// Class instances will be created at the time they are used
|
||||
|
@ -36,7 +36,7 @@ void PerfQuery::EnableQuery(PerfQueryGroup type)
|
||||
{
|
||||
// TODO
|
||||
FlushOne();
|
||||
ERROR_LOG(VIDEO, "flushed query buffer early!");
|
||||
ERROR_LOG(VIDEO, "Flushed query buffer early!");
|
||||
}
|
||||
|
||||
// start query
|
||||
|
@ -715,12 +715,12 @@ void Renderer::SetBlendMode(bool forceUpdate)
|
||||
if (bpmem.blendmode.logicopenable && !forceUpdate)
|
||||
return;
|
||||
|
||||
if (bpmem.blendmode.subtract) // enable blending src 1 dst 1
|
||||
if (bpmem.blendmode.subtract)
|
||||
{
|
||||
gx_state.blenddc.RenderTarget[0].BlendEnable = true;
|
||||
SetBlendOp(D3D11_BLEND_OP_REV_SUBTRACT);
|
||||
SetSrcBlend(d3dSrcFactors[1]);
|
||||
SetDestBlend(d3dDestFactors[1]);
|
||||
SetSrcBlend(D3D11_BLEND_ONE);
|
||||
SetDestBlend(D3D11_BLEND_ONE);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -154,7 +154,7 @@ void VertexManager::Draw(UINT stride)
|
||||
|
||||
if (IndexGenerator::GetNumTriangles() > 0)
|
||||
{
|
||||
D3D::context->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
|
||||
D3D::context->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP);
|
||||
D3D::context->DrawIndexed(IndexGenerator::GetTriangleindexLen(), m_triangle_draw_index, 0);
|
||||
INCSTAT(stats.thisFrame.numIndexedDrawCalls);
|
||||
}
|
||||
|
@ -162,7 +162,7 @@ void VertexShaderCache::Init()
|
||||
for (k = 0;k < 64;k++) vs_constant_offset_table[C_TRANSFORMMATRICES+k] = 312+4*k;
|
||||
for (k = 0;k < 32;k++) vs_constant_offset_table[C_NORMALMATRICES+k] = 568+4*k;
|
||||
for (k = 0;k < 64;k++) vs_constant_offset_table[C_POSTTRANSFORMMATRICES+k] = 696+4*k;
|
||||
for (k = 0;k < 4;k++) vs_constant_offset_table[C_DEPTHPARAMS+k] = 952+4*k;
|
||||
vs_constant_offset_table[C_DEPTHPARAMS] = 952;
|
||||
|
||||
if (!File::Exists(File::GetUserPath(D_SHADERCACHE_IDX)))
|
||||
File::CreateDir(File::GetUserPath(D_SHADERCACHE_IDX).c_str());
|
||||
|
@ -35,6 +35,7 @@
|
||||
#include "Debugger/DebuggerPanel.h"
|
||||
#include "DLCache.h"
|
||||
#include "EmuWindow.h"
|
||||
#include "IndexGenerator.h"
|
||||
#include "FileUtil.h"
|
||||
#include "Globals.h"
|
||||
#include "IniFile.h"
|
||||
@ -96,6 +97,7 @@ void InitBackendInfo()
|
||||
g_Config.backend_info.bSupportsDualSourceBlend = true;
|
||||
g_Config.backend_info.bSupportsFormatReinterpretation = true;
|
||||
g_Config.backend_info.bSupportsPixelLighting = true;
|
||||
g_Config.backend_info.bSupportsPrimitiveRestart = true;
|
||||
|
||||
IDXGIFactory* factory;
|
||||
IDXGIAdapter* ad;
|
||||
@ -119,9 +121,9 @@ void InitBackendInfo()
|
||||
modes = DX11::D3D::EnumAAModes(ad);
|
||||
for (unsigned int i = 0; i < modes.size(); ++i)
|
||||
{
|
||||
if (i == 0) sprintf_s(buf, 32, "None");
|
||||
else if (modes[i].Quality) sprintf_s(buf, 32, "%d samples (quality level %d)", modes[i].Count, modes[i].Quality);
|
||||
else sprintf_s(buf, 32, "%d samples", modes[i].Count);
|
||||
if (i == 0) sprintf_s(buf, 32, _trans("None"));
|
||||
else if (modes[i].Quality) sprintf_s(buf, 32, _trans("%d samples (quality level %d)"), modes[i].Count, modes[i].Quality);
|
||||
else sprintf_s(buf, 32, _trans("%d samples"), modes[i].Count);
|
||||
g_Config.backend_info.AAModes.push_back(buf);
|
||||
}
|
||||
}
|
||||
@ -192,6 +194,7 @@ void VideoBackend::Video_Prepare()
|
||||
// VideoCommon
|
||||
BPInit();
|
||||
Fifo_Init();
|
||||
IndexGenerator::Init();
|
||||
VertexLoaderManager::Init();
|
||||
OpcodeDecoder_Init();
|
||||
VertexShaderManager::Init();
|
||||
|
@ -199,6 +199,7 @@
|
||||
<ClCompile Include="Src\FramebufferManager.cpp" />
|
||||
<ClCompile Include="Src\main.cpp" />
|
||||
<ClCompile Include="Src\NativeVertexFormat.cpp" />
|
||||
<ClCompile Include="Src\PerfQuery.cpp" />
|
||||
<ClCompile Include="Src\PixelShaderCache.cpp" />
|
||||
<ClCompile Include="Src\Render.cpp" />
|
||||
<ClCompile Include="Src\stdafx.cpp">
|
||||
@ -222,6 +223,7 @@
|
||||
<ClInclude Include="Src\FramebufferManager.h" />
|
||||
<ClInclude Include="Src\Globals.h" />
|
||||
<ClInclude Include="Src\main.h" />
|
||||
<ClInclude Include="Src\PerfQuery.h" />
|
||||
<ClInclude Include="Src\PixelShaderCache.h" />
|
||||
<ClInclude Include="Src\Render.h" />
|
||||
<ClInclude Include="Src\stdafx.h" />
|
||||
|
@ -39,6 +39,9 @@
|
||||
<ClCompile Include="Src\TextureConverter.cpp">
|
||||
<Filter>D3D</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Src\PerfQuery.cpp">
|
||||
<Filter>Render</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="Src\Globals.h" />
|
||||
@ -78,6 +81,9 @@
|
||||
<ClInclude Include="Src\TextureConverter.h">
|
||||
<Filter>D3D</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Src\PerfQuery.h">
|
||||
<Filter>Render</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Filter Include="D3D">
|
||||
|
@ -114,9 +114,9 @@ private:
|
||||
color_surface_Format(D3DFMT_UNKNOWN), depth_surface_Format(D3DFMT_UNKNOWN),
|
||||
depth_ReadBuffer_Format(D3DFMT_UNKNOWN) {}
|
||||
|
||||
LPDIRECT3DTEXTURE9 color_texture;//Texture thats contains the color data of the render target
|
||||
LPDIRECT3DTEXTURE9 color_texture;//Texture that contains the color data of the render target
|
||||
LPDIRECT3DTEXTURE9 colorRead_texture;//1 pixel texture for temporal data store
|
||||
LPDIRECT3DTEXTURE9 depth_texture;//Texture thats contains the depth data of the render target
|
||||
LPDIRECT3DTEXTURE9 depth_texture;//Texture that contains the depth data of the render target
|
||||
LPDIRECT3DTEXTURE9 depthRead_texture;//4 pixel texture for temporal data store
|
||||
|
||||
LPDIRECT3DTEXTURE9 color_reinterpret_texture;//buffer used for ReinterpretPixelData
|
||||
@ -126,8 +126,8 @@ private:
|
||||
LPDIRECT3DSURFACE9 color_surface;//Color Surface
|
||||
LPDIRECT3DSURFACE9 color_ReadBuffer;//Surface 0 of colorRead_texture
|
||||
LPDIRECT3DSURFACE9 depth_ReadBuffer;//Surface 0 of depthRead_texture
|
||||
LPDIRECT3DSURFACE9 color_OffScreenReadBuffer;//System memory Surface that can be locked to retriebe the data
|
||||
LPDIRECT3DSURFACE9 depth_OffScreenReadBuffer;//System memory Surface that can be locked to retriebe the data
|
||||
LPDIRECT3DSURFACE9 color_OffScreenReadBuffer;//System memory Surface that can be locked to retrieve the data
|
||||
LPDIRECT3DSURFACE9 depth_OffScreenReadBuffer;//System memory Surface that can be locked to retrieve the data
|
||||
|
||||
D3DFORMAT color_surface_Format;//Format of the color Surface
|
||||
D3DFORMAT depth_surface_Format;//Format of the Depth Surface
|
||||
|
@ -187,7 +187,7 @@ void D3DVertexFormat::SetupVertexPointers()
|
||||
if (d3d_decl)
|
||||
DX9::D3D::SetVertexDeclaration(d3d_decl);
|
||||
else
|
||||
ERROR_LOG(VIDEO, "invalid d3d decl");
|
||||
ERROR_LOG(VIDEO, "Invalid D3D decl");
|
||||
}
|
||||
|
||||
} // namespace DX9
|
||||
|
155
Source/Plugins/Plugin_VideoDX9/Src/PerfQuery.cpp
Normal file
155
Source/Plugins/Plugin_VideoDX9/Src/PerfQuery.cpp
Normal file
@ -0,0 +1,155 @@
|
||||
#include "RenderBase.h"
|
||||
|
||||
#include "D3DBase.h"
|
||||
#include "PerfQuery.h"
|
||||
|
||||
namespace DX9 {
|
||||
|
||||
PerfQuery::PerfQuery()
|
||||
: m_query_read_pos()
|
||||
, m_query_count()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
PerfQuery::~PerfQuery()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void PerfQuery::CreateDeviceObjects()
|
||||
{
|
||||
for (int i = 0; i != ARRAYSIZE(m_query_buffer); ++i)
|
||||
{
|
||||
D3D::dev->CreateQuery(D3DQUERYTYPE_OCCLUSION, &m_query_buffer[i].query);
|
||||
}
|
||||
ResetQuery();
|
||||
}
|
||||
void PerfQuery::DestroyDeviceObjects()
|
||||
{
|
||||
for (int i = 0; i != ARRAYSIZE(m_query_buffer); ++i)
|
||||
{
|
||||
m_query_buffer[i].query->Release();
|
||||
}
|
||||
}
|
||||
|
||||
void PerfQuery::EnableQuery(PerfQueryGroup type)
|
||||
{
|
||||
// Is this sane?
|
||||
if (m_query_count > ARRAYSIZE(m_query_buffer) / 2)
|
||||
WeakFlush();
|
||||
|
||||
if (ARRAYSIZE(m_query_buffer) == m_query_count)
|
||||
{
|
||||
// TODO
|
||||
FlushOne();
|
||||
ERROR_LOG(VIDEO, "Flushed query buffer early!");
|
||||
}
|
||||
|
||||
// start query
|
||||
if (type == PQG_ZCOMP_ZCOMPLOC || type == PQG_ZCOMP)
|
||||
{
|
||||
auto& entry = m_query_buffer[(m_query_read_pos + m_query_count) % ARRAYSIZE(m_query_buffer)];
|
||||
entry.query->Issue(D3DISSUE_BEGIN);
|
||||
entry.query_type = type;
|
||||
++m_query_count;
|
||||
}
|
||||
}
|
||||
|
||||
void PerfQuery::DisableQuery(PerfQueryGroup type)
|
||||
{
|
||||
// stop query
|
||||
if (type == PQG_ZCOMP_ZCOMPLOC || type == PQG_ZCOMP)
|
||||
{
|
||||
auto& entry = m_query_buffer[(m_query_read_pos + m_query_count + ARRAYSIZE(m_query_buffer)-1) % ARRAYSIZE(m_query_buffer)];
|
||||
entry.query->Issue(D3DISSUE_END);
|
||||
}
|
||||
}
|
||||
|
||||
void PerfQuery::ResetQuery()
|
||||
{
|
||||
m_query_count = 0;
|
||||
std::fill_n(m_results, ARRAYSIZE(m_results), 0);
|
||||
}
|
||||
|
||||
u32 PerfQuery::GetQueryResult(PerfQueryType type)
|
||||
{
|
||||
u32 result = 0;
|
||||
|
||||
if (type == PQ_ZCOMP_INPUT_ZCOMPLOC || type == PQ_ZCOMP_OUTPUT_ZCOMPLOC)
|
||||
{
|
||||
result = m_results[PQG_ZCOMP_ZCOMPLOC];
|
||||
}
|
||||
else if (type == PQ_ZCOMP_INPUT || type == PQ_ZCOMP_OUTPUT)
|
||||
{
|
||||
result = m_results[PQG_ZCOMP];
|
||||
}
|
||||
else if (type == PQ_BLEND_INPUT)
|
||||
{
|
||||
result = m_results[PQG_ZCOMP] + m_results[PQG_ZCOMP_ZCOMPLOC];
|
||||
}
|
||||
else if (type == PQ_EFB_COPY_CLOCKS)
|
||||
{
|
||||
result = m_results[PQG_EFB_COPY_CLOCKS];
|
||||
}
|
||||
|
||||
return result / 4;
|
||||
}
|
||||
|
||||
void PerfQuery::FlushOne()
|
||||
{
|
||||
auto& entry = m_query_buffer[m_query_read_pos];
|
||||
|
||||
DWORD result = 0;
|
||||
HRESULT hr = S_FALSE;
|
||||
while (hr != S_OK && hr != D3DERR_DEVICELOST)
|
||||
{
|
||||
// TODO: Might cause us to be stuck in an infinite loop!
|
||||
hr = entry.query->GetData(&result, sizeof(result), D3DGETDATA_FLUSH);
|
||||
}
|
||||
|
||||
// NOTE: Reported pixel metrics should be referenced to native resolution
|
||||
m_results[entry.query_type] += (u32)((u64)result * EFB_WIDTH / g_renderer->GetTargetWidth() * EFB_HEIGHT / g_renderer->GetTargetHeight());
|
||||
|
||||
m_query_read_pos = (m_query_read_pos + 1) % ARRAYSIZE(m_query_buffer);
|
||||
--m_query_count;
|
||||
}
|
||||
|
||||
// TODO: could selectively flush things, but I don't think that will do much
|
||||
void PerfQuery::FlushResults()
|
||||
{
|
||||
while (!IsFlushed())
|
||||
FlushOne();
|
||||
}
|
||||
|
||||
void PerfQuery::WeakFlush()
|
||||
{
|
||||
while (!IsFlushed())
|
||||
{
|
||||
auto& entry = m_query_buffer[m_query_read_pos];
|
||||
|
||||
DWORD result = 0;
|
||||
HRESULT hr = entry.query->GetData(&result, sizeof(result), 0);
|
||||
|
||||
if (hr == S_OK)
|
||||
{
|
||||
// NOTE: Reported pixel metrics should be referenced to native resolution
|
||||
m_results[entry.query_type] += (u32)((u64)result * EFB_WIDTH / g_renderer->GetTargetWidth() * EFB_HEIGHT / g_renderer->GetTargetHeight());
|
||||
|
||||
m_query_read_pos = (m_query_read_pos + 1) % ARRAYSIZE(m_query_buffer);
|
||||
--m_query_count;
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool PerfQuery::IsFlushed() const
|
||||
{
|
||||
return 0 == m_query_count;
|
||||
}
|
||||
|
||||
|
||||
} // namespace
|
47
Source/Plugins/Plugin_VideoDX9/Src/PerfQuery.h
Normal file
47
Source/Plugins/Plugin_VideoDX9/Src/PerfQuery.h
Normal file
@ -0,0 +1,47 @@
|
||||
#ifndef _PERFQUERY_H_
|
||||
#define _PERFQUERY_H_
|
||||
|
||||
#include "PerfQueryBase.h"
|
||||
|
||||
namespace DX9 {
|
||||
|
||||
class PerfQuery : public PerfQueryBase
|
||||
{
|
||||
public:
|
||||
PerfQuery();
|
||||
~PerfQuery();
|
||||
|
||||
void EnableQuery(PerfQueryGroup type);
|
||||
void DisableQuery(PerfQueryGroup type);
|
||||
void ResetQuery();
|
||||
u32 GetQueryResult(PerfQueryType type);
|
||||
void FlushResults();
|
||||
bool IsFlushed() const;
|
||||
void CreateDeviceObjects();
|
||||
void DestroyDeviceObjects();
|
||||
|
||||
private:
|
||||
struct ActiveQuery
|
||||
{
|
||||
IDirect3DQuery9* query;
|
||||
PerfQueryGroup query_type;
|
||||
};
|
||||
|
||||
void WeakFlush();
|
||||
// Only use when non-empty
|
||||
void FlushOne();
|
||||
|
||||
// when testing in SMS: 64 was too small, 128 was ok
|
||||
static const int PERF_QUERY_BUFFER_SIZE = 512;
|
||||
|
||||
ActiveQuery m_query_buffer[PERF_QUERY_BUFFER_SIZE];
|
||||
int m_query_read_pos;
|
||||
|
||||
// TODO: sloppy
|
||||
volatile int m_query_count;
|
||||
volatile u32 m_results[PQG_NUM_MEMBERS];
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
#endif // _PERFQUERY_H_
|
@ -55,7 +55,7 @@
|
||||
#include "BPFunctions.h"
|
||||
#include "FPSCounter.h"
|
||||
#include "ConfigManager.h"
|
||||
|
||||
#include "PerfQuery.h"
|
||||
#include <strsafe.h>
|
||||
|
||||
|
||||
@ -68,7 +68,7 @@ static u32 s_blendMode;
|
||||
static u32 s_LastAA;
|
||||
static bool IS_AMD;
|
||||
static float m_fMaxPointSize;
|
||||
|
||||
static bool s_vsync;
|
||||
static char *st;
|
||||
|
||||
static LPDIRECT3DSURFACE9 ScreenShootMEMSurface = NULL;
|
||||
@ -88,6 +88,7 @@ void SetupDeviceObjects()
|
||||
VertexShaderCache::Init();
|
||||
PixelShaderCache::Init();
|
||||
g_vertex_manager->CreateDeviceObjects();
|
||||
((PerfQuery*)g_perf_query)->CreateDeviceObjects();
|
||||
// Texture cache will recreate themselves over time.
|
||||
}
|
||||
|
||||
@ -100,6 +101,7 @@ void TeardownDeviceObjects()
|
||||
D3D::dev->SetRenderTarget(0, D3D::GetBackBufferSurface());
|
||||
D3D::dev->SetDepthStencilSurface(D3D::GetBackBufferDepthSurface());
|
||||
delete g_framebuffer_manager;
|
||||
((PerfQuery*)g_perf_query)->DestroyDeviceObjects();
|
||||
D3D::font.Shutdown();
|
||||
TextureCache::Invalidate();
|
||||
VertexLoaderManager::Shutdown();
|
||||
@ -190,7 +192,8 @@ Renderer::Renderer()
|
||||
D3D::dev->CreateOffscreenPlainSurface(s_backbuffer_width,s_backbuffer_height, D3DFMT_X8R8G8B8, D3DPOOL_SYSTEMMEM, &ScreenShootMEMSurface, NULL );
|
||||
D3D::SetRenderState(D3DRS_POINTSCALEENABLE,false);
|
||||
m_fMaxPointSize = D3D::GetCaps().MaxPointSize;
|
||||
|
||||
// Handle VSync on/off
|
||||
s_vsync = g_ActiveConfig.IsVSync();
|
||||
}
|
||||
|
||||
Renderer::~Renderer()
|
||||
@ -452,7 +455,8 @@ u32 Renderer::AccessEFB(EFBAccessType type, u32 x, u32 y, u32 poke_data)
|
||||
}
|
||||
else if(type == PEEK_COLOR)
|
||||
{
|
||||
// TODO: Can't we directly StretchRect to System buf?
|
||||
// We can't directly StretchRect to System buf because is not supported by all implementations
|
||||
// this is the only safe path that works in most cases
|
||||
hr = D3D::dev->StretchRect(pEFBSurf, &RectToLock, pBufferRT, NULL, D3DTEXF_NONE);
|
||||
D3D::dev->GetRenderTargetData(pBufferRT, pSystemBuf);
|
||||
|
||||
@ -661,49 +665,78 @@ void Renderer::SetBlendMode(bool forceUpdate)
|
||||
// Our render target always uses an alpha channel, so we need to override the blend functions to assume a destination alpha of 1 if the render target isn't supposed to have an alpha channel
|
||||
// Example: D3DBLEND_DESTALPHA needs to be D3DBLEND_ONE since the result without an alpha channel is assumed to always be 1.
|
||||
bool target_has_alpha = bpmem.zcontrol.pixel_format == PIXELFMT_RGBA6_Z24;
|
||||
//bDstAlphaPass is taken into account because the ability to disable alpha composition is
|
||||
//really useful for debugging shader and blending errors
|
||||
bool use_DstAlpha = !g_ActiveConfig.bDstAlphaPass && bpmem.dstalpha.enable && bpmem.blendmode.alphaupdate && target_has_alpha;
|
||||
bool use_DualSource = use_DstAlpha && g_ActiveConfig.backend_info.bSupportsDualSourceBlend;
|
||||
const D3DBLEND d3dSrcFactors[8] =
|
||||
{
|
||||
D3DBLEND_ZERO,
|
||||
D3DBLEND_ONE,
|
||||
D3DBLEND_DESTCOLOR,
|
||||
D3DBLEND_INVDESTCOLOR,
|
||||
D3DBLEND_SRCALPHA,
|
||||
D3DBLEND_INVSRCALPHA,
|
||||
(target_has_alpha) ? D3DBLEND_DESTALPHA : D3DBLEND_ONE,
|
||||
(target_has_alpha) ? D3DBLEND_INVDESTALPHA : D3DBLEND_ZERO
|
||||
};
|
||||
{
|
||||
D3DBLEND_ZERO,
|
||||
D3DBLEND_ONE,
|
||||
D3DBLEND_DESTCOLOR,
|
||||
D3DBLEND_INVDESTCOLOR,
|
||||
(use_DualSource) ? D3DBLEND_SRCCOLOR2 : D3DBLEND_SRCALPHA,
|
||||
(use_DualSource) ? D3DBLEND_INVSRCCOLOR2 : D3DBLEND_INVSRCALPHA,
|
||||
(target_has_alpha) ? D3DBLEND_DESTALPHA : D3DBLEND_ONE,
|
||||
(target_has_alpha) ? D3DBLEND_INVDESTALPHA : D3DBLEND_ZERO
|
||||
};
|
||||
const D3DBLEND d3dDestFactors[8] =
|
||||
{
|
||||
D3DBLEND_ZERO,
|
||||
D3DBLEND_ONE,
|
||||
D3DBLEND_SRCCOLOR,
|
||||
D3DBLEND_INVSRCCOLOR,
|
||||
D3DBLEND_SRCALPHA,
|
||||
D3DBLEND_INVSRCALPHA,
|
||||
(target_has_alpha) ? D3DBLEND_DESTALPHA : D3DBLEND_ONE,
|
||||
(target_has_alpha) ? D3DBLEND_INVDESTALPHA : D3DBLEND_ZERO
|
||||
};
|
||||
D3DBLEND_SRCCOLOR,
|
||||
D3DBLEND_INVSRCCOLOR,
|
||||
(use_DualSource) ? D3DBLEND_SRCCOLOR2 : D3DBLEND_SRCALPHA,
|
||||
(use_DualSource) ? D3DBLEND_INVSRCCOLOR2 : D3DBLEND_INVSRCALPHA,
|
||||
(target_has_alpha) ? D3DBLEND_DESTALPHA : D3DBLEND_ONE,
|
||||
(target_has_alpha) ? D3DBLEND_INVDESTALPHA : D3DBLEND_ZERO
|
||||
};
|
||||
|
||||
if (bpmem.blendmode.logicopenable && !forceUpdate)
|
||||
{
|
||||
D3D::SetRenderState(D3DRS_SEPARATEALPHABLENDENABLE , false);
|
||||
return;
|
||||
}
|
||||
|
||||
if (bpmem.blendmode.subtract && bpmem.blendmode.blendenable)
|
||||
{
|
||||
D3D::SetRenderState(D3DRS_ALPHABLENDENABLE, true);
|
||||
D3D::SetRenderState(D3DRS_BLENDOP, D3DBLENDOP_REVSUBTRACT);
|
||||
D3D::SetRenderState(D3DRS_SRCBLEND, d3dSrcFactors[1]);
|
||||
D3D::SetRenderState(D3DRS_DESTBLEND, d3dDestFactors[1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
D3D::SetRenderState(D3DRS_ALPHABLENDENABLE, bpmem.blendmode.blendenable);
|
||||
if (bpmem.blendmode.blendenable)
|
||||
bool blend_enable = bpmem.blendmode.subtract || bpmem.blendmode.blendenable;
|
||||
D3D::SetRenderState(D3DRS_ALPHABLENDENABLE, blend_enable);
|
||||
D3D::SetRenderState(D3DRS_SEPARATEALPHABLENDENABLE, blend_enable && g_ActiveConfig.backend_info.bSupportsSeparateAlphaFunction);
|
||||
if (blend_enable)
|
||||
{
|
||||
D3DBLENDOP op = D3DBLENDOP_ADD;
|
||||
u32 srcidx = bpmem.blendmode.srcfactor;
|
||||
u32 dstidx = bpmem.blendmode.dstfactor;
|
||||
if (bpmem.blendmode.subtract)
|
||||
{
|
||||
op = D3DBLENDOP_REVSUBTRACT;
|
||||
srcidx = GX_BL_ONE;
|
||||
dstidx = GX_BL_ONE;
|
||||
}
|
||||
D3D::SetRenderState(D3DRS_BLENDOP, op);
|
||||
D3D::SetRenderState(D3DRS_SRCBLEND, d3dSrcFactors[srcidx]);
|
||||
D3D::SetRenderState(D3DRS_DESTBLEND, d3dDestFactors[dstidx]);
|
||||
if (g_ActiveConfig.backend_info.bSupportsSeparateAlphaFunction)
|
||||
{
|
||||
D3D::SetRenderState(D3DRS_BLENDOP, D3DBLENDOP_ADD);
|
||||
D3D::SetRenderState(D3DRS_SRCBLEND, d3dSrcFactors[bpmem.blendmode.srcfactor]);
|
||||
D3D::SetRenderState(D3DRS_DESTBLEND, d3dDestFactors[bpmem.blendmode.dstfactor]);
|
||||
}
|
||||
}
|
||||
if (use_DualSource)
|
||||
{
|
||||
op = D3DBLENDOP_ADD;
|
||||
srcidx = GX_BL_ONE;
|
||||
dstidx = GX_BL_ZERO;
|
||||
}
|
||||
else
|
||||
{
|
||||
// we can't use D3DBLEND_DESTCOLOR or D3DBLEND_INVDESTCOLOR for source in alpha channel so use their alpha equivalent instead
|
||||
if (srcidx == GX_BL_DSTCLR) srcidx = GX_BL_DSTALPHA;
|
||||
if (srcidx == GX_BL_INVDSTCLR) srcidx = GX_BL_INVDSTALPHA;
|
||||
// we can't use D3DBLEND_SRCCOLOR or D3DBLEND_INVSRCCOLOR for destination in alpha channel so use their alpha equivalent instead
|
||||
if (dstidx == GX_BL_SRCCLR) dstidx = GX_BL_SRCALPHA;
|
||||
if (dstidx == GX_BL_INVSRCCLR) dstidx = GX_BL_INVSRCALPHA;
|
||||
}
|
||||
D3D::SetRenderState(D3DRS_BLENDOPALPHA, op);
|
||||
D3D::SetRenderState(D3DRS_SRCBLENDALPHA, d3dSrcFactors[srcidx]);
|
||||
D3D::SetRenderState(D3DRS_DESTBLENDALPHA, d3dDestFactors[dstidx]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool Renderer::SaveScreenshot(const std::string &filename, const TargetRectangle &dst_rect)
|
||||
@ -1008,7 +1041,8 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons
|
||||
|
||||
DLCache::ProgressiveCleanup();
|
||||
TextureCache::Cleanup();
|
||||
|
||||
// Flip/present backbuffer to frontbuffer here
|
||||
D3D::Present();
|
||||
// Enable configuration changes
|
||||
UpdateActiveConfig();
|
||||
TextureCache::OnConfigChanged(g_ActiveConfig);
|
||||
@ -1067,8 +1101,15 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons
|
||||
// New frame
|
||||
stats.ResetFrame();
|
||||
|
||||
// Flip/present backbuffer to frontbuffer here
|
||||
D3D::Present();
|
||||
// Handle vsync changes during execution
|
||||
if(s_vsync != g_ActiveConfig.IsVSync())
|
||||
{
|
||||
s_vsync = g_ActiveConfig.IsVSync();
|
||||
TeardownDeviceObjects();
|
||||
D3D::Reset();
|
||||
// device objects lost, so recreate all of them
|
||||
SetupDeviceObjects();
|
||||
}
|
||||
D3D::BeginFrame();
|
||||
RestoreAPIState();
|
||||
|
||||
@ -1084,14 +1125,16 @@ void Renderer::ApplyState(bool bUseDstAlpha)
|
||||
{
|
||||
if (bUseDstAlpha)
|
||||
{
|
||||
// TODO: WTF is this crap? We're enabling color writing regardless of the actual GPU state here...
|
||||
// If we get here we are sure that we are using dst alpha pass. (bpmem.dstalpha.enable)
|
||||
// Alpha write is enabled. (because bpmem.blendmode.alphaupdate && bpmem.zcontrol.pixel_format == PIXELFMT_RGBA6_Z24)
|
||||
// We must disable blend because we want to write alpha value directly to the alpha channel without modifications.
|
||||
D3D::ChangeRenderState(D3DRS_COLORWRITEENABLE, D3DCOLORWRITEENABLE_ALPHA);
|
||||
D3D::ChangeRenderState(D3DRS_ALPHABLENDENABLE, false);
|
||||
if(bpmem.zmode.testenable && bpmem.zmode.updateenable)
|
||||
{
|
||||
//This is needed to draw to the correct pixels in multi-pass algorithms
|
||||
//this avoid z-figthing and grants that you write to the same pixels
|
||||
//affected by the last pass
|
||||
// This is needed to draw to the correct pixels in multi-pass algorithms
|
||||
// to avoid z-fighting and grants that you write to the same pixels
|
||||
// affected by the last pass
|
||||
D3D::ChangeRenderState(D3DRS_ZWRITEENABLE, false);
|
||||
D3D::ChangeRenderState(D3DRS_ZFUNC, D3DCMP_EQUAL);
|
||||
}
|
||||
@ -1284,7 +1327,7 @@ void Renderer::SetLineWidth()
|
||||
// We can't change line width in D3D unless we use ID3DXLine
|
||||
float fratio = xfregs.viewport.wd != 0 ? Renderer::EFBToScaledXf(1.f) : 1.0f;
|
||||
float psize = bpmem.lineptwidth.linesize * fratio / 6.0f;
|
||||
//little hack to compensate scalling problems in dx9 must be taken out when scalling is fixed.
|
||||
//little hack to compensate scaling problems in dx9 must be taken out when scaling is fixed.
|
||||
psize *= 2.0f;
|
||||
if (psize > m_fMaxPointSize)
|
||||
{
|
||||
|
@ -353,7 +353,7 @@ void VertexManager::vFlush()
|
||||
PixelShaderManager::SetTexDims(i, tentry->native_width, tentry->native_height, 0, 0);
|
||||
}
|
||||
else
|
||||
ERROR_LOG(VIDEO, "error loading texture");
|
||||
ERROR_LOG(VIDEO, "Error loading texture");
|
||||
}
|
||||
}
|
||||
|
||||
@ -361,7 +361,12 @@ void VertexManager::vFlush()
|
||||
VertexShaderManager::SetConstants();
|
||||
PixelShaderManager::SetConstants();
|
||||
u32 stride = g_nativeVertexFmt->GetVertexStride();
|
||||
if (!PixelShaderCache::SetShader(DSTALPHA_NONE,g_nativeVertexFmt->m_components))
|
||||
bool useDstAlpha = !g_ActiveConfig.bDstAlphaPass && bpmem.dstalpha.enable && bpmem.blendmode.alphaupdate &&
|
||||
bpmem.zcontrol.pixel_format == PIXELFMT_RGBA6_Z24;
|
||||
bool useDualSource = useDstAlpha && g_ActiveConfig.backend_info.bSupportsDualSourceBlend;
|
||||
DSTALPHA_MODE AlphaMode = useDualSource ? DSTALPHA_DUAL_SOURCE_BLEND : DSTALPHA_NONE;
|
||||
|
||||
if (!PixelShaderCache::SetShader(AlphaMode ,g_nativeVertexFmt->m_components))
|
||||
{
|
||||
GFX_DEBUGGER_PAUSE_LOG_AT(NEXT_ERROR,true,{printf("Fail to set pixel shader\n");});
|
||||
goto shader_fail;
|
||||
@ -373,7 +378,8 @@ void VertexManager::vFlush()
|
||||
|
||||
}
|
||||
PrepareDrawBuffers(stride);
|
||||
g_nativeVertexFmt->SetupVertexPointers();
|
||||
g_nativeVertexFmt->SetupVertexPointers();
|
||||
g_perf_query->EnableQuery(bpmem.zcontrol.early_ztest ? PQG_ZCOMP_ZCOMPLOC : PQG_ZCOMP);
|
||||
if(m_buffers_count)
|
||||
{
|
||||
DrawVertexBuffer(stride);
|
||||
@ -382,10 +388,8 @@ void VertexManager::vFlush()
|
||||
{
|
||||
DrawVertexArray(stride);
|
||||
}
|
||||
|
||||
bool useDstAlpha = !g_ActiveConfig.bDstAlphaPass && bpmem.dstalpha.enable && bpmem.blendmode.alphaupdate &&
|
||||
bpmem.zcontrol.pixel_format == PIXELFMT_RGBA6_Z24;
|
||||
if (useDstAlpha)
|
||||
g_perf_query->DisableQuery(bpmem.zcontrol.early_ztest ? PQG_ZCOMP_ZCOMPLOC : PQG_ZCOMP);
|
||||
if (useDstAlpha && !useDualSource)
|
||||
{
|
||||
if (!PixelShaderCache::SetShader(DSTALPHA_ALPHA_PASS, g_nativeVertexFmt->m_components))
|
||||
{
|
||||
|
@ -111,8 +111,7 @@ void VertexShaderCache::Init()
|
||||
"{\n"
|
||||
"VSOUTPUT OUT;"
|
||||
"OUT.vPosition = inPosition;\n"
|
||||
// HACK: Scale the texture coordinate range from (0,width) to (0,width-1), otherwise the linear filter won't average our samples correctly
|
||||
"OUT.vTexCoord = inTEX0 * (float2(1.f,1.f) / inInvTexSize - float2(1.f,1.f)) * inInvTexSize;\n"
|
||||
"OUT.vTexCoord = inTEX0;\n"
|
||||
"OUT.vTexCoord1 = inTEX2;\n"
|
||||
"return OUT;\n"
|
||||
"}\n");
|
||||
|
@ -13,6 +13,7 @@ class VideoBackend : public VideoBackendHardware
|
||||
void Shutdown();
|
||||
|
||||
std::string GetName();
|
||||
std::string GetDisplayName();
|
||||
|
||||
void Video_Prepare();
|
||||
void Video_Cleanup();
|
||||
|
@ -51,13 +51,14 @@
|
||||
#include "VideoState.h"
|
||||
#include "Render.h"
|
||||
#include "DLCache.h"
|
||||
#include "IndexGenerator.h"
|
||||
#include "IniFile.h"
|
||||
#include "Core.h"
|
||||
#include "Host.h"
|
||||
|
||||
#include "ConfigManager.h"
|
||||
#include "VideoBackend.h"
|
||||
#include "PerfQueryBase.h"
|
||||
#include "PerfQuery.h"
|
||||
|
||||
namespace DX9
|
||||
{
|
||||
@ -87,15 +88,24 @@ std::string VideoBackend::GetName()
|
||||
return "Direct3D9";
|
||||
}
|
||||
|
||||
std::string VideoBackend::GetDisplayName()
|
||||
{
|
||||
return "Direct3D9";
|
||||
}
|
||||
|
||||
void InitBackendInfo()
|
||||
{
|
||||
DX9::D3D::Init();
|
||||
const int shaderModel = ((DX9::D3D::GetCaps().PixelShaderVersion >> 8) & 0xFF);
|
||||
D3DCAPS9 device_caps = DX9::D3D::GetCaps();
|
||||
const int shaderModel = ((device_caps.PixelShaderVersion >> 8) & 0xFF);
|
||||
const int maxConstants = (shaderModel < 3) ? 32 : ((shaderModel < 4) ? 224 : 65536);
|
||||
g_Config.backend_info.APIType = shaderModel < 3 ? API_D3D9_SM20 :API_D3D9_SM30;
|
||||
g_Config.backend_info.APIType = shaderModel < 3 ? API_D3D9_SM20 : API_D3D9_SM30;
|
||||
g_Config.backend_info.bUseRGBATextures = false;
|
||||
g_Config.backend_info.bUseMinimalMipCount = true;
|
||||
g_Config.backend_info.bSupports3DVision = true;
|
||||
g_Config.backend_info.bSupportsPrimitiveRestart = false; // TODO: figure out if it does
|
||||
g_Config.backend_info.bSupportsSeparateAlphaFunction = device_caps.PrimitiveMiscCaps & D3DPMISCCAPS_SEPARATEALPHABLEND;
|
||||
// Dual source blend disabled by default until a proper method to test for support is found
|
||||
g_Config.backend_info.bSupportsDualSourceBlend = false;
|
||||
g_Config.backend_info.bSupportsFormatReinterpretation = true;
|
||||
g_Config.backend_info.bSupportsPixelLighting = C_PLIGHTS + 40 <= maxConstants && C_PMATERIALS + 4 <= maxConstants;
|
||||
@ -169,20 +179,20 @@ void VideoBackend::Video_Prepare()
|
||||
|
||||
// internal interfaces
|
||||
g_vertex_manager = new VertexManager;
|
||||
g_perf_query = new PerfQuery;
|
||||
g_renderer = new Renderer;
|
||||
g_texture_cache = new TextureCache;
|
||||
g_perf_query = new PerfQueryBase;
|
||||
g_texture_cache = new TextureCache;
|
||||
// VideoCommon
|
||||
BPInit();
|
||||
Fifo_Init();
|
||||
IndexGenerator::Init();
|
||||
VertexLoaderManager::Init();
|
||||
OpcodeDecoder_Init();
|
||||
VertexShaderManager::Init();
|
||||
PixelShaderManager::Init();
|
||||
CommandProcessor::Init();
|
||||
PixelEngine::Init();
|
||||
DLCache::Init();
|
||||
|
||||
DLCache::Init();
|
||||
// Notify the core that the video backend is ready
|
||||
Host_Message(WM_USER_CREATE);
|
||||
}
|
||||
@ -210,9 +220,9 @@ void VideoBackend::Shutdown()
|
||||
// internal interfaces
|
||||
PixelShaderCache::Shutdown();
|
||||
VertexShaderCache::Shutdown();
|
||||
delete g_perf_query;
|
||||
delete g_texture_cache;
|
||||
delete g_renderer;
|
||||
delete g_perf_query;
|
||||
delete g_vertex_manager;
|
||||
g_renderer = NULL;
|
||||
g_texture_cache = NULL;
|
||||
|
@ -145,7 +145,7 @@ void OpenGL_ReportARBProgramError()
|
||||
{
|
||||
GLint loc = 0;
|
||||
glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &loc);
|
||||
ERROR_LOG(VIDEO, "program error at %d: ", loc);
|
||||
ERROR_LOG(VIDEO, "Program error at %d: ", loc);
|
||||
ERROR_LOG(VIDEO, "%s", (char*)pstr);
|
||||
ERROR_LOG(VIDEO, "\n");
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ void PerfQuery::EnableQuery(PerfQueryGroup type)
|
||||
if (ARRAYSIZE(m_query_buffer) == m_query_count)
|
||||
{
|
||||
FlushOne();
|
||||
//ERROR_LOG(VIDEO, "flushed query buffer early!");
|
||||
//ERROR_LOG(VIDEO, "Flushed query buffer early!");
|
||||
}
|
||||
|
||||
// start query
|
||||
|
@ -165,7 +165,7 @@ void ApplyShader()
|
||||
std::string code;
|
||||
std::string path = File::GetUserPath(D_SHADERS_IDX) + g_ActiveConfig.sPostProcessingShader + ".txt";
|
||||
if(!File::ReadFileToString(true, path.c_str(), code)) {
|
||||
ERROR_LOG(VIDEO, "post-processing shader not found: %s", path.c_str());
|
||||
ERROR_LOG(VIDEO, "Post-processing shader not found: %s", path.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "Debugger.h"
|
||||
#include "Statistics.h"
|
||||
#include "ImageWrite.h"
|
||||
#include "Render.h"
|
||||
|
||||
namespace OGL
|
||||
{
|
||||
@ -122,8 +123,15 @@ void SHADER::SetProgramBindings()
|
||||
glBindFragDataLocationIndexed(glprogid, 0, 0, "ocol0");
|
||||
glBindFragDataLocationIndexed(glprogid, 0, 1, "ocol1");
|
||||
}
|
||||
else
|
||||
else if(g_ogl_config.eSupportedGLSLVersion > GLSL_120)
|
||||
{
|
||||
glBindFragDataLocation(glprogid, 0, "ocol0");
|
||||
}
|
||||
else
|
||||
{
|
||||
// ogl2 shaders don't need to bind output colors.
|
||||
// gl_FragColor already point to color channel
|
||||
}
|
||||
|
||||
// Need to set some attribute locations
|
||||
glBindAttribLocation(glprogid, SHADER_POSITION_ATTRIB, "rawpos");
|
||||
@ -270,7 +278,7 @@ bool ProgramShaderCache::CompileShader ( SHADER& shader, const char* vcode, cons
|
||||
glAttachShader(pid, vsid);
|
||||
glAttachShader(pid, psid);
|
||||
|
||||
if (g_ActiveConfig.backend_info.bSupportsGLSLCache)
|
||||
if (g_ogl_config.bSupportsGLSLCache)
|
||||
glProgramParameteri(pid, GL_PROGRAM_BINARY_RETRIEVABLE_HINT, GL_TRUE);
|
||||
|
||||
shader.SetProgramBindings();
|
||||
@ -406,14 +414,14 @@ void ProgramShaderCache::Init(void)
|
||||
}
|
||||
|
||||
// Read our shader cache, only if supported
|
||||
if (g_ActiveConfig.backend_info.bSupportsGLSLCache)
|
||||
if (g_ogl_config.bSupportsGLSLCache)
|
||||
{
|
||||
GLint Supported;
|
||||
glGetIntegerv(GL_NUM_PROGRAM_BINARY_FORMATS, &Supported);
|
||||
if(!Supported)
|
||||
{
|
||||
ERROR_LOG(VIDEO, "GL_ARB_get_program_binary is supported, but no binary format is known. So disable shader cache.");
|
||||
g_ActiveConfig.backend_info.bSupportsGLSLCache = false;
|
||||
g_ogl_config.bSupportsGLSLCache = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -439,7 +447,7 @@ void ProgramShaderCache::Init(void)
|
||||
void ProgramShaderCache::Shutdown(void)
|
||||
{
|
||||
// store all shaders in cache on disk
|
||||
if (g_ActiveConfig.backend_info.bSupportsGLSLCache)
|
||||
if (g_ogl_config.bSupportsGLSLCache)
|
||||
{
|
||||
PCache::iterator iter = pshaders.begin();
|
||||
for (; iter != pshaders.end(); ++iter)
|
||||
@ -481,32 +489,17 @@ void ProgramShaderCache::Shutdown(void)
|
||||
|
||||
void ProgramShaderCache::CreateHeader ( void )
|
||||
{
|
||||
#ifdef _WIN32
|
||||
// Intel Windows driver has a issue:
|
||||
// their glsl doesn't know about the ubo extension, so we can't load it.
|
||||
// but as version 140, ubo is in core and don't have to be loaded in glsl.
|
||||
// as sandy do ogl3.1, glsl 140 is supported, so force it in this way.
|
||||
// TODO: remove this again when the issue is fixed:
|
||||
// see http://communities.intel.com/thread/36084
|
||||
char *vendor = (char*)glGetString(GL_VENDOR);
|
||||
bool glsl140_hack = strcmp(vendor, "Intel") == 0;
|
||||
#elif __APPLE__
|
||||
// as apple doesn't support glsl130 at all, we also have to use glsl140
|
||||
bool glsl140_hack = true;
|
||||
#else
|
||||
bool glsl140_hack = false;
|
||||
#endif
|
||||
|
||||
GLSL_VERSION v = g_ogl_config.eSupportedGLSLVersion;
|
||||
snprintf(s_glsl_header, sizeof(s_glsl_header),
|
||||
"#version %s\n"
|
||||
"%s\n" // tex_rect
|
||||
"%s\n" // ubo
|
||||
|
||||
"\n"// A few required defines and ones that will make our lives a lot easier
|
||||
"#define ATTRIN in\n"
|
||||
"#define ATTROUT out\n"
|
||||
"#define VARYIN centroid in\n"
|
||||
"#define VARYOUT centroid out\n"
|
||||
"#define ATTRIN %s\n"
|
||||
"#define ATTROUT %s\n"
|
||||
"#define VARYIN %s\n"
|
||||
"#define VARYOUT %s\n"
|
||||
|
||||
// Silly differences
|
||||
"#define float2 vec2\n"
|
||||
@ -518,10 +511,27 @@ void ProgramShaderCache::CreateHeader ( void )
|
||||
"#define saturate(x) clamp(x, 0.0f, 1.0f)\n"
|
||||
"#define lerp(x, y, z) mix(x, y, z)\n"
|
||||
|
||||
// glsl 120 hack
|
||||
"%s\n"
|
||||
"%s\n"
|
||||
"%s\n"
|
||||
"%s\n"
|
||||
"%s\n"
|
||||
"#define COLOROUT(name) %s\n"
|
||||
|
||||
, glsl140_hack ? "140" : "130"
|
||||
, glsl140_hack ? "#define texture2DRect texture" : "#extension GL_ARB_texture_rectangle : enable"
|
||||
, g_ActiveConfig.backend_info.bSupportsGLSLUBO && !glsl140_hack ? "#extension GL_ARB_uniform_buffer_object : enable" : "// ubo disabled"
|
||||
, v==GLSL_120 ? "120" : v==GLSL_130 ? "130" : "140"
|
||||
, v<=GLSL_130 ? "#extension GL_ARB_texture_rectangle : enable" : "#define texture2DRect texture"
|
||||
, g_ActiveConfig.backend_info.bSupportsGLSLUBO && v!=GLSL_140 ? "#extension GL_ARB_uniform_buffer_object : enable" : ""
|
||||
, v==GLSL_120 ? "attribute" : "in"
|
||||
, v==GLSL_120 ? "attribute" : "out"
|
||||
, v==GLSL_120 ? "varying" : "centroid in"
|
||||
, v==GLSL_120 ? "varying" : "centroid out"
|
||||
, v==GLSL_120 ? "#define texture texture2D" : ""
|
||||
, v==GLSL_120 ? "#define round(x) floor((x)+0.5f)" : ""
|
||||
, v==GLSL_120 ? "#define out " : ""
|
||||
, v==GLSL_120 ? "#define ocol0 gl_FragColor" : ""
|
||||
, v==GLSL_120 ? "#define ocol1 gl_FragColor" : "" //TODO: implemenet dual source blend
|
||||
, v==GLSL_120 ? "" : "out vec4 name;"
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -128,9 +128,9 @@ const u8 rasters[char_count][char_height] = {
|
||||
|
||||
static const char *s_vertexShaderSrc =
|
||||
"uniform vec2 charSize;\n"
|
||||
"in vec2 rawpos;\n"
|
||||
"in vec2 tex0;\n"
|
||||
"out vec2 uv0;\n"
|
||||
"ATTRIN vec2 rawpos;\n"
|
||||
"ATTRIN vec2 tex0;\n"
|
||||
"VARYOUT vec2 uv0;\n"
|
||||
"void main(void) {\n"
|
||||
" gl_Position = vec4(rawpos,0,1);\n"
|
||||
" uv0 = tex0 * charSize;\n"
|
||||
@ -139,8 +139,8 @@ static const char *s_vertexShaderSrc =
|
||||
static const char *s_fragmentShaderSrc =
|
||||
"uniform sampler2D samp8;\n"
|
||||
"uniform vec4 color;\n"
|
||||
"in vec2 uv0;\n"
|
||||
"out vec4 ocol0;\n"
|
||||
"VARYIN vec2 uv0;\n"
|
||||
"COLOROUT(ocol0)\n"
|
||||
"void main(void) {\n"
|
||||
" ocol0 = texture(samp8,uv0) * color;\n"
|
||||
"}\n";
|
||||
|
@ -24,7 +24,9 @@
|
||||
#include <cstdio>
|
||||
|
||||
#include "GLUtil.h"
|
||||
#if defined(HAVE_WX) && HAVE_WX
|
||||
#include "WxUtils.h"
|
||||
#endif
|
||||
|
||||
#include "FileUtil.h"
|
||||
|
||||
@ -103,6 +105,21 @@ int OSDInternalW, OSDInternalH;
|
||||
namespace OGL
|
||||
{
|
||||
|
||||
enum MultisampleMode {
|
||||
MULTISAMPLE_OFF,
|
||||
MULTISAMPLE_2X,
|
||||
MULTISAMPLE_4X,
|
||||
MULTISAMPLE_8X,
|
||||
MULTISAMPLE_CSAA_8X,
|
||||
MULTISAMPLE_CSAA_8XQ,
|
||||
MULTISAMPLE_CSAA_16X,
|
||||
MULTISAMPLE_CSAA_16XQ,
|
||||
MULTISAMPLE_SSAA_4X,
|
||||
};
|
||||
|
||||
|
||||
VideoConfig g_ogl_config;
|
||||
|
||||
// Declarations and definitions
|
||||
// ----------------------------
|
||||
static int s_fps = 0;
|
||||
@ -117,9 +134,10 @@ static int s_MSAASamples = 1;
|
||||
static int s_MSAACoverageSamples = 0;
|
||||
static int s_LastMultisampleMode = 0;
|
||||
|
||||
static bool s_bHaveCoverageMSAA = false;
|
||||
static u32 s_blendMode;
|
||||
|
||||
static bool s_vsync;
|
||||
|
||||
#if defined(HAVE_WX) && HAVE_WX
|
||||
static std::thread scrshotThread;
|
||||
#endif
|
||||
@ -133,7 +151,7 @@ static std::vector<u32> s_efbCache[2][EFB_CACHE_WIDTH * EFB_CACHE_HEIGHT]; // 2
|
||||
|
||||
int GetNumMSAASamples(int MSAAMode)
|
||||
{
|
||||
int samples, maxSamples;
|
||||
int samples;
|
||||
switch (MSAAMode)
|
||||
{
|
||||
case MULTISAMPLE_OFF:
|
||||
@ -147,6 +165,7 @@ int GetNumMSAASamples(int MSAAMode)
|
||||
case MULTISAMPLE_4X:
|
||||
case MULTISAMPLE_CSAA_8X:
|
||||
case MULTISAMPLE_CSAA_16X:
|
||||
case MULTISAMPLE_SSAA_4X:
|
||||
samples = 4;
|
||||
break;
|
||||
|
||||
@ -159,12 +178,11 @@ int GetNumMSAASamples(int MSAAMode)
|
||||
default:
|
||||
samples = 1;
|
||||
}
|
||||
glGetIntegerv(GL_MAX_SAMPLES, &maxSamples);
|
||||
|
||||
if(samples <= maxSamples) return samples;
|
||||
if(samples <= g_ogl_config.max_samples) return samples;
|
||||
|
||||
ERROR_LOG(VIDEO, "MSAA Bug: %d samples selected, but only %d supported by gpu.", samples, maxSamples);
|
||||
return maxSamples;
|
||||
ERROR_LOG(VIDEO, "MSAA Bug: %d samples selected, but only %d supported by GPU.", samples, g_ogl_config.max_samples);
|
||||
return g_ogl_config.max_samples;
|
||||
}
|
||||
|
||||
int GetNumMSAACoverageSamples(int MSAAMode)
|
||||
@ -185,12 +203,59 @@ int GetNumMSAACoverageSamples(int MSAAMode)
|
||||
default:
|
||||
samples = 0;
|
||||
}
|
||||
if(s_bHaveCoverageMSAA || samples == 0) return samples;
|
||||
if(g_ogl_config.bSupportCoverageMSAA || samples == 0) return samples;
|
||||
|
||||
ERROR_LOG(VIDEO, "MSAA Bug: CSAA selected, but not supported by gpu.");
|
||||
ERROR_LOG(VIDEO, "MSAA Bug: CSAA selected, but not supported by GPU.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ApplySSAASettings() {
|
||||
if(g_ActiveConfig.iMultisampleMode == MULTISAMPLE_SSAA_4X) {
|
||||
if(g_ogl_config.bSupportSampleShading) {
|
||||
glEnable(GL_SAMPLE_SHADING_ARB);
|
||||
glMinSampleShadingARB(s_MSAASamples);
|
||||
} else {
|
||||
ERROR_LOG(VIDEO, "MSAA Bug: SSAA selected, but not supported by GPU.");
|
||||
}
|
||||
} else if(g_ogl_config.bSupportSampleShading) {
|
||||
glDisable(GL_SAMPLE_SHADING_ARB);
|
||||
}
|
||||
}
|
||||
|
||||
void ErrorCallback( GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const char* message, void* userParam)
|
||||
{
|
||||
const char *s_source;
|
||||
const char *s_type;
|
||||
|
||||
switch(source)
|
||||
{
|
||||
case GL_DEBUG_SOURCE_API_ARB: s_source = "API"; break;
|
||||
case GL_DEBUG_SOURCE_WINDOW_SYSTEM_ARB: s_source = "Window System"; break;
|
||||
case GL_DEBUG_SOURCE_SHADER_COMPILER_ARB: s_source = "Shader Compiler"; break;
|
||||
case GL_DEBUG_SOURCE_THIRD_PARTY_ARB: s_source = "Third Party"; break;
|
||||
case GL_DEBUG_SOURCE_APPLICATION_ARB: s_source = "Application"; break;
|
||||
case GL_DEBUG_SOURCE_OTHER_ARB: s_source = "Other"; break;
|
||||
default: s_source = "Unknown"; break;
|
||||
}
|
||||
switch(type)
|
||||
{
|
||||
case GL_DEBUG_TYPE_ERROR_ARB: s_type = "Error"; break;
|
||||
case GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_ARB: s_type = "Deprecated"; break;
|
||||
case GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_ARB: s_type = "Undefined"; break;
|
||||
case GL_DEBUG_TYPE_PORTABILITY_ARB: s_type = "Portability"; break;
|
||||
case GL_DEBUG_TYPE_PERFORMANCE_ARB: s_type = "Performance"; break;
|
||||
case GL_DEBUG_TYPE_OTHER_ARB: s_type = "Other"; break;
|
||||
default: s_type = "Unknown"; break;
|
||||
}
|
||||
switch(severity)
|
||||
{
|
||||
case GL_DEBUG_SEVERITY_HIGH_ARB: ERROR_LOG(VIDEO, "id: %x, source: %s, type: %s - %s", id, s_source, s_type, message); break;
|
||||
case GL_DEBUG_SEVERITY_MEDIUM_ARB: WARN_LOG(VIDEO, "id: %x, source: %s, type: %s - %s", id, s_source, s_type, message); break;
|
||||
case GL_DEBUG_SEVERITY_LOW_ARB: WARN_LOG(VIDEO, "id: %x, source: %s, type: %s - %s", id, s_source, s_type, message); break;
|
||||
default: ERROR_LOG(VIDEO, "id: %x, source: %s, type: %s - %s", id, s_source, s_type, message); break;
|
||||
}
|
||||
}
|
||||
|
||||
// Init functions
|
||||
Renderer::Renderer()
|
||||
{
|
||||
@ -201,15 +266,6 @@ Renderer::Renderer()
|
||||
s_ShowEFBCopyRegions_VBO = 0;
|
||||
s_blendMode = 0;
|
||||
InitFPSCounter();
|
||||
|
||||
const char* gl_vendor = (const char*)glGetString(GL_VENDOR);
|
||||
const char* gl_renderer = (const char*)glGetString(GL_RENDERER);
|
||||
const char* gl_version = (const char*)glGetString(GL_VERSION);
|
||||
|
||||
OSD::AddMessage(StringFromFormat("Video Info: %s, %s, %s",
|
||||
gl_vendor,
|
||||
gl_renderer,
|
||||
gl_version).c_str(), 5000);
|
||||
|
||||
bool bSuccess = true;
|
||||
GLint numvertexattribs = 0;
|
||||
@ -231,6 +287,15 @@ Renderer::Renderer()
|
||||
ERROR_LOG(VIDEO, "glewInit() failed! Does your video card support OpenGL 2.x?");
|
||||
return; // TODO: fail
|
||||
}
|
||||
|
||||
#if defined(_DEBUG) || defined(DEBUGFAST)
|
||||
if (GLEW_ARB_debug_output)
|
||||
{
|
||||
glDebugMessageControlARB(GL_DONT_CARE, GL_DONT_CARE, GL_DONT_CARE, 0, NULL, true);
|
||||
glDebugMessageCallbackARB( ErrorCallback, NULL );
|
||||
glEnable( GL_DEBUG_OUTPUT );
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!GLEW_EXT_secondary_color)
|
||||
{
|
||||
@ -268,54 +333,96 @@ Renderer::Renderer()
|
||||
bSuccess = false;
|
||||
}
|
||||
|
||||
s_bHaveCoverageMSAA = GLEW_NV_framebuffer_multisample_coverage;
|
||||
if (!bSuccess)
|
||||
return; // TODO: fail
|
||||
|
||||
g_Config.backend_info.bSupportsDualSourceBlend = GLEW_ARB_blend_func_extended;
|
||||
g_Config.backend_info.bSupportsGLSLUBO = GLEW_ARB_uniform_buffer_object;
|
||||
g_Config.backend_info.bSupportsGLPinnedMemory = GLEW_AMD_pinned_memory;
|
||||
g_Config.backend_info.bSupportsGLSync = GLEW_ARB_sync;
|
||||
g_Config.backend_info.bSupportsGLSLCache = GLEW_ARB_get_program_binary;
|
||||
g_Config.backend_info.bSupportsGLBaseVertex = GLEW_ARB_draw_elements_base_vertex;
|
||||
g_Config.backend_info.bSupportsPrimitiveRestart = GLEW_VERSION_3_1 || GLEW_NV_primitive_restart;
|
||||
|
||||
g_ogl_config.bSupportsGLSLCache = GLEW_ARB_get_program_binary;
|
||||
g_ogl_config.bSupportsGLPinnedMemory = GLEW_AMD_pinned_memory;
|
||||
g_ogl_config.bSupportsGLSync = GLEW_ARB_sync;
|
||||
g_ogl_config.bSupportsGLBaseVertex = GLEW_ARB_draw_elements_base_vertex;
|
||||
g_ogl_config.bSupportCoverageMSAA = GLEW_NV_framebuffer_multisample_coverage;
|
||||
g_ogl_config.bSupportSampleShading = GLEW_ARB_sample_shading;
|
||||
g_ogl_config.bSupportOGL31 = GLEW_VERSION_3_1;
|
||||
|
||||
g_ogl_config.gl_vendor = (const char*)glGetString(GL_VENDOR);
|
||||
g_ogl_config.gl_renderer = (const char*)glGetString(GL_RENDERER);
|
||||
g_ogl_config.gl_version = (const char*)glGetString(GL_VERSION);
|
||||
g_ogl_config.glsl_version = (const char*)glGetString(GL_SHADING_LANGUAGE_VERSION);
|
||||
|
||||
if(strstr(g_ogl_config.glsl_version, "1.00") || strstr(g_ogl_config.glsl_version, "1.10"))
|
||||
{
|
||||
ERROR_LOG(VIDEO, "GPU: OGL ERROR: Need at least GLSL 1.20\n"
|
||||
"GPU: Does your video card support OpenGL 2.1?\n"
|
||||
"GPU: Your driver supports glsl %s", g_ogl_config.glsl_version);
|
||||
bSuccess = false;
|
||||
}
|
||||
else if(strstr(g_ogl_config.glsl_version, "1.20"))
|
||||
{
|
||||
g_ogl_config.eSupportedGLSLVersion = GLSL_120;
|
||||
g_Config.backend_info.bSupportsDualSourceBlend = false; //TODO: implemenet dual source blend
|
||||
}
|
||||
else if(strstr(g_ogl_config.glsl_version, "1.30"))
|
||||
{
|
||||
g_ogl_config.eSupportedGLSLVersion = GLSL_130;
|
||||
}
|
||||
else
|
||||
{
|
||||
g_ogl_config.eSupportedGLSLVersion = GLSL_140;
|
||||
}
|
||||
|
||||
glGetIntegerv(GL_MAX_SAMPLES, &g_ogl_config.max_samples);
|
||||
if(g_ogl_config.max_samples < 1)
|
||||
g_ogl_config.max_samples = 1;
|
||||
|
||||
if(g_Config.backend_info.bSupportsGLSLUBO && (
|
||||
// hd3000 get corruption, hd4000 also and a big slowdown
|
||||
!strcmp(gl_vendor, "Intel Open Source Technology Center") && (!strcmp(gl_version, "3.0 Mesa 9.0.0") || !strcmp(gl_version, "3.0 Mesa 9.0.1") || !strcmp(gl_version, "3.0 Mesa 9.0.2") || !strcmp(gl_version, "3.0 Mesa 9.0.3") || !strcmp(gl_version, "3.0 Mesa 9.1.0") )
|
||||
!strcmp(g_ogl_config.gl_vendor, "Intel Open Source Technology Center") && (
|
||||
!strcmp(g_ogl_config.gl_version, "3.0 Mesa 9.0.0") ||
|
||||
!strcmp(g_ogl_config.gl_version, "3.0 Mesa 9.0.1") ||
|
||||
!strcmp(g_ogl_config.gl_version, "3.0 Mesa 9.0.2") ||
|
||||
!strcmp(g_ogl_config.gl_version, "3.0 Mesa 9.0.3") ||
|
||||
!strcmp(g_ogl_config.gl_version, "3.0 Mesa 9.1.0") ||
|
||||
!strcmp(g_ogl_config.gl_version, "3.0 Mesa 9.1.1") )
|
||||
)) {
|
||||
g_Config.backend_info.bSupportsGLSLUBO = false;
|
||||
ERROR_LOG(VIDEO, "buggy driver detected. Disable UBO");
|
||||
ERROR_LOG(VIDEO, "Buggy driver detected. Disable UBO");
|
||||
}
|
||||
|
||||
#ifndef _WIN32
|
||||
if(g_Config.backend_info.bSupportsGLPinnedMemory && !strcmp(gl_vendor, "Advanced Micro Devices, Inc.")) {
|
||||
g_Config.backend_info.bSupportsGLPinnedMemory = false;
|
||||
ERROR_LOG(VIDEO, "some fglrx versions have broken pinned memory support, so it's disabled for fglrx");
|
||||
}
|
||||
#endif
|
||||
|
||||
UpdateActiveConfig();
|
||||
OSD::AddMessage(StringFromFormat("Missing Extensions: %s%s%s%s%s%s",
|
||||
|
||||
OSD::AddMessage(StringFromFormat("Video Info: %s, %s, %s",
|
||||
g_ogl_config.gl_vendor,
|
||||
g_ogl_config.gl_renderer,
|
||||
g_ogl_config.gl_version).c_str(), 5000);
|
||||
|
||||
WARN_LOG(VIDEO,"Missing OGL Extensions: %s%s%s%s%s%s%s%s%s",
|
||||
g_ActiveConfig.backend_info.bSupportsDualSourceBlend ? "" : "DualSourceBlend ",
|
||||
g_ActiveConfig.backend_info.bSupportsGLSLUBO ? "" : "UniformBuffer ",
|
||||
g_ActiveConfig.backend_info.bSupportsGLPinnedMemory ? "" : "PinnedMemory ",
|
||||
g_ActiveConfig.backend_info.bSupportsGLSLCache ? "" : "ShaderCache ",
|
||||
g_ActiveConfig.backend_info.bSupportsGLBaseVertex ? "" : "BaseVertex ",
|
||||
g_ActiveConfig.backend_info.bSupportsGLSync ? "" : "Sync "
|
||||
).c_str(), 5000);
|
||||
|
||||
if (!bSuccess)
|
||||
return; // TODO: fail
|
||||
g_ActiveConfig.backend_info.bSupportsPrimitiveRestart ? "" : "PrimitiveRestart ",
|
||||
g_ogl_config.bSupportsGLPinnedMemory ? "" : "PinnedMemory ",
|
||||
g_ogl_config.bSupportsGLSLCache ? "" : "ShaderCache ",
|
||||
g_ogl_config.bSupportsGLBaseVertex ? "" : "BaseVertex ",
|
||||
g_ogl_config.bSupportsGLSync ? "" : "Sync ",
|
||||
g_ogl_config.bSupportCoverageMSAA ? "" : "CSAA ",
|
||||
g_ogl_config.bSupportSampleShading ? "" : "SSAA "
|
||||
);
|
||||
|
||||
s_LastMultisampleMode = g_ActiveConfig.iMultisampleMode;
|
||||
s_MSAASamples = GetNumMSAASamples(s_LastMultisampleMode);
|
||||
s_MSAACoverageSamples = GetNumMSAACoverageSamples(s_LastMultisampleMode);
|
||||
|
||||
ApplySSAASettings();
|
||||
|
||||
// Decide frambuffer size
|
||||
s_backbuffer_width = (int)GLInterface->GetBackBufferWidth();
|
||||
s_backbuffer_height = (int)GLInterface->GetBackBufferHeight();
|
||||
|
||||
// Handle VSync on/off
|
||||
int swapInterval = g_ActiveConfig.IsVSync() ? 1 : 0;
|
||||
GLInterface->SwapInterval(swapInterval);
|
||||
s_vsync = g_ActiveConfig.IsVSync();
|
||||
GLInterface->SwapInterval(s_vsync);
|
||||
|
||||
// check the max texture width and height
|
||||
GLint max_texture_size;
|
||||
@ -371,6 +478,20 @@ Renderer::Renderer()
|
||||
glScissor(0, 0, GetTargetWidth(), GetTargetHeight());
|
||||
glBlendColor(0, 0, 0, 0.5f);
|
||||
glClearDepth(1.0f);
|
||||
|
||||
if(g_ActiveConfig.backend_info.bSupportsPrimitiveRestart)
|
||||
{
|
||||
if(g_ogl_config.bSupportOGL31)
|
||||
{
|
||||
glEnable(GL_PRIMITIVE_RESTART);
|
||||
glPrimitiveRestartIndex(65535);
|
||||
}
|
||||
else
|
||||
{
|
||||
glEnableClientState(GL_PRIMITIVE_RESTART_NV);
|
||||
glPrimitiveRestartIndexNV(65535);
|
||||
}
|
||||
}
|
||||
|
||||
UpdateActiveConfig();
|
||||
}
|
||||
@ -405,15 +526,15 @@ void Renderer::Init()
|
||||
s_pfont = new RasterFont();
|
||||
|
||||
ProgramShaderCache::CompileShader(s_ShowEFBCopyRegions,
|
||||
"in vec2 rawpos;\n"
|
||||
"in vec3 color0;\n"
|
||||
"out vec4 c;\n"
|
||||
"ATTRIN vec2 rawpos;\n"
|
||||
"ATTRIN vec3 color0;\n"
|
||||
"VARYOUT vec4 c;\n"
|
||||
"void main(void) {\n"
|
||||
" gl_Position = vec4(rawpos,0,1);\n"
|
||||
" c = vec4(color0, 1.0);\n"
|
||||
"}\n",
|
||||
"in vec4 c;\n"
|
||||
"out vec4 ocol0;\n"
|
||||
"VARYIN vec4 c;\n"
|
||||
"COLOROUT(ocol0)\n"
|
||||
"void main(void) {\n"
|
||||
" ocol0 = c;\n"
|
||||
"}\n");
|
||||
@ -450,10 +571,6 @@ void Renderer::DrawDebugInfo()
|
||||
|
||||
if (g_ActiveConfig.bShowEFBCopyRegions)
|
||||
{
|
||||
// Store Line Size
|
||||
GLfloat lSize;
|
||||
glGetFloatv(GL_LINE_WIDTH, &lSize);
|
||||
|
||||
// Set Line Size
|
||||
glLineWidth(3.0f);
|
||||
|
||||
@ -566,7 +683,7 @@ void Renderer::DrawDebugInfo()
|
||||
glDrawArrays(GL_LINES, 0, stats.efb_regions.size() * 2*6);
|
||||
|
||||
// Restore Line Size
|
||||
glLineWidth(lSize);
|
||||
SetLineWidth();
|
||||
|
||||
// Clear stored regions
|
||||
stats.efb_regions.clear();
|
||||
@ -920,8 +1037,8 @@ void Renderer::SetBlendMode(bool forceUpdate)
|
||||
GL_ONE,
|
||||
GL_DST_COLOR,
|
||||
GL_ONE_MINUS_DST_COLOR,
|
||||
GL_SRC_ALPHA,
|
||||
GL_ONE_MINUS_SRC_ALPHA, // NOTE: If dual-source blending is enabled, use SRC1_ALPHA
|
||||
(useDualSource) ? GL_SRC1_ALPHA : (GLenum)GL_SRC_ALPHA,
|
||||
(useDualSource) ? GL_ONE_MINUS_SRC1_ALPHA : (GLenum)GL_ONE_MINUS_SRC_ALPHA,
|
||||
(target_has_alpha) ? GL_DST_ALPHA : (GLenum)GL_ONE,
|
||||
(target_has_alpha) ? GL_ONE_MINUS_DST_ALPHA : (GLenum)GL_ZERO
|
||||
};
|
||||
@ -931,8 +1048,8 @@ void Renderer::SetBlendMode(bool forceUpdate)
|
||||
GL_ONE,
|
||||
GL_SRC_COLOR,
|
||||
GL_ONE_MINUS_SRC_COLOR,
|
||||
GL_SRC_ALPHA,
|
||||
GL_ONE_MINUS_SRC_ALPHA, // NOTE: If dual-source blending is enabled, use SRC1_ALPHA
|
||||
(useDualSource) ? GL_SRC1_ALPHA : (GLenum)GL_SRC_ALPHA,
|
||||
(useDualSource) ? GL_ONE_MINUS_SRC1_ALPHA : (GLenum)GL_ONE_MINUS_SRC_ALPHA,
|
||||
(target_has_alpha) ? GL_DST_ALPHA : (GLenum)GL_ONE,
|
||||
(target_has_alpha) ? GL_ONE_MINUS_DST_ALPHA : (GLenum)GL_ZERO
|
||||
};
|
||||
@ -973,30 +1090,32 @@ void Renderer::SetBlendMode(bool forceUpdate)
|
||||
|
||||
if (changes & 0x1FA)
|
||||
{
|
||||
GLenum srcFactor = glSrcFactors[(newval >> 3) & 7];
|
||||
GLenum dstFactor = glDestFactors[(newval >> 6) & 7];
|
||||
GLenum srcFactorAlpha = srcFactor;
|
||||
GLenum dstFactorAlpha = dstFactor;
|
||||
u32 srcidx = (newval >> 3) & 7;
|
||||
u32 dstidx = (newval >> 6) & 7;
|
||||
GLenum srcFactor = glSrcFactors[srcidx];
|
||||
GLenum dstFactor = glDestFactors[dstidx];
|
||||
|
||||
// adjust alpha factors
|
||||
if (useDualSource)
|
||||
{
|
||||
srcFactorAlpha = GL_ONE;
|
||||
dstFactorAlpha = GL_ZERO;
|
||||
srcidx = GX_BL_ONE;
|
||||
dstidx = GX_BL_ZERO;
|
||||
}
|
||||
else
|
||||
{
|
||||
// we can't use GL_DST_COLOR or GL_ONE_MINUS_DST_COLOR for source in alpha channel so use their alpha equivalent instead
|
||||
if (srcidx == GX_BL_DSTCLR) srcidx = GX_BL_DSTALPHA;
|
||||
if (srcidx == GX_BL_INVDSTCLR) srcidx = GX_BL_INVDSTALPHA;
|
||||
|
||||
if (srcFactor == GL_SRC_ALPHA)
|
||||
srcFactor = GL_SRC1_ALPHA;
|
||||
else if (srcFactor == GL_ONE_MINUS_SRC_ALPHA)
|
||||
srcFactor = GL_ONE_MINUS_SRC1_ALPHA;
|
||||
|
||||
if (dstFactor == GL_SRC_ALPHA)
|
||||
dstFactor = GL_SRC1_ALPHA;
|
||||
else if (dstFactor == GL_ONE_MINUS_SRC_ALPHA)
|
||||
dstFactor = GL_ONE_MINUS_SRC1_ALPHA;
|
||||
}
|
||||
|
||||
// we can't use GL_SRC_COLOR or GL_ONE_MINUS_SRC_COLOR for destination in alpha channel so use their alpha equivalent instead
|
||||
if (dstidx == GX_BL_SRCCLR) dstidx = GX_BL_SRCALPHA;
|
||||
if (dstidx == GX_BL_INVSRCCLR) dstidx = GX_BL_INVSRCALPHA;
|
||||
}
|
||||
GLenum srcFactorAlpha = glSrcFactors[srcidx];
|
||||
GLenum dstFactorAlpha = glDestFactors[dstidx];
|
||||
// blend RGB change
|
||||
glBlendFuncSeparate(srcFactor, dstFactor, srcFactorAlpha, dstFactorAlpha);
|
||||
}
|
||||
|
||||
s_blendMode = newval;
|
||||
}
|
||||
|
||||
@ -1076,8 +1195,8 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons
|
||||
int xfbWidth = xfbSource->srcWidth;
|
||||
int hOffset = ((s32)xfbSource->srcAddr - (s32)xfbAddr) / ((s32)fbWidth * 2);
|
||||
|
||||
drawRc.top = flipped_trc.bottom + (hOffset + xfbHeight) * flipped_trc.GetHeight() / fbHeight;
|
||||
drawRc.bottom = flipped_trc.bottom + hOffset * flipped_trc.GetHeight() / fbHeight;
|
||||
drawRc.top = flipped_trc.top - hOffset * flipped_trc.GetHeight() / fbHeight;
|
||||
drawRc.bottom = flipped_trc.top - (hOffset + xfbHeight) * flipped_trc.GetHeight() / fbHeight;
|
||||
drawRc.left = flipped_trc.left + (flipped_trc.GetWidth() - xfbWidth * flipped_trc.GetWidth() / fbWidth)/2;
|
||||
drawRc.right = flipped_trc.left + (flipped_trc.GetWidth() + xfbWidth * flipped_trc.GetWidth() / fbWidth)/2;
|
||||
|
||||
@ -1270,7 +1389,8 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons
|
||||
s_LastMultisampleMode = g_ActiveConfig.iMultisampleMode;
|
||||
s_MSAASamples = GetNumMSAASamples(s_LastMultisampleMode);
|
||||
s_MSAACoverageSamples = GetNumMSAACoverageSamples(s_LastMultisampleMode);
|
||||
|
||||
ApplySSAASettings();
|
||||
|
||||
delete g_framebuffer_manager;
|
||||
g_framebuffer_manager = new FramebufferManager(s_target_width, s_target_height,
|
||||
s_MSAASamples, s_MSAACoverageSamples);
|
||||
@ -1289,7 +1409,9 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons
|
||||
DrawDebugText();
|
||||
|
||||
GL_REPORT_ERRORD();
|
||||
|
||||
|
||||
// Do our OSD callbacks
|
||||
OSD::DoCallbacks(OSD::OSD_ONFRAME);
|
||||
OSD::DrawMessages();
|
||||
GL_REPORT_ERRORD();
|
||||
|
||||
@ -1307,7 +1429,11 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons
|
||||
|
||||
GL_REPORT_ERRORD();
|
||||
|
||||
GLInterface->SwapInterval(g_ActiveConfig.IsVSync() ? 1 : 0);
|
||||
if(s_vsync != g_ActiveConfig.IsVSync())
|
||||
{
|
||||
s_vsync = g_ActiveConfig.IsVSync();
|
||||
GLInterface->SwapInterval(s_vsync);
|
||||
}
|
||||
|
||||
// Clean out old stuff from caches. It's not worth it to clean out the shader caches.
|
||||
DLCache::ProgressiveCleanup();
|
||||
|
@ -9,6 +9,31 @@ namespace OGL
|
||||
|
||||
void ClearEFBCache();
|
||||
|
||||
enum GLSL_VERSION {
|
||||
GLSL_120,
|
||||
GLSL_130,
|
||||
GLSL_140 // and above
|
||||
};
|
||||
|
||||
// ogl-only config, so not in VideoConfig.h
|
||||
extern struct VideoConfig {
|
||||
bool bSupportsGLSLCache;
|
||||
bool bSupportsGLPinnedMemory;
|
||||
bool bSupportsGLSync;
|
||||
bool bSupportsGLBaseVertex;
|
||||
bool bSupportCoverageMSAA;
|
||||
bool bSupportSampleShading;
|
||||
GLSL_VERSION eSupportedGLSLVersion;
|
||||
bool bSupportOGL31;
|
||||
|
||||
const char *gl_vendor;
|
||||
const char *gl_renderer;
|
||||
const char* gl_version;
|
||||
const char* glsl_version;
|
||||
|
||||
s32 max_samples;
|
||||
} g_ogl_config;
|
||||
|
||||
class Renderer : public ::Renderer
|
||||
{
|
||||
public:
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "GLUtil.h"
|
||||
#include "StreamBuffer.h"
|
||||
#include "MemoryUtil.h"
|
||||
#include "Render.h"
|
||||
|
||||
namespace OGL
|
||||
{
|
||||
@ -31,19 +32,19 @@ StreamBuffer::StreamBuffer(u32 type, size_t size, StreamType uploadType)
|
||||
{
|
||||
glGenBuffers(1, &m_buffer);
|
||||
|
||||
bool nvidia = !strcmp((const char*)glGetString(GL_VENDOR), "NVIDIA Corporation");
|
||||
bool nvidia = !strcmp(g_ogl_config.gl_vendor, "NVIDIA Corporation");
|
||||
|
||||
if(m_uploadtype == STREAM_DETECT)
|
||||
if(m_uploadtype & STREAM_DETECT)
|
||||
{
|
||||
if(!g_Config.backend_info.bSupportsGLBaseVertex)
|
||||
if(!g_ogl_config.bSupportsGLBaseVertex && (m_uploadtype & BUFFERSUBDATA))
|
||||
m_uploadtype = BUFFERSUBDATA;
|
||||
else if(g_Config.backend_info.bSupportsGLSync && g_Config.bHackedBufferUpload)
|
||||
else if(g_ogl_config.bSupportsGLSync && g_Config.bHackedBufferUpload && (m_uploadtype & MAP_AND_RISK))
|
||||
m_uploadtype = MAP_AND_RISK;
|
||||
else if(g_Config.backend_info.bSupportsGLSync && g_Config.backend_info.bSupportsGLPinnedMemory)
|
||||
else if(g_ogl_config.bSupportsGLSync && g_ogl_config.bSupportsGLPinnedMemory && (m_uploadtype & PINNED_MEMORY))
|
||||
m_uploadtype = PINNED_MEMORY;
|
||||
else if(nvidia)
|
||||
else if(nvidia && (m_uploadtype & BUFFERSUBDATA))
|
||||
m_uploadtype = BUFFERSUBDATA;
|
||||
else if(g_Config.backend_info.bSupportsGLSync)
|
||||
else if(g_ogl_config.bSupportsGLSync && (m_uploadtype & MAP_AND_SYNC))
|
||||
m_uploadtype = MAP_AND_SYNC;
|
||||
else
|
||||
m_uploadtype = MAP_AND_ORPHAN;
|
||||
@ -124,6 +125,7 @@ void StreamBuffer::Alloc ( size_t size, u32 stride )
|
||||
m_iterator_aligned = 0;
|
||||
break;
|
||||
case STREAM_DETECT:
|
||||
case DETECT_MASK: // Just to shutup warnings
|
||||
break;
|
||||
}
|
||||
m_iterator = m_iterator_aligned;
|
||||
@ -139,7 +141,7 @@ size_t StreamBuffer::Upload ( u8* data, size_t size )
|
||||
memcpy(pointer, data, size);
|
||||
glUnmapBuffer(m_buffertype);
|
||||
} else {
|
||||
ERROR_LOG(VIDEO, "buffer mapping failed");
|
||||
ERROR_LOG(VIDEO, "Buffer mapping failed");
|
||||
}
|
||||
break;
|
||||
case PINNED_MEMORY:
|
||||
@ -151,6 +153,7 @@ size_t StreamBuffer::Upload ( u8* data, size_t size )
|
||||
glBufferSubData(m_buffertype, m_iterator, size, data);
|
||||
break;
|
||||
case STREAM_DETECT:
|
||||
case DETECT_MASK: // Just to shutup warnings
|
||||
break;
|
||||
}
|
||||
size_t ret = m_iterator;
|
||||
@ -189,7 +192,7 @@ void StreamBuffer::Init()
|
||||
|
||||
// on error, switch to another backend. some old catalyst seems to have broken pinned memory support
|
||||
if(glGetError() != GL_NO_ERROR) {
|
||||
ERROR_LOG(VIDEO, "pinned memory detected, but not working. Please report this: %s, %s, %s", glGetString(GL_VENDOR), glGetString(GL_RENDERER), glGetString(GL_VERSION));
|
||||
ERROR_LOG(VIDEO, "Pinned memory detected, but not working. Please report this: %s, %s, %s", g_ogl_config.gl_vendor, g_ogl_config.gl_renderer, g_ogl_config.gl_version);
|
||||
Shutdown();
|
||||
m_uploadtype = MAP_AND_SYNC;
|
||||
Init();
|
||||
@ -201,9 +204,10 @@ void StreamBuffer::Init()
|
||||
pointer = (u8*)glMapBuffer(m_buffertype, GL_WRITE_ONLY);
|
||||
glUnmapBuffer(m_buffertype);
|
||||
if(!pointer)
|
||||
ERROR_LOG(VIDEO, "buffer allocation failed");
|
||||
ERROR_LOG(VIDEO, "Buffer allocation failed");
|
||||
|
||||
case STREAM_DETECT:
|
||||
case DETECT_MASK: // Just to shutup warnings
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -230,6 +234,7 @@ void StreamBuffer::Shutdown()
|
||||
FreeAlignedMemory(pointer);
|
||||
break;
|
||||
case STREAM_DETECT:
|
||||
case DETECT_MASK: // Just to shutup warnings
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -32,18 +32,19 @@
|
||||
namespace OGL
|
||||
{
|
||||
enum StreamType {
|
||||
STREAM_DETECT,
|
||||
MAP_AND_ORPHAN,
|
||||
MAP_AND_SYNC,
|
||||
MAP_AND_RISK,
|
||||
PINNED_MEMORY,
|
||||
BUFFERSUBDATA
|
||||
DETECT_MASK = 0x3F,
|
||||
STREAM_DETECT = (1 << 0),
|
||||
MAP_AND_ORPHAN = (1 << 1),
|
||||
MAP_AND_SYNC = (1 << 2),
|
||||
MAP_AND_RISK = (1 << 3),
|
||||
PINNED_MEMORY = (1 << 4),
|
||||
BUFFERSUBDATA = (1 << 5)
|
||||
};
|
||||
|
||||
class StreamBuffer {
|
||||
|
||||
public:
|
||||
StreamBuffer(u32 type, size_t size, StreamType uploadType = STREAM_DETECT);
|
||||
StreamBuffer(u32 type, size_t size, StreamType uploadType = DETECT_MASK);
|
||||
~StreamBuffer();
|
||||
|
||||
void Alloc(size_t size, u32 stride = 0);
|
||||
|
@ -74,8 +74,6 @@ struct VBOCache {
|
||||
};
|
||||
static std::map<u64,VBOCache> s_VBO;
|
||||
|
||||
static u32 s_TempFramebuffer = 0;
|
||||
|
||||
bool SaveTexture(const char* filename, u32 textarget, u32 tex, int virtual_width, int virtual_height, unsigned int level)
|
||||
{
|
||||
int width = std::max(virtual_width >> level, 1);
|
||||
@ -107,12 +105,20 @@ TextureCache::TCacheEntry::~TCacheEntry()
|
||||
glDeleteTextures(1, &texture);
|
||||
texture = 0;
|
||||
}
|
||||
|
||||
if (framebuffer)
|
||||
{
|
||||
glDeleteFramebuffers(1, &framebuffer);
|
||||
framebuffer = 0;
|
||||
}
|
||||
}
|
||||
|
||||
TextureCache::TCacheEntry::TCacheEntry()
|
||||
{
|
||||
glGenTextures(1, &texture);
|
||||
GL_REPORT_ERRORD();
|
||||
|
||||
framebuffer = 0;
|
||||
}
|
||||
|
||||
void TextureCache::TCacheEntry::Bind(unsigned int stage)
|
||||
@ -268,9 +274,13 @@ TextureCache::TCacheEntryBase* TextureCache::CreateRenderTargetTexture(
|
||||
entry->m_tex_levels = 1;
|
||||
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, gl_iformat, scaled_tex_w, scaled_tex_h, 0, gl_format, gl_type, NULL);
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
|
||||
glGenFramebuffers(1, &entry->framebuffer);
|
||||
FramebufferManager::SetFramebuffer(entry->framebuffer);
|
||||
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, entry->texture, 0);
|
||||
GL_REPORT_FBO_ERROR();
|
||||
|
||||
SetStage();
|
||||
|
||||
GL_REPORT_ERRORD();
|
||||
@ -290,17 +300,12 @@ void TextureCache::TCacheEntry::FromRenderTarget(u32 dstAddr, unsigned int dstFo
|
||||
FramebufferManager::ResolveAndGetDepthTarget(srcRect) :
|
||||
FramebufferManager::ResolveAndGetRenderTarget(srcRect);
|
||||
|
||||
GL_REPORT_ERRORD();
|
||||
GL_REPORT_ERRORD();
|
||||
|
||||
if (type != TCET_EC_DYNAMIC || g_ActiveConfig.bCopyEFBToTexture)
|
||||
{
|
||||
if (s_TempFramebuffer == 0)
|
||||
glGenFramebuffers(1, (GLuint*)&s_TempFramebuffer);
|
||||
FramebufferManager::SetFramebuffer(framebuffer);
|
||||
|
||||
FramebufferManager::SetFramebuffer(s_TempFramebuffer);
|
||||
// Bind texture to temporary framebuffer
|
||||
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture, 0);
|
||||
GL_REPORT_FBO_ERROR();
|
||||
GL_REPORT_ERRORD();
|
||||
|
||||
glActiveTexture(GL_TEXTURE0+9);
|
||||
@ -353,10 +358,10 @@ void TextureCache::TCacheEntry::FromRenderTarget(u32 dstAddr, unsigned int dstFo
|
||||
(GLfloat)targetSource.left, (GLfloat)targetSource.bottom,
|
||||
-1.f, -1.f,
|
||||
(GLfloat)targetSource.left, (GLfloat)targetSource.top,
|
||||
1.f, -1.f,
|
||||
(GLfloat)targetSource.right, (GLfloat)targetSource.top,
|
||||
1.f, 1.f,
|
||||
(GLfloat)targetSource.right, (GLfloat)targetSource.bottom
|
||||
(GLfloat)targetSource.right, (GLfloat)targetSource.bottom,
|
||||
1.f, -1.f,
|
||||
(GLfloat)targetSource.right, (GLfloat)targetSource.top
|
||||
};
|
||||
|
||||
glBindBuffer(GL_ARRAY_BUFFER, vbo_it->second.vbo);
|
||||
@ -366,14 +371,11 @@ void TextureCache::TCacheEntry::FromRenderTarget(u32 dstAddr, unsigned int dstFo
|
||||
}
|
||||
|
||||
glBindVertexArray(vbo_it->second.vao);
|
||||
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||
|
||||
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, 0);
|
||||
|
||||
GL_REPORT_ERRORD();
|
||||
|
||||
// Unbind texture from temporary framebuffer
|
||||
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, 0, 0);
|
||||
}
|
||||
|
||||
if (false == g_ActiveConfig.bCopyEFBToTexture)
|
||||
@ -419,8 +421,8 @@ TextureCache::TextureCache()
|
||||
const char *pColorMatrixProg =
|
||||
"uniform sampler2DRect samp9;\n"
|
||||
"uniform vec4 colmat[7];\n"
|
||||
"in vec2 uv0;\n"
|
||||
"out vec4 ocol0;\n"
|
||||
"VARYIN vec2 uv0;\n"
|
||||
"COLOROUT(ocol0)\n"
|
||||
"\n"
|
||||
"void main(){\n"
|
||||
" vec4 texcol = texture2DRect(samp9, uv0);\n"
|
||||
@ -431,8 +433,8 @@ TextureCache::TextureCache()
|
||||
const char *pDepthMatrixProg =
|
||||
"uniform sampler2DRect samp9;\n"
|
||||
"uniform vec4 colmat[5];\n"
|
||||
"in vec2 uv0;\n"
|
||||
"out vec4 ocol0;\n"
|
||||
"VARYIN vec2 uv0;\n"
|
||||
"COLOROUT(ocol0)\n"
|
||||
"\n"
|
||||
"void main(){\n"
|
||||
" vec4 texcol = texture2DRect(samp9, uv0);\n"
|
||||
@ -443,9 +445,9 @@ TextureCache::TextureCache()
|
||||
|
||||
|
||||
const char *VProgram =
|
||||
"in vec2 rawpos;\n"
|
||||
"in vec2 tex0;\n"
|
||||
"out vec2 uv0;\n"
|
||||
"ATTRIN vec2 rawpos;\n"
|
||||
"ATTRIN vec2 tex0;\n"
|
||||
"VARYOUT vec2 uv0;\n"
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
" uv0 = tex0;\n"
|
||||
@ -477,12 +479,6 @@ TextureCache::~TextureCache()
|
||||
glDeleteVertexArrays(1, &it->second.vao);
|
||||
}
|
||||
s_VBO.clear();
|
||||
|
||||
if (s_TempFramebuffer)
|
||||
{
|
||||
glDeleteFramebuffers(1, (GLuint*)&s_TempFramebuffer);
|
||||
s_TempFramebuffer = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void TextureCache::DisableStage(unsigned int stage)
|
||||
|
@ -41,6 +41,7 @@ private:
|
||||
struct TCacheEntry : TCacheEntryBase
|
||||
{
|
||||
GLuint texture;
|
||||
GLuint framebuffer;
|
||||
|
||||
PC_TexFormat pcfmt;
|
||||
|
||||
|
@ -66,9 +66,9 @@ static int s_cached_srcWidth = 0;
|
||||
static int s_cached_srcHeight = 0;
|
||||
|
||||
static const char *VProgram =
|
||||
"in vec2 rawpos;\n"
|
||||
"in vec2 tex0;\n"
|
||||
"out vec2 uv0;\n"
|
||||
"ATTRIN vec2 rawpos;\n"
|
||||
"ATTRIN vec2 tex0;\n"
|
||||
"VARYOUT vec2 uv0;\n"
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
" uv0 = tex0;\n"
|
||||
@ -80,8 +80,8 @@ void CreatePrograms()
|
||||
// Output is BGRA because that is slightly faster than RGBA.
|
||||
const char *FProgramRgbToYuyv =
|
||||
"uniform sampler2DRect samp9;\n"
|
||||
"in vec2 uv0;\n"
|
||||
"out vec4 ocol0;\n"
|
||||
"VARYIN vec2 uv0;\n"
|
||||
"COLOROUT(ocol0)\n"
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
" vec3 c0 = texture2DRect(samp9, uv0).rgb;\n"
|
||||
@ -96,8 +96,8 @@ void CreatePrograms()
|
||||
|
||||
const char *FProgramYuyvToRgb =
|
||||
"uniform sampler2DRect samp9;\n"
|
||||
"in vec2 uv0;\n"
|
||||
"out vec4 ocol0;\n"
|
||||
"VARYIN vec2 uv0;\n"
|
||||
"COLOROUT(ocol0)\n"
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
" vec4 c0 = texture2DRect(samp9, uv0).rgba;\n"
|
||||
@ -250,10 +250,10 @@ void EncodeToRamUsingShader(GLuint srcTexture, const TargetRectangle& sourceRc,
|
||||
(float)sourceRc.left, (float)sourceRc.top,
|
||||
-1.f, 1.f,
|
||||
(float)sourceRc.left, (float)sourceRc.bottom,
|
||||
1.f, 1.f,
|
||||
(float)sourceRc.right, (float)sourceRc.bottom,
|
||||
1.f, -1.f,
|
||||
(float)sourceRc.right, (float)sourceRc.top
|
||||
(float)sourceRc.right, (float)sourceRc.top,
|
||||
1.f, 1.f,
|
||||
(float)sourceRc.right, (float)sourceRc.bottom
|
||||
};
|
||||
glBindBuffer(GL_ARRAY_BUFFER, s_encode_VBO );
|
||||
glBufferData(GL_ARRAY_BUFFER, 4*4*sizeof(GLfloat), vertices, GL_STREAM_DRAW);
|
||||
@ -262,7 +262,7 @@ void EncodeToRamUsingShader(GLuint srcTexture, const TargetRectangle& sourceRc,
|
||||
}
|
||||
|
||||
glBindVertexArray( s_encode_VAO );
|
||||
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||
|
||||
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, 0);
|
||||
|
||||
@ -426,10 +426,10 @@ void DecodeToTexture(u32 xfbAddr, int srcWidth, int srcHeight, GLuint destRender
|
||||
(float)srcFmtWidth, (float)srcHeight,
|
||||
1.f, 1.f,
|
||||
(float)srcFmtWidth, 0.f,
|
||||
-1.f, 1.f,
|
||||
0.f, 0.f,
|
||||
-1.f, -1.f,
|
||||
0.f, (float)srcHeight
|
||||
0.f, (float)srcHeight,
|
||||
-1.f, 1.f,
|
||||
0.f, 0.f
|
||||
};
|
||||
|
||||
glBindBuffer(GL_ARRAY_BUFFER, s_decode_VBO );
|
||||
@ -440,7 +440,7 @@ void DecodeToTexture(u32 xfbAddr, int srcWidth, int srcHeight, GLuint destRender
|
||||
}
|
||||
|
||||
glBindVertexArray( s_decode_VAO );
|
||||
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||
|
||||
GL_REPORT_ERRORD();
|
||||
|
||||
|
@ -41,6 +41,7 @@
|
||||
#include "Debugger.h"
|
||||
#include "StreamBuffer.h"
|
||||
#include "PerfQueryBase.h"
|
||||
#include "Render.h"
|
||||
|
||||
#include "main.h"
|
||||
|
||||
@ -72,7 +73,7 @@ void VertexManager::CreateDeviceObjects()
|
||||
{
|
||||
s_vertexBuffer = new StreamBuffer(GL_ARRAY_BUFFER, MAX_VBUFFER_SIZE);
|
||||
m_vertex_buffers = s_vertexBuffer->getBuffer();
|
||||
s_indexBuffer = new StreamBuffer(GL_ELEMENT_ARRAY_BUFFER, MAX_IBUFFER_SIZE);
|
||||
s_indexBuffer = new StreamBuffer(GL_ELEMENT_ARRAY_BUFFER, MAX_IBUFFER_SIZE, (StreamType)(DETECT_MASK & ~PINNED_MEMORY));
|
||||
m_index_buffers = s_indexBuffer->getBuffer();
|
||||
|
||||
m_CurrentVertexFmt = NULL;
|
||||
@ -123,10 +124,12 @@ void VertexManager::Draw(u32 stride)
|
||||
u32 triangle_index_size = IndexGenerator::GetTriangleindexLen();
|
||||
u32 line_index_size = IndexGenerator::GetLineindexLen();
|
||||
u32 point_index_size = IndexGenerator::GetPointindexLen();
|
||||
if(g_Config.backend_info.bSupportsGLBaseVertex) {
|
||||
GLenum triangle_mode = g_ActiveConfig.backend_info.bSupportsPrimitiveRestart?GL_TRIANGLE_STRIP:GL_TRIANGLES;
|
||||
|
||||
if(g_ogl_config.bSupportsGLBaseVertex) {
|
||||
if (triangle_index_size > 0)
|
||||
{
|
||||
glDrawElementsBaseVertex(GL_TRIANGLES, triangle_index_size, GL_UNSIGNED_SHORT, (u8*)NULL+s_offset[0], s_baseVertex);
|
||||
glDrawElementsBaseVertex(triangle_mode, triangle_index_size, GL_UNSIGNED_SHORT, (u8*)NULL+s_offset[0], s_baseVertex);
|
||||
INCSTAT(stats.thisFrame.numIndexedDrawCalls);
|
||||
}
|
||||
if (line_index_size > 0)
|
||||
@ -142,7 +145,7 @@ void VertexManager::Draw(u32 stride)
|
||||
} else {
|
||||
if (triangle_index_size > 0)
|
||||
{
|
||||
glDrawElements(GL_TRIANGLES, triangle_index_size, GL_UNSIGNED_SHORT, (u8*)NULL+s_offset[0]);
|
||||
glDrawElements(triangle_mode, triangle_index_size, GL_UNSIGNED_SHORT, (u8*)NULL+s_offset[0]);
|
||||
INCSTAT(stats.thisFrame.numIndexedDrawCalls);
|
||||
}
|
||||
if (line_index_size > 0)
|
||||
@ -233,7 +236,7 @@ void VertexManager::vFlush()
|
||||
PixelShaderManager::SetTexDims(i, tentry->native_width, tentry->native_height, 0, 0);
|
||||
}
|
||||
else
|
||||
ERROR_LOG(VIDEO, "error loading texture");
|
||||
ERROR_LOG(VIDEO, "Error loading texture");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -96,6 +96,7 @@ Make AA apply instantly during gameplay if possible
|
||||
#include "PerfQuery.h"
|
||||
|
||||
#include "VideoState.h"
|
||||
#include "IndexGenerator.h"
|
||||
#include "VideoBackend.h"
|
||||
#include "ConfigManager.h"
|
||||
|
||||
@ -141,7 +142,7 @@ void InitBackendInfo()
|
||||
g_Config.backend_info.bSupportsPixelLighting = true;
|
||||
|
||||
// aamodes
|
||||
const char* caamodes[] = {"None", "2x", "4x", "8x", "8x CSAA", "8xQ CSAA", "16x CSAA", "16xQ CSAA"};
|
||||
const char* caamodes[] = {_trans("None"), "2x", "4x", "8x", "8x CSAA", "8xQ CSAA", "16x CSAA", "16xQ CSAA", "4x SSAA"};
|
||||
g_Config.backend_info.AAModes.assign(caamodes, caamodes + sizeof(caamodes)/sizeof(*caamodes));
|
||||
|
||||
// pp shaders
|
||||
@ -156,7 +157,10 @@ void VideoBackend::ShowConfig(void *_hParent)
|
||||
diag.ShowModal();
|
||||
#endif
|
||||
}
|
||||
|
||||
void Test(u32 Data)
|
||||
{
|
||||
printf("Data: %d\n", Data);
|
||||
}
|
||||
bool VideoBackend::Initialize(void *&window_handle)
|
||||
{
|
||||
InitializeShared();
|
||||
@ -174,6 +178,9 @@ bool VideoBackend::Initialize(void *&window_handle)
|
||||
if (!GLInterface->Create(window_handle))
|
||||
return false;
|
||||
|
||||
// Do our OSD callbacks
|
||||
OSD::DoCallbacks(OSD::OSD_INIT);
|
||||
|
||||
s_BackendInitialized = true;
|
||||
|
||||
return true;
|
||||
@ -199,6 +206,7 @@ void VideoBackend::Video_Prepare()
|
||||
g_perf_query = new PerfQuery;
|
||||
Fifo_Init(); // must be done before OpcodeDecoder_Init()
|
||||
OpcodeDecoder_Init();
|
||||
IndexGenerator::Init();
|
||||
VertexShaderManager::Init();
|
||||
PixelShaderManager::Init();
|
||||
ProgramShaderCache::Init();
|
||||
@ -220,6 +228,10 @@ void VideoBackend::Video_Prepare()
|
||||
void VideoBackend::Shutdown()
|
||||
{
|
||||
s_BackendInitialized = false;
|
||||
|
||||
// Do our OSD callbacks
|
||||
OSD::DoCallbacks(OSD::OSD_SHUTDOWN);
|
||||
|
||||
GLInterface->Shutdown();
|
||||
}
|
||||
|
||||
@ -253,6 +265,7 @@ void VideoBackend::Video_Cleanup() {
|
||||
OpcodeDecoder_Shutdown();
|
||||
delete g_renderer;
|
||||
g_renderer = NULL;
|
||||
GLInterface->ClearCurrent();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -36,11 +36,11 @@ if(USE_EGL)
|
||||
endif()
|
||||
|
||||
if(USE_GLES)
|
||||
set(SRCS ${SRCS}
|
||||
../Plugin_VideoOGL/Src/GLUtil.cpp)
|
||||
set(SRCS ${SRCS} ../Plugin_VideoOGL/Src/GLUtil.cpp)
|
||||
set(LIBS ${LIBS}
|
||||
GLESv2)
|
||||
else()
|
||||
set(SRCS ${SRCS} Src/RasterFont.cpp)
|
||||
set(LIBS ${LIBS}
|
||||
GLEW
|
||||
${OPENGL_LIBRARIES})
|
||||
|
@ -184,6 +184,7 @@
|
||||
<ClCompile Include="Src\OpcodeDecoder.cpp" />
|
||||
<ClCompile Include="Src\SWPixelEngine.cpp" />
|
||||
<ClCompile Include="Src\Rasterizer.cpp" />
|
||||
<ClCompile Include="Src\RasterFont.cpp" />
|
||||
<ClCompile Include="Src\SWRenderer.cpp" />
|
||||
<ClCompile Include="Src\SetupUnit.cpp" />
|
||||
<ClCompile Include="Src\SWStatistics.cpp" />
|
||||
@ -217,6 +218,7 @@
|
||||
<ClInclude Include="Src\OpcodeDecoder.h" />
|
||||
<ClInclude Include="Src\SWPixelEngine.h" />
|
||||
<ClInclude Include="Src\Rasterizer.h" />
|
||||
<ClInclude Include="Src\RasterFont.h" />
|
||||
<ClInclude Include="Src\SWRenderer.h" />
|
||||
<ClInclude Include="Src\SetupUnit.h" />
|
||||
<ClInclude Include="Src\SWStatistics.h" />
|
||||
|
@ -13,6 +13,7 @@
|
||||
<ClCompile Include="Src\OpcodeDecoder.cpp" />
|
||||
<ClCompile Include="Src\SWPixelEngine.cpp" />
|
||||
<ClCompile Include="Src\Rasterizer.cpp" />
|
||||
<ClCompile Include="Src\RasterFont.cpp" />
|
||||
<ClCompile Include="Src\SWRenderer.cpp" />
|
||||
<ClCompile Include="Src\SetupUnit.cpp" />
|
||||
<ClCompile Include="Src\SWStatistics.cpp" />
|
||||
@ -39,6 +40,7 @@
|
||||
<ClInclude Include="Src\OpcodeDecoder.h" />
|
||||
<ClInclude Include="Src\SWPixelEngine.h" />
|
||||
<ClInclude Include="Src\Rasterizer.h" />
|
||||
<ClInclude Include="Src\RasterFont.h" />
|
||||
<ClInclude Include="Src\SWRenderer.h" />
|
||||
<ClInclude Include="Src\SetupUnit.h" />
|
||||
<ClInclude Include="Src\SWStatistics.h" />
|
||||
|
223
Source/Plugins/Plugin_VideoSoftware/Src/RasterFont.cpp
Normal file
223
Source/Plugins/Plugin_VideoSoftware/Src/RasterFont.cpp
Normal file
@ -0,0 +1,223 @@
|
||||
// Copyright (C) 2003 Dolphin Project.
|
||||
|
||||
// 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
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include "../../Plugin_VideoOGL/Src/GLUtil.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "RasterFont.h"
|
||||
// globals
|
||||
|
||||
const GLubyte rasters[][13] = {
|
||||
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18},
|
||||
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x36, 0x36, 0x36},
|
||||
{0x00, 0x00, 0x00, 0x66, 0x66, 0xff, 0x66, 0x66, 0xff, 0x66, 0x66, 0x00, 0x00},
|
||||
{0x00, 0x00, 0x18, 0x7e, 0xff, 0x1b, 0x1f, 0x7e, 0xf8, 0xd8, 0xff, 0x7e, 0x18},
|
||||
{0x00, 0x00, 0x0e, 0x1b, 0xdb, 0x6e, 0x30, 0x18, 0x0c, 0x76, 0xdb, 0xd8, 0x70},
|
||||
{0x00, 0x00, 0x7f, 0xc6, 0xcf, 0xd8, 0x70, 0x70, 0xd8, 0xcc, 0xcc, 0x6c, 0x38},
|
||||
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x1c, 0x0c, 0x0e},
|
||||
{0x00, 0x00, 0x0c, 0x18, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x18, 0x0c},
|
||||
{0x00, 0x00, 0x30, 0x18, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x18, 0x30},
|
||||
{0x00, 0x00, 0x00, 0x00, 0x99, 0x5a, 0x3c, 0xff, 0x3c, 0x5a, 0x99, 0x00, 0x00},
|
||||
{0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0xff, 0xff, 0x18, 0x18, 0x18, 0x00, 0x00},
|
||||
{0x00, 0x00, 0x30, 0x18, 0x1c, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x00, 0x00, 0x00, 0x38, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x00, 0x60, 0x60, 0x30, 0x30, 0x18, 0x18, 0x0c, 0x0c, 0x06, 0x06, 0x03, 0x03},
|
||||
{0x00, 0x00, 0x3c, 0x66, 0xc3, 0xe3, 0xf3, 0xdb, 0xcf, 0xc7, 0xc3, 0x66, 0x3c},
|
||||
{0x00, 0x00, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x78, 0x38, 0x18},
|
||||
{0x00, 0x00, 0xff, 0xc0, 0xc0, 0x60, 0x30, 0x18, 0x0c, 0x06, 0x03, 0xe7, 0x7e},
|
||||
{0x00, 0x00, 0x7e, 0xe7, 0x03, 0x03, 0x07, 0x7e, 0x07, 0x03, 0x03, 0xe7, 0x7e},
|
||||
{0x00, 0x00, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0xff, 0xcc, 0x6c, 0x3c, 0x1c, 0x0c},
|
||||
{0x00, 0x00, 0x7e, 0xe7, 0x03, 0x03, 0x07, 0xfe, 0xc0, 0xc0, 0xc0, 0xc0, 0xff},
|
||||
{0x00, 0x00, 0x7e, 0xe7, 0xc3, 0xc3, 0xc7, 0xfe, 0xc0, 0xc0, 0xc0, 0xe7, 0x7e},
|
||||
{0x00, 0x00, 0x30, 0x30, 0x30, 0x30, 0x18, 0x0c, 0x06, 0x03, 0x03, 0x03, 0xff},
|
||||
{0x00, 0x00, 0x7e, 0xe7, 0xc3, 0xc3, 0xe7, 0x7e, 0xe7, 0xc3, 0xc3, 0xe7, 0x7e},
|
||||
{0x00, 0x00, 0x7e, 0xe7, 0x03, 0x03, 0x03, 0x7f, 0xe7, 0xc3, 0xc3, 0xe7, 0x7e},
|
||||
{0x00, 0x00, 0x00, 0x38, 0x38, 0x00, 0x00, 0x38, 0x38, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x00, 0x00, 0x30, 0x18, 0x1c, 0x1c, 0x00, 0x00, 0x1c, 0x1c, 0x00, 0x00, 0x00},
|
||||
{0x00, 0x00, 0x06, 0x0c, 0x18, 0x30, 0x60, 0xc0, 0x60, 0x30, 0x18, 0x0c, 0x06},
|
||||
{0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x00, 0x00, 0x60, 0x30, 0x18, 0x0c, 0x06, 0x03, 0x06, 0x0c, 0x18, 0x30, 0x60},
|
||||
{0x00, 0x00, 0x18, 0x00, 0x00, 0x18, 0x18, 0x0c, 0x06, 0x03, 0xc3, 0xc3, 0x7e},
|
||||
{0x00, 0x00, 0x3f, 0x60, 0xcf, 0xdb, 0xd3, 0xdd, 0xc3, 0x7e, 0x00, 0x00, 0x00},
|
||||
{0x00, 0x00, 0xc3, 0xc3, 0xc3, 0xc3, 0xff, 0xc3, 0xc3, 0xc3, 0x66, 0x3c, 0x18},
|
||||
{0x00, 0x00, 0xfe, 0xc7, 0xc3, 0xc3, 0xc7, 0xfe, 0xc7, 0xc3, 0xc3, 0xc7, 0xfe},
|
||||
{0x00, 0x00, 0x7e, 0xe7, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xe7, 0x7e},
|
||||
{0x00, 0x00, 0xfc, 0xce, 0xc7, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc7, 0xce, 0xfc},
|
||||
{0x00, 0x00, 0xff, 0xc0, 0xc0, 0xc0, 0xc0, 0xfc, 0xc0, 0xc0, 0xc0, 0xc0, 0xff},
|
||||
{0x00, 0x00, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xfc, 0xc0, 0xc0, 0xc0, 0xff},
|
||||
{0x00, 0x00, 0x7e, 0xe7, 0xc3, 0xc3, 0xcf, 0xc0, 0xc0, 0xc0, 0xc0, 0xe7, 0x7e},
|
||||
{0x00, 0x00, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xff, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3},
|
||||
{0x00, 0x00, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x7e},
|
||||
{0x00, 0x00, 0x7c, 0xee, 0xc6, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06},
|
||||
{0x00, 0x00, 0xc3, 0xc6, 0xcc, 0xd8, 0xf0, 0xe0, 0xf0, 0xd8, 0xcc, 0xc6, 0xc3},
|
||||
{0x00, 0x00, 0xff, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0},
|
||||
{0x00, 0x00, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xdb, 0xff, 0xff, 0xe7, 0xc3},
|
||||
{0x00, 0x00, 0xc7, 0xc7, 0xcf, 0xcf, 0xdf, 0xdb, 0xfb, 0xf3, 0xf3, 0xe3, 0xe3},
|
||||
{0x00, 0x00, 0x7e, 0xe7, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xe7, 0x7e},
|
||||
{0x00, 0x00, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xfe, 0xc7, 0xc3, 0xc3, 0xc7, 0xfe},
|
||||
{0x00, 0x00, 0x3f, 0x6e, 0xdf, 0xdb, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0x66, 0x3c},
|
||||
{0x00, 0x00, 0xc3, 0xc6, 0xcc, 0xd8, 0xf0, 0xfe, 0xc7, 0xc3, 0xc3, 0xc7, 0xfe},
|
||||
{0x00, 0x00, 0x7e, 0xe7, 0x03, 0x03, 0x07, 0x7e, 0xe0, 0xc0, 0xc0, 0xe7, 0x7e},
|
||||
{0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xff},
|
||||
{0x00, 0x00, 0x7e, 0xe7, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3},
|
||||
{0x00, 0x00, 0x18, 0x3c, 0x3c, 0x66, 0x66, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3},
|
||||
{0x00, 0x00, 0xc3, 0xe7, 0xff, 0xff, 0xdb, 0xdb, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3},
|
||||
{0x00, 0x00, 0xc3, 0x66, 0x66, 0x3c, 0x3c, 0x18, 0x3c, 0x3c, 0x66, 0x66, 0xc3},
|
||||
{0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x3c, 0x66, 0x66, 0xc3},
|
||||
{0x00, 0x00, 0xff, 0xc0, 0xc0, 0x60, 0x30, 0x7e, 0x0c, 0x06, 0x03, 0x03, 0xff},
|
||||
{0x00, 0x00, 0x3c, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x3c},
|
||||
{0x00, 0x03, 0x03, 0x06, 0x06, 0x0c, 0x0c, 0x18, 0x18, 0x30, 0x30, 0x60, 0x60},
|
||||
{0x00, 0x00, 0x3c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x3c},
|
||||
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc3, 0x66, 0x3c, 0x18},
|
||||
{0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x38, 0x30, 0x70},
|
||||
{0x00, 0x00, 0x7f, 0xc3, 0xc3, 0x7f, 0x03, 0xc3, 0x7e, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x00, 0x00, 0xfe, 0xc3, 0xc3, 0xc3, 0xc3, 0xfe, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0},
|
||||
{0x00, 0x00, 0x7e, 0xc3, 0xc0, 0xc0, 0xc0, 0xc3, 0x7e, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x00, 0x00, 0x7f, 0xc3, 0xc3, 0xc3, 0xc3, 0x7f, 0x03, 0x03, 0x03, 0x03, 0x03},
|
||||
{0x00, 0x00, 0x7f, 0xc0, 0xc0, 0xfe, 0xc3, 0xc3, 0x7e, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x00, 0x00, 0x30, 0x30, 0x30, 0x30, 0x30, 0xfc, 0x30, 0x30, 0x30, 0x33, 0x1e},
|
||||
{0x7e, 0xc3, 0x03, 0x03, 0x7f, 0xc3, 0xc3, 0xc3, 0x7e, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x00, 0x00, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xfe, 0xc0, 0xc0, 0xc0, 0xc0},
|
||||
{0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x18, 0x00},
|
||||
{0x38, 0x6c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x00, 0x00, 0x0c, 0x00},
|
||||
{0x00, 0x00, 0xc6, 0xcc, 0xf8, 0xf0, 0xd8, 0xcc, 0xc6, 0xc0, 0xc0, 0xc0, 0xc0},
|
||||
{0x00, 0x00, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x78},
|
||||
{0x00, 0x00, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0xfe, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xfc, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00},
|
||||
{0xc0, 0xc0, 0xc0, 0xfe, 0xc3, 0xc3, 0xc3, 0xc3, 0xfe, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x03, 0x03, 0x03, 0x7f, 0xc3, 0xc3, 0xc3, 0xc3, 0x7f, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x00, 0x00, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xe0, 0xfe, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x00, 0x00, 0xfe, 0x03, 0x03, 0x7e, 0xc0, 0xc0, 0x7f, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x00, 0x00, 0x1c, 0x36, 0x30, 0x30, 0x30, 0x30, 0xfc, 0x30, 0x30, 0x30, 0x00},
|
||||
{0x00, 0x00, 0x7e, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x00, 0x00, 0x18, 0x3c, 0x3c, 0x66, 0x66, 0xc3, 0xc3, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x00, 0x00, 0xc3, 0xe7, 0xff, 0xdb, 0xc3, 0xc3, 0xc3, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x00, 0x00, 0xc3, 0x66, 0x3c, 0x18, 0x3c, 0x66, 0xc3, 0x00, 0x00, 0x00, 0x00},
|
||||
{0xc0, 0x60, 0x60, 0x30, 0x18, 0x3c, 0x66, 0x66, 0xc3, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x00, 0x00, 0xff, 0x60, 0x30, 0x18, 0x0c, 0x06, 0xff, 0x00, 0x00, 0x00, 0x00},
|
||||
{0x00, 0x00, 0x0f, 0x18, 0x18, 0x18, 0x38, 0xf0, 0x38, 0x18, 0x18, 0x18, 0x0f},
|
||||
{0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18},
|
||||
{0x00, 0x00, 0xf0, 0x18, 0x18, 0x18, 0x1c, 0x0f, 0x1c, 0x18, 0x18, 0x18, 0xf0},
|
||||
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x8f, 0xf1, 0x60, 0x00, 0x00, 0x00}
|
||||
};
|
||||
|
||||
RasterFont::RasterFont()
|
||||
{
|
||||
// set GL modes
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||
// create the raster font
|
||||
fontOffset = glGenLists(128);
|
||||
for (int i = 32; i < 127; i++) {
|
||||
glNewList(i + fontOffset, GL_COMPILE);
|
||||
glBitmap(8, 13, 0.0f, 2.0f, 10.0f, 0.0f, rasters[i - 32]);
|
||||
glEndList();
|
||||
}
|
||||
|
||||
temp_buffer = new char[TEMP_BUFFER_SIZE];
|
||||
}
|
||||
|
||||
RasterFont::~RasterFont()
|
||||
{
|
||||
glDeleteLists(fontOffset, 128);
|
||||
delete [] temp_buffer;
|
||||
}
|
||||
|
||||
void RasterFont::printString(const char *s, double x, double y, double z)
|
||||
{
|
||||
int length = (int)strlen(s);
|
||||
if (!length)
|
||||
return;
|
||||
if (length >= TEMP_BUFFER_SIZE)
|
||||
length = TEMP_BUFFER_SIZE - 1;
|
||||
|
||||
// Sanitize string to avoid GL errors.
|
||||
char *s2 = temp_buffer;
|
||||
memcpy(s2, s, length);
|
||||
s2[length] = 0;
|
||||
for (int i = 0; i < length; i++) {
|
||||
if (s2[i] < 32 || s2[i] > 126)
|
||||
s2[i] = '!';
|
||||
}
|
||||
|
||||
// go to the right spot
|
||||
glRasterPos3d(x, y, z);
|
||||
GL_REPORT_ERRORD();
|
||||
|
||||
glPushAttrib (GL_LIST_BIT);
|
||||
glListBase(fontOffset);
|
||||
glCallLists((GLsizei)strlen(s2), GL_UNSIGNED_BYTE, (GLubyte *) s2);
|
||||
GL_REPORT_ERRORD();
|
||||
glPopAttrib();
|
||||
GL_REPORT_ERRORD();
|
||||
}
|
||||
|
||||
void RasterFont::printCenteredString(const char *s, double y, int screen_width, double z)
|
||||
{
|
||||
int length = (int)strlen(s);
|
||||
int x = (int)(screen_width/2.0 - (length/2.0)*char_width);
|
||||
printString(s, x, y, z);
|
||||
}
|
||||
|
||||
void RasterFont::printMultilineText(const char *text, double start_x, double start_y, double z, int bbWidth, int bbHeight)
|
||||
{
|
||||
double x = start_x;
|
||||
double y = start_y;
|
||||
char temp[1024];
|
||||
char *t = temp;
|
||||
while (*text)
|
||||
{
|
||||
if (*text == '\n')
|
||||
{
|
||||
*t = 0;
|
||||
printString(temp, x, y, z);
|
||||
y -= char_height * 2.0f / bbHeight;
|
||||
x = start_x;
|
||||
t = temp;
|
||||
}
|
||||
else if (*text == '\r')
|
||||
{
|
||||
t = temp;
|
||||
}
|
||||
else if (*text == '\t')
|
||||
{
|
||||
//todo: add tabs every something like 4*char_width
|
||||
*t = 0;
|
||||
int cpos = (int)strlen(temp);
|
||||
int newpos = (cpos + 4) & (~3);
|
||||
printString(temp, x, y, z);
|
||||
x = start_x + (char_width*newpos) * 2.0f / bbWidth;
|
||||
t = temp;
|
||||
*t++ = ' ';
|
||||
}
|
||||
else
|
||||
*t++ = *text;
|
||||
|
||||
text++;
|
||||
}
|
||||
|
||||
// ????
|
||||
if (t != text)
|
||||
{
|
||||
*t = 0;
|
||||
printString(temp, x, y, z);
|
||||
}
|
||||
}
|
42
Source/Plugins/Plugin_VideoSoftware/Src/RasterFont.h
Normal file
42
Source/Plugins/Plugin_VideoSoftware/Src/RasterFont.h
Normal file
@ -0,0 +1,42 @@
|
||||
// Copyright (C) 2003 Dolphin Project.
|
||||
|
||||
// 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
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#ifndef _RASTERFONT_H_
|
||||
#define _RASTERFONT_H_
|
||||
|
||||
class RasterFont {
|
||||
public:
|
||||
RasterFont();
|
||||
~RasterFont(void);
|
||||
static int debug;
|
||||
|
||||
// some useful constants
|
||||
enum {char_width = 10};
|
||||
enum {char_height = 15};
|
||||
|
||||
// and the happy helper functions
|
||||
void printString(const char *s, double x, double y, double z=0.0);
|
||||
void printCenteredString(const char *s, double y, int screen_width, double z=0.0);
|
||||
|
||||
void printMultilineText(const char *text, double x, double y, double z, int bbWidth, int bbHeight);
|
||||
private:
|
||||
int fontOffset;
|
||||
char *temp_buffer;
|
||||
enum {TEMP_BUFFER_SIZE = 64 * 1024};
|
||||
};
|
||||
|
||||
#endif // _RASTERFONT_H_
|
@ -56,7 +56,7 @@ CPReg cpreg; // shared between gfx and emulator thread
|
||||
|
||||
void DoState(PointerWrap &p)
|
||||
{
|
||||
p.Do(cpreg);
|
||||
p.DoPOD(cpreg);
|
||||
p.DoArray(commandBuffer, commandBufferSize);
|
||||
p.Do(readPos);
|
||||
p.Do(writePos);
|
||||
|
@ -50,7 +50,7 @@ static int et_SetFinishOnMainThread;
|
||||
|
||||
void DoState(PointerWrap &p)
|
||||
{
|
||||
p.Do(pereg);
|
||||
p.DoPOD(pereg);
|
||||
p.Do(g_bSignalTokenInterrupt);
|
||||
p.Do(g_bSignalFinishInterrupt);
|
||||
p.Do(et_SetTokenOnMainThread);
|
||||
|
@ -19,11 +19,12 @@
|
||||
#include <math.h>
|
||||
|
||||
#include "../../Plugin_VideoOGL/Src/GLUtil.h"
|
||||
#include "../../Plugin_VideoOGL/Src/RasterFont.h"
|
||||
#include "../../Plugin_VideoOGL/Src/ProgramShaderCache.h"
|
||||
#include "RasterFont.h"
|
||||
#include "SWRenderer.h"
|
||||
#include "SWStatistics.h"
|
||||
|
||||
#include "OnScreenDisplay.h"
|
||||
|
||||
static GLuint s_RenderTarget = 0;
|
||||
|
||||
static GLint attr_pos = -1, attr_tex = -1;
|
||||
@ -33,7 +34,7 @@ static GLuint program;
|
||||
// Rasterfont isn't compatible with GLES
|
||||
// degasus: I think it does, but I can't test it
|
||||
#ifndef USE_GLES
|
||||
OGL::RasterFont* s_pfont = NULL;
|
||||
RasterFont* s_pfont = NULL;
|
||||
#endif
|
||||
|
||||
void SWRenderer::Init()
|
||||
@ -47,7 +48,6 @@ void SWRenderer::Shutdown()
|
||||
#ifndef USE_GLES
|
||||
delete s_pfont;
|
||||
s_pfont = 0;
|
||||
OGL::ProgramShaderCache::Shutdown();
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -90,9 +90,7 @@ void SWRenderer::Prepare()
|
||||
CreateShaders();
|
||||
// TODO: Enable for GLES once RasterFont supports GLES
|
||||
#ifndef USE_GLES
|
||||
// ogl rasterfont depends on ogl programshadercache
|
||||
OGL::ProgramShaderCache::Init();
|
||||
s_pfont = new OGL::RasterFont();
|
||||
s_pfont = new RasterFont();
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
#endif
|
||||
GL_REPORT_ERRORD();
|
||||
@ -103,14 +101,12 @@ void SWRenderer::RenderText(const char* pstr, int left, int top, u32 color)
|
||||
#ifndef USE_GLES
|
||||
int nBackbufferWidth = (int)GLInterface->GetBackBufferWidth();
|
||||
int nBackbufferHeight = (int)GLInterface->GetBackBufferHeight();
|
||||
|
||||
glColor4f(((color>>16) & 0xff)/255.0f, ((color>> 8) & 0xff)/255.0f,
|
||||
((color>> 0) & 0xff)/255.0f, ((color>>24) & 0xFF)/255.0f);
|
||||
s_pfont->printMultilineText(pstr,
|
||||
left * 2.0f / (float)nBackbufferWidth - 1,
|
||||
1 - top * 2.0f / (float)nBackbufferHeight,
|
||||
0, nBackbufferWidth, nBackbufferHeight, color);
|
||||
|
||||
glBindVertexArray(0);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
left * 2.0f / (float)nBackbufferWidth - 1,
|
||||
1 - top * 2.0f / (float)nBackbufferHeight,
|
||||
0, nBackbufferWidth, nBackbufferHeight);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -123,7 +119,7 @@ void SWRenderer::DrawDebugText()
|
||||
if (g_SWVideoConfig.bShowStats)
|
||||
{
|
||||
p+=sprintf(p,"Objects: %i\n",swstats.thisFrame.numDrawnObjects);
|
||||
p+=sprintf(p,"Primatives: %i\n",swstats.thisFrame.numPrimatives);
|
||||
p+=sprintf(p,"Primitives: %i\n",swstats.thisFrame.numPrimatives);
|
||||
p+=sprintf(p,"Vertices Loaded: %i\n",swstats.thisFrame.numVerticesLoaded);
|
||||
|
||||
p+=sprintf(p,"Triangles Input: %i\n",swstats.thisFrame.numTrianglesIn);
|
||||
@ -228,6 +224,9 @@ void SWRenderer::DrawTexture(u8 *texture, int width, int height)
|
||||
|
||||
void SWRenderer::SwapBuffer()
|
||||
{
|
||||
// Do our OSD callbacks
|
||||
OSD::DoCallbacks(OSD::OSD_ONFRAME);
|
||||
|
||||
DrawDebugText();
|
||||
|
||||
glFlush();
|
||||
|
@ -238,7 +238,7 @@ void SWVertexLoader::SetFormat(u8 attributeIndex, u8 primitiveType)
|
||||
const int elements = tcElements[i];
|
||||
_assert_msg_(VIDEO, NOT_PRESENT <= desc && desc <= INDEX16, "Invalid texture coordinates description!\n(desc = %d)", desc);
|
||||
_assert_msg_(VIDEO, FORMAT_UBYTE <= format && format <= FORMAT_FLOAT, "Invalid texture coordinates format!\n(format = %d)", format);
|
||||
_assert_msg_(VIDEO, 0 <= elements && elements <= 1, "Invalid number of texture coordinates elemnts!\n(elements = %d)", elements);
|
||||
_assert_msg_(VIDEO, 0 <= elements && elements <= 1, "Invalid number of texture coordinates elements!\n(elements = %d)", elements);
|
||||
|
||||
m_texCoordLoader[i] = VertexLoader_TextCoord::GetFunction(desc, format, elements);
|
||||
m_VertexSize += VertexLoader_TextCoord::GetSize(desc, format, elements);
|
||||
|
@ -47,7 +47,6 @@ SWVideoConfig::SWVideoConfig()
|
||||
|
||||
void SWVideoConfig::Load(const char* ini_file)
|
||||
{
|
||||
std::string temp;
|
||||
IniFile iniFile;
|
||||
iniFile.Load(ini_file);
|
||||
|
||||
|
@ -43,6 +43,7 @@
|
||||
#include "SWVertexLoader.h"
|
||||
#include "SWStatistics.h"
|
||||
|
||||
#include "OnScreenDisplay.h"
|
||||
#define VSYNC_ENABLED 0
|
||||
|
||||
namespace SW
|
||||
@ -81,6 +82,8 @@ bool VideoSoftware::Initialize(void *&window_handle)
|
||||
INFO_LOG(VIDEO, "%s", "SWRenderer::Create failed\n");
|
||||
return false;
|
||||
}
|
||||
// Do our OSD callbacks
|
||||
OSD::DoCallbacks(OSD::OSD_INIT);
|
||||
|
||||
InitBPMemory();
|
||||
InitXFMemory();
|
||||
@ -111,15 +114,15 @@ void VideoSoftware::DoState(PointerWrap& p)
|
||||
OpcodeDecoder::DoState(p);
|
||||
Clipper::DoState(p);
|
||||
p.Do(swxfregs);
|
||||
p.Do(bpmem);
|
||||
p.Do(swstats);
|
||||
p.Do(bpmem);
|
||||
p.DoPOD(swstats);
|
||||
|
||||
// CP Memory
|
||||
p.DoArray(arraybases, 16);
|
||||
p.DoArray(arraystrides, 16);
|
||||
p.Do(MatrixIndexA);
|
||||
p.Do(MatrixIndexB);
|
||||
p.Do(g_VtxDesc.Hex);
|
||||
p.DoArray(arraybases, 16);
|
||||
p.DoArray(arraystrides, 16);
|
||||
p.Do(MatrixIndexA);
|
||||
p.Do(MatrixIndexB);
|
||||
p.Do(g_VtxDesc.Hex);
|
||||
p.DoArray(g_VtxAttr, 8);
|
||||
p.DoMarker("CP Memory");
|
||||
|
||||
@ -162,7 +165,10 @@ void VideoSoftware::Shutdown()
|
||||
// TODO: should be in Video_Cleanup
|
||||
HwRasterizer::Shutdown();
|
||||
SWRenderer::Shutdown();
|
||||
|
||||
|
||||
// Do our OSD callbacks
|
||||
OSD::DoCallbacks(OSD::OSD_SHUTDOWN);
|
||||
|
||||
GLInterface->Shutdown();
|
||||
}
|
||||
|
||||
|
@ -20,12 +20,13 @@
|
||||
#include "Tev.h"
|
||||
#include "EfbInterface.h"
|
||||
#include "TextureSampler.h"
|
||||
#include "XFMemLoader.h"
|
||||
#include "SWPixelEngine.h"
|
||||
#include "SWStatistics.h"
|
||||
#include "SWVideoConfig.h"
|
||||
#include "DebugUtil.h"
|
||||
|
||||
#include <math.h>
|
||||
#include <cmath>
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define ALLOW_TEV_DUMPS 1
|
||||
@ -697,9 +698,13 @@ void Tev::Draw()
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// convert to 8 bits per component
|
||||
u8 output[4] = {(u8)Reg[0][ALP_C], (u8)Reg[0][BLU_C], (u8)Reg[0][GRN_C], (u8)Reg[0][RED_C]};
|
||||
|
||||
// convert to 8 bits per component
|
||||
// the results of the last tev stage are put onto the screen,
|
||||
// regardless of the used destination register - TODO: Verify!
|
||||
u32 color_index = bpmem.combiners[bpmem.genMode.numtevstages].colorC.dest;
|
||||
u32 alpha_index = bpmem.combiners[bpmem.genMode.numtevstages].alphaC.dest;
|
||||
u8 output[4] = {(u8)Reg[alpha_index][ALP_C], (u8)Reg[color_index][BLU_C], (u8)Reg[color_index][GRN_C], (u8)Reg[color_index][RED_C]};
|
||||
|
||||
if (!TevAlphaTest(output[ALP_C]))
|
||||
return;
|
||||
@ -748,10 +753,22 @@ void Tev::Draw()
|
||||
|
||||
}
|
||||
|
||||
// stuff to do!
|
||||
// here, where we'll have to add/handle x range adjustment (if related BP register it's enabled)
|
||||
// x_adjust = sqrt((x-center)^2 + k^2)/k
|
||||
// ze *= x_adjust
|
||||
if(bpmem.fogRange.Base.Enabled)
|
||||
{
|
||||
// TODO: This is untested and should definitely be checked against real hw.
|
||||
// - No idea if offset is really normalized against the viewport width or against the projection matrix or yet something else
|
||||
// - scaling of the "k" coefficient isn't clear either.
|
||||
|
||||
// First, calculate the offset from the viewport center (normalized to 0..1)
|
||||
float offset = (Position[0] - (bpmem.fogRange.Base.Center - 342)) / (float)swxfregs.viewport.wd;
|
||||
// Based on that, choose the index such that points which are far away from the z-axis use the 10th "k" value and such that central points use the first value.
|
||||
int index = 9 - std::abs(offset) * 9.f;
|
||||
index = (index < 0) ? 0 : (index > 9) ? 9 : index; // TODO: Shouldn't be necessary!
|
||||
// Look up coefficient... Seems like multiplying by 4 makes Fortune Street work properly (fog is too strong without the factor)
|
||||
float k = bpmem.fogRange.K[index/2].GetValue(index%2) * 4.f;
|
||||
float x_adjust = sqrt(offset*offset + k*k)/k;
|
||||
ze *= x_adjust; // NOTE: This is basically dividing by a cosine (hidden behind GXInitFogAdjTable): 1/cos = c/b = sqrt(a^2+b^2)/b
|
||||
}
|
||||
|
||||
ze -= bpmem.fog.c_proj_fsel.GetC();
|
||||
|
||||
|
@ -88,13 +88,13 @@ void TransformPosition(const InputVertexData *src, OutputVertexData *dst)
|
||||
const float* mat = (const float*)&swxfregs.posMatrices[src->posMtx * 4];
|
||||
MultiplyVec3Mat34(src->position, mat, dst->mvPosition);
|
||||
|
||||
if (swxfregs.projection[6] == 0)
|
||||
if (swxfregs.projection.type == GX_PERSPECTIVE)
|
||||
{
|
||||
MultipleVec3Perspective(dst->mvPosition, swxfregs.projection, dst->projectedPosition);
|
||||
MultipleVec3Perspective(dst->mvPosition, swxfregs.projection.rawProjection, dst->projectedPosition);
|
||||
}
|
||||
else
|
||||
{
|
||||
MultipleVec3Ortho(dst->mvPosition, swxfregs.projection, dst->projectedPosition);
|
||||
MultipleVec3Ortho(dst->mvPosition, swxfregs.projection.rawProjection, dst->projectedPosition);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -85,6 +85,9 @@ struct Light
|
||||
#define LIGHTATTN_NONE 2
|
||||
#define LIGHTATTN_DIR 3
|
||||
|
||||
#define GX_PERSPECTIVE 0
|
||||
#define GX_ORTHOGRAPHIC 1
|
||||
|
||||
union LitChannel
|
||||
{
|
||||
struct
|
||||
@ -160,6 +163,12 @@ struct Viewport
|
||||
float farZ;
|
||||
};
|
||||
|
||||
struct Projection
|
||||
{
|
||||
float rawProjection[6];
|
||||
u32 type; // only GX_PERSPECTIVE or GX_ORTHOGRAPHIC are allowed
|
||||
};
|
||||
|
||||
union TexMtxInfo
|
||||
{
|
||||
struct
|
||||
@ -218,7 +227,7 @@ struct XFRegisters
|
||||
TXFMatrixIndexA MatrixIndexA; // 0x1018
|
||||
TXFMatrixIndexB MatrixIndexB; // 0x1019
|
||||
Viewport viewport; // 0x101a - 0x101f
|
||||
float projection[7]; // 0x1020 - 0x1026
|
||||
Projection projection; // 0x1020 - 0x1026
|
||||
u32 unk8[24]; // 0x1027 - 0x103e
|
||||
u32 numTexGens; // 0x103f
|
||||
TexMtxInfo texMtxInfo[8]; // 0x1040 - 0x1047
|
||||
|
Reference in New Issue
Block a user