Switch D3D9 too to the glsl shader generator

This commit is contained in:
Henrik Rydgård 2020-10-31 00:19:20 +01:00
parent cf1a5e2c67
commit c311eeaf7d
3 changed files with 10 additions and 6 deletions

View File

@ -30,12 +30,13 @@ LPD3DBLOB CompileShaderToByteCodeD3D9(const char *code, const char *target, std:
&pErrorMsg);
if (pErrorMsg) {
*errorMessage = (CHAR *)pErrorMsg->GetBufferPointer();
*errorMessage = std::string((CHAR *)pErrorMsg->GetBufferPointer());
OutputDebugStringUTF8(LineNumberString(std::string(code)).c_str());
OutputDebugStringUTF8(errorMessage->c_str());
pErrorMsg->Release();
pShaderCode = nullptr;
} else if (FAILED(hr)) {
*errorMessage = GetStringErrorMsg(hr);
if (pShaderCode) {

View File

@ -41,6 +41,7 @@
#include "GPU/GPUState.h"
#include "GPU/ge_constants.h"
#include "GPU/Common/ShaderUniforms.h"
#include "GPU/GLES/FragmentShaderGeneratorGLES.h"
#include "GPU/Directx9/ShaderManagerDX9.h"
#include "GPU/Directx9/DrawEngineDX9.h"
#include "GPU/Directx9/FramebufferManagerDX9.h"
@ -510,7 +511,7 @@ void ShaderManagerDX9::VSUpdateUniforms(u64 dirtyUniforms) {
}
ShaderManagerDX9::ShaderManagerDX9(Draw::DrawContext *draw, LPDIRECT3DDEVICE9 device)
: ShaderManagerCommon(draw), device_(device), lastVShader_(nullptr), lastPShader_(nullptr) {
: ShaderManagerCommon(draw), device_(device), compat_(HLSL_D3D9) {
codeBuffer_ = new char[16384];
}
@ -627,7 +628,8 @@ VSShader *ShaderManagerDX9::ApplyShader(bool useHWTransform, bool useHWTessellat
if (fsIter == fsCache_.end()) {
// Fragment shader not in cache. Let's compile it.
std::string errorString;
bool success = GenerateFragmentShaderHLSL(FSID, codeBuffer_, HLSL_D3D9, &errorString);
uint64_t uniformMask;
bool success = GenerateFragmentShaderGLSL(FSID, codeBuffer_, compat_, &uniformMask, &errorString);
// We're supposed to handle all possible cases.
_assert_(success);
fs = new PSShader(device_, FSID, codeBuffer_);

View File

@ -22,7 +22,7 @@
#include "Common/Common.h"
#include "GPU/Directx9/VertexShaderGeneratorHLSL.h"
#include "GPU/Directx9/FragmentShaderGeneratorHLSL.h"
#include "GPU/GLES/FragmentShaderGeneratorGLES.h"
#include "GPU/Common/ShaderCommon.h"
#include "GPU/Common/ShaderId.h"
#include "Common/Math/lin/matrix4x4.h"
@ -112,14 +112,15 @@ private:
void Clear();
LPDIRECT3DDEVICE9 device_;
GLSLShaderCompat compat_;
FShaderID lastFSID_;
VShaderID lastVSID_;
char *codeBuffer_;
VSShader *lastVShader_;
PSShader *lastPShader_;
VSShader *lastVShader_ = nullptr;
PSShader *lastPShader_ = nullptr;
typedef std::map<FShaderID, PSShader *> FSCache;
FSCache fsCache_;