mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-27 07:20:49 +00:00
Texcoord attrs must be called a_texcoord0, this should be fixed. Oh well.
Also small fix for depth in float-depal.
This commit is contained in:
parent
83fd8a2fd8
commit
852c395fb7
@ -14,6 +14,7 @@ const char * const vulkan_glsl_preamble_fs =
|
||||
"#extension GL_ARB_shader_image_load_store : enable\n"
|
||||
"#define splat3(x) vec3(x)\n"
|
||||
"#define DISCARD discard\n"
|
||||
"precision lowp float;\n"
|
||||
"precision highp int;\n"
|
||||
"\n";
|
||||
|
||||
@ -131,6 +132,7 @@ void ShaderWriter::Preamble(const char **gl_extensions, size_t num_gl_extensions
|
||||
case ShaderStage::Fragment:
|
||||
C("#define DISCARD discard\n");
|
||||
if (lang_.gles) {
|
||||
C("precision lowp float;\n");
|
||||
if (lang_.glslES30) {
|
||||
C("precision highp int;\n");
|
||||
}
|
||||
|
@ -31,7 +31,7 @@
|
||||
|
||||
static const InputDef vsInputs[2] = {
|
||||
{ "vec2", "a_position", Draw::SEM_POSITION, },
|
||||
{ "vec2", "a_texcoord", Draw::SEM_TEXCOORD0, },
|
||||
{ "vec2", "a_texcoord0", Draw::SEM_TEXCOORD0, },
|
||||
};
|
||||
|
||||
// TODO: Deduplicate with DepalettizeCommon.cpp
|
||||
@ -135,6 +135,12 @@ void GenerateDepalShaderFloat(ShaderWriter &writer, const DepalConfig &config, c
|
||||
const int shift = config.shift;
|
||||
const int mask = config.mask;
|
||||
|
||||
if (config.pixelFormat == GE_FORMAT_DEPTH16) {
|
||||
DepthScaleFactors factors = GetDepthScaleFactors();
|
||||
writer.ConstFloat("z_scale", factors.scale);
|
||||
writer.ConstFloat("z_offset", factors.offset);
|
||||
}
|
||||
|
||||
float index_multiplier = 1.0f;
|
||||
// pixelformat is the format of the texture we are sampling.
|
||||
bool formatOK = true;
|
||||
@ -216,9 +222,14 @@ void GenerateDepalShaderFloat(ShaderWriter &writer, const DepalConfig &config, c
|
||||
case GE_FORMAT_DEPTH16:
|
||||
{
|
||||
// TODO: I think we can handle most scenarios here, but texturing from depth buffers requires an extension on ES 2.0 anyway.
|
||||
if ((mask & (mask + 1)) == 0 && shift < 16) {
|
||||
if (shift < 16) {
|
||||
index_multiplier = 1.0f / (float)(1 << shift);
|
||||
truncate_cpy(lookupMethod, "index.r");
|
||||
truncate_cpy(lookupMethod, "((index.x - z_offset) * z_scale)");
|
||||
|
||||
if ((mask & (mask + 1)) != 0) {
|
||||
// But we'll try with the above anyway.
|
||||
formatOK = false;
|
||||
}
|
||||
} else {
|
||||
formatOK = false;
|
||||
}
|
||||
@ -262,12 +273,11 @@ void GenerateDepalFs(char *buffer, const DepalConfig &config, const ShaderLangua
|
||||
case GLSL_1xx:
|
||||
GenerateDepalShaderFloat(writer, config, lang);
|
||||
break;
|
||||
case GLSL_3xx:
|
||||
case GLSL_VULKAN:
|
||||
case GLSL_3xx:
|
||||
case HLSL_D3D11:
|
||||
GenerateDepalShader300(writer, config, lang);
|
||||
break;
|
||||
break;
|
||||
default:
|
||||
_assert_msg_(false, "Depal shader language not supported: %d", (int)lang.shaderLanguage);
|
||||
}
|
||||
@ -277,7 +287,7 @@ void GenerateDepalFs(char *buffer, const DepalConfig &config, const ShaderLangua
|
||||
void GenerateDepalVs(char *buffer, const ShaderLanguageDesc &lang) {
|
||||
ShaderWriter writer(buffer, lang, ShaderStage::Vertex, nullptr, 0);
|
||||
writer.BeginVSMain(vsInputs, Slice<UniformDef>::empty(), varyings);
|
||||
writer.C(" v_texcoord = a_texcoord;\n");
|
||||
writer.C(" v_texcoord = a_texcoord0;\n");
|
||||
writer.C(" gl_Position = vec4(a_position, 0.0, 1.0);\n");
|
||||
if (strlen(lang.viewportYSign)) {
|
||||
writer.F(" gl_Position.y *= %s1.0;\n", lang.viewportYSign);
|
||||
|
@ -1897,7 +1897,6 @@ void TextureCacheCommon::ApplyTextureFramebuffer(VirtualFramebuffer *framebuffer
|
||||
|
||||
draw_->InvalidateCachedState();
|
||||
InvalidateLastTexture();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1922,10 +1921,10 @@ void TextureCacheCommon::ApplyTextureFramebuffer(VirtualFramebuffer *framebuffer
|
||||
shaderApply.Use();
|
||||
|
||||
draw_->BindFramebufferAsTexture(framebuffer->fbo, 0, depth ? Draw::FB_DEPTH_BIT : Draw::FB_COLOR_BIT, 0);
|
||||
draw_->BindTexture(1, clutTexture);
|
||||
Draw::SamplerState *nearest = depalShaderCache_->GetSampler();
|
||||
draw_->BindSamplerStates(0, 1, &nearest);
|
||||
draw_->BindSamplerStates(1, 1, &nearest);
|
||||
draw_->BindTexture(1, clutTexture);
|
||||
|
||||
shaderApply.Shade();
|
||||
draw_->BindTexture(0, nullptr);
|
||||
|
Loading…
Reference in New Issue
Block a user