mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-24 08:30:16 +00:00
(D3D driver) Add HAVE_CG defines
This commit is contained in:
parent
d786df681f
commit
3005adffc3
@ -1,5 +1,7 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2012 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2012 - Daniel De Matteis
|
||||
* Copyright (C) 2012 - OV2
|
||||
*
|
||||
* RetroArch 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 Found-
|
||||
@ -36,6 +38,9 @@
|
||||
#define IDI_ICON 1
|
||||
#define MAX_MONITORS 9
|
||||
|
||||
/* TODO: Make Cg optional - same as in the GL driver where we can either bake in
|
||||
* GLSL, Cg or HLSL shader support */
|
||||
|
||||
namespace Monitor
|
||||
{
|
||||
static HMONITOR last_hm;
|
||||
@ -170,8 +175,10 @@ void D3DVideo::init(const video_info_t &info)
|
||||
|
||||
calculate_rect(screen_width, screen_height, info.force_aspect, g_settings.video.aspect_ratio);
|
||||
|
||||
#ifdef HAVE_CG
|
||||
if (!init_cg())
|
||||
throw std::runtime_error("Failed to init Cg");
|
||||
#endif
|
||||
if (!init_chain(info))
|
||||
throw std::runtime_error("Failed to init render chain");
|
||||
if (!init_font())
|
||||
@ -547,6 +554,7 @@ void D3DVideo::process()
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef HAVE_CG
|
||||
bool D3DVideo::init_cg()
|
||||
{
|
||||
cgCtx = cgCreateContext();
|
||||
@ -572,20 +580,26 @@ void D3DVideo::deinit_cg()
|
||||
cgCtx = nullptr;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void D3DVideo::init_chain_singlepass(const video_info_t &video_info)
|
||||
{
|
||||
LinkInfo info = {0};
|
||||
LinkInfo info_second = {0};
|
||||
|
||||
#ifdef HAVE_CG
|
||||
if (cg_shader.empty())
|
||||
{
|
||||
auto shader_type = g_settings.video.shader_type;
|
||||
if ((shader_type == RARCH_SHADER_CG || shader_type == RARCH_SHADER_AUTO) && *g_settings.video.cg_shader_path)
|
||||
if ((
|
||||
shader_type == RARCH_SHADER_CG ||
|
||||
shader_type == RARCH_SHADER_AUTO) && *g_settings.video.cg_shader_path)
|
||||
cg_shader = g_settings.video.cg_shader_path;
|
||||
}
|
||||
|
||||
info.shader_path = cg_shader;
|
||||
#endif
|
||||
|
||||
bool second_pass = g_settings.video.render_to_texture;
|
||||
|
||||
if (second_pass)
|
||||
@ -1174,11 +1188,13 @@ static bool d3d9_read_viewport(void *data, uint8_t *buffer)
|
||||
|
||||
static bool d3d9_set_shader(void *data, enum rarch_shader_type type, const char *path)
|
||||
{
|
||||
#ifdef HAVE_CG
|
||||
if (type != RARCH_SHADER_CG)
|
||||
{
|
||||
RARCH_ERR("[D3D9]: Only Cg shaders supported.\n");
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
return reinterpret_cast<D3DVideo*>(data)->set_shader(path);
|
||||
}
|
||||
|
@ -22,8 +22,11 @@
|
||||
#include <d3d9.h>
|
||||
#include <d3dx9.h>
|
||||
#include <d3dx9core.h>
|
||||
|
||||
#ifdef HAVE_CG
|
||||
#include <Cg/cg.h>
|
||||
#include <Cg/cgD3D9.h>
|
||||
#endif
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
@ -78,9 +81,11 @@ class D3DVideo
|
||||
bool needs_restore;
|
||||
bool restore();
|
||||
|
||||
#ifdef HAVE_CG
|
||||
CGcontext cgCtx;
|
||||
bool init_cg();
|
||||
void deinit_cg();
|
||||
#endif
|
||||
|
||||
void init_imports(ConfigFile &conf, const std::string &basedir);
|
||||
void init_luts(ConfigFile &conf, const std::string &basedir);
|
||||
|
@ -50,7 +50,9 @@ class RenderChain
|
||||
|
||||
RenderChain(const video_info_t &video_info,
|
||||
IDirect3DDevice9 *dev,
|
||||
#ifdef HAVE_CG
|
||||
CGcontext cgCtx,
|
||||
#endif
|
||||
const LinkInfo &info,
|
||||
PixelFormat fmt,
|
||||
const D3DVIEWPORT9 &final_viewport);
|
||||
@ -73,7 +75,9 @@ class RenderChain
|
||||
private:
|
||||
|
||||
IDirect3DDevice9 *dev;
|
||||
#ifdef HAVE_CG
|
||||
CGcontext cgCtx;
|
||||
#endif
|
||||
unsigned pixel_size;
|
||||
|
||||
const video_info_t &video_info;
|
||||
@ -98,7 +102,9 @@ class RenderChain
|
||||
LinkInfo info;
|
||||
IDirect3DTexture9 *tex;
|
||||
IDirect3DVertexBuffer9 *vertex_buf;
|
||||
#ifdef HAVE_CG
|
||||
CGprogram vPrg, fPrg;
|
||||
#endif
|
||||
unsigned last_width, last_height;
|
||||
|
||||
IDirect3DVertexDeclaration9 *vertex_decl;
|
||||
|
@ -90,7 +90,7 @@
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;HAVE_WIN32_D3D9;_DEBUG;_WINDOWS;%(PreprocessorDefinitions);HAVE_CONFIGFILE;HAVE_SCREENSHOTS;HAVE_BSV_MOVIE;HAVE_DINPUT;HAVE_XAUDIO;HAVE_DSOUND;HAVE_OPENGL;HAVE_DYLIB;HAVE_NETPLAY;HAVE_NETWORK_CMD;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;HAVE_DYNAMIC;PACKAGE_VERSION="0.9.8-beta2";_CRT_SECURE_NO_WARNINGS</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>WIN32;HAVE_WIN32_D3D9;HAVE_CG;_DEBUG;_WINDOWS;%(PreprocessorDefinitions);HAVE_CONFIGFILE;HAVE_SCREENSHOTS;HAVE_BSV_MOVIE;HAVE_DINPUT;HAVE_XAUDIO;HAVE_DSOUND;HAVE_OPENGL;HAVE_DYLIB;HAVE_NETPLAY;HAVE_NETWORK_CMD;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;HAVE_DYNAMIC;PACKAGE_VERSION="0.9.8-beta2";_CRT_SECURE_NO_WARNINGS</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(MSBuildProjectDirectory);$(MSBuildProjectDirectory)\..\..\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<CompileAs>CompileAsCpp</CompileAs>
|
||||
@ -126,7 +126,7 @@
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;HAVE_WIN32_D3D9;NDEBUG;_WINDOWS;%(PreprocessorDefinitions);HAVE_CONFIGFILE;HAVE_SCREENSHOTS;HAVE_BSV_MOVIE;HAVE_DINPUT;HAVE_XAUDIO;HAVE_DSOUND;HAVE_OPENGL;HAVE_DYLIB;HAVE_NETPLAY;HAVE_NETWORK_CMD;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;HAVE_DYNAMIC;PACKAGE_VERSION="0.9.8-beta2";_CRT_SECURE_NO_WARNINGS</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>WIN32;HAVE_WIN32_D3D9;HAVE_CG;NDEBUG;_WINDOWS;%(PreprocessorDefinitions);HAVE_CONFIGFILE;HAVE_SCREENSHOTS;HAVE_BSV_MOVIE;HAVE_DINPUT;HAVE_XAUDIO;HAVE_DSOUND;HAVE_OPENGL;HAVE_DYLIB;HAVE_NETPLAY;HAVE_NETWORK_CMD;HAVE_COMMAND;HAVE_STDIN_CMD;HAVE_THREADS;HAVE_DYNAMIC;PACKAGE_VERSION="0.9.8-beta2";_CRT_SECURE_NO_WARNINGS</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(MSBuildProjectDirectory);$(MSBuildProjectDirectory)\..\..\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<CompileAs>CompileAsCpp</CompileAs>
|
||||
|
Loading…
Reference in New Issue
Block a user