Am 08.01.2019 um 22:46 schrieb Daniel Ansorregui mailszeros@gmail.com:
@@ -340,6 +340,11 @@ static const struct wined3d_format_base_flags format_base_flags[] = {WINED3DFMT_NULL, WINED3DFMT_FLAG_EXTENSION}, {WINED3DFMT_NVDB, WINED3DFMT_FLAG_EXTENSION}, {WINED3DFMT_RESZ, WINED3DFMT_FLAG_EXTENSION},
- {WINED3DFMT_L8_UNORM, WINED3DFMT_FLAG_ALLOW_FETCH4},
- {WINED3DFMT_L16_UNORM, WINED3DFMT_FLAG_ALLOW_FETCH4},
- {WINED3DFMT_R16_FLOAT, WINED3DFMT_FLAG_ALLOW_FETCH4},
- {WINED3DFMT_R16, WINED3DFMT_FLAG_ALLOW_FETCH4},
- {WINED3DFMT_R32_FLOAT, WINED3DFMT_FLAG_ALLOW_FETCH4},
};
...
@@ -5926,6 +5932,9 @@ void gen_ffp_frag_op(const struct wined3d_context *context, const struct wined3d settings->op[i].aarg1 = aarg1; settings->op[i].aarg2 = aarg2; settings->op[i].tmp_dst = state->texture_states[i][WINED3D_TSS_RESULT_ARG] == WINED3DTA_TEMP;
settings->op[i].fetch4 = (state->textures[i] && gl_info->supported[ARB_TEXTURE_GATHER] &&
state->textures[i]->resource.format_flags & WINED3DFMT_FLAG_ALLOW_FETCH4 &&
}state->sampler_states[i][WINED3D_SAMP_MIPMAP_LOD_BIAS] == MAKEFOURCC('G','E','T','4'));
You could remove WINED3DFMT_FLAG_ALLOW_FETCH4 from all formats during the format table initialization if ARB_TEXTURE_GATHER is not supported. That way you can avoid checking for the GL extension in this performance critical place.
I'm myself not sure about what is supposed to go into format_base_flags[] and format_texture_info[], but I think the former is for intrinsic properties of the format, whereas the latter is for things that at least to some extent depend on the OpenGL capabilities. Since you need ARB_texture_gather for fetch4 I'd put it into format_texture_info, but wait for confirmation from Henri before changing it.