mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2024-12-03 15:14:17 +08:00
lima: ppir: use dummy program if FS has empty body
As per spec, any colors, or color components, associated with a fragment that are not written by the fragment shader are undefined. So we might as well just write vec4(1.0) to output, since HW doesn't allow us to have an empty FS. Backport-to: 23.3 Backport-to: 24.0 Reviewed-by: Erico Nunes <nunes.erico@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24855>
This commit is contained in:
parent
b999e41250
commit
6998c48f77
@ -323,15 +323,25 @@ static bool
|
||||
lima_fs_upload_shader(struct lima_context *ctx,
|
||||
struct lima_fs_compiled_shader *fs)
|
||||
{
|
||||
static const uint32_t pp_clear_program[] = {
|
||||
PP_CLEAR_PROGRAM
|
||||
};
|
||||
int shader_size = sizeof(pp_clear_program);
|
||||
void *shader = (void *)pp_clear_program;
|
||||
struct lima_screen *screen = lima_screen(ctx->base.screen);
|
||||
|
||||
fs->bo = lima_bo_create(screen, fs->state.shader_size, 0);
|
||||
if (fs->state.shader_size) {
|
||||
shader_size = fs->state.shader_size;
|
||||
shader = fs->shader;
|
||||
}
|
||||
|
||||
fs->bo = lima_bo_create(screen, shader_size, 0);
|
||||
if (!fs->bo) {
|
||||
fprintf(stderr, "lima: create fs shader bo fail\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
memcpy(lima_bo_map(fs->bo), fs->shader, fs->state.shader_size);
|
||||
memcpy(lima_bo_map(fs->bo), shader, shader_size);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -692,11 +692,9 @@ lima_screen_create(int fd, const struct pipe_screen_config *config,
|
||||
screen->pp_buffer->cacheable = false;
|
||||
|
||||
/* fs program for clear buffer?
|
||||
* const0 1 0 0 -1.67773, mov.v0 $0 ^const0.xxxx, stop
|
||||
*/
|
||||
static const uint32_t pp_clear_program[] = {
|
||||
0x00020425, 0x0000000c, 0x01e007cf, 0xb0000000,
|
||||
0x000005f5, 0x00000000, 0x00000000, 0x00000000,
|
||||
PP_CLEAR_PROGRAM
|
||||
};
|
||||
memcpy(lima_bo_map(screen->pp_buffer) + pp_clear_program_offset,
|
||||
pp_clear_program, sizeof(pp_clear_program));
|
||||
|
@ -60,6 +60,11 @@ struct ra_regs;
|
||||
|
||||
#define NR_BO_CACHE_BUCKETS (MAX_BO_CACHE_BUCKET - MIN_BO_CACHE_BUCKET + 1)
|
||||
|
||||
/* const0 1 0 0 -1.67773, mov.v0 $0 ^const0.xxxx, stop */
|
||||
#define PP_CLEAR_PROGRAM \
|
||||
0x00020425, 0x0000000c, 0x01e007cf, 0xb0000000, \
|
||||
0x000005f5, 0x00000000, 0x00000000, 0x00000000, \
|
||||
|
||||
struct lima_screen {
|
||||
struct pipe_screen base;
|
||||
struct renderonly *ro;
|
||||
|
Loading…
Reference in New Issue
Block a user