diff options
| author | degasus <wickmarkus@web.de> | 2014-01-24 15:41:08 +0100 |
|---|---|---|
| committer | degasus <wickmarkus@web.de> | 2014-01-31 07:19:34 +0100 |
| commit | a65162f1cd345b8f206fd01e19ac261d09ac291b (patch) | |
| tree | 4f90d9cb21c73d88715653d16afcc62090257460 /Source/Core/VideoCommon | |
| parent | 6c59b691b0247f4a56ff17d7cf134364b258a6c5 (diff) | |
PortableVertexFormat: use AttributeFormat for posmtx attribute format
Diffstat (limited to 'Source/Core/VideoCommon')
| -rw-r--r-- | Source/Core/VideoCommon/NativeVertexFormat.h | 3 | ||||
| -rw-r--r-- | Source/Core/VideoCommon/VertexLoader.cpp | 10 | ||||
| -rw-r--r-- | Source/Core/VideoCommon/VertexShaderGen.cpp | 7 |
3 files changed, 8 insertions, 12 deletions
diff --git a/Source/Core/VideoCommon/NativeVertexFormat.h b/Source/Core/VideoCommon/NativeVertexFormat.h index 5ed868ee73..8b41ecdd04 100644 --- a/Source/Core/VideoCommon/NativeVertexFormat.h +++ b/Source/Core/VideoCommon/NativeVertexFormat.h @@ -89,8 +89,7 @@ struct PortableVertexDeclaration AttributeFormat normals[3]; AttributeFormat colors[2]; AttributeFormat texcoords[8]; - - int posmtx_offset; + AttributeFormat posmtx; }; // The implementation of this class is specific for GL/DX, so NativeVertexFormat.cpp diff --git a/Source/Core/VideoCommon/VertexLoader.cpp b/Source/Core/VideoCommon/VertexLoader.cpp index 3e3a020eb4..99e5541c0d 100644 --- a/Source/Core/VideoCommon/VertexLoader.cpp +++ b/Source/Core/VideoCommon/VertexLoader.cpp @@ -756,13 +756,13 @@ void VertexLoader::CompileVertexTranslator() if (m_VtxDesc.PosMatIdx) { WriteCall(PosMtx_Write); - vtx_decl.posmtx_offset = nat_offset; + vtx_decl.posmtx.components = 4; + vtx_decl.posmtx.enable = true; + vtx_decl.posmtx.offset = nat_offset; + vtx_decl.posmtx.type = VAR_UNSIGNED_BYTE; + vtx_decl.posmtx.integer = false; nat_offset += 4; } - else - { - vtx_decl.posmtx_offset = -1; - } native_stride = nat_offset; vtx_decl.stride = native_stride; diff --git a/Source/Core/VideoCommon/VertexShaderGen.cpp b/Source/Core/VideoCommon/VertexShaderGen.cpp index 78d54492ac..57742889eb 100644 --- a/Source/Core/VideoCommon/VertexShaderGen.cpp +++ b/Source/Core/VideoCommon/VertexShaderGen.cpp @@ -168,7 +168,7 @@ static inline void GenerateVertexShader(T& out, u32 components, API_TYPE api_typ out.Write(" float%d tex%d : TEXCOORD%d,\n", hastexmtx ? 3 : 2, i, i); } if (components & VB_HAS_POSMTXIDX) - out.Write(" float4 blend_indices : BLENDINDICES,\n"); + out.Write(" float4 fposmtx : BLENDINDICES,\n"); out.Write(" float4 rawpos : POSITION) {\n"); } out.Write("VS_OUTPUT o;\n"); @@ -176,10 +176,7 @@ static inline void GenerateVertexShader(T& out, u32 components, API_TYPE api_typ // transforms if (components & VB_HAS_POSMTXIDX) { - if (api_type == API_D3D) - out.Write("int posmtx = blend_indices.x * 255.0;\n"); // TODO: Ugly, should use an integer instead - else - out.Write("int posmtx = int(fposmtx);\n"); + out.Write("int posmtx = int(fposmtx * 255.0);\n"); // TODO: Ugly, should use an integer instead if (is_writing_shadercode && (DriverDetails::HasBug(DriverDetails::BUG_NODYNUBOACCESS) && !DriverDetails::HasBug(DriverDetails::BUG_ANNIHILATEDUBOS)) ) { |
