diff options
| author | Tillmann Karras <tilkax@gmail.com> | 2015-11-03 03:47:05 +0100 |
|---|---|---|
| committer | Tillmann Karras <tilkax@gmail.com> | 2015-11-03 14:40:23 +0100 |
| commit | 71d1eb3c313535b5003884bb862635d4d2f8aae9 (patch) | |
| tree | c678349f96b9151d853d69915a826f227754e9a1 /Source/Core/VideoCommon/GeometryShaderGen.cpp | |
| parent | c04358fbe28a80fa462dce1ff71c02820f87bd29 (diff) | |
VideoCommon: return code/uid from shader gens
rather than passing in non-const references
Diffstat (limited to 'Source/Core/VideoCommon/GeometryShaderGen.cpp')
| -rw-r--r-- | Source/Core/VideoCommon/GeometryShaderGen.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/Source/Core/VideoCommon/GeometryShaderGen.cpp b/Source/Core/VideoCommon/GeometryShaderGen.cpp index f36aa94a9a..bf054464c2 100644 --- a/Source/Core/VideoCommon/GeometryShaderGen.cpp +++ b/Source/Core/VideoCommon/GeometryShaderGen.cpp @@ -30,8 +30,9 @@ template<class T> static inline void EmitVertex(T& out, const char* vertex, API_ template<class T> static inline void EndPrimitive(T& out, API_TYPE ApiType); template<class T> -static inline void GenerateGeometryShader(T& out, u32 primitive_type, API_TYPE ApiType) +static inline T GenerateGeometryShader(u32 primitive_type, API_TYPE ApiType) { + T out; // Non-uid template parameters will write to the dummy data (=> gets optimized out) geometry_shader_uid_data dummy_data; geometry_shader_uid_data* uid_data = out.template GetUidData<geometry_shader_uid_data>(); @@ -292,6 +293,8 @@ static inline void GenerateGeometryShader(T& out, u32 primitive_type, API_TYPE A if (text[sizeof(text) - 1] != 0x7C) PanicAlert("GeometryShader generator - buffer too small, canary has been eaten!"); } + + return out; } template<class T> @@ -327,12 +330,12 @@ static inline void EndPrimitive(T& out, API_TYPE ApiType) out.Write("\toutput.RestartStrip();\n"); } -void GetGeometryShaderUid(GeometryShaderUid& object, u32 primitive_type, API_TYPE ApiType) +GeometryShaderUid GetGeometryShaderUid(u32 primitive_type, API_TYPE ApiType) { - GenerateGeometryShader<GeometryShaderUid>(object, primitive_type, ApiType); + return GenerateGeometryShader<GeometryShaderUid>(primitive_type, ApiType); } -void GenerateGeometryShaderCode(ShaderCode& object, u32 primitive_type, API_TYPE ApiType) +ShaderCode GenerateGeometryShaderCode(u32 primitive_type, API_TYPE ApiType) { - GenerateGeometryShader<ShaderCode>(object, primitive_type, ApiType); + return GenerateGeometryShader<ShaderCode>(primitive_type, ApiType); } |
