mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-15 02:29:51 +01:00
GPU: Add sampler1 for postshader orig source.
This commit is contained in:
1 parent
ed4719a9b6
commit
8f8098ed24
4 files changed
+22
-10
No files matched your search
@@ -491,11 +491,11 @@ void PresentationCommon::SourceFramebuffer(Draw::Framebuffer *fb, int bufferWidt
|
||||
srcHeight_ = bufferHeight;
|
||||
}
|
||||
|
||||
void PresentationCommon::BindSource() {
|
||||
void PresentationCommon::BindSource(int binding) {
|
||||
if (srcTexture_) {
|
||||
draw_->BindTexture(0, srcTexture_);
|
||||
draw_->BindTexture(binding, srcTexture_);
|
||||
} else if (srcFramebuffer_) {
|
||||
draw_->BindFramebufferAsTexture(srcFramebuffer_, 0, Draw::FB_COLOR_BIT, 0);
|
||||
draw_->BindFramebufferAsTexture(srcFramebuffer_, binding, Draw::FB_COLOR_BIT, 0);
|
||||
} else {
|
||||
assert(false);
|
||||
}
|
||||
@@ -611,8 +611,9 @@ void PresentationCommon::CopyToOutput(OutputFlags flags, int uvRotation, float u
|
||||
if (usePostShaderOutput) {
|
||||
draw_->BindFramebufferAsTexture(postShaderFramebuffers_[i - 1], 0, Draw::FB_COLOR_BIT, 0);
|
||||
} else {
|
||||
BindSource();
|
||||
BindSource(0);
|
||||
}
|
||||
BindSource(1);
|
||||
|
||||
int nextWidth, nextHeight;
|
||||
draw_->GetFramebufferDimensions(postShaderFramebuffer, &nextWidth, &nextHeight);
|
||||
@@ -628,6 +629,7 @@ void PresentationCommon::CopyToOutput(OutputFlags flags, int uvRotation, float u
|
||||
|
||||
Draw::SamplerState *sampler = useNearest || shaderInfo->isUpscalingFilter ? samplerNearest_ : samplerLinear_;
|
||||
draw_->BindSamplerStates(0, 1, &sampler);
|
||||
draw_->BindSamplerStates(1, 1, &sampler);
|
||||
|
||||
draw_->BindVertexBuffers(0, 1, &vdata_, &postVertsOffset);
|
||||
draw_->BindIndexBuffer(idata_, 0);
|
||||
@@ -658,8 +660,9 @@ void PresentationCommon::CopyToOutput(OutputFlags flags, int uvRotation, float u
|
||||
if (usePostShaderOutput) {
|
||||
draw_->BindFramebufferAsTexture(postShaderFramebuffers_.back(), 0, Draw::FB_COLOR_BIT, 0);
|
||||
} else {
|
||||
BindSource();
|
||||
BindSource(0);
|
||||
}
|
||||
BindSource(1);
|
||||
|
||||
if (isFinalAtOutputResolution) {
|
||||
PostShaderUniforms uniforms;
|
||||
@@ -676,6 +679,7 @@ void PresentationCommon::CopyToOutput(OutputFlags flags, int uvRotation, float u
|
||||
|
||||
Draw::SamplerState *sampler = useNearest ? samplerNearest_ : samplerLinear_;
|
||||
draw_->BindSamplerStates(0, 1, &sampler);
|
||||
draw_->BindSamplerStates(1, 1, &sampler);
|
||||
|
||||
auto setViewport = [&](float x, float y, float w, float h) {
|
||||
Draw::Viewport viewport{ x, y, w, h, 0.0f, 1.0f };
|
||||
|
||||
@@ -114,7 +114,7 @@ protected:
|
||||
bool BuildPostShader(const ShaderInfo *shaderInfo, const ShaderInfo *next);
|
||||
bool AllocateFramebuffer(int w, int h);
|
||||
|
||||
void BindSource();
|
||||
void BindSource(int binding);
|
||||
|
||||
void GetCardboardSettings(CardboardSettings *cardboardSettings);
|
||||
void CalculatePostShaderUniforms(int bufferWidth, int bufferHeight, int targetWidth, int targetHeight, const ShaderInfo *shaderInfo, PostShaderUniforms *uniforms);
|
||||
|
||||
@@ -140,6 +140,10 @@ std::string Postprocess(std::string code, ShaderLanguage lang, Draw::ShaderStage
|
||||
out << "sampler2D sampler0 : register(s0);\n";
|
||||
continue;
|
||||
}
|
||||
if (line == "uniform sampler2D sampler1;" && lang == HLSL_DX9) {
|
||||
out << "sampler2D sampler1 : register(s1);\n";
|
||||
continue;
|
||||
}
|
||||
if (line.find("uniform float") != std::string::npos) {
|
||||
continue;
|
||||
}
|
||||
@@ -181,7 +185,10 @@ bool ConvertToVulkanGLSL(std::string *dest, TranslatedShaderMetadata *destMetada
|
||||
if (line.find("uniform bool") != std::string::npos) {
|
||||
continue;
|
||||
} else if (line.find("uniform sampler2D") == 0) {
|
||||
line = "layout(set = 0, binding = 1) " + line;
|
||||
if (line.find("sampler0") != line.npos)
|
||||
line = "layout(set = 0, binding = 1) " + line;
|
||||
else
|
||||
line = "layout(set = 0, binding = 2) " + line;
|
||||
} else if (line.find("uniform ") != std::string::npos) {
|
||||
continue;
|
||||
} else if (2 == sscanf(line.c_str(), "varying vec%d v_texcoord%d;", &vecSize, &num)) {
|
||||
|
||||
@@ -21,7 +21,8 @@
|
||||
#include "Common/Log.h"
|
||||
#include "Common/StringUtils.h"
|
||||
#include "Core/Reporting.h"
|
||||
#include "DepalettizeShaderGLES.h"
|
||||
#include "GPU/GLES/DepalettizeShaderGLES.h"
|
||||
#include "GPU/GLES/DrawEngineGLES.h"
|
||||
#include "GPU/GLES/TextureCacheGLES.h"
|
||||
#include "GPU/Common/DepalettizeShaderCommon.h"
|
||||
|
||||
@@ -178,8 +179,8 @@ DepalShader *DepalShaderCacheGLES::GetDepalettizeShader(uint32_t clutMode, GEBuf
|
||||
queries.push_back({ &depal->u_pal, "pal" });
|
||||
|
||||
std::vector<GLRProgram::Initializer> initializer;
|
||||
initializer.push_back({ &depal->u_tex, 0, 0 });
|
||||
initializer.push_back({ &depal->u_pal, 0, 3 });
|
||||
initializer.push_back({ &depal->u_tex, 0, TEX_SLOT_PSP_TEXTURE });
|
||||
initializer.push_back({ &depal->u_pal, 0, TEX_SLOT_CLUT });
|
||||
|
||||
std::vector<GLRShader *> shaders{ vertexShader_, fragShader };
|
||||
|
||||
|
||||
Reference in new issue
Block a user