Draw tex coords for invalid textures.
This commit is contained in:
parent
825c09dd16
commit
0e04e1c455
|
@ -2132,15 +2132,19 @@ bool CommandProcessor::PopulateSampler(DrawCommand* draw_command,
|
|||
// ?
|
||||
assert_true(fetch.type == 0x2);
|
||||
|
||||
// Reset slot.
|
||||
// If we fail, we still draw but with an invalid texture.
|
||||
draw_command->state_data->texture_samplers[desc.fetch_slot] = 0;
|
||||
|
||||
TextureInfo texture_info;
|
||||
if (!TextureInfo::Prepare(fetch, &texture_info)) {
|
||||
XELOGE("Unable to parse texture fetcher info");
|
||||
return false; // invalid texture used
|
||||
return true; // invalid texture used
|
||||
}
|
||||
SamplerInfo sampler_info;
|
||||
if (!SamplerInfo::Prepare(fetch, desc.tex_fetch, &sampler_info)) {
|
||||
XELOGE("Unable to parse sampler info");
|
||||
return false; // invalid texture used
|
||||
return true; // invalid texture used
|
||||
}
|
||||
|
||||
uint32_t guest_base = fetch.address << 12;
|
||||
|
@ -2150,7 +2154,7 @@ bool CommandProcessor::PopulateSampler(DrawCommand* draw_command,
|
|||
if (!entry_view) {
|
||||
// Unable to create/fetch/etc.
|
||||
XELOGE("Failed to demand texture");
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Shaders will use bindless to fetch right from it.
|
||||
|
|
|
@ -1472,7 +1472,8 @@ bool GL4ShaderTranslator::TranslateTextureFetch(const instr_fetch_tex_t* tex,
|
|||
|
||||
// Translate.
|
||||
// TODO(benvanik): if sampler == null, set to invalid color.
|
||||
Append(" t = texture(");
|
||||
Append(" if (state.texture_samplers[%d].x != 0) {\n", tex->const_idx & 0xF);
|
||||
Append(" t = texture(");
|
||||
Append("%s(state.texture_samplers[%d])", sampler_type, tex->const_idx & 0xF);
|
||||
Append(", r%u.", tex->src_reg);
|
||||
src_swiz = tex->src_swiz;
|
||||
|
@ -1481,26 +1482,25 @@ bool GL4ShaderTranslator::TranslateTextureFetch(const instr_fetch_tex_t* tex,
|
|||
src_swiz >>= 2;
|
||||
}
|
||||
Append(");\n");
|
||||
|
||||
// Output texture coordinates as color.
|
||||
// TODO(benvanik): only if texture is invalid?
|
||||
// Append(" t = vec4(r%u.", tex->src_reg);
|
||||
// src_swiz = tex->src_swiz;
|
||||
// for (int i = 0; i < src_component_count; i++) {
|
||||
// Append("%c", chan_names[src_swiz & 0x3]);
|
||||
// src_swiz >>= 2;
|
||||
//}
|
||||
// switch (src_component_count) {
|
||||
// case 1:
|
||||
// Append(", 0.0, 0.0, 1.0);\n");
|
||||
// break;
|
||||
// case 2:
|
||||
// Append(", 0.0, 1.0);\n");
|
||||
// break;
|
||||
// case 3:
|
||||
// Append(", 1.0);\n");
|
||||
// break;
|
||||
//}
|
||||
Append(" } else {\n");
|
||||
Append(" t = vec4(r%u.", tex->src_reg);
|
||||
src_swiz = tex->src_swiz;
|
||||
for (int i = 0; i < src_component_count; i++) {
|
||||
Append("%c", chan_names[src_swiz & 0x3]);
|
||||
src_swiz >>= 2;
|
||||
}
|
||||
switch (src_component_count) {
|
||||
case 1:
|
||||
Append(", 0.0, 0.0, 1.0);\n");
|
||||
break;
|
||||
case 2:
|
||||
Append(", 0.0, 1.0);\n");
|
||||
break;
|
||||
case 3:
|
||||
Append(", 1.0);\n");
|
||||
break;
|
||||
}
|
||||
Append(" }\n");
|
||||
|
||||
Append(" r%u.xyzw = vec4(", tex->dst_reg);
|
||||
uint32_t dst_swiz = tex->dst_swiz;
|
||||
|
|
Loading…
Reference in New Issue