mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-22 22:00:39 -06:00
ShaderGen: Small optimization.
This commit is contained in:
@ -21,10 +21,11 @@
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include "CommonTypes.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "CommonTypes.h"
|
||||
#include "VideoCommon.h"
|
||||
|
||||
class ShaderGeneratorInterface
|
||||
{
|
||||
public:
|
||||
@ -125,4 +126,31 @@ private:
|
||||
std::vector<bool> constant_usage; // TODO: Is vector<bool> appropriate here?
|
||||
};
|
||||
|
||||
template<class T>
|
||||
static void WriteRegister(T& object, API_TYPE ApiType, const char *prefix, const u32 num)
|
||||
{
|
||||
if (ApiType == API_OPENGL)
|
||||
return; // Nothing to do here
|
||||
|
||||
object.Write(" : register(%s%d)", prefix, num);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
static void WriteLocation(T& object, API_TYPE ApiType, bool using_ubos)
|
||||
{
|
||||
if (using_ubos)
|
||||
return;
|
||||
|
||||
object.Write("uniform ");
|
||||
}
|
||||
|
||||
template<class T>
|
||||
static void DeclareUniform(T& object, API_TYPE api_type, bool using_ubos, const u32 num, const char* type, const char* name)
|
||||
{
|
||||
WriteLocation(object, api_type, using_ubos);
|
||||
object.Write("%s %s ", type, name);
|
||||
WriteRegister(object, api_type, "c", num);
|
||||
object.Write(";\n");
|
||||
}
|
||||
|
||||
#endif // _SHADERGENCOMMON_H
|
||||
|
Reference in New Issue
Block a user