#include "stdafx.h" #define GETEFFECTCAPABILITIES_GUID CKGUID(0x1b9a3f92,0x2a477527) //----------------------------------------------------------------------------- enum { PARAMOUT_PLATFORM = 0, PARAMOUT_DXVERSION, PARAMOUT_VSVERSION, PARAMOUT_PSVERSION }; #define PLATFORM_UNKNOWN "Unknown" #define PLATFORM_WINDOWS "Windows" #define PLATFORM_XBOX "Xbox" //----------------------------------------------------------------------------- int GetShaderCapabilities(const CKBehaviorContext& behcontext) { CKBehavior* beh = behcontext.Behavior; CKRenderContext* rc = behcontext.CurrentRenderContext; // Gets the manager. int id = 0; CKShaderManager* fxman = (CKShaderManager*)behcontext.Context->GetManagerByGuid(ShaderManagerGUID); // On if (beh->IsInputActive(0)) { int platform = VXPLATFORM_UNKNOWN; platform = VxGetPlatform(); float dxversion = 0; float vsversion = 0; float psversion = 0; VxDirectXData* dxdata = NULL; dxdata = rc->GetDirectXInfo(); if (dxdata) { switch(dxdata->DxVersion) { case 0x0900 : dxversion = 9.0f; break; case 0x0801 : dxversion = 8.1f; break; case 0x0800 : dxversion = 8.0f; break; case 0x0700 : dxversion = 7.0f; break; case 0x0500 : dxversion = 5.0f; break; } } // If the effect manager is available. if (fxman && fxman->IsSupported()) fxman->GetVSPSVersion(vsversion, psversion); beh->SetOutputParameterValue(PARAMOUT_PLATFORM, &platform); beh->SetOutputParameterValue(PARAMOUT_DXVERSION, &dxversion); beh->SetOutputParameterValue(PARAMOUT_VSVERSION, &vsversion); beh->SetOutputParameterValue(PARAMOUT_PSVERSION, &psversion); beh->ActivateOutput(0); } return CKBR_OK; } //----------------------------------------------------------------------------- CKERROR CreateGetShaderCapabilitiesProto(CKBehaviorPrototype **pproto) { CKBehaviorPrototype *proto = CreateCKBehaviorPrototype("Get Shader Capabilities"); if(!proto) return CKERR_OUTOFMEMORY; proto->DeclareInput("In"); proto->DeclareOutput("Out"); proto->DeclareOutParameter("Platform", CKPGUID_HOST_PLATFORM); proto->DeclareOutParameter("DX Version", CKPGUID_FLOAT); proto->DeclareOutParameter("VS Version", CKPGUID_FLOAT); proto->DeclareOutParameter("PS Version", CKPGUID_FLOAT); proto->SetFlags(CK_BEHAVIORPROTOTYPE_NORMAL); proto->SetFunction(GetShaderCapabilities); proto->SetFlags(CK_BEHAVIORPROTOTYPE_OBSOLETE); *pproto = proto; return CK_OK; } //----------------------------------------------------------------------------- CKObjectDeclaration *FillBehaviorGetShaderCapabilities() { CKObjectDeclaration *od = CreateCKObjectDeclaration("Get Shader Capabilities"); od->SetDescription("Gets shaders (HLSL only) related hardware capabilities"); /* rem: In: triggers the process
Out: is activated when the process is completed.

Material: The material.
Technique: The name of the technique.
Find Next Technique: Finds the next technique from the technique found.
*/ od->SetCategory("Shaders/General"); od->SetType(CKDLL_BEHAVIORPROTOTYPE); od->SetGuid(GETEFFECTCAPABILITIES_GUID); od->SetAuthorGuid(VIRTOOLS_GUID); od->SetAuthorName("Virtools"); od->SetVersion(0x00010000); od->SetCreationFunction(CreateGetShaderCapabilitiesProto); od->SetCompatibleClassId(CKCID_BEOBJECT); return od; }