Skip to content
Merged
Show file tree
Hide file tree
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
70 changes: 34 additions & 36 deletions src/gallium/drivers/zink/zink_batch.c
Original file line number Diff line number Diff line change
Expand Up @@ -821,17 +821,18 @@ submit_queue(void *data, void *gdata, int thread_index)
const bool screen_lost = screen->device_lost && keep_promises;
bool recorded = !screen_lost;
if (recorded && bs->has_work) {
VRAM_ALLOC_LOOP(result,
VKSCR(EndCommandBuffer)(bs->cmdbuf),
if (result != VK_SUCCESS) {
mesa_loge("ZINK: vkEndCommandBuffer failed (%s)", vk_Result_to_str(result));
recorded = false;
if (!keep_promises) {
bs->is_device_lost = true;
goto end;
}
/* Once, not in VRAM_ALLOC_LOOP: a failed vkEndCommandBuffer leaves the command buffer invalid (the
* error is its recording's, e.g. a pipeline the driver could not create), and ending it again is
* invalid usage that the runtime asserts on. */
result = VKSCR(EndCommandBuffer)(bs->cmdbuf);
if (result != VK_SUCCESS) {
mesa_loge("ZINK: vkEndCommandBuffer failed (%s)", vk_Result_to_str(result));
recorded = false;
if (!keep_promises) {
bs->is_device_lost = true;
goto end;
}
);
}
}
if (recorded && bs->has_reordered_work) {
VkMemoryBarrier mb;
Expand All @@ -846,38 +847,35 @@ submit_queue(void *data, void *gdata, int thread_index)
src,
VK_PIPELINE_STAGE_ALL_COMMANDS_BIT,
0, 1, &mb, 0, NULL, 0, NULL);
VRAM_ALLOC_LOOP(result,
VKSCR(EndCommandBuffer)(bs->reordered_cmdbuf),
if (result != VK_SUCCESS) {
mesa_loge("ZINK: vkEndCommandBuffer failed (%s)", vk_Result_to_str(result));
recorded = false;
if (!keep_promises) {
bs->is_device_lost = true;
goto end;
}
result = VKSCR(EndCommandBuffer)(bs->reordered_cmdbuf); /* once: see above */
if (result != VK_SUCCESS) {
mesa_loge("ZINK: vkEndCommandBuffer failed (%s)", vk_Result_to_str(result));
recorded = false;
if (!keep_promises) {
bs->is_device_lost = true;
goto end;
}
);
}
}
if (recorded && bs->has_unsync) {
VRAM_ALLOC_LOOP(result,
VKSCR(EndCommandBuffer)(bs->unsynchronized_cmdbuf),
if (result != VK_SUCCESS) {
mesa_loge("ZINK: vkEndCommandBuffer failed (%s)", vk_Result_to_str(result));
recorded = false;
if (!keep_promises) {
bs->is_device_lost = true;
goto end;
}
result = VKSCR(EndCommandBuffer)(bs->unsynchronized_cmdbuf); /* once: see above */
if (result != VK_SUCCESS) {
mesa_loge("ZINK: vkEndCommandBuffer failed (%s)", vk_Result_to_str(result));
recorded = false;
if (!keep_promises) {
bs->is_device_lost = true;
goto end;
}
);
}
}
if (!recorded) {
/* the batch that lost the screen reports it (post_submit); later ones only keep their promises */
if (!screen_lost) {
mesa_loge("ZINK: batch %" PRIu64 " dropped: its semaphores are signalled without its command buffers; "
"the context is lost", batch_id);
bs->is_device_lost = true;
}
/* The batch that lost the screen reports it (post_submit); later ones only keep their promises. A batch
* whose recording failed (vkEndCommandBuffer's error: a render or draw the driver refused) is dropped
* without losing the context: its work is missing, the device and the context's other work are not,
* and losing the context would fail everything after it. */
if (!screen_lost)
mesa_loge("ZINK: batch %" PRIu64 " dropped: its recording failed; its semaphores are signalled "
"without its command buffers", batch_id);
si[ZINK_SUBMIT_CMDBUF].commandBufferCount = 0;
}

Expand Down
8 changes: 8 additions & 0 deletions src/mesa/state_tracker/st_cb_copyimage.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,14 @@ get_canonical_format(struct pipe_screen *screen,
break;

case 16:
/* UNORM for G16R16's sake, but a driver that cannot both render
* and sample R16G16_UNORM (a GLES driver need not: it is not a
* core format) copies R16G16 bit-exactly as UINT.
*/
if (desc->swizzle[0] == PIPE_SWIZZLE_X && desc->swizzle[1] == PIPE_SWIZZLE_Y &&
!screen->is_format_supported(screen, PIPE_FORMAT_R16G16_UNORM, PIPE_TEXTURE_2D, 0, 0,
PIPE_BIND_RENDER_TARGET | PIPE_BIND_SAMPLER_VIEW))
return PIPE_FORMAT_R16G16_UINT;
RETURN_FOR_SWIZZLE2(X, Y, PIPE_FORMAT_R16G16_UNORM);
RETURN_FOR_SWIZZLE2(Y, X, PIPE_FORMAT_G16R16_UNORM);
break;
Expand Down
9 changes: 9 additions & 0 deletions src/mesa/state_tracker/st_extensions.c
Original file line number Diff line number Diff line change
Expand Up @@ -1460,6 +1460,15 @@ void st_init_extensions(struct pipe_screen *screen,
get_max_samples_for_formats(screen, ARRAY_SIZE(int_formats),
int_formats, consts->MaxSamples,
PIPE_BIND_SAMPLER_VIEW);
/* GL's minimum is 1: a driver without multisampled integer formats
* still has single-sampled ones (ES 3.1 queries it per format)
*/
if (consts->MaxSamples && !consts->MaxIntegerSamples)
consts->MaxIntegerSamples = 1;
if (consts->MaxSamples && !consts->MaxColorTextureSamples)
consts->MaxColorTextureSamples = 1;
if (consts->MaxSamples && !consts->MaxDepthTextureSamples)
consts->MaxDepthTextureSamples = 1;

/* ARB_framebuffer_no_attachments, assume max no. of samples 32 */
consts->MaxFramebufferSamples =
Expand Down
Loading