just a little cleanup to maintain minimal interfaces

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7591 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Rodolfo Osvaldo Bogado 2011-06-10 19:16:09 +00:00
parent 3fceffd8c0
commit e5210de9d5
7 changed files with 20 additions and 18 deletions

View File

@ -380,7 +380,7 @@ static void BuildSwapModeTable()
}
}
const char *GeneratePixelShaderCode(DSTALPHA_MODE dstAlphaMode, API_TYPE ApiType, u32 components, bool hlsl_sm_2_0 )
const char *GeneratePixelShaderCode(DSTALPHA_MODE dstAlphaMode, API_TYPE ApiType, u32 components)
{
setlocale(LC_NUMERIC, "C"); // Reset locale for compilation
text[sizeof(text) - 1] = 0x7C; // canary
@ -460,7 +460,7 @@ const char *GeneratePixelShaderCode(DSTALPHA_MODE dstAlphaMode, API_TYPE ApiType
WRITE(p, " out float4 ocol0 : COLOR0,%s%s\n in float4 rawpos : %s,\n",
dstAlphaMode == DSTALPHA_DUAL_SOURCE_BLEND ? "\n out float4 ocol1 : COLOR1," : "",
DepthTextureEnable ? "\n out float depth : DEPTH," : "",
ApiType == API_OPENGL ? "WPOS" : hlsl_sm_2_0 ? "POSITION" : "VPOS");
ApiType & API_OPENGL ? "WPOS" : ApiType & API_D3D9_SM20 ? "POSITION" : "VPOS");
}
else
{

View File

@ -113,7 +113,7 @@ enum DSTALPHA_MODE
DSTALPHA_DUAL_SOURCE_BLEND // Use dual-source blending
};
const char *GeneratePixelShaderCode(DSTALPHA_MODE dstAlphaMode, API_TYPE ApiType, u32 components, bool hlsl_sm_2_0 = false);
const char *GeneratePixelShaderCode(DSTALPHA_MODE dstAlphaMode, API_TYPE ApiType, u32 components);
void GetPixelShaderId(PIXELSHADERUID *uid, DSTALPHA_MODE dstAlphaMode);
extern PIXELSHADERUID last_pixel_shader_uid;

View File

@ -80,7 +80,7 @@ void WriteSwizzler(char*& p, u32 format, API_TYPE ApiType)
{
WRITE(p,"uniform samplerRECT samp0 : register(s0);\n");
}
else if (ApiType == API_D3D9)
else if (ApiType & API_D3D9)
{
WRITE(p,"uniform sampler samp0 : register(s0);\n");
}
@ -150,7 +150,7 @@ void Write32BitSwizzler(char*& p, u32 format, API_TYPE ApiType)
{
WRITE(p,"uniform samplerRECT samp0 : register(s0);\n");
}
else if (ApiType == API_D3D9)
else if (ApiType & API_D3D9)
{
WRITE(p,"uniform sampler samp0 : register(s0);\n");
}
@ -209,7 +209,7 @@ void Write32BitSwizzler(char*& p, u32 format, API_TYPE ApiType)
void WriteSampleColor(char*& p, const char* colorComp, const char* dest, API_TYPE ApiType)
{
const char* texSampleOpName;
if (ApiType == API_D3D9)
if (ApiType & API_D3D9)
texSampleOpName = "tex2D";
else if (ApiType == API_D3D11)
texSampleOpName = "tex0.Sample";

View File

@ -112,7 +112,7 @@ const char *GenerateVertexShaderCode(u32 components, API_TYPE api_type)
_assert_(bpmem.genMode.numtexgens == xfregs.numTexGen.numTexGens);
_assert_(bpmem.genMode.numcolchans == xfregs.numChan.numColorChans);
bool is_d3d = (api_type == API_D3D9 || api_type == API_D3D11);
bool is_d3d = (api_type & API_D3D9 || api_type == API_D3D11);
u32 lightMask = 0;
if (xfregs.numChan.numColorChans > 0)
lightMask |= xfregs.color[0].GetFullLightMask() | xfregs.alpha[0].GetFullLightMask();
@ -187,7 +187,7 @@ const char *GenerateVertexShaderCode(u32 components, API_TYPE api_type)
// transforms
if (components & VB_HAS_POSMTXIDX)
{
if (api_type == API_D3D9)
if (api_type & API_D3D9)
{
WRITE(p, "int4 indices = D3DCOLORtoUBYTE4(blend_indices);\n");
WRITE(p, "int posmtx = indices.x;\n");

View File

@ -107,11 +107,13 @@ struct TargetRectangle : public MathUtil::Rectangle<int>
typedef enum
{
API_OPENGL,
API_D3D9,
API_D3D11,
API_GLSL,
API_NONE
API_OPENGL = 1,
API_D3D9_SM30 = 2,
API_D3D9_SM20 = 4,
API_D3D9 = 6,
API_D3D11 = 8,
API_GLSL = 16,
API_NONE = 32
} API_TYPE;
inline u32 RGBA8ToRGBA6ToRGBA8(u32 src)

View File

@ -360,7 +360,7 @@ bool PixelShaderCache::SetShader(DSTALPHA_MODE dstAlphaMode, u32 components)
// Need to compile a new shader
const char *code = GeneratePixelShaderCode(dstAlphaMode, API_D3D9, components, ((D3D::GetCaps().PixelShaderVersion >> 8) & 0xFF) < 3);
const char *code = GeneratePixelShaderCode(dstAlphaMode, ((D3D::GetCaps().PixelShaderVersion >> 8) & 0xFF) < 3 ? API_D3D9_SM20 : API_D3D9_SM30, components);
u32 code_hash = HashAdler32((const u8 *)code, strlen(code));
unique_shaders.insert(code_hash);

View File

@ -89,15 +89,15 @@ std::string VideoBackend::GetName()
void InitBackendInfo()
{
DX9::D3D::Init();
g_Config.backend_info.APIType = API_D3D9;
const int shaderModel = ((DX9::D3D::GetCaps().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.bUseRGBATextures = false;
g_Config.backend_info.bSupports3DVision = true;
g_Config.backend_info.bSupportsDualSourceBlend = false;
g_Config.backend_info.bSupportsFormatReinterpretation = true;
const int shaderModel = ((DX9::D3D::GetCaps().PixelShaderVersion >> 8) & 0xFF);
const int maxConstants = (shaderModel < 3) ? 32 : ((shaderModel < 4) ? 224 : 65536);
g_Config.backend_info.bSupportsPixelLighting = C_PLIGHTS + 40 <= maxConstants && C_PMATERIALS + 4 <= maxConstants;
// adapters