start adding d3d9 display method, but.. it was more work than gdi+, as I expected. I'll finish it another time.

This commit is contained in:
zeromus 2014-12-08 02:15:42 +00:00
parent 1473db5aa8
commit 08ae448257
22 changed files with 853 additions and 88 deletions

View File

@ -105,7 +105,7 @@ namespace BizHawk.Client.Common
}
}
public enum EDispMethod { OpenGL, GdiPlus };
public enum EDispMethod { OpenGL, GdiPlus, SlimDX9 };
public enum EDispManagerAR { None, System, Custom };

View File

@ -1444,6 +1444,10 @@
<Project>{5160CFB1-5389-47C1-B7F6-8A0DC97641EE}</Project>
<Name>BizHawk.Bizware.BizwareGL.OpenTK</Name>
</ProjectReference>
<ProjectReference Include="..\Bizware\BizHawk.Bizware.BizwareGL.SlimDX\BizHawk.Bizware.BizwareGL.SlimDX.csproj">
<Project>{E6B436B1-A3CD-4C9A-8F76-5D7154726884}</Project>
<Name>BizHawk.Bizware.BizwareGL.SlimDX</Name>
</ProjectReference>
<ProjectReference Include="..\Bizware\BizHawk.Bizware.BizwareGL\BizHawk.Bizware.BizwareGL.csproj">
<Project>{9F84A0B2-861E-4EF4-B89B-5E2A3F38A465}</Project>
<Name>BizHawk.Bizware.BizwareGL</Name>

View File

@ -46,6 +46,8 @@ namespace BizHawk.Client.EmuHawk
if (GL is BizHawk.Bizware.BizwareGL.Drivers.OpenTK.IGL_TK)
Renderer = new GuiRenderer(GL);
else if (GL is BizHawk.Bizware.BizwareGL.Drivers.SlimDX.IGL_SlimDX9)
Renderer = new GuiRenderer(GL);
else
Renderer = new GDIPlusGuiRenderer((BizHawk.Bizware.BizwareGL.Drivers.GdiPlus.IGL_GdiPlus)GL);
@ -484,7 +486,8 @@ TESTEROO:
if (!simulate)
{
//special codepath for GDI+
if (GL is IGL_GdiPlus)
//TODO - make for gdi+ only. maybe other codepath for d3d
if (!(GL is BizHawk.Bizware.BizwareGL.Drivers.OpenTK.IGL_TK))
{
//wrap the videoprovider data in a BitmapBuffer (no point to refactoring that many IVideoProviders)
bb = new BitmapBuffer(bufferWidth, bufferHeight, videoBuffer);

View File

@ -79,13 +79,19 @@ namespace BizHawk.Client.EmuHawk
//create IGL context. we do this whether or not the user has selected OpenGL, so that we can run opengl-based emulator cores
GlobalWin.IGL_GL = new Bizware.BizwareGL.Drivers.OpenTK.IGL_TK();
if(Global.Config.DispMethod == Config.EDispMethod.GdiPlus)
GlobalWin.GL = new Bizware.BizwareGL.Drivers.GdiPlus.IGL_GdiPlus();
else
GlobalWin.GL = new Bizware.BizwareGL.Drivers.OpenTK.IGL_TK();
//setup the GL context manager, needed for coping with multiple opengl cores vs opengl display method
GlobalWin.GLManager = new GLManager();
GlobalWin.CR_GL = GlobalWin.GLManager.GetContextForIGL(GlobalWin.GL);
//now create the "GL" context for the display method. we can reuse the IGL_TK context if opengl display method is chosen
if (Global.Config.DispMethod == Config.EDispMethod.GdiPlus)
GlobalWin.GL = new Bizware.BizwareGL.Drivers.GdiPlus.IGL_GdiPlus();
else if (Global.Config.DispMethod == Config.EDispMethod.SlimDX9)
GlobalWin.GL = new Bizware.BizwareGL.Drivers.SlimDX.IGL_SlimDX9();
else
GlobalWin.GL = GlobalWin.IGL_GL;
//WHY do we have to do this? some intel graphics drivers (ig7icd64.dll 10.18.10.3304 on an unknown chip on win8.1) are calling SetDllDirectory() for the process, which ruins stuff.
//The relevant initialization happened just before in "create IGL context".
//It isn't clear whether we need the earlier SetDllDirectory(), but I think we do.

View File

@ -63,11 +63,13 @@
this.tabControl1 = new System.Windows.Forms.TabControl();
this.tpAR = new System.Windows.Forms.TabPage();
this.tpDispMethod = new System.Windows.Forms.TabPage();
this.tpMisc = new System.Windows.Forms.TabPage();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.rbGDIPlus = new System.Windows.Forms.RadioButton();
this.label6 = new System.Windows.Forms.Label();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.label7 = new System.Windows.Forms.Label();
this.rbGDIPlus = new System.Windows.Forms.RadioButton();
this.tpMisc = new System.Windows.Forms.TabPage();
this.rbD3D9 = new System.Windows.Forms.RadioButton();
this.label8 = new System.Windows.Forms.Label();
this.groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.tbScanlineIntensity)).BeginInit();
this.grpFinalFilter.SuspendLayout();
@ -75,8 +77,8 @@
this.tabControl1.SuspendLayout();
this.tpAR.SuspendLayout();
this.tpDispMethod.SuspendLayout();
this.tpMisc.SuspendLayout();
this.groupBox3.SuspendLayout();
this.tpMisc.SuspendLayout();
this.SuspendLayout();
//
// btnCancel
@ -394,7 +396,7 @@
//
this.rbOpenGL.AutoSize = true;
this.rbOpenGL.Checked = true;
this.rbOpenGL.Location = new System.Drawing.Point(9, 19);
this.rbOpenGL.Location = new System.Drawing.Point(6, 80);
this.rbOpenGL.Name = "rbOpenGL";
this.rbOpenGL.Size = new System.Drawing.Size(65, 17);
this.rbOpenGL.TabIndex = 3;
@ -404,7 +406,7 @@
//
// label5
//
this.label5.Location = new System.Drawing.Point(24, 39);
this.label5.Location = new System.Drawing.Point(21, 100);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(359, 47);
this.label5.TabIndex = 16;
@ -451,6 +453,49 @@
this.tpDispMethod.Text = "Display Method";
this.tpDispMethod.UseVisualStyleBackColor = true;
//
// label6
//
this.label6.Location = new System.Drawing.Point(3, 227);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(359, 47);
this.label6.TabIndex = 18;
this.label6.Text = "Changes require restart of program to take effect.\r\n";
//
// groupBox3
//
this.groupBox3.Controls.Add(this.label8);
this.groupBox3.Controls.Add(this.rbD3D9);
this.groupBox3.Controls.Add(this.label7);
this.groupBox3.Controls.Add(this.rbGDIPlus);
this.groupBox3.Controls.Add(this.label5);
this.groupBox3.Controls.Add(this.rbOpenGL);
this.groupBox3.Location = new System.Drawing.Point(4, 3);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(389, 221);
this.groupBox3.TabIndex = 16;
this.groupBox3.TabStop = false;
//
// label7
//
this.label7.Location = new System.Drawing.Point(21, 170);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(359, 47);
this.label7.TabIndex = 18;
this.label7.Text = " • Mainly for compatibility purposes\r\n • Missing some features\r\n • Works better o" +
"ver Remote Desktop, etc.\r\n";
//
// rbGDIPlus
//
this.rbGDIPlus.AutoSize = true;
this.rbGDIPlus.Checked = true;
this.rbGDIPlus.Location = new System.Drawing.Point(6, 150);
this.rbGDIPlus.Name = "rbGDIPlus";
this.rbGDIPlus.Size = new System.Drawing.Size(50, 17);
this.rbGDIPlus.TabIndex = 17;
this.rbGDIPlus.TabStop = true;
this.rbGDIPlus.Text = "GDI+";
this.rbGDIPlus.UseVisualStyleBackColor = true;
//
// tpMisc
//
this.tpMisc.Controls.Add(this.label2);
@ -464,46 +509,26 @@
this.tpMisc.Text = "Misc";
this.tpMisc.UseVisualStyleBackColor = true;
//
// groupBox3
// rbD3D9
//
this.groupBox3.Controls.Add(this.label7);
this.groupBox3.Controls.Add(this.rbGDIPlus);
this.groupBox3.Controls.Add(this.label5);
this.groupBox3.Controls.Add(this.rbOpenGL);
this.groupBox3.Location = new System.Drawing.Point(4, 3);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(389, 165);
this.groupBox3.TabIndex = 16;
this.groupBox3.TabStop = false;
this.rbD3D9.AutoSize = true;
this.rbD3D9.Checked = true;
this.rbD3D9.Enabled = false;
this.rbD3D9.Location = new System.Drawing.Point(6, 10);
this.rbD3D9.Name = "rbD3D9";
this.rbD3D9.Size = new System.Drawing.Size(73, 17);
this.rbD3D9.TabIndex = 19;
this.rbD3D9.TabStop = true;
this.rbD3D9.Text = "Direct3D9";
this.rbD3D9.UseVisualStyleBackColor = true;
//
// rbGDIPlus
// label8
//
this.rbGDIPlus.AutoSize = true;
this.rbGDIPlus.Checked = true;
this.rbGDIPlus.Location = new System.Drawing.Point(6, 89);
this.rbGDIPlus.Name = "rbGDIPlus";
this.rbGDIPlus.Size = new System.Drawing.Size(50, 17);
this.rbGDIPlus.TabIndex = 17;
this.rbGDIPlus.TabStop = true;
this.rbGDIPlus.Text = "GDI+";
this.rbGDIPlus.UseVisualStyleBackColor = true;
//
// label6
//
this.label6.Location = new System.Drawing.Point(3, 171);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(359, 47);
this.label6.TabIndex = 18;
this.label6.Text = "Changes require restart of program to take effect.\r\n";
//
// label7
//
this.label7.Location = new System.Drawing.Point(24, 109);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(359, 47);
this.label7.TabIndex = 18;
this.label7.Text = " • Mainly for compatibility purposes\r\n • Missing some features\r\n • Works better o" +
"ver Remote Desktop, etc.\r\n";
this.label8.Location = new System.Drawing.Point(24, 30);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(359, 47);
this.label8.TabIndex = 20;
this.label8.Text = " • Not working yet\r\n • Best compatibility\r\n • No support for custom shaders\r\n";
//
// DisplayConfigLite
//
@ -530,10 +555,10 @@
this.tpAR.ResumeLayout(false);
this.tpAR.PerformLayout();
this.tpDispMethod.ResumeLayout(false);
this.tpMisc.ResumeLayout(false);
this.tpMisc.PerformLayout();
this.groupBox3.ResumeLayout(false);
this.groupBox3.PerformLayout();
this.tpMisc.ResumeLayout(false);
this.tpMisc.PerformLayout();
this.ResumeLayout(false);
}
@ -579,5 +604,7 @@
private System.Windows.Forms.Label label7;
private System.Windows.Forms.RadioButton rbGDIPlus;
private System.Windows.Forms.TabPage tpMisc;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.RadioButton rbD3D9;
}
}

View File

@ -38,6 +38,7 @@ namespace BizHawk.Client.EmuHawk.config
rbOpenGL.Checked = Global.Config.DispMethod == Config.EDispMethod.OpenGL;
rbGDIPlus.Checked = Global.Config.DispMethod == Config.EDispMethod.GdiPlus;
rbD3D9.Checked = Global.Config.DispMethod == Config.EDispMethod.SlimDX9;
// null emulator config hack
{
@ -113,6 +114,8 @@ namespace BizHawk.Client.EmuHawk.config
Global.Config.DispMethod = Config.EDispMethod.OpenGL;
if(rbGDIPlus.Checked)
Global.Config.DispMethod = Config.EDispMethod.GdiPlus;
if(rbD3D9.Checked)
Global.Config.DispMethod = Config.EDispMethod.SlimDX9;
Global.Config.DispUserFilterPath = PathSelection;
GlobalWin.DisplayManager.RefreshUserShader();

View File

@ -29,6 +29,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BizHawk.Client.DBMan", "Biz
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BizHawk.Bizware.BizwareGL.GdiPlus", "Bizware\BizHawk.Bizware.BizwareGL.GdiPlus\BizHawk.Bizware.BizwareGL.GdiPlus.csproj", "{337CA23E-65E7-44E1-9411-97EE08BB8116}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BizHawk.Bizware.BizwareGL.SlimDX", "Bizware\BizHawk.Bizware.BizwareGL.SlimDX\BizHawk.Bizware.BizwareGL.SlimDX.csproj", "{E6B436B1-A3CD-4C9A-8F76-5D7154726884}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -173,6 +175,18 @@ Global
{337CA23E-65E7-44E1-9411-97EE08BB8116}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{337CA23E-65E7-44E1-9411-97EE08BB8116}.Release|Win32.ActiveCfg = Release|Any CPU
{337CA23E-65E7-44E1-9411-97EE08BB8116}.Release|x86.ActiveCfg = Release|Any CPU
{E6B436B1-A3CD-4C9A-8F76-5D7154726884}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E6B436B1-A3CD-4C9A-8F76-5D7154726884}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E6B436B1-A3CD-4C9A-8F76-5D7154726884}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{E6B436B1-A3CD-4C9A-8F76-5D7154726884}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{E6B436B1-A3CD-4C9A-8F76-5D7154726884}.Debug|Win32.ActiveCfg = Debug|Any CPU
{E6B436B1-A3CD-4C9A-8F76-5D7154726884}.Debug|x86.ActiveCfg = Debug|Any CPU
{E6B436B1-A3CD-4C9A-8F76-5D7154726884}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E6B436B1-A3CD-4C9A-8F76-5D7154726884}.Release|Any CPU.Build.0 = Release|Any CPU
{E6B436B1-A3CD-4C9A-8F76-5D7154726884}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{E6B436B1-A3CD-4C9A-8F76-5D7154726884}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{E6B436B1-A3CD-4C9A-8F76-5D7154726884}.Release|Win32.ActiveCfg = Release|Any CPU
{E6B436B1-A3CD-4C9A-8F76-5D7154726884}.Release|x86.ActiveCfg = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -188,6 +202,7 @@ Global
{9F84A0B2-861E-4EF4-B89B-5E2A3F38A465} = {0540A9A6-977E-466D-8BD3-1D8590BD5282}
{5160CFB1-5389-47C1-B7F6-8A0DC97641EE} = {0540A9A6-977E-466D-8BD3-1D8590BD5282}
{337CA23E-65E7-44E1-9411-97EE08BB8116} = {0540A9A6-977E-466D-8BD3-1D8590BD5282}
{E6B436B1-A3CD-4C9A-8F76-5D7154726884} = {0540A9A6-977E-466D-8BD3-1D8590BD5282}
EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution
StartupItem = BizHawk.Client.EmuHawk\BizHawk.Client.EmuHawk.csproj

View File

@ -84,11 +84,10 @@ namespace BizHawk.Bizware.BizwareGL.Drivers.GdiPlus
public void Clear(OpenTK.Graphics.OpenGL.ClearBufferMask mask)
{
}
public string API { get { return "GDIPLUS"; } }
public IBlendState CreateBlendState(BlendingFactorSrc colorSource, BlendEquationMode colorEquation, BlendingFactorDest colorDest,
BlendingFactorSrc alphaSource, BlendEquationMode alphaEquation, BlendingFactorDest alphaDest)
{
@ -106,7 +105,10 @@ namespace BizHawk.Bizware.BizwareGL.Drivers.GdiPlus
public IntPtr GenTexture() { return ResourceIDs.Alloc(ResourceIdManager.EResourceType.Texture); }
public void FreeTexture(IntPtr texHandle) { ResourceIDs.Free(texHandle); }
public void FreeTexture(Texture2d tex)
{
ResourceIDs.Free(tex.Id);
}
public IntPtr GetEmptyHandle() { return new IntPtr(0); }
public IntPtr GetEmptyUniformHandle() { return new IntPtr(-1); }
@ -214,7 +216,7 @@ namespace BizHawk.Bizware.BizwareGL.Drivers.GdiPlus
tw.SDBitmap = sdbmp;
IntPtr id = GenTexture();
ResourceIDs.Lookup[id.ToInt32()] = tw;
return new Texture2d(this, id, bitmap.Width, bitmap.Height);
return new Texture2d(this, id, null, bitmap.Width, bitmap.Height);
}
public Texture2d LoadTexture(Stream stream)
@ -248,7 +250,7 @@ namespace BizHawk.Bizware.BizwareGL.Drivers.GdiPlus
var tw = new TextureWrapper();
tw.SDBitmap = sdbmp;
ResourceIDs.Lookup[id.ToInt32()] = tw;
return new Texture2d(this, id, bmp.Width, bmp.Height);
return new Texture2d(this, id, null, bmp.Width, bmp.Height);
}
public unsafe BitmapBuffer ResolveTexture2d(Texture2d tex)

View File

@ -42,6 +42,8 @@ namespace BizHawk.Bizware.BizwareGL.Drivers.OpenTK
//NOTE: this throws EGL exceptions anyway. I'm going to ignore it and whine about it later
}
public string API { get { return "OPENGL"; } }
public IGL_TK()
{
//make an 'offscreen context' so we can at least do things without having to create a window
@ -87,7 +89,10 @@ namespace BizHawk.Bizware.BizwareGL.Drivers.OpenTK
}
public IntPtr GenTexture() { return new IntPtr(GL.GenTexture()); }
public void FreeTexture(IntPtr texHandle) { GL.DeleteTexture(texHandle.ToInt32()); }
public void FreeTexture(Texture2d tex)
{
GL.DeleteTexture(tex.Id.ToInt32());
}
public IntPtr GetEmptyHandle() { return new IntPtr(0); }
public IntPtr GetEmptyUniformHandle() { return new IntPtr(-1); }
@ -367,13 +372,13 @@ namespace BizHawk.Bizware.BizwareGL.Drivers.OpenTK
public Texture2d CreateTexture(int width, int height)
{
IntPtr id = (this as IGL).GenTexture();
return new Texture2d(this, id, width, height);
IntPtr id = GenTexture();
return new Texture2d(this, id, null, width, height);
}
public Texture2d WrapGLTexture2d(IntPtr glTexId, int width, int height)
{
return new Texture2d(this as IGL,glTexId, width, height);
return new Texture2d(this as IGL, glTexId, null, width, height);
}
public void LoadTextureData(Texture2d tex, BitmapBuffer bmp)
@ -399,8 +404,8 @@ namespace BizHawk.Bizware.BizwareGL.Drivers.OpenTK
public unsafe RenderTarget CreateRenderTarget(int w, int h)
{
//create a texture for it
IntPtr texid = (this as IGL).GenTexture();
Texture2d tex = new Texture2d(this, texid, w, h);
IntPtr texid = GenTexture();
Texture2d tex = new Texture2d(this, texid, null, w, h);
GL.BindTexture(TextureTarget.Texture2D,texid.ToInt32());
GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgba8, w, h, 0, PixelFormat.Bgra, PixelType.UnsignedByte, IntPtr.Zero);
tex.SetMagFilter(TextureMagFilter.Nearest);
@ -438,10 +443,10 @@ namespace BizHawk.Bizware.BizwareGL.Drivers.OpenTK
public Texture2d LoadTexture(BitmapBuffer bmp)
{
Texture2d ret = null;
IntPtr id = (this as IGL).GenTexture();
IntPtr id = GenTexture();
try
{
ret = new Texture2d(this, id, bmp.Width, bmp.Height);
ret = new Texture2d(this, id, null, bmp.Width, bmp.Height);
GL.BindTexture(TextureTarget.Texture2D, id.ToInt32());
//picking a color order that matches doesnt seem to help, any. maybe my driver is accelerating it, or maybe it isnt a big deal. but its something to study on another day
GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgba, bmp.Width, bmp.Height, 0, PixelFormat.Bgra, PixelType.UnsignedByte, IntPtr.Zero);
@ -449,7 +454,7 @@ namespace BizHawk.Bizware.BizwareGL.Drivers.OpenTK
}
catch
{
(this as IGL).FreeTexture(id);
GL.DeleteTexture(id.ToInt32());
throw;
}

View File

@ -18,9 +18,9 @@ namespace BizHawk.Bizware.BizwareGL.Drivers.OpenTK
Owner = owner as IGL_TK;
VertexLayout = owner.CreateVertexLayout();
VertexLayout.DefineVertexAttribute("VertexCoord", 0, 4, VertexAttribPointerType.Float, false, 40, 0); //VertexCoord
VertexLayout.DefineVertexAttribute("ColorShit", 1, 4, VertexAttribPointerType.Float, false, 40, 16); //COLOR
VertexLayout.DefineVertexAttribute("TexCoord", 2, 2, VertexAttribPointerType.Float, false, 40, 32); //TexCoord (is this vec2 or vec4? the glsl converted from cg had vec4 but the cg had vec2...)
VertexLayout.DefineVertexAttribute("VertexCoord", 0, 4, VertexAttribPointerType.Float, AttributeUsage.Unspecified, false, 40, 0); //VertexCoord
VertexLayout.DefineVertexAttribute("ColorShit", 1, 4, VertexAttribPointerType.Float, AttributeUsage.Unspecified, false, 40, 16); //COLOR
VertexLayout.DefineVertexAttribute("TexCoord", 2, 2, VertexAttribPointerType.Float, AttributeUsage.Unspecified, false, 40, 32); //TexCoord (is this vec2 or vec4? the glsl converted from cg had vec4 but the cg had vec2...)
VertexLayout.Close();
string vsSource = "#define VERTEX\r\n" + source;

View File

@ -0,0 +1,79 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{E6B436B1-A3CD-4C9A-8F76-5D7154726884}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>BizHawk.Bizware.BizwareGL.SlimDX</RootNamespace>
<AssemblyName>BizHawk.Bizware.BizwareGL.SlimDX</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<ItemGroup>
<Reference Include="OpenTK, Version=1.1.0.0, Culture=neutral, PublicKeyToken=bad199fe84eb3df4, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\References\OpenTK.dll</HintPath>
</Reference>
<Reference Include="SlimDX, Version=1.1.0.0, Culture=neutral, PublicKeyToken=bad199fe84eb3df4, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\References\SlimDX.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\BizHawk.Common\BizHawk.Common.csproj">
<Project>{866F8D13-0678-4FF9-80A4-A3993FD4D8A3}</Project>
<Name>BizHawk.Common</Name>
</ProjectReference>
<ProjectReference Include="..\BizHawk.Bizware.BizwareGL\BizHawk.Bizware.BizwareGL.csproj">
<Project>{9F84A0B2-861E-4EF4-B89B-5E2A3F38A465}</Project>
<Name>BizHawk.Bizware.BizwareGL</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Compile Include="GLControlWrapper_SlimDX9.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="IGL_SlimDX9.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@ -0,0 +1,71 @@
using System;
using System.Drawing;
using System.Reflection;
using System.Threading;
using System.IO;
using System.Collections.Generic;
using System.Windows.Forms;
using BizHawk.Bizware.BizwareGL;
using SlimDX.Direct3D9;
namespace BizHawk.Bizware.BizwareGL.Drivers.SlimDX
{
public class GLControlWrapper_SlimDX9 : Control, IGraphicsControl
{
public GLControlWrapper_SlimDX9(IGL_SlimDX9 sdx)
{
this.sdx = sdx;
//uhhh not sure what we need to be doing here
//SetStyle(ControlStyles.AllPaintingInWmPaint, true);
SetStyle(ControlStyles.UserPaint, true);
SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
SetStyle(ControlStyles.Opaque, true);
SetStyle(ControlStyles.UserMouse, true);
Resize += new EventHandler(GLControlWrapper_SlimDX_Resize);
}
public bool Vsync;
void GLControlWrapper_SlimDX_Resize(object sender, EventArgs e)
{
sdx.RefreshControlSwapChain(this);
}
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
//if(MyBufferedGraphics != null)
}
IGL_SlimDX9 sdx;
public Control Control { get { return this; } }
public SwapChain SwapChain;
public void SetVsync(bool state)
{
Vsync = state;
sdx.RefreshControlSwapChain(this);
}
public void Begin()
{
}
public void End()
{
}
public void SwapBuffers()
{
}
}
}

View File

@ -0,0 +1,474 @@
using System;
using System.Text;
using System.IO;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using System.Windows.Forms;
using swf = System.Windows.Forms;
using sd = System.Drawing;
using sdi = System.Drawing.Imaging;
using BizHawk.Bizware.BizwareGL;
using SlimDX.Direct3D9;
using d3d9=SlimDX.Direct3D9;
using OpenTK;
using OpenTK.Graphics;
using gl=OpenTK.Graphics.OpenGL;
namespace BizHawk.Bizware.BizwareGL.Drivers.SlimDX
{
public class IGL_SlimDX9 : IGL
{
static Direct3D d3d;
private Device dev;
INativeWindow OffscreenNativeWindow;
public string API { get { return "D3D9"; } }
public IGL_SlimDX9()
{
if (d3d == null)
{
d3d = new Direct3D();
}
//make an 'offscreen context' so we can at least do things without having to create a window
OffscreenNativeWindow = new OpenTK.NativeWindow();
OffscreenNativeWindow.ClientSize = new sd.Size(8, 8);
CreateDevice();
}
private void DestroyDevice()
{
if (dev != null)
{
dev.Dispose();
dev = null;
}
}
public void CreateDevice()
{
DestroyDevice();
//just create some present params so we can get the device created
var pp = new PresentParameters
{
BackBufferWidth = 8,
BackBufferHeight = 8,
DeviceWindowHandle = OffscreenNativeWindow.WindowInfo.Handle,
PresentationInterval = PresentInterval.Immediate
};
var flags = CreateFlags.SoftwareVertexProcessing;
if ((d3d.GetDeviceCaps(0, DeviceType.Hardware).DeviceCaps & DeviceCaps.HWTransformAndLight) != 0)
{
flags = CreateFlags.HardwareVertexProcessing;
}
dev = new Device(d3d, 0, DeviceType.Hardware, pp.DeviceWindowHandle, flags, pp);
}
void IDisposable.Dispose()
{
}
public void Clear(OpenTK.Graphics.OpenGL.ClearBufferMask mask)
{
}
public IBlendState CreateBlendState(gl.BlendingFactorSrc colorSource, gl.BlendEquationMode colorEquation, gl.BlendingFactorDest colorDest,
gl.BlendingFactorSrc alphaSource, gl.BlendEquationMode alphaEquation, gl.BlendingFactorDest alphaDest)
{
return null;
}
public void SetClearColor(sd.Color color)
{
}
public unsafe void BindArrayData(void* pData)
{
}
public void FreeTexture(Texture2d tex) {
var dtex = tex.Opaque as d3d9.Texture;
dtex.Dispose();
}
public IntPtr GetEmptyHandle() { return new IntPtr(0); }
public IntPtr GetEmptyUniformHandle() { return new IntPtr(-1); }
class ShaderWrapper
{
public d3d9.ConstantTable ct;
public d3d9.VertexShader vs;
public d3d9.PixelShader ps;
}
public Shader CreateFragmentShader(string source, bool required)
{
ShaderWrapper sw = new ShaderWrapper();
string errors;
using (var bytecode = d3d9.ShaderBytecode.Compile(source, null, null, "psmain", "ps_2_0", ShaderFlags.None, out errors))
{
sw.ct = bytecode.ConstantTable;
sw.ps = new PixelShader(dev, bytecode);
}
Shader s = new Shader(this, IntPtr.Zero, true);
s.Opaque = sw;
return s;
}
public Shader CreateVertexShader(string source, bool required)
{
ShaderWrapper sw = new ShaderWrapper();
string errors;
using (var bytecode = d3d9.ShaderBytecode.Compile(source, null, null, "vsmain", "vs_2_0", ShaderFlags.None, out errors))
{
sw.ct = bytecode.ConstantTable;
sw.vs = new VertexShader(dev, bytecode);
}
Shader s = new Shader(this, IntPtr.Zero, true);
s.Opaque = sw;
return s;
}
public void FreeShader(IntPtr shader) { }
public void SetBlendState(IBlendState rsBlend)
{
//TODO for real
}
class MyBlendState : IBlendState { }
static MyBlendState _rsBlendNone = new MyBlendState(), _rsBlendNormal = new MyBlendState();
public IBlendState BlendNone { get { return _rsBlendNone; } }
public IBlendState BlendNormal { get { return _rsBlendNormal; } }
public Pipeline CreatePipeline(VertexLayout vertexLayout, Shader vertexShader, Shader fragmentShader, bool required)
{
VertexElement[] ves = new VertexElement[vertexLayout.Items.Count];
foreach (var kvp in vertexLayout.Items)
{
var item = kvp.Value;
d3d9.DeclarationType decltype = DeclarationType.Float1;
switch (item.AttribType)
{
case gl.VertexAttribPointerType.Float:
if (item.Components == 1) decltype = DeclarationType.Float1;
else if (item.Components == 2) decltype = DeclarationType.Float2;
else if (item.Components == 3) decltype = DeclarationType.Float3;
else if (item.Components == 4) decltype = DeclarationType.Float4;
else throw new NotSupportedException();
break;
default:
throw new NotSupportedException();
}
d3d9.DeclarationUsage usage = DeclarationUsage.Position;
byte usageIndex = 0;
switch(item.Usage)
{
case AttributeUsage.Position:
usage = DeclarationUsage.Position;
break;
case AttributeUsage.Texcoord0:
usage = DeclarationUsage.TextureCoordinate;
break;
case AttributeUsage.Texcoord1:
usage = DeclarationUsage.TextureCoordinate;
usageIndex = 1;
break;
case AttributeUsage.Color0:
usage = DeclarationUsage.Color;
break;
default:
throw new NotSupportedException();
}
ves[kvp.Key] = new VertexElement(0, (short)item.Offset, decltype, DeclarationMethod.Default, usage, usageIndex);
}
var pw = new PipelineWrapper();
pw.VertexDeclaration = new VertexDeclaration(dev, ves);
Pipeline pipeline = new Pipeline(this,IntPtr.Zero,true, vertexLayout, new List<UniformInfo>());
pipeline.Opaque = pw;
return pipeline;
}
class PipelineWrapper
{
public d3d9.VertexDeclaration VertexDeclaration;
}
public VertexLayout CreateVertexLayout() { return new VertexLayout(this, new IntPtr(0)); }
public void BindTexture2d(Texture2d tex)
{
}
public void SetTextureWrapMode(Texture2d tex, bool clamp)
{
}
public void DrawArrays(PrimitiveType mode, int first, int count)
{
}
public void BindPipeline(Pipeline pipeline)
{
}
public void SetPipelineUniform(PipelineUniform uniform, bool value)
{
}
public unsafe void SetPipelineUniformMatrix(PipelineUniform uniform, Matrix4 mat, bool transpose)
{
}
public unsafe void SetPipelineUniformMatrix(PipelineUniform uniform, ref Matrix4 mat, bool transpose)
{
}
public void SetPipelineUniform(PipelineUniform uniform, Vector4 value)
{
}
public void SetPipelineUniform(PipelineUniform uniform, Vector2 value)
{
}
public void SetPipelineUniform(PipelineUniform uniform, float value)
{
}
public unsafe void SetPipelineUniform(PipelineUniform uniform, Vector4[] values)
{
}
public void SetPipelineUniformSampler(PipelineUniform uniform, IntPtr texHandle)
{
}
public void TexParameter2d(gl.TextureParameterName pname, int param)
{
//if (CurrentBoundTexture == null)
// return;
//TextureWrapper tw = TextureWrapperForTexture(CurrentBoundTexture);
//if (pname == TextureParameterName.TextureMinFilter)
// tw.MinFilter = (TextureMinFilter)param;
//if (pname == TextureParameterName.TextureMagFilter)
// tw.MagFilter = (TextureMagFilter)param;
}
public Texture2d LoadTexture(sd.Bitmap bitmap)
{
using (var bmp = new BitmapBuffer(bitmap, new BitmapLoadOptions()))
return (this as IGL).LoadTexture(bmp);
}
public Texture2d LoadTexture(Stream stream)
{
using (var bmp = new BitmapBuffer(stream, new BitmapLoadOptions()))
return (this as IGL).LoadTexture(bmp);
}
public Texture2d CreateTexture(int width, int height)
{
return null;
}
public Texture2d WrapGLTexture2d(IntPtr glTexId, int width, int height)
{
//TODO - need to rip the texturedata. we had code for that somewhere...
return null;
}
public void LoadTextureData(Texture2d tex, BitmapBuffer bmp)
{
sdi.BitmapData bmp_data = bmp.LockBits();
d3d9.Texture dtex = tex.Opaque as d3d9.Texture;
var dr = dtex.LockRectangle(0, LockFlags.None);
//TODO - do we need to handle odd sizes, weird pitches here?
dr.Data.WriteRange(bmp_data.Scan0, bmp.Width * bmp.Height);
dtex.UnlockRectangle(0);
bmp.UnlockBits(bmp_data);
}
public Texture2d LoadTexture(BitmapBuffer bmp)
{
var tex = new d3d9.Texture(dev, bmp.Width, bmp.Height, 1, d3d9.Usage.None, d3d9.Format.A8R8G8B8, d3d9.Pool.Managed);
var ret = new Texture2d(this, IntPtr.Zero, tex, bmp.Width, bmp.Height);
LoadTextureData(ret, bmp);
return ret;
}
public unsafe BitmapBuffer ResolveTexture2d(Texture2d tex)
{
//todo
return null;
}
public Texture2d LoadTexture(string path)
{
//todo
//using (var fs = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read))
// return (this as IGL).LoadTexture(fs);
return null;
}
public Matrix4 CreateGuiProjectionMatrix(int w, int h)
{
return CreateGuiProjectionMatrix(new sd.Size(w, h));
}
public Matrix4 CreateGuiViewMatrix(int w, int h)
{
return CreateGuiViewMatrix(new sd.Size(w, h));
}
public Matrix4 CreateGuiProjectionMatrix(sd.Size dims)
{
Matrix4 ret = Matrix4.Identity;
ret.M11 = 2.0f / (float)dims.Width;
ret.M22 = 2.0f / (float)dims.Height;
return ret;
}
public Matrix4 CreateGuiViewMatrix(sd.Size dims)
{
Matrix4 ret = Matrix4.Identity;
ret.M22 = -1.0f;
ret.M41 = -(float)dims.Width * 0.5f; // -0.5f;
ret.M42 = (float)dims.Height * 0.5f; // +0.5f;
return ret;
}
public void SetViewport(int x, int y, int width, int height)
{
}
public void SetViewport(int width, int height)
{
}
public void SetViewport(sd.Size size)
{
SetViewport(size.Width, size.Height);
}
public void SetViewport(swf.Control control)
{
}
public void BeginControl(GLControlWrapper_SlimDX9 control)
{
}
public void EndControl(GLControlWrapper_SlimDX9 control)
{
}
public void SwapControl(GLControlWrapper_SlimDX9 control)
{
}
public void FreeRenderTarget(RenderTarget rt)
{
//int id = rt.Id.ToInt32();
//var rtw = ResourceIDs.Lookup[id] as RenderTargetWrapper;
//rtw.Target.Dispose();
//ResourceIDs.Free(rt.Id);
}
public unsafe RenderTarget CreateRenderTarget(int w, int h)
{
//Texture2d tex = null;
//var rt = new RenderTarget(this, ResourceIDs.Alloc(ResourceIdManager.EResourceType.RenderTarget), tex);
//int id = rt.Id.ToInt32();
//RenderTargetWrapper rtw = new RenderTargetWrapper(this);
//rtw.Target = rt;
//ResourceIDs.Lookup[id] = rtw;
//return rt;
return null;
}
public void BindRenderTarget(RenderTarget rt)
{
//if (rt == null)
//{
// //null means to use the default RT for the current control
// CurrentRenderTargetWrapper = CurrentControl.RenderTargetWrapper;
//}
//else
//{
// CurrentRenderTargetWrapper = RenderTargetWrapperForRt(rt);
//}
}
public void RefreshControlSwapChain(GLControlWrapper_SlimDX9 control)
{
if (control.SwapChain != null)
{
control.SwapChain.Dispose();
control.SwapChain = null;
}
var pp = new PresentParameters
{
BackBufferWidth = Math.Max(8,control.ClientSize.Width),
BackBufferHeight = Math.Max(8, control.ClientSize.Height),
BackBufferCount = 2,
BackBufferFormat = Format.X8R8G8B8,
DeviceWindowHandle = control.Handle,
Windowed = true,
PresentationInterval = control.Vsync ? PresentInterval.One : PresentInterval.Immediate
};
control.SwapChain = new SwapChain(dev, pp);
}
public IGraphicsControl Internal_CreateGraphicsControl()
{
var ret = new GLControlWrapper_SlimDX9(this);
RefreshControlSwapChain(ret);
return ret;
}
public void DrawArrays(gl.PrimitiveType mode, int first, int count)
{
}
} //class IGL_SlimDX
}

View File

@ -0,0 +1,10 @@
namespace BizHawk.Bizware.BizwareGL
{
public enum AttributeUsage
{
Unspecified,
Position,
Color0,
Texcoord0, Texcoord1,
}
}

View File

@ -50,6 +50,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="AttributeInfo.cs" />
<Compile Include="AttributeUsage.cs" />
<Compile Include="BitmapBuffer.cs" />
<Compile Include="BitmapLoadOptions.cs" />
<Compile Include="Borrowed\BitmapFontParser\BitmapFont.cs" />

View File

@ -19,7 +19,7 @@ namespace BizHawk.Bizware.BizwareGL
//in case we need it
//GLControl.GetType().GetMethod("SetStyle", BindingFlags.Instance | BindingFlags.NonPublic).Invoke(GLControl, new object[] { System.Windows.Forms.ControlStyles.UserMouse, true });
IGC = owner.Internal_CreateGraphicsControl();
Managed = IGC as Control;

View File

@ -26,16 +26,29 @@ namespace BizHawk.Bizware.BizwareGL
Owner = owner;
VertexLayout = owner.CreateVertexLayout();
VertexLayout.DefineVertexAttribute("aPosition", 0, 2, VertexAttribPointerType.Float, false, 32, 0);
VertexLayout.DefineVertexAttribute("aTexcoord", 1, 2, VertexAttribPointerType.Float, false, 32, 8);
VertexLayout.DefineVertexAttribute("aColor", 2, 4, VertexAttribPointerType.Float, false, 32, 16);
VertexLayout.DefineVertexAttribute("aPosition", 0, 2, VertexAttribPointerType.Float, AttributeUsage.Position, false, 32, 0);
VertexLayout.DefineVertexAttribute("aTexcoord", 1, 2, VertexAttribPointerType.Float, AttributeUsage.Texcoord0, false, 32, 8);
VertexLayout.DefineVertexAttribute("aColor", 2, 4, VertexAttribPointerType.Float, AttributeUsage.Texcoord1, false, 32, 16);
VertexLayout.Close();
_Projection = new MatrixStack();
_Modelview = new MatrixStack();
var vs = Owner.CreateVertexShader(DefaultVertexShader,true);
var ps = Owner.CreateFragmentShader(DefaultPixelShader, true);
string psProgram, vsProgram;
if (owner.API == "D3D9")
{
vsProgram = DefaultShader_d3d9;
psProgram = DefaultShader_d3d9;
}
else
{
vsProgram = DefaultVertexShader_gl;
psProgram = DefaultPixelShader_gl;
}
var vs = Owner.CreateVertexShader(vsProgram, true);
var ps = Owner.CreateFragmentShader(psProgram, true);
CurrPipeline = DefaultPipeline = Owner.CreatePipeline(VertexLayout, vs, ps, true);
}
@ -346,7 +359,54 @@ namespace BizHawk.Bizware.BizwareGL
bool BlendStateSet;
#endif
public readonly string DefaultVertexShader = @"
public readonly string DefaultShader_d3d9 = @"
float4x4 um44Modelview, um44Projection;
float4 uModulateColor;
bool uSamplerEnable;
texture2D texture0;
sampler uSampler0 = sampler_state { Texture = (texture0); };
struct VS_INPUT
{
float2 aPosition : POSITION;
float2 aTexcoord : TEXCOORD0;
float4 aColor : TEXCOORD1;
};
struct VS_OUTPUT
{
float4 vPosition : POSITION;
float2 vTexcoord0 : TEXCOORD0;
float4 vCornerColor : TEXCOORD1;
};
struct PS_INPUT
{
float2 vTexcoord0 : TEXCOORD0;
float4 vCornerColor : TEXCOORD1;
};
VS_OUTPUT vsmain(VS_INPUT src)
{
VS_OUTPUT dst;
float4 temp = float4(src.aPosition,0,1);
dst.vPosition = mul(mul(temp,um44Modelview),um44Projection);
dst.vTexcoord0 = src.aTexcoord;
dst.vCornerColor = src.aColor * uModulateColor;
return dst;
}
float4 psmain(PS_INPUT src) : COLOR
{
float4 temp = src.vCornerColor;
if(uSamplerEnable) temp *= tex2D(uSampler0,src.vTexcoord0);
return temp;
}
";
public readonly string DefaultVertexShader_gl = @"
#version 110 //opengl 2.0 ~ 2004
uniform mat4 um44Modelview, um44Projection;
uniform vec4 uModulateColor;
@ -366,7 +426,7 @@ void main()
vCornerColor = aColor * uModulateColor;
}";
public readonly string DefaultPixelShader = @"
public readonly string DefaultPixelShader_gl = @"
#version 110 //opengl 2.0 ~ 2004
uniform bool uSamplerEnable;
uniform sampler2D uSampler0;

View File

@ -30,11 +30,6 @@ namespace BizHawk.Bizware.BizwareGL
/// </summary>
void SetClearColor(Color color);
/// <summary>
/// generates a texture handle
/// </summary>
IntPtr GenTexture();
/// <summary>
/// returns an empty handle
/// </summary>
@ -121,9 +116,9 @@ namespace BizHawk.Bizware.BizwareGL
void FreeShader(IntPtr shader);
/// <summary>
/// frees the provided texture handle
/// frees the provided texture
/// </summary>
void FreeTexture(IntPtr texHandle);
void FreeTexture(Texture2d tex);
/// <summary>
/// resolves the texture into a new BitmapBuffer
@ -268,5 +263,10 @@ namespace BizHawk.Bizware.BizwareGL
void BindRenderTarget(RenderTarget rt);
IGraphicsControl Internal_CreateGraphicsControl();
/// <summary>
/// returns a string representing the API employed by this context
/// </summary>
string API { get; }
}
}

View File

@ -69,6 +69,7 @@ namespace BizHawk.Bizware.BizwareGL
public IntPtr Id { get; private set; }
public VertexLayout VertexLayout { get; private set; }
public bool Available { get; private set; }
public object Opaque;
public void Dispose()
{

View File

@ -19,6 +19,7 @@ namespace BizHawk.Bizware.BizwareGL
public IntPtr Id { get; private set; }
public bool Disposed { get; private set; }
public bool Available { get; private set; }
public object Opaque;
public void Dispose()
{

View File

@ -23,14 +23,15 @@ namespace BizHawk.Bizware.BizwareGL
public void Dispose()
{
Owner.FreeTexture(Id);
Owner.FreeTexture(this);
Id = Owner.GetEmptyHandle();
}
public Texture2d(IGL owner, IntPtr id, int width, int height)
public Texture2d(IGL owner, IntPtr id, object opaque, int width, int height)
{
Owner = owner;
Id = id;
Opaque = opaque;
Width = width;
Height = height;
}
@ -70,6 +71,7 @@ namespace BizHawk.Bizware.BizwareGL
public IGL Owner { get; private set; }
public IntPtr Id { get; private set; }
public object Opaque { get; private set; }
//note.. this was a lame idea. convenient, but weird. lets just change this back to ints.
public float Width { get; private set; }

View File

@ -23,11 +23,11 @@ namespace BizHawk.Bizware.BizwareGL
//nothing to do yet..
}
public void DefineVertexAttribute(string name, int index, int components, VertexAttribPointerType attribType, bool normalized, int stride, int offset = 0)
public void DefineVertexAttribute(string name, int index, int components, VertexAttribPointerType attribType, AttributeUsage usage, bool normalized, int stride, int offset = 0)
{
if (Closed)
throw new InvalidOperationException("Type is Closed and is now immutable.");
Items[index] = new LayoutItem { Name = name, Components = components, AttribType = attribType, Normalized = normalized, Stride = stride, Offset = offset };
Items[index] = new LayoutItem { Name = name, Components = components, AttribType = attribType, Usage = usage, Normalized = normalized, Stride = stride, Offset = offset };
}
/// <summary>
@ -46,6 +46,7 @@ namespace BizHawk.Bizware.BizwareGL
public bool Normalized { get; internal set; }
public int Stride { get; internal set; }
public int Offset { get; internal set; }
public AttributeUsage Usage { get; internal set; }
}
public class MyDictionary : WorkingDictionary<int, LayoutItem>