mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-12-06 04:33:49 +01:00
D3D11: Fix shader module leak in thin3d.
Thanks Unknown.
This commit is contained in:
1 parent
b8ccd7fae7
commit
c0c2bfb293
1 file changed
+25
-24
@@ -664,7 +664,28 @@ InputLayout *D3D11DrawContext::CreateInputLayout(const InputLayoutDesc &desc) {
|
||||
return inputLayout;
|
||||
}
|
||||
|
||||
class D3D11ShaderModule;
|
||||
class D3D11ShaderModule : public ShaderModule {
|
||||
public:
|
||||
D3D11ShaderModule(const std::string &tag) : tag_(tag) {
|
||||
}
|
||||
~D3D11ShaderModule() {
|
||||
if (vs)
|
||||
vs->Release();
|
||||
if (ps)
|
||||
ps->Release();
|
||||
if (gs)
|
||||
gs->Release();
|
||||
}
|
||||
ShaderStage GetStage() const override { return stage; }
|
||||
|
||||
std::vector<uint8_t> byteCode_;
|
||||
ShaderStage stage;
|
||||
std::string tag_;
|
||||
|
||||
ID3D11VertexShader *vs = nullptr;
|
||||
ID3D11PixelShader *ps = nullptr;
|
||||
ID3D11GeometryShader *gs = nullptr;
|
||||
};
|
||||
|
||||
class D3D11Pipeline : public Pipeline {
|
||||
public:
|
||||
@@ -681,6 +702,9 @@ public:
|
||||
il->Release();
|
||||
if (dynamicUniforms)
|
||||
dynamicUniforms->Release();
|
||||
for (D3D11ShaderModule *shaderModule : shaderModules) {
|
||||
shaderModule->Release();
|
||||
}
|
||||
}
|
||||
bool RequiresBuffer() override {
|
||||
return true;
|
||||
@@ -856,29 +880,6 @@ Texture *D3D11DrawContext::CreateTexture(const TextureDesc &desc) {
|
||||
return tex;
|
||||
}
|
||||
|
||||
class D3D11ShaderModule : public ShaderModule {
|
||||
public:
|
||||
D3D11ShaderModule(const std::string &tag) : tag_(tag) {
|
||||
}
|
||||
~D3D11ShaderModule() {
|
||||
if (vs)
|
||||
vs->Release();
|
||||
if (ps)
|
||||
ps->Release();
|
||||
if (gs)
|
||||
gs->Release();
|
||||
}
|
||||
ShaderStage GetStage() const override { return stage; }
|
||||
|
||||
std::vector<uint8_t> byteCode_;
|
||||
ShaderStage stage;
|
||||
std::string tag_;
|
||||
|
||||
ID3D11VertexShader *vs = nullptr;
|
||||
ID3D11PixelShader *ps = nullptr;
|
||||
ID3D11GeometryShader *gs = nullptr;
|
||||
};
|
||||
|
||||
ShaderModule *D3D11DrawContext::CreateShaderModule(ShaderStage stage, ShaderLanguage language, const uint8_t *data, size_t dataSize, const std::string &tag) {
|
||||
if (language != ShaderLanguage::HLSL_D3D11) {
|
||||
ERROR_LOG(G3D, "Unsupported shader language");
|
||||
|
||||
Reference in new issue
Block a user