nuke softrend

This commit is contained in:
Flyinghead 2020-02-26 23:41:05 +01:00
parent 1b8c2a63c2
commit 99f04ec753
14 changed files with 81 additions and 1532 deletions

View File

@ -111,9 +111,6 @@ elseif(${FEAT_SHREC} EQUAL ${DYNAREC_CPP})
list(APPEND core_SRCS ${d_core}/rec-cpp/rec_cpp.cpp)
endif()
add_definitions(/DFEAT_HAS_SOFTREND=0)
### deps.cmake #################################################################################
set(d_deps ${reicast_core_path}/deps)

View File

@ -253,10 +253,6 @@
#define FEAT_HAS_COREIO_HTTP 0
#endif
#if defined(TARGET_SOFTREND)
#define FEAT_HAS_SOFTREND 1
#endif
//defaults
#ifndef FEAT_SHREC
@ -289,10 +285,6 @@
#define FEAT_HAS_COREIO_HTTP 1
#endif
#ifndef FEAT_HAS_SOFTREND
#define FEAT_HAS_SOFTREND BUILD_COMPILER == COMPILER_VC //GCC wants us to enable sse4 globaly to enable intrins
#endif
#if HOST_CPU == CPU_X64 || HOST_CPU == CPU_ARM64
#define HOST_64BIT_CPU
#endif

View File

@ -148,11 +148,6 @@ ifdef USE_GLES
RZDCY_CFLAGS += -DGLES -fPIC
endif
ifdef HAS_SOFTREND
RZDCY_CFLAGS += -DTARGET_SOFTREND
RZDCY_MODULES += rend/soft/
endif
ifdef CHD5_FLAC
RZDCY_CFLAGS += -DCHD5_FLAC -I$(RZDCY_SRC_DIR)/deps/flac/src/libFLAC/include/ -I$(RZDCY_SRC_DIR)/deps/flac/include
RZDCY_CFLAGS += -DHAVE_CONFIG_H

View File

@ -358,11 +358,6 @@ static void rend_create_renderer()
case 0:
renderer = rend_GLES2();
break;
#if FEAT_HAS_SOFTREND
case 2:
renderer = rend_softrend();
break;
#endif
#if !defined(GLES) && HOST_OS != OS_DARWIN
case 3:
renderer = rend_GL4();
@ -403,9 +398,12 @@ void rend_init_renderer()
void rend_term_renderer()
{
renderer->Term();
delete renderer;
renderer = NULL;
if (renderer != NULL)
{
renderer->Term();
delete renderer;
renderer = NULL;
}
if (fallback_renderer != NULL)
{
delete fallback_renderer;

View File

@ -54,7 +54,6 @@ Renderer* rend_GLES2();
Renderer* rend_GL4();
#endif
Renderer* rend_norend();
Renderer* rend_softrend();
#ifdef USE_VULKAN
Renderer* rend_Vulkan();
Renderer* rend_OITVulkan();

View File

@ -1,105 +0,0 @@
#include <d3d11.h>
#include "hw/pvr/Renderer_if.h"
#include "oslib/oslib.h"
#pragma comment(lib,"d3d11.lib")
struct d3d11 : Renderer
{
ID3D11Device* dev;
IDXGISwapChain* swapchain;
ID3D11DeviceContext* devctx;
ID3D11RenderTargetView* rtv;
bool Init()
{
HRESULT hr;
DXGI_SWAP_CHAIN_DESC sd;
ZeroMemory( &sd, sizeof( sd ) );
sd.BufferCount = 1;
sd.BufferDesc.Width = 640;
sd.BufferDesc.Height = 480;
sd.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
sd.BufferDesc.RefreshRate.Numerator = 60;
sd.BufferDesc.RefreshRate.Denominator = 1;
sd.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
sd.OutputWindow = (HWND)libPvr_GetRenderTarget();
sd.SampleDesc.Count = 1;
sd.SampleDesc.Quality = 0;
sd.Windowed = TRUE;
D3D_FEATURE_LEVEL FeatureLevelsRequested = D3D_FEATURE_LEVEL_10_0;
UINT numLevelsRequested = 1;
D3D_FEATURE_LEVEL FeatureLevelsSupported;
if( FAILED (hr = D3D11CreateDeviceAndSwapChain( NULL,
D3D_DRIVER_TYPE_HARDWARE,
NULL,
0,
&FeatureLevelsRequested,
numLevelsRequested,
D3D11_SDK_VERSION,
&sd,
&swapchain,
&dev,
&FeatureLevelsSupported,
&devctx )))
{
return hr;
}
ID3D11Texture2D* pBackBuffer;
// Get a pointer to the back buffer
hr = swapchain->GetBuffer( 0, __uuidof( ID3D11Texture2D ),
( LPVOID* )&pBackBuffer );
// Create a render-target view
dev->CreateRenderTargetView( pBackBuffer, NULL, &rtv );
// Bind the view
devctx->OMSetRenderTargets( 1, &rtv, NULL );
D3D11_VIEWPORT vp;
vp.Width = 640;
vp.Height = 480;
vp.MinDepth = 0.0f;
vp.MaxDepth = 1.0f;
vp.TopLeftX = 0;
vp.TopLeftY = 0;
devctx->RSSetViewports( 1, &vp );
return true;
}
void Resize(int w, int h) { }
void Term() { }
bool Process(TA_context* ctx)
{
return true;
}
bool Render()
{
if (!pvrrc.isRTT)
{
float col[4]={0,rand()/(float)RAND_MAX,rand()/(float)RAND_MAX,0};
devctx->ClearRenderTargetView(rtv,col);
}
return !pvrrc.isRTT;
}
void Present()
{
swapchain->Present(0,0);
}
};
Renderer* rend_D3D11()
{
return new d3d11();
}

View File

@ -199,7 +199,6 @@ extern struct ShaderUniforms_t
struct TextureCacheData : BaseTextureCacheData
{
GLuint texID; //gl texture
u16* pData;
virtual std::string GetId() override { return std::to_string(texID); }
virtual void UploadToGPU(int width, int height, u8 *temp_tex_buffer, bool mipmapped) override;
virtual bool Delete() override;

View File

@ -25,10 +25,6 @@ Compression
look into it, but afaik PVRC is not realtime doable
*/
#if FEAT_HAS_SOFTREND
#include <xmmintrin.h>
#endif
extern u32 decoded_colors[3][65536];
TextureCache TexCache;
@ -75,122 +71,89 @@ static void dumpRtTexture(u32 name, u32 w, u32 h) {
void TextureCacheData::UploadToGPU(int width, int height, u8 *temp_tex_buffer, bool mipmapped)
{
if (texID != 0)
//upload to OpenGL !
glcache.BindTexture(GL_TEXTURE_2D, texID);
GLuint comps = GL_RGBA;
GLuint gltype;
switch (tex_type)
{
//upload to OpenGL !
glcache.BindTexture(GL_TEXTURE_2D, texID);
GLuint comps = GL_RGBA;
GLuint gltype;
switch (tex_type)
case TextureType::_5551:
gltype = GL_UNSIGNED_SHORT_5_5_5_1;
break;
case TextureType::_565:
gltype = GL_UNSIGNED_SHORT_5_6_5;
comps = GL_RGB;
break;
case TextureType::_4444:
gltype = GL_UNSIGNED_SHORT_4_4_4_4;
break;
case TextureType::_8888:
gltype = GL_UNSIGNED_BYTE;
break;
default:
die("Unsupported texture type");
break;
}
if (mipmapped)
{
int mipmapLevels = 0;
int dim = width;
while (dim != 0)
{
case TextureType::_5551:
gltype = GL_UNSIGNED_SHORT_5_5_5_1;
break;
case TextureType::_565:
gltype = GL_UNSIGNED_SHORT_5_6_5;
comps = GL_RGB;
break;
case TextureType::_4444:
gltype = GL_UNSIGNED_SHORT_4_4_4_4;
break;
case TextureType::_8888:
gltype = GL_UNSIGNED_BYTE;
break;
default:
die("Unsupported texture type");
break;
mipmapLevels++;
dim >>= 1;
}
if (mipmapped)
{
int mipmapLevels = 0;
int dim = width;
while (dim != 0)
{
mipmapLevels++;
dim >>= 1;
}
#if !defined(GLES2) && HOST_OS != OS_DARWIN
// Open GL 4.2 or GLES 3.0 min
if (gl.gl_major > 4 || (gl.gl_major == 4 && gl.gl_minor >= 2)
|| (gl.is_gles && gl.gl_major >= 3))
// Open GL 4.2 or GLES 3.0 min
if (gl.gl_major > 4 || (gl.gl_major == 4 && gl.gl_minor >= 2)
|| (gl.is_gles && gl.gl_major >= 3))
{
GLuint internalFormat;
switch (tex_type)
{
GLuint internalFormat;
switch (tex_type)
{
case TextureType::_5551:
internalFormat = GL_RGB5_A1;
break;
case TextureType::_565:
internalFormat = GL_RGB565;
break;
case TextureType::_4444:
internalFormat = GL_RGBA4;
break;
case TextureType::_8888:
internalFormat = GL_RGBA8;
break;
}
if (Updates == 1)
{
glTexStorage2D(GL_TEXTURE_2D, mipmapLevels, internalFormat, width, height);
glCheck();
}
for (int i = 0; i < mipmapLevels; i++)
{
glTexSubImage2D(GL_TEXTURE_2D, mipmapLevels - i - 1, 0, 0, 1 << i, 1 << i, comps, gltype, temp_tex_buffer);
temp_tex_buffer += (1 << (2 * i)) * (tex_type == TextureType::_8888 ? 4 : 2);
}
case TextureType::_5551:
internalFormat = GL_RGB5_A1;
break;
case TextureType::_565:
internalFormat = GL_RGB565;
break;
case TextureType::_4444:
internalFormat = GL_RGBA4;
break;
case TextureType::_8888:
internalFormat = GL_RGBA8;
break;
}
else
#endif
if (Updates == 1)
{
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, mipmapLevels - 1);
for (int i = 0; i < mipmapLevels; i++)
{
glTexImage2D(GL_TEXTURE_2D, mipmapLevels - i - 1, comps, 1 << i, 1 << i, 0, comps, gltype, temp_tex_buffer);
temp_tex_buffer += (1 << (2 * i)) * (tex_type == TextureType::_8888 ? 4 : 2);
}
glTexStorage2D(GL_TEXTURE_2D, mipmapLevels, internalFormat, width, height);
glCheck();
}
for (int i = 0; i < mipmapLevels; i++)
{
glTexSubImage2D(GL_TEXTURE_2D, mipmapLevels - i - 1, 0, 0, 1 << i, 1 << i, comps, gltype, temp_tex_buffer);
temp_tex_buffer += (1 << (2 * i)) * (tex_type == TextureType::_8888 ? 4 : 2);
}
}
else
#endif
{
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0);
glTexImage2D(GL_TEXTURE_2D, 0,comps, width, height, 0, comps, gltype, temp_tex_buffer);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, mipmapLevels - 1);
for (int i = 0; i < mipmapLevels; i++)
{
glTexImage2D(GL_TEXTURE_2D, mipmapLevels - i - 1, comps, 1 << i, 1 << i, 0, comps, gltype, temp_tex_buffer);
temp_tex_buffer += (1 << (2 * i)) * (tex_type == TextureType::_8888 ? 4 : 2);
}
}
glCheck();
}
else {
#if FEAT_HAS_SOFTREND
/*
if (tex_type == TextureType::_565)
tex_type = 0;
else if (tex_type == TextureType::_5551)
tex_type = 1;
else if (tex_type == TextureType::_4444)
tex_type = 2;
*/
u16 *tex_data = (u16 *)temp_tex_buffer;
if (pData) {
_mm_free(pData);
}
pData = (u16*)_mm_malloc(w * h * 16, 16);
for (int y = 0; y < h; y++) {
for (int x = 0; x < w; x++) {
u32* data = (u32*)&pData[(x + y*w) * 8];
data[0] = decoded_colors[tex_type][tex_data[(x + 1) % w + (y + 1) % h * w]];
data[1] = decoded_colors[tex_type][tex_data[(x + 0) % w + (y + 1) % h * w]];
data[2] = decoded_colors[tex_type][tex_data[(x + 1) % w + (y + 0) % h * w]];
data[3] = decoded_colors[tex_type][tex_data[(x + 0) % w + (y + 0) % h * w]];
}
}
#else
die("Soft rend disabled, invalid code path");
#endif
else
{
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0);
glTexImage2D(GL_TEXTURE_2D, 0,comps, width, height, 0, comps, gltype, temp_tex_buffer);
}
glCheck();
}
bool TextureCacheData::Delete()
@ -198,19 +161,9 @@ bool TextureCacheData::Delete()
if (!BaseTextureCacheData::Delete())
return false;
if (pData) {
#if FEAT_HAS_SOFTREND
_mm_free(pData);
pData = 0;
#else
die("softrend disabled, invalid codepath");
#endif
}
if (texID) {
if (texID)
glcache.DeleteTextures(1, &texID);
}
return true;
}
@ -437,33 +390,8 @@ u64 gl_GetTexture(TSP tsp, TCW tcw)
return tf->texID;
}
text_info raw_GetTexture(TSP tsp, TCW tcw)
void DoCleanup()
{
text_info rv = { 0 };
//lookup texture
TextureCacheData* tf = TexCache.getTextureCacheData(tsp, tcw);
if (tf->pData == nullptr)
tf->Create();
//update if needed
if (tf->NeedsUpdate())
tf->Update();
//return gl texture
rv.height = tf->h;
rv.width = tf->w;
rv.pdata = tf->pData;
rv.textype = (u32)tf->tex_type;
return rv;
}
void DoCleanup() {
}
GLuint fbTextureId;

File diff suppressed because it is too large Load Diff

View File

@ -1,8 +1,8 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
@ -12,7 +12,7 @@ buildscript {
allprojects {
repositories {
jcenter()
google()
jcenter()
}
}

View File

@ -319,11 +319,6 @@ set(CMAKE_CXX_FLAGS " ${_CXX_FLAGS}") # ${CMAKE_CXX_FLAGS}
#define FEAT_HAS_COREIO_HTTP 0
#endif
#if defined(TARGET_SOFTREND) # need -fopenmp
#define FEAT_HAS_SOFTREND 1
#endif
if (TARGET_NSW) # -DCMAKE_TOOLCHAIN_FILE=./cmake/devkitA64.cmake -DTARGET_NSW=ON
set(HOST_OS ${OS_NSW_HOS})
@ -332,7 +327,7 @@ if (TARGET_NSW) # -DCMAKE_TOOLCHAIN_FILE=./cmake/devkitA64.cmake -DTARGET_NSW=ON
add_definitions(-D__SWITCH__ -DGLES -DMESA_EGL_NO_X11_HEADERS)
add_definitions(-DTARGET_NO_THREADS -DTARGET_NO_EXCEPTIONS -DTARGET_NO_NIXPROF)
add_definitions(-DTARGET_NO_COREIO_HTTP -UTARGET_SOFTREND)
add_definitions(-DTARGET_NO_COREIO_HTTP)
add_definitions(-D_GLIBCXX_USE_C99_MATH_TR1 -D_LDBL_EQ_DBL)
endif()
@ -344,7 +339,7 @@ if (TARGET_PS4) # -DCMAKE_TOOLCHAIN_FILE=./cmake/{ps4sdk,clang_scei}.cmake -DTAR
add_definitions(-DPS4 -DTARGET_PS4 -DTARGET_BSD -D__ORBIS__ -DGLES -DMESA_EGL_NO_X11_HEADERS) ## last needed for __unix__ on eglplatform.h
add_definitions(-DTARGET_NO_THREADS -DTARGET_NO_EXCEPTIONS -DTARGET_NO_NIXPROF)
add_definitions(-DTARGET_NO_COREIO_HTTP -UTARGET_SOFTREND)
add_definitions(-DTARGET_NO_COREIO_HTTP)
message("*******FIXME******** LARGE PAGES !!")

View File

@ -389,10 +389,6 @@ ifdef USE_LIBAO
LIBS += `pkg-config --libs ao`
endif
ifdef HAS_SOFTREND
CFLAGS += -msse4.1
endif
# these are also handled on core.mk, but ignored here
# GLES on x11?
@ -403,11 +399,6 @@ else ifdef FOR_LINUX
LIBS += -ldl -lGL #for desktop gl
endif
#softrend?
ifdef HAS_SOFTREND
CXXFLAGS += -DTARGET_SOFTREND
endif
ifdef TEST_AUTOMATION
CFLAGS += -DTEST_AUTOMATION
endif

View File

@ -257,7 +257,6 @@
<ClCompile Include="..\core\rend\gles\imgui_impl_opengl3.cpp" />
<ClCompile Include="..\core\rend\gui.cpp" />
<ClCompile Include="..\core\rend\gui_util.cpp" />
<ClCompile Include="..\core\rend\soft\softrend.cpp" />
<ClCompile Include="..\core\rend\TexCache.cpp" />
<ClCompile Include="..\core\serialize.cpp" />
<ClCompile Include="..\core\stdclass.cpp" />

View File

@ -333,9 +333,6 @@
<ClCompile Include="..\core\rec-cpp\rec_cpp.cpp">
<Filter>rec-cpp</Filter>
</ClCompile>
<ClCompile Include="..\core\rend\soft\softrend.cpp">
<Filter>rend\soft</Filter>
</ClCompile>
<ClCompile Include="..\core\hw\naomi\naomi.cpp">
<Filter>hw\naomi</Filter>
</ClCompile>