mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-15 13:57:57 -07:00
2ed61b0ee1
We (the Microsoft C++ team) use the dolphin project as part of our "Real world code" tests. I noticed a few issues in windows specific code when building dolphin with the MSVC compiler in its conformance mode (/permissive-). For more information on /permissive- see our blog https://blogs.msdn.microsoft.com/vcblog/2016/11/16/permissive-switch/. These changes are to address 3 different types of issues: 1) Use of qualified names in member declarations struct A { void A::f() { } // error C4596: illegal qualified name in member declaration // remove redundant 'A::' to fix }; 2) Binding a non-const reference to a temporary struct S{}; // If arg is in 'in' parameter, then it should be made const. void func(S& arg){} int main() { //error C2664: 'void func(S &)': cannot convert argument 1 from 'S' to 'S &' //note: A non-const reference may only be bound to an lvalue func( S() ); //Work around this by creating a local, and using it to call the function S s; func( s ); } 3) Add missing #include <intrin.h> Because of the workaround you are using in the code you will need to include this. This is because of changes in the libraries and not /permissive-
48 lines
1.2 KiB
C++
48 lines
1.2 KiB
C++
// Copyright 2014 Dolphin Emulator Project
|
|
// Licensed under GPLv2+
|
|
// Refer to the license.txt file included.
|
|
|
|
#pragma once
|
|
|
|
#include <d3d11.h>
|
|
#include <map>
|
|
|
|
#include "VideoCommon/GeometryShaderGen.h"
|
|
|
|
namespace DX11
|
|
{
|
|
class GeometryShaderCache
|
|
{
|
|
public:
|
|
static void Init();
|
|
static void Clear();
|
|
static void Shutdown();
|
|
static bool SetShader(u32 primitive_type); // TODO: Should be renamed to LoadShader
|
|
static bool InsertByteCode(const GeometryShaderUid& uid, const void* bytecode,
|
|
unsigned int bytecodelen);
|
|
|
|
static ID3D11GeometryShader* GetClearGeometryShader();
|
|
static ID3D11GeometryShader* GetCopyGeometryShader();
|
|
|
|
static ID3D11GeometryShader* GetActiveShader() { return last_entry->shader; }
|
|
static ID3D11Buffer*& GetConstantBuffer();
|
|
|
|
private:
|
|
struct GSCacheEntry
|
|
{
|
|
ID3D11GeometryShader* shader;
|
|
|
|
GSCacheEntry() : shader(nullptr) {}
|
|
void Destroy() { SAFE_RELEASE(shader); }
|
|
};
|
|
|
|
typedef std::map<GeometryShaderUid, GSCacheEntry> GSCache;
|
|
|
|
static GSCache GeometryShaders;
|
|
static const GSCacheEntry* last_entry;
|
|
static GeometryShaderUid last_uid;
|
|
static const GSCacheEntry pass_entry;
|
|
};
|
|
|
|
} // namespace DX11
|