glgsg: Don't use simple RAM image in shaders for non-sampler2D types

Simple RAM images are always 2D right now, so this would otherwise cause an error.
This commit is contained in:
rdb 2021-11-28 13:59:21 +01:00
parent 8f9d23ff29
commit 5cad0eb973

View File

@ -2952,10 +2952,13 @@ update_shader_texture_bindings(ShaderContext *prev) {
// Bindless texturing wasn't supported or didn't work, so let's just bind
// the texture normally.
// Note that simple RAM images are always 2-D for now, so to avoid errors,
// we must load the real texture if this is not for a sampler2D.
bool force = (spec._desired_type != Texture::TT_2d_texture);
#ifndef OPENGLES
if (multi_bind) {
// Multi-bind case.
if (!_glgsg->update_texture(gtc, false)) {
if (!_glgsg->update_texture(gtc, force)) {
textures[i] = 0;
} else {
gtc->set_active(true);
@ -2975,7 +2978,7 @@ update_shader_texture_bindings(ShaderContext *prev) {
{
// Non-multibind case.
_glgsg->set_active_texture_stage(i);
if (!_glgsg->update_texture(gtc, false)) {
if (!_glgsg->update_texture(gtc, force)) {
continue;
}
_glgsg->apply_texture(gtc);