Skip to content

Commit

Permalink
Don't use fragmentShaderInt32Support as a replacement for checking fo…
Browse files Browse the repository at this point in the history
…r bitwiseOps
  • Loading branch information
hrydgard committed Oct 10, 2022
1 parent aec2249 commit ee46f89
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion GPU/Common/TextureCacheCommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2059,7 +2059,7 @@ void TextureCacheCommon::ApplyTextureFramebuffer(VirtualFramebuffer *framebuffer
bool useShaderDepal = framebufferManager_->GetCurrentRenderVFB() != framebuffer &&
!depth &&
!gstate_c.curTextureIs3D &&
draw_->GetDeviceCaps().fragmentShaderInt32Supported;
draw_->GetShaderLanguageDesc().bitwiseOps;

// TODO: Implement shader depal in the fragment shader generator for D3D11 at least.
switch (draw_->GetShaderLanguageDesc().shaderLanguage) {
Expand Down
2 changes: 1 addition & 1 deletion GPU/D3D11/StateMappingD3D11.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ void DrawEngineD3D11::ApplyDrawState(int prim) {
} else {
keys_.blend.value = 0;

pipelineState_.Convert(draw_->GetDeviceCaps().fragmentShaderInt32Supported);
pipelineState_.Convert(draw_->GetShaderLanguageDesc().bitwiseOps);
GenericMaskState &maskState = pipelineState_.maskState;
GenericBlendState &blendState = pipelineState_.blendState;
// We ignore the logicState on D3D since there's no support, the emulation of it is blend-and-shader only.
Expand Down
2 changes: 1 addition & 1 deletion GPU/Directx9/StateMappingDX9.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ void DrawEngineDX9::ApplyDrawState(int prim) {
}
dxstate.colorMask.set(mask);
} else {
pipelineState_.Convert(draw_->GetDeviceCaps().fragmentShaderInt32Supported);
pipelineState_.Convert(draw_->GetShaderLanguageDesc().bitwiseOps);
GenericMaskState &maskState = pipelineState_.maskState;
GenericBlendState &blendState = pipelineState_.blendState;
// We ignore the logicState on D3D since there's no support, the emulation of it is blend-and-shader only.
Expand Down
9 changes: 4 additions & 5 deletions GPU/GLES/ShaderManagerGLES.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ void LinkedShader::use(const ShaderID &VSID) {
// Note that we no longer track attr masks here - we do it for the input layouts instead.
}

void LinkedShader::UpdateUniforms(u32 vertType, const ShaderID &vsid, bool useBufferedRendering, const Draw::DeviceCaps &caps) {
void LinkedShader::UpdateUniforms(u32 vertType, const ShaderID &vsid, bool useBufferedRendering, const ShaderLanguageDesc &shaderLanguage) {
u64 dirty = dirtyUniforms & availableUniforms;
dirtyUniforms = 0;

Expand Down Expand Up @@ -445,8 +445,7 @@ void LinkedShader::UpdateUniforms(u32 vertType, const ShaderID &vsid, bool useBu
SetColorUniform3(render_, &u_texenv, gstate.texenvcolor);
}
if (dirty & DIRTY_ALPHACOLORREF) {
if (caps.fragmentShaderInt32Supported) {
// Same as bitwiseOps really
if (shaderLanguage.bitwiseOps) {
render_->SetUniformUI1(&u_alphacolorref, gstate.getColorTestRef() | ((gstate.getAlphaTestRef() & gstate.getAlphaTestMask()) << 24));
} else {
SetColorUniform3Alpha255(render_, &u_alphacolorref, gstate.getColorTestRef(), gstate.getAlphaTestRef() & gstate.getAlphaTestMask());
Expand Down Expand Up @@ -817,7 +816,7 @@ LinkedShader *ShaderManagerGLES::ApplyFragmentShader(VShaderID VSID, Shader *vs,
}

if (lastVShaderSame_ && FSID == lastFSID_) {
lastShader_->UpdateUniforms(vertType, VSID, useBufferedRendering, draw_->GetDeviceCaps());
lastShader_->UpdateUniforms(vertType, VSID, useBufferedRendering, draw_->GetShaderLanguageDesc());
return lastShader_;
}

Expand Down Expand Up @@ -860,7 +859,7 @@ LinkedShader *ShaderManagerGLES::ApplyFragmentShader(VShaderID VSID, Shader *vs,
} else {
ls->use(VSID);
}
ls->UpdateUniforms(vertType, VSID, useBufferedRendering, draw_->GetDeviceCaps());
ls->UpdateUniforms(vertType, VSID, useBufferedRendering, draw_->GetShaderLanguageDesc());

lastShader_ = ls;
return ls;
Expand Down
3 changes: 2 additions & 1 deletion GPU/GLES/ShaderManagerGLES.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,15 @@
#include "GPU/Common/FragmentShaderGenerator.h"

class Shader;
struct ShaderLanguageDesc;

class LinkedShader {
public:
LinkedShader(GLRenderManager *render, VShaderID VSID, Shader *vs, FShaderID FSID, Shader *fs, bool useHWTransform, bool preloading = false);
~LinkedShader();

void use(const ShaderID &VSID);
void UpdateUniforms(u32 vertType, const ShaderID &VSID, bool useBufferedRendering, const Draw::DeviceCaps &caps);
void UpdateUniforms(u32 vertType, const ShaderID &VSID, bool useBufferedRendering, const ShaderLanguageDesc &shaderLanguage);

GLRenderManager *render_;
Shader *vs_;
Expand Down
2 changes: 1 addition & 1 deletion GPU/GLES/StateMappingGLES.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ void DrawEngineGLES::ApplyDrawState(int prim) {
bool alphaMask = gstate.isClearModeAlphaMask();
renderManager->SetNoBlendAndMask((colorMask ? 7 : 0) | (alphaMask ? 8 : 0));
} else {
pipelineState_.Convert(draw_->GetDeviceCaps().fragmentShaderInt32Supported);
pipelineState_.Convert(draw_->GetShaderLanguageDesc().bitwiseOps);
GenericMaskState &maskState = pipelineState_.maskState;
GenericBlendState &blendState = pipelineState_.blendState;
GenericLogicState &logicState = pipelineState_.logicState;
Expand Down
2 changes: 1 addition & 1 deletion GPU/GPUCommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3325,7 +3325,7 @@ u32 GPUCommon::CheckGPUFeatures() const {
features |= GPU_SUPPORTS_ANY_FRAMEBUFFER_FETCH;
}

if (draw_->GetDeviceCaps().fragmentShaderInt32Supported) {
if (draw_->GetShaderLanguageDesc().bitwiseOps) {
features |= GPU_USE_LIGHT_UBERSHADER;
}

Expand Down
2 changes: 1 addition & 1 deletion GPU/Vulkan/StateMappingVulkan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ void DrawEngineVulkan::ConvertStateToVulkanKey(FramebufferManagerVulkan &fbManag
bool alphaMask = gstate.isClearModeAlphaMask();
key.colorWriteMask = (colorMask ? (VK_COLOR_COMPONENT_R_BIT | VK_COLOR_COMPONENT_G_BIT | VK_COLOR_COMPONENT_B_BIT) : 0) | (alphaMask ? VK_COLOR_COMPONENT_A_BIT : 0);
} else {
pipelineState_.Convert(draw_->GetDeviceCaps().fragmentShaderInt32Supported);
pipelineState_.Convert(draw_->GetShaderLanguageDesc().bitwiseOps);
GenericMaskState &maskState = pipelineState_.maskState;
GenericBlendState &blendState = pipelineState_.blendState;
GenericLogicState &logicState = pipelineState_.logicState;
Expand Down

0 comments on commit ee46f89

Please sign in to comment.