+ NvApi package for win32 and win64 by Dmitry Boyarintsev, resolves #15771

git-svn-id: trunk@14951 -
This commit is contained in:
florian 2010-02-28 09:56:36 +00:00
parent e001876e2b
commit e9c95ea46f
7 changed files with 3273 additions and 5 deletions

4
.gitattributes vendored
View File

@ -4488,6 +4488,10 @@ packages/numlib/tests/test.bat svneol=native#text/plain
packages/numlib/tests/test.pas svneol=native#text/plain
packages/numlib/tests/timer.pas svneol=native#text/plain
packages/numlib/tests/turte.pas svneol=native#text/plain
packages/nvapi/Makefile.fpc svneol=native#text/plain
packages/nvapi/examples/nvapitest.pas svneol=native#text/pascal
packages/nvapi/fpmake.pp svneol=native#text/pascal
packages/nvapi/src/nvapi.pas svneol=native#text/pascal
packages/objcrtl/Makefile svneol=native#text/plain
packages/objcrtl/Makefile.fpc svneol=native#text/plain
packages/objcrtl/examples/objcrtltest.pas svneol=native#text/plain

View File

@ -1,5 +1,5 @@
#
# Don't edit, this file is generated by FPCMake Version 2.0.0 [2010/02/04]
# Don't edit, this file is generated by FPCMake Version 2.0.0 [2010/02/28]
#
default: all
MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian i386-nativent m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-solaris x86_64-darwin x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-darwin arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-darwin powerpc64-embedded avr-embedded armeb-linux armeb-embedded mipsel-linux
@ -271,7 +271,7 @@ ifeq ($(FULL_TARGET),i386-go32v2)
override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 fv graph unzip gdbint
endif
ifeq ($(FULL_TARGET),i386-win32)
override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 fv winunits-base winunits-jedi fcl-web fastcgi ibase mysql zlib oracle odbc postgres sqlite imagemagick gdbint libpng mad tcl opengl gtk1 gtk2 librsvg a52 cdrom fpgtk openal fftw lua fcl-extra zorba oggvorbis sdl openssl graph pcap httpd13 httpd20 httpd22 pxlib numlib winceunits cairo libxml gmp opencl libsee
override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 fv winunits-base winunits-jedi fcl-web fastcgi ibase mysql zlib oracle odbc postgres sqlite imagemagick gdbint libpng mad tcl opengl gtk1 gtk2 librsvg a52 cdrom fpgtk openal fftw lua fcl-extra zorba oggvorbis sdl openssl graph pcap httpd13 httpd20 httpd22 pxlib numlib winceunits cairo libxml gmp opencl libsee nvapi
endif
ifeq ($(FULL_TARGET),i386-os2)
override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 fv zlib libpng x11 tcl fpgtk rexx os2units gtk1 imlib
@ -397,7 +397,7 @@ ifeq ($(FULL_TARGET),x86_64-darwin)
override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 fv fcl-web fastcgi fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick libpng gdbm tcl syslog libcurl bfd aspell utmp fftw pcap openssl numlib iconvenc gmp fcl-extra univint opengl x11 cairo gtk1 gtk2 librsvg fpgtk xforms gnome1 httpd13 httpd20 httpd22 imlib cocoaint
endif
ifeq ($(FULL_TARGET),x86_64-win64)
override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 fv winunits-base winunits-jedi fcl-web fastcgi ibase mysql zlib oracle odbc postgres sqlite imagemagick tcl opengl gtk1 fpgtk fftw sdl openssl cdrom httpd13 httpd20 httpd22 numlib fcl-extra opencl
override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 fv winunits-base winunits-jedi fcl-web fastcgi ibase mysql zlib oracle odbc postgres sqlite imagemagick tcl opengl gtk1 fpgtk fftw sdl openssl cdrom httpd13 httpd20 httpd22 numlib fcl-extra opencl nvapi
endif
ifeq ($(FULL_TARGET),x86_64-embedded)
override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2
@ -1740,6 +1740,7 @@ TARGET_DIRS_LIBXML=1
TARGET_DIRS_GMP=1
TARGET_DIRS_OPENCL=1
TARGET_DIRS_LIBSEE=1
TARGET_DIRS_NVAPI=1
endif
ifeq ($(FULL_TARGET),i386-os2)
TARGET_DIRS_HASH=1
@ -3809,6 +3810,7 @@ TARGET_DIRS_HTTPD22=1
TARGET_DIRS_NUMLIB=1
TARGET_DIRS_FCL-EXTRA=1
TARGET_DIRS_OPENCL=1
TARGET_DIRS_NVAPI=1
endif
ifeq ($(FULL_TARGET),x86_64-embedded)
TARGET_DIRS_HASH=1
@ -8678,6 +8680,51 @@ opencl:
$(MAKE) -C opencl all
.PHONY: opencl_all opencl_debug opencl_smart opencl_release opencl_units opencl_examples opencl_shared opencl_install opencl_sourceinstall opencl_exampleinstall opencl_distinstall opencl_zipinstall opencl_zipsourceinstall opencl_zipexampleinstall opencl_zipdistinstall opencl_clean opencl_distclean opencl_cleanall opencl_info opencl_makefiles opencl
endif
ifdef TARGET_DIRS_NVAPI
nvapi_all:
$(MAKE) -C nvapi all
nvapi_debug:
$(MAKE) -C nvapi debug
nvapi_smart:
$(MAKE) -C nvapi smart
nvapi_release:
$(MAKE) -C nvapi release
nvapi_units:
$(MAKE) -C nvapi units
nvapi_examples:
$(MAKE) -C nvapi examples
nvapi_shared:
$(MAKE) -C nvapi shared
nvapi_install:
$(MAKE) -C nvapi install
nvapi_sourceinstall:
$(MAKE) -C nvapi sourceinstall
nvapi_exampleinstall:
$(MAKE) -C nvapi exampleinstall
nvapi_distinstall:
$(MAKE) -C nvapi distinstall
nvapi_zipinstall:
$(MAKE) -C nvapi zipinstall
nvapi_zipsourceinstall:
$(MAKE) -C nvapi zipsourceinstall
nvapi_zipexampleinstall:
$(MAKE) -C nvapi zipexampleinstall
nvapi_zipdistinstall:
$(MAKE) -C nvapi zipdistinstall
nvapi_clean:
$(MAKE) -C nvapi clean
nvapi_distclean:
$(MAKE) -C nvapi distclean
nvapi_cleanall:
$(MAKE) -C nvapi cleanall
nvapi_info:
$(MAKE) -C nvapi info
nvapi_makefiles:
$(MAKE) -C nvapi makefiles
nvapi:
$(MAKE) -C nvapi all
.PHONY: nvapi_all nvapi_debug nvapi_smart nvapi_release nvapi_units nvapi_examples nvapi_shared nvapi_install nvapi_sourceinstall nvapi_exampleinstall nvapi_distinstall nvapi_zipinstall nvapi_zipsourceinstall nvapi_zipexampleinstall nvapi_zipdistinstall nvapi_clean nvapi_distclean nvapi_cleanall nvapi_info nvapi_makefiles nvapi
endif
ifdef TARGET_DIRS_REXX
rexx_all:
$(MAKE) -C rexx all

View File

@ -49,9 +49,9 @@ dirs_linux=fv fcl-web fastcgi fcl-async ibase mysql ncurses unzip zlib oracle db
dirs_win32=fv winunits-base winunits-jedi fcl-web fastcgi ibase mysql zlib oracle odbc postgres sqlite imagemagick \
gdbint libpng mad tcl opengl gtk1 gtk2 librsvg a52 cdrom fpgtk openal fftw lua fcl-extra zorba \
oggvorbis sdl openssl graph pcap httpd13 httpd20 httpd22 pxlib numlib winceunits cairo libxml \
gmp opencl libsee
gmp opencl libsee nvapi
dirs_win64=fv winunits-base winunits-jedi fcl-web fastcgi ibase mysql zlib oracle odbc postgres sqlite imagemagick \
tcl opengl gtk1 fpgtk fftw sdl openssl cdrom httpd13 httpd20 httpd22 numlib fcl-extra opencl
tcl opengl gtk1 fpgtk fftw sdl openssl cdrom httpd13 httpd20 httpd22 numlib fcl-extra opencl nvapi
dirs_wince=winceunits httpd22 fcl-web fastcgi tcl fftw unzip zlib sqlite mysql ibase postgres oracle odbc sdl openssl oggvorbis numlib
dirs_os2=fv zlib libpng x11 tcl fpgtk rexx os2units gtk1 imlib
dirs_emx=fv zlib libpng x11 tcl fpgtk rexx os2units gtk1 imlib

View File

@ -0,0 +1,27 @@
#
# Makefile.fpc for Free Pascal NvAPI Packages
#
[package]
name=nvapi
version=2.4.0
[target]
units=nvapi
[compiler]
includedir=src
sourcedir=src
[install]
fpcpackage=y
fpcsubdir=packages
[default]
fpcdir=../..
[shared]
build=n
[rules]
.NOTPARALLEL:

View File

@ -0,0 +1,137 @@
program navapitest;
{$APPTYPE CONSOLE}
{$ifdef fpc}{$mode delphi}{$endif}
uses
SysUtils,
NvAPI;
procedure TestGraphicAPI;
var
info : NV_DISPLAY_DRIVER_VERSION;
res : NvAPI_Status;
begin
writeln('Graphic Driver API: ' );
FillChar(info, sizeof(info), 0);
info.version:=NV_DISPLAY_DRIVER_VERSION_VER;
res:=NvAPI_GetDisplayDriverVersion(0, @info);
if res= NVAPI_OK then begin
writeln('DriverVer: ', info.drvVersion div 100, '.', info.drvVersion mod 100);
writeln('Branch: ', info.szBuildBranchString);
writeln('Adpater: ', info.szAdapterString);
end else
writeln('Not available or Failed (err ', Integer(res),')');
writeln;
end;
procedure TestGPUAPI;
var
phys : TNvPhysicalGpuHandleArray;
log : TNvLogicalGpuHandleArray;
cnt : LongWord;
i : Integer;
name : NvAPI_ShortString;
thermal : TNvGPUThermalSettings;
res : NvAPI_Status;
begin
writeln('GPU API: ' );
if NvAPI_EnumPhysicalGPUs(phys, cnt) = NVAPI_OK then begin
writeln('Physical GPUs ', cnt);
for i:=0 to cnt - 1 do
if NvAPI_GPU_GetFullName(phys[i], name) = NVAPI_OK then begin
write(' ', name,' ');
FillChar(thermal, sizeof(thermal), 0);
thermal.version:=NV_GPU_THERMAL_SETTINGS_VER;
res:=NvAPI_GPU_GetThermalSettings(phys[i],0, @thermal);
if res= NVAPI_OK then
write('temp: ', thermal.sensor[0].currentTemp, ' C');
writeln;
end;
end;
if NvAPI_EnumLogicalGPUs(log, cnt) = NVAPI_OK then
writeln('Logical GPUs ', cnt);
writeln;
end;
procedure TestDisplayAPI;
var
i : Integer;
hnd : NvDisplayHandle;
name : NvAPI_ShortString;
begin
writeln('Display APIs: ');
i:=0;
hnd:=0;
while NvAPI_EnumNVidiaDisplayHandle(i, hnd) = NVAPI_OK do begin
if NvAPI_GetAssociatedNVidiaDisplayName(hnd, name) = NVAPI_OK then
writeln('Display: ', name);
inc(i);
end;
writeln;
end;
procedure TestStereoscopicAPI;
var
res : NvAPI_Status;
b : NvU8;
begin
writeln('Stereoscopic API check');
res:=NvAPI_Stereo_IsEnabled(b);
if res = NVAPI_OK then begin
Writeln('Stereo is available');
if b = 0 then
writeln(' disabled')
else
writeln(' enabled');
end else
Writeln('Stereo is unavailable');
writeln;
end;
procedure TestSystemAPI;
var
info : NV_CHIPSET_INFO_v1;
res : NvAPI_Status;
begin
writeln('System APIs: ');
FillChar(info, sizeof(info), 0);
info.version:=NV_CHIPSET_INFO_VER_1;
res:=NvAPI_SYS_GetChipSetInfo ( info );
if res = NVAPI_OK then begin
writelN('Vendor: ', info.szVendorName);
writeln('Chipset: ', info.szChipsetName);
writelN('Vendor ID: ', IntToHex(info.vendorId, 4));
writelN('Device ID: ', IntToHex(info.deviceId, 4));
end;
writeln;
end;
var
ver : NvAPI_ShortString;
res : NvAPI_Status;
{$R nvapitest.res}
begin
res:=NvAPI_Initialize;
if res<>NVAPI_OK then begin
writeln('unable to initialize NvAPI');
Exit;
end;
writeln('NvAPI test');
NvAPI_GetInterfaceVersionString(ver);
writeln('Version: ', ver);
writeln;
TestSystemAPI;
TestGraphicAPI;
TestDisplayAPI;
TestGPUAPI;
TestStereoscopicAPI;
end.

36
packages/nvapi/fpmake.pp Normal file
View File

@ -0,0 +1,36 @@
{$ifndef ALLPACKAGES}
{$mode objfpc}{$H+}
program fpmake;
uses fpmkunit;
Var
P : TPackage;
T : TTarget;
begin
With Installer do
begin
{$endif ALLPACKAGES}
P:=AddPackage('nvapi');
{$ifdef ALLPACKAGES}
P.Directory:='nvapi';
{$endif ALLPACKAGES}
P.Version:='2.4.0';
P.Author := 'NVidia, Andreas Hausladen, Dmitry "skalogryz" Boyarintsev';
P.License := 'NVidia license';
P.HomepageURL := 'nvidia.com';
P.Email := '';
P.Description := 'NvAPI header';
P.NeedLibC:= true;
P.SourcePath.Add('src');
P.IncludePath.Add('src');
T:=P.Targets.AddUnit('nvapi.pas');
{$ifndef ALLPACKAGES}
Run;
end;
end.
{$endif ALLPACKAGES}

3017
packages/nvapi/src/nvapi.pas Normal file

File diff suppressed because it is too large Load Diff