It is used to access the buffer region. No iov support yet.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Ryan Neph <ryanneph@google.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
It is used to access the control region, with iov support.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Ryan Neph <ryanneph@google.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
We want to access its iov directly from vkr_ring.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Ryan Neph <ryanneph@google.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
They are easier to work with when we support iov_count > 1.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Ryan Neph <ryanneph@google.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
The only functional difference should be that vkr_region_is_aligned
checks both begin and end.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Ryan Neph <ryanneph@google.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
I need to work with ring regions in more places, and need helper
functions. vkr_region uses {begin, end}, which seems easier to work
with than {offset, size}.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Ryan Neph <ryanneph@google.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
It initializes and validates a ring layout, replacing
validate_ring_layout.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Ryan Neph <ryanneph@google.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
The GLSL spec does not mention a memoryBarrierAtomic function, and the
GLSL to TGSI compiler indicates that a TGSI_MEMBAR_ATOMIC_BUFFER is
created from GLSL's memoryBarrierAtomicCounter.
Ref: 526f7d7790/src/mesa/state_tracker/st_glsl_to_tgsi.cpp (L3737)
This fixes:
KHR-GL43.compute_shader.shared-struct
Signed-off-by: Rohan Garg <rohan.garg@collabora.com>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
VkDrmFormatModifierPropertiesListEXT::drmFormatModifierCount may be used
uninitialized. It is a codegen bug but a proper fix breaks the
protocol. Until we are ready to finalize the protocol, let's work
around it.
It works so far because Mesa calls the function twice in a row. In the
first call, pDrmFormatModifierProperties is NULL and the uninitialized
value is not used. Instead, it is initialized by the host driver.
In the second call, because of how the temp pool works, the memory gets
reused and the "uninitialized value" is already initialized. Thanks
goes to Yiwei for figuring this out.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Ryan Neph <ryanneph@google.com>
There is also a num_in_clip_dist, so this makes it clearer what is what.
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Rohan Garg <rohan.garg@collabora.com>
Let the value found in the properties takes preference.
This fixes all compilation and link errors with
KHR-GL43.cull_distance.functional
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Rohan Garg <rohan.garg@collabora.com>
It seems that the GLSL error messages don't count empty lines, so
it is easier to locate errors when the empty lines are skipped in
the output.
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Rohan Garg <rohan.garg@collabora.com>
To make the TGSI-GLSL conversion easier to track, keep the original TGSI
text in place when it is to be logged, and print it right before the shader
conversion.
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Rohan Garg <rohan.garg@collabora.com>
Since we patch the shaders right away only print the shader debug output
after the conversion and the pathcing is finished. This requires that the
tcs pass-through shader printing is moved to the according function.
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Rohan Garg <rohan.garg@collabora.com>
Commit 603699f1 ("vrend: Cleanup and fix bug in next_sampler_id
tracking") fixed a rendering issue in Factorio but inadvertently changed
the indexing behavior for shadow samplers in some related code cleaning.
shadow_samp_*_locs arrays are currently indexed according to the bit
position of a sampler in samplers_used_mask and shadow_samp_mask, so
sampler_index must be incremented for each sampler, not just for each
shadow sampler.
Fixes: 603699f1 ("vrend: Cleanup and fix bug in next_sampler_id tracking")
Signed-off-by: Ryan Neph <ryanneph@google.com>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
There is no need to validate string sizes as they are only encoded in
one place, unlike with other dynamic arrays.
We don't validate string sizes when they are non-zero already. This fixes the
decoder to not validate when they are 0.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Ryan Neph <ryanneph@google.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
A debug message is emitted whenever sampler states are applied and a
NULL state pointer is encountered. NULL pointers indicate that the
default state should be used instead, so there's no need to spam with
error messages approx. 1+ times per draw-call.
commit 405a50d ("vrend: cleanup vrend_bind_sampler_states") adds a more
useful debug message at sampler state bind-time when handle is non-zero
and corresponding state object cannot be located.
Fixes: 32c733f ("src/: replace all instances of "fprintf to stderr" with "vrend_printf"")
Signed-off-by: Ryan Neph <ryanneph@google.com>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Discovered while investigating broken floor tile rendering in Factorio
(game). Skipping increment of next_sampler_id, regardless of dirty
status, results in collision with caller's use of next_sampler_id for
additional samplers.
Closes: https://gitlab.freedesktop.org/virgl/virglrenderer/-/issues/227
Fixes: c08c8419 ("vrend: use helper pointers in draw_bind_samplers_shader")
Signed-off-by: Ryan Neph <ryanneph@google.com>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Cleaner to modify ctx->sub->sampler_views_dirty directly.
Added error message for failed sampler state binds.
Signed-off-by: Ryan Neph <ryanneph@google.com>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
refactor vrend_shader_info use to constant and reduce some variable
scope.
Signed-off-by: Ryan Neph <ryanneph@google.com>
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
These are marked noautovalidity="true" in vk.xml and the decoder does
not validate them. There are more incidents, but for the others, we
will let VVL do its job. Reported by Yiwei.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Ryan Neph <ryanneph@google.com>
The decoder gained dynamic array size validation in commit 92b083bb
("vkr: validate array sizes and string lengths") but failed for one
case: fooCount != 0 and pFoo is NULL. This commit fixes that.
Fixes: 0690ad0b ("vkr: remove some manual NULL checks")
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Ryan Neph <ryanneph@google.com>
We finally have dev readily available to be passed to
vkr_device_add_object.
Let vkr_device_remove_object call list_del as well.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Ryan Neph <ryanneph@google.com>
They are more flexible than the removed {CREATE,DESTORY}_OBJECT. We can
use them for VkDeviceMemory.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Ryan Neph <ryanneph@google.com>
Define two more helper functions and call the helper functions directly.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Ryan Neph <ryanneph@google.com>
Expand the macro at the call sites because it is short enough.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Ryan Neph <ryanneph@google.com>
Expand the macro at the call sites because it is short enough.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Ryan Neph <ryanneph@google.com>
The macro defines a type-safe cast function. Define one for every
object.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Ryan Neph <ryanneph@google.com>
Add macros to define helper functions. Update ALLOCATE_POOL_OBJECTS and
FREE_POOL_OBJECTS to use the helper functions.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Ryan Neph <ryanneph@google.com>
Generate helper functions. Update CREATE_OBJECT and DESTROY_OBJECT to
use the helper functions.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Ryan Neph <ryanneph@google.com>
They just have some #includes currently.
v2: removed vkCreateRenderPass2 as a variant
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Ryan Neph <ryanneph@google.com>
This allows us to use vkr_context_alloc_object.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Ryan Neph <ryanneph@google.com>
A helper function that loads the id from the handle automatically.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Ryan Neph <ryanneph@google.com>
A helper function that asserts.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Ryan Neph <ryanneph@google.com>
By using the string buffer that automatically grows we avoid that
the argument string gets cut off at a certain size when we switch
to pass immediate texop args
v2: free buffers on early error return
Closes: #235
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
While crosvm gets the legit debug name from the guest kernel, it does
not pass it to virglrenderer. We prefer the instance name anyway.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Ryan Neph <ryanneph@google.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Remember it as the instance name.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Ryan Neph <ryanneph@google.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Ensure all ring control member variables have their own storage during
ring creation. Member address re-use would otherwise result in undefined
behavior.
Signed-off-by: Ryan Neph <ryanneph@google.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>