static rc_t KNSProxiesAddHttpProxyPath ( KNSProxies * self, const char * proxy, size_t proxy_size, uint16_t proxy_port ) { const String * proxy_host = NULL; rc_t rc = 0; HttpProxy * new_proxy = NULL; BSTItem * node = NULL; HttpProxy add = { proxy_host, proxy_port, 0 }; assert ( self ); if ( proxy == NULL ) return 0; if ( rc == 0 ) { String tmp; StringInit ( & tmp, proxy, proxy_size, string_len ( proxy, proxy_size ) ); rc = StringCopy ( & proxy_host, & tmp ); if ( rc == 0 ) add . proxy_host = proxy_host; else return rc; } if ( BSTreeFind ( & self -> proxie_tree, & add, BSTItemCmp ) != NULL ) { DBGMSG ( DBG_KNS, DBG_FLAG ( DBG_KNS_PROXY ), ( "Ignored duplicate proxy '%S:%d'\n", proxy_host, proxy_port ) ); free ( ( void * ) proxy_host ); return 0; } new_proxy = calloc ( 1, sizeof * new_proxy ); if ( new_proxy == NULL ) return RC ( rcNS, rcMgr, rcAllocating, rcMemory, rcExhausted ); new_proxy -> proxy_host = proxy_host; new_proxy -> proxy_port = proxy_port; node = calloc ( 1, sizeof * node ); if ( node == NULL ) { free ( new_proxy ); return RC ( rcNS, rcMgr, rcAllocating, rcMemory, rcExhausted ); } node -> proxy = new_proxy; rc = BSTreeInsert ( & self -> proxie_tree, ( BSTNode * ) node, BSTreeSort ); DBGMSG ( DBG_KNS, DBG_FLAG ( DBG_KNS_PROXY ), ( "Added proxy '%S:%d'\n", proxy_host, proxy_port ) ); if ( ! self -> http_proxy_enabled ) self -> http_proxy_enabled = ( proxy_host != NULL ); return rc; }
static rc_t CC KHttpUndyingFileTimedRead(const KHttpUndyingFile *self, uint64_t pos, void *buffer, size_t bsize, size_t *num_read, struct timeout_t *tm) { if (self == NULL || self->file == NULL) { return KFileTimedRead(NULL, pos, buffer, bsize, num_read, tm); } else { rc_t rc = 0, prev_rc = 0; int i = 0; for (i = 0; i < RETRY_REVIVE; ++i) { int r = 0; for (r = 0; r < RETRY_READ; ++r) { rc = KFileTimedRead(self->file, pos, buffer, bsize, num_read, tm); if (rc == 0) { return rc; } else { DBGMSG(DBG_KNS, DBG_FLAG(DBG_KNS_ERR), ( "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@3 %s KFileTimedRead(%s, %d)(%d/%d) = %R @@" "\n", __FUNCTION__, self->url, pos, r + 1, RETRY_READ, rc)); if (prev_rc == 0) { prev_rc = rc; } else if (rc == prev_rc) { break; } } } if (i < RETRY_REVIVE - 1) { DBGMSG(DBG_KNS, DBG_FLAG(DBG_KNS_ERR), ( "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@5 %s %d/%d KFileTimedRead: Reviving... @@@" "\n", __FUNCTION__, i + 1, RETRY_REVIVE)); rc = Revive(self); if (rc != 0) { DBGMSG(DBG_KNS, DBG_FLAG(DBG_KNS_ERR), ( "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@5 %s KFileTimedRead(%s, %d): Revive = %R @" "\n", __FUNCTION__, self->url, pos, rc)); return rc; } } else { DBGMSG(DBG_KNS, DBG_FLAG(DBG_KNS_ERR), ( "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@5 %s %d/%d KFileTimedRead: Not Reviving @@" "\n", __FUNCTION__, i + 1, RETRY_REVIVE)); } } return rc; } }
void nine_dump_D3DLIGHT9(unsigned ch, const D3DLIGHT9 *lit) { DBG_FLAG(ch, "D3DLIGHT9(%p):\n" "Type: %s\n" "Diffuse: (%f %f %f %f)\n" "Specular: (%f %f %f %f)\n" "Ambient: (%f %f %f %f)\n" "Position: (%f %f %f)\n" "Direction: (%f %f %f)\n" "Range: %f\n" "Falloff: %f\n" "Attenuation: %f + %f * d + %f * d^2\n" "Theta: %f deg\n" "Phi: %f deg\n", lit, nine_D3DLIGHTTYPE_to_str(lit->Type), lit->Diffuse.r,lit->Diffuse.r,lit->Diffuse.g,lit->Diffuse.a, lit->Specular.r,lit->Specular.r,lit->Specular.g,lit->Specular.a, lit->Ambient.r,lit->Ambient.r,lit->Ambient.g,lit->Ambient.a, lit->Position.x,lit->Position.y,lit->Position.z, lit->Direction.x,lit->Direction.y,lit->Direction.z, lit->Range,lit->Falloff, lit->Attenuation0,lit->Attenuation1,lit->Attenuation2, lit->Theta * 360.0f / M_PI,lit->Phi * 360.0f / M_PI); }
rc_t add_cgi_request_param( struct cgi_request * request, const char * fmt, ... ) { rc_t rc; if ( request == NULL || fmt == NULL ) rc = RC( rcVDB, rcNoTarg, rcConstructing, rcParam, rcNull ); else { va_list args; char buffer[ 4096 ]; size_t num_writ; va_start ( args, fmt ); rc = string_vprintf( buffer, sizeof buffer, &num_writ, fmt, args ); if ( rc != 0 ) ErrMsg( "string_vprintf( '%s' ) -> %R", fmt, rc ); else { DBGMSG ( DBG_APP, DBG_FLAG ( DBG_APP_1 ), ( "\t%s\n", buffer ) ); rc = VNamelistAppend( request->params, buffer ); if ( rc != 0 ) ErrMsg( "VNamelistAppend( '%s' ) -> %R", buffer, rc ); } va_end ( args ); } return rc; }
static bool KNSProxiesHttpProxyInitFromKfg ( KNSProxies * self, const KConfig * kfg ) { bool fromKfg = false; const KConfigNode * proxy; rc_t rc = KConfigOpenNodeRead ( kfg, & proxy, "/http/proxy" ); if ( rc == 0 ) { const KConfigNode * proxy_path; rc = KConfigNodeOpenNodeRead ( proxy, & proxy_path, "path" ); if ( rc == 0 ) { String * path; rc = KConfigNodeReadString ( proxy_path, & path ); if ( rc == 0 ) { DBGMSG ( DBG_KNS, DBG_FLAG ( DBG_KNS_PROXY ), ( "Loading proxy '%S' from configuration\n", path ) ); rc = KNSProxiesAddHTTPProxyPath ( self, "%S", path ); if ( rc == 0 ) fromKfg = true; StringWhack ( path ); } KConfigNodeRelease ( proxy_path ); } KConfigNodeRelease ( proxy ); } return fromKfg; }
void nine_dump_D3DADAPTER_IDENTIFIER9(unsigned ch, const D3DADAPTER_IDENTIFIER9 *id) { DBG_FLAG(ch, "D3DADAPTER_IDENTIFIER9(%p):\n" "Driver: %s\n" "Description: %s\n" "DeviceName: %s\n" "DriverVersion: %08x.%08x\n" "VendorId: %x\n" "DeviceId: %x\n" "SubSysId: %x\n" "Revision: %u\n" "GUID: %08x.%04x.%04x.%02x.%02x.%02x.%02x.%02x.%02x.%02x.%02x\n" "WHQLLevel: %u\n", id, id->Driver, id->Description, id->DeviceName, id->DriverVersionLowPart, id->DriverVersionHighPart, id->VendorId, id->DeviceId, id->SubSysId, id->Revision, id->DeviceIdentifier.Data1, id->DeviceIdentifier.Data2, id->DeviceIdentifier.Data3, id->DeviceIdentifier.Data4[0], id->DeviceIdentifier.Data4[1], id->DeviceIdentifier.Data4[2], id->DeviceIdentifier.Data4[3], id->DeviceIdentifier.Data4[4], id->DeviceIdentifier.Data4[5], id->DeviceIdentifier.Data4[6], id->DeviceIdentifier.Data4[7], id->WHQLLevel); }
/* ---------------------------------------------------------------------- * Destroy * */ static rc_t CC KCounterFileDestroy (KCounterFile *self) { rc_t rc = 0; uint64_t size; assert (self != NULL); assert (self->bytecounter != NULL); if (self->force || ! self->size_allowed) { size_t num_read = 0; uint8_t ignored[64*1024]; size = self->max_position; if (self->dad.read_enabled) do { rc = KFileRead (self->original, size, ignored, sizeof ignored, &num_read); size += num_read; DBGMSG(DBG_KFS,DBG_FLAG(DBG_KFS_COUNTER), ("%s: size '%lu' num_read '%lu'\n", __func__, size, num_read)); if (rc != 0) break; check_state (self, ignored, num_read); } while (num_read != 0); } else { rc = KFileSize (self->original, &size); DBGMSG(DBG_KFS,DBG_FLAG(DBG_KFS_COUNTER), ("%s: lazy way size '%lu'\n", __func__, size)); } *self->bytecounter = size; if (rc == 0) { rc = KFileRelease (self->original); free (self); } return rc; }
static rc_t KNSManagerVMakeUndyingHttpFile(const KNSManager *self, const KFile **file, struct KStream *conn, ver_t vers, const char *url, va_list args) { char buffer[PATH_MAX] = ""; size_t num_writ = 0; rc_t rc = 0; KHttpUndyingFile *f = NULL; if (file == NULL) { return RC(rcNS, rcFile, rcConstructing, rcParam, rcNull); } *file = NULL; f = calloc(1, sizeof *f); if (f == NULL) { return RC(rcNS, rcFile, rcConstructing, rcMemory, rcExhausted); } rc = string_vprintf(buffer, sizeof buffer, &num_writ, url, args); if (rc == 0) { f->url = string_dup_measure(url, NULL); } if (f->url == NULL) { rc = RC(rcNS, rcFile, rcConstructing, rcMemory, rcExhausted); } f->vers = vers; if (rc == 0) { rc = KNSManagerAddRef(self); if (rc == 0) { f->mgr = self; } } if (rc == 0) { assert(conn == NULL); rc = Revive(f); } if (rc == 0) { KHttpUndyingFileSize(f, &f->size); DBGMSG(DBG_KNS, DBG_FLAG(DBG_KNS_MGR), ( "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@4 %s KNSManagerMakeUndyingHttpFile: size = %ld" "\n", __FUNCTION__, f->size)); } if (rc == 0) { rc = KFileInit(&f->dad, (const KFile_vt*)&vtKHttpFile, "KHttpUndyingFile", url, true, false); } if (rc == 0) { *file = &f->dad; } else { KHttpUndyingFileDestroy(f); } return rc; }
/* OpenUpdate * finish create operation */ static rc_t VDatabaseOpenUpdate ( VDatabase *self, const char *decl ) { /* open metadata */ rc_t rc = KDatabaseOpenMetadataUpdate ( self -> kdb, & self -> meta ); if ( rc == 0 ) { /* fetch stored schema */ rc = VDatabaseLoadSchema ( self ); if ( rc == 0 ) { /* fetch requested schema */ const SDatabase *sdb = self -> sdb; if ( decl != NULL && decl [ 0 ] != 0 ) { uint32_t type; const SNameOverload *name; sdb = ( self -> dad != NULL ) ? SDatabaseFind ( self -> dad -> sdb, self -> schema, & name, & type, decl, "VDatabaseOpenUpdate" ): VSchemaFind ( self -> schema, & name, & type, decl, "VDatabaseOpenUpdate", true ); if ( sdb != NULL && type != eDatabase ) { PLOGMSG ( klogWarn, ( klogWarn, "expression '$(expr)' is not a database", "expr=%s", decl )); sdb = NULL; } } /* error if the two definitions differ */ if ( sdb != NULL && self -> sdb != NULL && sdb != self -> sdb ) rc = RC ( rcVDB, rcDatabase, rcOpening, rcSchema, rcIncorrect ); else if ( sdb == NULL && self -> sdb == NULL ) rc = RC ( rcVDB, rcDatabase, rcOpening, rcSchema, rcNotFound ); else { if ( sdb != NULL ) self -> sdb = sdb; /* write schema to metadata */ rc = VDatabaseStoreSchema ( self ); if ( rc == 0 ) return 0; } } } DBGMSG(DBG_VDB, DBG_FLAG(DBG_VDB_VDB), ("VDatabaseOpenUpdate = %d\n", rc)); return rc; }
void nine_dump_D3DTSS_value(unsigned ch, D3DTEXTURESTAGESTATETYPE type, DWORD value) { float rgba[4]; switch (type) { case D3DTSS_COLOROP: case D3DTSS_ALPHAOP: DBG_FLAG(ch, "D3DTSS_%s = %s\n", nine_D3DTSS_to_str(type), nine_D3DTOP_to_str(value)); break; case D3DTSS_COLORARG0: case D3DTSS_COLORARG1: case D3DTSS_COLORARG2: case D3DTSS_ALPHAARG0: case D3DTSS_ALPHAARG1: case D3DTSS_ALPHAARG2: case D3DTSS_RESULTARG: DBG_FLAG(ch, "D3DTSS_%s = %s%s%s\n", nine_D3DTSS_to_str(type), (value & D3DTA_COMPLEMENT) ? "COMPLEMENT " : "", (value & D3DTA_ALPHAREPLICATE) ? "ALPHAREPLICATE " : "", nine_D3DTA_to_str(value)); break; case D3DTSS_BUMPENVMAT00: case D3DTSS_BUMPENVMAT01: case D3DTSS_BUMPENVMAT10: case D3DTSS_BUMPENVMAT11: case D3DTSS_BUMPENVLSCALE: case D3DTSS_BUMPENVLOFFSET: DBG_FLAG(ch, "D3DTSS_%s = %f\n", nine_D3DTSS_to_str(type), asfloat(value)); break; case D3DTSS_TEXCOORDINDEX: DBG_FLAG(ch, "D3DTSS_TEXCOORDINDEX = %s %u\n", nine_D3DTSS_TCI_to_str(value), value & 0xffff); break; case D3DTSS_TEXTURETRANSFORMFLAGS: DBG_FLAG(ch, "D3DTSS_TEXTURETRANSFORMFLAGS = %s\n", nine_D3DTTFF_to_str(value)); break; case D3DTSS_CONSTANT: d3dcolor_to_rgba(rgba, value); DBG_FLAG(ch, "D3DTSS_CONSTANT = %f %f %f %F\n", rgba[0],rgba[1],rgba[2],rgba[3]); break; default: DBG_FLAG(ch, "D3DTSS_? = 0x%08x\n", value); break; } }
void nine_dump_D3DMATERIAL9(unsigned ch, const D3DMATERIAL9 *mat) { DBG_FLAG(ch, "D3DMATERIAL9(%p):\n" "Diffuse: (%f %f %f %f)\n" "Specular: (%f %f %f %f)\n" "Ambient: (%f %f %f %f)\n" "Emissive: (%f %f %f %f)\n" "Power: %f\n", mat, mat->Diffuse.r,mat->Diffuse.r,mat->Diffuse.g,mat->Diffuse.a, mat->Specular.r,mat->Specular.r,mat->Specular.g,mat->Specular.a, mat->Ambient.r,mat->Ambient.r,mat->Ambient.g,mat->Ambient.a, mat->Emissive.r,mat->Emissive.r,mat->Emissive.g,mat->Emissive.a, mat->Power); }
LIB_EXPORT rc_t CC KNSManagerNewReleaseVersion(const struct KNSManager *self, SraReleaseVersion *newVersion) { rc_t rc = 0; int i = 0, retryOnFailure = 2; for (i = 0; i < retryOnFailure; ++i) { rc = KNSManagerNewReleaseVersionImpl(self, newVersion); if (rc == 0) { break; } DBGMSG(DBG_KNS, DBG_FLAG(DBG_KNS_ERR), ( "@@@@@@@@2: KNSManagerNewReleaseVersion %d/%d = %R" "\n", i + 1, retryOnFailure, rc)); } return rc; }
/* LoadLib * load a dynamic library * * "lib" [ OUT ] - return parameter for loaded library * * "path" [ IN ] - NUL terminated string in directory-native * character set denoting target library */ static rc_t KDyldLoad ( KDyld *self, KDylib *lib, const char *path ) { /* (VDB-1391) remove dynamic linker interfaces from system */ #if USE_DYLOAD rc_t rc; const char *msg; size_t msg_len; lib -> handle = dlopen ( path, path == NULL ? RTLD_LAZY : DLOPEN_MODE ); if ( lib -> handle != NULL ) return KDylibSetLogging ( lib ); msg = dlerror (); rc = RC ( rcFS, rcDylib, rcLoading, rcNoObj, rcUnknown ); msg_len = strlen(msg); if ( msg_len > lib -> path . size + 2 ) { const char *cmp = & msg [ lib -> path . size + 2 ]; if ( strcmp ( cmp, "cannot open shared object file: No such file or directory" ) == 0 ) rc = RC ( rcFS, rcDylib, rcLoading, rcPath, rcNotFound ); else if ( strncmp ( cmp, "undefined symbol: ", sizeof "undefined symbol: " - 1 ) == 0 ) rc = RC ( rcFS, rcDylib, rcLoading, rcDylib, rcIncomplete ); } if (GetRCState(rc) == rcUnknown) { static const char imageNotFound[] = " image not found"; const char *cmp1 = strstr(msg, imageNotFound); const char *cmp2 = msg + msg_len - (sizeof(imageNotFound) - 1); if (cmp1 == cmp2) rc = RC ( rcFS, rcDylib, rcLoading, rcPath, rcNotFound ); } DBGMSG (DBG_KFS, DBG_FLAG(DBG_KFS_DLL), ("%s: %R %s\n", __func__, rc, msg)); if (GetRCState(rc) == rcUnknown) { (void)LOGMSG(klogWarn, (msg)); } return rc; #else lib -> handle = NULL; return 0; #endif }
static bool KNSProxiesHttpProxyInitFromEnvVar ( KNSProxies * self, const char * name ) { const char * path = getenv ( name ); if ( path != NULL ) { assert ( self ); DBGMSG ( DBG_KNS, DBG_FLAG ( DBG_KNS_PROXY ), ( "Loading proxy env.var. %s='%s'\n", name, path ) ); if ( KNSProxiesAddHTTPProxyPath ( self, path ) != 0 ) return false; assert ( self -> http_proxy_enabled ); return true; } return false; }
/* OpenRead * finish initialization on open for read */ static rc_t VTableOpenRead ( VTable *self ) { /* open metadata */ rc_t rc = KTableOpenMetadataRead ( self -> ktbl, & self -> meta ); if ( rc == 0 ) { /* open "col" node, if present */ rc = KMetadataOpenNodeRead ( self -> meta, & self -> col_node, "col" ); if ( rc == 0 || GetRCState ( rc ) == rcNotFound ) { /* fetch stored schema */ rc = VTableLoadSchema ( self ); if ( rc == 0 && self -> stbl == NULL ) rc = RC ( rcVDB, rcTable, rcOpening, rcSchema, rcNotFound ); } } DBGMSG(DBG_VDB, DBG_FLAG(DBG_VDB_VDB), ("VTableOpenRead = %d\n", rc)); return rc; }
rc_t VPhysicalLoadMetadata ( VPhysical *self, VTypedecl *td, VSchema *schema ) { /* capture fixed row length */ const KMDataNode *node; rc_t rc = KMetadataOpenNodeRead ( self -> meta, & node, "row-len" ); if ( rc == 0 ) { rc = KMDataNodeReadAsU32 ( node, & self -> fixed_len ); KMDataNodeRelease ( node ); if ( rc != 0 ) return rc; } /* look for "schema" root node */ rc = KMetadataOpenNodeRead ( self -> meta, & node, "schema" ); if ( rc == 0 ) return VPhysicalLoadSchema ( self, td, schema, node ); if ( GetRCState ( rc ) != rcNotFound ) return rc; /* appears to be an older column */ self -> v01 = true; /* look for "decoding" root node */ rc = KMetadataOpenNodeRead ( self -> meta, & node, "decoding" ); if ( rc == 0 ) return VPhysicalLoadV1Schema ( self, td, schema, node ); if ( GetRCState ( rc ) != rcNotFound ) return rc; /* benign error for very old columns */ rc = RC ( rcVDB, rcColumn, rcLoading, rcSchema, rcNotFound ); DBGMSG(DBG_VDB, DBG_FLAG(DBG_VDB_VDB), ("VPhysicalLoadMetadata = %d\n", rc)); return rc; }
rc_t make_cgi_request( struct cgi_request ** request, const char * url ) { rc_t rc = 0; cgi_request * r = calloc( 1, sizeof * r ); if ( r == NULL ) { rc = RC( rcVDB, rcNoTarg, rcConstructing, rcMemory, rcExhausted ); ErrMsg( "calloc( %d ) -> %R", ( sizeof * r ), rc ); } else { r->url = string_dup_measure( url, NULL ); if ( r->url == NULL ) { rc = RC( rcVDB, rcNoTarg, rcConstructing, rcMemory, rcExhausted ); ErrMsg( "string_dup_measure( '%s' ) -> %R", url, rc ); } else { DBGMSG ( DBG_APP, DBG_FLAG ( DBG_APP_1 ), ( "%s\n", r -> url ) ); rc = VNamelistMake( &r->params, 10 ); if ( rc != 0 ) ErrMsg( "VNamelistMake() -> %R", rc ); else { rc = KNSManagerMake( &r->kns_mgr ); if ( rc != 0 ) ErrMsg( "KNSManagerMake() -> %R", rc ); else *request = r; } } if ( rc != 0 ) release_cgi_request( r ); } return rc; }
void nine_dump_D3DCAPS9(unsigned ch, const D3DCAPS9 *caps) { const int c = 1 << 17; int p = 0; char *s = (char *)MALLOC(c); if (!s) { DBG_FLAG(ch, "D3DCAPS9(%p): (out of memory)\n", caps); return; } C2S("DeviceType: %s\n", nine_D3DDEVTYPE_to_str(caps->DeviceType)); C2S("AdapterOrdinal: %u\nCaps:", caps->AdapterOrdinal); if (caps->Caps & 0x20000) C2S(" READ_SCANLINE"); if (caps->Caps & ~0x20000) C2S(" %x", caps->Caps & ~0x20000); C2S("\nCaps2:"); CAP_CASE(Caps2, D3DCAPS2, CANAUTOGENMIPMAP); CAP_CASE(Caps2, D3DCAPS2, CANCALIBRATEGAMMA); CAP_CASE(Caps2, D3DCAPS2, CANSHARERESOURCE); CAP_CASE(Caps2, D3DCAPS2, CANMANAGERESOURCE); CAP_CASE(Caps2, D3DCAPS2, DYNAMICTEXTURES); CAP_CASE(Caps2, D3DCAPS2, FULLSCREENGAMMA); C2S("\nCaps3:"); CAP_CASE(Caps3, D3DCAPS3, ALPHA_FULLSCREEN_FLIP_OR_DISCARD); CAP_CASE(Caps3, D3DCAPS3, COPY_TO_VIDMEM); CAP_CASE(Caps3, D3DCAPS3, COPY_TO_SYSTEMMEM); CAP_CASE(Caps3, D3DCAPS3, DXVAHD); CAP_CASE(Caps3, D3DCAPS3, LINEAR_TO_SRGB_PRESENTATION); C2S("\nPresentationIntervals:"); CAP_CASE(PresentationIntervals, D3DPRESENT_INTERVAL, ONE); CAP_CASE(PresentationIntervals, D3DPRESENT_INTERVAL, TWO); CAP_CASE(PresentationIntervals, D3DPRESENT_INTERVAL, THREE); CAP_CASE(PresentationIntervals, D3DPRESENT_INTERVAL, FOUR); CAP_CASE(PresentationIntervals, D3DPRESENT_INTERVAL, IMMEDIATE); C2S("\nCursorCaps:"); CAP_CASE(CursorCaps, D3DCURSORCAPS, COLOR); CAP_CASE(CursorCaps, D3DCURSORCAPS, LOWRES); C2S("\nDevCaps:"); CAP_CASE(DevCaps, D3DDEVCAPS, CANBLTSYSTONONLOCAL); CAP_CASE(DevCaps, D3DDEVCAPS, CANRENDERAFTERFLIP); CAP_CASE(DevCaps, D3DDEVCAPS, DRAWPRIMITIVES2); CAP_CASE(DevCaps, D3DDEVCAPS, DRAWPRIMITIVES2EX); CAP_CASE(DevCaps, D3DDEVCAPS, DRAWPRIMTLVERTEX); CAP_CASE(DevCaps, D3DDEVCAPS, EXECUTESYSTEMMEMORY); CAP_CASE(DevCaps, D3DDEVCAPS, EXECUTEVIDEOMEMORY); CAP_CASE(DevCaps, D3DDEVCAPS, HWRASTERIZATION); CAP_CASE(DevCaps, D3DDEVCAPS, HWTRANSFORMANDLIGHT); CAP_CASE(DevCaps, D3DDEVCAPS, NPATCHES); CAP_CASE(DevCaps, D3DDEVCAPS, PUREDEVICE); CAP_CASE(DevCaps, D3DDEVCAPS, QUINTICRTPATCHES); CAP_CASE(DevCaps, D3DDEVCAPS, RTPATCHES); CAP_CASE(DevCaps, D3DDEVCAPS, RTPATCHHANDLEZERO); CAP_CASE(DevCaps, D3DDEVCAPS, SEPARATETEXTUREMEMORIES); CAP_CASE(DevCaps, D3DDEVCAPS, TEXTURENONLOCALVIDMEM); CAP_CASE(DevCaps, D3DDEVCAPS, TEXTURESYSTEMMEMORY); CAP_CASE(DevCaps, D3DDEVCAPS, TEXTUREVIDEOMEMORY); CAP_CASE(DevCaps, D3DDEVCAPS, TLVERTEXSYSTEMMEMORY); CAP_CASE(DevCaps, D3DDEVCAPS, TLVERTEXVIDEOMEMORY); C2S("\nPrimitiveMiscCaps:"); CAP_CASE(PrimitiveMiscCaps, D3DPMISCCAPS, MASKZ); CAP_CASE(PrimitiveMiscCaps, D3DPMISCCAPS, CULLNONE); CAP_CASE(PrimitiveMiscCaps, D3DPMISCCAPS, CULLCW); CAP_CASE(PrimitiveMiscCaps, D3DPMISCCAPS, CULLCCW); CAP_CASE(PrimitiveMiscCaps, D3DPMISCCAPS, COLORWRITEENABLE); CAP_CASE(PrimitiveMiscCaps, D3DPMISCCAPS, CLIPPLANESCALEDPOINTS); CAP_CASE(PrimitiveMiscCaps, D3DPMISCCAPS, CLIPTLVERTS); CAP_CASE(PrimitiveMiscCaps, D3DPMISCCAPS, TSSARGTEMP); CAP_CASE(PrimitiveMiscCaps, D3DPMISCCAPS, BLENDOP); CAP_CASE(PrimitiveMiscCaps, D3DPMISCCAPS, NULLREFERENCE); CAP_CASE(PrimitiveMiscCaps, D3DPMISCCAPS, INDEPENDENTWRITEMASKS); CAP_CASE(PrimitiveMiscCaps, D3DPMISCCAPS, PERSTAGECONSTANT); CAP_CASE(PrimitiveMiscCaps, D3DPMISCCAPS, POSTBLENDSRGBCONVERT); CAP_CASE(PrimitiveMiscCaps, D3DPMISCCAPS, FOGANDSPECULARALPHA); CAP_CASE(PrimitiveMiscCaps, D3DPMISCCAPS, SEPARATEALPHABLEND); CAP_CASE(PrimitiveMiscCaps, D3DPMISCCAPS, MRTINDEPENDENTBITDEPTHS); CAP_CASE(PrimitiveMiscCaps, D3DPMISCCAPS, MRTPOSTPIXELSHADERBLENDING); CAP_CASE(PrimitiveMiscCaps, D3DPMISCCAPS, FOGVERTEXCLAMPED); C2S("\nRasterCaps:"); CAP_CASE(RasterCaps, D3DPRASTERCAPS, ANISOTROPY); CAP_CASE(RasterCaps, D3DPRASTERCAPS, COLORPERSPECTIVE); CAP_CASE(RasterCaps, D3DPRASTERCAPS, DITHER); CAP_CASE(RasterCaps, D3DPRASTERCAPS, DEPTHBIAS); CAP_CASE(RasterCaps, D3DPRASTERCAPS, FOGRANGE); CAP_CASE(RasterCaps, D3DPRASTERCAPS, FOGTABLE); CAP_CASE(RasterCaps, D3DPRASTERCAPS, FOGVERTEX); CAP_CASE(RasterCaps, D3DPRASTERCAPS, MIPMAPLODBIAS); CAP_CASE(RasterCaps, D3DPRASTERCAPS, MULTISAMPLE_TOGGLE); CAP_CASE(RasterCaps, D3DPRASTERCAPS, SCISSORTEST); CAP_CASE(RasterCaps, D3DPRASTERCAPS, SLOPESCALEDEPTHBIAS); CAP_CASE(RasterCaps, D3DPRASTERCAPS, WBUFFER); CAP_CASE(RasterCaps, D3DPRASTERCAPS, WFOG); CAP_CASE(RasterCaps, D3DPRASTERCAPS, ZBUFFERLESSHSR); CAP_CASE(RasterCaps, D3DPRASTERCAPS, ZFOG); CAP_CASE(RasterCaps, D3DPRASTERCAPS, ZTEST); C2S("\nZCmpCaps:"); CAP_CASE(ZCmpCaps, D3DPCMPCAPS, ALWAYS); CAP_CASE(ZCmpCaps, D3DPCMPCAPS, EQUAL); CAP_CASE(ZCmpCaps, D3DPCMPCAPS, GREATER); CAP_CASE(ZCmpCaps, D3DPCMPCAPS, GREATEREQUAL); CAP_CASE(ZCmpCaps, D3DPCMPCAPS, LESS); CAP_CASE(ZCmpCaps, D3DPCMPCAPS, LESSEQUAL); CAP_CASE(ZCmpCaps, D3DPCMPCAPS, NEVER); CAP_CASE(ZCmpCaps, D3DPCMPCAPS, NOTEQUAL); C2S("\nSrcBlendCaps"); CAP_CASE(SrcBlendCaps, D3DPBLENDCAPS, BLENDFACTOR); CAP_CASE(SrcBlendCaps, D3DPBLENDCAPS, BOTHINVSRCALPHA); CAP_CASE(SrcBlendCaps, D3DPBLENDCAPS, BOTHSRCALPHA); CAP_CASE(SrcBlendCaps, D3DPBLENDCAPS, DESTALPHA); CAP_CASE(SrcBlendCaps, D3DPBLENDCAPS, DESTCOLOR); CAP_CASE(SrcBlendCaps, D3DPBLENDCAPS, INVDESTALPHA); CAP_CASE(SrcBlendCaps, D3DPBLENDCAPS, INVDESTCOLOR); CAP_CASE(SrcBlendCaps, D3DPBLENDCAPS, INVSRCALPHA); CAP_CASE(SrcBlendCaps, D3DPBLENDCAPS, INVSRCCOLOR); CAP_CASE(SrcBlendCaps, D3DPBLENDCAPS, INVSRCCOLOR2); CAP_CASE(SrcBlendCaps, D3DPBLENDCAPS, ONE); CAP_CASE(SrcBlendCaps, D3DPBLENDCAPS, SRCALPHA); CAP_CASE(SrcBlendCaps, D3DPBLENDCAPS, SRCALPHASAT); CAP_CASE(SrcBlendCaps, D3DPBLENDCAPS, SRCCOLOR); CAP_CASE(SrcBlendCaps, D3DPBLENDCAPS, SRCCOLOR2); CAP_CASE(SrcBlendCaps, D3DPBLENDCAPS, ZERO); C2S("\nDestBlendCaps"); CAP_CASE(DestBlendCaps, D3DPBLENDCAPS, BLENDFACTOR); CAP_CASE(DestBlendCaps, D3DPBLENDCAPS, BOTHINVSRCALPHA); CAP_CASE(DestBlendCaps, D3DPBLENDCAPS, BOTHSRCALPHA); CAP_CASE(DestBlendCaps, D3DPBLENDCAPS, DESTALPHA); CAP_CASE(DestBlendCaps, D3DPBLENDCAPS, DESTCOLOR); CAP_CASE(DestBlendCaps, D3DPBLENDCAPS, INVDESTALPHA); CAP_CASE(DestBlendCaps, D3DPBLENDCAPS, INVDESTCOLOR); CAP_CASE(DestBlendCaps, D3DPBLENDCAPS, INVSRCALPHA); CAP_CASE(DestBlendCaps, D3DPBLENDCAPS, INVSRCCOLOR); CAP_CASE(DestBlendCaps, D3DPBLENDCAPS, INVSRCCOLOR2); CAP_CASE(DestBlendCaps, D3DPBLENDCAPS, ONE); CAP_CASE(DestBlendCaps, D3DPBLENDCAPS, SRCALPHA); CAP_CASE(DestBlendCaps, D3DPBLENDCAPS, SRCALPHASAT); CAP_CASE(DestBlendCaps, D3DPBLENDCAPS, SRCCOLOR); CAP_CASE(DestBlendCaps, D3DPBLENDCAPS, SRCCOLOR2); CAP_CASE(DestBlendCaps, D3DPBLENDCAPS, ZERO); C2S("\nAlphaCmpCaps:"); CAP_CASE(AlphaCmpCaps, D3DPCMPCAPS, ALWAYS); CAP_CASE(AlphaCmpCaps, D3DPCMPCAPS, EQUAL); CAP_CASE(AlphaCmpCaps, D3DPCMPCAPS, GREATER); CAP_CASE(AlphaCmpCaps, D3DPCMPCAPS, GREATEREQUAL); CAP_CASE(AlphaCmpCaps, D3DPCMPCAPS, LESS); CAP_CASE(AlphaCmpCaps, D3DPCMPCAPS, LESSEQUAL); CAP_CASE(AlphaCmpCaps, D3DPCMPCAPS, NEVER); CAP_CASE(AlphaCmpCaps, D3DPCMPCAPS, NOTEQUAL); C2S("\nShadeCaps:"); CAP_CASE(ShadeCaps, D3DPSHADECAPS, ALPHAGOURAUDBLEND); CAP_CASE(ShadeCaps, D3DPSHADECAPS, COLORGOURAUDRGB); CAP_CASE(ShadeCaps, D3DPSHADECAPS, FOGGOURAUD); CAP_CASE(ShadeCaps, D3DPSHADECAPS, SPECULARGOURAUDRGB); C2S("\nTextureCaps:"); CAP_CASE(TextureCaps, D3DPTEXTURECAPS, ALPHA); CAP_CASE(TextureCaps, D3DPTEXTURECAPS, ALPHAPALETTE); CAP_CASE(TextureCaps, D3DPTEXTURECAPS, CUBEMAP); CAP_CASE(TextureCaps, D3DPTEXTURECAPS, CUBEMAP_POW2); CAP_CASE(TextureCaps, D3DPTEXTURECAPS, MIPCUBEMAP); CAP_CASE(TextureCaps, D3DPTEXTURECAPS, MIPMAP); CAP_CASE(TextureCaps, D3DPTEXTURECAPS, MIPVOLUMEMAP); CAP_CASE(TextureCaps, D3DPTEXTURECAPS, NONPOW2CONDITIONAL); CAP_CASE(TextureCaps, D3DPTEXTURECAPS, NOPROJECTEDBUMPENV); CAP_CASE(TextureCaps, D3DPTEXTURECAPS, PERSPECTIVE); CAP_CASE(TextureCaps, D3DPTEXTURECAPS, POW2); CAP_CASE(TextureCaps, D3DPTEXTURECAPS, PROJECTED); CAP_CASE(TextureCaps, D3DPTEXTURECAPS, SQUAREONLY); CAP_CASE(TextureCaps, D3DPTEXTURECAPS, TEXREPEATNOTSCALEDBYSIZE); CAP_CASE(TextureCaps, D3DPTEXTURECAPS, VOLUMEMAP); CAP_CASE(TextureCaps, D3DPTEXTURECAPS, VOLUMEMAP_POW2); C2S("\nTextureFilterCaps:"); /* CAP_CASE(TextureFilterCaps, D3DPTFILTERCAPS, CONVOLUTIONMONO); */ CAP_CASE(TextureFilterCaps, D3DPTFILTERCAPS, MAGFPOINT); CAP_CASE(TextureFilterCaps, D3DPTFILTERCAPS, MAGFLINEAR); CAP_CASE(TextureFilterCaps, D3DPTFILTERCAPS, MAGFANISOTROPIC); CAP_CASE(TextureFilterCaps, D3DPTFILTERCAPS, MAGFPYRAMIDALQUAD); CAP_CASE(TextureFilterCaps, D3DPTFILTERCAPS, MAGFGAUSSIANQUAD); CAP_CASE(TextureFilterCaps, D3DPTFILTERCAPS, MINFPOINT); CAP_CASE(TextureFilterCaps, D3DPTFILTERCAPS, MINFLINEAR); CAP_CASE(TextureFilterCaps, D3DPTFILTERCAPS, MINFANISOTROPIC); CAP_CASE(TextureFilterCaps, D3DPTFILTERCAPS, MINFPYRAMIDALQUAD); CAP_CASE(TextureFilterCaps, D3DPTFILTERCAPS, MINFGAUSSIANQUAD); CAP_CASE(TextureFilterCaps, D3DPTFILTERCAPS, MIPFPOINT); CAP_CASE(TextureFilterCaps, D3DPTFILTERCAPS, MIPFLINEAR); C2S("\nCubeTextureFilterCaps:"); /* CAP_CASE(CubeTextureFilterCaps, D3DPTFILTERCAPS, CONVOLUTIONMONO); */ CAP_CASE(CubeTextureFilterCaps, D3DPTFILTERCAPS, MAGFPOINT); CAP_CASE(CubeTextureFilterCaps, D3DPTFILTERCAPS, MAGFLINEAR); CAP_CASE(CubeTextureFilterCaps, D3DPTFILTERCAPS, MAGFANISOTROPIC); CAP_CASE(CubeTextureFilterCaps, D3DPTFILTERCAPS, MAGFPYRAMIDALQUAD); CAP_CASE(CubeTextureFilterCaps, D3DPTFILTERCAPS, MAGFGAUSSIANQUAD); CAP_CASE(CubeTextureFilterCaps, D3DPTFILTERCAPS, MINFPOINT); CAP_CASE(CubeTextureFilterCaps, D3DPTFILTERCAPS, MINFLINEAR); CAP_CASE(CubeTextureFilterCaps, D3DPTFILTERCAPS, MINFANISOTROPIC); CAP_CASE(CubeTextureFilterCaps, D3DPTFILTERCAPS, MINFPYRAMIDALQUAD); CAP_CASE(CubeTextureFilterCaps, D3DPTFILTERCAPS, MINFGAUSSIANQUAD); CAP_CASE(CubeTextureFilterCaps, D3DPTFILTERCAPS, MIPFPOINT); CAP_CASE(CubeTextureFilterCaps, D3DPTFILTERCAPS, MIPFLINEAR); C2S("\nVolumeTextureFilterCaps:"); /* CAP_CASE(VolumeTextureFilterCaps, D3DPTFILTERCAPS, CONVOLUTIONMONO); */ CAP_CASE(VolumeTextureFilterCaps, D3DPTFILTERCAPS, MAGFPOINT); CAP_CASE(VolumeTextureFilterCaps, D3DPTFILTERCAPS, MAGFLINEAR); CAP_CASE(VolumeTextureFilterCaps, D3DPTFILTERCAPS, MAGFANISOTROPIC); CAP_CASE(VolumeTextureFilterCaps, D3DPTFILTERCAPS, MAGFPYRAMIDALQUAD); CAP_CASE(VolumeTextureFilterCaps, D3DPTFILTERCAPS, MAGFGAUSSIANQUAD); CAP_CASE(VolumeTextureFilterCaps, D3DPTFILTERCAPS, MINFPOINT); CAP_CASE(VolumeTextureFilterCaps, D3DPTFILTERCAPS, MINFLINEAR); CAP_CASE(VolumeTextureFilterCaps, D3DPTFILTERCAPS, MINFANISOTROPIC); CAP_CASE(VolumeTextureFilterCaps, D3DPTFILTERCAPS, MINFPYRAMIDALQUAD); CAP_CASE(VolumeTextureFilterCaps, D3DPTFILTERCAPS, MINFGAUSSIANQUAD); CAP_CASE(VolumeTextureFilterCaps, D3DPTFILTERCAPS, MIPFPOINT); CAP_CASE(VolumeTextureFilterCaps, D3DPTFILTERCAPS, MIPFLINEAR); C2S("\nTextureAddressCaps:"); CAP_CASE(TextureAddressCaps, D3DPTADDRESSCAPS, BORDER); CAP_CASE(TextureAddressCaps, D3DPTADDRESSCAPS, CLAMP); CAP_CASE(TextureAddressCaps, D3DPTADDRESSCAPS, INDEPENDENTUV); CAP_CASE(TextureAddressCaps, D3DPTADDRESSCAPS, MIRROR); CAP_CASE(TextureAddressCaps, D3DPTADDRESSCAPS, MIRRORONCE); CAP_CASE(TextureAddressCaps, D3DPTADDRESSCAPS, WRAP); C2S("\nVolumeTextureAddressCaps:"); CAP_CASE(VolumeTextureAddressCaps, D3DPTADDRESSCAPS, BORDER); CAP_CASE(VolumeTextureAddressCaps, D3DPTADDRESSCAPS, CLAMP); CAP_CASE(VolumeTextureAddressCaps, D3DPTADDRESSCAPS, INDEPENDENTUV); CAP_CASE(VolumeTextureAddressCaps, D3DPTADDRESSCAPS, MIRROR); CAP_CASE(VolumeTextureAddressCaps, D3DPTADDRESSCAPS, MIRRORONCE); CAP_CASE(VolumeTextureAddressCaps, D3DPTADDRESSCAPS, WRAP); C2S("\nLineCaps:"); CAP_CASE(LineCaps, D3DLINECAPS, ALPHACMP); CAP_CASE(LineCaps, D3DLINECAPS, ANTIALIAS); CAP_CASE(LineCaps, D3DLINECAPS, BLEND); CAP_CASE(LineCaps, D3DLINECAPS, FOG); CAP_CASE(LineCaps, D3DLINECAPS, TEXTURE); CAP_CASE(LineCaps, D3DLINECAPS, ZTEST); C2S("\nMaxTextureWidth: %u", caps->MaxTextureWidth); C2S("\nMaxTextureHeight: %u", caps->MaxTextureHeight); C2S("\nMaxVolumeExtent: %u", caps->MaxVolumeExtent); C2S("\nMaxTextureRepeat: %u", caps->MaxTextureRepeat); C2S("\nMaxTextureAspectRatio: %u", caps->MaxTextureAspectRatio); C2S("\nMaxAnisotropy: %u", caps->MaxAnisotropy); C2S("\nMaxVertexW: %f", caps->MaxVertexW); C2S("\nGuardBandLef,Top,Right,Bottom: %f %f %f %f", caps->GuardBandLeft, caps->GuardBandTop, caps->GuardBandRight, caps->GuardBandBottom); C2S("\nExtentsAdjust: %f", caps->ExtentsAdjust); C2S("\nStencilCaps:"); CAP_CASE(StencilCaps, D3DSTENCILCAPS, KEEP); CAP_CASE(StencilCaps, D3DSTENCILCAPS, ZERO); CAP_CASE(StencilCaps, D3DSTENCILCAPS, REPLACE); CAP_CASE(StencilCaps, D3DSTENCILCAPS, INCRSAT); CAP_CASE(StencilCaps, D3DSTENCILCAPS, DECRSAT); CAP_CASE(StencilCaps, D3DSTENCILCAPS, INVERT); CAP_CASE(StencilCaps, D3DSTENCILCAPS, INCR); CAP_CASE(StencilCaps, D3DSTENCILCAPS, DECR); CAP_CASE(StencilCaps, D3DSTENCILCAPS, TWOSIDED); C2S("\nFVFCaps:"); CAP_CASE(FVFCaps, D3DFVFCAPS, DONOTSTRIPELEMENTS); CAP_CASE(FVFCaps, D3DFVFCAPS, PSIZE); CAP_CASE(FVFCaps, D3DFVFCAPS, TEXCOORDCOUNTMASK); C2S("\nTextureOpCaps:"); CAP_CASE(TextureOpCaps, D3DTEXOPCAPS, ADD); CAP_CASE(TextureOpCaps, D3DTEXOPCAPS, ADDSIGNED); C2S(" ..."); C2S("\nMaxTextureBlendStages: %u", caps->MaxTextureBlendStages); C2S("\nMaxSimultaneousTextures: %u", caps->MaxTextureBlendStages); C2S("\nVertexProcessingCaps:"); CAP_CASE(VertexProcessingCaps, D3DVTXPCAPS, DIRECTIONALLIGHTS); CAP_CASE(VertexProcessingCaps, D3DVTXPCAPS, LOCALVIEWER); CAP_CASE(VertexProcessingCaps, D3DVTXPCAPS, MATERIALSOURCE7); CAP_CASE(VertexProcessingCaps, D3DVTXPCAPS, NO_TEXGEN_NONLOCALVIEWER); CAP_CASE(VertexProcessingCaps, D3DVTXPCAPS, POSITIONALLIGHTS); CAP_CASE(VertexProcessingCaps, D3DVTXPCAPS, TEXGEN); CAP_CASE(VertexProcessingCaps, D3DVTXPCAPS, TEXGEN_SPHEREMAP); CAP_CASE(VertexProcessingCaps, D3DVTXPCAPS, TWEENING); C2S("\nMaxActiveLights: %u", caps->MaxActiveLights); C2S("\nMaxUserClipPlanes: %u", caps->MaxUserClipPlanes); C2S("\nMaxVertexBlendMatrices: %u", caps->MaxVertexBlendMatrices); C2S("\nMaxVertexBlendMatrixIndex: %u", caps->MaxVertexBlendMatrixIndex); C2S("\nMaxPointSize: %f", caps->MaxPointSize); C2S("\nMaxPrimitiveCount: 0x%x", caps->MaxPrimitiveCount); C2S("\nMaxVertexIndex: 0x%x", caps->MaxVertexIndex); C2S("\nMaxStreams: %u", caps->MaxStreams); C2S("\nMaxStreamStride: 0x%x", caps->MaxStreamStride); C2S("\nVertexShaderVersion: %08x", caps->VertexShaderVersion); C2S("\nMaxVertexShaderConst: %u", caps->MaxVertexShaderConst); C2S("\nPixelShaderVersion: %08x", caps->PixelShaderVersion); C2S("\nPixelShader1xMaxValue: %f", caps->PixelShader1xMaxValue); DBG_FLAG(ch, "D3DCAPS9(%p) part 1:\n%s\n", caps, s); p = 0; C2S("DevCaps2:"); CAP_CASE(DevCaps2, D3DDEVCAPS2, ADAPTIVETESSRTPATCH); CAP_CASE(DevCaps2, D3DDEVCAPS2, ADAPTIVETESSNPATCH); CAP_CASE(DevCaps2, D3DDEVCAPS2, CAN_STRETCHRECT_FROM_TEXTURES); CAP_CASE(DevCaps2, D3DDEVCAPS2, DMAPNPATCH); CAP_CASE(DevCaps2, D3DDEVCAPS2, PRESAMPLEDDMAPNPATCH); CAP_CASE(DevCaps2, D3DDEVCAPS2, STREAMOFFSET); CAP_CASE(DevCaps2, D3DDEVCAPS2, VERTEXELEMENTSCANSHARESTREAMOFFSET); C2S("\nMasterAdapterOrdinal: %u", caps->MasterAdapterOrdinal); C2S("\nAdapterOrdinalInGroup: %u", caps->AdapterOrdinalInGroup); C2S("\nNumberOfAdaptersInGroup: %u", caps->NumberOfAdaptersInGroup); C2S("\nDeclTypes:"); CAP_CASE(DeclTypes, D3DDTCAPS, UBYTE4); CAP_CASE(DeclTypes, D3DDTCAPS, UBYTE4N); CAP_CASE(DeclTypes, D3DDTCAPS, SHORT2N); CAP_CASE(DeclTypes, D3DDTCAPS, SHORT4N); CAP_CASE(DeclTypes, D3DDTCAPS, USHORT2N); CAP_CASE(DeclTypes, D3DDTCAPS, USHORT4N); CAP_CASE(DeclTypes, D3DDTCAPS, UDEC3); CAP_CASE(DeclTypes, D3DDTCAPS, DEC3N); CAP_CASE(DeclTypes, D3DDTCAPS, FLOAT16_2); CAP_CASE(DeclTypes, D3DDTCAPS, FLOAT16_4); C2S("\nNumSimultaneousRTs: %u", caps->NumSimultaneousRTs); C2S("\nStretchRectFilterCaps:"); CAP_CASE(StretchRectFilterCaps, D3DPTFILTERCAPS, MINFPOINT); CAP_CASE(StretchRectFilterCaps, D3DPTFILTERCAPS, MINFLINEAR); CAP_CASE(StretchRectFilterCaps, D3DPTFILTERCAPS, MAGFPOINT); CAP_CASE(StretchRectFilterCaps, D3DPTFILTERCAPS, MAGFLINEAR); C2S("\nVS20Caps.Caps: Predication=%s", caps->VS20Caps.Caps ? "yes" : "no"); C2S("\nVS20Caps.DynamicFlowControlDepth: %u", caps->VS20Caps.DynamicFlowControlDepth); C2S("\nVS20Caps.NumTemps: %u", caps->VS20Caps.NumTemps); C2S("\nVS20Caps.StaticFlowControlDepth: %u", caps->VS20Caps.StaticFlowControlDepth); C2S("\nPS20Caps.Caps: Predication=%s", caps->VS20Caps.Caps ? "yes" : "no"); C2S("\nPS20Caps.DynamicFlowControlDepth: %u", caps->PS20Caps.DynamicFlowControlDepth); C2S("\nPS20Caps.NumTemps: %u", caps->PS20Caps.NumTemps); C2S("\nPS20Caps.StaticFlowControlDepth: %u", caps->PS20Caps.StaticFlowControlDepth); C2S("\nPS20Caps.NumInstructionSlots: %u", caps->PS20Caps.NumInstructionSlots); C2S("\nVertexTextureFilterCaps"); /* CAP_CASE(VertexTextureFilterCaps, D3DPTFILTERCAPS, CONVOLUTIONMONO); */ CAP_CASE(VertexTextureFilterCaps, D3DPTFILTERCAPS, MAGFPOINT); CAP_CASE(VertexTextureFilterCaps, D3DPTFILTERCAPS, MAGFLINEAR); CAP_CASE(VertexTextureFilterCaps, D3DPTFILTERCAPS, MAGFANISOTROPIC); CAP_CASE(VertexTextureFilterCaps, D3DPTFILTERCAPS, MAGFPYRAMIDALQUAD); CAP_CASE(VertexTextureFilterCaps, D3DPTFILTERCAPS, MAGFGAUSSIANQUAD); CAP_CASE(VertexTextureFilterCaps, D3DPTFILTERCAPS, MINFPOINT); CAP_CASE(VertexTextureFilterCaps, D3DPTFILTERCAPS, MINFLINEAR); CAP_CASE(VertexTextureFilterCaps, D3DPTFILTERCAPS, MINFANISOTROPIC); CAP_CASE(VertexTextureFilterCaps, D3DPTFILTERCAPS, MINFPYRAMIDALQUAD); CAP_CASE(VertexTextureFilterCaps, D3DPTFILTERCAPS, MINFGAUSSIANQUAD); CAP_CASE(VertexTextureFilterCaps, D3DPTFILTERCAPS, MIPFPOINT); CAP_CASE(VertexTextureFilterCaps, D3DPTFILTERCAPS, MIPFLINEAR); C2S("\nMaxVShaderInstructionsExecuted: %u", caps->MaxVShaderInstructionsExecuted); C2S("\nMaxPShaderInstructionsExecuted: %u", caps->MaxPShaderInstructionsExecuted); C2S("\nMaxVertexShader30InstructionSlots: %u >= 512", caps->MaxVertexShader30InstructionSlots); C2S("\nMaxPixelShader30InstructionSlots: %u >= 512", caps->MaxPixelShader30InstructionSlots); DBG_FLAG(ch, "D3DCAPS9(%p) part 2:\n%s\n", caps, s); FREE(s); }
/* HomeDirectory * returns a KDirectory where the binary for a given function is located * * "dir" [ OUT ] - return parameter for home directory ( read-only ), if found * * "func" [ IN ] - function pointer within binary to be located */ LIB_EXPORT rc_t CC KDyldHomeDirectory ( const KDyld *self, const KDirectory **dir, fptr_t func ) { rc_t rc; if ( dir == NULL ) rc = RC ( rcFS, rcDylib, rcSearching, rcParam, rcNull ); else { * dir = NULL; if ( self == NULL ) rc = RC ( rcFS, rcDylib, rcSearching, rcSelf, rcNull ); else if ( func == NULL ) rc = RC ( rcFS, rcDylib, rcSearching, rcFunction, rcNull ); else { Dl_info info; memset ( & info, 0, sizeof info ); if ( dladdr ( ( void* ) func, & info ) == 0 ) rc = RC ( rcFS, rcDylib, rcSearching, rcFunction, rcNotFound ); else { KDirectory *wd; rc = KDirectoryNativeDir ( & wd ); if ( rc == 0 ) { /* turn this into a real path */ const KSysDir *sdir = KDirectoryGetSysDir ( wd ); if ( sdir == NULL ) rc = RC ( rcFS, rcDylib, rcSearching, rcDirectory, rcIncorrect ); else { /* "dladdr" will return a simple name rather than a path when the address is within the application itself and the application was found using PATH. this is brilliant design at its best. */ char thanks_for_brilliant_APIs [ PATH_MAX ]; const char *dli_fname = info . dli_fname; /* check for a path rather than a name */ const char *last_slash = strrchr ( info . dli_fname, '/' ); if ( last_slash == NULL ) { /* simple name - get PATH */ const char *PATH = getenv ( "PATH" ); rc = RC ( rcFS, rcDylib, rcSearching, rcPath, rcNotFound ); if ( PATH != NULL ) { /* loop over PATH */ const char *path_start, *path_end; for ( path_start = PATH;; path_start = path_end + 1 ) { /* look for non-empty directory */ path_end = strchr ( path_start, ':' ); if ( path_start != path_end && path_start [ 0 ] != 0 ) { rc_t rc2; uint32_t path_type; /* handle last element in list */ if ( path_end == NULL ) last_slash = path_start + strlen ( path_start ); else for ( last_slash = path_end; last_slash > path_start; -- last_slash ) { if ( last_slash [ -1 ] != '/' ) break; } /* create possible path, using up to ':' */ rc2 = string_printf ( thanks_for_brilliant_APIs, sizeof thanks_for_brilliant_APIs, NULL, "%.*s/%s", ( int ) ( last_slash - path_start ), path_start, dli_fname ); /* if failed to create path string */ if ( rc2 != 0 ) break; /* check path against working directory */ path_type = KDirectoryPathType ( wd, thanks_for_brilliant_APIs ); if ( ( path_type & ~ kptAlias ) == kptFile ) { uint32_t access = 0; rc = KDirectoryAccess ( wd, & access, thanks_for_brilliant_APIs ); if ( rc != 0 ) break; /* try to do a quick check that the file can be executed. but it could fail to do the right guess. */ if ( access & 0100 || access & 0010 || access & 0001 ) { /* this is a file, which can be assumed to be an executable */ dli_fname = thanks_for_brilliant_APIs; last_slash = & thanks_for_brilliant_APIs [ last_slash - path_start ]; rc = 0; break; } } } /* exit if no more paths */ if ( path_end == NULL ) break; } } } if ( rc == 0 ) { char real [ PATH_MAX ]; rc = KSysDirRealPath ( sdir, real, sizeof real, "%.*s" , ( int ) ( last_slash - dli_fname ), dli_fname ); if ( rc == 0 ) rc = KDirectoryOpenDirRead ( wd, dir, false, real ); DBGMSG(DBG_KFS, DBG_FLAG(DBG_KFS_DIR), ("%s: %R path is '%s'\n", __func__, rc, real)); } } KDirectoryRelease ( wd ); } } } } return rc; }
KNSProxies * KNSManagerKNSProxiesMake ( struct KNSManager * mgr, const KConfig * kfg ) { rc_t rc = 0; int i = 0; int n = 2; typedef enum { eEnv, eKfg, } EType; EType type [ 2 ] = { eKfg, eEnv }; KNSProxies * self = calloc ( 1, sizeof * self ); if ( self == NULL ) return NULL; assert ( self ); BSTreeInit ( & self -> proxie_tree ); rc = KConfigReadBool ( kfg, "/http/proxy/enabled", & self -> http_proxy_enabled ); if ( rc != 0 ) { if ( GetRCState ( rc ) == rcNotFound ) rc = 0; else { KNSManagerSetHTTPProxyPath ( mgr, NULL ); assert ( self -> http_proxy_enabled == false ); } } else if ( ! self -> http_proxy_enabled ) return self; { bool proxy_only = false; rc_t rc = KConfigReadBool ( kfg, "/http/proxy/only", & proxy_only ); if ( rc == 0 && proxy_only ) self-> http_proxy_only = true; } { String * result = NULL; rc = KConfigReadString ( kfg, "/http/proxy/use", & result ); if ( rc == 0 ) { if ( StringCmp ( result, "env") ) { n = 1; type [ 0 ] = eEnv; } else if ( StringCmp ( result, "kfg") ) { n = 1; type [ 0 ] = eKfg; } else if ( StringCmp ( result, "none") ) { n = 0; } else if ( StringCmp ( result, "env,kfg") ) { n = 2; type [ 0 ] = eEnv; type [ 1 ] = eKfg; } else if ( StringCmp ( result, "kfg,env") ) { n = 2; type [ 0 ] = eKfg; type [ 1 ] = eEnv; } } RELEASE ( String, result ); } for ( i = 0; i < n; ++ i ) { switch ( type [ i ] ) { case eEnv: KNSProxiesHttpProxyInitFromEnv ( self ); break; case eKfg: KNSProxiesHttpProxyInitFromKfg ( self, kfg ); break; default: assert ( 0 ); break; } } BSTreeForEach ( & self -> proxie_tree, false, KNSProxiesBSTreeCount, & self -> http_proxies_cnt ); if ( self -> http_proxies_cnt > 0 ) { self -> http_proxies = calloc ( self -> http_proxies_cnt, sizeof * self -> http_proxies ); if ( self -> http_proxies == NULL ) return NULL; DBGMSG ( DBG_KNS, DBG_FLAG ( DBG_KNS_PROXY ), ( "Will use %zu proxy spec%s%s\n", self -> http_proxies_cnt, self -> http_proxies_cnt > 1 ? "s" : "", self -> http_proxy_only ? "" : " and direct connection") ); } self -> tmpS = 0; n = self -> http_proxies_cnt; srand ( time ( NULL ) ); while ( n > 0 ) { self -> rand = rand () % n; self -> tmpI = 0; if ( ! BSTreeDoUntil ( & self -> proxie_tree, false, KNSProxiesBSTreeSetRand, self ) ) { BSTreeForEach ( & self -> proxie_tree, false, KNSProxiesBSTreeInit, self ) ; n = 0; } else { const BSTItem * item = ( BSTItem * ) self -> tmpB; self -> http_proxies [ self -> tmpS ++ ] = item -> proxy; BSTreeUnlink ( & self -> proxie_tree, self -> tmpB ); BSTItemWhack ( self -> tmpB, NULL ); self -> tmpB = NULL; -- n; } } /* BSTreeForEach ( & self -> proxie_tree, false, KNSProxiesBSTreeInit, self );*/ for ( self -> tmpS = 1; self -> tmpS < self ->http_proxies_cnt; ++ self -> tmpS ) { self -> http_proxies [ self -> tmpS - 1 ] -> next = self -> http_proxies [ self -> tmpS ]; } return self; }
static rc_t CC KNSManagerNewReleaseVersionImpl(const struct KNSManager *self, SraReleaseVersion *newVersion) { rc_t rc = 0; KDataBuffer result; KHttpRequest *req = NULL; KHttpResult *rslt = NULL; if (newVersion == NULL) { return RC(rcNS, rcArgv, rcAccessing, rcParam, rcNull); } memset(newVersion, 0, sizeof *newVersion); if (self == NULL) { return RC(rcNS, rcArgv, rcAccessing, rcSelf, rcNull); } memset(&result, 0, sizeof result); if (rc == 0) { rc = KNSManagerMakeRequest(self, &req, 0x01010000, NULL, "https://ftp-trace.ncbi.nlm.nih.gov/sra/sdk/current/sratoolkit.current.version" ); } if (rc == 0) { rc = KHttpRequestGET(req, &rslt); } if (rc == 0) { uint32_t code = 0; rc = KHttpResultStatus(rslt, &code, NULL, 0, NULL); if (rc == 0) { if (code != 200) { rc = RC(rcNS, rcFile, rcReading, rcFile, rcInvalid); } } } if (rc == 0) { size_t total = 0; KStream *response = NULL; rc = KHttpResultGetInputStream(rslt, &response); if (rc == 0) { rc = KDataBufferMakeBytes(&result, 1024); } while (rc == 0) { size_t num_read = 0; uint8_t *base = NULL; uint64_t avail = result.elem_count - total; if (avail < 256) { rc = KDataBufferResize(&result, result.elem_count + 1024); if (rc != 0) { break; } } base = result.base; rc = KStreamRead(response, &base[total], result.elem_count - total, &num_read); if (num_read > 0 || rc != 0) { DBGMSG(DBG_VFS, DBG_FLAG(DBG_VFS), ("KStreamRead" "(sratoolkit.current.version, %zu) = %R\n", num_read, rc)); } if (rc != 0) { /* TBD - look more closely at rc */ if (num_read > 0) { rc = 0; } else { break; } } if (num_read == 0) { break; } total += num_read; } RELEASE(KStream, response); if (rc == 0) { DBGMSG(DBG_VFS, DBG_FLAG(DBG_VFS), ("sratoolkit.current.version (%zu)\n", total)); result.elem_count = total; } } if (rc == 0) { const char *start = (const void*)(result.base); size_t size = KDataBufferBytes(&result); DBGMSG(DBG_VFS, DBG_FLAG(DBG_VFS), ("sratoolkit.current.version = '%.*s'\n", (uint32_t)size, start)); rc = SraReleaseVersionInit(newVersion, start, size); } KDataBufferWhack(&result); RELEASE(KHttpResult, rslt); RELEASE(KHttpRequest, req); return rc; }
/* OpenUpdate * finish create operation */ static rc_t VTableOpenUpdate ( VTable *self, const char *decl ) { /* open metadata */ rc_t rc = KTableOpenMetadataUpdate ( self -> ktbl, & self -> meta ); if ( rc == 0 ) { /* open "col" node */ rc = KMetadataOpenNodeUpdate ( self -> meta, & self -> col_node, "col" ); if ( rc == 0 ) { /* fetch stored schema */ rc = VTableLoadSchema ( self ); if ( rc == 0 ) { /* fetch requested schema */ const STable *stbl = self -> stbl; if ( decl != NULL && decl [ 0 ] != 0 ) { uint32_t type; const SNameOverload *name; if ( self -> db != NULL ) { const STblMember *mbr = SDatabaseFind ( self -> db -> sdb, self -> schema, & name, & type, decl, "VTableOpenUpdate" ); if ( mbr == NULL || type != eTblMember ) { PLOGMSG ( klogWarn, ( klogWarn, "expression '$(expr)' is not a table member", "expr=%s", decl )); stbl = NULL; } else { stbl = mbr -> tbl; assert ( stbl != NULL ); } } else { stbl = VSchemaFind ( self -> schema, & name, & type, decl, "VTableOpenUpdate", true ); if ( stbl != NULL && type != eTable ) { PLOGMSG ( klogWarn, ( klogWarn, "expression '$(expr)' is not a table", "expr=%s", decl )); stbl = NULL; } } } /* error if the two definitions differ */ if ( stbl != NULL && self -> stbl != NULL && stbl != self -> stbl ) rc = RC ( rcVDB, rcTable, rcOpening, rcSchema, rcIncorrect ); else if ( stbl == NULL && self -> stbl == NULL ) rc = RC ( rcVDB, rcTable, rcOpening, rcSchema, rcNotFound ); else if ( self -> stbl == NULL ) { /* write schema to metadata */ self -> stbl = stbl; rc = VTableStoreSchema ( self ); } else if ( stbl != NULL ) { /* use latest schema but don't overwrite in metadata */ self -> stbl = stbl; } } } } DBGMSG(DBG_VDB, DBG_FLAG(DBG_VDB_VDB), ("VTableOpenUpdate = %d\n", rc)); return rc; }
/* KColumnBlobRead * read data from blob * * "offset" [ IN ] - starting offset into blob * * "buffer" [ OUT ] and "bsize" [ IN ] - return buffer for read * * "num_read" [ OUT ] - number of bytes actually read * * "remaining" [ OUT, NULL OKAY ] - optional return parameter for * the number of bytes remaining to be read. specifically, * "offset" + "num_read" + "remaining" == sizeof blob */ LIB_EXPORT rc_t CC KColumnBlobRead ( const KColumnBlob *self, size_t offset, void *buffer, size_t bsize, size_t *num_read, size_t *remaining ) { rc_t rc; size_t ignore; if ( remaining == NULL ) remaining = & ignore; if ( num_read == NULL ) rc = RC ( rcDB, rcBlob, rcReading, rcParam, rcNull ); else { if ( self == NULL ) rc = RC ( rcDB, rcBlob, rcReading, rcSelf, rcNull ); else { size_t size = self -> loc . u . blob . size; const KColumn *col = self -> col; if ( offset > size ) offset = size; if ( bsize == 0 ) rc = 0; else if ( buffer == NULL ) rc = RC ( rcDB, rcBlob, rcReading, rcBuffer, rcNull ); else { size_t to_read = size - offset; if ( to_read > bsize ) to_read = bsize; POS_DEBUG(( "KDB: %s,%lu,%lu\n", self->col->path, offset, to_read )); #ifdef _DEBUGGING if ( KDbgTestModConds ( DBG_KFS, DBG_FLAG( DBG_KFS_POS ) ) || KDbgTestModConds ( DBG_KFS, DBG_FLAG( DBG_KFS_PAGE ) ) ) { KDbgSetColName( self->col->path ); } #endif *num_read = 0; while ( * num_read < to_read ) { size_t nread = 0; rc = KColumnDataRead ( & col -> df, & self -> pmorig, offset - *num_read, & ( ( char * ) buffer ) [ * num_read ], to_read - * num_read, & nread ); if ( rc != 0 ) break; if (nread == 0) { rc = RC ( rcDB, rcBlob, rcReading, rcFile, rcInsufficient ); break; } *num_read += nread; } #ifdef _DEBUGGING if ( KDbgTestModConds ( DBG_KFS, DBG_FLAG( DBG_KFS_POS ) ) || KDbgTestModConds ( DBG_KFS, DBG_FLAG( DBG_KFS_PAGE ) ) ) { KDbgSetColName( NULL ); } #endif if ( rc == 0 ) { * remaining = size - offset - * num_read; return 0; } } * remaining = size - offset; * num_read = 0; return rc; } * num_read = 0; } * remaining = 0; return rc; }