IDS_SOL_ABOUT "Kabal av J Brown\n\nCardLib versjon 1.0."
IDS_SOL_QUIT "Slutt nåværende spill?"
IDS_SOL_WIN "Gratulerer, du vant!!"
- IDS_SOL_DEAL "Deal again?"
+ IDS_SOL_DEAL "Del ut igjen?"
END
LISTBOX IDC_PARTITION, 20,12,278,142,LBS_HASSTRINGS | WS_VSCROLL
PUSHBUTTON "&Opprett", IDC_PARTCREATE, 20,155,50,15
PUSHBUTTON "&Slett", IDC_PARTDELETE, 76,155,50,15
+ PUSHBUTTON "S&tasjon", IDC_DEVICEDRIVER, 162,155,50,15, WS_DISABLED
PUSHBUTTON "&Avansert valg...", IDC_PARTMOREOPTS, 218,155,80,15
LTEXT "Trykk på Neste for å starte installasjon prosessen.", IDC_STATIC, 10, 180 ,277, 20
END
+IDD_PARTITION DIALOGEX DISCARDABLE 0, 0, 145, 90
+STYLE WS_VISIBLE|WS_CAPTION|WS_THICKFRAME
+CAPTION "Opprett partisjon"
+FONT 8, "MS Shell Dlg"
+BEGIN
+ CONTROL "",IDC_UPDOWN1,"msctls_updown32", WS_VISIBLE,104,22,9,13
+ CONTROL "Opprett og formater partisjon",IDC_STATIC,"Button",BS_GROUPBOX,7,5,129,57
+ LTEXT "Størrelse:",IDC_STATIC, 13,24,27,9
+ EDITTEXT IDC_PARTSIZE,52,23,53,13, WS_VISIBLE|WS_TABSTOP
+ LTEXT "GB",IDC_UNIT, 117,24,14,9
+ LTEXT "Filsystem:",IDC_STATIC,13,46,35,9
+ CONTROL "",IDC_FSTYPE,"ComboBox",WS_VISIBLE|WS_TABSTOP|CBS_DROPDOWNLIST,52,42,79,50
+ PUSHBUTTON "&OK",IDOK,35,68,47,15, WS_VISIBLE|WS_TABSTOP
+ PUSHBUTTON "&Avbryt",IDCANCEL,87,68,47,15, WS_VISIBLE|WS_TABSTOP
+END
+
IDD_BOOTOPTIONS DIALOGEX DISCARDABLE 0, 0, 305, 105
-STYLE WS_VISIBLE|WS_CAPTION|WS_SYSMENU|WS_THICKFRAME
+STYLE WS_VISIBLE|WS_CAPTION|WS_THICKFRAME
CAPTION "Avansert partisjon innstillinger"
FONT 8, "MS Shell Dlg"
BEGIN
CONTROL "Installer oppstartslaster på harddiskens (MBR)", IDC_INSTFREELDR, "Button", BS_AUTORADIOBUTTON | WS_TABSTOP, 10,46,278,11
CONTROL "Ikke installer oppstartslaster", IDC_NOINSTFREELDR, "Button", BS_AUTORADIOBUTTON | WS_TABSTOP | WS_DISABLED , 10,57,278,11
PUSHBUTTON "&OK", IDOK, 180,83,50,15, WS_TABSTOP | WS_VISIBLE
- PUSHBUTTON "&Cancel", IDCANCEL, 240,83,50,15, WS_TABSTOP | WS_VISIBLE
+ PUSHBUTTON "&Avbryt", IDCANCEL, 240,83,50,15, WS_TABSTOP | WS_VISIBLE
+END
+
+IDD_SUMMARYPAGE DIALOGEX 0, 0, 317, 193
+STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
+CAPTION "ReactOS installering"
+FONT 8, "MS Shell Dlg"
+BEGIN
+ CONTROL "Installasjon oppsumering", IDC_ACTION, "Button", BS_GROUPBOX, 10,0,297,172
+ LTEXT "Trykk på Neste for å starte installasjon prosessen.", IDC_STATIC, 10, 180 ,277, 20
END
IDD_PROCESSPAGE DIALOGEX 0, 0, 317, 193
LTEXT "Når du trykker Fullført, vil din datamaskin starte på nytt.", IDC_STATIC, 20, 80, 277, 10
CONTROL "", IDC_RESTART_PROGRESS, "msctls_progress32", PBS_SMOOTH | WS_CHILD | WS_VISIBLE | WS_BORDER, 20, 120, 277, 8
- LTEXT "Hvis du fortsatt har CD platen i stasjon, fjern denne. Også, for å starte din datamaskin på nytt, trykk på Fullført.", IDC_STATIC, 10, 180, 297, 20
+ LTEXT "Hvis du fortsatt har CD platen i stasjon, fjern denne. For å starte din datamaskin på nytt, trykk på Fullført.", IDC_STATIC, 10, 180, 297, 20
END
STRINGTABLE
BEGIN
- IDS_LANGTITLE "Språk valg"
+ IDS_LANGTITLE "Språkvalg"
IDS_LANGSUBTITLE "Velg språk for installering og til ferdig system."
IDS_TYPETITLE "Velkommen til ReactOS installering"
IDS_TYPESUBTITLE "Velg installering type."
IDS_PROCESSSUBTITLE "Opprett og formater partisjon, kopier filer, installere og sett opp oppstartlaster"
IDS_RESTARTTITLE "Første steget av installering er fullført"
IDS_RESTARTSUBTITLE "Første steget av installering har blitt fullført, start på nytt for å fortsette til andre steget"
+ IDS_SUMMARYTITLE "Installasjon oppsumering"
+ IDS_SUMMARYSUBTITLE "Sjekk listen av installasjon egenskapene før du fortsetter installasjon av enhetene"
IDS_ABORTSETUP "ReactOS er ikke fullstendig installert på datamaskinen. Hvis du avslutter nå, trenger du å kjøre installeringen på nytt for å installere Reactos. Vil du virkelig avslutte?"
IDS_ABORTSETUP2 "Avbryt installasjonen?"
END
*d = '\0';
} else {
// read long file name
+ s = (const char*)p->Ent->B;
TCHAR lname[] = {s[1], s[3], s[5], s[7], s[9], s[14], s[16], s[18], s[20], s[22], s[24], s[28], s[30]};
long_name = String(lname, 13) + long_name;
#define NDEBUG
#include <debug.h>
-static VOID CALLBACK
-ServiceMain(DWORD argc, LPTSTR *argv);
-
-static SERVICE_TABLE_ENTRY ServiceTable[2] =
-{
- {TEXT("NetLogon"), ServiceMain},
- {NULL, NULL}
-};
-
-static VOID CALLBACK
-ServiceMain(
- IN DWORD argc,
- IN LPWSTR *argv)
-{
- DPRINT("ServiceMain() called\n");
-}
-
INT WINAPI
wWinMain(
IN HINSTANCE hInstance,
/* FIXME: More initialization */
- StartServiceCtrlDispatcher(ServiceTable);
-
DPRINT(" Done...\n");
ByeBye:
}
+VOID
+WaitForLSA(VOID)
+{
+ HANDLE hEvent;
+ DWORD dwError;
+
+ DPRINT1("WaitForLSA() called\n");
+
+ hEvent = CreateEventW(NULL,
+ TRUE,
+ FALSE,
+ L"LSA_RPC_SERVER_ACTIVE");
+ if (hEvent == NULL)
+ {
+ dwError = GetLastError();
+ DPRINT1("Failed to create the notication event (Error %lu)\n", dwError);
+
+ if (dwError == ERROR_ALREADY_EXISTS)
+ {
+ hEvent = OpenEventW(SYNCHRONIZE,
+ FALSE,
+ L"LSA_RPC_SERVER_ACTIVE");
+ if (hEvent != NULL)
+ {
+ DPRINT1("Could not open the notification event!\n");
+ return;
+ }
+ }
+ }
+
+ DPRINT1("Wait for LSA!\n");
+ WaitForSingleObject(hEvent, INFINITE);
+ DPRINT1("LSA is available!\n");
+
+ CloseHandle(hEvent);
+
+ DPRINT1("WaitForLSA() done\n");
+}
+
+
DWORD
ScmCreateServiceDatabase(VOID)
{
RegCloseKey(hServicesKey);
+ /* Wait for LSA */
+ WaitForLSA();
+
/* Delete services that are marked for delete */
ScmDeleteMarkedServices();
static BOOL
StartServicesManager(VOID)
{
- HANDLE ServicesInitEvent = NULL;
STARTUPINFOW StartupInfo;
PROCESS_INFORMATION ProcessInformation;
- DWORD Count;
LPCWSTR ServiceString = L"services.exe";
BOOL res;
/* Start the service control manager (services.exe) */
+ ZeroMemory(&StartupInfo, sizeof(STARTUPINFOW));
StartupInfo.cb = sizeof(StartupInfo);
StartupInfo.lpReserved = NULL;
StartupInfo.lpDesktop = NULL;
return FALSE;
}
- /* Wait for event creation (by SCM) for max. 20 seconds */
- for (Count = 0; Count < 20; Count++)
- {
- Sleep(1000);
-
- TRACE("WL: Attempting to open event \"SvcctrlStartEvent_A3752DX\"\n");
- ServicesInitEvent = OpenEventW(
- SYNCHRONIZE,
- FALSE,
- L"SvcctrlStartEvent_A3752DX");
- if (ServicesInitEvent)
- break;
- }
+ TRACE("WL: Created new process - %S\n", ServiceString);
- if (!ServicesInitEvent)
- {
- ERR("WL: Failed to open event \"SvcctrlStartEvent_A3752DX\"\n");
- return FALSE;
- }
+ CloseHandle(ProcessInformation.hThread);
+ CloseHandle(ProcessInformation.hProcess);
- /* Wait for event signalization */
- WaitForSingleObject(ServicesInitEvent, INFINITE);
- CloseHandle(ServicesInitEvent);
TRACE("WL: StartServicesManager() done.\n");
return TRUE;
}
-static BOOL
-StartCustomService(
- IN LPCWSTR ServiceName)
-{
- SC_HANDLE hSCManager = NULL;
- SC_HANDLE hService = NULL;
- BOOL ret = FALSE;
-
- hSCManager = OpenSCManager(NULL, NULL, 0);
- if (!hSCManager)
- {
- ERR("WL: Failed to OpenSCManager\n");
- goto cleanup;
- }
-
- hService = OpenServiceW(hSCManager, ServiceName, SERVICE_START);
- if (!hService)
- {
- ERR("WL: Failed to open the service\n");
- goto cleanup;
- }
- if (!StartServiceW(hService, 0, NULL))
- {
- ERR("WL: Failed to start the service\n");
- goto cleanup;
- }
-
- ret = TRUE;
-
-cleanup:
- if (hService)
- CloseServiceHandle(hService);
- if (hSCManager)
- CloseServiceHandle(hSCManager);
- return ret;
-}
static BOOL
StartLsass(VOID)
{
- HANDLE LsassInitEvent;
+ STARTUPINFOW StartupInfo;
+ PROCESS_INFORMATION ProcessInformation;
+ LPCWSTR ServiceString = L"lsass.exe";
+ BOOL res;
- LsassInitEvent = CreateEventW(
+ /* Start the service control manager (services.exe) */
+ ZeroMemory(&StartupInfo, sizeof(STARTUPINFOW));
+ StartupInfo.cb = sizeof(StartupInfo);
+ StartupInfo.lpReserved = NULL;
+ StartupInfo.lpDesktop = NULL;
+ StartupInfo.lpTitle = NULL;
+ StartupInfo.dwFlags = 0;
+ StartupInfo.cbReserved2 = 0;
+ StartupInfo.lpReserved2 = 0;
+
+ TRACE("WL: Creating new process - %S\n", ServiceString);
+
+ res = CreateProcessW(
+ ServiceString,
+ NULL,
+ NULL,
NULL,
- TRUE,
FALSE,
- L"Global\\SECURITY_SERVICES_STARTED");
- if (!LsassInitEvent)
- {
- ERR("WL: Failed to create lsass notification event (error %lu)\n", GetLastError());
- return FALSE;
- }
+ DETACHED_PROCESS,
+ NULL,
+ NULL,
+ &StartupInfo,
+ &ProcessInformation);
- /* Start the local security authority subsystem (Netlogon service) */
- if (!StartCustomService(L"Netlogon"))
- {
- ERR("WL: Failed to start NetLogon service (error %lu)\n", GetLastError());
- return FALSE;
- }
+ TRACE("WL: Created new process - %S\n", ServiceString);
- WaitForSingleObject(LsassInitEvent, INFINITE);
- CloseHandle(LsassInitEvent);
+ CloseHandle(ProcessInformation.hThread);
+ CloseHandle(ProcessInformation.hProcess);
- return TRUE;
+ return res;
}
BOOL
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","10079",0x00000000,"c_10079.nls"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","10081",0x00000000,"c_10081.nls"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","20866",0x00000000,"c_20866.nls"
+HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","21866",0x00000000,"c_21866.nls"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","28591",0x00000000,"c_28591.nls"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","28592",0x00000000,"c_28592.nls"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","28593",0x00000000,"c_28593.nls"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","28597",0x00000000,"c_28597.nls"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","28598",0x00000000,"c_28598.nls"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","28599",0x00000000,"c_28599.nls"
+HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","28600",0x00000000,"c_28600.nls"
+HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","28603",0x00000000,"c_28603.nls"
+HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","28604",0x00000000,"c_28604.nls"
+HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","28605",0x00000000,"c_28605.nls"
+HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","28606",0x00000000,"c_28606.nls"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","ACP",0x00000000,"1252"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","OEMCP",0x00000000,"437"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","MACCP",0x00000000,"10000"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","10079",0x00000000,"c_10079.nls"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","10081",0x00000000,"c_10081.nls"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","20866",0x00000000,"c_20866.nls"
+HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","21866",0x00000000,"c_21866.nls"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","28591",0x00000000,"c_28591.nls"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","28592",0x00000000,"c_28592.nls"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","28593",0x00000000,"c_28593.nls"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","28597",0x00000000,"c_28597.nls"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","28598",0x00000000,"c_28598.nls"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","28599",0x00000000,"c_28599.nls"
+HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","28600",0x00000000,"c_28600.nls"
+HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","28603",0x00000000,"c_28603.nls"
+HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","28604",0x00000000,"c_28604.nls"
+HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","28605",0x00000000,"c_28605.nls"
+HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","28606",0x00000000,"c_28606.nls"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","ACP",0x00000000,"1252"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","OEMCP",0x00000000,"437"
HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","MACCP",0x00000000,"10000"
HKLM,"SYSTEM\CurrentControlSet\Services\Fs_Rec","Start",0x00010001,0x00000001
HKLM,"SYSTEM\CurrentControlSet\Services\Fs_Rec","Type",0x00010001,0x00000008
+; Green driver
+;HKLM,"SYSTEM\CurrentControlSet\Services\green","ErrorControl",0x00010001,0x00000000
+;HKLM,"SYSTEM\CurrentControlSet\Services\green","Group",0x00000000,"Extended base"
+;HKLM,"SYSTEM\CurrentControlSet\Services\green","ImagePath",0x00020000,"system32\drivers\green.sys"
+;HKLM,"SYSTEM\CurrentControlSet\Services\green","Start",0x00010001,0x00000001
+;HKLM,"SYSTEM\CurrentControlSet\Services\green","Type",0x00010001,0x00000001
+;HKLM,"SYSTEM\CurrentControlSet\Services\green\Parameters","AttachedDevice",0x00000000,"\Device\Serial0"
+
; i8042 port driver
HKLM,"SYSTEM\CurrentControlSet\Services\i8042prt","ErrorControl",0x00010001,0x00000000
HKLM,"SYSTEM\CurrentControlSet\Services\i8042prt","Group",0x00000000,"Keyboard Port"
HKLM,"SYSTEM\CurrentControlSet\Services\Ndis","Type",0x00010001,0x00000001
; NetLogon
-HKLM,"SYSTEM\CurrentControlSet\Services\NetLogon","DisplayName",0x00000000,"Net Logon"
-HKLM,"SYSTEM\CurrentControlSet\Services\NetLogon","Description",0x00000000,"Sets up a secure channel to a domain controller for domain authentication"
-HKLM,"SYSTEM\CurrentControlSet\Services\NetLogon","ErrorControl",0x00010001,0x00000001
-HKLM,"SYSTEM\CurrentControlSet\Services\Netlogon","ImagePath",0x00020000,"%SystemRoot%\system32\lsass.exe"
-HKLM,"SYSTEM\CurrentControlSet\Services\NetLogon","Start",0x00010001,0x00000003
-HKLM,"SYSTEM\CurrentControlSet\Services\Netlogon","Type",0x00010001,0x00000020
+;HKLM,"SYSTEM\CurrentControlSet\Services\NetLogon","DisplayName",0x00000000,"Net Logon"
+;HKLM,"SYSTEM\CurrentControlSet\Services\NetLogon","Description",0x00000000,"Sets up a secure channel to a domain controller for domain authentication"
+;HKLM,"SYSTEM\CurrentControlSet\Services\NetLogon","ErrorControl",0x00010001,0x00000001
+;HKLM,"SYSTEM\CurrentControlSet\Services\Netlogon","ImagePath",0x00020000,"%SystemRoot%\system32\lsass.exe"
+;HKLM,"SYSTEM\CurrentControlSet\Services\NetLogon","Start",0x00010001,0x00000003
+;HKLM,"SYSTEM\CurrentControlSet\Services\Netlogon","Type",0x00010001,0x00000020
; Named Pipe filesystem driver
HKLM,"SYSTEM\CurrentControlSet\Services\Npfs","ErrorControl",0x00010001,0x00000000
4 = -O2
5 = -O3
-->
-<property name="OPTIMIZE" value="3" />
+<property name="OPTIMIZE" value="1" />
<!--
InitPropSheetPage(&psh, PropPages[i].idDlg, PropPages[i].DlgProc, PropPages[i].Callback);
}
- /* NOTE: Don;t call SHAddFromPropSheetExtArray here because this applet only allows
+ /* NOTE: Don't call SHAddFromPropSheetExtArray here because this applet only allows
replacing the background page but not extending the applet by more pages */
ret = (LONG)(PropertySheet(&psh) != -1);
DWORD ResolutionsCount = 1;
DWORD i;
- newEntry = HeapAlloc(GetProcessHeap(), 0, sizeof(DISPLAY_DEVICE_ENTRY));
- memset(newEntry, 0, sizeof(DISPLAY_DEVICE_ENTRY));
+ newEntry = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(DISPLAY_DEVICE_ENTRY));
if (!newEntry) goto ByeBye;
newEntry->Settings = GetPossibleSettings(DisplayDevice->DeviceName, &newEntry->SettingsCount, &newEntry->CurrentSettings);
EnableWindow(GetDlgItem(hwndDlg, IDC_SETTINGS_RESOLUTION), FALSE);
EnableWindow(GetDlgItem(hwndDlg, IDC_SETTINGS_RESOLUTION_TEXT), FALSE);
EnableWindow(GetDlgItem(hwndDlg, IDC_SETTINGS_ADVANCED), FALSE);
+ ShowWindow(GetDlgItem(hwndDlg, IDC_SETTINGS_SPECTRUM), SW_HIDE);
}
else if (Result == 1)
{
<file>volume.c</file>
<file>volumetexture.c</file>
<file>version.rc</file>
+
+ <dependency>wineheaders</dependency>
</module>
#include "wingdi.h"
#include "wine/debug.h"
#include "d3d8.h"
-#include "wine/wined3d_interface.h"
+#include "wine/wined3d.h"
/* Device caps */
#define INITIAL_SHADER_HANDLE_TABLE_SIZE 64
return hrc;
}
-static HRESULT WINAPI IDirect3DDevice8Impl_CreateSurface(LPDIRECT3DDEVICE8 iface, UINT Width, UINT Height, D3DFORMAT Format, BOOL Lockable, BOOL Discard, UINT Level, IDirect3DSurface8 **ppSurface,D3DRESOURCETYPE Type, UINT Usage,D3DPOOL Pool, D3DMULTISAMPLE_TYPE MultiSample, DWORD MultisampleQuality) {
+static HRESULT IDirect3DDevice8Impl_CreateSurface(LPDIRECT3DDEVICE8 iface, UINT Width, UINT Height, D3DFORMAT Format, BOOL Lockable, BOOL Discard, UINT Level, IDirect3DSurface8 **ppSurface,D3DRESOURCETYPE Type, UINT Usage,D3DPOOL Pool, D3DMULTISAMPLE_TYPE MultiSample, DWORD MultisampleQuality) {
HRESULT hrc;
IDirect3DSurface8Impl *object;
IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
return hr;
}
-static HRESULT WINAPI IDirect3DDevice8Impl_CreateVertexDeclaration(IDirect3DDevice8 *iface, CONST DWORD *declaration, IDirect3DVertexDeclaration8 **decl_ptr) {
+static HRESULT IDirect3DDevice8Impl_CreateVertexDeclaration(IDirect3DDevice8 *iface, CONST DWORD *declaration, IDirect3DVertexDeclaration8 **decl_ptr) {
IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
IDirect3DVertexDeclaration8Impl *object;
WINED3DVERTEXELEMENT *wined3d_elements;
return hrc;
}
-IWineD3DVertexDeclaration *IDirect3DDevice8Impl_FindDecl(IDirect3DDevice8Impl *This, DWORD fvf)
+static IWineD3DVertexDeclaration *IDirect3DDevice8Impl_FindDecl(IDirect3DDevice8Impl *This, DWORD fvf)
{
HRESULT hr;
IWineD3DVertexDeclaration* pDecl = NULL;
<file>volume.c</file>
<file>volumetexture.c</file>
<file>version.rc</file>
+
+ <dependency>wineheaders</dependency>
</module>
#include "wine/unicode.h"
#include "d3d9.h"
-#include "wine/wined3d_interface.h"
+#include "wine/wined3d.h"
/* ===========================================================================
Internal use
/* IDirect3DDevice9: */
-extern HRESULT WINAPI IDirect3DDevice9Impl_GetDirect3D(LPDIRECT3DDEVICE9EX iface, IDirect3D9** ppD3D9);
extern HRESULT WINAPI IDirect3DDevice9Impl_CreateAdditionalSwapChain(LPDIRECT3DDEVICE9EX iface, D3DPRESENT_PARAMETERS* pPresentationParameters, IDirect3DSwapChain9** pSwapChain);
extern HRESULT WINAPI IDirect3DDevice9Impl_GetSwapChain(LPDIRECT3DDEVICE9EX iface, UINT iSwapChain, IDirect3DSwapChain9** pSwapChain);
extern UINT WINAPI IDirect3DDevice9Impl_GetNumberOfSwapChains(LPDIRECT3DDEVICE9EX iface);
extern HRESULT WINAPI IDirect3DDevice9Impl_CreateVertexDeclaration(LPDIRECT3DDEVICE9EX iface, CONST D3DVERTEXELEMENT9* pVertexElements, IDirect3DVertexDeclaration9** ppDecl);
extern HRESULT WINAPI IDirect3DDevice9Impl_SetVertexDeclaration(LPDIRECT3DDEVICE9EX iface, IDirect3DVertexDeclaration9* pDecl);
extern HRESULT WINAPI IDirect3DDevice9Impl_GetVertexDeclaration(LPDIRECT3DDEVICE9EX iface, IDirect3DVertexDeclaration9** ppDecl);
-extern HRESULT WINAPI IDirect3DDevice9Impl_SetFVF(LPDIRECT3DDEVICE9EX iface, DWORD FVF);
-extern HRESULT WINAPI IDirect3DDevice9Impl_GetFVF(LPDIRECT3DDEVICE9EX iface, DWORD* pFVF);
extern HRESULT WINAPI IDirect3DDevice9Impl_CreateVertexShader(LPDIRECT3DDEVICE9EX iface, CONST DWORD* pFunction, IDirect3DVertexShader9** ppShader);
extern HRESULT WINAPI IDirect3DDevice9Impl_SetVertexShader(LPDIRECT3DDEVICE9EX iface, IDirect3DVertexShader9* pShader);
extern HRESULT WINAPI IDirect3DDevice9Impl_GetVertexShader(LPDIRECT3DDEVICE9EX iface, IDirect3DVertexShader9** ppShader);
extern HRESULT WINAPI IDirect3DDevice9Impl_GetVertexShaderConstantI(LPDIRECT3DDEVICE9EX iface, UINT StartRegister, int* pConstantData, UINT Vector4iCount);
extern HRESULT WINAPI IDirect3DDevice9Impl_SetVertexShaderConstantB(LPDIRECT3DDEVICE9EX iface, UINT StartRegister, CONST BOOL* pConstantData, UINT BoolCount);
extern HRESULT WINAPI IDirect3DDevice9Impl_GetVertexShaderConstantB(LPDIRECT3DDEVICE9EX iface, UINT StartRegister, BOOL* pConstantData, UINT BoolCount);
-extern HRESULT WINAPI IDirect3DDevice9Impl_SetStreamSource(LPDIRECT3DDEVICE9EX iface, UINT StreamNumber, IDirect3DVertexBuffer9* pStreamData, UINT OffsetInBytes, UINT Stride);
-extern HRESULT WINAPI IDirect3DDevice9Impl_GetStreamSource(LPDIRECT3DDEVICE9EX iface, UINT StreamNumber, IDirect3DVertexBuffer9** ppStreamData, UINT* OffsetInBytes, UINT* pStride);
extern HRESULT WINAPI IDirect3DDevice9Impl_CreatePixelShader(LPDIRECT3DDEVICE9EX iface, CONST DWORD* pFunction, IDirect3DPixelShader9** ppShader);
extern HRESULT WINAPI IDirect3DDevice9Impl_SetPixelShader(LPDIRECT3DDEVICE9EX iface, IDirect3DPixelShader9* pShader);
extern HRESULT WINAPI IDirect3DDevice9Impl_GetPixelShader(LPDIRECT3DDEVICE9EX iface, IDirect3DPixelShader9** ppShader);
return hr;
}
-HRESULT WINAPI IDirect3DDevice9Impl_GetDirect3D(LPDIRECT3DDEVICE9EX iface, IDirect3D9** ppD3D9) {
+static HRESULT WINAPI IDirect3DDevice9Impl_GetDirect3D(LPDIRECT3DDEVICE9EX iface, IDirect3D9** ppD3D9) {
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
HRESULT hr = D3D_OK;
IWineD3D* pWineD3D;
}
-static HRESULT WINAPI IDirect3DDevice9Impl_CreateSurface(LPDIRECT3DDEVICE9EX iface, UINT Width, UINT Height, D3DFORMAT Format, BOOL Lockable, BOOL Discard, UINT Level, IDirect3DSurface9 **ppSurface,D3DRESOURCETYPE Type, UINT Usage, D3DPOOL Pool, D3DMULTISAMPLE_TYPE MultiSample, DWORD MultisampleQuality,HANDLE* pSharedHandle ) {
+static HRESULT IDirect3DDevice9Impl_CreateSurface(LPDIRECT3DDEVICE9EX iface, UINT Width, UINT Height, D3DFORMAT Format, BOOL Lockable, BOOL Discard, UINT Level, IDirect3DSurface9 **ppSurface,D3DRESOURCETYPE Type, UINT Usage, D3DPOOL Pool, D3DMULTISAMPLE_TYPE MultiSample, DWORD MultisampleQuality,HANDLE* pSharedHandle ) {
HRESULT hrc;
IDirect3DSurface9Impl *object;
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
return hr;
}
-/* This isn't in MSDN!
-static HRESULT WINAPI IDirect3DDevice9Impl_GetFrontBuffer(LPDIRECT3DDEVICE9EX iface, IDirect3DSurface9* pDestSurface) {
- IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
- FIXME("(%p) : stub\n", This);
- return D3D_OK;
-}
-*/
-
static HRESULT WINAPI IDirect3DDevice9Impl_GetRenderTargetData(LPDIRECT3DDEVICE9EX iface, IDirect3DSurface9* pRenderTarget, IDirect3DSurface9* pDestSurface) {
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
IDirect3DSurface9Impl *renderTarget = (IDirect3DSurface9Impl *)pRenderTarget;
return hr;
}
-IDirect3DVertexDeclaration9 *getConvertedDecl(IDirect3DDevice9Impl *This, DWORD fvf) {
+static IDirect3DVertexDeclaration9 *getConvertedDecl(IDirect3DDevice9Impl *This, DWORD fvf) {
HRESULT hr;
D3DVERTEXELEMENT9* elements = NULL;
IDirect3DVertexDeclaration9* pDecl = NULL;
return pDecl;
}
-HRESULT WINAPI IDirect3DDevice9Impl_SetFVF(LPDIRECT3DDEVICE9EX iface, DWORD FVF) {
+static HRESULT WINAPI IDirect3DDevice9Impl_SetFVF(LPDIRECT3DDEVICE9EX iface, DWORD FVF) {
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
HRESULT hr;
TRACE("(%p) Relay\n" , This);
return hr;
}
-HRESULT WINAPI IDirect3DDevice9Impl_GetFVF(LPDIRECT3DDEVICE9EX iface, DWORD* pFVF) {
+static HRESULT WINAPI IDirect3DDevice9Impl_GetFVF(LPDIRECT3DDEVICE9EX iface, DWORD* pFVF) {
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
HRESULT hr;
TRACE("(%p) Relay\n" , This);
return hr;
}
-HRESULT WINAPI IDirect3DDevice9Impl_SetStreamSource(LPDIRECT3DDEVICE9EX iface, UINT StreamNumber, IDirect3DVertexBuffer9* pStreamData, UINT OffsetInBytes, UINT Stride) {
+static HRESULT WINAPI IDirect3DDevice9Impl_SetStreamSource(LPDIRECT3DDEVICE9EX iface, UINT StreamNumber, IDirect3DVertexBuffer9* pStreamData, UINT OffsetInBytes, UINT Stride) {
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
HRESULT hr;
TRACE("(%p) Relay\n" , This);
return hr;
}
-HRESULT WINAPI IDirect3DDevice9Impl_GetStreamSource(LPDIRECT3DDEVICE9EX iface, UINT StreamNumber, IDirect3DVertexBuffer9 **pStream, UINT* OffsetInBytes, UINT* pStride) {
+static HRESULT WINAPI IDirect3DDevice9Impl_GetStreamSource(LPDIRECT3DDEVICE9EX iface, UINT StreamNumber, IDirect3DVertexBuffer9 **pStream, UINT* OffsetInBytes, UINT* pStride) {
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
IWineD3DVertexBuffer *retStream = NULL;
HRESULT rc = D3D_OK;
WINE_DEFAULT_DEBUG_CHANNEL(d3d_shader);
WINE_DECLARE_DEBUG_CHANNEL(d3d_constants);
WINE_DECLARE_DEBUG_CHANNEL(d3d_caps);
+WINE_DECLARE_DEBUG_CHANNEL(d3d);
#define GLINFO_LOCATION (*gl_info)
* @target_type should be either GL_VERTEX_PROGRAM_ARB (for vertex shaders)
* or GL_FRAGMENT_PROGRAM_ARB (for pixel shaders)
*/
-static unsigned int shader_arb_load_constantsF(IWineD3DBaseShaderImpl* This, WineD3D_GL_Info *gl_info, GLuint target_type,
- unsigned int max_constants, float* constants, char *dirty_consts) {
+static unsigned int shader_arb_load_constantsF(IWineD3DBaseShaderImpl* This, const WineD3D_GL_Info *gl_info,
+ GLuint target_type, unsigned int max_constants, const float *constants, char *dirty_consts)
+{
local_constant* lconst;
DWORD i, j;
unsigned int ret;
IWineD3DDeviceImpl* deviceImpl = (IWineD3DDeviceImpl*) device;
IWineD3DStateBlockImpl* stateBlock = deviceImpl->stateBlock;
- WineD3D_GL_Info *gl_info = &deviceImpl->adapter->gl_info;
+ const WineD3D_GL_Info *gl_info = &deviceImpl->adapter->gl_info;
unsigned char i;
if (useVertexShader) {
for(i = 0; i < psi->numbumpenvmatconsts; i++) {
/* The state manager takes care that this function is always called if the bump env matrix changes
*/
- float *data = (float *) &stateBlock->textureState[(int) psi->bumpenvmatconst[i].texunit][WINED3DTSS_BUMPENVMAT00];
+ const float *data = (const float *)&stateBlock->textureState[(int) psi->bumpenvmatconst[i].texunit][WINED3DTSS_BUMPENVMAT00];
GL_EXTCALL(glProgramEnvParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, psi->bumpenvmatconst[i].const_num, data));
deviceImpl->activeContext->pshader_const_dirty[psi->bumpenvmatconst[i].const_num] = 1;
* don't care about them. The pointers are valid for sure because the stateblock is bigger.
* (they're WINED3DTSS_TEXTURETRANSFORMFLAGS and WINED3DTSS_ADDRESSW, so most likely 0 or NaN
*/
- float *scale = (float *) &stateBlock->textureState[(int) psi->luminanceconst[i].texunit][WINED3DTSS_BUMPENVLSCALE];
+ const float *scale = (const float *)&stateBlock->textureState[(int) psi->luminanceconst[i].texunit][WINED3DTSS_BUMPENVLSCALE];
GL_EXTCALL(glProgramEnvParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, psi->luminanceconst[i].const_num, scale));
deviceImpl->activeContext->pshader_const_dirty[psi->luminanceconst[i].const_num] = 1;
}
}
-
- if(((IWineD3DPixelShaderImpl *) pshader)->srgb_enabled &&
- !((IWineD3DPixelShaderImpl *) pshader)->srgb_mode_hardcoded) {
- float comparison[4];
- float mul_low[4];
-
- if(stateBlock->renderState[WINED3DRS_SRGBWRITEENABLE]) {
- comparison[0] = srgb_cmp; comparison[1] = srgb_cmp;
- comparison[2] = srgb_cmp; comparison[3] = srgb_cmp;
-
- mul_low[0] = srgb_mul_low; mul_low[1] = srgb_mul_low;
- mul_low[2] = srgb_mul_low; mul_low[3] = srgb_mul_low;
- } else {
- comparison[0] = 1.0 / 0.0; comparison[1] = 1.0 / 0.0;
- comparison[2] = 1.0 / 0.0; comparison[3] = 1.0 / 0.0;
-
- mul_low[0] = 1.0; mul_low[1] = 1.0;
- mul_low[2] = 1.0; mul_low[3] = 1.0;
- }
- GL_EXTCALL(glProgramEnvParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, psi->srgb_cmp_const, comparison));
- GL_EXTCALL(glProgramEnvParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, psi->srgb_low_const, mul_low));
- checkGLcall("Load sRGB correction constants\n");
- deviceImpl->activeContext->pshader_const_dirty[psi->srgb_low_const] = 1;
- deviceImpl->activeContext->pshader_const_dirty[psi->srgb_cmp_const] = 1;
-
- }
}
}
/* Generate the variable & register declarations for the ARB_vertex_program output target */
-static void shader_generate_arb_declarations(
- IWineD3DBaseShader *iface,
- shader_reg_maps* reg_maps,
- SHADER_BUFFER* buffer,
- WineD3D_GL_Info* gl_info) {
-
+static void shader_generate_arb_declarations(IWineD3DBaseShader *iface, const shader_reg_maps *reg_maps,
+ SHADER_BUFFER *buffer, const WineD3D_GL_Info *gl_info)
+{
IWineD3DBaseShaderImpl* This = (IWineD3DBaseShaderImpl*) iface;
IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *) This->baseShader.device;
DWORD i, cur;
unsigned max_constantsF = min(This->baseShader.limits.constant_float,
(pshader ? GL_LIMITS(pshader_constantsF) : GL_LIMITS(vshader_constantsF)));
UINT extra_constants_needed = 0;
- local_constant* lconst;
+ const local_constant *lconst;
/* Temporary Output register */
shader_addline(buffer, "TEMP TMP_OUT;\n");
}
if(device->stateBlock->renderState[WINED3DRS_SRGBWRITEENABLE] && pshader) {
- IWineD3DPixelShaderImpl *ps_impl = (IWineD3DPixelShaderImpl *) This;
- /* If there are 2 constants left to use, use them to pass the sRGB correction values in. This way
- * srgb write correction can be turned on and off dynamically without recompilation. Otherwise
- * hardcode them. The drawback of hardcoding is that the shader needs recompilation to turn sRGB
- * off again
- */
- if(max_constantsF + extra_constants_needed + 1 < GL_LIMITS(pshader_constantsF) && FALSE) {
- /* The idea is that if srgb is enabled, then disabled, the constant loading code
- * can effectively disable sRGB correction by passing 1.0 and INF as the multiplication
- * and comparison constants. If it disables it that way, the shader won't be recompiled
- * and the code will stay in, so sRGB writing can be turned on again by setting the
- * constants from the spec
- */
- ps_impl->srgb_mode_hardcoded = 0;
- ps_impl->srgb_low_const = GL_LIMITS(pshader_constantsF) - extra_constants_needed;
- ps_impl->srgb_cmp_const = GL_LIMITS(pshader_constantsF) - extra_constants_needed - 1;
- shader_addline(buffer, "PARAM srgb_mul_low = program.env[%d];\n", ps_impl->srgb_low_const);
- shader_addline(buffer, "PARAM srgb_comparison = program.env[%d];\n", ps_impl->srgb_cmp_const);
- } else {
- shader_addline(buffer, "PARAM srgb_mul_low = {%f, %f, %f, 1.0};\n",
- srgb_mul_low, srgb_mul_low, srgb_mul_low);
- shader_addline(buffer, "PARAM srgb_comparison = {%f, %f, %f, %f};\n",
- srgb_cmp, srgb_cmp, srgb_cmp, srgb_cmp);
- ps_impl->srgb_mode_hardcoded = 1;
- }
- /* These can be hardcoded, they do not cause any harm because no fragment will enter the high
- * path if the comparison value is set to INF
- */
+ shader_addline(buffer, "PARAM srgb_mul_low = {%f, %f, %f, 1.0};\n",
+ srgb_mul_low, srgb_mul_low, srgb_mul_low);
+ shader_addline(buffer, "PARAM srgb_comparison = {%f, %f, %f, %f};\n",
+ srgb_cmp, srgb_cmp, srgb_cmp, srgb_cmp);
shader_addline(buffer, "PARAM srgb_pow = {%f, %f, %f, 1.0};\n",
srgb_pow, srgb_pow, srgb_pow);
shader_addline(buffer, "PARAM srgb_mul_hi = {%f, %f, %f, 1.0};\n",
srgb_mul_high, srgb_mul_high, srgb_mul_high);
shader_addline(buffer, "PARAM srgb_sub_hi = {%f, %f, %f, 0.0};\n",
srgb_sub_high, srgb_sub_high, srgb_sub_high);
- ps_impl->srgb_enabled = 1;
- } else if(pshader) {
- IWineD3DPixelShaderImpl *ps_impl = (IWineD3DPixelShaderImpl *) This;
-
- /* Do not write any srgb fixup into the shader to save shader size and processing time.
- * As a consequence, we can't toggle srgb write on without recompilation
- */
- ps_impl->srgb_enabled = 0;
- ps_impl->srgb_mode_hardcoded = 1;
}
/* Load local constants using the program-local space,
"coefdiv.x" /* 15 (d2) */
};
-static void shader_arb_get_write_mask(SHADER_OPCODE_ARG* arg, const DWORD param, char *write_mask) {
+static void shader_arb_get_write_mask(const SHADER_OPCODE_ARG *arg, const DWORD param, char *write_mask)
+{
IWineD3DBaseShaderImpl *This = (IWineD3DBaseShaderImpl *) arg->shader;
char *ptr = write_mask;
char vshader = shader_is_vshader_version(This->baseShader.hex_version);
}
/* TODO: merge with pixel shader */
-static void vshader_program_add_param(SHADER_OPCODE_ARG *arg, const DWORD param, BOOL is_input, char *hwLine) {
-
+static void vshader_program_add_param(const SHADER_OPCODE_ARG *arg, const DWORD param, BOOL is_input, char *hwLine)
+{
IWineD3DVertexShaderImpl* This = (IWineD3DVertexShaderImpl*) arg->shader;
/* oPos, oFog and oPts in D3D */
}
}
-static void shader_hw_sample(SHADER_OPCODE_ARG* arg, DWORD sampler_idx, const char *dst_str, const char *coord_reg, BOOL projected, BOOL bias) {
+static void shader_hw_sample(const SHADER_OPCODE_ARG *arg, DWORD sampler_idx, const char *dst_str,
+ const char *coord_reg, BOOL projected, BOOL bias)
+{
SHADER_BUFFER* buffer = arg->buffer;
DWORD sampler_type = arg->reg_maps->samplers[sampler_idx] & WINED3DSP_TEXTURETYPE_MASK;
const char *tex_type;
}
}
-static void gen_color_correction(SHADER_BUFFER *buffer, const char *reg, const char *writemask,
- const char *one, const char *two, WINED3DFORMAT fmt,
- WineD3D_GL_Info *gl_info) {
- switch(fmt) {
- case WINED3DFMT_V8U8:
- case WINED3DFMT_V16U16:
- if(GL_SUPPORT(NV_TEXTURE_SHADER) && fmt == WINED3DFMT_V8U8) {
- if(0) {
- /* The 3rd channel returns 1.0 in d3d, but 0.0 in gl. Fix this while we're at it :-)
- * disabled until an application that needs it is found because it causes unneeded
- * shader recompilation in some game
- */
- if(strlen(writemask) >= 4) {
- shader_addline(buffer, "MOV %s.%c, %s;\n", reg, writemask[3], one);
- }
- }
- } else {
- /* Correct the sign, but leave the blue as it is - it was loaded correctly already
- * ARB shaders are a bit picky wrt writemasks and swizzles. If we're free to scale
- * all registers, do so, this saves an instruction.
- */
- if(strlen(writemask) >= 5) {
- shader_addline(buffer, "MAD %s, %s, %s, -%s;\n", reg, reg, two, one);
- } else if(strlen(writemask) >= 3) {
- shader_addline(buffer, "MAD %s.%c, %s.%c, %s, -%s;\n",
- reg, writemask[1],
- reg, writemask[1],
- two, one);
- shader_addline(buffer, "MAD %s.%c, %s.%c, %s, -%s;\n",
- reg, writemask[2],
- reg, writemask[2],
- two, one);
- } else if(strlen(writemask) == 2) {
- shader_addline(buffer, "MAD %s.%c, %s.%c, %s, -%s;\n", reg, writemask[1],
- reg, writemask[1], two, one);
- }
- }
- break;
-
- case WINED3DFMT_X8L8V8U8:
- if(!GL_SUPPORT(NV_TEXTURE_SHADER)) {
- /* Red and blue are the signed channels, fix them up; Blue(=L) is correct already,
- * and a(X) is always 1.0. Cannot do a full conversion due to L(blue)
- */
- if(strlen(writemask) >= 3) {
- shader_addline(buffer, "MAD %s.%c, %s.%c, %s, -%s;\n",
- reg, writemask[1],
- reg, writemask[1],
- two, one);
- shader_addline(buffer, "MAD %s.%c, %s.%c, %s, -%s;\n",
- reg, writemask[2],
- reg, writemask[2],
- two, one);
- } else if(strlen(writemask) == 2) {
- shader_addline(buffer, "MAD %s.%c, %s.%c, %s, -%s;\n",
- reg, writemask[1],
- reg, writemask[1],
- two, one);
- }
- }
- break;
-
- case WINED3DFMT_L6V5U5:
- if(!GL_SUPPORT(NV_TEXTURE_SHADER)) {
- if(strlen(writemask) >= 4) {
- /* Swap y and z (U and L), and do a sign conversion on x and the new y(V and U) */
- shader_addline(buffer, "MOV TMP.g, %s.%c;\n",
- reg, writemask[2]);
- shader_addline(buffer, "MAD %s.%c%c, %s.%c%c%c%c, %s, -%s;\n",
- reg, writemask[1], writemask[2],
- reg, writemask[3], writemask[1], writemask[3], writemask[1],
- two, one);
- shader_addline(buffer, "MOV %s.%c, TMP.g;\n", reg,
- writemask[3]);
- } else if(strlen(writemask) == 3) {
- /* This is bad: We have VL, but we need VU */
- FIXME("2 components sampled from a converted L6V5U5 texture\n");
- } else {
- shader_addline(buffer, "MAD %s.%c, %s.%c, %s, -%s;\n",
- reg, writemask[1],
- reg, writemask[1],
- two, one);
- }
- }
- break;
-
- case WINED3DFMT_Q8W8V8U8:
- if(!GL_SUPPORT(NV_TEXTURE_SHADER)) {
- /* Correct the sign in all channels */
- switch(strlen(writemask)) {
- case 4:
- shader_addline(buffer, "MAD %s.%c, %s.%c, coefmul.x, -one;\n",
- reg, writemask[3],
- reg, writemask[3]);
- /* drop through */
- case 3:
- shader_addline(buffer, "MAD %s.%c, %s.%c, coefmul.x, -one;\n",
- reg, writemask[2],
- reg, writemask[2]);
- /* drop through */
- case 2:
- shader_addline(buffer, "MAD %s.%c, %s.%c, coefmul.x, -one;\n",
- reg, writemask[1],
- reg, writemask[1]);
- break;
-
- /* Should not occur, since it's at minimum '.' and a letter */
- case 1:
- ERR("Unexpected writemask: \"%s\"\n", writemask);
- break;
-
- case 5:
- default:
- shader_addline(buffer, "MAD %s, %s, coefmul.x, -one;\n", reg, reg);
- }
- }
- break;
-
- case WINED3DFMT_ATI2N:
- /* GL_ATI_texture_compression_3dc returns the two channels as luminance-alpha,
- * which means the first one is replicated across .rgb, and the 2nd one is in
- * .a. We need the 2nd in .g
- *
- * GL_EXT_texture_compression_rgtc returns the values in .rg, however, they
- * are swapped compared to d3d. So swap red and green.
- */
- if(GL_SUPPORT(EXT_TEXTURE_COMPRESSION_RGTC)) {
- shader_addline(buffer, "SWZ %s, %s, %c, %c, 1, 0;\n",
- reg, reg, writemask[2], writemask[1]);
- } else {
- if(strlen(writemask) == 5) {
- shader_addline(buffer, "MOV %s.%c, %s.%c;\n",
- reg, writemask[2], reg, writemask[4]);
- } else if(strlen(writemask) == 2) {
- /* Nothing to do */
- } else {
- /* This is bad: We have VL, but we need VU */
- FIXME("2 or 3 components sampled from a converted ATI2N texture\n");
- }
- }
- break;
-
- /* stupid compiler */
+static const char *shader_arb_get_fixup_swizzle(enum fixup_channel_source channel_source)
+{
+ switch(channel_source)
+ {
+ case CHANNEL_SOURCE_ZERO: return "0";
+ case CHANNEL_SOURCE_ONE: return "1";
+ case CHANNEL_SOURCE_X: return "x";
+ case CHANNEL_SOURCE_Y: return "y";
+ case CHANNEL_SOURCE_Z: return "z";
+ case CHANNEL_SOURCE_W: return "w";
default:
- break;
+ FIXME("Unhandled channel source %#x\n", channel_source);
+ return "undefined";
}
}
-static void shader_arb_color_correction(SHADER_OPCODE_ARG* arg) {
- IWineD3DBaseShaderImpl* shader = (IWineD3DBaseShaderImpl*) arg->shader;
- IWineD3DDeviceImpl* deviceImpl = (IWineD3DDeviceImpl*) shader->baseShader.device;
- WineD3D_GL_Info *gl_info = &deviceImpl->adapter->gl_info;
- WINED3DFORMAT fmt;
- WINED3DFORMAT conversion_group;
- IWineD3DBaseTextureImpl *texture;
- UINT i;
- BOOL recorded = FALSE;
- DWORD sampler_idx;
- DWORD hex_version = shader->baseShader.hex_version;
- char reg[256];
- char writemask[6];
+static void gen_color_correction(SHADER_BUFFER *buffer, const char *reg, DWORD dst_mask,
+ const char *one, const char *two, struct color_fixup_desc fixup)
+{
+ DWORD mask;
- switch(arg->opcode->opcode) {
- case WINED3DSIO_TEX:
- if (hex_version < WINED3DPS_VERSION(2,0)) {
- sampler_idx = arg->dst & WINED3DSP_REGNUM_MASK;
- } else {
- sampler_idx = arg->src[1] & WINED3DSP_REGNUM_MASK;
- }
- break;
+ if (is_yuv_fixup(fixup))
+ {
+ enum yuv_fixup yuv_fixup = get_yuv_fixup(fixup);
+ FIXME("YUV fixup (%#x) not supported\n", yuv_fixup);
+ return;
+ }
- case WINED3DSIO_TEXLDL:
- FIXME("Add color fixup for vertex texture WINED3DSIO_TEXLDL\n");
- return;
+ mask = 0;
+ if (fixup.x_source != CHANNEL_SOURCE_X) mask |= WINED3DSP_WRITEMASK_0;
+ if (fixup.y_source != CHANNEL_SOURCE_Y) mask |= WINED3DSP_WRITEMASK_1;
+ if (fixup.z_source != CHANNEL_SOURCE_Z) mask |= WINED3DSP_WRITEMASK_2;
+ if (fixup.w_source != CHANNEL_SOURCE_W) mask |= WINED3DSP_WRITEMASK_3;
+ mask &= dst_mask;
- case WINED3DSIO_TEXDP3TEX:
- case WINED3DSIO_TEXM3x3TEX:
- case WINED3DSIO_TEXM3x3SPEC:
- case WINED3DSIO_TEXM3x3VSPEC:
- case WINED3DSIO_TEXBEM:
- case WINED3DSIO_TEXREG2AR:
- case WINED3DSIO_TEXREG2GB:
- case WINED3DSIO_TEXREG2RGB:
- sampler_idx = arg->dst & WINED3DSP_REGNUM_MASK;
- break;
+ if (mask)
+ {
+ shader_addline(buffer, "SWZ %s, %s, %s, %s, %s, %s;\n", reg, reg,
+ shader_arb_get_fixup_swizzle(fixup.x_source), shader_arb_get_fixup_swizzle(fixup.y_source),
+ shader_arb_get_fixup_swizzle(fixup.z_source), shader_arb_get_fixup_swizzle(fixup.w_source));
+ }
- default:
- /* Not a texture sampling instruction, nothing to do */
- return;
- };
+ mask = 0;
+ if (fixup.x_sign_fixup) mask |= WINED3DSP_WRITEMASK_0;
+ if (fixup.y_sign_fixup) mask |= WINED3DSP_WRITEMASK_1;
+ if (fixup.z_sign_fixup) mask |= WINED3DSP_WRITEMASK_2;
+ if (fixup.w_sign_fixup) mask |= WINED3DSP_WRITEMASK_3;
+ mask &= dst_mask;
- texture = (IWineD3DBaseTextureImpl *) deviceImpl->stateBlock->textures[sampler_idx];
- if(texture) {
- fmt = texture->resource.format;
- conversion_group = texture->baseTexture.shader_conversion_group;
- } else {
- fmt = WINED3DFMT_UNKNOWN;
- conversion_group = WINED3DFMT_UNKNOWN;
- }
+ if (mask)
+ {
+ char reg_mask[6];
+ char *ptr = reg_mask;
- /* before doing anything, record the sampler with the format in the format conversion list,
- * but check if it's not there already
- */
- for(i = 0; i < shader->baseShader.num_sampled_samplers; i++) {
- if(shader->baseShader.sampled_samplers[i] == sampler_idx) {
- recorded = TRUE;
+ if (mask != WINED3DSP_WRITEMASK_ALL)
+ {
+ *ptr++ = '.';
+ if (mask & WINED3DSP_WRITEMASK_0) *ptr++ = 'x';
+ if (mask & WINED3DSP_WRITEMASK_1) *ptr++ = 'y';
+ if (mask & WINED3DSP_WRITEMASK_2) *ptr++ = 'z';
+ if (mask & WINED3DSP_WRITEMASK_3) *ptr++ = 'w';
}
+ *ptr = '\0';
+
+ shader_addline(buffer, "MAD %s%s, %s, %s, -%s;\n", reg, reg_mask, reg, two, one);
}
- if(!recorded) {
- shader->baseShader.sampled_samplers[shader->baseShader.num_sampled_samplers] = sampler_idx;
- shader->baseShader.num_sampled_samplers++;
- shader->baseShader.sampled_format[sampler_idx] = conversion_group;
- }
+}
+static void shader_arb_color_correction(const struct SHADER_OPCODE_ARG* arg, struct color_fixup_desc fixup)
+{
+ char reg[256];
pshader_get_register_name(arg->shader, arg->dst, reg);
- shader_arb_get_write_mask(arg, arg->dst, writemask);
- if(strlen(writemask) == 0) strcpy(writemask, ".xyzw");
-
- gen_color_correction(arg->buffer, reg, writemask, "one", "coefmul.x", fmt, gl_info);
-
+ gen_color_correction(arg->buffer, reg, arg->dst & WINED3DSP_WRITEMASK_ALL, "one", "coefmul.x", fixup);
}
-
static void pshader_gen_input_modifier_line (
IWineD3DBaseShader *iface,
SHADER_BUFFER* buffer,
sprintf(outregstr, "T%c%s", 'A' + tmpreg, swzstr);
}
-static inline void pshader_gen_output_modifier_line(
- SHADER_BUFFER* buffer,
- int saturate,
- char *write_mask,
- int shift,
- char *regstr) {
-
+static inline void pshader_gen_output_modifier_line(SHADER_BUFFER *buffer, int saturate, const char *write_mask,
+ int shift, const char *regstr)
+{
/* Generate a line that does the output modifier computation */
shader_addline(buffer, "MUL%s %s%s, %s, %s;\n", saturate ? "_SAT" : "",
regstr, write_mask, regstr, shift_tab[shift]);
}
-static void pshader_hw_bem(SHADER_OPCODE_ARG* arg) {
+static void pshader_hw_bem(const SHADER_OPCODE_ARG *arg)
+{
IWineD3DPixelShaderImpl* This = (IWineD3DPixelShaderImpl*) arg->shader;
SHADER_BUFFER* buffer = arg->buffer;
}
}
-static void pshader_hw_cnd(SHADER_OPCODE_ARG* arg) {
-
+static void pshader_hw_cnd(const SHADER_OPCODE_ARG *arg)
+{
IWineD3DBaseShaderImpl* shader = (IWineD3DBaseShaderImpl*) arg->shader;
SHADER_BUFFER* buffer = arg->buffer;
char dst_wmask[20];
pshader_gen_output_modifier_line(buffer, FALSE, dst_wmask, shift, dst_name);
}
-static void pshader_hw_cmp(SHADER_OPCODE_ARG* arg) {
-
+static void pshader_hw_cmp(const SHADER_OPCODE_ARG *arg)
+{
SHADER_BUFFER* buffer = arg->buffer;
char dst_wmask[20];
char dst_name[50];
/** Process the WINED3DSIO_DP2ADD instruction in ARB.
* dst = dot2(src0, src1) + src2 */
-static void pshader_hw_dp2add(SHADER_OPCODE_ARG* arg) {
+static void pshader_hw_dp2add(const SHADER_OPCODE_ARG *arg)
+{
SHADER_BUFFER* buffer = arg->buffer;
char dst_wmask[20];
char dst_name[50];
}
/* Map the opcode 1-to-1 to the GL code */
-static void shader_hw_map2gl(SHADER_OPCODE_ARG* arg)
+static void shader_hw_map2gl(const SHADER_OPCODE_ARG *arg)
{
IWineD3DBaseShaderImpl *shader = (IWineD3DBaseShaderImpl*)arg->shader;
CONST SHADER_OPCODE* curOpcode = arg->opcode;
SHADER_BUFFER* buffer = arg->buffer;
DWORD dst = arg->dst;
- DWORD* src = arg->src;
+ const DWORD *src = arg->src;
char arguments[256];
unsigned int i;
}
}
-static void shader_hw_mov(SHADER_OPCODE_ARG *arg)
+static void shader_hw_mov(const SHADER_OPCODE_ARG *arg)
{
IWineD3DBaseShaderImpl *shader = (IWineD3DBaseShaderImpl*)arg->shader;
}
}
-static void pshader_hw_texkill(SHADER_OPCODE_ARG* arg) {
+static void pshader_hw_texkill(const SHADER_OPCODE_ARG *arg)
+{
IWineD3DPixelShaderImpl* This = (IWineD3DPixelShaderImpl*) arg->shader;
DWORD hex_version = This->baseShader.hex_version;
SHADER_BUFFER* buffer = arg->buffer;
}
}
-static void pshader_hw_tex(SHADER_OPCODE_ARG* arg) {
+static void pshader_hw_tex(const SHADER_OPCODE_ARG *arg)
+{
IWineD3DPixelShaderImpl* This = (IWineD3DPixelShaderImpl*) arg->shader;
IWineD3DDeviceImpl* deviceImpl = (IWineD3DDeviceImpl*) This->baseShader.device;
DWORD dst = arg->dst;
- DWORD* src = arg->src;
+ const DWORD *src = arg->src;
SHADER_BUFFER* buffer = arg->buffer;
DWORD hex_version = This->baseShader.hex_version;
BOOL projected = FALSE, bias = FALSE;
shader_hw_sample(arg, reg_sampler_code, reg_dest, reg_coord, projected, bias);
}
-static void pshader_hw_texcoord(SHADER_OPCODE_ARG* arg) {
-
+static void pshader_hw_texcoord(const SHADER_OPCODE_ARG *arg)
+{
IWineD3DPixelShaderImpl* This = (IWineD3DPixelShaderImpl*) arg->shader;
DWORD dst = arg->dst;
SHADER_BUFFER* buffer = arg->buffer;
}
}
-static void pshader_hw_texreg2ar(SHADER_OPCODE_ARG* arg) {
-
+static void pshader_hw_texreg2ar(const SHADER_OPCODE_ARG *arg)
+{
SHADER_BUFFER* buffer = arg->buffer;
IWineD3DPixelShaderImpl* This = (IWineD3DPixelShaderImpl*) arg->shader;
IWineD3DDeviceImpl* deviceImpl = (IWineD3DDeviceImpl*) This->baseShader.device;
shader_hw_sample(arg, reg1, dst_str, "TMP", flags & WINED3DTTFF_PROJECTED, FALSE);
}
-static void pshader_hw_texreg2gb(SHADER_OPCODE_ARG* arg) {
-
+static void pshader_hw_texreg2gb(const SHADER_OPCODE_ARG *arg)
+{
SHADER_BUFFER* buffer = arg->buffer;
DWORD reg1 = arg->dst & WINED3DSP_REGNUM_MASK;
shader_hw_sample(arg, reg1, dst_str, "TMP", FALSE, FALSE);
}
-static void pshader_hw_texreg2rgb(SHADER_OPCODE_ARG* arg) {
-
+static void pshader_hw_texreg2rgb(const SHADER_OPCODE_ARG *arg)
+{
SHADER_BUFFER* buffer = arg->buffer;
DWORD reg1 = arg->dst & WINED3DSP_REGNUM_MASK;
char dst_str[8];
shader_hw_sample(arg, reg1, dst_str, src_str, FALSE, FALSE);
}
-static void pshader_hw_texbem(SHADER_OPCODE_ARG* arg) {
+static void pshader_hw_texbem(const SHADER_OPCODE_ARG *arg)
+{
IWineD3DPixelShaderImpl* This = (IWineD3DPixelShaderImpl*) arg->shader;
BOOL has_bumpmat = FALSE;
BOOL has_luminance = FALSE;
}
}
-static void pshader_hw_texm3x2pad(SHADER_OPCODE_ARG* arg) {
-
+static void pshader_hw_texm3x2pad(const SHADER_OPCODE_ARG *arg)
+{
DWORD reg = arg->dst & WINED3DSP_REGNUM_MASK;
SHADER_BUFFER* buffer = arg->buffer;
char src0_name[50];
shader_addline(buffer, "DP3 TMP.x, T%u, %s;\n", reg, src0_name);
}
-static void pshader_hw_texm3x2tex(SHADER_OPCODE_ARG* arg) {
-
+static void pshader_hw_texm3x2tex(const SHADER_OPCODE_ARG *arg)
+{
IWineD3DPixelShaderImpl* This = (IWineD3DPixelShaderImpl*) arg->shader;
IWineD3DDeviceImpl* deviceImpl = (IWineD3DDeviceImpl*) This->baseShader.device;
DWORD flags;
shader_hw_sample(arg, reg, dst_str, "TMP", flags & WINED3DTTFF_PROJECTED, FALSE);
}
-static void pshader_hw_texm3x3pad(SHADER_OPCODE_ARG* arg) {
-
+static void pshader_hw_texm3x3pad(const SHADER_OPCODE_ARG *arg)
+{
IWineD3DPixelShaderImpl* This = (IWineD3DPixelShaderImpl*) arg->shader;
DWORD reg = arg->dst & WINED3DSP_REGNUM_MASK;
SHADER_BUFFER* buffer = arg->buffer;
current_state->texcoord_w[current_state->current_row++] = reg;
}
-static void pshader_hw_texm3x3tex(SHADER_OPCODE_ARG* arg) {
-
+static void pshader_hw_texm3x3tex(const SHADER_OPCODE_ARG *arg)
+{
IWineD3DPixelShaderImpl* This = (IWineD3DPixelShaderImpl*) arg->shader;
IWineD3DDeviceImpl* deviceImpl = (IWineD3DDeviceImpl*) This->baseShader.device;
DWORD flags;
current_state->current_row = 0;
}
-static void pshader_hw_texm3x3vspec(SHADER_OPCODE_ARG* arg) {
-
+static void pshader_hw_texm3x3vspec(const SHADER_OPCODE_ARG *arg)
+{
IWineD3DPixelShaderImpl* This = (IWineD3DPixelShaderImpl*) arg->shader;
IWineD3DDeviceImpl* deviceImpl = (IWineD3DDeviceImpl*) This->baseShader.device;
DWORD flags;
current_state->current_row = 0;
}
-static void pshader_hw_texm3x3spec(SHADER_OPCODE_ARG* arg) {
-
+static void pshader_hw_texm3x3spec(const SHADER_OPCODE_ARG *arg)
+{
IWineD3DPixelShaderImpl* This = (IWineD3DPixelShaderImpl*) arg->shader;
IWineD3DDeviceImpl* deviceImpl = (IWineD3DDeviceImpl*) This->baseShader.device;
DWORD flags;
current_state->current_row = 0;
}
-static void pshader_hw_texdepth(SHADER_OPCODE_ARG* arg) {
+static void pshader_hw_texdepth(const SHADER_OPCODE_ARG *arg)
+{
SHADER_BUFFER* buffer = arg->buffer;
char dst_name[50];
/** Process the WINED3DSIO_TEXDP3TEX instruction in ARB:
* Take a 3-component dot product of the TexCoord[dstreg] and src,
* then perform a 1D texture lookup from stage dstregnum, place into dst. */
-static void pshader_hw_texdp3tex(SHADER_OPCODE_ARG* arg) {
+static void pshader_hw_texdp3tex(const SHADER_OPCODE_ARG *arg)
+{
SHADER_BUFFER* buffer = arg->buffer;
DWORD sampler_idx = arg->dst & WINED3DSP_REGNUM_MASK;
char src0[50];
/** Process the WINED3DSIO_TEXDP3 instruction in ARB:
* Take a 3-component dot product of the TexCoord[dstreg] and src. */
-static void pshader_hw_texdp3(SHADER_OPCODE_ARG* arg) {
+static void pshader_hw_texdp3(const SHADER_OPCODE_ARG *arg)
+{
char src0[50];
char dst_str[50];
char dst_mask[6];
/** Process the WINED3DSIO_TEXM3X3 instruction in ARB
* Perform the 3rd row of a 3x3 matrix multiply */
-static void pshader_hw_texm3x3(SHADER_OPCODE_ARG* arg) {
+static void pshader_hw_texm3x3(const SHADER_OPCODE_ARG *arg)
+{
SHADER_BUFFER* buffer = arg->buffer;
char dst_str[50];
char dst_mask[6];
* Calculate tmp0.y = TexCoord[dstreg] . src.xyz; (tmp0.x has already been calculated)
* depth = (tmp0.y == 0.0) ? 1.0 : tmp0.x / tmp0.y
*/
-static void pshader_hw_texm3x2depth(SHADER_OPCODE_ARG* arg) {
+static void pshader_hw_texm3x2depth(const SHADER_OPCODE_ARG *arg)
+{
SHADER_BUFFER* buffer = arg->buffer;
DWORD dst_reg = arg->dst & WINED3DSP_REGNUM_MASK;
char src0[50];
/** Handles transforming all WINED3DSIO_M?x? opcodes for
Vertex/Pixel shaders to ARB_vertex_program codes */
-static void shader_hw_mnxn(SHADER_OPCODE_ARG* arg) {
-
+static void shader_hw_mnxn(const SHADER_OPCODE_ARG *arg)
+{
int i;
int nComponents = 0;
SHADER_OPCODE_ARG tmpArg;
+ IWineD3DBaseShaderImpl *shader = (IWineD3DBaseShaderImpl *)arg->shader;
+ const SHADER_OPCODE *opcode_table = shader->baseShader.shader_ins;
+ DWORD shader_version = shader->baseShader.hex_version;
memset(&tmpArg, 0, sizeof(SHADER_OPCODE_ARG));
switch(arg->opcode->opcode) {
case WINED3DSIO_M4x4:
nComponents = 4;
- tmpArg.opcode = shader_get_opcode(arg->shader, WINED3DSIO_DP4);
+ tmpArg.opcode = shader_get_opcode(opcode_table, shader_version, WINED3DSIO_DP4);
break;
case WINED3DSIO_M4x3:
nComponents = 3;
- tmpArg.opcode = shader_get_opcode(arg->shader, WINED3DSIO_DP4);
+ tmpArg.opcode = shader_get_opcode(opcode_table, shader_version, WINED3DSIO_DP4);
break;
case WINED3DSIO_M3x4:
nComponents = 4;
- tmpArg.opcode = shader_get_opcode(arg->shader, WINED3DSIO_DP3);
+ tmpArg.opcode = shader_get_opcode(opcode_table, shader_version, WINED3DSIO_DP3);
break;
case WINED3DSIO_M3x3:
nComponents = 3;
- tmpArg.opcode = shader_get_opcode(arg->shader, WINED3DSIO_DP3);
+ tmpArg.opcode = shader_get_opcode(opcode_table, shader_version, WINED3DSIO_DP3);
break;
case WINED3DSIO_M3x2:
nComponents = 2;
- tmpArg.opcode = shader_get_opcode(arg->shader, WINED3DSIO_DP3);
+ tmpArg.opcode = shader_get_opcode(opcode_table, shader_version, WINED3DSIO_DP3);
break;
default:
break;
}
}
-static void vshader_hw_rsq_rcp(SHADER_OPCODE_ARG* arg) {
+static void vshader_hw_rsq_rcp(const SHADER_OPCODE_ARG *arg)
+{
CONST SHADER_OPCODE* curOpcode = arg->opcode;
SHADER_BUFFER* buffer = arg->buffer;
DWORD dst = arg->dst;
shader_addline(buffer, "%s;\n", tmpLine);
}
-static void shader_hw_nrm(SHADER_OPCODE_ARG* arg) {
+static void shader_hw_nrm(const SHADER_OPCODE_ARG *arg)
+{
SHADER_BUFFER* buffer = arg->buffer;
char dst_name[50];
char src_name[50];
pshader_gen_output_modifier_line(buffer, FALSE, dst_wmask, shift, dst_name);
}
-static void shader_hw_sincos(SHADER_OPCODE_ARG* arg) {
+static void shader_hw_sincos(const SHADER_OPCODE_ARG *arg)
+{
/* This instruction exists in ARB, but the d3d instruction takes two extra parameters which
* must contain fixed constants. So we need a separate function to filter those constants and
* can't use map2gl
}
-static GLuint create_arb_blt_vertex_program(WineD3D_GL_Info *gl_info) {
+static GLuint create_arb_blt_vertex_program(const WineD3D_GL_Info *gl_info)
+{
GLuint program_id = 0;
const char *blt_vprogram =
"!!ARBvp1.0\n"
return program_id;
}
-static GLuint create_arb_blt_fragment_program(WineD3D_GL_Info *gl_info, enum tex_types tex_type)
+static GLuint create_arb_blt_fragment_program(const WineD3D_GL_Info *gl_info, enum tex_types tex_type)
{
GLuint program_id = 0;
const char *blt_fprograms[tex_type_count] =
static void shader_arb_select(IWineD3DDevice *iface, BOOL usePS, BOOL useVS) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
struct shader_arb_priv *priv = (struct shader_arb_priv *) This->shader_priv;
- WineD3D_GL_Info *gl_info = &This->adapter->gl_info;
+ const WineD3D_GL_Info *gl_info = &This->adapter->gl_info;
if (useVS) {
TRACE("Using vertex shader\n");
+ IWineD3DVertexShaderImpl_CompileShader(This->stateBlock->vertexShader);
- priv->current_vprogram_id = ((IWineD3DVertexShaderImpl *)This->stateBlock->vertexShader)->baseShader.prgId;
+ priv->current_vprogram_id = ((IWineD3DVertexShaderImpl *)This->stateBlock->vertexShader)->prgId;
/* Bind the vertex program */
GL_EXTCALL(glBindProgramARB(GL_VERTEX_PROGRAM_ARB, priv->current_vprogram_id));
}
if (usePS) {
+ struct ps_compile_args compile_args;
TRACE("Using pixel shader\n");
-
- priv->current_fprogram_id = ((IWineD3DPixelShaderImpl *)This->stateBlock->pixelShader)->baseShader.prgId;
+ find_ps_compile_args((IWineD3DPixelShaderImpl *) This->stateBlock->pixelShader, This->stateBlock, &compile_args);
+ priv->current_fprogram_id = find_gl_pshader((IWineD3DPixelShaderImpl *) This->stateBlock->pixelShader,
+ &compile_args);
/* Bind the fragment program */
GL_EXTCALL(glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, priv->current_fprogram_id));
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
struct shader_arb_priv *priv = (struct shader_arb_priv *) This->shader_priv;
GLuint *blt_fprogram = &priv->depth_blt_fprogram_id[tex_type];
- WineD3D_GL_Info *gl_info = &This->adapter->gl_info;
+ const WineD3D_GL_Info *gl_info = &This->adapter->gl_info;
if (!priv->depth_blt_vprogram_id) priv->depth_blt_vprogram_id = create_arb_blt_vertex_program(gl_info);
GL_EXTCALL(glBindProgramARB(GL_VERTEX_PROGRAM_ARB, priv->depth_blt_vprogram_id));
static void shader_arb_deselect_depth_blt(IWineD3DDevice *iface) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
struct shader_arb_priv *priv = (struct shader_arb_priv *) This->shader_priv;
- WineD3D_GL_Info *gl_info = &This->adapter->gl_info;
+ const WineD3D_GL_Info *gl_info = &This->adapter->gl_info;
if (priv->current_vprogram_id) {
GL_EXTCALL(glBindProgramARB(GL_VERTEX_PROGRAM_ARB, priv->current_vprogram_id));
static void shader_arb_cleanup(IWineD3DDevice *iface) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
- WineD3D_GL_Info *gl_info = &This->adapter->gl_info;
+ const WineD3D_GL_Info *gl_info = &This->adapter->gl_info;
if (GL_SUPPORT(ARB_VERTEX_PROGRAM)) glDisable(GL_VERTEX_PROGRAM_ARB);
if (GL_SUPPORT(ARB_FRAGMENT_PROGRAM)) glDisable(GL_FRAGMENT_PROGRAM_ARB);
}
static void shader_arb_destroy(IWineD3DBaseShader *iface) {
- IWineD3DBaseShaderImpl *This = (IWineD3DBaseShaderImpl *) iface;
- WineD3D_GL_Info *gl_info = &((IWineD3DDeviceImpl *) This->baseShader.device)->adapter->gl_info;
+ IWineD3DBaseShaderImpl *baseShader = (IWineD3DBaseShaderImpl *) iface;
+ const WineD3D_GL_Info *gl_info = &((IWineD3DDeviceImpl *)baseShader->baseShader.device)->adapter->gl_info;
+ char pshader = shader_is_pshader_version(baseShader->baseShader.hex_version);
- ENTER_GL();
- GL_EXTCALL(glDeleteProgramsARB(1, &This->baseShader.prgId));
- checkGLcall("GL_EXTCALL(glDeleteProgramsARB(1, &This->baseShader.prgId))");
- LEAVE_GL();
- This->baseShader.prgId = 0;
- This->baseShader.is_compiled = FALSE;
+ if(pshader) {
+ IWineD3DPixelShaderImpl *This = (IWineD3DPixelShaderImpl *) iface;
+ UINT i;
+
+ ENTER_GL();
+ for(i = 0; i < This->num_gl_shaders; i++) {
+ GL_EXTCALL(glDeleteProgramsARB(1, &This->gl_shaders[i].prgId));
+ checkGLcall("GL_EXTCALL(glDeleteProgramsARB(1, &This->gl_shaders[i].prgId))");
+ }
+ LEAVE_GL();
+ HeapFree(GetProcessHeap(), 0, This->gl_shaders);
+ This->gl_shaders = NULL;
+ This->num_gl_shaders = 0;
+ } else {
+ IWineD3DVertexShaderImpl *This = (IWineD3DVertexShaderImpl *) iface;
+
+ ENTER_GL();
+ GL_EXTCALL(glDeleteProgramsARB(1, &This->prgId));
+ checkGLcall("GL_EXTCALL(glDeleteProgramsARB(1, &This->prgId))");
+ ((IWineD3DVertexShaderImpl *) This)->prgId = 0;
+ LEAVE_GL();
+ }
+ baseShader->baseShader.is_compiled = FALSE;
}
static HRESULT shader_arb_alloc(IWineD3DDevice *iface) {
static void shader_arb_free(IWineD3DDevice *iface) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
- WineD3D_GL_Info *gl_info = &This->adapter->gl_info;
+ const WineD3D_GL_Info *gl_info = &This->adapter->gl_info;
struct shader_arb_priv *priv = (struct shader_arb_priv *) This->shader_priv;
int i;
/* [0.0;1.0] clamping. Not needed, this is done implicitly */
}
-static void shader_arb_generate_pshader(IWineD3DPixelShader *iface, SHADER_BUFFER *buffer) {
+static GLuint shader_arb_generate_pshader(IWineD3DPixelShader *iface, SHADER_BUFFER *buffer) {
IWineD3DPixelShaderImpl *This = (IWineD3DPixelShaderImpl *)iface;
- shader_reg_maps* reg_maps = &This->baseShader.reg_maps;
+ const shader_reg_maps* reg_maps = &This->baseShader.reg_maps;
CONST DWORD *function = This->baseShader.function;
const char *fragcolor;
- WineD3D_GL_Info *gl_info = &((IWineD3DDeviceImpl *)This->baseShader.device)->adapter->gl_info;
- local_constant* lconst;
+ const WineD3D_GL_Info *gl_info = &((IWineD3DDeviceImpl *)This->baseShader.device)->adapter->gl_info;
+ const local_constant *lconst;
+ GLuint retval;
/* Create the hw ARB shader */
shader_addline(buffer, "!!ARBfp1.0\n");
} else {
fragcolor = "TMP_COLOR";
}
- if(This->srgb_enabled) {
+ if(((IWineD3DDeviceImpl *)This->baseShader.device)->stateBlock->renderState[WINED3DRS_SRGBWRITEENABLE]) {
arbfp_add_sRGB_correction(buffer, fragcolor, "TMP", "TMP2", "TA", "TB");
}
if (This->baseShader.hex_version < WINED3DPS_VERSION(3,0)) {
shader_addline(buffer, "END\n");
/* TODO: change to resource.glObjectHandle or something like that */
- GL_EXTCALL(glGenProgramsARB(1, &This->baseShader.prgId));
+ GL_EXTCALL(glGenProgramsARB(1, &retval));
- TRACE("Creating a hw pixel shader, prg=%d\n", This->baseShader.prgId);
- GL_EXTCALL(glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, This->baseShader.prgId));
+ TRACE("Creating a hw pixel shader, prg=%d\n", retval);
+ GL_EXTCALL(glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, retval));
- TRACE("Created hw pixel shader, prg=%d\n", This->baseShader.prgId);
+ TRACE("Created hw pixel shader, prg=%d\n", retval);
/* Create the program and check for errors */
GL_EXTCALL(glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
buffer->bsize, buffer->buffer));
glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &errPos);
FIXME("HW PixelShader Error at position %d: %s\n",
errPos, debugstr_a((const char *)glGetString(GL_PROGRAM_ERROR_STRING_ARB)));
- This->baseShader.prgId = -1;
+ retval = 0;
}
/* Load immediate constants */
if(!This->baseShader.load_local_constsF) {
LIST_FOR_EACH_ENTRY(lconst, &This->baseShader.constantsF, local_constant, entry) {
- float *value = (float *) lconst->value;
+ const float *value = (const float *)lconst->value;
GL_EXTCALL(glProgramLocalParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, lconst->idx, value));
checkGLcall("glProgramLocalParameter4fvARB");
}
}
+
+ return retval;
}
static void shader_arb_generate_vshader(IWineD3DVertexShader *iface, SHADER_BUFFER *buffer) {
IWineD3DVertexShaderImpl *This = (IWineD3DVertexShaderImpl *)iface;
- shader_reg_maps* reg_maps = &This->baseShader.reg_maps;
+ const shader_reg_maps *reg_maps = &This->baseShader.reg_maps;
CONST DWORD *function = This->baseShader.function;
IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *)This->baseShader.device;
- WineD3D_GL_Info *gl_info = &device->adapter->gl_info;
- local_constant* lconst;
+ const WineD3D_GL_Info *gl_info = &device->adapter->gl_info;
+ const local_constant *lconst;
/* Create the hw ARB shader */
shader_addline(buffer, "!!ARBvp1.0\n");
shader_addline(buffer, "END\n");
/* TODO: change to resource.glObjectHandle or something like that */
- GL_EXTCALL(glGenProgramsARB(1, &This->baseShader.prgId));
+ GL_EXTCALL(glGenProgramsARB(1, &This->prgId));
- TRACE("Creating a hw vertex shader, prg=%d\n", This->baseShader.prgId);
- GL_EXTCALL(glBindProgramARB(GL_VERTEX_PROGRAM_ARB, This->baseShader.prgId));
+ TRACE("Creating a hw vertex shader, prg=%d\n", This->prgId);
+ GL_EXTCALL(glBindProgramARB(GL_VERTEX_PROGRAM_ARB, This->prgId));
- TRACE("Created hw vertex shader, prg=%d\n", This->baseShader.prgId);
+ TRACE("Created hw vertex shader, prg=%d\n", This->prgId);
/* Create the program and check for errors */
GL_EXTCALL(glProgramStringARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
buffer->bsize, buffer->buffer));
glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &errPos);
FIXME("HW VertexShader Error at position %d: %s\n",
errPos, debugstr_a((const char *)glGetString(GL_PROGRAM_ERROR_STRING_ARB)));
- This->baseShader.prgId = -1;
+ This->prgId = -1;
}
/* Load immediate constants */
if(!This->baseShader.load_local_constsF) {
LIST_FOR_EACH_ENTRY(lconst, &This->baseShader.constantsF, local_constant, entry) {
- float *value = (float *) lconst->value;
+ const float *value = (const float *)lconst->value;
GL_EXTCALL(glProgramLocalParameter4fvARB(GL_VERTEX_PROGRAM_ARB, lconst->idx, value));
}
}
}
-static void shader_arb_get_caps(WINED3DDEVTYPE devtype, WineD3D_GL_Info *gl_info, struct shader_caps *pCaps) {
+static void shader_arb_get_caps(WINED3DDEVTYPE devtype, const WineD3D_GL_Info *gl_info, struct shader_caps *pCaps)
+{
/* We don't have an ARB fixed function pipeline yet, so let the none backend set its caps,
* then overwrite the shader specific ones
*/
}
}
-static BOOL shader_arb_conv_supported(WINED3DFORMAT fmt) {
- TRACE("Checking shader format support for format %s:", debug_d3dformat(fmt));
- switch(fmt) {
- case WINED3DFMT_V8U8:
- case WINED3DFMT_V16U16:
- case WINED3DFMT_X8L8V8U8:
- case WINED3DFMT_L6V5U5:
- case WINED3DFMT_Q8W8V8U8:
- case WINED3DFMT_ATI2N:
- TRACE("[OK]\n");
- return TRUE;
- default:
- TRACE("[FAILED\n");
- return FALSE;
+static BOOL shader_arb_color_fixup_supported(struct color_fixup_desc fixup)
+{
+ if (TRACE_ON(d3d_shader) && TRACE_ON(d3d))
+ {
+ TRACE("Checking support for color_fixup:\n");
+ dump_color_fixup_desc(fixup);
+ }
+
+ /* We support everything except YUV conversions. */
+ if (!is_yuv_fixup(fixup))
+ {
+ TRACE("[OK]\n");
+ return TRUE;
}
+
+ TRACE("[FAILED]\n");
+ return FALSE;
}
static const SHADER_HANDLER shader_arb_instruction_handler_table[WINED3DSIH_TABLE_SIZE] =
shader_arb_generate_pshader,
shader_arb_generate_vshader,
shader_arb_get_caps,
- shader_arb_conv_supported,
+ shader_arb_color_fixup_supported,
};
/* ARB_fragment_program fixed function pipeline replacement definitions */
}
static void arbfp_free_ffpshader(void *value, void *gli) {
- WineD3D_GL_Info *gl_info = gli;
+ const WineD3D_GL_Info *gl_info = gli;
struct arbfp_ffp_desc *entry_arb = value;
ENTER_GL();
}
}
-static void arbfp_get_caps(WINED3DDEVTYPE devtype, WineD3D_GL_Info *gl_info, struct fragment_caps *caps) {
+static void arbfp_get_caps(WINED3DDEVTYPE devtype, const WineD3D_GL_Info *gl_info, struct fragment_caps *caps)
+{
caps->TextureOpCaps = WINED3DTEXOPCAPS_DISABLE |
WINED3DTEXOPCAPS_SELECTARG1 |
WINED3DTEXOPCAPS_SELECTARG2 |
}
/* The stateblock is passed for GLINFO_LOCATION */
-static GLuint gen_arbfp_ffp_shader(struct ffp_frag_settings *settings, IWineD3DStateBlockImpl *stateblock) {
+static GLuint gen_arbfp_ffp_shader(const struct ffp_frag_settings *settings, IWineD3DStateBlockImpl *stateblock)
+{
unsigned int stage;
SHADER_BUFFER buffer;
BOOL tex_read[MAX_TEXTURES] = {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE};
}
sprintf(colorcor_dst, "tex%u", stage);
- gen_color_correction(&buffer, colorcor_dst, ".rgba", "const.x", "const.y",
- settings->op[stage].color_correction, &GLINFO_LOCATION);
+ gen_color_correction(&buffer, colorcor_dst, WINED3DSP_WRITEMASK_ALL, "const.x", "const.y",
+ settings->op[stage].color_correction);
}
/* Generate the main shader */
BOOL use_pshader = use_ps(device);
BOOL use_vshader = use_vs(device);
struct ffp_frag_settings settings;
- struct arbfp_ffp_desc *desc;
+ const struct arbfp_ffp_desc *desc;
unsigned int i;
if(isStateDirty(context, STATE_RENDER(WINED3DRS_FOGENABLE))) {
- if(use_pshader) {
- IWineD3DPixelShader_CompileShader(stateblock->pixelShader);
- } else if(device->shader_backend == &arb_program_shader_backend && context->last_was_pshader) {
+ if(!use_pshader && device->shader_backend == &arb_program_shader_backend && context->last_was_pshader) {
/* Reload fixed function constants since they collide with the pixel shader constants */
for(i = 0; i < MAX_TEXTURES; i++) {
set_bumpmat_arbfp(STATE_TEXTURESTAGE(i, WINED3DTSS_BUMPENVMAT00), stateblock, context);
return;
}
- if(use_pshader) {
- IWineD3DPixelShader_CompileShader(stateblock->pixelShader);
- } else {
+ if(!use_pshader) {
/* Find or create a shader implementing the fixed function pipeline settings, then activate it */
gen_ffp_frag_op(stateblock, &settings, FALSE);
- desc = (struct arbfp_ffp_desc *) find_ffp_frag_shader(priv->fragment_shaders, &settings);
+ desc = (const struct arbfp_ffp_desc *)find_ffp_frag_shader(priv->fragment_shaders, &settings);
if(!desc) {
- desc = HeapAlloc(GetProcessHeap(), 0, sizeof(*desc));
- if(!desc) {
+ struct arbfp_ffp_desc *new_desc = HeapAlloc(GetProcessHeap(), 0, sizeof(*new_desc));
+ if (!new_desc)
+ {
ERR("Out of memory\n");
return;
}
- desc->num_textures_used = 0;
+ new_desc->num_textures_used = 0;
for(i = 0; i < GL_LIMITS(texture_stages); i++) {
if(settings.op[i].cop == WINED3DTOP_DISABLE) break;
- desc->num_textures_used = i;
+ new_desc->num_textures_used = i;
}
- memcpy(&desc->parent.settings, &settings, sizeof(settings));
- desc->shader = gen_arbfp_ffp_shader(&settings, stateblock);
- add_ffp_frag_shader(priv->fragment_shaders, &desc->parent);
- TRACE("Allocated fixed function replacement shader descriptor %p\n", desc);
+ memcpy(&new_desc->parent.settings, &settings, sizeof(settings));
+ new_desc->shader = gen_arbfp_ffp_shader(&settings, stateblock);
+ add_ffp_frag_shader(priv->fragment_shaders, &new_desc->parent);
+ TRACE("Allocated fixed function replacement shader descriptor %p\n", new_desc);
+ desc = new_desc;
}
/* Now activate the replacement program. GL_FRAGMENT_PROGRAM_ARB is already active(however, note the
arbfp_get_caps,
arbfp_alloc,
arbfp_free,
- shader_arb_conv_supported,
+ shader_arb_color_fixup_supported,
arbfp_fragmentstate_template,
TRUE /* We can disable projected textures */
};
LEAVE_GL();
}
-static BOOL gen_planar_yuv_read(SHADER_BUFFER *buffer, WINED3DFORMAT fmt, GLenum textype, char *luminance) {
+static BOOL gen_planar_yuv_read(SHADER_BUFFER *buffer, enum yuv_fixup yuv_fixup, GLenum textype, char *luminance)
+{
char chroma;
const char *tex, *texinstr;
- if(fmt == WINED3DFMT_UYVY) {
+ if (yuv_fixup == YUV_FIXUP_UYVY) {
chroma = 'r';
*luminance = 'a';
} else {
return TRUE;
}
-static BOOL gen_yv12_read(SHADER_BUFFER *buffer, WINED3DFORMAT fmt, GLenum textype, char *luminance) {
+static BOOL gen_yv12_read(SHADER_BUFFER *buffer, GLenum textype, char *luminance)
+{
const char *tex;
switch(textype) {
return TRUE;
}
-static GLuint gen_yuv_shader(IWineD3DDeviceImpl *device, WINED3DFORMAT fmt, GLenum textype) {
+static GLuint gen_yuv_shader(IWineD3DDeviceImpl *device, enum yuv_fixup yuv_fixup, GLenum textype)
+{
GLenum shader;
SHADER_BUFFER buffer;
char luminance_component;
shader_addline(&buffer, "PARAM yuv_coef = {1.403, 0.344, 0.714, 1.770};\n");
shader_addline(&buffer, "PARAM size = program.local[0];\n");
- if(fmt == WINED3DFMT_UYVY || fmt ==WINED3DFMT_YUY2) {
- if(gen_planar_yuv_read(&buffer, fmt, textype, &luminance_component) == FALSE) {
- HeapFree(GetProcessHeap(), 0, buffer.buffer);
- return 0;
- }
- } else {
- if(gen_yv12_read(&buffer, fmt, textype, &luminance_component) == FALSE) {
+ switch (yuv_fixup)
+ {
+ case YUV_FIXUP_UYVY:
+ case YUV_FIXUP_YUY2:
+ if (!gen_planar_yuv_read(&buffer, yuv_fixup, textype, &luminance_component))
+ {
+ HeapFree(GetProcessHeap(), 0, buffer.buffer);
+ return 0;
+ }
+ break;
+
+ case YUV_FIXUP_YV12:
+ if (!gen_yv12_read(&buffer, textype, &luminance_component))
+ {
+ HeapFree(GetProcessHeap(), 0, buffer.buffer);
+ return 0;
+ }
+ break;
+
+ default:
+ FIXME("Unsupported YUV fixup %#x\n", yuv_fixup);
HeapFree(GetProcessHeap(), 0, buffer.buffer);
return 0;
- }
}
/* Calculate the final result. Formula is taken from
HeapFree(GetProcessHeap(), 0, buffer.buffer);
LEAVE_GL();
- if(fmt == WINED3DFMT_YUY2) {
- if(textype == GL_TEXTURE_RECTANGLE_ARB) {
- priv->yuy2_rect_shader = shader;
- } else {
- priv->yuy2_2d_shader = shader;
- }
- } else if(fmt == WINED3DFMT_UYVY) {
- if(textype == GL_TEXTURE_RECTANGLE_ARB) {
- priv->uyvy_rect_shader = shader;
- } else {
- priv->uyvy_2d_shader = shader;
- }
- } else {
- if(textype == GL_TEXTURE_RECTANGLE_ARB) {
- priv->yv12_rect_shader = shader;
- } else {
- priv->yv12_2d_shader = shader;
- }
+ switch (yuv_fixup)
+ {
+ case YUV_FIXUP_YUY2:
+ if (textype == GL_TEXTURE_RECTANGLE_ARB) priv->yuy2_rect_shader = shader;
+ else priv->yuy2_2d_shader = shader;
+ break;
+
+ case YUV_FIXUP_UYVY:
+ if (textype == GL_TEXTURE_RECTANGLE_ARB) priv->uyvy_rect_shader = shader;
+ else priv->uyvy_2d_shader = shader;
+ break;
+
+ case YUV_FIXUP_YV12:
+ if (textype == GL_TEXTURE_RECTANGLE_ARB) priv->yv12_rect_shader = shader;
+ else priv->yv12_2d_shader = shader;
+ break;
}
+
return shader;
}
IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *) iface;
float size[4] = {width, height, 1, 1};
struct arbfp_blit_priv *priv = (struct arbfp_blit_priv *) device->blit_priv;
- const GlPixelFormatDesc *glDesc;
+ const struct GlPixelFormatDesc *glDesc;
+ enum yuv_fixup yuv_fixup;
getFormatDescEntry(fmt, &GLINFO_LOCATION, &glDesc);
- if(glDesc->conversion_group != WINED3DFMT_YUY2 && glDesc->conversion_group != WINED3DFMT_UYVY &&
- glDesc->conversion_group != WINED3DFMT_YV12) {
- TRACE("Format: %s\n", debug_d3dformat(glDesc->conversion_group));
+ if (!is_yuv_fixup(glDesc->color_fixup))
+ {
+ TRACE("Fixup:\n");
+ dump_color_fixup_desc(glDesc->color_fixup);
/* Don't bother setting up a shader for unconverted formats */
ENTER_GL();
glEnable(textype);
return WINED3D_OK;
}
- if(glDesc->conversion_group == WINED3DFMT_YUY2) {
- if(textype == GL_TEXTURE_RECTANGLE_ARB) {
- shader = priv->yuy2_rect_shader;
- } else {
- shader = priv->yuy2_2d_shader;
- }
- } else if(glDesc->conversion_group == WINED3DFMT_UYVY) {
- if(textype == GL_TEXTURE_RECTANGLE_ARB) {
- shader = priv->uyvy_rect_shader;
- } else {
- shader = priv->uyvy_2d_shader;
- }
- } else {
- if(textype == GL_TEXTURE_RECTANGLE_ARB) {
- shader = priv->yv12_rect_shader;
- } else {
- shader = priv->yv12_2d_shader;
- }
- }
+ yuv_fixup = get_yuv_fixup(glDesc->color_fixup);
- if(!shader) {
- shader = gen_yuv_shader(device, glDesc->conversion_group, textype);
+ switch(yuv_fixup)
+ {
+ case YUV_FIXUP_YUY2:
+ shader = textype == GL_TEXTURE_RECTANGLE_ARB ? priv->yuy2_rect_shader : priv->yuy2_2d_shader;
+ break;
+
+ case YUV_FIXUP_UYVY:
+ shader = textype == GL_TEXTURE_RECTANGLE_ARB ? priv->uyvy_rect_shader : priv->uyvy_2d_shader;
+ break;
+
+ case YUV_FIXUP_YV12:
+ shader = textype == GL_TEXTURE_RECTANGLE_ARB ? priv->yv12_rect_shader : priv->yv12_2d_shader;
+ break;
+
+ default:
+ FIXME("Unsupported YUV fixup %#x, not setting a shader\n", yuv_fixup);
+ ENTER_GL();
+ glEnable(textype);
+ checkGLcall("glEnable(textype)");
+ LEAVE_GL();
+ return E_NOTIMPL;
}
+ if (!shader) shader = gen_yuv_shader(device, yuv_fixup, textype);
+
ENTER_GL();
glEnable(GL_FRAGMENT_PROGRAM_ARB);
checkGLcall("glEnable(GL_FRAGMENT_PROGRAM_ARB)");
LEAVE_GL();
}
-static BOOL arbfp_blit_conv_supported(WINED3DFORMAT fmt) {
- TRACE("Checking blit format support for format %s:", debug_d3dformat(fmt));
- switch(fmt) {
- case WINED3DFMT_YUY2:
- case WINED3DFMT_UYVY:
- case WINED3DFMT_YV12:
+static BOOL arbfp_blit_color_fixup_supported(struct color_fixup_desc fixup)
+{
+ enum yuv_fixup yuv_fixup;
+
+ if (TRACE_ON(d3d_shader) && TRACE_ON(d3d))
+ {
+ TRACE("Checking support for fixup:\n");
+ dump_color_fixup_desc(fixup);
+ }
+
+ if (is_identity_fixup(fixup))
+ {
+ TRACE("[OK]\n");
+ return TRUE;
+ }
+
+ /* We only support YUV conversions. */
+ if (!is_yuv_fixup(fixup))
+ {
+ TRACE("[FAILED]\n");
+ return FALSE;
+ }
+
+ yuv_fixup = get_yuv_fixup(fixup);
+ switch(yuv_fixup)
+ {
+ case YUV_FIXUP_YUY2:
+ case YUV_FIXUP_UYVY:
+ case YUV_FIXUP_YV12:
TRACE("[OK]\n");
return TRUE;
+
default:
+ FIXME("Unsupported YUV fixup %#x\n", yuv_fixup);
TRACE("[FAILED]\n");
return FALSE;
}
arbfp_blit_free,
arbfp_blit_set,
arbfp_blit_unset,
- arbfp_blit_conv_supported
+ arbfp_blit_color_fixup_supported,
};
#undef GLINFO_LOCATION
#include "wined3d_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3d_shader);
+WINE_DECLARE_DEBUG_CHANNEL(d3d);
/* Some private defines, Constant associations, etc.
* Env bump matrix and per stage constant should be independent,
}
#define GLINFO_LOCATION (*gl_info)
-static GLuint register_for_arg(DWORD arg, WineD3D_GL_Info *gl_info, unsigned int stage, GLuint *mod, GLuint *rep, GLuint tmparg) {
+static GLuint register_for_arg(DWORD arg, const WineD3D_GL_Info *gl_info,
+ unsigned int stage, GLuint *mod, GLuint *rep, GLuint tmparg)
+{
GLenum ret;
if(mod) *mod = GL_NONE;
return ret;
}
-static GLuint find_tmpreg(struct texture_stage_op op[MAX_TEXTURES]) {
+static GLuint find_tmpreg(const struct texture_stage_op op[MAX_TEXTURES])
+{
int lowest_read = -1;
int lowest_write = -1;
int i;
}
}
-static GLuint gen_ati_shader(struct texture_stage_op op[MAX_TEXTURES], WineD3D_GL_Info *gl_info) {
+static GLuint gen_ati_shader(const struct texture_stage_op op[MAX_TEXTURES], const WineD3D_GL_Info *gl_info)
+{
GLuint ret = GL_EXTCALL(glGenFragmentShadersATI(1));
unsigned int stage;
GLuint arg0, arg1, arg2, extrarg;
/* Pass 2: Generate perturbation calculations */
for(stage = 0; stage < GL_LIMITS(textures); stage++) {
+ GLuint argmodextra_x, argmodextra_y;
+ struct color_fixup_desc fixup;
+
if(op[stage].cop == WINED3DTOP_DISABLE) break;
if(op[stage].cop != WINED3DTOP_BUMPENVMAP &&
op[stage].cop != WINED3DTOP_BUMPENVMAPLUMINANCE) continue;
- /* Nice thing, we get the color correction for free :-) */
- if(op[stage].color_correction == WINED3DFMT_V8U8) {
- argmodextra = GL_2X_BIT_ATI | GL_BIAS_BIT_ATI;
- } else {
- argmodextra = 0;
+ if (fixup.x_source != CHANNEL_SOURCE_X || fixup.y_source != CHANNEL_SOURCE_Y)
+ {
+ FIXME("Swizzles not implemented\n");
+ argmodextra_x = GL_NONE;
+ argmodextra_y = GL_NONE;
+ }
+ else
+ {
+ /* Nice thing, we get the color correction for free :-) */
+ argmodextra_x = fixup.x_sign_fixup ? GL_2X_BIT_ATI | GL_BIAS_BIT_ATI : GL_NONE;
+ argmodextra_y = fixup.y_sign_fixup ? GL_2X_BIT_ATI | GL_BIAS_BIT_ATI : GL_NONE;
}
TRACE("glColorFragmentOp3ATI(GL_DOT2_ADD_ATI, GL_REG_%d_ATI, GL_RED_BIT_ATI, GL_NONE, GL_REG_%d_ATI, GL_NONE, %s, ATI_FFP_CONST_BUMPMAT(%d), GL_NONE, GL_NONE, GL_REG_%d_ATI, GL_RED, GL_NONE)\n",
- stage + 1, stage, debug_argmod(argmodextra), stage, stage + 1);
+ stage + 1, stage, debug_argmod(argmodextra_x), stage, stage + 1);
GL_EXTCALL(glColorFragmentOp3ATI(GL_DOT2_ADD_ATI, GL_REG_0_ATI + stage + 1, GL_RED_BIT_ATI, GL_NONE,
- GL_REG_0_ATI + stage, GL_NONE, argmodextra,
+ GL_REG_0_ATI + stage, GL_NONE, argmodextra_x,
ATI_FFP_CONST_BUMPMAT(stage), GL_NONE, GL_2X_BIT_ATI | GL_BIAS_BIT_ATI,
GL_REG_0_ATI + stage + 1, GL_RED, GL_NONE));
GL_EXTCALL(glColorFragmentOp1ATI(GL_MOV_ATI, GL_REG_5_ATI, GL_GREEN_BIT_ATI, GL_NONE,
ATI_FFP_CONST_BUMPMAT(stage), GL_ALPHA, GL_NONE));
TRACE("glColorFragmentOp3ATI(GL_DOT2_ADD_ATI, GL_REG_%d_ATI, GL_GREEN_BIT_ATI, GL_NONE, GL_REG_%d_ATI, GL_NONE, %s, GL_REG_5_ATI, GL_NONE, GL_NONE, GL_REG_%d_ATI, GL_GREEN, GL_NONE)\n",
- stage + 1, stage, debug_argmod(argmodextra), stage + 1);
+ stage + 1, stage, debug_argmod(argmodextra_y), stage + 1);
GL_EXTCALL(glColorFragmentOp3ATI(GL_DOT2_ADD_ATI, GL_REG_0_ATI + stage + 1, GL_GREEN_BIT_ATI, GL_NONE,
- GL_REG_0_ATI + stage, GL_NONE, argmodextra,
+ GL_REG_0_ATI + stage, GL_NONE, argmodextra_y,
GL_REG_5_ATI, GL_NONE, GL_2X_BIT_ATI | GL_BIAS_BIT_ATI,
GL_REG_0_ATI + stage + 1, GL_GREEN, GL_NONE));
}
#define GLINFO_LOCATION stateblock->wineD3DDevice->adapter->gl_info
static void set_tex_op_atifs(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
IWineD3DDeviceImpl *This = stateblock->wineD3DDevice;
- struct atifs_ffp_desc *desc;
+ const struct atifs_ffp_desc *desc;
struct ffp_frag_settings settings;
struct atifs_private_data *priv = (struct atifs_private_data *) This->fragment_priv;
DWORD mapped_stage;
unsigned int i;
gen_ffp_frag_op(stateblock, &settings, TRUE);
- desc = (struct atifs_ffp_desc *) find_ffp_frag_shader(priv->fragment_shaders, &settings);
+ desc = (const struct atifs_ffp_desc *)find_ffp_frag_shader(priv->fragment_shaders, &settings);
if(!desc) {
- desc = HeapAlloc(GetProcessHeap(), 0, sizeof(*desc));
- if(!desc) {
+ struct atifs_ffp_desc *new_desc = HeapAlloc(GetProcessHeap(), 0, sizeof(*new_desc));
+ if (!new_desc)
+ {
ERR("Out of memory\n");
return;
}
- desc->num_textures_used = 0;
+ new_desc->num_textures_used = 0;
for(i = 0; i < GL_LIMITS(texture_stages); i++) {
if(settings.op[i].cop == WINED3DTOP_DISABLE) break;
- desc->num_textures_used = i;
+ new_desc->num_textures_used = i;
}
- memcpy(&desc->parent.settings, &settings, sizeof(settings));
- desc->shader = gen_ati_shader(settings.op, &GLINFO_LOCATION);
- add_ffp_frag_shader(priv->fragment_shaders, &desc->parent);
- TRACE("Allocated fixed function replacement shader descriptor %p\n", desc);
+ memcpy(&new_desc->parent.settings, &settings, sizeof(settings));
+ new_desc->shader = gen_ati_shader(settings.op, &GLINFO_LOCATION);
+ add_ffp_frag_shader(priv->fragment_shaders, &new_desc->parent);
+ TRACE("Allocated fixed function replacement shader descriptor %p\n", new_desc);
+ desc = new_desc;
}
/* GL_ATI_fragment_shader depends on the GL_TEXTURE_xD enable settings. Update the texture stages
}
}
-static void atifs_get_caps(WINED3DDEVTYPE devtype, WineD3D_GL_Info *gl_info, struct fragment_caps *caps) {
+static void atifs_get_caps(WINED3DDEVTYPE devtype, const WineD3D_GL_Info *gl_info, struct fragment_caps *caps)
+{
caps->TextureOpCaps = WINED3DTEXOPCAPS_DISABLE |
WINED3DTEXOPCAPS_SELECTARG1 |
WINED3DTEXOPCAPS_SELECTARG2 |
}
#undef GLINFO_LOCATION
-static BOOL atifs_conv_supported(WINED3DFORMAT fmt) {
- TRACE("Checking shader format support for format %s:", debug_d3dformat(fmt));
- switch(fmt) {
- case WINED3DFMT_V8U8:
- case WINED3DFMT_V16U16:
- TRACE("[OK]\n");
- return TRUE;
- default:
- TRACE("[FAILED\n");
- return FALSE;
+static BOOL atifs_color_fixup_supported(struct color_fixup_desc fixup)
+{
+ if (TRACE_ON(d3d_shader) && TRACE_ON(d3d))
+ {
+ TRACE("Checking support for fixup:\n");
+ dump_color_fixup_desc(fixup);
}
+
+ /* We only support sign fixup of the first two channels. */
+ if (fixup.x_source == CHANNEL_SOURCE_X && fixup.y_source == CHANNEL_SOURCE_Y
+ && fixup.z_source == CHANNEL_SOURCE_Z && fixup.w_source == CHANNEL_SOURCE_W
+ && !fixup.z_sign_fixup && !fixup.w_sign_fixup)
+ {
+ TRACE("[OK]\n");
+ return TRUE;
+ }
+
+ TRACE("[FAILED]\n");
+ return FALSE;
}
const struct fragment_pipeline atifs_fragment_pipeline = {
atifs_get_caps,
atifs_alloc,
atifs_free,
- atifs_conv_supported,
+ atifs_color_fixup_supported,
atifs_fragmentstate_template,
TRUE /* We can disable projected textures */
};
#include "wined3d_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3d_shader);
+WINE_DECLARE_DEBUG_CHANNEL(d3d);
#define GLNAME_REQUIRE_GLSL ((const char *)1)
+static void shader_dump_param(const DWORD param, const DWORD addr_token, int input, DWORD shader_version);
+
static inline BOOL shader_is_version_token(DWORD token) {
return shader_is_pshader_version(token) ||
shader_is_vshader_version(token);
return 0;
}
-const SHADER_OPCODE* shader_get_opcode(
- IWineD3DBaseShader *iface, const DWORD code) {
-
- IWineD3DBaseShaderImpl *This = (IWineD3DBaseShaderImpl*) iface;
-
+const SHADER_OPCODE *shader_get_opcode(const SHADER_OPCODE *opcode_table, DWORD shader_version, DWORD code)
+{
DWORD i = 0;
- DWORD hex_version = This->baseShader.hex_version;
- const SHADER_OPCODE *shader_ins = This->baseShader.shader_ins;
/** TODO: use dichotomic search */
- while (NULL != shader_ins[i].name) {
- if (((code & WINED3DSI_OPCODE_MASK) == shader_ins[i].opcode) &&
- (((hex_version >= shader_ins[i].min_version) && (hex_version <= shader_ins[i].max_version)) ||
- ((shader_ins[i].min_version == 0) && (shader_ins[i].max_version == 0)))) {
- return &shader_ins[i];
+ while (opcode_table[i].name)
+ {
+ if ((code & WINED3DSI_OPCODE_MASK) == opcode_table[i].opcode
+ && shader_version >= opcode_table[i].min_version
+ && (!opcode_table[i].max_version || shader_version <= opcode_table[i].max_version))
+ {
+ return &opcode_table[i];
}
++i;
}
- FIXME("Unsupported opcode %#x(%d) masked %#x, shader version %#x\n",
- code, code, code & WINED3DSI_OPCODE_MASK, hex_version);
+
+ FIXME("Unsupported opcode %#x(%d) masked %#x, shader version %#x\n",
+ code, code, code & WINED3DSI_OPCODE_MASK, shader_version);
+
return NULL;
}
/* Read a parameter opcode from the input stream,
* and possibly a relative addressing token.
* Return the number of tokens read */
-int shader_get_param(
- IWineD3DBaseShader* iface,
- const DWORD* pToken,
- DWORD* param,
- DWORD* addr_token) {
-
+static int shader_get_param(const DWORD *pToken, DWORD shader_version, DWORD *param, DWORD *addr_token)
+{
/* PS >= 3.0 have relative addressing (with token)
* VS >= 2.0 have relative addressing (with token)
* VS >= 1.0 < 2.0 have relative addressing (without token)
* The version check below should work in general */
- IWineD3DBaseShaderImpl* This = (IWineD3DBaseShaderImpl*) iface;
- char rel_token = WINED3DSHADER_VERSION_MAJOR(This->baseShader.hex_version) >= 2 &&
+ char rel_token = WINED3DSHADER_VERSION_MAJOR(shader_version) >= 2 &&
((*pToken & WINED3DSHADER_ADDRESSMODE_MASK) == WINED3DSHADER_ADDRMODE_RELATIVE);
*param = *pToken;
* Note: This function assumes source or destination token format.
* It will not work with specially-formatted tokens like DEF or DCL,
* but hopefully those would be recognized */
-
-int shader_skip_unrecognized(
- IWineD3DBaseShader* iface,
- const DWORD* pToken) {
-
+static int shader_skip_unrecognized(const DWORD *pToken, DWORD shader_version)
+{
int tokens_read = 0;
int i = 0;
while (*pToken & 0x80000000) {
DWORD param, addr_token;
- tokens_read += shader_get_param(iface, pToken, ¶m, &addr_token);
+ tokens_read += shader_get_param(pToken, shader_version, ¶m, &addr_token);
pToken += tokens_read;
FIXME("Unrecognized opcode param: token=0x%08x "
"addr_token=0x%08x name=", param, addr_token);
- shader_dump_param(iface, param, addr_token, i);
+ shader_dump_param(param, addr_token, i, shader_version);
FIXME("\n");
++i;
}
/* Convert floating point offset relative
* to a register file to an absolute offset for float constants */
-
-unsigned int shader_get_float_offset(const DWORD reg) {
-
+static unsigned int shader_get_float_offset(const DWORD reg)
+{
unsigned int regnum = reg & WINED3DSP_REGNUM_MASK;
int regtype = shader_get_regtype(reg);
IWineD3DStateBlockImpl *stateBlock) {
IWineD3DBaseShaderImpl* This = (IWineD3DBaseShaderImpl*) iface;
+ const SHADER_OPCODE *shader_ins = This->baseShader.shader_ins;
+ DWORD shader_version = This->baseShader.hex_version;
unsigned int cur_loop_depth = 0, max_loop_depth = 0;
/* There are some minor differences between pixel and vertex shaders */
/* Fetch opcode */
opcode_token = *pToken++;
- curOpcode = shader_get_opcode(iface, opcode_token);
+ curOpcode = shader_get_opcode(shader_ins, shader_version, opcode_token);
/* Unhandled opcode, and its parameters */
if (NULL == curOpcode) {
for (i = 0; i < limit; ++i) {
DWORD param, addr_token, reg, regtype;
- pToken += shader_get_param(iface, pToken, ¶m, &addr_token);
+ pToken += shader_get_param(pToken, shader_version, ¶m, &addr_token);
regtype = shader_get_regtype(param);
reg = param & WINED3DSP_REGNUM_MASK;
return WINED3D_OK;
}
-static void shader_dump_decl_usage(
- IWineD3DBaseShaderImpl* This,
- DWORD decl,
- DWORD param) {
-
+static void shader_dump_decl_usage(DWORD decl, DWORD param, DWORD shader_version)
+{
DWORD regtype = shader_get_regtype(param);
TRACE("dcl");
DWORD idx = (decl & WINED3DSP_DCL_USAGEINDEX_MASK) >> WINED3DSP_DCL_USAGEINDEX_SHIFT;
/* Pixel shaders 3.0 don't have usage semantics */
- char pshader = shader_is_pshader_version(This->baseShader.hex_version);
- if (pshader && This->baseShader.hex_version < WINED3DPS_VERSION(3,0))
+ if (shader_is_pshader_version(shader_version) && shader_version < WINED3DPS_VERSION(3,0))
return;
else
TRACE("_");
}
}
-static void shader_dump_arr_entry(
- IWineD3DBaseShader *iface,
- const DWORD param,
- const DWORD addr_token,
- unsigned int reg,
- int input) {
-
+static void shader_dump_arr_entry(const DWORD param, const DWORD addr_token,
+ unsigned int reg, int input, DWORD shader_version)
+{
char relative =
((param & WINED3DSHADER_ADDRESSMODE_MASK) == WINED3DSHADER_ADDRMODE_RELATIVE);
if (relative) {
TRACE("[");
if (addr_token)
- shader_dump_param(iface, addr_token, 0, input);
+ shader_dump_param(addr_token, 0, input, shader_version);
else
TRACE("a0.x");
TRACE(" + ");
TRACE("]");
}
-void shader_dump_param(
- IWineD3DBaseShader *iface,
- const DWORD param,
- const DWORD addr_token,
- int input) {
-
- IWineD3DBaseShaderImpl* This = (IWineD3DBaseShaderImpl*) iface;
+static void shader_dump_param(const DWORD param, const DWORD addr_token, int input, DWORD shader_version)
+{
static const char * const rastout_reg_names[] = { "oPos", "oFog", "oPts" };
static const char * const misctype_reg_names[] = { "vPos", "vFace"};
char swizzle_reg_chars[4];
DWORD modifier = param & WINED3DSP_SRCMOD_MASK;
/* There are some minor differences between pixel and vertex shaders */
- char pshader = shader_is_pshader_version(This->baseShader.hex_version);
+ char pshader = shader_is_pshader_version(shader_version);
/* For one, we'd prefer color components to be shown for pshaders.
* FIXME: use the swizzle function for this */
break;
case WINED3DSPR_INPUT:
TRACE("v");
- shader_dump_arr_entry(iface, param, addr_token, reg, input);
+ shader_dump_arr_entry(param, addr_token, reg, input, shader_version);
break;
case WINED3DSPR_CONST:
case WINED3DSPR_CONST2:
case WINED3DSPR_CONST3:
case WINED3DSPR_CONST4:
TRACE("c");
- shader_dump_arr_entry(iface, param, addr_token, shader_get_float_offset(param), input);
+ shader_dump_arr_entry(param, addr_token, shader_get_float_offset(param), input, shader_version);
break;
case WINED3DSPR_TEXTURE: /* vs: case D3DSPR_ADDR */
TRACE("%c%u", (pshader? 't':'a'), reg);
/* Vertex shaders >= 3.0 use general purpose output registers
* (WINED3DSPR_OUTPUT), which can include an address token */
- if (WINED3DSHADER_VERSION_MAJOR(This->baseShader.hex_version) >= 3) {
+ if (WINED3DSHADER_VERSION_MAJOR(shader_version) >= 3) {
TRACE("o");
- shader_dump_arr_entry(iface, param, addr_token, reg, input);
+ shader_dump_arr_entry(param, addr_token, reg, input, shader_version);
}
else
TRACE("oT%u", reg);
break;
case WINED3DSPR_CONSTINT:
TRACE("i");
- shader_dump_arr_entry(iface, param, addr_token, reg, input);
+ shader_dump_arr_entry(param, addr_token, reg, input, shader_version);
break;
case WINED3DSPR_CONSTBOOL:
TRACE("b");
- shader_dump_arr_entry(iface, param, addr_token, reg, input);
+ shader_dump_arr_entry(param, addr_token, reg, input, shader_version);
break;
case WINED3DSPR_LABEL:
TRACE("l%u", reg);
}
}
+static void shader_color_correction(IWineD3DBaseShaderImpl *shader,
+ IWineD3DDeviceImpl *device, const struct SHADER_OPCODE_ARG *arg)
+{
+ DWORD hex_version = shader->baseShader.hex_version;
+ IWineD3DBaseTextureImpl *texture;
+ struct color_fixup_desc fixup;
+ BOOL recorded = FALSE;
+ DWORD sampler_idx;
+ UINT i;
+
+ switch(arg->opcode->opcode)
+ {
+ case WINED3DSIO_TEX:
+ if (hex_version < WINED3DPS_VERSION(2,0)) sampler_idx = arg->dst & WINED3DSP_REGNUM_MASK;
+ else sampler_idx = arg->src[1] & WINED3DSP_REGNUM_MASK;
+ break;
+
+ case WINED3DSIO_TEXLDL:
+ FIXME("Add color fixup for vertex texture WINED3DSIO_TEXLDL\n");
+ return;
+
+ case WINED3DSIO_TEXDP3TEX:
+ case WINED3DSIO_TEXM3x3TEX:
+ case WINED3DSIO_TEXM3x3SPEC:
+ case WINED3DSIO_TEXM3x3VSPEC:
+ case WINED3DSIO_TEXBEM:
+ case WINED3DSIO_TEXREG2AR:
+ case WINED3DSIO_TEXREG2GB:
+ case WINED3DSIO_TEXREG2RGB:
+ sampler_idx = arg->dst & WINED3DSP_REGNUM_MASK;
+ break;
+
+ default:
+ /* Not a texture sampling instruction, nothing to do */
+ return;
+ };
+
+ texture = (IWineD3DBaseTextureImpl *)device->stateBlock->textures[sampler_idx];
+ if (texture) fixup = texture->baseTexture.shader_color_fixup;
+ else fixup = COLOR_FIXUP_IDENTITY;
+
+ /* before doing anything, record the sampler with the format in the format conversion list,
+ * but check if it's not there already */
+ for (i = 0; i < shader->baseShader.num_sampled_samplers; ++i)
+ {
+ if (shader->baseShader.sampled_samplers[i] == sampler_idx)
+ {
+ recorded = TRUE;
+ break;
+ }
+ }
+
+ if (!recorded)
+ {
+ shader->baseShader.sampled_samplers[shader->baseShader.num_sampled_samplers] = sampler_idx;
+ ++shader->baseShader.num_sampled_samplers;
+ }
+
+ device->shader_backend->shader_color_correction(arg, fixup);
+}
+
/** Shared code in order to generate the bulk of the shader string.
Use the shader_header_fct & shader_footer_fct to add strings
that are specific to pixel or vertex functions
NOTE: A description of how to parse tokens can be found on msdn */
-void shader_generate_main(
- IWineD3DBaseShader *iface,
- SHADER_BUFFER* buffer,
- shader_reg_maps* reg_maps,
- CONST DWORD* pFunction) {
-
+void shader_generate_main(IWineD3DBaseShader *iface, SHADER_BUFFER* buffer,
+ const shader_reg_maps* reg_maps, CONST DWORD* pFunction)
+{
IWineD3DBaseShaderImpl* This = (IWineD3DBaseShaderImpl*) iface;
IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *) This->baseShader.device; /* To access shader backend callbacks */
+ const SHADER_OPCODE *opcode_table = This->baseShader.shader_ins;
const SHADER_HANDLER *handler_table = device->shader_backend->shader_instruction_handler_table;
+ DWORD shader_version = This->baseShader.hex_version;
const DWORD *pToken = pFunction;
const SHADER_OPCODE *curOpcode = NULL;
SHADER_HANDLER hw_fct = NULL;
/* Read opcode */
hw_arg.opcode_token = *pToken++;
- curOpcode = shader_get_opcode(iface, hw_arg.opcode_token);
+ curOpcode = shader_get_opcode(opcode_table, shader_version, hw_arg.opcode_token);
/* Select handler */
if (curOpcode == NULL)
/* Unknown opcode and its parameters */
if (NULL == curOpcode) {
FIXME("Unrecognized opcode: token=0x%08x\n", hw_arg.opcode_token);
- pToken += shader_skip_unrecognized(iface, pToken);
+ pToken += shader_skip_unrecognized(pToken, shader_version);
/* Nothing to do */
} else if (WINED3DSIO_DCL == curOpcode->opcode ||
if (curOpcode->dst_token) {
DWORD param, addr_token = 0;
- pToken += shader_get_param(iface, pToken, ¶m, &addr_token);
+ pToken += shader_get_param(pToken, shader_version, ¶m, &addr_token);
hw_arg.dst = param;
hw_arg.dst_addr = addr_token;
}
for (i = 0; i < (curOpcode->num_params - curOpcode->dst_token); i++) {
DWORD param, addr_token = 0;
- pToken += shader_get_param(iface, pToken, ¶m, &addr_token);
+ pToken += shader_get_param(pToken, shader_version, ¶m, &addr_token);
hw_arg.src[i] = param;
hw_arg.src_addr[i] = addr_token;
}
hw_fct(&hw_arg);
/* Add color correction if needed */
- device->shader_backend->shader_color_correction(&hw_arg);
+ shader_color_correction(This, device, &hw_arg);
/* Process instruction modifiers for GLSL apps ( _sat, etc. ) */
/* FIXME: This should be internal to the shader backend.
}
}
-void shader_dump_ins_modifiers(const DWORD output) {
-
+static void shader_dump_ins_modifiers(const DWORD output)
+{
DWORD shift = (output & WINED3DSP_DSTSHIFT_MASK) >> WINED3DSP_DSTSHIFT_SHIFT;
DWORD mmask = output & WINED3DSP_DSTMOD_MASK;
TRACE("(%p) : Parsing program\n", This);
- if (NULL != pToken) {
- while (WINED3DVS_END() != *pToken) {
- if (shader_is_version_token(*pToken)) { /** version */
- This->baseShader.hex_version = *pToken;
- TRACE("%s_%u_%u\n", shader_is_pshader_version(This->baseShader.hex_version)? "ps": "vs",
- WINED3DSHADER_VERSION_MAJOR(This->baseShader.hex_version),
- WINED3DSHADER_VERSION_MINOR(This->baseShader.hex_version));
- ++pToken;
- ++len;
- continue;
+ if (!pFunction)
+ {
+ WARN("Got a NULL pFunction, returning.\n");
+ This->baseShader.functionLength = 1; /* no Function defined use fixed function vertex processing */
+ return;
+ }
+
+ while (WINED3DVS_END() != *pToken)
+ {
+ if (shader_is_version_token(*pToken)) /* version */
+ {
+ This->baseShader.hex_version = *pToken;
+ TRACE("%s_%u_%u\n", shader_is_pshader_version(This->baseShader.hex_version)? "ps": "vs",
+ WINED3DSHADER_VERSION_MAJOR(This->baseShader.hex_version),
+ WINED3DSHADER_VERSION_MINOR(This->baseShader.hex_version));
+ ++pToken;
+ ++len;
+ continue;
+ }
+ if (shader_is_comment(*pToken)) /* comment */
+ {
+ DWORD comment_len = (*pToken & WINED3DSI_COMMENTSIZE_MASK) >> WINED3DSI_COMMENTSIZE_SHIFT;
+ ++pToken;
+ TRACE("//%s\n", (const char*)pToken);
+ pToken += comment_len;
+ len += comment_len + 1;
+ continue;
+ }
+ opcode_token = *pToken++;
+ curOpcode = shader_get_opcode(This->baseShader.shader_ins, This->baseShader.hex_version, opcode_token);
+ len++;
+
+ if (!curOpcode)
+ {
+ int tokens_read;
+ FIXME("Unrecognized opcode: token=0x%08x\n", opcode_token);
+ tokens_read = shader_skip_unrecognized(pToken, This->baseShader.hex_version);
+ pToken += tokens_read;
+ len += tokens_read;
+ }
+ else
+ {
+ if (curOpcode->opcode == WINED3DSIO_DCL)
+ {
+ DWORD usage = *pToken;
+ DWORD param = *(pToken + 1);
+
+ shader_dump_decl_usage(usage, param, This->baseShader.hex_version);
+ shader_dump_ins_modifiers(param);
+ TRACE(" ");
+ shader_dump_param(param, 0, 0, This->baseShader.hex_version);
+ pToken += 2;
+ len += 2;
}
- if (shader_is_comment(*pToken)) { /** comment */
- DWORD comment_len = (*pToken & WINED3DSI_COMMENTSIZE_MASK) >> WINED3DSI_COMMENTSIZE_SHIFT;
- ++pToken;
- TRACE("//%s\n", (const char*)pToken);
- pToken += comment_len;
- len += comment_len + 1;
- continue;
+ else if (curOpcode->opcode == WINED3DSIO_DEF)
+ {
+ unsigned int offset = shader_get_float_offset(*pToken);
+
+ TRACE("def c%u = %f, %f, %f, %f", offset,
+ *(const float *)(pToken + 1),
+ *(const float *)(pToken + 2),
+ *(const float *)(pToken + 3),
+ *(const float *)(pToken + 4));
+ pToken += 5;
+ len += 5;
}
- opcode_token = *pToken++;
- curOpcode = shader_get_opcode(iface, opcode_token);
- len++;
-
- if (NULL == curOpcode) {
+ else if (curOpcode->opcode == WINED3DSIO_DEFI)
+ {
+ TRACE("defi i%u = %d, %d, %d, %d", *pToken & WINED3DSP_REGNUM_MASK,
+ *(pToken + 1),
+ *(pToken + 2),
+ *(pToken + 3),
+ *(pToken + 4));
+ pToken += 5;
+ len += 5;
+ }
+ else if (curOpcode->opcode == WINED3DSIO_DEFB)
+ {
+ TRACE("defb b%u = %s", *pToken & WINED3DSP_REGNUM_MASK,
+ *(pToken + 1)? "true": "false");
+ pToken += 2;
+ len += 2;
+ }
+ else
+ {
+ DWORD param, addr_token;
int tokens_read;
- FIXME("Unrecognized opcode: token=0x%08x\n", opcode_token);
- tokens_read = shader_skip_unrecognized(iface, pToken);
- pToken += tokens_read;
- len += tokens_read;
-
- } else {
- if (curOpcode->opcode == WINED3DSIO_DCL) {
-
- DWORD usage = *pToken;
- DWORD param = *(pToken + 1);
-
- shader_dump_decl_usage(This, usage, param);
- shader_dump_ins_modifiers(param);
- TRACE(" ");
- shader_dump_param(iface, param, 0, 0);
- pToken += 2;
- len += 2;
-
- } else if (curOpcode->opcode == WINED3DSIO_DEF) {
-
- unsigned int offset = shader_get_float_offset(*pToken);
-
- TRACE("def c%u = %f, %f, %f, %f", offset,
- *(const float *)(pToken + 1),
- *(const float *)(pToken + 2),
- *(const float *)(pToken + 3),
- *(const float *)(pToken + 4));
-
- pToken += 5;
- len += 5;
- } else if (curOpcode->opcode == WINED3DSIO_DEFI) {
-
- TRACE("defi i%u = %d, %d, %d, %d", *pToken & WINED3DSP_REGNUM_MASK,
- *(pToken + 1),
- *(pToken + 2),
- *(pToken + 3),
- *(pToken + 4));
-
- pToken += 5;
- len += 5;
-
- } else if (curOpcode->opcode == WINED3DSIO_DEFB) {
-
- TRACE("defb b%u = %s", *pToken & WINED3DSP_REGNUM_MASK,
- *(pToken + 1)? "true": "false");
-
- pToken += 2;
- len += 2;
-
- } else {
- DWORD param, addr_token;
- int tokens_read;
-
- /* Print out predication source token first - it follows
- * the destination token. */
- if (opcode_token & WINED3DSHADER_INSTRUCTION_PREDICATED) {
- TRACE("(");
- shader_dump_param(iface, *(pToken + 2), 0, 1);
- TRACE(") ");
- }
- if (opcode_token & WINED3DSI_COISSUE) {
- /* PixWin marks instructions with the coissue flag with a '+' */
- TRACE("+");
- }
-
- TRACE("%s", curOpcode->name);
-
- if (curOpcode->opcode == WINED3DSIO_IFC ||
- curOpcode->opcode == WINED3DSIO_BREAKC) {
-
- DWORD op = (opcode_token & INST_CONTROLS_MASK) >> INST_CONTROLS_SHIFT;
- switch (op) {
- case COMPARISON_GT: TRACE("_gt"); break;
- case COMPARISON_EQ: TRACE("_eq"); break;
- case COMPARISON_GE: TRACE("_ge"); break;
- case COMPARISON_LT: TRACE("_lt"); break;
- case COMPARISON_NE: TRACE("_ne"); break;
- case COMPARISON_LE: TRACE("_le"); break;
- default:
- TRACE("_(%u)", op);
- }
- } else if (curOpcode->opcode == WINED3DSIO_TEX &&
- This->baseShader.hex_version >= WINED3DPS_VERSION(2,0)) {
- if(opcode_token & WINED3DSI_TEXLD_PROJECT) TRACE("p");
- }
-
- /* Destination token */
- if (curOpcode->dst_token) {
-
- /* Destination token */
- tokens_read = shader_get_param(iface, pToken, ¶m, &addr_token);
- pToken += tokens_read;
- len += tokens_read;
+ /* Print out predication source token first - it follows
+ * the destination token. */
+ if (opcode_token & WINED3DSHADER_INSTRUCTION_PREDICATED)
+ {
+ TRACE("(");
+ shader_dump_param(*(pToken + 2), 0, 1, This->baseShader.hex_version);
+ TRACE(") ");
+ }
+ if (opcode_token & WINED3DSI_COISSUE)
+ {
+ /* PixWin marks instructions with the coissue flag with a '+' */
+ TRACE("+");
+ }
- shader_dump_ins_modifiers(param);
- TRACE(" ");
- shader_dump_param(iface, param, addr_token, 0);
+ TRACE("%s", curOpcode->name);
+
+ if (curOpcode->opcode == WINED3DSIO_IFC
+ || curOpcode->opcode == WINED3DSIO_BREAKC)
+ {
+ DWORD op = (opcode_token & INST_CONTROLS_MASK) >> INST_CONTROLS_SHIFT;
+
+ switch (op)
+ {
+ case COMPARISON_GT: TRACE("_gt"); break;
+ case COMPARISON_EQ: TRACE("_eq"); break;
+ case COMPARISON_GE: TRACE("_ge"); break;
+ case COMPARISON_LT: TRACE("_lt"); break;
+ case COMPARISON_NE: TRACE("_ne"); break;
+ case COMPARISON_LE: TRACE("_le"); break;
+ default: TRACE("_(%u)", op);
}
+ }
+ else if (curOpcode->opcode == WINED3DSIO_TEX
+ && This->baseShader.hex_version >= WINED3DPS_VERSION(2,0)
+ && (opcode_token & WINED3DSI_TEXLD_PROJECT))
+ {
+ TRACE("p");
+ }
- /* Predication token - already printed out, just skip it */
- if (opcode_token & WINED3DSHADER_INSTRUCTION_PREDICATED) {
- pToken++;
- len++;
- }
+ /* Destination token */
+ if (curOpcode->dst_token)
+ {
+ tokens_read = shader_get_param(pToken, This->baseShader.hex_version, ¶m, &addr_token);
+ pToken += tokens_read;
+ len += tokens_read;
- /* Other source tokens */
- for (i = curOpcode->dst_token; i < curOpcode->num_params; ++i) {
+ shader_dump_ins_modifiers(param);
+ TRACE(" ");
+ shader_dump_param(param, addr_token, 0, This->baseShader.hex_version);
+ }
- tokens_read = shader_get_param(iface, pToken, ¶m, &addr_token);
- pToken += tokens_read;
- len += tokens_read;
+ /* Predication token - already printed out, just skip it */
+ if (opcode_token & WINED3DSHADER_INSTRUCTION_PREDICATED)
+ {
+ pToken++;
+ len++;
+ }
- TRACE((i == 0)? " " : ", ");
- shader_dump_param(iface, param, addr_token, 1);
- }
+ /* Other source tokens */
+ for (i = curOpcode->dst_token; i < curOpcode->num_params; ++i)
+ {
+ tokens_read = shader_get_param(pToken, This->baseShader.hex_version, ¶m, &addr_token);
+ pToken += tokens_read;
+ len += tokens_read;
+
+ TRACE((i == 0)? " " : ", ");
+ shader_dump_param(param, addr_token, 1, This->baseShader.hex_version);
}
- TRACE("\n");
}
+ TRACE("\n");
}
- This->baseShader.functionLength = (len + 1) * sizeof(DWORD);
- } else {
- This->baseShader.functionLength = 1; /* no Function defined use fixed function vertex processing */
}
+ This->baseShader.functionLength = (len + 1) * sizeof(DWORD);
}
static const SHADER_HANDLER shader_none_instruction_handler_table[WINED3DSIH_TABLE_SIZE] = {0};
static void shader_none_deselect_depth_blt(IWineD3DDevice *iface) {}
static void shader_none_load_constants(IWineD3DDevice *iface, char usePS, char useVS) {}
static void shader_none_cleanup(IWineD3DDevice *iface) {}
-static void shader_none_color_correction(SHADER_OPCODE_ARG* arg) {}
+static void shader_none_color_correction(const struct SHADER_OPCODE_ARG *arg, struct color_fixup_desc fixup) {}
static void shader_none_destroy(IWineD3DBaseShader *iface) {}
static HRESULT shader_none_alloc(IWineD3DDevice *iface) {return WINED3D_OK;}
static void shader_none_free(IWineD3DDevice *iface) {}
static BOOL shader_none_dirty_const(IWineD3DDevice *iface) {return FALSE;}
-static void shader_none_generate_pshader(IWineD3DPixelShader *iface, SHADER_BUFFER *buffer) {
+static GLuint shader_none_generate_pshader(IWineD3DPixelShader *iface, SHADER_BUFFER *buffer) {
FIXME("NONE shader backend asked to generate a pixel shader\n");
+ return 0;
}
static void shader_none_generate_vshader(IWineD3DVertexShader *iface, SHADER_BUFFER *buffer) {
FIXME("NONE shader backend asked to generate a vertex shader\n");
}
#define GLINFO_LOCATION (*gl_info)
-static void shader_none_get_caps(WINED3DDEVTYPE devtype, WineD3D_GL_Info *gl_info, struct shader_caps *pCaps) {
+static void shader_none_get_caps(WINED3DDEVTYPE devtype, const WineD3D_GL_Info *gl_info, struct shader_caps *pCaps)
+{
/* Set the shader caps to 0 for the none shader backend */
pCaps->VertexShaderVersion = 0;
pCaps->PixelShaderVersion = 0;
pCaps->PixelShader1xMaxValue = 0.0;
}
#undef GLINFO_LOCATION
-static BOOL shader_none_conv_supported(WINED3DFORMAT fmt) {
- TRACE("Checking shader format support for format %s", debug_d3dformat(fmt));
- switch(fmt) {
- /* Faked to make some apps happy. */
- case WINED3DFMT_V8U8:
- case WINED3DFMT_V16U16:
- case WINED3DFMT_L6V5U5:
- case WINED3DFMT_X8L8V8U8:
- case WINED3DFMT_Q8W8V8U8:
- TRACE("[OK]\n");
- return TRUE;
- default:
- TRACE("[FAILED]\n");
- return FALSE;
+static BOOL shader_none_color_fixup_supported(struct color_fixup_desc fixup)
+{
+ if (TRACE_ON(d3d_shader) && TRACE_ON(d3d))
+ {
+ TRACE("Checking support for fixup:\n");
+ dump_color_fixup_desc(fixup);
}
+
+ /* Faked to make some apps happy. */
+ if (!is_yuv_fixup(fixup))
+ {
+ TRACE("[OK]\n");
+ return TRUE;
+ }
+
+ TRACE("[FAILED]\n");
+ return FALSE;
}
const shader_backend_t none_shader_backend = {
shader_none_generate_pshader,
shader_none_generate_vshader,
shader_none_get_caps,
- shader_none_conv_supported
+ shader_none_color_fixup_supported,
};
/* *******************************************
WINE_DEFAULT_DEBUG_CHANNEL(d3d_texture);
#define GLINFO_LOCATION This->resource.wineD3DDevice->adapter->gl_info
-/* *******************************************
- IWineD3DBaseTexture IUnknown parts follow
- ******************************************* */
-HRESULT WINAPI IWineD3DBaseTextureImpl_QueryInterface(IWineD3DBaseTexture *iface, REFIID riid, LPVOID *ppobj)
+void basetexture_cleanup(IWineD3DBaseTexture *iface)
{
- IWineD3DBaseTextureImpl *This = (IWineD3DBaseTextureImpl *)iface;
- TRACE("(%p)->(%s,%p)\n",This,debugstr_guid(riid),ppobj);
- if (IsEqualGUID(riid, &IID_IUnknown)
- || IsEqualGUID(riid, &IID_IWineD3DBase)
- || IsEqualGUID(riid, &IID_IWineD3DResource)
- || IsEqualGUID(riid, &IID_IWineD3DBaseTexture)) {
- IUnknown_AddRef(iface);
- *ppobj = This;
- return S_OK;
- }
- *ppobj = NULL;
- return E_NOINTERFACE;
-}
-
-ULONG WINAPI IWineD3DBaseTextureImpl_AddRef(IWineD3DBaseTexture *iface) {
- IWineD3DBaseTextureImpl *This = (IWineD3DBaseTextureImpl *)iface;
- ULONG ref = InterlockedIncrement(&This->resource.ref);
-
- TRACE("(%p) : AddRef increasing from %d\n", This,ref - 1);
- return ref;
-}
-
-ULONG WINAPI IWineD3DBaseTextureImpl_Release(IWineD3DBaseTexture *iface) {
- IWineD3DBaseTextureImpl *This = (IWineD3DBaseTextureImpl *)iface;
- ULONG ref = InterlockedDecrement(&This->resource.ref);
- TRACE("(%p) : Releasing from %d\n", This, ref + 1);
- if (ref == 0) {
- IWineD3DBaseTextureImpl_CleanUp(iface);
- HeapFree(GetProcessHeap(), 0, This);
- }
- return ref;
-}
-
-/* class static */
-void IWineD3DBaseTextureImpl_CleanUp(IWineD3DBaseTexture *iface) {
IWineD3DBaseTextureImpl *This = (IWineD3DBaseTextureImpl *)iface;
IWineD3DDeviceImpl *device = This->resource.wineD3DDevice;
glDeleteTextures(1, &This->baseTexture.textureName);
LEAVE_GL();
}
- IWineD3DResourceImpl_CleanUp((IWineD3DResource *)iface);
-}
-/* ****************************************************
- IWineD3DBaseTexture IWineD3DResource parts follow
- **************************************************** */
-HRESULT WINAPI IWineD3DBaseTextureImpl_GetDevice(IWineD3DBaseTexture *iface, IWineD3DDevice** ppDevice) {
- return IWineD3DResourceImpl_GetDevice((IWineD3DResource *)iface, ppDevice);
+ resource_cleanup((IWineD3DResource *)iface);
}
-HRESULT WINAPI IWineD3DBaseTextureImpl_SetPrivateData(IWineD3DBaseTexture *iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) {
- return IWineD3DResourceImpl_SetPrivateData((IWineD3DResource *)iface, refguid, pData, SizeOfData, Flags);
-}
-
-HRESULT WINAPI IWineD3DBaseTextureImpl_GetPrivateData(IWineD3DBaseTexture *iface, REFGUID refguid, void* pData, DWORD* pSizeOfData) {
- return IWineD3DResourceImpl_GetPrivateData((IWineD3DResource *)iface, refguid, pData, pSizeOfData);
-}
-
-HRESULT WINAPI IWineD3DBaseTextureImpl_FreePrivateData(IWineD3DBaseTexture *iface, REFGUID refguid) {
- return IWineD3DResourceImpl_FreePrivateData((IWineD3DResource *)iface, refguid);
-}
-
-DWORD WINAPI IWineD3DBaseTextureImpl_SetPriority(IWineD3DBaseTexture *iface, DWORD PriorityNew) {
- return IWineD3DResourceImpl_SetPriority((IWineD3DResource *)iface, PriorityNew);
-}
-
-DWORD WINAPI IWineD3DBaseTextureImpl_GetPriority(IWineD3DBaseTexture *iface) {
- return IWineD3DResourceImpl_GetPriority((IWineD3DResource *)iface);
-}
-
-void WINAPI IWineD3DBaseTextureImpl_PreLoad(IWineD3DBaseTexture *iface) {
- IWineD3DResourceImpl_PreLoad((IWineD3DResource *)iface);
-}
-
-void WINAPI IWineD3DBaseTextureImpl_UnLoad(IWineD3DBaseTexture *iface) {
+void basetexture_unload(IWineD3DBaseTexture *iface)
+{
IWineD3DTextureImpl *This = (IWineD3DTextureImpl *)iface;
IWineD3DDeviceImpl *device = This->resource.wineD3DDevice;
This->baseTexture.dirty = TRUE;
}
-WINED3DRESOURCETYPE WINAPI IWineD3DBaseTextureImpl_GetType(IWineD3DBaseTexture *iface) {
- return IWineD3DResourceImpl_GetType((IWineD3DResource *)iface);
-}
-
-HRESULT WINAPI IWineD3DBaseTextureImpl_GetParent(IWineD3DBaseTexture *iface, IUnknown **pParent) {
- return IWineD3DResourceImpl_GetParent((IWineD3DResource *)iface, pParent);
-}
-
-/* ******************************************************
- IWineD3DBaseTexture IWineD3DBaseTexture parts follow
- ****************************************************** */
-
/* There is no OpenGL equivalent of setLOD, getLOD. All they do anyway is prioritize texture loading
* so just pretend that they work unless something really needs a failure. */
-DWORD WINAPI IWineD3DBaseTextureImpl_SetLOD(IWineD3DBaseTexture *iface, DWORD LODNew) {
+DWORD basetexture_set_lod(IWineD3DBaseTexture *iface, DWORD LODNew)
+{
IWineD3DBaseTextureImpl *This = (IWineD3DBaseTextureImpl *)iface;
if (This->resource.pool != WINED3DPOOL_MANAGED) {
return This->baseTexture.LOD;
}
-DWORD WINAPI IWineD3DBaseTextureImpl_GetLOD(IWineD3DBaseTexture *iface) {
+DWORD basetexture_get_lod(IWineD3DBaseTexture *iface)
+{
IWineD3DBaseTextureImpl *This = (IWineD3DBaseTextureImpl *)iface;
if (This->resource.pool != WINED3DPOOL_MANAGED) {
return This->baseTexture.LOD;
}
-DWORD WINAPI IWineD3DBaseTextureImpl_GetLevelCount(IWineD3DBaseTexture *iface) {
+DWORD basetexture_get_level_count(IWineD3DBaseTexture *iface)
+{
IWineD3DBaseTextureImpl *This = (IWineD3DBaseTextureImpl *)iface;
TRACE("(%p) : returning %d\n", This, This->baseTexture.levels);
return This->baseTexture.levels;
}
-HRESULT WINAPI IWineD3DBaseTextureImpl_SetAutoGenFilterType(IWineD3DBaseTexture *iface, WINED3DTEXTUREFILTERTYPE FilterType) {
+HRESULT basetexture_set_autogen_filter_type(IWineD3DBaseTexture *iface, WINED3DTEXTUREFILTERTYPE FilterType)
+{
IWineD3DBaseTextureImpl *This = (IWineD3DBaseTextureImpl *)iface;
IWineD3DDeviceImpl *device = This->resource.wineD3DDevice;
UINT textureDimensions = IWineD3DBaseTexture_GetTextureDimensions(iface);
return WINED3D_OK;
}
-WINED3DTEXTUREFILTERTYPE WINAPI IWineD3DBaseTextureImpl_GetAutoGenFilterType(IWineD3DBaseTexture *iface) {
+WINED3DTEXTUREFILTERTYPE basetexture_get_autogen_filter_type(IWineD3DBaseTexture *iface)
+{
IWineD3DBaseTextureImpl *This = (IWineD3DBaseTextureImpl *)iface;
FIXME("(%p) : stub\n", This);
if (!(This->resource.usage & WINED3DUSAGE_AUTOGENMIPMAP)) {
return This->baseTexture.filterType;
}
-void WINAPI IWineD3DBaseTextureImpl_GenerateMipSubLevels(IWineD3DBaseTexture *iface) {
+void basetexture_generate_mipmaps(IWineD3DBaseTexture *iface)
+{
IWineD3DBaseTextureImpl *This = (IWineD3DBaseTextureImpl *)iface;
/* TODO: implement filters using GL_SGI_generate_mipmaps http://oss.sgi.com/projects/ogl-sample/registry/SGIS/generate_mipmap.txt */
FIXME("(%p) : stub\n", This);
return ;
}
-/* Internal function, No d3d mapping */
-BOOL WINAPI IWineD3DBaseTextureImpl_SetDirty(IWineD3DBaseTexture *iface, BOOL dirty) {
+BOOL basetexture_set_dirty(IWineD3DBaseTexture *iface, BOOL dirty)
+{
BOOL old;
IWineD3DBaseTextureImpl *This = (IWineD3DBaseTextureImpl *)iface;
old = This->baseTexture.dirty;
return old;
}
-BOOL WINAPI IWineD3DBaseTextureImpl_GetDirty(IWineD3DBaseTexture *iface) {
+BOOL basetexture_get_dirty(IWineD3DBaseTexture *iface)
+{
IWineD3DBaseTextureImpl *This = (IWineD3DBaseTextureImpl *)iface;
return This->baseTexture.dirty;
}
-HRESULT WINAPI IWineD3DBaseTextureImpl_BindTexture(IWineD3DBaseTexture *iface) {
+HRESULT basetexture_bind(IWineD3DBaseTexture *iface)
+{
IWineD3DBaseTextureImpl *This = (IWineD3DBaseTextureImpl *)iface;
HRESULT hr = WINED3D_OK;
UINT textureDimensions;
return hr;
}
-UINT WINAPI IWineD3DBaseTextureImpl_GetTextureDimensions(IWineD3DBaseTexture *iface){
- IWineD3DBaseTextureImpl *This = (IWineD3DBaseTextureImpl *)iface;
- FIXME("(%p) : This shouldn't be called\n", This);
- return WINED3D_OK;
-}
-
-BOOL WINAPI IWineD3DBaseTextureImpl_IsCondNP2(IWineD3DBaseTexture *iface){
- IWineD3DBaseTextureImpl *This = (IWineD3DBaseTextureImpl *)iface;
- FIXME("(%p) : This shouldn't be called\n", This);
- return FALSE;
-}
-
-static inline GLenum warpLookupType(WINED3DSAMPLERSTATETYPE Type) {
- switch(Type) {
- case WINED3DSAMP_ADDRESSU:
- return GL_TEXTURE_WRAP_S;
- case WINED3DSAMP_ADDRESSV:
- return GL_TEXTURE_WRAP_T;
- case WINED3DSAMP_ADDRESSW:
- return GL_TEXTURE_WRAP_R;
- default:
- FIXME("Unexpected warp type %d\n", Type);
- return 0;
- }
-}
-
static inline void apply_wrap(const GLint textureDimensions, const DWORD state, const GLint type,
BOOL cond_np2) {
GLint wrapParm;
}
}
-void WINAPI IWineD3DBaseTextureImpl_ApplyStateChanges(IWineD3DBaseTexture *iface,
- const DWORD textureStates[WINED3D_HIGHEST_TEXTURE_STATE + 1],
- const DWORD samplerStates[WINED3D_HIGHEST_SAMPLER_STATE + 1]) {
+void basetexture_apply_state_changes(IWineD3DBaseTexture *iface,
+ const DWORD textureStates[WINED3D_HIGHEST_TEXTURE_STATE + 1],
+ const DWORD samplerStates[WINED3D_HIGHEST_SAMPLER_STATE + 1])
+{
IWineD3DBaseTextureImpl *This = (IWineD3DBaseTextureImpl *)iface;
DWORD state;
GLint textureDimensions = IWineD3DBaseTexture_GetTextureDimensions(iface);
if (state > WINED3DTEXF_ANISOTROPIC) {
FIXME("Unrecognized or unsupported MAGFILTER* value %d\n", state);
} else {
- glValue = (*This->baseTexture.magLookup)[state - WINED3DTEXF_NONE];
+ glValue = This->baseTexture.magLookup[state - WINED3DTEXF_NONE];
TRACE("ValueMAG=%d setting MAGFILTER to %x\n", state, glValue);
glTexParameteri(textureDimensions, GL_TEXTURE_MAG_FILTER, glValue);
/* We need to reset the Anisotropic filtering state when we change the mag filter to WINED3DTEXF_ANISOTROPIC (this seems a bit weird, check the documentation to see how it should be switched off. */
This->baseTexture.states[WINED3DTEXSTA_MINFILTER],
This->baseTexture.states[WINED3DTEXSTA_MIPFILTER]);
}
- glValue = (*This->baseTexture.minMipLookup)
+ glValue = This->baseTexture.minMipLookup
[min(max(samplerStates[WINED3DSAMP_MINFILTER],WINED3DTEXF_NONE), WINED3DTEXF_ANISOTROPIC)]
- [min(max(samplerStates[WINED3DSAMP_MIPFILTER],WINED3DTEXF_NONE), WINED3DTEXF_LINEAR)];
+ .mip[min(max(samplerStates[WINED3DSAMP_MIPFILTER],WINED3DTEXF_NONE), WINED3DTEXF_LINEAR)];
TRACE("ValueMIN=%d, ValueMIP=%d, setting MINFILTER to %x\n",
samplerStates[WINED3DSAMP_MINFILTER],
This->baseTexture.states[WINED3DTEXSTA_MAXANISOTROPY] = samplerStates[WINED3DSAMP_MAXANISOTROPY];
}
}
-
-
-static const IWineD3DBaseTextureVtbl IWineD3DBaseTexture_Vtbl =
-{
- /* IUnknown */
- IWineD3DBaseTextureImpl_QueryInterface,
- IWineD3DBaseTextureImpl_AddRef,
- IWineD3DBaseTextureImpl_Release,
- /* IWineD3DResource */
- IWineD3DBaseTextureImpl_GetParent,
- IWineD3DBaseTextureImpl_GetDevice,
- IWineD3DBaseTextureImpl_SetPrivateData,
- IWineD3DBaseTextureImpl_GetPrivateData,
- IWineD3DBaseTextureImpl_FreePrivateData,
- IWineD3DBaseTextureImpl_SetPriority,
- IWineD3DBaseTextureImpl_GetPriority,
- IWineD3DBaseTextureImpl_PreLoad,
- IWineD3DBaseTextureImpl_UnLoad,
- IWineD3DBaseTextureImpl_GetType,
- /*IWineD3DBaseTexture*/
- IWineD3DBaseTextureImpl_SetLOD,
- IWineD3DBaseTextureImpl_GetLOD,
- IWineD3DBaseTextureImpl_GetLevelCount,
- IWineD3DBaseTextureImpl_SetAutoGenFilterType,
- IWineD3DBaseTextureImpl_GetAutoGenFilterType,
- IWineD3DBaseTextureImpl_GenerateMipSubLevels,
- IWineD3DBaseTextureImpl_SetDirty,
- IWineD3DBaseTextureImpl_GetDirty,
- /* internal */
- IWineD3DBaseTextureImpl_BindTexture,
- IWineD3DBaseTextureImpl_GetTextureDimensions,
- IWineD3DBaseTextureImpl_IsCondNP2,
- IWineD3DBaseTextureImpl_ApplyStateChanges
-
-};
return WINED3D_OK;
}
-static HRESULT WINAPI IWineD3DClipperImpl_GetClipList(IWineD3DClipper *iface, RECT *Rect, RGNDATA *ClipList, DWORD *Size)
+static HRESULT WINAPI IWineD3DClipperImpl_GetClipList(IWineD3DClipper *iface, const RECT *Rect,
+ RGNDATA *ClipList, DWORD *Size)
{
IWineD3DClipperImpl *This = (IWineD3DClipperImpl *)iface;
TRACE("(%p,%p,%p,%p)\n", This, Rect, ClipList, Size);
}
}
-static HRESULT WINAPI IWineD3DClipperImpl_SetClipList(IWineD3DClipper *iface, RGNDATA *rgn, DWORD Flags)
+static HRESULT WINAPI IWineD3DClipperImpl_SetClipList(IWineD3DClipper *iface, const RGNDATA *rgn, DWORD Flags)
{
IWineD3DClipperImpl *This = (IWineD3DClipperImpl *)iface;
static int warned = 0;
* the alpha blend state changes with different render target formats
*/
if(oldFmt != newFmt) {
- const GlPixelFormatDesc *glDesc;
+ const struct GlPixelFormatDesc *glDesc;
const StaticPixelFormatDesc *old = getFormatDescEntry(oldFmt, NULL, NULL);
const StaticPixelFormatDesc *new = getFormatDescEntry(newFmt, &GLINFO_LOCATION, &glDesc);
IWineD3DCubeTexture IWineD3DResource parts follow
**************************************************** */
static HRESULT WINAPI IWineD3DCubeTextureImpl_GetDevice(IWineD3DCubeTexture *iface, IWineD3DDevice** ppDevice) {
- return IWineD3DResourceImpl_GetDevice((IWineD3DResource *)iface, ppDevice);
+ return resource_get_device((IWineD3DResource *)iface, ppDevice);
}
static HRESULT WINAPI IWineD3DCubeTextureImpl_SetPrivateData(IWineD3DCubeTexture *iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) {
- return IWineD3DResourceImpl_SetPrivateData((IWineD3DResource *)iface, refguid, pData, SizeOfData, Flags);
+ return resource_set_private_data((IWineD3DResource *)iface, refguid, pData, SizeOfData, Flags);
}
static HRESULT WINAPI IWineD3DCubeTextureImpl_GetPrivateData(IWineD3DCubeTexture *iface, REFGUID refguid, void* pData, DWORD* pSizeOfData) {
- return IWineD3DResourceImpl_GetPrivateData((IWineD3DResource *)iface, refguid, pData, pSizeOfData);
+ return resource_get_private_data((IWineD3DResource *)iface, refguid, pData, pSizeOfData);
}
static HRESULT WINAPI IWineD3DCubeTextureImpl_FreePrivateData(IWineD3DCubeTexture *iface, REFGUID refguid) {
- return IWineD3DResourceImpl_FreePrivateData((IWineD3DResource *)iface, refguid);
+ return resource_free_private_data((IWineD3DResource *)iface, refguid);
}
static DWORD WINAPI IWineD3DCubeTextureImpl_SetPriority(IWineD3DCubeTexture *iface, DWORD PriorityNew) {
- return IWineD3DResourceImpl_SetPriority((IWineD3DResource *)iface, PriorityNew);
+ return resource_set_priority((IWineD3DResource *)iface, PriorityNew);
}
static DWORD WINAPI IWineD3DCubeTextureImpl_GetPriority(IWineD3DCubeTexture *iface) {
- return IWineD3DResourceImpl_GetPriority((IWineD3DResource *)iface);
+ return resource_get_priority((IWineD3DResource *)iface);
}
static void WINAPI IWineD3DCubeTextureImpl_PreLoad(IWineD3DCubeTexture *iface) {
}
}
- IWineD3DBaseTextureImpl_UnLoad((IWineD3DBaseTexture *) iface);
+ basetexture_unload((IWineD3DBaseTexture *)iface);
}
static WINED3DRESOURCETYPE WINAPI IWineD3DCubeTextureImpl_GetType(IWineD3DCubeTexture *iface) {
- return IWineD3DResourceImpl_GetType((IWineD3DResource *)iface);
+ return resource_get_type((IWineD3DResource *)iface);
}
static HRESULT WINAPI IWineD3DCubeTextureImpl_GetParent(IWineD3DCubeTexture *iface, IUnknown **pParent) {
- return IWineD3DResourceImpl_GetParent((IWineD3DResource *)iface, pParent);
+ return resource_get_parent((IWineD3DResource *)iface, pParent);
}
/* ******************************************************
IWineD3DCubeTexture IWineD3DBaseTexture parts follow
****************************************************** */
static DWORD WINAPI IWineD3DCubeTextureImpl_SetLOD(IWineD3DCubeTexture *iface, DWORD LODNew) {
- return IWineD3DBaseTextureImpl_SetLOD((IWineD3DBaseTexture *)iface, LODNew);
+ return basetexture_set_lod((IWineD3DBaseTexture *)iface, LODNew);
}
static DWORD WINAPI IWineD3DCubeTextureImpl_GetLOD(IWineD3DCubeTexture *iface) {
- return IWineD3DBaseTextureImpl_GetLOD((IWineD3DBaseTexture *)iface);
+ return basetexture_get_lod((IWineD3DBaseTexture *)iface);
}
static DWORD WINAPI IWineD3DCubeTextureImpl_GetLevelCount(IWineD3DCubeTexture *iface) {
- return IWineD3DBaseTextureImpl_GetLevelCount((IWineD3DBaseTexture *)iface);
+ return basetexture_get_level_count((IWineD3DBaseTexture *)iface);
}
static HRESULT WINAPI IWineD3DCubeTextureImpl_SetAutoGenFilterType(IWineD3DCubeTexture *iface, WINED3DTEXTUREFILTERTYPE FilterType) {
- return IWineD3DBaseTextureImpl_SetAutoGenFilterType((IWineD3DBaseTexture *)iface, FilterType);
+ return basetexture_set_autogen_filter_type((IWineD3DBaseTexture *)iface, FilterType);
}
static WINED3DTEXTUREFILTERTYPE WINAPI IWineD3DCubeTextureImpl_GetAutoGenFilterType(IWineD3DCubeTexture *iface) {
- return IWineD3DBaseTextureImpl_GetAutoGenFilterType((IWineD3DBaseTexture *)iface);
+ return basetexture_get_autogen_filter_type((IWineD3DBaseTexture *)iface);
}
static void WINAPI IWineD3DCubeTextureImpl_GenerateMipSubLevels(IWineD3DCubeTexture *iface) {
- IWineD3DBaseTextureImpl_GenerateMipSubLevels((IWineD3DBaseTexture *)iface);
+ basetexture_generate_mipmaps((IWineD3DBaseTexture *)iface);
}
/* Internal function, No d3d mapping */
static BOOL WINAPI IWineD3DCubeTextureImpl_SetDirty(IWineD3DCubeTexture *iface, BOOL dirty) {
- return IWineD3DBaseTextureImpl_SetDirty((IWineD3DBaseTexture *)iface, dirty);
+ return basetexture_set_dirty((IWineD3DBaseTexture *)iface, dirty);
}
/* Internal function, No d3d mapping */
static BOOL WINAPI IWineD3DCubeTextureImpl_GetDirty(IWineD3DCubeTexture *iface) {
- return IWineD3DBaseTextureImpl_GetDirty((IWineD3DBaseTexture *)iface);
+ return basetexture_get_dirty((IWineD3DBaseTexture *)iface);
}
static HRESULT WINAPI IWineD3DCubeTextureImpl_BindTexture(IWineD3DCubeTexture *iface) {
TRACE("(%p) : relay to BaseTexture\n", This);
- hr = IWineD3DBaseTextureImpl_BindTexture((IWineD3DBaseTexture *)iface);
+ hr = basetexture_bind((IWineD3DBaseTexture *)iface);
if (set_gl_texture_desc && SUCCEEDED(hr)) {
UINT i, j;
for (i = 0; i < This->baseTexture.levels; ++i) {
const DWORD textureStates[WINED3D_HIGHEST_TEXTURE_STATE + 1],
const DWORD samplerStates[WINED3D_HIGHEST_SAMPLER_STATE + 1]) {
TRACE("(%p) : relay to BaseTexture\n", iface);
- IWineD3DBaseTextureImpl_ApplyStateChanges((IWineD3DBaseTexture *)iface, textureStates, samplerStates);
+ basetexture_apply_state_changes((IWineD3DBaseTexture *)iface, textureStates, samplerStates);
}
}
}
}
- IWineD3DBaseTextureImpl_CleanUp((IWineD3DBaseTexture *) iface);
+ basetexture_cleanup((IWineD3DBaseTexture *)iface);
/* finally delete the object */
HeapFree(GetProcessHeap(), 0, This);
}
};
/* static function declarations */
-static void WINAPI IWineD3DDeviceImpl_AddResource(IWineD3DDevice *iface, IWineD3DResource *resource);
+static void IWineD3DDeviceImpl_AddResource(IWineD3DDevice *iface, IWineD3DResource *resource);
/* helper macros */
#define D3DMEMCHECK(object, ppResult) if(NULL == object) { *ppResult = NULL; WARN("Out of memory\n"); return WINED3DERR_OUTOFVIDEOMEMORY;}
object->num_contained_ps_consts_f = GL_LIMITS(pshader_constantsF);
for (i = 0; i < MAX_CONST_B; ++i) {
object->contained_ps_consts_b[i] = i;
- object->changed.pixelShaderConstantsB[i] = TRUE;
+ object->changed.pixelShaderConstantsB |= (1 << i);
}
object->num_contained_ps_consts_b = MAX_CONST_B;
for (i = 0; i < MAX_CONST_I; ++i) {
object->contained_ps_consts_i[i] = i;
- object->changed.pixelShaderConstantsI[i] = TRUE;
+ object->changed.pixelShaderConstantsI |= (1 << i);
}
object->num_contained_ps_consts_i = MAX_CONST_I;
}
object->num_contained_vs_consts_f = GL_LIMITS(vshader_constantsF);
for (i = 0; i < MAX_CONST_B; ++i) {
- object->changed.vertexShaderConstantsB[i] = TRUE;
object->contained_vs_consts_b[i] = i;
+ object->changed.vertexShaderConstantsB |= (1 << i);
}
object->num_contained_vs_consts_b = MAX_CONST_B;
for (i = 0; i < MAX_CONST_I; ++i) {
- object->changed.vertexShaderConstantsI[i] = TRUE;
object->contained_vs_consts_i[i] = i;
+ object->changed.vertexShaderConstantsI |= (1 << i);
}
object->num_contained_vs_consts_i = MAX_CONST_I;
for (i = 0; i < NUM_SAVEDVERTEXSTATES_R; i++) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
IWineD3DSurfaceImpl *object; /*NOTE: impl ref allowed since this is a create function */
unsigned int Size = 1;
- const GlPixelFormatDesc *glDesc;
+ const struct GlPixelFormatDesc *glDesc;
const StaticPixelFormatDesc *tableEntry = getFormatDescEntry(Format, &GLINFO_LOCATION, &glDesc);
UINT mul_4w, mul_4h;
TRACE("(%p) Create surface\n",This);
HRESULT hr;
unsigned int pow2Width;
unsigned int pow2Height;
- const GlPixelFormatDesc *glDesc;
+ const struct GlPixelFormatDesc *glDesc;
getFormatDescEntry(Format, &GLINFO_LOCATION, &glDesc);
TRACE("(%p) : Width %d, Height %d, Levels %d, Usage %#x\n", This, Width, Height, Levels, Usage);
object->height = Height;
if(glDesc->Flags & WINED3DFMT_FLAG_FILTERING) {
- object->baseTexture.minMipLookup = &minMipLookup;
- object->baseTexture.magLookup = &magLookup;
+ object->baseTexture.minMipLookup = minMipLookup;
+ object->baseTexture.magLookup = magLookup;
} else {
- object->baseTexture.minMipLookup = &minMipLookup_noFilter;
- object->baseTexture.magLookup = &magLookup_noFilter;
+ object->baseTexture.minMipLookup = minMipLookup_noFilter;
+ object->baseTexture.magLookup = magLookup_noFilter;
}
/** Non-power2 support **/
object->baseTexture.pow2Matrix[15] = 1.0;
object->target = GL_TEXTURE_2D;
object->cond_np2 = TRUE;
- object->baseTexture.minMipLookup = &minMipLookup_noFilter;
+ object->baseTexture.minMipLookup = minMipLookup_noFilter;
} else if(GL_SUPPORT(ARB_TEXTURE_RECTANGLE) &&
(Width != pow2Width || Height != pow2Height) &&
!((Format == WINED3DFMT_P8) && GL_SUPPORT(EXT_PALETTED_TEXTURE) && (wined3d_settings.rendertargetlock_mode == RTL_READTEX || wined3d_settings.rendertargetlock_mode == RTL_TEXTEX)))
object->baseTexture.pow2Matrix[15] = 1.0;
object->target = GL_TEXTURE_RECTANGLE_ARB;
object->cond_np2 = TRUE;
- object->baseTexture.minMipLookup = &minMipLookup_noFilter;
+ object->baseTexture.minMipLookup = minMipLookup_noFilter;
} else {
object->baseTexture.pow2Matrix[0] = (((float)Width) / ((float)pow2Width));
object->baseTexture.pow2Matrix[5] = (((float)Height) / ((float)pow2Height));
tmpW = max(1, tmpW >> 1);
tmpH = max(1, tmpH >> 1);
}
- object->baseTexture.shader_conversion_group = glDesc->conversion_group;
+ object->baseTexture.shader_color_fixup = glDesc->color_fixup;
TRACE("(%p) : Created texture %p\n", This, object);
return WINED3D_OK;
UINT tmpW;
UINT tmpH;
UINT tmpD;
- const GlPixelFormatDesc *glDesc;
+ const struct GlPixelFormatDesc *glDesc;
getFormatDescEntry(Format, &GLINFO_LOCATION, &glDesc);
TRACE("(%p) : W(%d) H(%d) D(%d), Lvl(%d) Usage(%d), Fmt(%u,%s), Pool(%s)\n", This, Width, Height,
Depth, Levels, Usage, Format, debug_d3dformat(Format), debug_d3dpool(Pool));
- object->width = Width;
- object->height = Height;
- object->depth = Depth;
-
/* Is NP2 support for volumes needed? */
object->baseTexture.pow2Matrix[ 0] = 1.0;
object->baseTexture.pow2Matrix[ 5] = 1.0;
object->baseTexture.pow2Matrix[15] = 1.0;
if(glDesc->Flags & WINED3DFMT_FLAG_FILTERING) {
- object->baseTexture.minMipLookup = &minMipLookup;
- object->baseTexture.magLookup = &magLookup;
+ object->baseTexture.minMipLookup = minMipLookup;
+ object->baseTexture.magLookup = magLookup;
} else {
- object->baseTexture.minMipLookup = &minMipLookup_noFilter;
- object->baseTexture.magLookup = &magLookup_noFilter;
+ object->baseTexture.minMipLookup = minMipLookup_noFilter;
+ object->baseTexture.magLookup = magLookup_noFilter;
}
/* Calculate levels for mip mapping */
tmpH = max(1, tmpH >> 1);
tmpD = max(1, tmpD >> 1);
}
- object->baseTexture.shader_conversion_group = glDesc->conversion_group;
+ object->baseTexture.shader_color_fixup = glDesc->color_fixup;
*ppVolumeTexture = (IWineD3DVolumeTexture *) object;
TRACE("(%p) : Created volume texture %p\n", This, object);
UINT tmpW;
HRESULT hr;
unsigned int pow2EdgeLength;
- const GlPixelFormatDesc *glDesc;
+ const struct GlPixelFormatDesc *glDesc;
getFormatDescEntry(Format, &GLINFO_LOCATION, &glDesc);
/* TODO: It should only be possible to create textures for formats
pow2EdgeLength = 1;
while (pow2EdgeLength < EdgeLength) pow2EdgeLength <<= 1;
- object->edgeLength = EdgeLength;
-
if (GL_SUPPORT(ARB_TEXTURE_NON_POWER_OF_TWO)) {
/* Precalculated scaling for 'faked' non power of two texture coords */
object->baseTexture.pow2Matrix[ 0] = 1.0;
}
if(glDesc->Flags & WINED3DFMT_FLAG_FILTERING) {
- object->baseTexture.minMipLookup = &minMipLookup;
- object->baseTexture.magLookup = &magLookup;
+ object->baseTexture.minMipLookup = minMipLookup;
+ object->baseTexture.magLookup = magLookup;
} else {
- object->baseTexture.minMipLookup = &minMipLookup_noFilter;
- object->baseTexture.magLookup = &magLookup_noFilter;
+ object->baseTexture.minMipLookup = minMipLookup_noFilter;
+ object->baseTexture.magLookup = magLookup_noFilter;
}
/* Calculate levels for mip mapping */
}
tmpW = max(1, tmpW >> 1);
}
- object->baseTexture.shader_conversion_group = glDesc->conversion_group;
+ object->baseTexture.shader_color_fixup = glDesc->color_fixup;
TRACE("(%p) : Created Cube Texture %p\n", This, object);
*ppCubeTexture = (IWineD3DCubeTexture *) object;
if(GL_SUPPORT(ARB_OCCLUSION_QUERY)) {
TRACE("(%p) Allocating data for an occlusion query\n", This);
+
+ ActivateContext(This, This->lastActiveRenderTarget, CTXUSAGE_RESOURCELOAD);
+ ENTER_GL();
GL_EXTCALL(glGenQueriesARB(1, &((WineQueryOcclusionData *)(object->extendedData))->queryId));
+ LEAVE_GL();
break;
}
case WINED3DQUERYTYPE_EVENT:
object->extendedData = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(WineQueryEventData));
((WineQueryEventData *)(object->extendedData))->ctx = This->activeContext;
+ ActivateContext(This, This->lastActiveRenderTarget, CTXUSAGE_RESOURCELOAD);
+ ENTER_GL();
if(GL_SUPPORT(APPLE_FENCE)) {
GL_EXTCALL(glGenFencesAPPLE(1, &((WineQueryEventData *)(object->extendedData))->fenceId));
checkGLcall("glGenFencesAPPLE");
GL_EXTCALL(glGenFencesNV(1, &((WineQueryEventData *)(object->extendedData))->fenceId));
checkGLcall("glGenFencesNV");
}
+ LEAVE_GL();
break;
case WINED3DQUERYTYPE_VCACHE:
return exStyle;
}
-static void WINAPI IWineD3DDeviceImpl_SetupFullscreenWindow(IWineD3DDevice *iface, HWND window, UINT w, UINT h) {
+static void IWineD3DDeviceImpl_SetupFullscreenWindow(IWineD3DDevice *iface, HWND window, UINT w, UINT h) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
LONG style, exStyle;
* window: Window to setup
*
*****************************************************************************/
-static void WINAPI IWineD3DDeviceImpl_RestoreWindow(IWineD3DDevice *iface, HWND window) {
+static void IWineD3DDeviceImpl_RestoreWindow(IWineD3DDevice *iface, HWND window) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
LONG style, exStyle;
return hr;
}
-static HRESULT WINAPI IWineD3DDeviceImpl_CreatePalette(IWineD3DDevice *iface, DWORD Flags, PALETTEENTRY *PalEnt, IWineD3DPalette **Palette, IUnknown *Parent) {
+static HRESULT WINAPI IWineD3DDeviceImpl_CreatePalette(IWineD3DDevice *iface, DWORD Flags,
+ const PALETTEENTRY *PalEnt, IWineD3DPalette **Palette, IUnknown *Parent)
+{
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface;
IWineD3DPaletteImpl *object;
HRESULT hr;
return;
}
-static HRESULT WINAPI IWineD3DDeviceImpl_SetDisplayMode(IWineD3DDevice *iface, UINT iSwapChain, WINED3DDISPLAYMODE* pMode) {
+static HRESULT WINAPI IWineD3DDeviceImpl_SetDisplayMode(IWineD3DDevice *iface, UINT iSwapChain,
+ const WINED3DDISPLAYMODE* pMode) {
DEVMODEW devmode;
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
LONG ret;
}
static HRESULT WINAPI IWineD3DDeviceImpl_MultiplyTransform(IWineD3DDevice *iface, WINED3DTRANSFORMSTATETYPE State, CONST WINED3DMATRIX* pMatrix) {
- WINED3DMATRIX *mat = NULL;
+ const WINED3DMATRIX *mat = NULL;
WINED3DMATRIX temp;
/* Note: Using 'updateStateBlock' rather than 'stateblock' in the code
TRACE("Set BOOL constant %u to %s\n", start + i, srcData[i]? "true":"false");
for (i = start; i < cnt + start; ++i) {
- This->updateStateBlock->changed.vertexShaderConstantsB[i] = TRUE;
+ This->updateStateBlock->changed.vertexShaderConstantsB |= (1 << i);
}
IWineD3DDeviceImpl_MarkStateDirty(This, STATE_VERTEXSHADERCONSTANT);
srcData[i*4], srcData[i*4+1], srcData[i*4+2], srcData[i*4+3]);
for (i = start; i < cnt + start; ++i) {
- This->updateStateBlock->changed.vertexShaderConstantsI[i] = TRUE;
+ This->updateStateBlock->changed.vertexShaderConstantsI |= (1 << i);
}
IWineD3DDeviceImpl_MarkStateDirty(This, STATE_VERTEXSHADERCONSTANT);
}
static void device_map_psamplers(IWineD3DDeviceImpl *This) {
- DWORD *sampler_tokens = ((IWineD3DPixelShaderImpl *)This->stateBlock->pixelShader)->baseShader.reg_maps.samplers;
+ const DWORD *sampler_tokens =
+ ((IWineD3DPixelShaderImpl *)This->stateBlock->pixelShader)->baseShader.reg_maps.samplers;
int i;
for (i = 0; i < MAX_FRAGMENT_SAMPLERS; ++i) {
}
}
-static BOOL device_unit_free_for_vs(IWineD3DDeviceImpl *This, DWORD *pshader_sampler_tokens, DWORD *vshader_sampler_tokens, int unit) {
+static BOOL device_unit_free_for_vs(IWineD3DDeviceImpl *This, const DWORD *pshader_sampler_tokens,
+ const DWORD *vshader_sampler_tokens, int unit)
+{
int current_mapping = This->rev_tex_unit_map[unit];
if (current_mapping == -1) {
}
static void device_map_vsamplers(IWineD3DDeviceImpl *This, BOOL ps) {
- DWORD *vshader_sampler_tokens = ((IWineD3DVertexShaderImpl *)This->stateBlock->vertexShader)->baseShader.reg_maps.samplers;
- DWORD *pshader_sampler_tokens = NULL;
+ const DWORD *vshader_sampler_tokens =
+ ((IWineD3DVertexShaderImpl *)This->stateBlock->vertexShader)->baseShader.reg_maps.samplers;
+ const DWORD *pshader_sampler_tokens = NULL;
int start = GL_LIMITS(combined_samplers) - 1;
int i;
IWineD3DPixelShaderImpl *pshader = (IWineD3DPixelShaderImpl *)This->stateBlock->pixelShader;
/* Make sure the shader's reg_maps are up to date. This is only relevant for 1.x pixelshaders. */
- IWineD3DPixelShader_CompileShader((IWineD3DPixelShader *)pshader);
+ IWineD3DPixelShader_UpdateSamplers((IWineD3DPixelShader *)pshader);
pshader_sampler_tokens = pshader->baseShader.reg_maps.samplers;
}
TRACE("Set BOOL constant %u to %s\n", start + i, srcData[i]? "true":"false");
for (i = start; i < cnt + start; ++i) {
- This->updateStateBlock->changed.pixelShaderConstantsB[i] = TRUE;
+ This->updateStateBlock->changed.pixelShaderConstantsB |= (1 << i);
}
IWineD3DDeviceImpl_MarkStateDirty(This, STATE_PIXELSHADERCONSTANT);
srcData[i*4], srcData[i*4+1], srcData[i*4+2], srcData[i*4+3]);
for (i = start; i < cnt + start; ++i) {
- This->updateStateBlock->changed.pixelShaderConstantsI[i] = TRUE;
+ This->updateStateBlock->changed.pixelShaderConstantsI |= (1 << i);
}
IWineD3DDeviceImpl_MarkStateDirty(This, STATE_PIXELSHADERCONSTANT);
}
#define copy_and_next(dest, src, size) memcpy(dest, src, size); dest += (size)
-static HRESULT
-process_vertices_strided(IWineD3DDeviceImpl *This, DWORD dwDestIndex, DWORD dwCount, WineDirect3DVertexStridedData *lpStrideData, IWineD3DVertexBufferImpl *dest, DWORD dwFlags) {
+static HRESULT process_vertices_strided(IWineD3DDeviceImpl *This, DWORD dwDestIndex, DWORD dwCount,
+ const WineDirect3DVertexStridedData *lpStrideData, IWineD3DVertexBufferImpl *dest, DWORD dwFlags)
+{
char *dest_ptr, *dest_conv = NULL, *dest_conv_addr = NULL;
unsigned int i;
DWORD DestFVF = dest->fvf;
return E_OUTOFMEMORY;
}
if(dest->vbo) {
- void *src;
+ const void *src;
GL_EXTCALL(glBindBufferARB(GL_ARRAY_BUFFER_ARB, dest->vbo));
checkGLcall("glBindBufferARB");
src = GL_EXTCALL(glMapBufferARB(GL_ARRAY_BUFFER_ARB, GL_READ_ONLY_ARB));
if ( ((DestFVF & WINED3DFVF_POSITION_MASK) == WINED3DFVF_XYZ ) ||
((DestFVF & WINED3DFVF_POSITION_MASK) == WINED3DFVF_XYZRHW ) ) {
/* The position first */
- float *p =
- (float *) (((char *) lpStrideData->u.s.position.lpData) + i * lpStrideData->u.s.position.dwStride);
+ const float *p =
+ (const float *)(lpStrideData->u.s.position.lpData + i * lpStrideData->u.s.position.dwStride);
float x, y, z, rhw;
TRACE("In: ( %06.2f %06.2f %06.2f )\n", p[0], p[1], p[2]);
if(dest_conv) dest_conv += sizeof(DWORD);
}
if (DestFVF & WINED3DFVF_NORMAL) {
- float *normal =
- (float *) (((float *) lpStrideData->u.s.normal.lpData) + i * lpStrideData->u.s.normal.dwStride);
+ const float *normal =
+ (const float *)(lpStrideData->u.s.normal.lpData + i * lpStrideData->u.s.normal.dwStride);
/* AFAIK this should go into the lighting information */
FIXME("Didn't expect the destination to have a normal\n");
copy_and_next(dest_ptr, normal, 3 * sizeof(float));
}
if (DestFVF & WINED3DFVF_DIFFUSE) {
- DWORD *color_d =
- (DWORD *) (((char *) lpStrideData->u.s.diffuse.lpData) + i * lpStrideData->u.s.diffuse.dwStride);
+ const DWORD *color_d =
+ (const DWORD *)(lpStrideData->u.s.diffuse.lpData + i * lpStrideData->u.s.diffuse.dwStride);
if(!color_d) {
static BOOL warned = FALSE;
if (DestFVF & WINED3DFVF_SPECULAR) {
/* What's the color value in the feedback buffer? */
- DWORD *color_s =
- (DWORD *) (((char *) lpStrideData->u.s.specular.lpData) + i * lpStrideData->u.s.specular.dwStride);
+ const DWORD *color_s =
+ (const DWORD *)(lpStrideData->u.s.specular.lpData + i * lpStrideData->u.s.specular.dwStride);
if(!color_s) {
static BOOL warned = FALSE;
}
for (tex_index = 0; tex_index < numTextures; tex_index++) {
- float *tex_coord =
- (float *) (((char *) lpStrideData->u.s.texCoords[tex_index].lpData) +
+ const float *tex_coord =
+ (const float *)(lpStrideData->u.s.texCoords[tex_index].lpData +
i * lpStrideData->u.s.texCoords[tex_index].dwStride);
if(!tex_coord) {
ERR("No source texture, but destination requests one\n");
}
}
for(i = 0; i < MAX_CONST_I; i++) {
- if(object->changed.vertexShaderConstantsI[i]) {
+ if (object->changed.vertexShaderConstantsI & (1 << i))
+ {
object->contained_vs_consts_i[object->num_contained_vs_consts_i] = i;
object->num_contained_vs_consts_i++;
}
}
for(i = 0; i < MAX_CONST_B; i++) {
- if(object->changed.vertexShaderConstantsB[i]) {
+ if (object->changed.vertexShaderConstantsB & (1 << i))
+ {
object->contained_vs_consts_b[object->num_contained_vs_consts_b] = i;
object->num_contained_vs_consts_b++;
}
}
for(i = 0; i < MAX_CONST_I; i++) {
- if(object->changed.pixelShaderConstantsI[i]) {
+ if (object->changed.pixelShaderConstantsI & (1 << i))
+ {
object->contained_ps_consts_i[object->num_contained_ps_consts_i] = i;
object->num_contained_ps_consts_i++;
}
}
for(i = 0; i < MAX_CONST_B; i++) {
- if(object->changed.pixelShaderConstantsB[i]) {
+ if (object->changed.pixelShaderConstantsB & (1 << i))
+ {
object->contained_ps_consts_b[object->num_contained_ps_consts_b] = i;
object->num_contained_ps_consts_b++;
}
unsigned int i;
WINED3DRECT curRect;
RECT vp_rect;
- WINED3DVIEWPORT *vp = &This->stateBlock->viewport;
+ const WINED3DVIEWPORT *vp = &This->stateBlock->viewport;
UINT drawable_width, drawable_height;
IWineD3DSurfaceImpl *depth_stencil = (IWineD3DSurfaceImpl *) This->stencilBufferTarget;
IWineD3DSwapChainImpl *swapchain = NULL;
/* Now process each rect in turn */
for (i = 0; i < Count; i++) {
/* Note gl uses lower left, width/height */
- IntersectRect((RECT *) &curRect, &vp_rect, (RECT *) &pRects[i]);
+ IntersectRect((RECT *)&curRect, &vp_rect, (const RECT *)&pRects[i]);
if(This->stateBlock->renderState[WINED3DRS_SCISSORTESTENABLE]) {
IntersectRect((RECT *) &curRect, (RECT *) &curRect, &This->stateBlock->scissorRect);
}
return WINED3D_OK;
}
-static HRESULT WINAPI IWineD3DDeviceImpl_DrawPrimitiveStrided (IWineD3DDevice *iface, WINED3DPRIMITIVETYPE PrimitiveType, UINT PrimitiveCount, WineDirect3DVertexStridedData *DrawPrimStrideData) {
+static HRESULT WINAPI IWineD3DDeviceImpl_DrawPrimitiveStrided(IWineD3DDevice *iface,
+ WINED3DPRIMITIVETYPE PrimitiveType, UINT PrimitiveCount,
+ const WineDirect3DVertexStridedData *DrawPrimStrideData)
+{
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface;
/* Mark the state dirty until we have nicer tracking
return WINED3D_OK;
}
-static HRESULT WINAPI IWineD3DDeviceImpl_DrawIndexedPrimitiveStrided(IWineD3DDevice *iface, WINED3DPRIMITIVETYPE PrimitiveType, UINT PrimitiveCount, WineDirect3DVertexStridedData *DrawPrimStrideData, UINT NumVertices, CONST void *pIndexData, WINED3DFORMAT IndexDataFormat) {
+static HRESULT WINAPI IWineD3DDeviceImpl_DrawIndexedPrimitiveStrided(IWineD3DDevice *iface,
+ WINED3DPRIMITIVETYPE PrimitiveType, UINT PrimitiveCount,
+ const WineDirect3DVertexStridedData *DrawPrimStrideData, UINT NumVertices, const void *pIndexData,
+ WINED3DFORMAT IndexDataFormat)
+{
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface;
DWORD idxSize = (IndexDataFormat == WINED3DFMT_INDEX32 ? 4 : 2);
static HRESULT WINAPI IWineD3DDeviceImpl_ValidateDevice(IWineD3DDevice *iface, DWORD* pNumPasses) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
IWineD3DBaseTextureImpl *texture;
- const GlPixelFormatDesc *gl_info;
+ const struct GlPixelFormatDesc *gl_info;
DWORD i;
TRACE("(%p) : %p\n", This, pNumPasses);
static HRESULT WINAPI IWineD3DDeviceImpl_SetSoftwareVertexProcessing(IWineD3DDevice *iface, BOOL bSoftware) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
- static BOOL showFixmes = TRUE;
- if (showFixmes) {
+ static BOOL warned;
+ if (!warned)
+ {
FIXME("(%p) : stub\n", This);
- showFixmes = FALSE;
+ warned = TRUE;
}
This->softwareVertexProcessing = bSoftware;
static BOOL WINAPI IWineD3DDeviceImpl_GetSoftwareVertexProcessing(IWineD3DDevice *iface) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
- static BOOL showFixmes = TRUE;
- if (showFixmes) {
+ static BOOL warned;
+ if (!warned)
+ {
FIXME("(%p) : stub\n", This);
- showFixmes = FALSE;
+ warned = TRUE;
}
return This->softwareVertexProcessing;
}
static HRESULT WINAPI IWineD3DDeviceImpl_SetNPatchMode(IWineD3DDevice *iface, float nSegments) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
- static BOOL showfixmes = TRUE;
+ static BOOL warned;
if(nSegments != 0.0f) {
- if( showfixmes) {
+ if (!warned)
+ {
FIXME("(%p) : stub nSegments(%f)\n", This, nSegments);
- showfixmes = FALSE;
+ warned = TRUE;
}
}
return WINED3D_OK;
static float WINAPI IWineD3DDeviceImpl_GetNPatchMode(IWineD3DDevice *iface) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
- static BOOL showfixmes = TRUE;
- if( showfixmes) {
+ static BOOL warned;
+ if (!warned)
+ {
FIXME("(%p) : stub returning(%f)\n", This, 0.0f);
- showfixmes = FALSE;
+ warned = TRUE;
}
return 0.0f;
}
return IWineD3DSurface_BltFast(pDestinationSurface,
pDestPoint ? pDestPoint->x : 0,
pDestPoint ? pDestPoint->y : 0,
- pSourceSurface, (RECT *) pSourceRect, 0);
+ pSourceSurface, pSourceRect, 0);
}
if (destFormat == WINED3DFMT_UNKNOWN) {
memset(&BltFx, 0, sizeof(BltFx));
BltFx.dwSize = sizeof(BltFx);
BltFx.u5.dwFillColor = argb_to_fmt(color, surface->resource.format);
- return IWineD3DSurface_Blt(pSurface, (RECT *) pRect, NULL, NULL, WINEDDBLT_COLORFILL, &BltFx, WINED3DTEXF_NONE);
+ return IWineD3DSurface_Blt(pSurface, (const RECT *)pRect, NULL, NULL,
+ WINEDDBLT_COLORFILL, &BltFx, WINED3DTEXF_NONE);
}
}
}
void stretch_rect_fbo(IWineD3DDevice *iface, IWineD3DSurface *src_surface, WINED3DRECT *src_rect,
- IWineD3DSurface *dst_surface, WINED3DRECT *dst_rect, const WINED3DTEXTUREFILTERTYPE filter, BOOL flip) {
+ IWineD3DSurface *dst_surface, WINED3DRECT *dst_rect, const WINED3DTEXTUREFILTERTYPE filter, BOOL flip)
+{
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
GLbitfield mask = GL_COLOR_BUFFER_BIT; /* TODO: Support blitting depth/stencil surfaces */
IWineD3DSwapChain *src_swapchain, *dst_swapchain;
This->cursorHeight = pSur->currentDesc.Height;
if (SUCCEEDED(IWineD3DSurface_LockRect(pCursorBitmap, &rect, NULL, WINED3DLOCK_READONLY)))
{
- const GlPixelFormatDesc *glDesc;
+ const struct GlPixelFormatDesc *glDesc;
const StaticPixelFormatDesc *tableEntry = getFormatDescEntry(WINED3DFMT_A8R8G8B8, &GLINFO_LOCATION, &glDesc);
char *mem, *bits = (char *)rect.pBits;
GLint intfmt = glDesc->glInternal;
return WINED3D_OK;
}
-static void updateSurfaceDesc(IWineD3DSurfaceImpl *surface, WINED3DPRESENT_PARAMETERS* pPresentationParameters) {
+static void updateSurfaceDesc(IWineD3DSurfaceImpl *surface, const WINED3DPRESENT_PARAMETERS* pPresentationParameters)
+{
IWineD3DDeviceImpl *This = surface->resource.wineD3DDevice; /* for GL_SUPPORT */
/* Reallocate proper memory for the front and back buffer and adjust their sizes */
return S_OK;
}
-static BOOL is_display_mode_supported(IWineD3DDeviceImpl *This, WINED3DPRESENT_PARAMETERS *pp) {
+static BOOL is_display_mode_supported(IWineD3DDeviceImpl *This, const WINED3DPRESENT_PARAMETERS *pp)
+{
UINT i, count;
WINED3DDISPLAYMODE m;
HRESULT hr;
TRACE("Relaying to swapchain\n");
if (IWineD3DDeviceImpl_GetSwapChain(iface, iSwapChain, &swapchain) == WINED3D_OK) {
- IWineD3DSwapChain_SetGammaRamp(swapchain, Flags, (WINED3DGAMMARAMP *)pRamp);
+ IWineD3DSwapChain_SetGammaRamp(swapchain, Flags, pRamp);
IWineD3DSwapChain_Release(swapchain);
}
return;
* any handles to other resource held by the caller must be closed
* (e.g. a texture should release all held surfaces because telling the device that it's been released.)
*****************************************************/
-static void WINAPI IWineD3DDeviceImpl_AddResource(IWineD3DDevice *iface, IWineD3DResource *resource){
+static void IWineD3DDeviceImpl_AddResource(IWineD3DDevice *iface, IWineD3DResource *resource){
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
TRACE("(%p) : Adding Resource %p\n", This, resource);
list_add_head(&This->resources, &((IWineD3DResourceImpl *) resource)->resource.resource_list_entry);
}
-static void WINAPI IWineD3DDeviceImpl_RemoveResource(IWineD3DDevice *iface, IWineD3DResource *resource){
+static void IWineD3DDeviceImpl_RemoveResource(IWineD3DDevice *iface, IWineD3DResource *resource){
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
TRACE("(%p) : Removing resource %p\n", This, resource);
static const struct blit_shader *select_blit_implementation(UINT Adapter, WINED3DDEVTYPE DeviceType);
/* lookup tables */
-int minLookup[MAX_LOOKUPS];
-int maxLookup[MAX_LOOKUPS];
+const int minLookup[MAX_LOOKUPS] =
+{
+ WINED3DTADDRESS_WRAP, /* WINELOOKUP_WARPPARAM */
+};
+
+const int maxLookup[MAX_LOOKUPS] =
+{
+ WINED3DTADDRESS_MIRRORONCE, /* WINELOOKUP_WARPPARAM */
+};
+
DWORD *stateLookup[MAX_LOOKUPS];
-DWORD minMipLookup[WINED3DTEXF_ANISOTROPIC + 1][WINED3DTEXF_LINEAR + 1];
-DWORD minMipLookup_noFilter[WINED3DTEXF_ANISOTROPIC + 1][WINED3DTEXF_LINEAR + 1] = {
- {GL_NEAREST, GL_NEAREST, GL_NEAREST},
- {GL_NEAREST, GL_NEAREST, GL_NEAREST},
- {GL_NEAREST, GL_NEAREST, GL_NEAREST},
- {GL_NEAREST, GL_NEAREST, GL_NEAREST},
+struct min_lookup minMipLookup[WINED3DTEXF_ANISOTROPIC + 1];
+const struct min_lookup minMipLookup_noFilter[WINED3DTEXF_ANISOTROPIC + 1] =
+{
+ {{GL_NEAREST, GL_NEAREST, GL_NEAREST}},
+ {{GL_NEAREST, GL_NEAREST, GL_NEAREST}},
+ {{GL_NEAREST, GL_NEAREST, GL_NEAREST}},
+ {{GL_NEAREST, GL_NEAREST, GL_NEAREST}},
};
-DWORD magLookup[WINED3DTEXF_ANISOTROPIC + 1];
-DWORD magLookup_noFilter[WINED3DTEXF_ANISOTROPIC + 1] = {
+GLenum magLookup[WINED3DTEXF_ANISOTROPIC + 1];
+const GLenum magLookup_noFilter[WINED3DTEXF_ANISOTROPIC + 1] =
+{
GL_NEAREST, GL_NEAREST, GL_NEAREST, GL_NEAREST
};
/* Set the shader type for this device, depending on the given capabilities,
* the device type, and the user preferences in wined3d_settings */
-void select_shader_mode(
- WineD3D_GL_Info *gl_info,
- WINED3DDEVTYPE DeviceType,
- int* ps_selected,
- int* vs_selected) {
-
+static void select_shader_mode(const WineD3D_GL_Info *gl_info, WINED3DDEVTYPE DeviceType, int *ps_selected, int *vs_selected)
+{
if (wined3d_settings.vs_mode == VS_NONE) {
*vs_selected = SHADER_NONE;
} else if (gl_info->supported[ARB_VERTEX_SHADER] && wined3d_settings.glslRequested) {
**********************************************************/
#define GLINFO_LOCATION (*gl_info)
-static inline BOOL test_arb_vs_offset_limit(WineD3D_GL_Info *gl_info) {
+static inline BOOL test_arb_vs_offset_limit(const WineD3D_GL_Info *gl_info)
+{
GLuint prog;
BOOL ret = FALSE;
const char *testcode =
return 0;
}
-BOOL IWineD3DImpl_FillGLCaps(WineD3D_GL_Info *gl_info) {
+static BOOL IWineD3DImpl_FillGLCaps(WineD3D_GL_Info *gl_info) {
const char *GL_Extensions = NULL;
const char *WGL_Extensions = NULL;
const char *gl_string = NULL;
* shader capabilities, so we use the shader capabilities to distinguish between FX and 6xxx/7xxx.
*/
if(WINE_D3D9_CAPABLE(gl_info) && (gl_info->vs_nv_version == VS_VERSION_30)) {
+ /* Geforce GTX - highend */
+ if(strstr(gl_info->gl_renderer, "GTX 280")) {
+ gl_info->gl_card = CARD_NVIDIA_GEFORCE_GTX280;
+ vidmem = 1024;
+ }
/* Geforce9 - highend */
- if(strstr(gl_info->gl_renderer, "9800")) {
+ else if(strstr(gl_info->gl_renderer, "9800")) {
gl_info->gl_card = CARD_NVIDIA_GEFORCE_9800GT;
vidmem = 512;
}
else
gl_info->vidmem = WINE_DEFAULT_VIDMEM;
- /* Load all the lookup tables
- TODO: It may be a good idea to make minLookup and maxLookup const and populate them in wined3d_private.h where they are declared */
- minLookup[WINELOOKUP_WARPPARAM] = WINED3DTADDRESS_WRAP;
- maxLookup[WINELOOKUP_WARPPARAM] = WINED3DTADDRESS_MIRRORONCE;
-
+ /* Load all the lookup tables */
for (i = 0; i < MAX_LOOKUPS; i++) {
stateLookup[i] = HeapAlloc(GetProcessHeap(), 0, sizeof(*stateLookup[i]) * (1 + maxLookup[i] - minLookup[i]) );
}
gl_info->supported[EXT_TEXTURE_FILTER_ANISOTROPIC] ? GL_LINEAR : GL_NEAREST;
- minMipLookup[WINED3DTEXF_NONE][WINED3DTEXF_NONE] = GL_LINEAR;
- minMipLookup[WINED3DTEXF_NONE][WINED3DTEXF_POINT] = GL_LINEAR;
- minMipLookup[WINED3DTEXF_NONE][WINED3DTEXF_LINEAR] = GL_LINEAR;
- minMipLookup[WINED3DTEXF_POINT][WINED3DTEXF_NONE] = GL_NEAREST;
- minMipLookup[WINED3DTEXF_POINT][WINED3DTEXF_POINT] = GL_NEAREST_MIPMAP_NEAREST;
- minMipLookup[WINED3DTEXF_POINT][WINED3DTEXF_LINEAR] = GL_NEAREST_MIPMAP_LINEAR;
- minMipLookup[WINED3DTEXF_LINEAR][WINED3DTEXF_NONE] = GL_LINEAR;
- minMipLookup[WINED3DTEXF_LINEAR][WINED3DTEXF_POINT] = GL_LINEAR_MIPMAP_NEAREST;
- minMipLookup[WINED3DTEXF_LINEAR][WINED3DTEXF_LINEAR] = GL_LINEAR_MIPMAP_LINEAR;
- minMipLookup[WINED3DTEXF_ANISOTROPIC][WINED3DTEXF_NONE] = gl_info->supported[EXT_TEXTURE_FILTER_ANISOTROPIC] ?
- GL_LINEAR_MIPMAP_LINEAR : GL_LINEAR;
- minMipLookup[WINED3DTEXF_ANISOTROPIC][WINED3DTEXF_POINT] = gl_info->supported[EXT_TEXTURE_FILTER_ANISOTROPIC] ? GL_LINEAR_MIPMAP_NEAREST : GL_LINEAR;
- minMipLookup[WINED3DTEXF_ANISOTROPIC][WINED3DTEXF_LINEAR] = gl_info->supported[EXT_TEXTURE_FILTER_ANISOTROPIC] ? GL_LINEAR_MIPMAP_LINEAR : GL_LINEAR;
+ minMipLookup[WINED3DTEXF_NONE].mip[WINED3DTEXF_NONE] = GL_LINEAR;
+ minMipLookup[WINED3DTEXF_NONE].mip[WINED3DTEXF_POINT] = GL_LINEAR;
+ minMipLookup[WINED3DTEXF_NONE].mip[WINED3DTEXF_LINEAR] = GL_LINEAR;
+ minMipLookup[WINED3DTEXF_POINT].mip[WINED3DTEXF_NONE] = GL_NEAREST;
+ minMipLookup[WINED3DTEXF_POINT].mip[WINED3DTEXF_POINT] = GL_NEAREST_MIPMAP_NEAREST;
+ minMipLookup[WINED3DTEXF_POINT].mip[WINED3DTEXF_LINEAR] = GL_NEAREST_MIPMAP_LINEAR;
+ minMipLookup[WINED3DTEXF_LINEAR].mip[WINED3DTEXF_NONE] = GL_LINEAR;
+ minMipLookup[WINED3DTEXF_LINEAR].mip[WINED3DTEXF_POINT] = GL_LINEAR_MIPMAP_NEAREST;
+ minMipLookup[WINED3DTEXF_LINEAR].mip[WINED3DTEXF_LINEAR] = GL_LINEAR_MIPMAP_LINEAR;
+ minMipLookup[WINED3DTEXF_ANISOTROPIC].mip[WINED3DTEXF_NONE]
+ = gl_info->supported[EXT_TEXTURE_FILTER_ANISOTROPIC] ? GL_LINEAR_MIPMAP_LINEAR : GL_LINEAR;
+ minMipLookup[WINED3DTEXF_ANISOTROPIC].mip[WINED3DTEXF_POINT]
+ = gl_info->supported[EXT_TEXTURE_FILTER_ANISOTROPIC] ? GL_LINEAR_MIPMAP_NEAREST : GL_LINEAR;
+ minMipLookup[WINED3DTEXF_ANISOTROPIC].mip[WINED3DTEXF_LINEAR]
+ = gl_info->supported[EXT_TEXTURE_FILTER_ANISOTROPIC] ? GL_LINEAR_MIPMAP_LINEAR : GL_LINEAR;
/* TODO: config lookups */
if (Adapter == 0 && !DEBUG_SINGLE_MODE) { /* Display */
DEVMODEW DevModeW;
int ModeIdx = 0;
- int i = 0;
+ UINT i = 0;
int j = 0;
ZeroMemory(&DevModeW, sizeof(DevModeW));
*(pIdentifier->Revision) = 0;
*pIdentifier->DeviceIdentifier = IID_D3DDEVICE_D3DUID;
+ if(wined3d_settings.pci_device_id != PCI_DEVICE_NONE)
+ {
+ TRACE_(d3d_caps)("Overriding pci device id with: %x\n", wined3d_settings.pci_device_id);
+ *(pIdentifier->DeviceId) = wined3d_settings.pci_device_id;
+ }
+
+ if(wined3d_settings.pci_vendor_id != PCI_VENDOR_NONE)
+ {
+ TRACE_(d3d_caps)("Overriding pci vendor id with: %x\n", wined3d_settings.pci_vendor_id);
+ *(pIdentifier->VendorId) = wined3d_settings.pci_vendor_id;
+ }
+
if (Flags & WINED3DENUM_NO_WHQL_LEVEL) {
*(pIdentifier->WHQLLevel) = 0;
} else {
WINED3DFORMAT DepthStencilFormat) {
IWineD3DImpl *This = (IWineD3DImpl *)iface;
int nCfgs;
- WineD3D_PixelFormat *cfgs;
+ const WineD3D_PixelFormat *cfgs;
int it;
WARN_(d3d_caps)("(%p)-> (STUB) (Adptr:%d, DevType:(%x,%s), AdptFmt:(%x,%s), RendrTgtFmt:(%x,%s), DepthStencilFmt:(%x,%s))\n",
BOOL Windowed, WINED3DMULTISAMPLE_TYPE MultiSampleType, DWORD* pQualityLevels) {
IWineD3DImpl *This = (IWineD3DImpl *)iface;
- const GlPixelFormatDesc *glDesc;
+ const struct GlPixelFormatDesc *glDesc;
const StaticPixelFormatDesc *desc;
TRACE_(d3d_caps)("(%p)-> (Adptr:%d, DevType:(%x,%s), SurfFmt:(%x,%s), Win?%d, MultiSamp:%x, pQual:%p)\n",
if(glDesc->Flags & (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL)) {
int i, nCfgs;
- WineD3D_PixelFormat *cfgs;
+ const WineD3D_PixelFormat *cfgs;
cfgs = Adapters[Adapter].cfgs;
nCfgs = Adapters[Adapter].nCfgs;
else if(glDesc->Flags & WINED3DFMT_FLAG_RENDERTARGET) {
short redSize, greenSize, blueSize, alphaSize, colorBits;
int i, nCfgs;
- WineD3D_PixelFormat *cfgs;
+ const WineD3D_PixelFormat *cfgs;
if(!getColorBits(SurfaceFormat, &redSize, &greenSize, &blueSize, &alphaSize, &colorBits)) {
ERR("Unable to color bits for format %#x, can't check multisampling capability!\n", SurfaceFormat);
static BOOL CheckBumpMapCapability(UINT Adapter, WINED3DDEVTYPE DeviceType, WINED3DFORMAT CheckFormat)
{
const struct fragment_pipeline *fp;
- const GlPixelFormatDesc *glDesc;
+ const struct GlPixelFormatDesc *glDesc;
switch(CheckFormat) {
case WINED3DFMT_V8U8:
case WINED3DFMT_L6V5U5:
case WINED3DFMT_X8L8V8U8:
case WINED3DFMT_Q8W8V8U8:
+ /* Ask the fixed function pipeline implementation if it can deal
+ * with the conversion. If we've got a GL extension giving native
+ * support this will be an identity conversion. */
getFormatDescEntry(CheckFormat, &GLINFO_LOCATION, &glDesc);
- if(glDesc->conversion_group == WINED3DFMT_UNKNOWN) {
- /* We have a GL extension giving native support */
- TRACE_(d3d_caps)("[OK]\n");
- return TRUE;
- }
-
- /* No native support: Ask the fixed function pipeline implementation if it
- * can deal with the conversion
- */
fp = select_fragment_implementation(Adapter, DeviceType);
- if(fp->conv_supported(CheckFormat)) {
+ if (fp->color_fixup_supported(glDesc->color_fixup))
+ {
TRACE_(d3d_caps)("[OK]\n");
return TRUE;
- } else {
- TRACE_(d3d_caps)("[FAILED]\n");
- return FALSE;
}
+ TRACE_(d3d_caps)("[FAILED]\n");
+ return FALSE;
default:
TRACE_(d3d_caps)("[FAILED]\n");
static BOOL CheckDepthStencilCapability(UINT Adapter, WINED3DFORMAT DisplayFormat, WINED3DFORMAT DepthStencilFormat)
{
int it=0;
- const GlPixelFormatDesc *glDesc;
+ const struct GlPixelFormatDesc *glDesc;
const StaticPixelFormatDesc *desc = getFormatDescEntry(DepthStencilFormat, &GLINFO_LOCATION, &glDesc);
/* Fail if we weren't able to get a description of the format */
static BOOL CheckFilterCapability(UINT Adapter, WINED3DFORMAT CheckFormat)
{
- const GlPixelFormatDesc *glDesc;
+ const struct GlPixelFormatDesc *glDesc;
const StaticPixelFormatDesc *desc = getFormatDescEntry(CheckFormat, &GLINFO_LOCATION, &glDesc);
/* Fail if we weren't able to get a description of the format */
static BOOL CheckRenderTargetCapability(WINED3DFORMAT AdapterFormat, WINED3DFORMAT CheckFormat)
{
UINT Adapter = 0;
- const GlPixelFormatDesc *glDesc;
+ const struct GlPixelFormatDesc *glDesc;
const StaticPixelFormatDesc *desc = getFormatDescEntry(CheckFormat, &GLINFO_LOCATION, &glDesc);
/* Fail if we weren't able to get a description of the format */
/* Check if a format support blending in combination with pixel shaders */
static BOOL CheckPostPixelShaderBlendingCapability(UINT Adapter, WINED3DFORMAT CheckFormat)
{
- const GlPixelFormatDesc *glDesc;
+ const struct GlPixelFormatDesc *glDesc;
const StaticPixelFormatDesc *desc = getFormatDescEntry(CheckFormat, &GLINFO_LOCATION, &glDesc);
/* Fail if we weren't able to get a description of the format */
{
const shader_backend_t *shader_backend;
const struct fragment_pipeline *fp;
- const GlPixelFormatDesc *glDesc;
+ const struct GlPixelFormatDesc *glDesc;
switch (CheckFormat) {
case WINED3DFMT_L6V5U5:
case WINED3DFMT_Q8W8V8U8:
case WINED3DFMT_V16U16:
- case WINED3DFMT_W11V11U10:
+ /* Ask the shader backend if it can deal with the conversion. If
+ * we've got a GL extension giving native support this will be an
+ * identity conversion. */
getFormatDescEntry(CheckFormat, &GLINFO_LOCATION, &glDesc);
- if(glDesc->conversion_group == WINED3DFMT_UNKNOWN) {
- /* We have a GL extension giving native support */
- TRACE_(d3d_caps)("[OK]\n");
- return TRUE;
- }
-
- /* No native support: Ask the fixed function pipeline implementation if it
- * can deal with the conversion
- */
shader_backend = select_shader_backend(Adapter, DeviceType);
- if(shader_backend->shader_conv_supported(CheckFormat)) {
+ if (shader_backend->shader_color_fixup_supported(glDesc->color_fixup))
+ {
TRACE_(d3d_caps)("[OK]\n");
return TRUE;
- } else {
- TRACE_(d3d_caps)("[FAILED]\n");
- return FALSE;
}
+ TRACE_(d3d_caps)("[FAILED]\n");
+ return FALSE;
case WINED3DFMT_DXT1:
case WINED3DFMT_DXT2:
case WINED3DFMT_INDEX32:
case WINED3DFMT_Q16W16V16U16:
case WINED3DFMT_A2W10V10U10:
+ case WINED3DFMT_W11V11U10:
TRACE_(d3d_caps)("[FAILED]\n"); /* Enable when implemented */
return FALSE;
/* Vendor specific formats */
case WINED3DFMT_ATI2N:
if(GL_SUPPORT(ATI_TEXTURE_COMPRESSION_3DC) || GL_SUPPORT(EXT_TEXTURE_COMPRESSION_RGTC)) {
+ getFormatDescEntry(CheckFormat, &GLINFO_LOCATION, &glDesc);
shader_backend = select_shader_backend(Adapter, DeviceType);
fp = select_fragment_implementation(Adapter, DeviceType);
- if(shader_backend->shader_conv_supported(CheckFormat) &&
- fp->conv_supported(CheckFormat)) {
+ if (shader_backend->shader_color_fixup_supported(glDesc->color_fixup)
+ && fp->color_fixup_supported(glDesc->color_fixup))
+ {
TRACE_(d3d_caps)("[OK]\n");
return TRUE;
}
}
static BOOL CheckSurfaceCapability(UINT Adapter, WINED3DFORMAT AdapterFormat, WINED3DDEVTYPE DeviceType, WINED3DFORMAT CheckFormat, WINED3DSURFTYPE SurfaceType) {
+ const struct GlPixelFormatDesc *format_desc;
const struct blit_shader *blitter;
if(SurfaceType == SURFACE_GDI) {
if(CheckDepthStencilCapability(Adapter, AdapterFormat, CheckFormat)) return TRUE;
/* If opengl can't process the format natively, the blitter may be able to convert it */
+ getFormatDescEntry(CheckFormat, &GLINFO_LOCATION, &format_desc);
blitter = select_blit_implementation(Adapter, DeviceType);
- if(blitter->conv_supported(CheckFormat)) {
+ if (blitter->color_fixup_supported(format_desc->color_fixup))
+ {
TRACE_(d3d_caps)("[OK]\n");
return TRUE;
}
return IUnknown_Release(volumeParent);
}
-static BOOL implementation_is_apple(WineD3D_GL_Info *gl_info) {
+static BOOL implementation_is_apple(const WineD3D_GL_Info *gl_info)
+{
/* MacOS has various specialities in the extensions it advertises. Some have to be loaded from
* the opengl 1.2+ core, while other extensions are advertised, but software emulated. So try to
* detect the Apple OpenGL implementation to apply some extension fixups afterwards.
{VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_8800GTS, 7, 15, 11, 7341 },
{VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_9600GT, 7, 15, 11, 7341 },
{VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_9800GT, 7, 15, 11, 7341 },
+ {VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX280, 7, 15, 11, 7341 },
/* ATI cards. The driver versions are somewhat similar, but not quite the same. Let's hardcode */
{VENDOR_ATI, CARD_ATI_RADEON_9500, 6, 14, 10, 6764 },
}
}
-static void WINE_GLAPI invalid_func(void *data) {
+static void WINE_GLAPI invalid_func(const void *data)
+{
ERR("Invalid vertex attribute function called\n");
DebugBreak();
}
-static void WINE_GLAPI invalid_texcoord_func(GLenum unit, void * data) {
+static void WINE_GLAPI invalid_texcoord_func(GLenum unit, const void *data)
+{
ERR("Invalid texcoord function called\n");
DebugBreak();
}
/* Helper functions for providing vertex data to opengl. The arrays are initialized based on
* the extension detection and are used in drawStridedSlow
*/
-static void WINE_GLAPI position_d3dcolor(void *data) {
- DWORD pos = *((DWORD *) data);
+static void WINE_GLAPI position_d3dcolor(const void *data)
+{
+ DWORD pos = *((const DWORD *)data);
FIXME("Add a test for fixed function position from d3dcolor type\n");
glVertex4s(D3DCOLOR_B_R(pos),
D3DCOLOR_B_B(pos),
D3DCOLOR_B_A(pos));
}
-static void WINE_GLAPI position_float4(void *data) {
- GLfloat *pos = (float *) data;
+
+static void WINE_GLAPI position_float4(const void *data)
+{
+ const GLfloat *pos = data;
if (pos[3] < eps && pos[3] > -eps)
glVertex3fv(pos);
}
}
-static void WINE_GLAPI diffuse_d3dcolor(void *data) {
- DWORD diffuseColor = *((DWORD *) data);
+static void WINE_GLAPI diffuse_d3dcolor(const void *data)
+{
+ DWORD diffuseColor = *((const DWORD *)data);
glColor4ub(D3DCOLOR_B_R(diffuseColor),
D3DCOLOR_B_G(diffuseColor),
D3DCOLOR_B_A(diffuseColor));
}
-static void WINE_GLAPI specular_d3dcolor(void *data) {
- DWORD specularColor = *((DWORD *) data);
+static void WINE_GLAPI specular_d3dcolor(const void *data)
+{
+ DWORD specularColor = *((const DWORD *)data);
GL_EXTCALL(glSecondaryColor3ubEXT)(D3DCOLOR_B_R(specularColor),
D3DCOLOR_B_G(specularColor),
D3DCOLOR_B_B(specularColor));
}
-static void WINE_GLAPI warn_no_specular_func(void *data) {
+
+static void WINE_GLAPI warn_no_specular_func(const void *data)
+{
WARN("GL_EXT_secondary_color not supported\n");
}
-void fillGLAttribFuncs(WineD3D_GL_Info *gl_info) {
- position_funcs[WINED3DDECLTYPE_FLOAT1] = (void *) invalid_func;
- position_funcs[WINED3DDECLTYPE_FLOAT2] = (void *) invalid_func;
- position_funcs[WINED3DDECLTYPE_FLOAT3] = (void *) glVertex3fv;
- position_funcs[WINED3DDECLTYPE_FLOAT4] = (void *) position_float4;
- position_funcs[WINED3DDECLTYPE_D3DCOLOR] = (void *) position_d3dcolor;
- position_funcs[WINED3DDECLTYPE_UBYTE4] = (void *) invalid_func;
- position_funcs[WINED3DDECLTYPE_SHORT2] = (void *) invalid_func;
- position_funcs[WINED3DDECLTYPE_SHORT4] = (void *) glVertex2sv;
- position_funcs[WINED3DDECLTYPE_UBYTE4N] = (void *) invalid_func;
- position_funcs[WINED3DDECLTYPE_SHORT2N] = (void *) invalid_func;
- position_funcs[WINED3DDECLTYPE_SHORT4N] = (void *) invalid_func;
- position_funcs[WINED3DDECLTYPE_USHORT2N] = (void *) invalid_func;
- position_funcs[WINED3DDECLTYPE_USHORT4N] = (void *) invalid_func;
- position_funcs[WINED3DDECLTYPE_UDEC3] = (void *) invalid_func;
- position_funcs[WINED3DDECLTYPE_DEC3N] = (void *) invalid_func;
- position_funcs[WINED3DDECLTYPE_FLOAT16_2] = (void *) invalid_func;
- position_funcs[WINED3DDECLTYPE_FLOAT16_4] = (void *) invalid_func;
-
- diffuse_funcs[WINED3DDECLTYPE_FLOAT1] = (void *) invalid_func;
- diffuse_funcs[WINED3DDECLTYPE_FLOAT2] = (void *) invalid_func;
- diffuse_funcs[WINED3DDECLTYPE_FLOAT3] = (void *) glColor3fv;
- diffuse_funcs[WINED3DDECLTYPE_FLOAT4] = (void *) glColor4fv;
- diffuse_funcs[WINED3DDECLTYPE_D3DCOLOR] = (void *) diffuse_d3dcolor;
- diffuse_funcs[WINED3DDECLTYPE_UBYTE4] = (void *) invalid_func;
- diffuse_funcs[WINED3DDECLTYPE_SHORT2] = (void *) invalid_func;
- diffuse_funcs[WINED3DDECLTYPE_SHORT4] = (void *) invalid_func;
- diffuse_funcs[WINED3DDECLTYPE_UBYTE4N] = (void *) glColor4ubv;
- diffuse_funcs[WINED3DDECLTYPE_SHORT2N] = (void *) invalid_func;
- diffuse_funcs[WINED3DDECLTYPE_SHORT4N] = (void *) glColor4sv;
- diffuse_funcs[WINED3DDECLTYPE_USHORT2N] = (void *) invalid_func;
- diffuse_funcs[WINED3DDECLTYPE_USHORT4N] = (void *) glColor4usv;
- diffuse_funcs[WINED3DDECLTYPE_UDEC3] = (void *) invalid_func;
- diffuse_funcs[WINED3DDECLTYPE_DEC3N] = (void *) invalid_func;
- diffuse_funcs[WINED3DDECLTYPE_FLOAT16_2] = (void *) invalid_func;
- diffuse_funcs[WINED3DDECLTYPE_FLOAT16_4] = (void *) invalid_func;
+static void fillGLAttribFuncs(const WineD3D_GL_Info *gl_info)
+{
+ position_funcs[WINED3DDECLTYPE_FLOAT1] = invalid_func;
+ position_funcs[WINED3DDECLTYPE_FLOAT2] = invalid_func;
+ position_funcs[WINED3DDECLTYPE_FLOAT3] = (glAttribFunc)glVertex3fv;
+ position_funcs[WINED3DDECLTYPE_FLOAT4] = position_float4;
+ position_funcs[WINED3DDECLTYPE_D3DCOLOR] = position_d3dcolor;
+ position_funcs[WINED3DDECLTYPE_UBYTE4] = invalid_func;
+ position_funcs[WINED3DDECLTYPE_SHORT2] = invalid_func;
+ position_funcs[WINED3DDECLTYPE_SHORT4] = (glAttribFunc)glVertex2sv;
+ position_funcs[WINED3DDECLTYPE_UBYTE4N] = invalid_func;
+ position_funcs[WINED3DDECLTYPE_SHORT2N] = invalid_func;
+ position_funcs[WINED3DDECLTYPE_SHORT4N] = invalid_func;
+ position_funcs[WINED3DDECLTYPE_USHORT2N] = invalid_func;
+ position_funcs[WINED3DDECLTYPE_USHORT4N] = invalid_func;
+ position_funcs[WINED3DDECLTYPE_UDEC3] = invalid_func;
+ position_funcs[WINED3DDECLTYPE_DEC3N] = invalid_func;
+ position_funcs[WINED3DDECLTYPE_FLOAT16_2] = invalid_func;
+ position_funcs[WINED3DDECLTYPE_FLOAT16_4] = invalid_func;
+
+ diffuse_funcs[WINED3DDECLTYPE_FLOAT1] = invalid_func;
+ diffuse_funcs[WINED3DDECLTYPE_FLOAT2] = invalid_func;
+ diffuse_funcs[WINED3DDECLTYPE_FLOAT3] = (glAttribFunc)glColor3fv;
+ diffuse_funcs[WINED3DDECLTYPE_FLOAT4] = (glAttribFunc)glColor4fv;
+ diffuse_funcs[WINED3DDECLTYPE_D3DCOLOR] = diffuse_d3dcolor;
+ diffuse_funcs[WINED3DDECLTYPE_UBYTE4] = invalid_func;
+ diffuse_funcs[WINED3DDECLTYPE_SHORT2] = invalid_func;
+ diffuse_funcs[WINED3DDECLTYPE_SHORT4] = invalid_func;
+ diffuse_funcs[WINED3DDECLTYPE_UBYTE4N] = (glAttribFunc)glColor4ubv;
+ diffuse_funcs[WINED3DDECLTYPE_SHORT2N] = invalid_func;
+ diffuse_funcs[WINED3DDECLTYPE_SHORT4N] = (glAttribFunc)glColor4sv;
+ diffuse_funcs[WINED3DDECLTYPE_USHORT2N] = invalid_func;
+ diffuse_funcs[WINED3DDECLTYPE_USHORT4N] = (glAttribFunc)glColor4usv;
+ diffuse_funcs[WINED3DDECLTYPE_UDEC3] = invalid_func;
+ diffuse_funcs[WINED3DDECLTYPE_DEC3N] = invalid_func;
+ diffuse_funcs[WINED3DDECLTYPE_FLOAT16_2] = invalid_func;
+ diffuse_funcs[WINED3DDECLTYPE_FLOAT16_4] = invalid_func;
/* No 4 component entry points here */
- specular_funcs[WINED3DDECLTYPE_FLOAT1] = (void *) invalid_func;
- specular_funcs[WINED3DDECLTYPE_FLOAT2] = (void *) invalid_func;
+ specular_funcs[WINED3DDECLTYPE_FLOAT1] = invalid_func;
+ specular_funcs[WINED3DDECLTYPE_FLOAT2] = invalid_func;
if(GL_SUPPORT(EXT_SECONDARY_COLOR)) {
- specular_funcs[WINED3DDECLTYPE_FLOAT3] = (void *) GL_EXTCALL(glSecondaryColor3fvEXT);
+ specular_funcs[WINED3DDECLTYPE_FLOAT3] = (glAttribFunc)GL_EXTCALL(glSecondaryColor3fvEXT);
} else {
- specular_funcs[WINED3DDECLTYPE_FLOAT3] = (void *) warn_no_specular_func;
+ specular_funcs[WINED3DDECLTYPE_FLOAT3] = warn_no_specular_func;
}
- specular_funcs[WINED3DDECLTYPE_FLOAT4] = (void *) invalid_func;
+ specular_funcs[WINED3DDECLTYPE_FLOAT4] = invalid_func;
if(GL_SUPPORT(EXT_SECONDARY_COLOR)) {
- specular_funcs[WINED3DDECLTYPE_D3DCOLOR] = (void *) specular_d3dcolor;
+ specular_funcs[WINED3DDECLTYPE_D3DCOLOR] = specular_d3dcolor;
} else {
- specular_funcs[WINED3DDECLTYPE_D3DCOLOR] = (void *) warn_no_specular_func;
+ specular_funcs[WINED3DDECLTYPE_D3DCOLOR] = warn_no_specular_func;
}
- specular_funcs[WINED3DDECLTYPE_UBYTE4] = (void *) invalid_func;
- specular_funcs[WINED3DDECLTYPE_SHORT2] = (void *) invalid_func;
- specular_funcs[WINED3DDECLTYPE_SHORT4] = (void *) invalid_func;
- specular_funcs[WINED3DDECLTYPE_UBYTE4N] = (void *) invalid_func;
- specular_funcs[WINED3DDECLTYPE_SHORT2N] = (void *) invalid_func;
- specular_funcs[WINED3DDECLTYPE_SHORT4N] = (void *) invalid_func;
- specular_funcs[WINED3DDECLTYPE_USHORT2N] = (void *) invalid_func;
- specular_funcs[WINED3DDECLTYPE_USHORT4N] = (void *) invalid_func;
- specular_funcs[WINED3DDECLTYPE_UDEC3] = (void *) invalid_func;
- specular_funcs[WINED3DDECLTYPE_DEC3N] = (void *) invalid_func;
- specular_funcs[WINED3DDECLTYPE_FLOAT16_2] = (void *) invalid_func;
- specular_funcs[WINED3DDECLTYPE_FLOAT16_4] = (void *) invalid_func;
+ specular_funcs[WINED3DDECLTYPE_UBYTE4] = invalid_func;
+ specular_funcs[WINED3DDECLTYPE_SHORT2] = invalid_func;
+ specular_funcs[WINED3DDECLTYPE_SHORT4] = invalid_func;
+ specular_funcs[WINED3DDECLTYPE_UBYTE4N] = invalid_func;
+ specular_funcs[WINED3DDECLTYPE_SHORT2N] = invalid_func;
+ specular_funcs[WINED3DDECLTYPE_SHORT4N] = invalid_func;
+ specular_funcs[WINED3DDECLTYPE_USHORT2N] = invalid_func;
+ specular_funcs[WINED3DDECLTYPE_USHORT4N] = invalid_func;
+ specular_funcs[WINED3DDECLTYPE_UDEC3] = invalid_func;
+ specular_funcs[WINED3DDECLTYPE_DEC3N] = invalid_func;
+ specular_funcs[WINED3DDECLTYPE_FLOAT16_2] = invalid_func;
+ specular_funcs[WINED3DDECLTYPE_FLOAT16_4] = invalid_func;
/* Only 3 component entry points here. Test how others behave. Float4 normals are used
* by one of our tests, trying to pass it to the pixel shader, which fails on Windows.
*/
- normal_funcs[WINED3DDECLTYPE_FLOAT1] = (void *) invalid_func;
- normal_funcs[WINED3DDECLTYPE_FLOAT2] = (void *) invalid_func;
- normal_funcs[WINED3DDECLTYPE_FLOAT3] = (void *) glNormal3fv;
- normal_funcs[WINED3DDECLTYPE_FLOAT4] = (void *) glNormal3fv; /* Just ignore the 4th value */
- normal_funcs[WINED3DDECLTYPE_D3DCOLOR] = (void *) invalid_func;
- normal_funcs[WINED3DDECLTYPE_UBYTE4] = (void *) invalid_func;
- normal_funcs[WINED3DDECLTYPE_SHORT2] = (void *) invalid_func;
- normal_funcs[WINED3DDECLTYPE_SHORT4] = (void *) invalid_func;
- normal_funcs[WINED3DDECLTYPE_UBYTE4N] = (void *) invalid_func;
- normal_funcs[WINED3DDECLTYPE_SHORT2N] = (void *) invalid_func;
- normal_funcs[WINED3DDECLTYPE_SHORT4N] = (void *) invalid_func;
- normal_funcs[WINED3DDECLTYPE_USHORT2N] = (void *) invalid_func;
- normal_funcs[WINED3DDECLTYPE_USHORT4N] = (void *) invalid_func;
- normal_funcs[WINED3DDECLTYPE_UDEC3] = (void *) invalid_func;
- normal_funcs[WINED3DDECLTYPE_DEC3N] = (void *) invalid_func;
- normal_funcs[WINED3DDECLTYPE_FLOAT16_2] = (void *) invalid_func;
- normal_funcs[WINED3DDECLTYPE_FLOAT16_4] = (void *) invalid_func;
-
- multi_texcoord_funcs[WINED3DDECLTYPE_FLOAT1] = (void *) GL_EXTCALL(glMultiTexCoord1fvARB);
- multi_texcoord_funcs[WINED3DDECLTYPE_FLOAT2] = (void *) GL_EXTCALL(glMultiTexCoord2fvARB);
- multi_texcoord_funcs[WINED3DDECLTYPE_FLOAT3] = (void *) GL_EXTCALL(glMultiTexCoord3fvARB);
- multi_texcoord_funcs[WINED3DDECLTYPE_FLOAT4] = (void *) GL_EXTCALL(glMultiTexCoord4fvARB);
- multi_texcoord_funcs[WINED3DDECLTYPE_D3DCOLOR] = (void *) invalid_texcoord_func;
- multi_texcoord_funcs[WINED3DDECLTYPE_UBYTE4] = (void *) invalid_texcoord_func;
- multi_texcoord_funcs[WINED3DDECLTYPE_SHORT2] = (void *) GL_EXTCALL(glMultiTexCoord2svARB);
- multi_texcoord_funcs[WINED3DDECLTYPE_SHORT4] = (void *) GL_EXTCALL(glMultiTexCoord4svARB);
- multi_texcoord_funcs[WINED3DDECLTYPE_UBYTE4N] = (void *) invalid_texcoord_func;
- multi_texcoord_funcs[WINED3DDECLTYPE_SHORT2N] = (void *) invalid_texcoord_func;
- multi_texcoord_funcs[WINED3DDECLTYPE_SHORT4N] = (void *) invalid_texcoord_func;
- multi_texcoord_funcs[WINED3DDECLTYPE_USHORT2N] = (void *) invalid_texcoord_func;
- multi_texcoord_funcs[WINED3DDECLTYPE_USHORT4N] = (void *) invalid_texcoord_func;
- multi_texcoord_funcs[WINED3DDECLTYPE_UDEC3] = (void *) invalid_texcoord_func;
- multi_texcoord_funcs[WINED3DDECLTYPE_DEC3N] = (void *) invalid_texcoord_func;
+ normal_funcs[WINED3DDECLTYPE_FLOAT1] = invalid_func;
+ normal_funcs[WINED3DDECLTYPE_FLOAT2] = invalid_func;
+ normal_funcs[WINED3DDECLTYPE_FLOAT3] = (glAttribFunc)glNormal3fv;
+ normal_funcs[WINED3DDECLTYPE_FLOAT4] = (glAttribFunc)glNormal3fv; /* Just ignore the 4th value */
+ normal_funcs[WINED3DDECLTYPE_D3DCOLOR] = invalid_func;
+ normal_funcs[WINED3DDECLTYPE_UBYTE4] = invalid_func;
+ normal_funcs[WINED3DDECLTYPE_SHORT2] = invalid_func;
+ normal_funcs[WINED3DDECLTYPE_SHORT4] = invalid_func;
+ normal_funcs[WINED3DDECLTYPE_UBYTE4N] = invalid_func;
+ normal_funcs[WINED3DDECLTYPE_SHORT2N] = invalid_func;
+ normal_funcs[WINED3DDECLTYPE_SHORT4N] = invalid_func;
+ normal_funcs[WINED3DDECLTYPE_USHORT2N] = invalid_func;
+ normal_funcs[WINED3DDECLTYPE_USHORT4N] = invalid_func;
+ normal_funcs[WINED3DDECLTYPE_UDEC3] = invalid_func;
+ normal_funcs[WINED3DDECLTYPE_DEC3N] = invalid_func;
+ normal_funcs[WINED3DDECLTYPE_FLOAT16_2] = invalid_func;
+ normal_funcs[WINED3DDECLTYPE_FLOAT16_4] = invalid_func;
+
+ multi_texcoord_funcs[WINED3DDECLTYPE_FLOAT1] = (glMultiTexCoordFunc)GL_EXTCALL(glMultiTexCoord1fvARB);
+ multi_texcoord_funcs[WINED3DDECLTYPE_FLOAT2] = (glMultiTexCoordFunc)GL_EXTCALL(glMultiTexCoord2fvARB);
+ multi_texcoord_funcs[WINED3DDECLTYPE_FLOAT3] = (glMultiTexCoordFunc)GL_EXTCALL(glMultiTexCoord3fvARB);
+ multi_texcoord_funcs[WINED3DDECLTYPE_FLOAT4] = (glMultiTexCoordFunc)GL_EXTCALL(glMultiTexCoord4fvARB);
+ multi_texcoord_funcs[WINED3DDECLTYPE_D3DCOLOR] = invalid_texcoord_func;
+ multi_texcoord_funcs[WINED3DDECLTYPE_UBYTE4] = invalid_texcoord_func;
+ multi_texcoord_funcs[WINED3DDECLTYPE_SHORT2] = (glMultiTexCoordFunc)GL_EXTCALL(glMultiTexCoord2svARB);
+ multi_texcoord_funcs[WINED3DDECLTYPE_SHORT4] = (glMultiTexCoordFunc)GL_EXTCALL(glMultiTexCoord4svARB);
+ multi_texcoord_funcs[WINED3DDECLTYPE_UBYTE4N] = invalid_texcoord_func;
+ multi_texcoord_funcs[WINED3DDECLTYPE_SHORT2N] = invalid_texcoord_func;
+ multi_texcoord_funcs[WINED3DDECLTYPE_SHORT4N] = invalid_texcoord_func;
+ multi_texcoord_funcs[WINED3DDECLTYPE_USHORT2N] = invalid_texcoord_func;
+ multi_texcoord_funcs[WINED3DDECLTYPE_USHORT4N] = invalid_texcoord_func;
+ multi_texcoord_funcs[WINED3DDECLTYPE_UDEC3] = invalid_texcoord_func;
+ multi_texcoord_funcs[WINED3DDECLTYPE_DEC3N] = invalid_texcoord_func;
if (GL_SUPPORT(NV_HALF_FLOAT))
{
- multi_texcoord_funcs[WINED3DDECLTYPE_FLOAT16_2] = (void *) GL_EXTCALL(glMultiTexCoord2hvNV);
- multi_texcoord_funcs[WINED3DDECLTYPE_FLOAT16_4] = (void *) GL_EXTCALL(glMultiTexCoord4hvNV);
+ multi_texcoord_funcs[WINED3DDECLTYPE_FLOAT16_2] = (glMultiTexCoordFunc)GL_EXTCALL(glMultiTexCoord2hvNV);
+ multi_texcoord_funcs[WINED3DDECLTYPE_FLOAT16_4] = (glMultiTexCoordFunc)GL_EXTCALL(glMultiTexCoord4hvNV);
} else {
- multi_texcoord_funcs[WINED3DDECLTYPE_FLOAT16_2] = (void *) invalid_texcoord_func;
- multi_texcoord_funcs[WINED3DDECLTYPE_FLOAT16_4] = (void *) invalid_texcoord_func;
+ multi_texcoord_funcs[WINED3DDECLTYPE_FLOAT16_2] = invalid_texcoord_func;
+ multi_texcoord_funcs[WINED3DDECLTYPE_FLOAT16_4] = invalid_texcoord_func;
}
- texcoord_funcs[WINED3DDECLTYPE_FLOAT1] = (void *) glTexCoord1fv;
- texcoord_funcs[WINED3DDECLTYPE_FLOAT2] = (void *) glTexCoord2fv;
- texcoord_funcs[WINED3DDECLTYPE_FLOAT3] = (void *) glTexCoord3fv;
- texcoord_funcs[WINED3DDECLTYPE_FLOAT4] = (void *) glTexCoord4fv;
- texcoord_funcs[WINED3DDECLTYPE_D3DCOLOR] = (void *) invalid_func;
- texcoord_funcs[WINED3DDECLTYPE_UBYTE4] = (void *) invalid_func;
- texcoord_funcs[WINED3DDECLTYPE_SHORT2] = (void *) glTexCoord2sv;
- texcoord_funcs[WINED3DDECLTYPE_SHORT4] = (void *) glTexCoord4sv;
- texcoord_funcs[WINED3DDECLTYPE_UBYTE4N] = (void *) invalid_func;
- texcoord_funcs[WINED3DDECLTYPE_SHORT2N] = (void *) invalid_func;
- texcoord_funcs[WINED3DDECLTYPE_SHORT4N] = (void *) invalid_func;
- texcoord_funcs[WINED3DDECLTYPE_USHORT2N] = (void *) invalid_func;
- texcoord_funcs[WINED3DDECLTYPE_USHORT4N] = (void *) invalid_func;
- texcoord_funcs[WINED3DDECLTYPE_UDEC3] = (void *) invalid_func;
- texcoord_funcs[WINED3DDECLTYPE_DEC3N] = (void *) invalid_func;
+ texcoord_funcs[WINED3DDECLTYPE_FLOAT1] = (glAttribFunc)glTexCoord1fv;
+ texcoord_funcs[WINED3DDECLTYPE_FLOAT2] = (glAttribFunc)glTexCoord2fv;
+ texcoord_funcs[WINED3DDECLTYPE_FLOAT3] = (glAttribFunc)glTexCoord3fv;
+ texcoord_funcs[WINED3DDECLTYPE_FLOAT4] = (glAttribFunc)glTexCoord4fv;
+ texcoord_funcs[WINED3DDECLTYPE_D3DCOLOR] = invalid_func;
+ texcoord_funcs[WINED3DDECLTYPE_UBYTE4] = invalid_func;
+ texcoord_funcs[WINED3DDECLTYPE_SHORT2] = (glAttribFunc)glTexCoord2sv;
+ texcoord_funcs[WINED3DDECLTYPE_SHORT4] = (glAttribFunc)glTexCoord4sv;
+ texcoord_funcs[WINED3DDECLTYPE_UBYTE4N] = invalid_func;
+ texcoord_funcs[WINED3DDECLTYPE_SHORT2N] = invalid_func;
+ texcoord_funcs[WINED3DDECLTYPE_SHORT4N] = invalid_func;
+ texcoord_funcs[WINED3DDECLTYPE_USHORT2N] = invalid_func;
+ texcoord_funcs[WINED3DDECLTYPE_USHORT4N] = invalid_func;
+ texcoord_funcs[WINED3DDECLTYPE_UDEC3] = invalid_func;
+ texcoord_funcs[WINED3DDECLTYPE_DEC3N] = invalid_func;
if (GL_SUPPORT(NV_HALF_FLOAT))
{
- texcoord_funcs[WINED3DDECLTYPE_FLOAT16_2] = (void *) GL_EXTCALL(glTexCoord2hvNV);
- texcoord_funcs[WINED3DDECLTYPE_FLOAT16_4] = (void *) GL_EXTCALL(glTexCoord4hvNV);
+ texcoord_funcs[WINED3DDECLTYPE_FLOAT16_2] = (glAttribFunc)GL_EXTCALL(glTexCoord2hvNV);
+ texcoord_funcs[WINED3DDECLTYPE_FLOAT16_4] = (glAttribFunc)GL_EXTCALL(glTexCoord4hvNV);
} else {
- texcoord_funcs[WINED3DDECLTYPE_FLOAT16_2] = (void *) invalid_func;
- texcoord_funcs[WINED3DDECLTYPE_FLOAT16_4] = (void *) invalid_func;
+ texcoord_funcs[WINED3DDECLTYPE_FLOAT16_2] = invalid_func;
+ texcoord_funcs[WINED3DDECLTYPE_FLOAT16_4] = invalid_func;
}
}
/* We need to deal with frequency data!*/
- BYTE *data = NULL;
+ const BYTE *data = NULL;
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
IWineD3DVertexDeclarationImpl* vertexDeclaration = (IWineD3DVertexDeclarationImpl *)This->stateBlock->vertexDecl;
- int i;
- WINED3DVERTEXELEMENT *element;
+ unsigned int i;
+ const WINED3DVERTEXELEMENT *element;
DWORD stride;
DWORD numPreloadStreams = This->stateBlock->streamIsUP ? 0 : vertexDeclaration->num_streams;
- DWORD *streams = vertexDeclaration->streams;
+ const DWORD *streams = vertexDeclaration->streams;
/* Check for transformed vertices, disable vertex shader if present */
strided->u.s.position_transformed = vertexDeclaration->position_transformed;
unsigned int idx;
element = vertexDeclaration->pDeclarationWine + i;
- TRACE("%p Element %p (%d of %d)\n", vertexDeclaration->pDeclarationWine,
+ TRACE("%p Element %p (%u of %u)\n", vertexDeclaration->pDeclarationWine,
element, i + 1, vertexDeclaration->declarationWNumElements - 1);
if (This->stateBlock->streamSource[element->Stream] == NULL)
* Slower GL version which extracts info about each vertex in turn
*/
-static void drawStridedSlow(IWineD3DDevice *iface, WineDirect3DVertexStridedData *sd,
- UINT NumVertexes, GLenum glPrimType,
- const void *idxData, short idxSize, ULONG minIndex, ULONG startIdx, ULONG startVertex) {
-
+static void drawStridedSlow(IWineD3DDevice *iface, const WineDirect3DVertexStridedData *sd, UINT NumVertexes,
+ GLenum glPrimType, const void *idxData, short idxSize, ULONG minIndex, ULONG startIdx, ULONG startVertex)
+{
unsigned int textureNo = 0;
const WORD *pIdxBufS = NULL;
const DWORD *pIdxBufL = NULL;
- LONG vx_index;
+ ULONG vx_index;
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
- UINT *streamOffset = This->stateBlock->streamOffset;
+ const UINT *streamOffset = This->stateBlock->streamOffset;
long SkipnStrides = startVertex + This->stateBlock->loadBaseVertexIndex;
BOOL pixelShader = use_ps(This);
-
- BYTE *texCoords[WINED3DDP_MAXTEXCOORD];
- BYTE *diffuse = NULL, *specular = NULL, *normal = NULL, *position = NULL;
+ BOOL specular_fog = FALSE;
+ UINT texture_stages = GL_LIMITS(texture_stages);
+ const BYTE *texCoords[WINED3DDP_MAXTEXCOORD];
+ const BYTE *diffuse = NULL, *specular = NULL, *normal = NULL, *position = NULL;
+ DWORD tex_mask = 0;
TRACE("Using slow vertex array code\n");
return;
}
- /* Adding the stream offset once is cheaper than doing it every iteration. Do not modify the strided data, it is a pointer
- * to the strided Data in the device and might be needed intact on the next draw
- */
- for (textureNo = 0; textureNo < GL_LIMITS(texture_stages); ++textureNo) {
- if(sd->u.s.texCoords[textureNo].lpData) {
- texCoords[textureNo] = sd->u.s.texCoords[textureNo].lpData + streamOffset[sd->u.s.texCoords[textureNo].streamNo];
- } else {
- texCoords[textureNo] = NULL;
- }
- }
- if(sd->u.s.diffuse.lpData) {
- diffuse = sd->u.s.diffuse.lpData + streamOffset[sd->u.s.diffuse.streamNo];
- }
- if(sd->u.s.specular.lpData) {
+ /* Start drawing in GL */
+ VTRACE(("glBegin(%x)\n", glPrimType));
+ glBegin(glPrimType);
+
+ if (sd->u.s.position.lpData) position = sd->u.s.position.lpData + streamOffset[sd->u.s.position.streamNo];
+
+ if (sd->u.s.normal.lpData) normal = sd->u.s.normal.lpData + streamOffset[sd->u.s.normal.streamNo];
+ else glNormal3f(0, 0, 0);
+
+ if (sd->u.s.diffuse.lpData) diffuse = sd->u.s.diffuse.lpData + streamOffset[sd->u.s.diffuse.streamNo];
+ else glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
+ if (This->activeContext->num_untracked_materials && sd->u.s.diffuse.dwType != WINED3DDECLTYPE_D3DCOLOR)
+ FIXME("Implement diffuse color tracking from %s\n", debug_d3ddecltype(sd->u.s.diffuse.dwType));
+
+ if (sd->u.s.specular.lpData)
+ {
specular = sd->u.s.specular.lpData + streamOffset[sd->u.s.specular.streamNo];
- }
- if(sd->u.s.normal.lpData) {
- normal = sd->u.s.normal.lpData + streamOffset[sd->u.s.normal.streamNo];
- }
- if(sd->u.s.position.lpData) {
- position = sd->u.s.position.lpData + streamOffset[sd->u.s.position.streamNo];
- }
- if(FIXME_ON(d3d_draw)) {
- if(specular && This->stateBlock->renderState[WINED3DRS_FOGENABLE] &&
- (This->stateBlock->renderState[WINED3DRS_FOGVERTEXMODE] == WINED3DFOG_NONE || sd->u.s.position_transformed )&&
- This->stateBlock->renderState[WINED3DRS_FOGTABLEMODE] == WINED3DFOG_NONE) {
- if(GL_SUPPORT(EXT_FOG_COORD) && sd->u.s.specular.dwType != WINED3DDECLTYPE_D3DCOLOR) {
- FIXME("Implement fog coordinates from %s\n", debug_d3ddecltype(sd->u.s.specular.dwType));
+ /* special case where the fog density is stored in the specular alpha channel */
+ if (This->stateBlock->renderState[WINED3DRS_FOGENABLE]
+ && (This->stateBlock->renderState[WINED3DRS_FOGVERTEXMODE] == WINED3DFOG_NONE
+ || sd->u.s.position.dwType == WINED3DDECLTYPE_FLOAT4)
+ && This->stateBlock->renderState[WINED3DRS_FOGTABLEMODE] == WINED3DFOG_NONE)
+ {
+ if (GL_SUPPORT(EXT_FOG_COORD))
+ {
+ if (sd->u.s.specular.dwType == WINED3DDECLTYPE_D3DCOLOR) specular_fog = TRUE;
+ else FIXME("Implement fog coordinates from %s\n", debug_d3ddecltype(sd->u.s.specular.dwType));
+ }
+ else
+ {
+ static BOOL warned;
+
+ if (!warned)
+ {
+ /* TODO: Use the fog table code from old ddraw */
+ FIXME("Implement fog for transformed vertices in software\n");
+ warned = TRUE;
+ }
}
}
- if(This->activeContext->num_untracked_materials && sd->u.s.diffuse.dwType != WINED3DDECLTYPE_D3DCOLOR) {
- FIXME("Implement diffuse color tracking from %s\n", debug_d3ddecltype(sd->u.s.diffuse.dwType));
- }
+ }
+ else if (GL_SUPPORT(EXT_SECONDARY_COLOR))
+ {
+ GL_EXTCALL(glSecondaryColor3fEXT)(0, 0, 0);
}
- /* Start drawing in GL */
- VTRACE(("glBegin(%x)\n", glPrimType));
- glBegin(glPrimType);
+ for (textureNo = 0; textureNo < texture_stages; ++textureNo)
+ {
+ int coordIdx = This->stateBlock->textureState[textureNo][WINED3DTSS_TEXCOORDINDEX];
+ int texture_idx = This->texUnitMap[textureNo];
- /* Default settings for data that is not passed */
- if (sd->u.s.normal.lpData == NULL) {
- glNormal3f(0, 0, 0);
- }
- if(sd->u.s.diffuse.lpData == NULL) {
- glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
- }
- if(sd->u.s.specular.lpData == NULL) {
- if (GL_SUPPORT(EXT_SECONDARY_COLOR)) {
- GL_EXTCALL(glSecondaryColor3fEXT)(0, 0, 0);
+ if (!GL_SUPPORT(ARB_MULTITEXTURE) && textureNo > 0)
+ {
+ FIXME("Program using multiple concurrent textures which this opengl implementation doesn't support\n");
+ continue;
+ }
+
+ if (!pixelShader && !This->stateBlock->textures[textureNo]) continue;
+
+ if (texture_idx == -1) continue;
+
+ if (coordIdx > 7)
+ {
+ TRACE("tex: %d - Skip tex coords, as being system generated\n", textureNo);
+ continue;
+ }
+ else if (coordIdx < 0)
+ {
+ FIXME("tex: %d - Coord index %d is less than zero, expect a crash.\n", textureNo, coordIdx);
+ continue;
+ }
+
+ if(sd->u.s.texCoords[coordIdx].lpData)
+ {
+ texCoords[coordIdx] =
+ sd->u.s.texCoords[coordIdx].lpData + streamOffset[sd->u.s.texCoords[coordIdx].streamNo];
+ tex_mask |= (1 << textureNo);
+ }
+ else
+ {
+ TRACE("tex: %d - Skipping tex coords, as no data supplied\n", textureNo);
+ if (GL_SUPPORT(ARB_MULTITEXTURE))
+ GL_EXTCALL(glMultiTexCoord4fARB(GL_TEXTURE0_ARB + texture_idx, 0, 0, 0, 1));
+ else
+ glTexCoord4f(0, 0, 0, 1);
}
}
/* For each primitive */
for (vx_index = 0; vx_index < NumVertexes; ++vx_index) {
+ UINT texture, tmp_tex_mask;
/* Blending data and Point sizes are not supported by this function. They are not supported by the fixed
* function pipeline at all. A Fixme for them is printed after decoding the vertex declaration
*/
/* Indexed so work out the number of strides to skip */
if (idxSize == 2) {
- VTRACE(("Idx for vertex %d = %d\n", vx_index, pIdxBufS[startIdx+vx_index]));
+ VTRACE(("Idx for vertex %u = %u\n", vx_index, pIdxBufS[startIdx+vx_index]));
SkipnStrides = pIdxBufS[startIdx + vx_index] + This->stateBlock->loadBaseVertexIndex;
} else {
- VTRACE(("Idx for vertex %d = %d\n", vx_index, pIdxBufL[startIdx+vx_index]));
+ VTRACE(("Idx for vertex %u = %u\n", vx_index, pIdxBufL[startIdx+vx_index]));
SkipnStrides = pIdxBufL[startIdx + vx_index] + This->stateBlock->loadBaseVertexIndex;
}
}
- /* Texture coords --------------------------- */
- for (textureNo = 0; textureNo < GL_LIMITS(texture_stages); ++textureNo) {
-
- if (!GL_SUPPORT(ARB_MULTITEXTURE) && textureNo > 0) {
- FIXME("Program using multiple concurrent textures which this opengl implementation doesn't support\n");
- continue ;
- }
-
- /* Query tex coords */
- if (This->stateBlock->textures[textureNo] != NULL || pixelShader) {
- int coordIdx = This->stateBlock->textureState[textureNo][WINED3DTSS_TEXCOORDINDEX];
- int texture_idx = This->texUnitMap[textureNo];
- void *ptrToCoords;
-
- if (coordIdx > 7) {
- VTRACE(("tex: %d - Skip tex coords, as being system generated\n", textureNo));
- continue;
- } else if (coordIdx < 0) {
- FIXME("tex: %d - Coord index %d is less than zero, expect a crash.\n", textureNo, coordIdx);
- continue;
- }
+ tmp_tex_mask = tex_mask;
+ for (texture = 0; tmp_tex_mask; tmp_tex_mask >>= 1, ++texture)
+ {
+ int coord_idx;
+ const void *ptr;
- if (texture_idx == -1) continue;
+ if (!(tmp_tex_mask & 1)) continue;
- if (texCoords[coordIdx] == NULL) {
- TRACE("tex: %d - Skipping tex coords, as no data supplied\n", textureNo);
- if (GL_SUPPORT(ARB_MULTITEXTURE)) {
- GL_EXTCALL(glMultiTexCoord4fARB(GL_TEXTURE0_ARB + texture_idx, 0, 0, 0, 1));
- } else {
- glTexCoord4f(0, 0, 0, 1);
- }
- continue;
- }
+ coord_idx = This->stateBlock->textureState[texture][WINED3DTSS_TEXCOORDINDEX];
+ ptr = texCoords[coord_idx] + (SkipnStrides * sd->u.s.texCoords[coord_idx].dwStride);
- ptrToCoords = texCoords[coordIdx] + (SkipnStrides * sd->u.s.texCoords[coordIdx].dwStride);
- if (GL_SUPPORT(ARB_MULTITEXTURE))
- multi_texcoord_funcs[sd->u.s.texCoords[coordIdx].dwType](GL_TEXTURE0_ARB + texture_idx, ptrToCoords);
- else
- texcoord_funcs[sd->u.s.texCoords[coordIdx].dwType](ptrToCoords);
+ if (GL_SUPPORT(ARB_MULTITEXTURE))
+ {
+ int texture_idx = This->texUnitMap[texture];
+ multi_texcoord_funcs[sd->u.s.texCoords[coord_idx].dwType](GL_TEXTURE0_ARB + texture_idx, ptr);
}
- } /* End of textures */
+ else
+ {
+ texcoord_funcs[sd->u.s.texCoords[coord_idx].dwType](ptr);
+ }
+ }
/* Diffuse -------------------------------- */
if (diffuse) {
- DWORD *ptrToCoords = (DWORD *)(diffuse + (SkipnStrides * sd->u.s.diffuse.dwStride));
+ const void *ptrToCoords = diffuse + SkipnStrides * sd->u.s.diffuse.dwStride;
- diffuse_funcs[sd->u.s.diffuse.dwType]((void *) ptrToCoords);
+ diffuse_funcs[sd->u.s.diffuse.dwType](ptrToCoords);
if(This->activeContext->num_untracked_materials) {
- DWORD diffuseColor = ptrToCoords[0];
+ DWORD diffuseColor = ((const DWORD *)ptrToCoords)[0];
unsigned char i;
float color[4];
/* Specular ------------------------------- */
if (specular) {
- DWORD *ptrToCoords = (DWORD *)(specular + (SkipnStrides * sd->u.s.specular.dwStride));
-
- /* special case where the fog density is stored in the specular alpha channel */
- if(This->stateBlock->renderState[WINED3DRS_FOGENABLE] &&
- (This->stateBlock->renderState[WINED3DRS_FOGVERTEXMODE] == WINED3DFOG_NONE || sd->u.s.position.dwType == WINED3DDECLTYPE_FLOAT4 )&&
- This->stateBlock->renderState[WINED3DRS_FOGTABLEMODE] == WINED3DFOG_NONE) {
- if(GL_SUPPORT(EXT_FOG_COORD)) {
- DWORD specularColor = ptrToCoords[0];
- GL_EXTCALL(glFogCoordfEXT(specularColor >> 24));
- } else {
- static BOOL warned = FALSE;
- if(!warned) {
- /* TODO: Use the fog table code from old ddraw */
- FIXME("Implement fog for transformed vertices in software\n");
- warned = TRUE;
- }
- }
- }
+ const void *ptrToCoords = specular + SkipnStrides * sd->u.s.specular.dwStride;
- specular_funcs[sd->u.s.specular.dwType]((void *) ptrToCoords);
+ specular_funcs[sd->u.s.specular.dwType](ptrToCoords);
+
+ if (specular_fog)
+ {
+ DWORD specularColor = *(const DWORD *)ptrToCoords;
+ GL_EXTCALL(glFogCoordfEXT(specularColor >> 24));
+ }
}
/* Normal -------------------------------- */
if (normal != NULL) {
- float *ptrToCoords = (float *)(normal + (SkipnStrides * sd->u.s.normal.dwStride));
+ const void *ptrToCoords = normal + SkipnStrides * sd->u.s.normal.dwStride;
normal_funcs[sd->u.s.normal.dwType](ptrToCoords);
}
/* Position -------------------------------- */
if (position) {
- float *ptrToCoords = (float *)(position + (SkipnStrides * sd->u.s.position.dwStride));
+ const void *ptrToCoords = position + SkipnStrides * sd->u.s.position.dwStride;
position_funcs[sd->u.s.position.dwType](ptrToCoords);
}
static inline void send_attribute(IWineD3DDeviceImpl *This, const DWORD type, const UINT index, const void *ptr) {
switch(type) {
case WINED3DDECLTYPE_FLOAT1:
- GL_EXTCALL(glVertexAttrib1fvARB(index, (float *) ptr));
+ GL_EXTCALL(glVertexAttrib1fvARB(index, (const float *)ptr));
break;
case WINED3DDECLTYPE_FLOAT2:
- GL_EXTCALL(glVertexAttrib2fvARB(index, (float *) ptr));
+ GL_EXTCALL(glVertexAttrib2fvARB(index, (const float *)ptr));
break;
case WINED3DDECLTYPE_FLOAT3:
- GL_EXTCALL(glVertexAttrib3fvARB(index, (float *) ptr));
+ GL_EXTCALL(glVertexAttrib3fvARB(index, (const float *)ptr));
break;
case WINED3DDECLTYPE_FLOAT4:
- GL_EXTCALL(glVertexAttrib4fvARB(index, (float *) ptr));
+ GL_EXTCALL(glVertexAttrib4fvARB(index, (const float *)ptr));
break;
case WINED3DDECLTYPE_UBYTE4:
break;
case WINED3DDECLTYPE_SHORT2:
- GL_EXTCALL(glVertexAttrib4svARB(index, (GLshort *) ptr));
+ GL_EXTCALL(glVertexAttrib4svARB(index, (const GLshort *)ptr));
break;
case WINED3DDECLTYPE_SHORT4:
- GL_EXTCALL(glVertexAttrib4svARB(index, (GLshort *) ptr));
+ GL_EXTCALL(glVertexAttrib4svARB(index, (const GLshort *)ptr));
break;
case WINED3DDECLTYPE_SHORT2N:
{
- GLshort s[4] = {((short *) ptr)[0], ((short *) ptr)[1], 0, 1};
+ GLshort s[4] = {((const GLshort *)ptr)[0], ((const GLshort *)ptr)[1], 0, 1};
GL_EXTCALL(glVertexAttrib4NsvARB(index, s));
break;
}
case WINED3DDECLTYPE_USHORT2N:
{
- GLushort s[4] = {((unsigned short *) ptr)[0], ((unsigned short *) ptr)[1], 0, 1};
+ GLushort s[4] = {((const GLushort *)ptr)[0], ((const GLushort *)ptr)[1], 0, 1};
GL_EXTCALL(glVertexAttrib4NusvARB(index, s));
break;
}
case WINED3DDECLTYPE_SHORT4N:
- GL_EXTCALL(glVertexAttrib4NsvARB(index, (GLshort *) ptr));
+ GL_EXTCALL(glVertexAttrib4NsvARB(index, (const GLshort *)ptr));
break;
case WINED3DDECLTYPE_USHORT4N:
- GL_EXTCALL(glVertexAttrib4NusvARB(index, (GLushort *) ptr));
+ GL_EXTCALL(glVertexAttrib4NusvARB(index, (const GLushort *)ptr));
break;
case WINED3DDECLTYPE_UDEC3:
* byte float according to the IEEE standard
*/
if (GL_SUPPORT(NV_HALF_FLOAT)) {
- GL_EXTCALL(glVertexAttrib2hvNV(index, (GLhalfNV *)ptr));
+ GL_EXTCALL(glVertexAttrib2hvNV(index, (const GLhalfNV *)ptr));
} else {
- float x = float_16_to_32(((unsigned short *) ptr) + 0);
- float y = float_16_to_32(((unsigned short *) ptr) + 1);
+ float x = float_16_to_32(((const unsigned short *)ptr) + 0);
+ float y = float_16_to_32(((const unsigned short *)ptr) + 1);
GL_EXTCALL(glVertexAttrib2fARB(index, x, y));
}
break;
case WINED3DDECLTYPE_FLOAT16_4:
if (GL_SUPPORT(NV_HALF_FLOAT)) {
- GL_EXTCALL(glVertexAttrib4hvNV(index, (GLhalfNV *)ptr));
+ GL_EXTCALL(glVertexAttrib4hvNV(index, (const GLhalfNV *)ptr));
} else {
- float x = float_16_to_32(((unsigned short *) ptr) + 0);
- float y = float_16_to_32(((unsigned short *) ptr) + 1);
- float z = float_16_to_32(((unsigned short *) ptr) + 2);
- float w = float_16_to_32(((unsigned short *) ptr) + 3);
+ float x = float_16_to_32(((const unsigned short *)ptr) + 0);
+ float y = float_16_to_32(((const unsigned short *)ptr) + 1);
+ float z = float_16_to_32(((const unsigned short *)ptr) + 2);
+ float w = float_16_to_32(((const unsigned short *)ptr) + 3);
GL_EXTCALL(glVertexAttrib4fARB(index, x, y, z, w));
}
break;
}
}
-static void drawStridedSlowVs(IWineD3DDevice *iface, WineDirect3DVertexStridedData *sd, UINT numberOfVertices,
- GLenum glPrimitiveType, const void *idxData, short idxSize, ULONG minIndex, ULONG startIdx,
- ULONG startVertex) {
-
+static void drawStridedSlowVs(IWineD3DDevice *iface, const WineDirect3DVertexStridedData *sd, UINT numberOfVertices,
+ GLenum glPrimitiveType, const void *idxData, short idxSize, ULONG minIndex, ULONG startIdx, ULONG startVertex)
+{
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface;
long SkipnStrides = startVertex + This->stateBlock->loadBaseVertexIndex;
const WORD *pIdxBufS = NULL;
const DWORD *pIdxBufL = NULL;
- LONG vx_index;
+ ULONG vx_index;
int i;
IWineD3DStateBlockImpl *stateblock = This->stateBlock;
- BYTE *ptr;
+ const BYTE *ptr;
if (idxSize != 0) {
/* Immediate mode drawing can't make use of indices in a vbo - get the data from the index buffer.
glEnd();
}
-static inline void drawStridedInstanced(IWineD3DDevice *iface, WineDirect3DVertexStridedData *sd, UINT numberOfVertices,
- GLenum glPrimitiveType, const void *idxData, short idxSize, ULONG minIndex,
- ULONG startIdx, ULONG startVertex) {
- UINT numInstances = 0;
- int numInstancedAttribs = 0, i, j;
+static inline void drawStridedInstanced(IWineD3DDevice *iface, const WineDirect3DVertexStridedData *sd,
+ UINT numberOfVertices, GLenum glPrimitiveType, const void *idxData, short idxSize, ULONG minIndex,
+ ULONG startIdx, ULONG startVertex)
+{
+ UINT numInstances = 0, i;
+ int numInstancedAttribs = 0, j;
UINT instancedData[sizeof(sd->u.input) / sizeof(sd->u.input[0]) /* 16 */];
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface;
IWineD3DStateBlockImpl *stateblock = This->stateBlock;
for(i = 0; i < numInstances; i++) {
/* Specify the instanced attributes using immediate mode calls */
for(j = 0; j < numInstancedAttribs; j++) {
- BYTE *ptr = sd->u.input[instancedData[j]].lpData +
+ const BYTE *ptr = sd->u.input[instancedData[j]].lpData +
sd->u.input[instancedData[j]].dwStride * i +
stateblock->streamOffset[sd->u.input[instancedData[j]].streamNo];
if(sd->u.input[instancedData[j]].VBO) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
IWineD3DSurfaceImpl *target;
- int i;
+ unsigned int i;
if (NumPrimitives == 0) return;
{
GLenum glPrimType;
BOOL emulation = FALSE;
- WineDirect3DVertexStridedData *strided = &This->strided_streams;
+ const WineDirect3DVertexStridedData *strided = &This->strided_streams;
WineDirect3DVertexStridedData stridedlcl;
/* Ok, Work out which primitive is requested and how many vertexes that
will be */
if(!use_vs(This)) {
if(!This->strided_streams.u.s.position_transformed && This->activeContext->num_untracked_materials &&
This->stateBlock->renderState[WINED3DRS_LIGHTING]) {
- static BOOL first = TRUE;
- if(first) {
+ static BOOL warned;
+ if (!warned) {
FIXME("Using software emulation because not all material properties could be tracked\n");
- first = FALSE;
+ warned = TRUE;
} else {
TRACE("Using software emulation because not all material properties could be tracked\n");
}
/* Either write a pipeline replacement shader or convert the specular alpha from unsigned byte
* to a float in the vertex buffer
*/
- static BOOL first = TRUE;
- if(first) {
+ static BOOL warned;
+ if (!warned) {
FIXME("Using software emulation because manual fog coordinates are provided\n");
- first = FALSE;
+ warned = TRUE;
} else {
TRACE("Using software emulation because manual fog coordinates are provided\n");
}
if (This->useDrawStridedSlow || emulation) {
/* Immediate mode drawing */
if(use_vs(This)) {
- static BOOL first = TRUE;
- if(first) {
+ static BOOL warned;
+ if (!warned) {
FIXME("Using immediate mode with vertex shaders for half float emulation\n");
- first = FALSE;
+ warned = TRUE;
} else {
TRACE("Using immediate mode with vertex shaders for half float emulation\n");
}
unsigned int i, j, num_quads, out_vertex_size, buffer_size, d3d_out_vertex_size;
float max_x = 0.0, max_y = 0.0, max_z = 0.0, neg_z = 0.0;
WineDirect3DVertexStridedData strided;
- BYTE *data;
- WINED3DRECTPATCH_INFO *info = &patch->RectPatchInfo;
+ const BYTE *data;
+ const WINED3DRECTPATCH_INFO *info = &patch->RectPatchInfo;
DWORD vtxStride;
GLenum feedback_type;
GLfloat *feedbuffer;
/* First, get the boundary cube of the input data */
for(j = 0; j < info->Height; j++) {
for(i = 0; i < info->Width; i++) {
- float *v = (float *) (data + vtxStride * i + vtxStride * info->Stride * j);
+ const float *v = (const float *)(data + vtxStride * i + vtxStride * info->Stride * j);
if(fabs(v[0]) > max_x) max_x = fabs(v[0]);
if(fabs(v[1]) > max_y) max_y = fabs(v[1]);
if(fabs(v[2]) > max_z) max_z = fabs(v[2]);
checkGLcall("glPolygonMode(GL_FRONT_AND_BACK, GL_FILL)");
IWineD3DDeviceImpl_MarkStateDirty(This, STATE_RENDER(WINED3DRS_FILLMODE));
if(patch->has_normals) {
- float black[4] = {0, 0, 0, 0};
- float red[4] = {1, 0, 0, 0};
- float green[4] = {0, 1, 0, 0};
- float blue[4] = {0, 0, 1, 0};
- float white[4] = {1, 1, 1, 1};
+ const GLfloat black[4] = {0, 0, 0, 0};
+ const GLfloat red[4] = {1, 0, 0, 0};
+ const GLfloat green[4] = {0, 1, 0, 0};
+ const GLfloat blue[4] = {0, 0, 1, 0};
+ const GLfloat white[4] = {1, 1, 1, 1};
glEnable(GL_LIGHTING);
checkGLcall("glEnable(GL_LIGHTING)");
glLightModelfv(GL_LIGHT_MODEL_AMBIENT, black);
glMap2f(GL_MAP2_VERTEX_3,
0, 1, vtxStride / sizeof(float), info->Width,
0, 1, info->Stride * vtxStride / sizeof(float), info->Height,
- (float *) data);
+ (const GLfloat *)data);
checkGLcall("glMap2f");
if(patch->has_texcoords) {
glMap2f(GL_MAP2_TEXTURE_COORD_4,
0, 1, vtxStride / sizeof(float), info->Width,
0, 1, info->Stride * vtxStride / sizeof(float), info->Height,
- (float *) data);
+ (const GLfloat *)data);
checkGLcall("glMap2f");
}
glMapGrid2f(ceilf(patch->numSegs[0]), 0.0, 1.0, ceilf(patch->numSegs[1]), 0.0, 1.0);
if(patch->has_normals) {
/* Now do the same with reverse light directions */
- float x[4] = {-1, 0, 0, 0};
- float y[4] = { 0, -1, 0, 0};
- float z[4] = { 0, 0, -1, 0};
+ const GLfloat x[4] = {-1, 0, 0, 0};
+ const GLfloat y[4] = { 0, -1, 0, 0};
+ const GLfloat z[4] = { 0, 0, -1, 0};
glLightfv(GL_LIGHT0, GL_POSITION, x);
glLightfv(GL_LIGHT1, GL_POSITION, y);
glLightfv(GL_LIGHT2, GL_POSITION, z);
WINE_DEFAULT_DEBUG_CHANNEL(d3d_shader);
WINE_DECLARE_DEBUG_CHANNEL(d3d_constants);
WINE_DECLARE_DEBUG_CHANNEL(d3d_caps);
+WINE_DECLARE_DEBUG_CHANNEL(d3d);
#define GLINFO_LOCATION (*gl_info)
/* GLSL shader private data */
struct shader_glsl_priv {
struct hash_table_t *glsl_program_lookup;
- struct glsl_shader_prog_link *glsl_program;
+ const struct glsl_shader_prog_link *glsl_program;
GLhandleARB depth_blt_program[tex_type_count];
};
/* Struct to maintain data about a linked GLSL program */
struct glsl_shader_prog_link {
- struct list vshader_entry;
- struct list pshader_entry;
- GLhandleARB programId;
- GLhandleARB *vuniformF_locations;
- GLhandleARB *puniformF_locations;
- GLhandleARB vuniformI_locations[MAX_CONST_I];
- GLhandleARB puniformI_locations[MAX_CONST_I];
- GLhandleARB posFixup_location;
- GLhandleARB bumpenvmat_location[MAX_TEXTURES];
- GLhandleARB luminancescale_location[MAX_TEXTURES];
- GLhandleARB luminanceoffset_location[MAX_TEXTURES];
- GLhandleARB srgb_comparison_location;
- GLhandleARB srgb_mul_low_location;
- GLhandleARB ycorrection_location;
- GLenum vertex_color_clamp;
- GLhandleARB vshader;
- GLhandleARB pshader;
+ struct list vshader_entry;
+ struct list pshader_entry;
+ GLhandleARB programId;
+ GLhandleARB *vuniformF_locations;
+ GLhandleARB *puniformF_locations;
+ GLhandleARB vuniformI_locations[MAX_CONST_I];
+ GLhandleARB puniformI_locations[MAX_CONST_I];
+ GLhandleARB posFixup_location;
+ GLhandleARB bumpenvmat_location[MAX_TEXTURES];
+ GLhandleARB luminancescale_location[MAX_TEXTURES];
+ GLhandleARB luminanceoffset_location[MAX_TEXTURES];
+ GLhandleARB ycorrection_location;
+ GLenum vertex_color_clamp;
+ GLhandleARB vshader;
+ IWineD3DPixelShader *pshader;
+ struct ps_compile_args ps_args;
};
typedef struct {
- GLhandleARB vshader;
- GLhandleARB pshader;
+ GLhandleARB vshader;
+ IWineD3DPixelShader *pshader;
+ struct ps_compile_args ps_args;
} glsl_program_key_t;
/** Prints the GLSL info log which will contain error messages if they exist */
-static void print_glsl_info_log(WineD3D_GL_Info *gl_info, GLhandleARB obj) {
+static void print_glsl_info_log(const WineD3D_GL_Info *gl_info, GLhandleARB obj)
+{
int infologLength = 0;
char *infoLog;
- int i;
+ unsigned int i;
BOOL is_spam;
const char *spam[] = {
/**
* Loads (pixel shader) samplers
*/
-static void shader_glsl_load_psamplers(
- WineD3D_GL_Info *gl_info,
- IWineD3DStateBlock* iface,
- GLhandleARB programId) {
-
+static void shader_glsl_load_psamplers(const WineD3D_GL_Info *gl_info, IWineD3DStateBlock *iface, GLhandleARB programId)
+{
IWineD3DStateBlockImpl* stateBlock = (IWineD3DStateBlockImpl*) iface;
GLhandleARB name_loc;
int i;
}
}
-static void shader_glsl_load_vsamplers(WineD3D_GL_Info *gl_info, IWineD3DStateBlock* iface, GLhandleARB programId) {
+static void shader_glsl_load_vsamplers(const WineD3D_GL_Info *gl_info, IWineD3DStateBlock *iface, GLhandleARB programId)
+{
IWineD3DStateBlockImpl* stateBlock = (IWineD3DStateBlockImpl*) iface;
GLhandleARB name_loc;
char sampler_name[20];
* Loads floating point constants (aka uniforms) into the currently set GLSL program.
* When constant_list == NULL, it will load all the constants.
*/
-static void shader_glsl_load_constantsF(IWineD3DBaseShaderImpl* This, WineD3D_GL_Info *gl_info,
- unsigned int max_constants, float* constants, GLhandleARB *constant_locations,
- struct list *constant_list) {
- constants_entry *constant;
- local_constant* lconst;
+static void shader_glsl_load_constantsF(IWineD3DBaseShaderImp