Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions hw/xbox/nv2a/pgraph/glsl/psh.c
Original file line number Diff line number Diff line change
Expand Up @@ -632,6 +632,9 @@ static const char *get_sampler_type(struct PixelShader *ps, enum PS_TEXTUREMODES
if (state->tex_x8y24[i] && ps->opts.vulkan) {
return "usampler2D";
}
if (state->tex_cubemap[i]) {
return samplerCube;
}
return sampler2D;
}
if (dim == 3) return sampler3D;
Expand Down Expand Up @@ -959,6 +962,11 @@ static MString* psh_convert(struct PixelShader *ps)
" }\n"
" return uv;\n"
"}\n"
"\n"
"vec3 remap2DToCube(vec3 texCoord2DProjective) {\n"
" vec2 st = (texCoord2DProjective.xy / texCoord2DProjective.z);"
" return normalize(vec3(1.0, st.y, -st.x));"
"}\n"
);

MString *clip = mstring_new();
Expand Down Expand Up @@ -1106,8 +1114,17 @@ static MString* psh_convert(struct PixelShader *ps)
apply_convolution_filter(ps, vars, i);
} else {
if (ps->state->dim_tex[i] == 2) {
mstring_append_fmt(vars, "vec4 t%d = textureProj(texSamp%d, %s(pT%d.xyw));\n",
i, i, tex_remap, i);
if (ps->state->tex_cubemap[i]) {
mstring_append_fmt(
vars,
"vec4 t%d = texture(texSamp%d, remap2DToCube(%s(pT%d.xyw)));\n",
i, i, tex_remap, i);
} else {
mstring_append_fmt(
vars,
"vec4 t%d = textureProj(texSamp%d, %s(pT%d.xyw));\n",
i, i, tex_remap, i);
}
} else if (ps->state->dim_tex[i] == 3) {
mstring_append_fmt(vars, "vec4 t%d = textureProj(texSamp%d, vec4(pT%d.xy, 0.0, pT%d.w));\n",
i, i, i, i);
Expand Down