Compare commits
55 Commits
mesa-20.2.
...
mesa-13.0.
Author | SHA1 | Date | |
---|---|---|---|
|
91b2b925d1 | ||
|
7a977612fc | ||
|
95b5a69093 | ||
|
ea37a06037 | ||
|
02d5e60ee0 | ||
|
649a47a834 | ||
|
d640b0d71b | ||
|
d35c4d1512 | ||
|
5c00425354 | ||
|
6458a9dc6c | ||
|
b1d02e7006 | ||
|
c29a37c444 | ||
|
9c5bbfcbc8 | ||
|
cf82ceb21e | ||
|
b214af38b9 | ||
|
fbfc01e654 | ||
|
100851b1f5 | ||
|
8ec30b87c0 | ||
|
cc5995d9e6 | ||
|
42de0666ec | ||
|
4083feb939 | ||
|
92a50b3d6e | ||
|
732b39507b | ||
|
8962e9a239 | ||
|
29f70e8e09 | ||
|
04bd51d7d0 | ||
|
f17450ff7e | ||
|
de826a10a7 | ||
|
188a866fd0 | ||
|
a850e69b7e | ||
|
d576a2b0e6 | ||
|
32caa7438a | ||
|
074ede8d4f | ||
|
497cf4a9d1 | ||
|
f623a8be3e | ||
|
af81cdfec0 | ||
|
990f395e00 | ||
|
19e8270fe0 | ||
|
cac49ee2cd | ||
|
0f8b7f90d1 | ||
|
abf5327b86 | ||
|
d0d3e721d0 | ||
|
293e458558 | ||
|
5798d602e0 | ||
|
039d1e6f11 | ||
|
ba6efd48c3 | ||
|
13f685cf11 | ||
|
8f807e914f | ||
|
3581e21d5b | ||
|
52df379d6b | ||
|
05b89cf40e | ||
|
4768b7353f | ||
|
554a99ebde | ||
|
e45c4586c2 | ||
|
2ced8eb136 |
@@ -62,6 +62,7 @@ noinst_HEADERS = \
|
||||
include/c99_math.h \
|
||||
include/c11 \
|
||||
include/D3D9 \
|
||||
include/GL/wglext.h \
|
||||
include/HaikuGL \
|
||||
include/no_extern_c.h \
|
||||
include/pci_ids
|
||||
|
2
bin/.cherry-ignore
Normal file
2
bin/.cherry-ignore
Normal file
@@ -0,0 +1,2 @@
|
||||
# Commit was picked with -x
|
||||
907ace57986733add2aebfa9dd7c83c67efed70e mapi: automake: set VISIBILITY_CFLAGS for shared glapi
|
@@ -1667,13 +1667,6 @@ AC_ARG_WITH([vulkan-icddir],
|
||||
[VULKAN_ICD_INSTALL_DIR='${datarootdir}/vulkan/icd.d'])
|
||||
AC_SUBST([VULKAN_ICD_INSTALL_DIR])
|
||||
|
||||
AC_ARG_ENABLE([vulkan-icd-full-driver-path],
|
||||
[AS_HELP_STRING([--disable-vulkan-icd-full-driver-path],
|
||||
[create Vulkan ICD files with just a .so name and no path])],
|
||||
[vulkan_icd_driver_path="$enableval"],
|
||||
[vulkan_icd_driver_path="yes"])
|
||||
AM_CONDITIONAL(VULKAN_ICD_DRIVER_PATH, test "x$vulkan_icd_driver_path" = xyes)
|
||||
|
||||
if test -n "$with_vulkan_drivers"; then
|
||||
VULKAN_DRIVERS=`IFS=', '; echo $with_vulkan_drivers`
|
||||
for driver in $VULKAN_DRIVERS; do
|
||||
|
@@ -3412,7 +3412,7 @@ static void visit_tex(struct nir_to_llvm_context *ctx, nir_tex_instr *instr)
|
||||
result = build_tex_intrinsic(ctx, instr, &txf_info);
|
||||
|
||||
result = LLVMBuildExtractElement(ctx->builder, result, ctx->i32zero, "");
|
||||
result = LLVMBuildICmp(ctx->builder, LLVMIntEQ, result, ctx->i32zero, "");
|
||||
result = emit_int_cmp(ctx, LLVMIntEQ, result, ctx->i32zero);
|
||||
goto write_result;
|
||||
}
|
||||
|
||||
@@ -3520,7 +3520,8 @@ static void visit_tex(struct nir_to_llvm_context *ctx, nir_tex_instr *instr)
|
||||
LLVMValueRef z = LLVMBuildExtractElement(ctx->builder, result, two, "");
|
||||
z = LLVMBuildSDiv(ctx->builder, z, six, "");
|
||||
result = LLVMBuildInsertElement(ctx->builder, result, z, two, "");
|
||||
}
|
||||
} else if (instr->dest.ssa.num_components != 4)
|
||||
result = trim_vector(ctx, result, instr->dest.ssa.num_components);
|
||||
|
||||
write_result:
|
||||
if (result) {
|
||||
|
@@ -2,6 +2,6 @@
|
||||
"file_format_version": "1.0.0",
|
||||
"ICD": {
|
||||
"library_path": "@build_libdir@/libvulkan_radeon.so",
|
||||
"abi_versions": "1.0.3"
|
||||
"api_version": "1.0.3"
|
||||
}
|
||||
}
|
||||
|
@@ -2,6 +2,6 @@
|
||||
"file_format_version": "1.0.0",
|
||||
"ICD": {
|
||||
"library_path": "libvulkan_radeon.so",
|
||||
"abi_versions": "1.0.3"
|
||||
"api_version": "1.0.3"
|
||||
}
|
||||
}
|
||||
|
@@ -2163,9 +2163,6 @@ static void radv_handle_cmask_image_transition(struct radv_cmd_buffer *cmd_buffe
|
||||
radv_initialise_cmask(cmd_buffer, image, 0xffffffffu);
|
||||
} else if (radv_layout_has_cmask(image, src_layout) &&
|
||||
!radv_layout_has_cmask(image, dst_layout)) {
|
||||
|
||||
if (!cmd_buffer->device->allow_fast_clears)
|
||||
return;
|
||||
radv_fast_clear_flush_image_inplace(cmd_buffer, image);
|
||||
}
|
||||
}
|
||||
|
@@ -44,12 +44,6 @@
|
||||
#include "util/debug.h"
|
||||
struct radv_dispatch_table dtable;
|
||||
|
||||
struct radv_fence {
|
||||
struct radeon_winsys_fence *fence;
|
||||
bool submitted;
|
||||
bool signalled;
|
||||
};
|
||||
|
||||
static VkResult
|
||||
radv_physical_device_init(struct radv_physical_device *device,
|
||||
struct radv_instance *instance,
|
||||
|
@@ -1206,6 +1206,13 @@ void radv_initialise_cmask(struct radv_cmd_buffer *cmd_buffer,
|
||||
struct radv_image *image, uint32_t value);
|
||||
void radv_initialize_dcc(struct radv_cmd_buffer *cmd_buffer,
|
||||
struct radv_image *image, uint32_t value);
|
||||
|
||||
struct radv_fence {
|
||||
struct radeon_winsys_fence *fence;
|
||||
bool submitted;
|
||||
bool signalled;
|
||||
};
|
||||
|
||||
#define RADV_DEFINE_HANDLE_CASTS(__radv_type, __VkType) \
|
||||
\
|
||||
static inline struct __radv_type * \
|
||||
|
@@ -318,13 +318,21 @@ VkResult radv_AcquireNextImageKHR(
|
||||
VkSwapchainKHR _swapchain,
|
||||
uint64_t timeout,
|
||||
VkSemaphore semaphore,
|
||||
VkFence fence,
|
||||
VkFence _fence,
|
||||
uint32_t* pImageIndex)
|
||||
{
|
||||
RADV_FROM_HANDLE(wsi_swapchain, swapchain, _swapchain);
|
||||
RADV_FROM_HANDLE(radv_fence, fence, _fence);
|
||||
|
||||
return swapchain->acquire_next_image(swapchain, timeout, semaphore,
|
||||
pImageIndex);
|
||||
VkResult result = swapchain->acquire_next_image(swapchain, timeout, semaphore,
|
||||
pImageIndex);
|
||||
|
||||
if (fence && result == VK_SUCCESS) {
|
||||
fence->submitted = true;
|
||||
fence->signalled = true;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
VkResult radv_QueuePresentKHR(
|
||||
|
@@ -4330,6 +4330,8 @@ handle_tess_ctrl_shader_output_decl(struct _mesa_glsl_parse_state *state,
|
||||
if (var->data.patch)
|
||||
return;
|
||||
|
||||
var->data.tess_varying_implicit_sized_array = var->type->is_unsized_array();
|
||||
|
||||
validate_layout_qualifier_vertex_count(state, loc, var, num_vertices,
|
||||
&state->tcs_output_size,
|
||||
"tessellation control shader output");
|
||||
@@ -4366,6 +4368,7 @@ handle_tess_shader_input_decl(struct _mesa_glsl_parse_state *state,
|
||||
if (var->type->is_unsized_array()) {
|
||||
var->type = glsl_type::get_array_instance(var->type->fields.array,
|
||||
state->Const.MaxPatchVertices);
|
||||
var->data.tess_varying_implicit_sized_array = true;
|
||||
} else if (var->type->length != state->Const.MaxPatchVertices) {
|
||||
_mesa_glsl_error(&loc, state,
|
||||
"per-vertex tessellation shader input arrays must be "
|
||||
|
@@ -126,7 +126,7 @@ void glsl_symbol_table::pop_scope()
|
||||
|
||||
bool glsl_symbol_table::name_declared_this_scope(const char *name)
|
||||
{
|
||||
return _mesa_symbol_table_symbol_scope(table, -1, name) == 0;
|
||||
return _mesa_symbol_table_symbol_scope(table, name) == 0;
|
||||
}
|
||||
|
||||
bool glsl_symbol_table::add_variable(ir_variable *v)
|
||||
@@ -152,7 +152,7 @@ bool glsl_symbol_table::add_variable(ir_variable *v)
|
||||
symbol_table_entry *entry = new(mem_ctx) symbol_table_entry(v);
|
||||
if (existing != NULL)
|
||||
entry->f = existing->f;
|
||||
int added = _mesa_symbol_table_add_symbol(table, -1, v->name, entry);
|
||||
int added = _mesa_symbol_table_add_symbol(table, v->name, entry);
|
||||
assert(added == 0);
|
||||
(void)added;
|
||||
return true;
|
||||
@@ -162,13 +162,13 @@ bool glsl_symbol_table::add_variable(ir_variable *v)
|
||||
|
||||
/* 1.20+ rules: */
|
||||
symbol_table_entry *entry = new(mem_ctx) symbol_table_entry(v);
|
||||
return _mesa_symbol_table_add_symbol(table, -1, v->name, entry) == 0;
|
||||
return _mesa_symbol_table_add_symbol(table, v->name, entry) == 0;
|
||||
}
|
||||
|
||||
bool glsl_symbol_table::add_type(const char *name, const glsl_type *t)
|
||||
{
|
||||
symbol_table_entry *entry = new(mem_ctx) symbol_table_entry(t);
|
||||
return _mesa_symbol_table_add_symbol(table, -1, name, entry) == 0;
|
||||
return _mesa_symbol_table_add_symbol(table, name, entry) == 0;
|
||||
}
|
||||
|
||||
bool glsl_symbol_table::add_interface(const char *name, const glsl_type *i,
|
||||
@@ -180,7 +180,7 @@ bool glsl_symbol_table::add_interface(const char *name, const glsl_type *i,
|
||||
symbol_table_entry *entry =
|
||||
new(mem_ctx) symbol_table_entry(i, mode);
|
||||
bool add_interface_symbol_result =
|
||||
_mesa_symbol_table_add_symbol(table, -1, name, entry) == 0;
|
||||
_mesa_symbol_table_add_symbol(table, name, entry) == 0;
|
||||
assert(add_interface_symbol_result);
|
||||
return add_interface_symbol_result;
|
||||
} else {
|
||||
@@ -199,7 +199,7 @@ bool glsl_symbol_table::add_function(ir_function *f)
|
||||
}
|
||||
}
|
||||
symbol_table_entry *entry = new(mem_ctx) symbol_table_entry(f);
|
||||
return _mesa_symbol_table_add_symbol(table, -1, f->name, entry) == 0;
|
||||
return _mesa_symbol_table_add_symbol(table, f->name, entry) == 0;
|
||||
}
|
||||
|
||||
bool glsl_symbol_table::add_default_precision_qualifier(const char *type_name,
|
||||
@@ -213,13 +213,16 @@ bool glsl_symbol_table::add_default_precision_qualifier(const char *type_name,
|
||||
symbol_table_entry *entry =
|
||||
new(mem_ctx) symbol_table_entry(default_specifier);
|
||||
|
||||
return _mesa_symbol_table_add_symbol(table, -1, name, entry) == 0;
|
||||
if (!get_entry(name))
|
||||
return _mesa_symbol_table_add_symbol(table, name, entry) == 0;
|
||||
|
||||
return _mesa_symbol_table_replace_symbol(table, name, entry) == 0;
|
||||
}
|
||||
|
||||
void glsl_symbol_table::add_global_function(ir_function *f)
|
||||
{
|
||||
symbol_table_entry *entry = new(mem_ctx) symbol_table_entry(f);
|
||||
int added = _mesa_symbol_table_add_global_symbol(table, -1, f->name, entry);
|
||||
int added = _mesa_symbol_table_add_global_symbol(table, f->name, entry);
|
||||
assert(added == 0);
|
||||
(void)added;
|
||||
}
|
||||
@@ -261,7 +264,7 @@ int glsl_symbol_table::get_default_precision_qualifier(const char *type_name)
|
||||
symbol_table_entry *glsl_symbol_table::get_entry(const char *name)
|
||||
{
|
||||
return (symbol_table_entry *)
|
||||
_mesa_symbol_table_find_symbol(table, -1, name);
|
||||
_mesa_symbol_table_find_symbol(table, name);
|
||||
}
|
||||
|
||||
void
|
||||
|
@@ -832,6 +832,12 @@ public:
|
||||
|
||||
unsigned implicit_sized_array:1;
|
||||
|
||||
/**
|
||||
* Is this a non-patch TCS output / TES input array that was implicitly
|
||||
* sized to gl_MaxPatchVertices?
|
||||
*/
|
||||
unsigned tess_varying_implicit_sized_array:1;
|
||||
|
||||
/**
|
||||
* Whether this is a fragment shader output implicitly initialized with
|
||||
* the previous contents of the specified render target at the
|
||||
|
@@ -130,14 +130,14 @@ ir_print_visitor::unique_name(ir_variable *var)
|
||||
|
||||
/* If there's no conflict, just use the original name */
|
||||
const char* name = NULL;
|
||||
if (_mesa_symbol_table_find_symbol(this->symbols, -1, var->name) == NULL) {
|
||||
if (_mesa_symbol_table_find_symbol(this->symbols, var->name) == NULL) {
|
||||
name = var->name;
|
||||
} else {
|
||||
static unsigned i = 1;
|
||||
name = ralloc_asprintf(this->mem_ctx, "%s@%u", var->name, ++i);
|
||||
}
|
||||
_mesa_hash_table_insert(this->printable_names, var, (void *) name);
|
||||
_mesa_symbol_table_add_symbol(this->symbols, -1, name, var);
|
||||
_mesa_symbol_table_add_symbol(this->symbols, name, var);
|
||||
return name;
|
||||
}
|
||||
|
||||
|
@@ -3574,6 +3574,7 @@ static gl_shader_variable *
|
||||
create_shader_variable(struct gl_shader_program *shProg,
|
||||
const ir_variable *in,
|
||||
const char *name, const glsl_type *type,
|
||||
const glsl_type *interface_type,
|
||||
bool use_implicit_location, int location,
|
||||
const glsl_type *outermost_struct_type)
|
||||
{
|
||||
@@ -3631,7 +3632,7 @@ create_shader_variable(struct gl_shader_program *shProg,
|
||||
|
||||
out->type = type;
|
||||
out->outermost_struct_type = outermost_struct_type;
|
||||
out->interface_type = in->get_interface_type();
|
||||
out->interface_type = interface_type;
|
||||
out->component = in->data.location_frac;
|
||||
out->index = in->data.index;
|
||||
out->patch = in->data.patch;
|
||||
@@ -3643,8 +3644,21 @@ create_shader_variable(struct gl_shader_program *shProg,
|
||||
return out;
|
||||
}
|
||||
|
||||
static const glsl_type *
|
||||
resize_to_max_patch_vertices(const struct gl_context *ctx,
|
||||
const glsl_type *type)
|
||||
{
|
||||
if (!type)
|
||||
return NULL;
|
||||
|
||||
return glsl_type::get_array_instance(type->fields.array,
|
||||
ctx->Const.MaxPatchVertices);
|
||||
}
|
||||
|
||||
static bool
|
||||
add_shader_variable(struct gl_shader_program *shProg, struct set *resource_set,
|
||||
add_shader_variable(const struct gl_context *ctx,
|
||||
struct gl_shader_program *shProg,
|
||||
struct set *resource_set,
|
||||
unsigned stage_mask,
|
||||
GLenum programInterface, ir_variable *var,
|
||||
const char *name, const glsl_type *type,
|
||||
@@ -3673,7 +3687,7 @@ add_shader_variable(struct gl_shader_program *shProg, struct set *resource_set,
|
||||
for (unsigned i = 0; i < type->length; i++) {
|
||||
const struct glsl_struct_field *field = &type->fields.structure[i];
|
||||
char *field_name = ralloc_asprintf(shProg, "%s.%s", name, field->name);
|
||||
if (!add_shader_variable(shProg, resource_set,
|
||||
if (!add_shader_variable(ctx, shProg, resource_set,
|
||||
stage_mask, programInterface,
|
||||
var, field_name, field->type,
|
||||
use_implicit_location, field_location,
|
||||
@@ -3687,6 +3701,29 @@ add_shader_variable(struct gl_shader_program *shProg, struct set *resource_set,
|
||||
}
|
||||
|
||||
default: {
|
||||
const glsl_type *interface_type = var->get_interface_type();
|
||||
|
||||
/* Unsized (non-patch) TCS output/TES input arrays are implicitly
|
||||
* sized to gl_MaxPatchVertices. Internally, we shrink them to a
|
||||
* smaller size.
|
||||
*
|
||||
* This can cause trouble with SSO programs. Since the TCS declares
|
||||
* the number of output vertices, we can always shrink TCS output
|
||||
* arrays. However, the TES might not be linked with a TCS, in
|
||||
* which case it won't know the size of the patch. In other words,
|
||||
* the TCS and TES may disagree on the (smaller) array sizes. This
|
||||
* can result in the resource names differing across stages, causing
|
||||
* SSO validation failures and other cascading issues.
|
||||
*
|
||||
* Expanding the array size to the full gl_MaxPatchVertices fixes
|
||||
* these issues. It's also what program interface queries expect,
|
||||
* as that is the official size of the array.
|
||||
*/
|
||||
if (var->data.tess_varying_implicit_sized_array) {
|
||||
type = resize_to_max_patch_vertices(ctx, type);
|
||||
interface_type = resize_to_max_patch_vertices(ctx, interface_type);
|
||||
}
|
||||
|
||||
/* Issue #16 of the ARB_program_interface_query spec says:
|
||||
*
|
||||
* "* If a variable is a member of an interface block without an
|
||||
@@ -3699,8 +3736,7 @@ add_shader_variable(struct gl_shader_program *shProg, struct set *resource_set,
|
||||
*/
|
||||
const char *prefixed_name = (var->data.from_named_ifc_block &&
|
||||
!is_gl_identifier(var->name))
|
||||
? ralloc_asprintf(shProg, "%s.%s", var->get_interface_type()->name,
|
||||
name)
|
||||
? ralloc_asprintf(shProg, "%s.%s", interface_type->name, name)
|
||||
: name;
|
||||
|
||||
/* The ARB_program_interface_query spec says:
|
||||
@@ -3711,6 +3747,7 @@ add_shader_variable(struct gl_shader_program *shProg, struct set *resource_set,
|
||||
*/
|
||||
gl_shader_variable *sha_v =
|
||||
create_shader_variable(shProg, var, prefixed_name, type,
|
||||
interface_type,
|
||||
use_implicit_location, location,
|
||||
outermost_struct_type);
|
||||
if (!sha_v)
|
||||
@@ -3723,7 +3760,8 @@ add_shader_variable(struct gl_shader_program *shProg, struct set *resource_set,
|
||||
}
|
||||
|
||||
static bool
|
||||
add_interface_variables(struct gl_shader_program *shProg,
|
||||
add_interface_variables(const struct gl_context *ctx,
|
||||
struct gl_shader_program *shProg,
|
||||
struct set *resource_set,
|
||||
unsigned stage, GLenum programInterface)
|
||||
{
|
||||
@@ -3774,7 +3812,7 @@ add_interface_variables(struct gl_shader_program *shProg,
|
||||
(stage == MESA_SHADER_VERTEX && var->data.mode == ir_var_shader_in) ||
|
||||
(stage == MESA_SHADER_FRAGMENT && var->data.mode == ir_var_shader_out);
|
||||
|
||||
if (!add_shader_variable(shProg, resource_set,
|
||||
if (!add_shader_variable(ctx, shProg, resource_set,
|
||||
1 << stage, programInterface,
|
||||
var, var->name, var->type, vs_input_or_fs_output,
|
||||
var->data.location - loc_bias))
|
||||
@@ -3784,7 +3822,9 @@ add_interface_variables(struct gl_shader_program *shProg,
|
||||
}
|
||||
|
||||
static bool
|
||||
add_packed_varyings(struct gl_shader_program *shProg, struct set *resource_set,
|
||||
add_packed_varyings(const struct gl_context *ctx,
|
||||
struct gl_shader_program *shProg,
|
||||
struct set *resource_set,
|
||||
int stage, GLenum type)
|
||||
{
|
||||
struct gl_linked_shader *sh = shProg->_LinkedShaders[stage];
|
||||
@@ -3810,7 +3850,7 @@ add_packed_varyings(struct gl_shader_program *shProg, struct set *resource_set,
|
||||
if (type == iface) {
|
||||
const int stage_mask =
|
||||
build_stageref(shProg, var->name, var->data.mode);
|
||||
if (!add_shader_variable(shProg, resource_set,
|
||||
if (!add_shader_variable(ctx, shProg, resource_set,
|
||||
stage_mask,
|
||||
iface, var, var->name, var->type, false,
|
||||
var->data.location - VARYING_SLOT_VAR0))
|
||||
@@ -3822,7 +3862,9 @@ add_packed_varyings(struct gl_shader_program *shProg, struct set *resource_set,
|
||||
}
|
||||
|
||||
static bool
|
||||
add_fragdata_arrays(struct gl_shader_program *shProg, struct set *resource_set)
|
||||
add_fragdata_arrays(const struct gl_context *ctx,
|
||||
struct gl_shader_program *shProg,
|
||||
struct set *resource_set)
|
||||
{
|
||||
struct gl_linked_shader *sh = shProg->_LinkedShaders[MESA_SHADER_FRAGMENT];
|
||||
|
||||
@@ -3834,7 +3876,7 @@ add_fragdata_arrays(struct gl_shader_program *shProg, struct set *resource_set)
|
||||
if (var) {
|
||||
assert(var->data.mode == ir_var_shader_out);
|
||||
|
||||
if (!add_shader_variable(shProg, resource_set,
|
||||
if (!add_shader_variable(ctx, shProg, resource_set,
|
||||
1 << MESA_SHADER_FRAGMENT,
|
||||
GL_PROGRAM_OUTPUT, var, var->name, var->type,
|
||||
true, var->data.location - FRAG_RESULT_DATA0))
|
||||
@@ -4093,24 +4135,24 @@ build_program_resource_list(struct gl_context *ctx,
|
||||
|
||||
/* Program interface needs to expose varyings in case of SSO. */
|
||||
if (shProg->SeparateShader) {
|
||||
if (!add_packed_varyings(shProg, resource_set,
|
||||
if (!add_packed_varyings(ctx, shProg, resource_set,
|
||||
input_stage, GL_PROGRAM_INPUT))
|
||||
return;
|
||||
|
||||
if (!add_packed_varyings(shProg, resource_set,
|
||||
if (!add_packed_varyings(ctx, shProg, resource_set,
|
||||
output_stage, GL_PROGRAM_OUTPUT))
|
||||
return;
|
||||
}
|
||||
|
||||
if (!add_fragdata_arrays(shProg, resource_set))
|
||||
if (!add_fragdata_arrays(ctx, shProg, resource_set))
|
||||
return;
|
||||
|
||||
/* Add inputs and outputs to the resource list. */
|
||||
if (!add_interface_variables(shProg, resource_set,
|
||||
if (!add_interface_variables(ctx, shProg, resource_set,
|
||||
input_stage, GL_PROGRAM_INPUT))
|
||||
return;
|
||||
|
||||
if (!add_interface_variables(shProg, resource_set,
|
||||
if (!add_interface_variables(ctx, shProg, resource_set,
|
||||
output_stage, GL_PROGRAM_OUTPUT))
|
||||
return;
|
||||
|
||||
|
@@ -193,6 +193,8 @@ flatten_named_interface_blocks_declarations::run(exec_list *instructions)
|
||||
new_var->data.patch = iface_t->fields.structure[i].patch;
|
||||
new_var->data.stream = var->data.stream;
|
||||
new_var->data.how_declared = var->data.how_declared;
|
||||
new_var->data.tess_varying_implicit_sized_array =
|
||||
var->data.tess_varying_implicit_sized_array;
|
||||
new_var->data.from_named_ifc_block = 1;
|
||||
|
||||
new_var->init_interface_type(var->type);
|
||||
|
@@ -241,6 +241,15 @@ dri2_add_config(_EGLDisplay *disp, const __DRIconfig *dri_config, int id,
|
||||
return NULL;
|
||||
break;
|
||||
|
||||
case __DRI_ATTRIB_MAX_PBUFFER_WIDTH:
|
||||
_eglSetConfigKey(&base, EGL_MAX_PBUFFER_WIDTH,
|
||||
_EGL_MAX_PBUFFER_WIDTH);
|
||||
break;
|
||||
case __DRI_ATTRIB_MAX_PBUFFER_HEIGHT:
|
||||
_eglSetConfigKey(&base, EGL_MAX_PBUFFER_HEIGHT,
|
||||
_EGL_MAX_PBUFFER_HEIGHT);
|
||||
break;
|
||||
|
||||
default:
|
||||
key = dri2_to_egl_attribute_map[attrib];
|
||||
if (key != 0)
|
||||
|
@@ -66,7 +66,8 @@ dri2_fallback_swap_buffers_with_damage(_EGLDriver *drv, _EGLDisplay *dpy,
|
||||
_EGLSurface *surf,
|
||||
const EGLint *rects, EGLint n_rects)
|
||||
{
|
||||
return EGL_FALSE;
|
||||
struct dri2_egl_display *dri2_dpy = dri2_egl_display(dpy);
|
||||
return dri2_dpy->vtbl->swap_buffers(drv, dpy, surf);
|
||||
}
|
||||
|
||||
static inline EGLBoolean
|
||||
|
@@ -766,8 +766,6 @@ droid_add_configs_for_visuals(_EGLDriver *drv, _EGLDisplay *dpy)
|
||||
EGL_NATIVE_VISUAL_TYPE, 0,
|
||||
EGL_FRAMEBUFFER_TARGET_ANDROID, EGL_TRUE,
|
||||
EGL_RECORDABLE_ANDROID, EGL_TRUE,
|
||||
EGL_MAX_PBUFFER_WIDTH, _EGL_MAX_PBUFFER_WIDTH,
|
||||
EGL_MAX_PBUFFER_HEIGHT, _EGL_MAX_PBUFFER_HEIGHT,
|
||||
EGL_NONE
|
||||
};
|
||||
unsigned int format_count[ARRAY_SIZE(visuals)] = { 0 };
|
||||
|
@@ -118,6 +118,13 @@ resize_callback(struct wl_egl_window *wl_win, void *data)
|
||||
(*dri2_dpy->flush->invalidate)(dri2_surf->dri_drawable);
|
||||
}
|
||||
|
||||
static void
|
||||
destroy_window_callback(void *data)
|
||||
{
|
||||
struct dri2_egl_surface *dri2_surf = data;
|
||||
dri2_surf->wl_win = NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called via eglCreateWindowSurface(), drv->API.CreateWindowSurface().
|
||||
*/
|
||||
@@ -159,6 +166,7 @@ dri2_wl_create_surface(_EGLDriver *drv, _EGLDisplay *disp,
|
||||
|
||||
dri2_surf->wl_win->private = dri2_surf;
|
||||
dri2_surf->wl_win->resize_callback = resize_callback;
|
||||
dri2_surf->wl_win->destroy_window_callback = destroy_window_callback;
|
||||
|
||||
dri2_surf->base.Width = -1;
|
||||
dri2_surf->base.Height = -1;
|
||||
@@ -254,8 +262,11 @@ dri2_wl_destroy_surface(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf)
|
||||
if (dri2_surf->throttle_callback)
|
||||
wl_callback_destroy(dri2_surf->throttle_callback);
|
||||
|
||||
dri2_surf->wl_win->private = NULL;
|
||||
dri2_surf->wl_win->resize_callback = NULL;
|
||||
if (dri2_surf->wl_win) {
|
||||
dri2_surf->wl_win->private = NULL;
|
||||
dri2_surf->wl_win->resize_callback = NULL;
|
||||
dri2_surf->wl_win->destroy_window_callback = NULL;
|
||||
}
|
||||
|
||||
free(surf);
|
||||
|
||||
|
@@ -734,7 +734,9 @@ eglCreateContext(EGLDisplay dpy, EGLConfig config, EGLContext share_list,
|
||||
|
||||
_EGL_CHECK_DISPLAY(disp, EGL_NO_CONTEXT, drv);
|
||||
|
||||
if (!config && !disp->Extensions.KHR_no_config_context)
|
||||
if (config != EGL_NO_CONFIG_KHR)
|
||||
_EGL_CHECK_CONFIG(disp, conf, EGL_NO_CONTEXT, drv);
|
||||
else if (!disp->Extensions.KHR_no_config_context)
|
||||
RETURN_EGL_ERROR(disp, EGL_BAD_CONFIG, EGL_NO_CONTEXT);
|
||||
|
||||
if (!share && share_list != EGL_NO_CONTEXT)
|
||||
|
@@ -262,9 +262,13 @@ _eglInitSurface(_EGLSurface *surf, _EGLDisplay *dpy, EGLint type,
|
||||
{
|
||||
const char *func;
|
||||
EGLint renderBuffer = EGL_BACK_BUFFER;
|
||||
EGLint swapBehavior = EGL_BUFFER_PRESERVED;
|
||||
EGLint swapBehavior = EGL_BUFFER_DESTROYED;
|
||||
EGLint err;
|
||||
|
||||
/* Swap behavior can be preserved only if config supports this. */
|
||||
if (conf->SurfaceType & EGL_SWAP_BEHAVIOR_PRESERVED_BIT)
|
||||
swapBehavior = EGL_BUFFER_PRESERVED;
|
||||
|
||||
switch (type) {
|
||||
case EGL_WINDOW_BIT:
|
||||
func = "eglCreateWindowSurface";
|
||||
|
@@ -760,7 +760,7 @@ CodeEmitterGK110::emitISAD(const Instruction *i)
|
||||
void
|
||||
CodeEmitterGK110::emitSHLADD(const Instruction *i)
|
||||
{
|
||||
uint8_t addOp = (i->src(2).mod.neg() << 1) | i->src(0).mod.neg();
|
||||
uint8_t addOp = (i->src(0).mod.neg() << 1) | i->src(2).mod.neg();
|
||||
const ImmediateValue *imm = i->src(1).get()->asImm();
|
||||
assert(imm);
|
||||
|
||||
|
@@ -762,7 +762,7 @@ CodeEmitterNVC0::emitIMAD(const Instruction *i)
|
||||
void
|
||||
CodeEmitterNVC0::emitSHLADD(const Instruction *i)
|
||||
{
|
||||
uint8_t addOp = (i->src(2).mod.neg() << 1) | i->src(0).mod.neg();
|
||||
uint8_t addOp = (i->src(0).mod.neg() << 1) | i->src(2).mod.neg();
|
||||
const ImmediateValue *imm = i->src(1).get()->asImm();
|
||||
assert(imm);
|
||||
|
||||
|
@@ -182,6 +182,7 @@ public:
|
||||
|
||||
// mask of used components of source s
|
||||
unsigned int srcMask(unsigned int s) const;
|
||||
unsigned int texOffsetMask() const;
|
||||
|
||||
SrcRegister getSrc(unsigned int s) const
|
||||
{
|
||||
@@ -234,6 +235,35 @@ private:
|
||||
const struct tgsi_full_instruction *insn;
|
||||
};
|
||||
|
||||
unsigned int Instruction::texOffsetMask() const
|
||||
{
|
||||
const struct tgsi_instruction_texture *tex = &insn->Texture;
|
||||
assert(insn->Instruction.Texture);
|
||||
|
||||
switch (tex->Texture) {
|
||||
case TGSI_TEXTURE_BUFFER:
|
||||
case TGSI_TEXTURE_1D:
|
||||
case TGSI_TEXTURE_SHADOW1D:
|
||||
case TGSI_TEXTURE_1D_ARRAY:
|
||||
case TGSI_TEXTURE_SHADOW1D_ARRAY:
|
||||
return 0x1;
|
||||
case TGSI_TEXTURE_2D:
|
||||
case TGSI_TEXTURE_SHADOW2D:
|
||||
case TGSI_TEXTURE_2D_ARRAY:
|
||||
case TGSI_TEXTURE_SHADOW2D_ARRAY:
|
||||
case TGSI_TEXTURE_RECT:
|
||||
case TGSI_TEXTURE_SHADOWRECT:
|
||||
case TGSI_TEXTURE_2D_MSAA:
|
||||
case TGSI_TEXTURE_2D_ARRAY_MSAA:
|
||||
return 0x3;
|
||||
case TGSI_TEXTURE_3D:
|
||||
return 0x7;
|
||||
default:
|
||||
assert(!"Unexpected texture target");
|
||||
return 0xf;
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int Instruction::srcMask(unsigned int s) const
|
||||
{
|
||||
unsigned int mask = insn->Dst[0].Register.WriteMask;
|
||||
@@ -955,6 +985,9 @@ private:
|
||||
int inferSysValDirection(unsigned sn) const;
|
||||
bool scanDeclaration(const struct tgsi_full_declaration *);
|
||||
bool scanInstruction(const struct tgsi_full_instruction *);
|
||||
void scanInstructionSrc(const Instruction& insn,
|
||||
const Instruction::SrcRegister& src,
|
||||
unsigned mask);
|
||||
void scanProperty(const struct tgsi_full_property *);
|
||||
void scanImmediate(const struct tgsi_full_immediate *);
|
||||
|
||||
@@ -1364,6 +1397,61 @@ inline bool Source::isEdgeFlagPassthrough(const Instruction& insn) const
|
||||
insn.getSrc(0).getFile() == TGSI_FILE_INPUT;
|
||||
}
|
||||
|
||||
void Source::scanInstructionSrc(const Instruction& insn,
|
||||
const Instruction::SrcRegister& src,
|
||||
unsigned mask)
|
||||
{
|
||||
if (src.getFile() == TGSI_FILE_TEMPORARY) {
|
||||
if (src.isIndirect(0))
|
||||
indirectTempArrays.insert(src.getArrayId());
|
||||
} else
|
||||
if (src.getFile() == TGSI_FILE_BUFFER ||
|
||||
src.getFile() == TGSI_FILE_IMAGE ||
|
||||
(src.getFile() == TGSI_FILE_MEMORY &&
|
||||
memoryFiles[src.getIndex(0)].mem_type == TGSI_MEMORY_TYPE_GLOBAL)) {
|
||||
info->io.globalAccess |= (insn.getOpcode() == TGSI_OPCODE_LOAD) ?
|
||||
0x1 : 0x2;
|
||||
} else
|
||||
if (src.getFile() == TGSI_FILE_OUTPUT) {
|
||||
if (src.isIndirect(0)) {
|
||||
// We don't know which one is accessed, just mark everything for
|
||||
// reading. This is an extremely unlikely occurrence.
|
||||
for (unsigned i = 0; i < info->numOutputs; ++i)
|
||||
info->out[i].oread = 1;
|
||||
} else {
|
||||
info->out[src.getIndex(0)].oread = 1;
|
||||
}
|
||||
}
|
||||
if (src.getFile() != TGSI_FILE_INPUT)
|
||||
return;
|
||||
|
||||
if (src.isIndirect(0)) {
|
||||
for (unsigned i = 0; i < info->numInputs; ++i)
|
||||
info->in[i].mask = 0xf;
|
||||
} else {
|
||||
const int i = src.getIndex(0);
|
||||
for (unsigned c = 0; c < 4; ++c) {
|
||||
if (!(mask & (1 << c)))
|
||||
continue;
|
||||
int k = src.getSwizzle(c);
|
||||
if (k <= TGSI_SWIZZLE_W)
|
||||
info->in[i].mask |= 1 << k;
|
||||
}
|
||||
switch (info->in[i].sn) {
|
||||
case TGSI_SEMANTIC_PSIZE:
|
||||
case TGSI_SEMANTIC_PRIMID:
|
||||
case TGSI_SEMANTIC_FOG:
|
||||
info->in[i].mask &= 0x1;
|
||||
break;
|
||||
case TGSI_SEMANTIC_PCOORD:
|
||||
info->in[i].mask &= 0x3;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool Source::scanInstruction(const struct tgsi_full_instruction *inst)
|
||||
{
|
||||
Instruction insn(inst);
|
||||
@@ -1396,66 +1484,19 @@ bool Source::scanInstruction(const struct tgsi_full_instruction *inst)
|
||||
indirectTempArrays.insert(dst.getArrayId());
|
||||
} else
|
||||
if (dst.getFile() == TGSI_FILE_BUFFER ||
|
||||
dst.getFile() == TGSI_FILE_IMAGE ||
|
||||
dst.getFile() == TGSI_FILE_IMAGE ||
|
||||
(dst.getFile() == TGSI_FILE_MEMORY &&
|
||||
memoryFiles[dst.getIndex(0)].mem_type == TGSI_MEMORY_TYPE_GLOBAL)) {
|
||||
info->io.globalAccess |= 0x2;
|
||||
}
|
||||
}
|
||||
|
||||
for (unsigned s = 0; s < insn.srcCount(); ++s) {
|
||||
Instruction::SrcRegister src = insn.getSrc(s);
|
||||
if (src.getFile() == TGSI_FILE_TEMPORARY) {
|
||||
if (src.isIndirect(0))
|
||||
indirectTempArrays.insert(src.getArrayId());
|
||||
} else
|
||||
if (src.getFile() == TGSI_FILE_BUFFER ||
|
||||
src.getFile() == TGSI_FILE_IMAGE ||
|
||||
(src.getFile() == TGSI_FILE_MEMORY &&
|
||||
memoryFiles[src.getIndex(0)].mem_type == TGSI_MEMORY_TYPE_GLOBAL)) {
|
||||
info->io.globalAccess |= (insn.getOpcode() == TGSI_OPCODE_LOAD) ?
|
||||
0x1 : 0x2;
|
||||
} else
|
||||
if (src.getFile() == TGSI_FILE_OUTPUT) {
|
||||
if (src.isIndirect(0)) {
|
||||
// We don't know which one is accessed, just mark everything for
|
||||
// reading. This is an extremely unlikely occurrence.
|
||||
for (unsigned i = 0; i < info->numOutputs; ++i)
|
||||
info->out[i].oread = 1;
|
||||
} else {
|
||||
info->out[src.getIndex(0)].oread = 1;
|
||||
}
|
||||
}
|
||||
if (src.getFile() != TGSI_FILE_INPUT)
|
||||
continue;
|
||||
unsigned mask = insn.srcMask(s);
|
||||
for (unsigned s = 0; s < insn.srcCount(); ++s)
|
||||
scanInstructionSrc(insn, insn.getSrc(s), insn.srcMask(s));
|
||||
|
||||
for (unsigned s = 0; s < insn.getNumTexOffsets(); ++s)
|
||||
scanInstructionSrc(insn, insn.getTexOffset(s), insn.texOffsetMask());
|
||||
|
||||
if (src.isIndirect(0)) {
|
||||
for (unsigned i = 0; i < info->numInputs; ++i)
|
||||
info->in[i].mask = 0xf;
|
||||
} else {
|
||||
const int i = src.getIndex(0);
|
||||
for (unsigned c = 0; c < 4; ++c) {
|
||||
if (!(mask & (1 << c)))
|
||||
continue;
|
||||
int k = src.getSwizzle(c);
|
||||
if (k <= TGSI_SWIZZLE_W)
|
||||
info->in[i].mask |= 1 << k;
|
||||
}
|
||||
switch (info->in[i].sn) {
|
||||
case TGSI_SEMANTIC_PSIZE:
|
||||
case TGSI_SEMANTIC_PRIMID:
|
||||
case TGSI_SEMANTIC_FOG:
|
||||
info->in[i].mask &= 0x1;
|
||||
break;
|
||||
case TGSI_SEMANTIC_PCOORD:
|
||||
info->in[i].mask &= 0x3;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@@ -307,6 +307,9 @@ nv50_program_create_strmout_state(const struct nv50_ir_prog_info *info,
|
||||
const unsigned r = pso->output[i].register_index;
|
||||
b = pso->output[i].output_buffer;
|
||||
|
||||
if (r >= info->numOutputs)
|
||||
continue;
|
||||
|
||||
for (c = 0; c < pso->output[i].num_components; ++c)
|
||||
so->map[base[b] + p + c] = info->out[r].slot[s + c];
|
||||
}
|
||||
|
@@ -509,11 +509,14 @@ nvc0_program_create_tfb_state(const struct nv50_ir_prog_info *info,
|
||||
for (i = 0; i < pso->num_outputs; ++i) {
|
||||
unsigned s = pso->output[i].start_component;
|
||||
unsigned p = pso->output[i].dst_offset;
|
||||
const unsigned r = pso->output[i].register_index;
|
||||
b = pso->output[i].output_buffer;
|
||||
|
||||
if (r >= info->numOutputs)
|
||||
continue;
|
||||
|
||||
for (c = 0; c < pso->output[i].num_components; ++c)
|
||||
tfb->varying_index[b][p++] =
|
||||
info->out[pso->output[i].register_index].slot[s + c];
|
||||
tfb->varying_index[b][p++] = info->out[r].slot[s + c];
|
||||
|
||||
tfb->varying_count[b] = MAX2(tfb->varying_count[b], p);
|
||||
tfb->stream[b] = pso->output[i].stream;
|
||||
|
@@ -1002,49 +1002,6 @@ nvc0_screen_create(struct nouveau_device *dev)
|
||||
|
||||
PUSH_REFN (push, screen->uniform_bo, NV_VRAM_DOMAIN(&screen->base) | NOUVEAU_BO_WR);
|
||||
|
||||
for (i = 0; i < 5; ++i) {
|
||||
/* TIC and TSC entries for each unit (nve4+ only) */
|
||||
/* auxiliary constants (6 user clip planes, base instance id) */
|
||||
BEGIN_NVC0(push, NVC0_3D(CB_SIZE), 3);
|
||||
PUSH_DATA (push, NVC0_CB_AUX_SIZE);
|
||||
PUSH_DATAh(push, screen->uniform_bo->offset + NVC0_CB_AUX_INFO(i));
|
||||
PUSH_DATA (push, screen->uniform_bo->offset + NVC0_CB_AUX_INFO(i));
|
||||
BEGIN_NVC0(push, NVC0_3D(CB_BIND(i)), 1);
|
||||
PUSH_DATA (push, (15 << 4) | 1);
|
||||
if (screen->eng3d->oclass >= NVE4_3D_CLASS) {
|
||||
unsigned j;
|
||||
BEGIN_1IC0(push, NVC0_3D(CB_POS), 9);
|
||||
PUSH_DATA (push, NVC0_CB_AUX_UNK_INFO);
|
||||
for (j = 0; j < 8; ++j)
|
||||
PUSH_DATA(push, j);
|
||||
} else {
|
||||
BEGIN_NVC0(push, NVC0_3D(TEX_LIMITS(i)), 1);
|
||||
PUSH_DATA (push, 0x54);
|
||||
}
|
||||
|
||||
/* MS sample coordinate offsets: these do not work with _ALT modes ! */
|
||||
BEGIN_1IC0(push, NVC0_3D(CB_POS), 1 + 2 * 8);
|
||||
PUSH_DATA (push, NVC0_CB_AUX_MS_INFO);
|
||||
PUSH_DATA (push, 0); /* 0 */
|
||||
PUSH_DATA (push, 0);
|
||||
PUSH_DATA (push, 1); /* 1 */
|
||||
PUSH_DATA (push, 0);
|
||||
PUSH_DATA (push, 0); /* 2 */
|
||||
PUSH_DATA (push, 1);
|
||||
PUSH_DATA (push, 1); /* 3 */
|
||||
PUSH_DATA (push, 1);
|
||||
PUSH_DATA (push, 2); /* 4 */
|
||||
PUSH_DATA (push, 0);
|
||||
PUSH_DATA (push, 3); /* 5 */
|
||||
PUSH_DATA (push, 0);
|
||||
PUSH_DATA (push, 2); /* 6 */
|
||||
PUSH_DATA (push, 1);
|
||||
PUSH_DATA (push, 3); /* 7 */
|
||||
PUSH_DATA (push, 1);
|
||||
}
|
||||
BEGIN_NVC0(push, NVC0_3D(LINKED_TSC), 1);
|
||||
PUSH_DATA (push, 0);
|
||||
|
||||
/* return { 0.0, 0.0, 0.0, 0.0 } for out-of-bounds vtxbuf access */
|
||||
BEGIN_NVC0(push, NVC0_3D(CB_SIZE), 3);
|
||||
PUSH_DATA (push, 256);
|
||||
@@ -1214,6 +1171,50 @@ nvc0_screen_create(struct nouveau_device *dev)
|
||||
if (nvc0_screen_init_compute(screen))
|
||||
goto fail;
|
||||
|
||||
/* XXX: Compute and 3D are somehow aliased on Fermi. */
|
||||
for (i = 0; i < 5; ++i) {
|
||||
/* TIC and TSC entries for each unit (nve4+ only) */
|
||||
/* auxiliary constants (6 user clip planes, base instance id) */
|
||||
BEGIN_NVC0(push, NVC0_3D(CB_SIZE), 3);
|
||||
PUSH_DATA (push, NVC0_CB_AUX_SIZE);
|
||||
PUSH_DATAh(push, screen->uniform_bo->offset + NVC0_CB_AUX_INFO(i));
|
||||
PUSH_DATA (push, screen->uniform_bo->offset + NVC0_CB_AUX_INFO(i));
|
||||
BEGIN_NVC0(push, NVC0_3D(CB_BIND(i)), 1);
|
||||
PUSH_DATA (push, (15 << 4) | 1);
|
||||
if (screen->eng3d->oclass >= NVE4_3D_CLASS) {
|
||||
unsigned j;
|
||||
BEGIN_1IC0(push, NVC0_3D(CB_POS), 9);
|
||||
PUSH_DATA (push, NVC0_CB_AUX_UNK_INFO);
|
||||
for (j = 0; j < 8; ++j)
|
||||
PUSH_DATA(push, j);
|
||||
} else {
|
||||
BEGIN_NVC0(push, NVC0_3D(TEX_LIMITS(i)), 1);
|
||||
PUSH_DATA (push, 0x54);
|
||||
}
|
||||
|
||||
/* MS sample coordinate offsets: these do not work with _ALT modes ! */
|
||||
BEGIN_1IC0(push, NVC0_3D(CB_POS), 1 + 2 * 8);
|
||||
PUSH_DATA (push, NVC0_CB_AUX_MS_INFO);
|
||||
PUSH_DATA (push, 0); /* 0 */
|
||||
PUSH_DATA (push, 0);
|
||||
PUSH_DATA (push, 1); /* 1 */
|
||||
PUSH_DATA (push, 0);
|
||||
PUSH_DATA (push, 0); /* 2 */
|
||||
PUSH_DATA (push, 1);
|
||||
PUSH_DATA (push, 1); /* 3 */
|
||||
PUSH_DATA (push, 1);
|
||||
PUSH_DATA (push, 2); /* 4 */
|
||||
PUSH_DATA (push, 0);
|
||||
PUSH_DATA (push, 3); /* 5 */
|
||||
PUSH_DATA (push, 0);
|
||||
PUSH_DATA (push, 2); /* 6 */
|
||||
PUSH_DATA (push, 1);
|
||||
PUSH_DATA (push, 3); /* 7 */
|
||||
PUSH_DATA (push, 1);
|
||||
}
|
||||
BEGIN_NVC0(push, NVC0_3D(LINKED_TSC), 1);
|
||||
PUSH_DATA (push, 0);
|
||||
|
||||
PUSH_KICK (push);
|
||||
|
||||
screen->tic.entries = CALLOC(4096, sizeof(void *));
|
||||
|
@@ -607,7 +607,7 @@ void nvc0_validate_textures(struct nvc0_context *nvc0)
|
||||
|
||||
/* Invalidate all CP textures because they are aliased. */
|
||||
for (int i = 0; i < nvc0->num_textures[5]; i++)
|
||||
nouveau_bufctx_reset(nvc0->bufctx_3d, NVC0_BIND_CP_TEX(i));
|
||||
nouveau_bufctx_reset(nvc0->bufctx_cp, NVC0_BIND_CP_TEX(i));
|
||||
nvc0->textures_dirty[5] = ~0;
|
||||
nvc0->dirty_cp |= NVC0_NEW_CP_TEXTURES;
|
||||
}
|
||||
|
@@ -826,8 +826,9 @@ static void r600_texture_alloc_cmask_separate(struct r600_common_screen *rscreen
|
||||
}
|
||||
|
||||
rtex->cmask_buffer = (struct r600_resource *)
|
||||
pipe_buffer_create(&rscreen->b, PIPE_BIND_CUSTOM,
|
||||
PIPE_USAGE_DEFAULT, rtex->cmask.size);
|
||||
r600_aligned_buffer_create(&rscreen->b, 0, PIPE_USAGE_DEFAULT,
|
||||
rtex->cmask.size,
|
||||
rtex->cmask.alignment);
|
||||
if (rtex->cmask_buffer == NULL) {
|
||||
rtex->cmask.size = 0;
|
||||
return;
|
||||
@@ -2442,29 +2443,29 @@ static void si_set_optimal_micro_tile_mode(struct r600_common_screen *rscreen,
|
||||
switch (rtex->last_msaa_resolve_target_micro_mode) {
|
||||
case 0: /* displayable */
|
||||
switch (rtex->surface.bpe) {
|
||||
case 8:
|
||||
case 1:
|
||||
rtex->surface.tiling_index[0] = 10;
|
||||
break;
|
||||
case 16:
|
||||
case 2:
|
||||
rtex->surface.tiling_index[0] = 11;
|
||||
break;
|
||||
default: /* 32, 64 */
|
||||
default: /* 4, 8 */
|
||||
rtex->surface.tiling_index[0] = 12;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 1: /* thin */
|
||||
switch (rtex->surface.bpe) {
|
||||
case 8:
|
||||
case 1:
|
||||
rtex->surface.tiling_index[0] = 14;
|
||||
break;
|
||||
case 16:
|
||||
case 2:
|
||||
rtex->surface.tiling_index[0] = 15;
|
||||
break;
|
||||
case 32:
|
||||
case 4:
|
||||
rtex->surface.tiling_index[0] = 16;
|
||||
break;
|
||||
default: /* 64, 128 */
|
||||
default: /* 8, 16 */
|
||||
rtex->surface.tiling_index[0] = 17;
|
||||
break;
|
||||
}
|
||||
|
@@ -911,7 +911,7 @@ static LLVMValueRef lds_load(struct lp_build_tgsi_context *bld_base,
|
||||
if (tgsi_type_is_64bit(type)) {
|
||||
LLVMValueRef value2;
|
||||
dw_addr = lp_build_add(&bld_base->uint_bld, dw_addr,
|
||||
lp_build_const_int32(gallivm, swizzle + 1));
|
||||
lp_build_const_int32(gallivm, 1));
|
||||
value2 = build_indexed_load(ctx, ctx->lds, dw_addr, false);
|
||||
return si_llvm_emit_fetch_64bit(bld_base, type, value, value2);
|
||||
}
|
||||
|
@@ -126,7 +126,6 @@ prepare_vs_constants_userbuf_swvp(struct NineDevice9 *device)
|
||||
cb.user_buffer = state->vs_const_i;
|
||||
|
||||
state->pipe.cb2_swvp = cb;
|
||||
state->changed.vs_const_i = 0;
|
||||
}
|
||||
|
||||
if (state->changed.vs_const_b || state->changed.group & NINE_STATE_SWVP) {
|
||||
@@ -138,7 +137,6 @@ prepare_vs_constants_userbuf_swvp(struct NineDevice9 *device)
|
||||
cb.user_buffer = state->vs_const_b;
|
||||
|
||||
state->pipe.cb3_swvp = cb;
|
||||
state->changed.vs_const_b = 0;
|
||||
}
|
||||
|
||||
if (!device->driver_caps.user_cbufs) {
|
||||
@@ -236,14 +234,30 @@ prepare_vs_constants_userbuf(struct NineDevice9 *device)
|
||||
if (state->changed.vs_const_i || state->changed.group & NINE_STATE_SWVP) {
|
||||
int *idst = (int *)&state->vs_const_f[4 * device->max_vs_const_f];
|
||||
memcpy(idst, state->vs_const_i, NINE_MAX_CONST_I * sizeof(int[4]));
|
||||
state->changed.vs_const_i = 0;
|
||||
}
|
||||
|
||||
if (state->changed.vs_const_b || state->changed.group & NINE_STATE_SWVP) {
|
||||
int *idst = (int *)&state->vs_const_f[4 * device->max_vs_const_f];
|
||||
uint32_t *bdst = (uint32_t *)&idst[4 * NINE_MAX_CONST_I];
|
||||
memcpy(bdst, state->vs_const_b, NINE_MAX_CONST_B * sizeof(BOOL));
|
||||
state->changed.vs_const_b = 0;
|
||||
}
|
||||
|
||||
if (device->state.changed.vs_const_i) {
|
||||
struct nine_range *r = device->state.changed.vs_const_i;
|
||||
struct nine_range *p = r;
|
||||
while (p->next)
|
||||
p = p->next;
|
||||
nine_range_pool_put_chain(&device->range_pool, r, p);
|
||||
device->state.changed.vs_const_i = NULL;
|
||||
}
|
||||
|
||||
if (device->state.changed.vs_const_b) {
|
||||
struct nine_range *r = device->state.changed.vs_const_b;
|
||||
struct nine_range *p = r;
|
||||
while (p->next)
|
||||
p = p->next;
|
||||
nine_range_pool_put_chain(&device->range_pool, r, p);
|
||||
device->state.changed.vs_const_b = NULL;
|
||||
}
|
||||
|
||||
if (!cb.buffer_size)
|
||||
@@ -290,23 +304,6 @@ prepare_vs_constants_userbuf(struct NineDevice9 *device)
|
||||
device->state.changed.vs_const_f = NULL;
|
||||
}
|
||||
|
||||
if (device->state.changed.vs_const_i) {
|
||||
struct nine_range *r = device->state.changed.vs_const_i;
|
||||
struct nine_range *p = r;
|
||||
while (p->next)
|
||||
p = p->next;
|
||||
nine_range_pool_put_chain(&device->range_pool, r, p);
|
||||
device->state.changed.vs_const_i = NULL;
|
||||
}
|
||||
|
||||
if (device->state.changed.vs_const_b) {
|
||||
struct nine_range *r = device->state.changed.vs_const_b;
|
||||
struct nine_range *p = r;
|
||||
while (p->next)
|
||||
p = p->next;
|
||||
nine_range_pool_put_chain(&device->range_pool, r, p);
|
||||
device->state.changed.vs_const_b = NULL;
|
||||
}
|
||||
state->changed.group &= ~NINE_STATE_VS_CONST;
|
||||
state->commit |= NINE_STATE_COMMIT_CONST_VS;
|
||||
}
|
||||
|
@@ -447,6 +447,7 @@ NineSurface9_LockRect( struct NineSurface9 *This,
|
||||
} else {
|
||||
u_box_origin_2d(This->desc.Width, This->desc.Height, &box);
|
||||
}
|
||||
box.z = This->layer;
|
||||
|
||||
user_warn(This->desc.Format == D3DFMT_NULL);
|
||||
|
||||
|
@@ -373,7 +373,7 @@ NineVolume9_UnlockBox( struct NineVolume9 *This )
|
||||
This->layer_stride_conversion,
|
||||
0, 0, 0,
|
||||
This->desc.Width, This->desc.Height,
|
||||
This->desc.Height);
|
||||
This->desc.Depth);
|
||||
|
||||
if (!This->data)
|
||||
pipe_transfer_unmap(This->pipe, transfer);
|
||||
|
@@ -303,6 +303,20 @@ static void set_micro_tile_mode(struct radeon_surf *surf,
|
||||
surf->micro_tile_mode = G_009910_MICRO_TILE_MODE(tile_mode);
|
||||
}
|
||||
|
||||
static unsigned cik_get_macro_tile_index(struct radeon_surf *surf)
|
||||
{
|
||||
unsigned index, tileb;
|
||||
|
||||
tileb = 8 * 8 * surf->bpe;
|
||||
tileb = MIN2(surf->tile_split, tileb);
|
||||
|
||||
for (index = 0; tileb > 64; index++)
|
||||
tileb >>= 1;
|
||||
|
||||
assert(index < 16);
|
||||
return index;
|
||||
}
|
||||
|
||||
static int amdgpu_surface_init(struct radeon_winsys *rws,
|
||||
struct radeon_surf *surf)
|
||||
{
|
||||
@@ -475,6 +489,9 @@ static int amdgpu_surface_init(struct radeon_winsys *rws,
|
||||
AddrSurfInfoIn.tileIndex = 10; /* 2D displayable */
|
||||
else
|
||||
AddrSurfInfoIn.tileIndex = 14; /* 2D non-displayable */
|
||||
|
||||
/* Addrlib doesn't set this if tileIndex is forced like above. */
|
||||
AddrSurfInfoOut.macroModeIndex = cik_get_macro_tile_index(surf);
|
||||
}
|
||||
}
|
||||
|
||||
|
2
src/intel/vulkan/.gitignore
vendored
2
src/intel/vulkan/.gitignore
vendored
@@ -3,4 +3,4 @@
|
||||
/anv_entrypoints.h
|
||||
/anv_timestamp.h
|
||||
/dev_icd.json
|
||||
/intel_icd.json
|
||||
/intel_icd.*.json
|
||||
|
@@ -147,13 +147,12 @@ anv_timestamp.h:
|
||||
$(AM_V_GEN) echo "#define ANV_TIMESTAMP \"$(TIMESTAMP_CMD)\"" > $@
|
||||
|
||||
BUILT_SOURCES = $(VULKAN_GENERATED_FILES)
|
||||
CLEANFILES = $(BUILT_SOURCES) dev_icd.json intel_icd.json
|
||||
CLEANFILES = $(BUILT_SOURCES) dev_icd.json intel_icd.@host_cpu@.json
|
||||
EXTRA_DIST = \
|
||||
$(top_srcdir)/include/vulkan/vk_icd.h \
|
||||
anv_entrypoints_gen.py \
|
||||
dev_icd.json.in \
|
||||
intel_icd.json.in \
|
||||
intel_icd.json
|
||||
intel_icd.json.in
|
||||
|
||||
libvulkan_intel_la_LIBADD = $(VULKAN_LIB_DEPS)
|
||||
|
||||
@@ -168,7 +167,7 @@ libvulkan_intel_la_LDFLAGS = \
|
||||
|
||||
|
||||
icdconfdir = @VULKAN_ICD_INSTALL_DIR@
|
||||
icdconf_DATA = intel_icd.json
|
||||
icdconf_DATA = intel_icd.@host_cpu@.json
|
||||
# The following is used for development purposes, by setting VK_ICD_FILENAMES.
|
||||
noinst_DATA = dev_icd.json
|
||||
|
||||
@@ -177,15 +176,9 @@ dev_icd.json : dev_icd.json.in
|
||||
-e "s#@build_libdir@#${abs_top_builddir}/${LIB_DIR}#" \
|
||||
< $(srcdir)/dev_icd.json.in > $@
|
||||
|
||||
if VULKAN_ICD_DRIVER_PATH
|
||||
ICD_DRIVER_PATH="${libdir}/libvulkan_intel.so"
|
||||
else
|
||||
ICD_DRIVER_PATH="libvulkan_intel.so"
|
||||
endif
|
||||
|
||||
intel_icd.json : intel_icd.json.in
|
||||
intel_icd.@host_cpu@.json : intel_icd.json.in
|
||||
$(AM_V_GEN) $(SED) \
|
||||
-e "s#@ICD_DRIVER_PATH@#${ICD_DRIVER_PATH}#" \
|
||||
-e "s#@install_libdir@#${libdir}#" \
|
||||
< $(srcdir)/intel_icd.json.in > $@
|
||||
|
||||
# Libvulkan with dummy gem. Used for unit tests.
|
||||
|
@@ -2,6 +2,6 @@
|
||||
"file_format_version": "1.0.0",
|
||||
"ICD": {
|
||||
"library_path": "@build_libdir@/libvulkan_intel.so",
|
||||
"abi_versions": "1.0.3"
|
||||
"api_version": "1.0.3"
|
||||
}
|
||||
}
|
||||
|
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"file_format_version": "1.0.0",
|
||||
"ICD": {
|
||||
"library_path": "@ICD_DRIVER_PATH@",
|
||||
"abi_versions": "1.0.3"
|
||||
"library_path": "@install_libdir@/libvulkan_intel.so",
|
||||
"api_version": "1.0.3"
|
||||
}
|
||||
}
|
||||
|
@@ -64,6 +64,9 @@ BUILT_SOURCES += shared-glapi/glapi_mapi_tmp.h
|
||||
|
||||
lib_LTLIBRARIES += shared-glapi/libglapi.la
|
||||
shared_glapi_libglapi_la_SOURCES = $(MAPI_GLAPI_FILES) shared-glapi/glapi_mapi_tmp.h
|
||||
shared_glapi_libglapi_la_CFLAGS = \
|
||||
$(AM_CFLAGS) \
|
||||
$(VISIBILITY_CFLAGS)
|
||||
shared_glapi_libglapi_la_CPPFLAGS = \
|
||||
$(AM_CPPFLAGS) \
|
||||
-DMAPI_MODE_GLAPI \
|
||||
|
@@ -8296,6 +8296,23 @@
|
||||
<!-- ARB extension 171 -->
|
||||
<xi:include href="ARB_pipeline_statistics_query.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
|
||||
|
||||
<category name="es3.2">
|
||||
<!-- This should be in es_EXT, but this file is included first and
|
||||
the alias doesn't work otherwise. -->
|
||||
<function name="PrimitiveBoundingBox" es2="3.2" desktop="false">
|
||||
<param name="minX" type="GLfloat"/>
|
||||
<param name="minY" type="GLfloat"/>
|
||||
<param name="minZ" type="GLfloat"/>
|
||||
<param name="minW" type="GLfloat"/>
|
||||
<param name="maxX" type="GLfloat"/>
|
||||
<param name="maxY" type="GLfloat"/>
|
||||
<param name="maxZ" type="GLfloat"/>
|
||||
<param name="maxW" type="GLfloat"/>
|
||||
</function>
|
||||
|
||||
<function name="BlendBarrier" es2="3.2"/>
|
||||
</category>
|
||||
|
||||
<category name="KHR_blend_equation_advanced" number="174">
|
||||
<enum name="BLEND_ADVANCED_COHERENT_KHR" value="0x9285"/>
|
||||
|
||||
@@ -8316,7 +8333,6 @@
|
||||
<enum name="HSL_COLOR_KHR" value="0x92AF"/>
|
||||
<enum name="HSL_LUMINOSITY_KHR" value="0x92B0"/>
|
||||
|
||||
<function name="BlendBarrier" es2="3.2"/>
|
||||
<function name="BlendBarrierKHR" alias="BlendBarrier" es2="2.0"/>
|
||||
</category>
|
||||
|
||||
@@ -8332,18 +8348,6 @@
|
||||
<size name="Get" mode="get"/>
|
||||
</enum>
|
||||
|
||||
<!-- This should be in es_EXT, but this file is included first and
|
||||
the alias doesn't work otherwise. -->
|
||||
<function name="PrimitiveBoundingBox" es2="3.2" desktop="false">
|
||||
<param name="minX" type="GLfloat"/>
|
||||
<param name="minY" type="GLfloat"/>
|
||||
<param name="minZ" type="GLfloat"/>
|
||||
<param name="minW" type="GLfloat"/>
|
||||
<param name="maxX" type="GLfloat"/>
|
||||
<param name="maxY" type="GLfloat"/>
|
||||
<param name="maxZ" type="GLfloat"/>
|
||||
<param name="maxW" type="GLfloat"/>
|
||||
</function>
|
||||
<function name="PrimitiveBoundingBoxARB" alias="PrimitiveBoundingBox">
|
||||
<param name="minX" type="GLfloat"/>
|
||||
<param name="minY" type="GLfloat"/>
|
||||
|
@@ -484,17 +484,22 @@ functions = [
|
||||
"BindVertexBuffer",
|
||||
"BindVertexBuffers",
|
||||
"Bitmap",
|
||||
"BlendBarrier",
|
||||
"BlendColor",
|
||||
"BlendColorEXT",
|
||||
"BlendEquation",
|
||||
"BlendEquationEXT",
|
||||
"BlendEquationi",
|
||||
"BlendEquationiARB",
|
||||
"BlendEquationSeparate",
|
||||
"BlendEquationSeparatei",
|
||||
"BlendEquationSeparateiARB",
|
||||
"BlendFunc",
|
||||
"BlendFunci",
|
||||
"BlendFunciARB",
|
||||
"BlendFuncSeparate",
|
||||
"BlendFuncSeparateEXT",
|
||||
"BlendFuncSeparatei",
|
||||
"BlendFuncSeparateiARB",
|
||||
"BlitFramebuffer",
|
||||
"BufferData",
|
||||
@@ -825,6 +830,7 @@ functions = [
|
||||
"GetFramebufferAttachmentParameteriv",
|
||||
"GetFramebufferAttachmentParameterivEXT",
|
||||
"GetFramebufferParameteriv",
|
||||
"GetGraphicsResetStatus",
|
||||
"GetGraphicsResetStatusARB",
|
||||
"GetHandleARB",
|
||||
"GetHistogram",
|
||||
@@ -864,8 +870,11 @@ functions = [
|
||||
"GetnSeparableFilterARB",
|
||||
"GetnTexImageARB",
|
||||
"GetnUniformdvARB",
|
||||
"GetnUniformfv",
|
||||
"GetnUniformfvARB",
|
||||
"GetnUniformiv",
|
||||
"GetnUniformivARB",
|
||||
"GetnUniformuiv",
|
||||
"GetnUniformuivARB",
|
||||
"GetObjectLabel",
|
||||
"GetObjectParameterfvARB",
|
||||
@@ -1160,6 +1169,7 @@ functions = [
|
||||
"Orthof",
|
||||
"Orthox",
|
||||
"PassThrough",
|
||||
"PatchParameteri",
|
||||
"PauseTransformFeedback",
|
||||
"PixelMapfv",
|
||||
"PixelMapuiv",
|
||||
@@ -1191,6 +1201,7 @@ functions = [
|
||||
"PopDebugGroup",
|
||||
"PopMatrix",
|
||||
"PopName",
|
||||
"PrimitiveBoundingBox",
|
||||
"PrimitiveRestartIndex",
|
||||
"PrimitiveRestartIndexNV",
|
||||
"PrimitiveRestartNV",
|
||||
@@ -1273,6 +1284,7 @@ functions = [
|
||||
"RasterPos4s",
|
||||
"RasterPos4sv",
|
||||
"ReadBuffer",
|
||||
"ReadnPixels",
|
||||
"ReadnPixelsARB",
|
||||
"ReadPixels",
|
||||
"Rectd",
|
||||
|
@@ -492,19 +492,6 @@ type_size_scalar(const struct glsl_type *type)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of scalar components needed to store type, assuming
|
||||
* that vectors are padded out to vec4.
|
||||
*
|
||||
* This has the packing rules of type_size_vec4(), but counts components
|
||||
* similar to type_size_scalar().
|
||||
*/
|
||||
extern "C" int
|
||||
type_size_vec4_times_4(const struct glsl_type *type)
|
||||
{
|
||||
return 4 * type_size_vec4(type);
|
||||
}
|
||||
|
||||
/* Attribute arrays are loaded as one vec4 per element (or matrix column),
|
||||
* except for double-precision types, which are loaded as one dvec4.
|
||||
*/
|
||||
@@ -1687,6 +1674,12 @@ fs_visitor::assign_gs_urb_setup()
|
||||
void
|
||||
fs_visitor::split_virtual_grfs()
|
||||
{
|
||||
/* Compact the register file so we eliminate dead vgrfs. This
|
||||
* only defines split points for live registers, so if we have
|
||||
* too large dead registers they will hit assertions later.
|
||||
*/
|
||||
compact_virtual_grfs();
|
||||
|
||||
int num_vars = this->alloc.count;
|
||||
|
||||
/* Count the total number of registers */
|
||||
|
@@ -324,8 +324,6 @@ public:
|
||||
|
||||
fs_reg *nir_locals;
|
||||
fs_reg *nir_ssa_values;
|
||||
fs_reg nir_inputs;
|
||||
fs_reg nir_outputs;
|
||||
fs_reg *nir_system_values;
|
||||
|
||||
bool failed;
|
||||
|
@@ -48,56 +48,18 @@ fs_visitor::emit_nir_code()
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
fs_visitor::nir_setup_single_output_varying(fs_reg *reg,
|
||||
const glsl_type *type,
|
||||
unsigned *location)
|
||||
{
|
||||
if (type->is_array() || type->is_matrix()) {
|
||||
const struct glsl_type *elem_type = glsl_get_array_element(type);
|
||||
const unsigned length = glsl_get_length(type);
|
||||
|
||||
for (unsigned i = 0; i < length; i++) {
|
||||
nir_setup_single_output_varying(reg, elem_type, location);
|
||||
}
|
||||
} else if (type->is_record()) {
|
||||
for (unsigned i = 0; i < type->length; i++) {
|
||||
const struct glsl_type *field_type = type->fields.structure[i].type;
|
||||
nir_setup_single_output_varying(reg, field_type, location);
|
||||
}
|
||||
} else {
|
||||
assert(type->is_scalar() || type->is_vector());
|
||||
unsigned num_iter = 1;
|
||||
if (type->is_dual_slot())
|
||||
num_iter = 2;
|
||||
for (unsigned count = 0; count < num_iter; count++) {
|
||||
this->outputs[*location] = *reg;
|
||||
*reg = offset(*reg, bld, 4);
|
||||
(*location)++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
fs_visitor::nir_setup_outputs()
|
||||
{
|
||||
if (stage == MESA_SHADER_TESS_CTRL || stage == MESA_SHADER_FRAGMENT)
|
||||
return;
|
||||
|
||||
nir_outputs = bld.vgrf(BRW_REGISTER_TYPE_F, nir->num_outputs);
|
||||
|
||||
nir_foreach_variable(var, &nir->outputs) {
|
||||
switch (stage) {
|
||||
case MESA_SHADER_VERTEX:
|
||||
case MESA_SHADER_TESS_EVAL:
|
||||
case MESA_SHADER_GEOMETRY: {
|
||||
fs_reg reg = offset(nir_outputs, bld, var->data.driver_location);
|
||||
unsigned location = var->data.location;
|
||||
nir_setup_single_output_varying(®, var->type, &location);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
unreachable("unhandled shader stage");
|
||||
const unsigned vec4s = type_size_vec4(var->type);
|
||||
fs_reg reg = bld.vgrf(BRW_REGISTER_TYPE_F, 4 * vec4s);
|
||||
for (unsigned i = 0; i < vec4s; i++) {
|
||||
if (outputs[var->data.driver_location + i].file == BAD_FILE)
|
||||
outputs[var->data.driver_location + i] = offset(reg, bld, 4 * i);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4251,12 +4213,11 @@ fs_visitor::nir_emit_intrinsic(const fs_builder &bld, nir_intrinsic_instr *instr
|
||||
|
||||
case nir_intrinsic_store_output: {
|
||||
fs_reg src = get_nir_src(instr->src[0]);
|
||||
fs_reg new_dest = offset(retype(nir_outputs, src.type), bld,
|
||||
instr->const_index[0]);
|
||||
|
||||
nir_const_value *const_offset = nir_src_as_const_value(instr->src[1]);
|
||||
assert(const_offset && "Indirect output stores not allowed");
|
||||
new_dest = offset(new_dest, bld, const_offset->u32[0]);
|
||||
fs_reg new_dest = retype(offset(outputs[instr->const_index[0]], bld,
|
||||
4 * const_offset->u32[0]), src.type);
|
||||
|
||||
unsigned num_components = instr->num_components;
|
||||
unsigned first_component = nir_intrinsic_component(instr);
|
||||
|
@@ -327,16 +327,11 @@ void
|
||||
brw_nir_lower_vue_outputs(nir_shader *nir,
|
||||
bool is_scalar)
|
||||
{
|
||||
if (is_scalar) {
|
||||
nir_assign_var_locations(&nir->outputs, &nir->num_outputs,
|
||||
VARYING_SLOT_VAR0,
|
||||
type_size_vec4_times_4);
|
||||
nir_lower_io(nir, nir_var_shader_out, type_size_vec4_times_4, 0);
|
||||
} else {
|
||||
nir_foreach_variable(var, &nir->outputs)
|
||||
var->data.driver_location = var->data.location;
|
||||
nir_lower_io(nir, nir_var_shader_out, type_size_vec4, 0);
|
||||
nir_foreach_variable(var, &nir->outputs) {
|
||||
var->data.driver_location = var->data.location;
|
||||
}
|
||||
|
||||
nir_lower_io(nir, nir_var_shader_out, type_size_vec4, 0);
|
||||
}
|
||||
|
||||
void
|
||||
|
@@ -34,7 +34,6 @@ extern "C" {
|
||||
int type_size_scalar(const struct glsl_type *type);
|
||||
int type_size_vec4(const struct glsl_type *type);
|
||||
int type_size_dvec4(const struct glsl_type *type);
|
||||
int type_size_vec4_times_4(const struct glsl_type *type);
|
||||
int type_size_vs_input(const struct glsl_type *type);
|
||||
|
||||
static inline int
|
||||
|
@@ -389,17 +389,48 @@ draw_buffers(struct gl_context *ctx, struct gl_framebuffer *fb,
|
||||
|
||||
/* complicated error checking... */
|
||||
for (output = 0; output < n; output++) {
|
||||
/* Section 4.2 (Whole Framebuffer Operations) of the OpenGL 3.0
|
||||
destMask[output] = draw_buffer_enum_to_bitmask(ctx, buffers[output]);
|
||||
|
||||
/* From the OpenGL 3.0 specification, page 258:
|
||||
* "Each buffer listed in bufs must be one of the values from tables
|
||||
* 4.5 or 4.6. Otherwise, an INVALID_ENUM error is generated.
|
||||
*/
|
||||
if (destMask[output] == BAD_MASK) {
|
||||
_mesa_error(ctx, GL_INVALID_ENUM, "%s(invalid buffer %s)",
|
||||
caller, _mesa_enum_to_string(buffers[output]));
|
||||
return;
|
||||
}
|
||||
|
||||
/* From the OpenGL 4.0 specification, page 256:
|
||||
* "For both the default framebuffer and framebuffer objects, the
|
||||
* constants FRONT, BACK, LEFT, RIGHT, and FRONT_AND_BACK are not
|
||||
* valid in the bufs array passed to DrawBuffers, and will result in
|
||||
* the error INVALID_ENUM. This restriction is because these
|
||||
* constants may themselves refer to multiple buffers, as shown in
|
||||
* table 4.4."
|
||||
* Previous versions of the OpenGL specification say INVALID_OPERATION,
|
||||
* but the Khronos conformance tests expect INVALID_ENUM.
|
||||
*/
|
||||
if (_mesa_bitcount(destMask[output]) > 1) {
|
||||
_mesa_error(ctx, GL_INVALID_ENUM, "%s(invalid buffer %s)",
|
||||
caller, _mesa_enum_to_string(buffers[output]));
|
||||
return;
|
||||
}
|
||||
|
||||
/* Section 4.2 (Whole Framebuffer Operations) of the OpenGL ES 3.0
|
||||
* specification says:
|
||||
*
|
||||
* "Each buffer listed in bufs must be BACK, NONE, or one of the values
|
||||
* from table 4.3 (NONE, COLOR_ATTACHMENTi)"
|
||||
* "If the GL is bound to a draw framebuffer object, the ith buffer
|
||||
* listed in bufs must be COLOR_ATTACHMENTi or NONE . Specifying a
|
||||
* buffer out of order, BACK , or COLOR_ATTACHMENTm where m is greater
|
||||
* than or equal to the value of MAX_- COLOR_ATTACHMENTS , will
|
||||
* generate the error INVALID_OPERATION .
|
||||
*/
|
||||
if (_mesa_is_gles3(ctx) && buffers[output] != GL_NONE &&
|
||||
buffers[output] != GL_BACK &&
|
||||
if (_mesa_is_gles3(ctx) && _mesa_is_user_fbo(fb) &&
|
||||
buffers[output] != GL_NONE &&
|
||||
(buffers[output] < GL_COLOR_ATTACHMENT0 ||
|
||||
buffers[output] >= GL_COLOR_ATTACHMENT0 + ctx->Const.MaxColorAttachments)) {
|
||||
_mesa_error(ctx, GL_INVALID_ENUM, "glDrawBuffers(buffer)");
|
||||
_mesa_error(ctx, GL_INVALID_OPERATION, "glDrawBuffers(buffer)");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -423,34 +454,6 @@ draw_buffers(struct gl_context *ctx, struct gl_framebuffer *fb,
|
||||
return;
|
||||
}
|
||||
|
||||
destMask[output] = draw_buffer_enum_to_bitmask(ctx, buffers[output]);
|
||||
|
||||
/* From the OpenGL 3.0 specification, page 258:
|
||||
* "Each buffer listed in bufs must be one of the values from tables
|
||||
* 4.5 or 4.6. Otherwise, an INVALID_ENUM error is generated.
|
||||
*/
|
||||
if (destMask[output] == BAD_MASK) {
|
||||
_mesa_error(ctx, GL_INVALID_ENUM, "%s(invalid buffer %s)",
|
||||
caller, _mesa_enum_to_string(buffers[output]));
|
||||
return;
|
||||
}
|
||||
|
||||
/* From the OpenGL 4.0 specification, page 256:
|
||||
* "For both the default framebuffer and framebuffer objects, the
|
||||
* constants FRONT, BACK, LEFT, RIGHT, and FRONT_AND_BACK are not
|
||||
* valid in the bufs array passed to DrawBuffers, and will result in
|
||||
* the error INVALID_ENUM. This restriction is because these
|
||||
* constants may themselves refer to multiple buffers, as shown in
|
||||
* table 4.4."
|
||||
* Previous versions of the OpenGL specification say INVALID_OPERATION,
|
||||
* but the Khronos conformance tests expect INVALID_ENUM.
|
||||
*/
|
||||
if (_mesa_bitcount(destMask[output]) > 1) {
|
||||
_mesa_error(ctx, GL_INVALID_ENUM, "%s(invalid buffer %s)",
|
||||
caller, _mesa_enum_to_string(buffers[output]));
|
||||
return;
|
||||
}
|
||||
|
||||
/* From the OpenGL 3.0 specification, page 259:
|
||||
* "If the GL is bound to the default framebuffer and DrawBuffers is
|
||||
* supplied with a constant (other than NONE) that does not indicate
|
||||
|
@@ -123,7 +123,7 @@ handle_ident(struct asm_parser_state *state, const char *text, YYSTYPE *lval)
|
||||
{
|
||||
lval->string = strdup(text);
|
||||
|
||||
return (_mesa_symbol_table_find_symbol(state->st, 0, text) == NULL)
|
||||
return (_mesa_symbol_table_find_symbol(state->st, text) == NULL)
|
||||
? IDENTIFIER : USED_IDENTIFIER;
|
||||
}
|
||||
|
||||
|
@@ -724,7 +724,7 @@ extSwizSel: INTEGER
|
||||
srcReg: USED_IDENTIFIER /* temporaryReg | progParamSingle */
|
||||
{
|
||||
struct asm_symbol *const s = (struct asm_symbol *)
|
||||
_mesa_symbol_table_find_symbol(state->st, 0, $1);
|
||||
_mesa_symbol_table_find_symbol(state->st, $1);
|
||||
|
||||
free($1);
|
||||
|
||||
@@ -812,7 +812,7 @@ dstReg: resultBinding
|
||||
| USED_IDENTIFIER /* temporaryReg | vertexResultReg */
|
||||
{
|
||||
struct asm_symbol *const s = (struct asm_symbol *)
|
||||
_mesa_symbol_table_find_symbol(state->st, 0, $1);
|
||||
_mesa_symbol_table_find_symbol(state->st, $1);
|
||||
|
||||
free($1);
|
||||
|
||||
@@ -841,7 +841,7 @@ dstReg: resultBinding
|
||||
progParamArray: USED_IDENTIFIER
|
||||
{
|
||||
struct asm_symbol *const s = (struct asm_symbol *)
|
||||
_mesa_symbol_table_find_symbol(state->st, 0, $1);
|
||||
_mesa_symbol_table_find_symbol(state->st, $1);
|
||||
|
||||
free($1);
|
||||
|
||||
@@ -914,7 +914,7 @@ addrRegNegOffset: INTEGER
|
||||
addrReg: USED_IDENTIFIER
|
||||
{
|
||||
struct asm_symbol *const s = (struct asm_symbol *)
|
||||
_mesa_symbol_table_find_symbol(state->st, 0, $1);
|
||||
_mesa_symbol_table_find_symbol(state->st, $1);
|
||||
|
||||
free($1);
|
||||
|
||||
@@ -2028,9 +2028,9 @@ legacyTexUnitNum: INTEGER
|
||||
ALIAS_statement: ALIAS IDENTIFIER '=' USED_IDENTIFIER
|
||||
{
|
||||
struct asm_symbol *exist = (struct asm_symbol *)
|
||||
_mesa_symbol_table_find_symbol(state->st, 0, $2);
|
||||
_mesa_symbol_table_find_symbol(state->st, $2);
|
||||
struct asm_symbol *target = (struct asm_symbol *)
|
||||
_mesa_symbol_table_find_symbol(state->st, 0, $4);
|
||||
_mesa_symbol_table_find_symbol(state->st, $4);
|
||||
|
||||
free($4);
|
||||
|
||||
@@ -2046,7 +2046,7 @@ ALIAS_statement: ALIAS IDENTIFIER '=' USED_IDENTIFIER
|
||||
"undefined variable binding in ALIAS statement");
|
||||
YYERROR;
|
||||
} else {
|
||||
_mesa_symbol_table_add_symbol(state->st, 0, $2, target);
|
||||
_mesa_symbol_table_add_symbol(state->st, $2, target);
|
||||
}
|
||||
}
|
||||
;
|
||||
@@ -2235,7 +2235,7 @@ declare_variable(struct asm_parser_state *state, char *name, enum asm_type t,
|
||||
{
|
||||
struct asm_symbol *s = NULL;
|
||||
struct asm_symbol *exist = (struct asm_symbol *)
|
||||
_mesa_symbol_table_find_symbol(state->st, 0, name);
|
||||
_mesa_symbol_table_find_symbol(state->st, name);
|
||||
|
||||
|
||||
if (exist != NULL) {
|
||||
@@ -2273,7 +2273,7 @@ declare_variable(struct asm_parser_state *state, char *name, enum asm_type t,
|
||||
break;
|
||||
}
|
||||
|
||||
_mesa_symbol_table_add_symbol(state->st, 0, s->name, s);
|
||||
_mesa_symbol_table_add_symbol(state->st, s->name, s);
|
||||
s->next = state->sym;
|
||||
state->sym = s;
|
||||
}
|
||||
|
@@ -26,6 +26,9 @@
|
||||
#include "../../util/hash_table.h"
|
||||
|
||||
struct symbol {
|
||||
/** Symbol name. */
|
||||
char *name;
|
||||
|
||||
/**
|
||||
* Link to the next symbol in the table with the same name
|
||||
*
|
||||
@@ -34,7 +37,6 @@ struct symbol {
|
||||
*/
|
||||
struct symbol *next_with_same_name;
|
||||
|
||||
|
||||
/**
|
||||
* Link to the next symbol in the table with the same scope
|
||||
*
|
||||
@@ -43,21 +45,6 @@ struct symbol {
|
||||
*/
|
||||
struct symbol *next_with_same_scope;
|
||||
|
||||
|
||||
/**
|
||||
* Header information for the list of symbols with the same name.
|
||||
*/
|
||||
struct symbol_header *hdr;
|
||||
|
||||
|
||||
/**
|
||||
* Name space of the symbol
|
||||
*
|
||||
* Name space are arbitrary user assigned integers. No two symbols can
|
||||
* exist in the same name space at the same scope level.
|
||||
*/
|
||||
int name_space;
|
||||
|
||||
/** Scope depth where this symbol was defined. */
|
||||
unsigned depth;
|
||||
|
||||
@@ -68,20 +55,6 @@ struct symbol {
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
*/
|
||||
struct symbol_header {
|
||||
/** Linkage in list of all headers in a given symbol table. */
|
||||
struct symbol_header *next;
|
||||
|
||||
/** Symbol name. */
|
||||
char *name;
|
||||
|
||||
/** Linked list of symbols with the same name. */
|
||||
struct symbol *symbols;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Element of the scope stack.
|
||||
*/
|
||||
@@ -104,41 +77,10 @@ struct _mesa_symbol_table {
|
||||
/** Top of scope stack. */
|
||||
struct scope_level *current_scope;
|
||||
|
||||
/** List of all symbol headers in the table. */
|
||||
struct symbol_header *hdr;
|
||||
|
||||
/** Current scope depth. */
|
||||
unsigned depth;
|
||||
};
|
||||
|
||||
|
||||
static void
|
||||
check_symbol_table(struct _mesa_symbol_table *table)
|
||||
{
|
||||
#if !defined(NDEBUG)
|
||||
struct scope_level *scope;
|
||||
|
||||
for (scope = table->current_scope; scope != NULL; scope = scope->next) {
|
||||
struct symbol *sym;
|
||||
|
||||
for (sym = scope->symbols
|
||||
; sym != NULL
|
||||
; sym = sym->next_with_same_name) {
|
||||
const struct symbol_header *const hdr = sym->hdr;
|
||||
struct symbol *sym2;
|
||||
|
||||
for (sym2 = hdr->symbols
|
||||
; sym2 != NULL
|
||||
; sym2 = sym2->next_with_same_name) {
|
||||
assert(sym2->hdr == hdr);
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
(void) table;
|
||||
#endif /* !defined(NDEBUG) */
|
||||
}
|
||||
|
||||
void
|
||||
_mesa_symbol_table_pop_scope(struct _mesa_symbol_table *table)
|
||||
{
|
||||
@@ -152,18 +94,22 @@ _mesa_symbol_table_pop_scope(struct _mesa_symbol_table *table)
|
||||
|
||||
while (sym != NULL) {
|
||||
struct symbol *const next = sym->next_with_same_scope;
|
||||
struct symbol_header *const hdr = sym->hdr;
|
||||
|
||||
assert(hdr->symbols == sym);
|
||||
|
||||
hdr->symbols = sym->next_with_same_name;
|
||||
struct hash_entry *hte = _mesa_hash_table_search(table->ht,
|
||||
sym->name);
|
||||
if (sym->next_with_same_name) {
|
||||
/* If there is a symbol with this name in an outer scope update
|
||||
* the hash table to point to it.
|
||||
*/
|
||||
hte->key = sym->next_with_same_name->name;
|
||||
hte->data = sym->next_with_same_name;
|
||||
} else {
|
||||
_mesa_hash_table_remove(table->ht, hte);
|
||||
free(sym->name);
|
||||
}
|
||||
|
||||
free(sym);
|
||||
|
||||
sym = next;
|
||||
}
|
||||
|
||||
check_symbol_table(table);
|
||||
}
|
||||
|
||||
|
||||
@@ -171,7 +117,6 @@ void
|
||||
_mesa_symbol_table_push_scope(struct _mesa_symbol_table *table)
|
||||
{
|
||||
struct scope_level *const scope = calloc(1, sizeof(*scope));
|
||||
|
||||
if (scope == NULL) {
|
||||
_mesa_error_no_memory(__func__);
|
||||
return;
|
||||
@@ -183,11 +128,11 @@ _mesa_symbol_table_push_scope(struct _mesa_symbol_table *table)
|
||||
}
|
||||
|
||||
|
||||
static struct symbol_header *
|
||||
static struct symbol *
|
||||
find_symbol(struct _mesa_symbol_table *table, const char *name)
|
||||
{
|
||||
struct hash_entry *entry = _mesa_hash_table_search(table->ht, name);
|
||||
return entry ? (struct symbol_header *) entry->data : NULL;
|
||||
return entry ? (struct symbol *) entry->data : NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -201,200 +146,140 @@ find_symbol(struct _mesa_symbol_table *table, const char *name)
|
||||
*/
|
||||
int
|
||||
_mesa_symbol_table_symbol_scope(struct _mesa_symbol_table *table,
|
||||
int name_space, const char *name)
|
||||
const char *name)
|
||||
{
|
||||
struct symbol_header *const hdr = find_symbol(table, name);
|
||||
struct symbol *sym;
|
||||
struct symbol *const sym = find_symbol(table, name);
|
||||
|
||||
if (hdr != NULL) {
|
||||
for (sym = hdr->symbols; sym != NULL; sym = sym->next_with_same_name) {
|
||||
assert(sym->hdr == hdr);
|
||||
if (sym) {
|
||||
assert(sym->depth <= table->depth);
|
||||
return sym->depth - table->depth;
|
||||
}
|
||||
|
||||
if ((name_space == -1) || (sym->name_space == name_space)) {
|
||||
assert(sym->depth <= table->depth);
|
||||
return sym->depth - table->depth;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
void *
|
||||
_mesa_symbol_table_find_symbol(struct _mesa_symbol_table *table,
|
||||
int name_space, const char *name)
|
||||
const char *name)
|
||||
{
|
||||
struct symbol_header *const hdr = find_symbol(table, name);
|
||||
struct symbol *const sym = find_symbol(table, name);
|
||||
if (sym)
|
||||
return sym->data;
|
||||
|
||||
if (hdr != NULL) {
|
||||
struct symbol *sym;
|
||||
|
||||
|
||||
for (sym = hdr->symbols; sym != NULL; sym = sym->next_with_same_name) {
|
||||
assert(sym->hdr == hdr);
|
||||
|
||||
if ((name_space == -1) || (sym->name_space == name_space)) {
|
||||
return sym->data;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
_mesa_symbol_table_add_symbol(struct _mesa_symbol_table *table,
|
||||
int name_space, const char *name,
|
||||
void *declaration)
|
||||
const char *name, void *declaration)
|
||||
{
|
||||
struct symbol_header *hdr;
|
||||
struct symbol *sym;
|
||||
struct symbol *new_sym;
|
||||
struct symbol *sym = find_symbol(table, name);
|
||||
|
||||
check_symbol_table(table);
|
||||
if (sym && sym->depth == table->depth)
|
||||
return -1;
|
||||
|
||||
hdr = find_symbol(table, name);
|
||||
new_sym = calloc(1, sizeof(*sym));
|
||||
if (new_sym == NULL) {
|
||||
_mesa_error_no_memory(__func__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
check_symbol_table(table);
|
||||
if (sym) {
|
||||
/* Store link to symbol in outer scope with the same name */
|
||||
new_sym->next_with_same_name = sym;
|
||||
new_sym->name = sym->name;
|
||||
} else {
|
||||
new_sym->name = strdup(name);
|
||||
if (new_sym->name == NULL) {
|
||||
free(new_sym);
|
||||
_mesa_error_no_memory(__func__);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (hdr == NULL) {
|
||||
hdr = calloc(1, sizeof(*hdr));
|
||||
if (hdr == NULL) {
|
||||
_mesa_error_no_memory(__func__);
|
||||
return -1;
|
||||
}
|
||||
new_sym->next_with_same_scope = table->current_scope->symbols;
|
||||
new_sym->data = declaration;
|
||||
new_sym->depth = table->depth;
|
||||
|
||||
hdr->name = strdup(name);
|
||||
if (hdr->name == NULL) {
|
||||
free(hdr);
|
||||
_mesa_error_no_memory(__func__);
|
||||
return -1;
|
||||
}
|
||||
table->current_scope->symbols = new_sym;
|
||||
|
||||
_mesa_hash_table_insert(table->ht, hdr->name, hdr);
|
||||
hdr->next = table->hdr;
|
||||
table->hdr = hdr;
|
||||
}
|
||||
_mesa_hash_table_insert(table->ht, new_sym->name, new_sym);
|
||||
|
||||
check_symbol_table(table);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* If the symbol already exists in this namespace at this scope, it cannot
|
||||
* be added to the table.
|
||||
*/
|
||||
for (sym = hdr->symbols
|
||||
; (sym != NULL) && (sym->name_space != name_space)
|
||||
; sym = sym->next_with_same_name) {
|
||||
/* empty */
|
||||
}
|
||||
int
|
||||
_mesa_symbol_table_replace_symbol(struct _mesa_symbol_table *table,
|
||||
const char *name,
|
||||
void *declaration)
|
||||
{
|
||||
struct symbol *sym = find_symbol(table, name);
|
||||
|
||||
if (sym && (sym->depth == table->depth))
|
||||
/* If the symbol doesn't exist, it cannot be replaced. */
|
||||
if (sym == NULL)
|
||||
return -1;
|
||||
|
||||
sym = calloc(1, sizeof(*sym));
|
||||
if (sym == NULL) {
|
||||
_mesa_error_no_memory(__func__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
sym->next_with_same_name = hdr->symbols;
|
||||
sym->next_with_same_scope = table->current_scope->symbols;
|
||||
sym->hdr = hdr;
|
||||
sym->name_space = name_space;
|
||||
sym->data = declaration;
|
||||
sym->depth = table->depth;
|
||||
|
||||
assert(sym->hdr == hdr);
|
||||
|
||||
hdr->symbols = sym;
|
||||
table->current_scope->symbols = sym;
|
||||
|
||||
check_symbol_table(table);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
_mesa_symbol_table_add_global_symbol(struct _mesa_symbol_table *table,
|
||||
int name_space, const char *name,
|
||||
void *declaration)
|
||||
const char *name, void *declaration)
|
||||
{
|
||||
struct symbol_header *hdr;
|
||||
struct symbol *sym;
|
||||
struct symbol *curr;
|
||||
struct scope_level *top_scope;
|
||||
struct scope_level *top_scope;
|
||||
struct symbol *inner_sym = NULL;
|
||||
struct symbol *sym = find_symbol(table, name);
|
||||
|
||||
check_symbol_table(table);
|
||||
while (sym) {
|
||||
if (sym->depth == 0)
|
||||
return -1;
|
||||
|
||||
hdr = find_symbol(table, name);
|
||||
inner_sym = sym;
|
||||
|
||||
check_symbol_table(table);
|
||||
/* Get symbol from the outer scope with the same name */
|
||||
sym = sym->next_with_same_name;
|
||||
}
|
||||
|
||||
if (hdr == NULL) {
|
||||
hdr = calloc(1, sizeof(*hdr));
|
||||
if (hdr == NULL) {
|
||||
_mesa_error_no_memory(__func__);
|
||||
return -1;
|
||||
}
|
||||
/* Find the top-level scope */
|
||||
for (top_scope = table->current_scope; top_scope->next != NULL;
|
||||
top_scope = top_scope->next) {
|
||||
/* empty */
|
||||
}
|
||||
|
||||
hdr->name = strdup(name);
|
||||
sym = calloc(1, sizeof(*sym));
|
||||
if (sym == NULL) {
|
||||
_mesa_error_no_memory(__func__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
_mesa_hash_table_insert(table->ht, hdr->name, hdr);
|
||||
hdr->next = table->hdr;
|
||||
table->hdr = hdr;
|
||||
}
|
||||
if (inner_sym) {
|
||||
/* In case we add the global out of order store a link to the global
|
||||
* symbol in global.
|
||||
*/
|
||||
inner_sym->next_with_same_name = sym;
|
||||
|
||||
check_symbol_table(table);
|
||||
sym->name = inner_sym->name;
|
||||
} else {
|
||||
sym->name = strdup(name);
|
||||
if (sym->name == NULL) {
|
||||
free(sym);
|
||||
_mesa_error_no_memory(__func__);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/* If the symbol already exists in this namespace at this scope, it cannot
|
||||
* be added to the table.
|
||||
*/
|
||||
for (sym = hdr->symbols
|
||||
; (sym != NULL) && (sym->name_space != name_space)
|
||||
; sym = sym->next_with_same_name) {
|
||||
/* empty */
|
||||
}
|
||||
sym->next_with_same_scope = top_scope->symbols;
|
||||
sym->data = declaration;
|
||||
|
||||
if (sym && sym->depth == 0)
|
||||
return -1;
|
||||
top_scope->symbols = sym;
|
||||
|
||||
/* Find the top-level scope */
|
||||
for (top_scope = table->current_scope
|
||||
; top_scope->next != NULL
|
||||
; top_scope = top_scope->next) {
|
||||
/* empty */
|
||||
}
|
||||
_mesa_hash_table_insert(table->ht, sym->name, sym);
|
||||
|
||||
sym = calloc(1, sizeof(*sym));
|
||||
if (sym == NULL) {
|
||||
_mesa_error_no_memory(__func__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
sym->next_with_same_scope = top_scope->symbols;
|
||||
sym->hdr = hdr;
|
||||
sym->name_space = name_space;
|
||||
sym->data = declaration;
|
||||
|
||||
assert(sym->hdr == hdr);
|
||||
|
||||
/* Since next_with_same_name is ordered by scope, we need to append the
|
||||
* new symbol to the _end_ of the list.
|
||||
*/
|
||||
if (hdr->symbols == NULL) {
|
||||
hdr->symbols = sym;
|
||||
} else {
|
||||
for (curr = hdr->symbols
|
||||
; curr->next_with_same_name != NULL
|
||||
; curr = curr->next_with_same_name) {
|
||||
/* empty */
|
||||
}
|
||||
curr->next_with_same_name = sym;
|
||||
}
|
||||
top_scope->symbols = sym;
|
||||
|
||||
check_symbol_table(table);
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -418,19 +303,10 @@ _mesa_symbol_table_ctor(void)
|
||||
void
|
||||
_mesa_symbol_table_dtor(struct _mesa_symbol_table *table)
|
||||
{
|
||||
struct symbol_header *hdr;
|
||||
struct symbol_header *next;
|
||||
|
||||
while (table->current_scope != NULL) {
|
||||
_mesa_symbol_table_pop_scope(table);
|
||||
}
|
||||
|
||||
for (hdr = table->hdr; hdr != NULL; hdr = next) {
|
||||
next = hdr->next;
|
||||
free(hdr->name);
|
||||
free(hdr);
|
||||
}
|
||||
|
||||
_mesa_hash_table_destroy(table->ht, NULL);
|
||||
free(table);
|
||||
}
|
||||
|
@@ -30,17 +30,22 @@ extern void _mesa_symbol_table_push_scope(struct _mesa_symbol_table *table);
|
||||
extern void _mesa_symbol_table_pop_scope(struct _mesa_symbol_table *table);
|
||||
|
||||
extern int _mesa_symbol_table_add_symbol(struct _mesa_symbol_table *symtab,
|
||||
int name_space, const char *name, void *declaration);
|
||||
const char *name, void *declaration);
|
||||
|
||||
extern int _mesa_symbol_table_add_global_symbol(
|
||||
struct _mesa_symbol_table *symtab, int name_space, const char *name,
|
||||
void *declaration);
|
||||
extern int _mesa_symbol_table_replace_symbol(struct _mesa_symbol_table *table,
|
||||
const char *name,
|
||||
void *declaration);
|
||||
|
||||
extern int
|
||||
_mesa_symbol_table_add_global_symbol(struct _mesa_symbol_table *symtab,
|
||||
const char *name,
|
||||
void *declaration);
|
||||
|
||||
extern int _mesa_symbol_table_symbol_scope(struct _mesa_symbol_table *table,
|
||||
int name_space, const char *name);
|
||||
const char *name);
|
||||
|
||||
extern void *_mesa_symbol_table_find_symbol(
|
||||
struct _mesa_symbol_table *symtab, int name_space, const char *name);
|
||||
extern void *_mesa_symbol_table_find_symbol(struct _mesa_symbol_table *symtab,
|
||||
const char *name);
|
||||
|
||||
extern struct _mesa_symbol_table *_mesa_symbol_table_ctor(void);
|
||||
|
||||
|
@@ -41,16 +41,21 @@ struct st_sync_object {
|
||||
struct gl_sync_object b;
|
||||
|
||||
struct pipe_fence_handle *fence;
|
||||
mtx_t mutex; /**< protects "fence" */
|
||||
};
|
||||
|
||||
|
||||
static struct gl_sync_object * st_new_sync_object(struct gl_context *ctx,
|
||||
GLenum type)
|
||||
{
|
||||
if (type == GL_SYNC_FENCE)
|
||||
return (struct gl_sync_object*)CALLOC_STRUCT(st_sync_object);
|
||||
else
|
||||
if (type == GL_SYNC_FENCE) {
|
||||
struct st_sync_object *so = CALLOC_STRUCT(st_sync_object);
|
||||
|
||||
mtx_init(&so->mutex, mtx_plain);
|
||||
return &so->b;
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static void st_delete_sync_object(struct gl_context *ctx,
|
||||
@@ -60,6 +65,7 @@ static void st_delete_sync_object(struct gl_context *ctx,
|
||||
struct st_sync_object *so = (struct st_sync_object*)obj;
|
||||
|
||||
screen->fence_reference(screen, &so->fence, NULL);
|
||||
mtx_destroy(&so->mutex);
|
||||
free(so->b.Label);
|
||||
free(so);
|
||||
}
|
||||
@@ -76,24 +82,6 @@ static void st_fence_sync(struct gl_context *ctx, struct gl_sync_object *obj,
|
||||
pipe->flush(pipe, &so->fence, PIPE_FLUSH_DEFERRED);
|
||||
}
|
||||
|
||||
static void st_check_sync(struct gl_context *ctx, struct gl_sync_object *obj)
|
||||
{
|
||||
struct pipe_context *pipe = st_context(ctx)->pipe;
|
||||
struct pipe_screen *screen = pipe->screen;
|
||||
struct st_sync_object *so = (struct st_sync_object*)obj;
|
||||
|
||||
/* If the fence doesn't exist, assume it's signalled. */
|
||||
if (!so->fence) {
|
||||
so->b.StatusFlag = GL_TRUE;
|
||||
return;
|
||||
}
|
||||
|
||||
if (screen->fence_finish(screen, pipe, so->fence, 0)) {
|
||||
screen->fence_reference(screen, &so->fence, NULL);
|
||||
so->b.StatusFlag = GL_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
static void st_client_wait_sync(struct gl_context *ctx,
|
||||
struct gl_sync_object *obj,
|
||||
GLbitfield flags, GLuint64 timeout)
|
||||
@@ -101,13 +89,22 @@ static void st_client_wait_sync(struct gl_context *ctx,
|
||||
struct pipe_context *pipe = st_context(ctx)->pipe;
|
||||
struct pipe_screen *screen = pipe->screen;
|
||||
struct st_sync_object *so = (struct st_sync_object*)obj;
|
||||
struct pipe_fence_handle *fence = NULL;
|
||||
|
||||
/* If the fence doesn't exist, assume it's signalled. */
|
||||
mtx_lock(&so->mutex);
|
||||
if (!so->fence) {
|
||||
mtx_unlock(&so->mutex);
|
||||
so->b.StatusFlag = GL_TRUE;
|
||||
return;
|
||||
}
|
||||
|
||||
/* We need a local copy of the fence pointer, so that we can call
|
||||
* fence_finish unlocked.
|
||||
*/
|
||||
screen->fence_reference(screen, &fence, so->fence);
|
||||
mtx_unlock(&so->mutex);
|
||||
|
||||
/* Section 4.1.2 of OpenGL 4.5 (Compatibility Profile) says:
|
||||
* [...] if ClientWaitSync is called and all of the following are true:
|
||||
* - the SYNC_FLUSH_COMMANDS_BIT bit is set in flags,
|
||||
@@ -120,11 +117,18 @@ static void st_client_wait_sync(struct gl_context *ctx,
|
||||
* Assume GL_SYNC_FLUSH_COMMANDS_BIT is always set, because applications
|
||||
* forget to set it.
|
||||
*/
|
||||
if (so->fence &&
|
||||
screen->fence_finish(screen, pipe, so->fence, timeout)) {
|
||||
if (screen->fence_finish(screen, pipe, fence, timeout)) {
|
||||
mtx_lock(&so->mutex);
|
||||
screen->fence_reference(screen, &so->fence, NULL);
|
||||
mtx_unlock(&so->mutex);
|
||||
so->b.StatusFlag = GL_TRUE;
|
||||
}
|
||||
screen->fence_reference(screen, &fence, NULL);
|
||||
}
|
||||
|
||||
static void st_check_sync(struct gl_context *ctx, struct gl_sync_object *obj)
|
||||
{
|
||||
st_client_wait_sync(ctx, obj, 0, 0);
|
||||
}
|
||||
|
||||
static void st_server_wait_sync(struct gl_context *ctx,
|
||||
|
@@ -126,6 +126,30 @@ setup_index_buffer(struct st_context *st,
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the restart index.
|
||||
*/
|
||||
static void
|
||||
setup_primitive_restart(struct gl_context *ctx,
|
||||
const struct _mesa_index_buffer *ib,
|
||||
struct pipe_draw_info *info)
|
||||
{
|
||||
if (ctx->Array._PrimitiveRestart) {
|
||||
info->restart_index = _mesa_primitive_restart_index(ctx, ib->type);
|
||||
|
||||
/* Enable primitive restart only when the restart index can have an
|
||||
* effect. This is required for correctness in radeonsi VI support.
|
||||
* Other hardware may also benefit from taking a faster, non-restart path
|
||||
* when possible.
|
||||
*/
|
||||
if ((ib->type == GL_UNSIGNED_INT) ||
|
||||
(ib->type == GL_UNSIGNED_SHORT && info->restart_index <= 0xffff) ||
|
||||
(ib->type == GL_UNSIGNED_BYTE && info->restart_index <= 0xff))
|
||||
info->primitive_restart = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Translate OpenGL primtive type (GL_POINTS, GL_TRIANGLE_STRIP, etc) to
|
||||
* the corresponding Gallium type.
|
||||
@@ -205,8 +229,7 @@ st_draw_vbo(struct gl_context *ctx,
|
||||
/* The VBO module handles restart for the non-indexed GLDrawArrays
|
||||
* so we only set these fields for indexed drawing:
|
||||
*/
|
||||
info.primitive_restart = ctx->Array._PrimitiveRestart;
|
||||
info.restart_index = _mesa_primitive_restart_index(ctx, ib->type);
|
||||
setup_primitive_restart(ctx, ib, &info);
|
||||
}
|
||||
else {
|
||||
/* Transform feedback drawing is always non-indexed. */
|
||||
@@ -299,6 +322,9 @@ st_indirect_draw_vbo(struct gl_context *ctx,
|
||||
}
|
||||
|
||||
info.indexed = TRUE;
|
||||
|
||||
/* Primitive restart is not handled by the VBO module in this case. */
|
||||
setup_primitive_restart(ctx, ib, &info);
|
||||
}
|
||||
|
||||
info.mode = translate_prim(ctx, mode);
|
||||
@@ -306,10 +332,6 @@ st_indirect_draw_vbo(struct gl_context *ctx,
|
||||
info.indirect = st_buffer_object(indirect_data)->buffer;
|
||||
info.indirect_offset = indirect_offset;
|
||||
|
||||
/* Primitive restart is not handled by the VBO module in this case. */
|
||||
info.primitive_restart = ctx->Array._PrimitiveRestart;
|
||||
info.restart_index = ctx->Array.RestartIndex;
|
||||
|
||||
if (ST_DEBUG & DEBUG_DRAW) {
|
||||
debug_printf("st/draw indirect: mode %s drawcount %d indexed %d\n",
|
||||
u_prim_name(info.mode),
|
||||
|
@@ -55,6 +55,7 @@
|
||||
#include "st_glsl_types.h"
|
||||
#include "st_nir.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#define PROGRAM_ANY_CONST ((1 << PROGRAM_STATE_VAR) | \
|
||||
(1 << PROGRAM_CONSTANT) | \
|
||||
@@ -2880,6 +2881,7 @@ glsl_to_tgsi_visitor::emit_block_mov(ir_assignment *ir, const struct glsl_type *
|
||||
|
||||
assert(type->is_scalar() || type->is_vector());
|
||||
|
||||
l->type = type->base_type;
|
||||
r->type = type->base_type;
|
||||
if (cond) {
|
||||
st_src_reg l_src = st_src_reg(*l);
|
||||
@@ -2940,10 +2942,12 @@ glsl_to_tgsi_visitor::visit(ir_assignment *ir)
|
||||
} else if (ir->write_mask == 0) {
|
||||
assert(!ir->lhs->type->is_scalar() && !ir->lhs->type->is_vector());
|
||||
|
||||
if (ir->lhs->type->is_array() || ir->lhs->type->is_matrix()) {
|
||||
unsigned num_elements = ir->lhs->type->without_array()->vector_elements;
|
||||
unsigned num_elements = ir->lhs->type->without_array()->vector_elements;
|
||||
|
||||
if (num_elements) {
|
||||
l.writemask = u_bit_consecutive(0, num_elements);
|
||||
} else {
|
||||
/* The type is a struct or an array of (array of) structs. */
|
||||
l.writemask = WRITEMASK_XYZW;
|
||||
}
|
||||
} else {
|
||||
@@ -5870,6 +5874,29 @@ emit_compute_block_size(const struct gl_program *program,
|
||||
cp->LocalSize[2]);
|
||||
}
|
||||
|
||||
struct sort_inout_decls {
|
||||
bool operator()(const struct inout_decl &a, const struct inout_decl &b) const {
|
||||
return mapping[a.mesa_index] < mapping[b.mesa_index];
|
||||
}
|
||||
|
||||
const GLuint *mapping;
|
||||
};
|
||||
|
||||
/* Sort the given array of decls by the corresponding slot (TGSI file index).
|
||||
*
|
||||
* This is for the benefit of older drivers which are broken when the
|
||||
* declarations aren't sorted in this way.
|
||||
*/
|
||||
static void
|
||||
sort_inout_decls_by_slot(struct inout_decl *decls,
|
||||
unsigned count,
|
||||
const GLuint mapping[])
|
||||
{
|
||||
sort_inout_decls sorter;
|
||||
sorter.mapping = mapping;
|
||||
std::sort(decls, decls + count, sorter);
|
||||
}
|
||||
|
||||
/**
|
||||
* Translate intermediate IR (glsl_to_tgsi_instruction) to TGSI format.
|
||||
* \param program the program to translate
|
||||
@@ -5942,6 +5969,8 @@ st_translate_program(
|
||||
case PIPE_SHADER_GEOMETRY:
|
||||
case PIPE_SHADER_TESS_EVAL:
|
||||
case PIPE_SHADER_TESS_CTRL:
|
||||
sort_inout_decls_by_slot(program->inputs, program->num_inputs, inputMapping);
|
||||
|
||||
for (i = 0; i < program->num_inputs; ++i) {
|
||||
struct inout_decl *decl = &program->inputs[i];
|
||||
unsigned slot = inputMapping[decl->mesa_index];
|
||||
@@ -5994,6 +6023,8 @@ st_translate_program(
|
||||
case PIPE_SHADER_TESS_EVAL:
|
||||
case PIPE_SHADER_TESS_CTRL:
|
||||
case PIPE_SHADER_VERTEX:
|
||||
sort_inout_decls_by_slot(program->outputs, program->num_outputs, outputMapping);
|
||||
|
||||
for (i = 0; i < program->num_outputs; ++i) {
|
||||
struct inout_decl *decl = &program->outputs[i];
|
||||
unsigned slot = outputMapping[decl->mesa_index];
|
||||
|
@@ -635,11 +635,15 @@ wsi_wl_image_init(struct wsi_wl_swapchain *chain,
|
||||
wl_display_roundtrip(chain->display->display);
|
||||
close(fd);
|
||||
|
||||
if (!image->buffer)
|
||||
goto fail_image;
|
||||
|
||||
wl_proxy_set_queue((struct wl_proxy *)image->buffer, chain->queue);
|
||||
wl_buffer_add_listener(image->buffer, &buffer_listener, image);
|
||||
|
||||
return VK_SUCCESS;
|
||||
|
||||
fail_image:
|
||||
chain->base.image_fns->free_wsi_image(vk_device, pAllocator,
|
||||
image->image, image->memory);
|
||||
|
||||
@@ -698,6 +702,9 @@ wsi_wl_surface_create_swapchain(VkIcdSurfaceBase *icd_surface,
|
||||
if (chain == NULL)
|
||||
return VK_ERROR_OUT_OF_HOST_MEMORY;
|
||||
|
||||
bool alpha = pCreateInfo->compositeAlpha ==
|
||||
VK_COMPOSITE_ALPHA_PRE_MULTIPLIED_BIT_KHR;
|
||||
|
||||
chain->base.device = device;
|
||||
chain->base.destroy = wsi_wl_swapchain_destroy;
|
||||
chain->base.get_images = wsi_wl_swapchain_get_images;
|
||||
@@ -707,7 +714,7 @@ wsi_wl_surface_create_swapchain(VkIcdSurfaceBase *icd_surface,
|
||||
chain->surface = surface->surface;
|
||||
chain->extent = pCreateInfo->imageExtent;
|
||||
chain->vk_format = pCreateInfo->imageFormat;
|
||||
chain->drm_format = wl_drm_format_for_vk_format(chain->vk_format, false);
|
||||
chain->drm_format = wl_drm_format_for_vk_format(chain->vk_format, alpha);
|
||||
|
||||
chain->present_mode = pCreateInfo->presentMode;
|
||||
chain->fifo_ready = true;
|
||||
|
@@ -471,6 +471,7 @@ struct x11_swapchain {
|
||||
xcb_connection_t * conn;
|
||||
xcb_window_t window;
|
||||
xcb_gc_t gc;
|
||||
uint32_t depth;
|
||||
VkExtent2D extent;
|
||||
uint32_t image_count;
|
||||
|
||||
@@ -625,7 +626,6 @@ x11_image_init(VkDevice device_h, struct x11_swapchain *chain,
|
||||
uint32_t row_pitch;
|
||||
uint32_t offset;
|
||||
uint32_t bpp = 32;
|
||||
uint32_t depth = 24;
|
||||
int fd;
|
||||
uint32_t size;
|
||||
|
||||
@@ -651,7 +651,7 @@ x11_image_init(VkDevice device_h, struct x11_swapchain *chain,
|
||||
pCreateInfo->imageExtent.width,
|
||||
pCreateInfo->imageExtent.height,
|
||||
row_pitch,
|
||||
depth, bpp, fd);
|
||||
chain->depth, bpp, fd);
|
||||
xcb_discard_reply(chain->conn, cookie.sequence);
|
||||
|
||||
int fence_fd = xshmfence_alloc_shm();
|
||||
@@ -752,18 +752,29 @@ x11_surface_create_swapchain(VkIcdSurfaceBase *icd_surface,
|
||||
if (chain == NULL)
|
||||
return VK_ERROR_OUT_OF_HOST_MEMORY;
|
||||
|
||||
xcb_connection_t *conn = x11_surface_get_connection(icd_surface);
|
||||
xcb_window_t window = x11_surface_get_window(icd_surface);
|
||||
xcb_get_geometry_reply_t *geometry =
|
||||
xcb_get_geometry_reply(conn, xcb_get_geometry(conn, window), NULL);
|
||||
|
||||
if (geometry == NULL)
|
||||
return VK_ERROR_SURFACE_LOST_KHR;
|
||||
|
||||
chain->base.device = device;
|
||||
chain->base.destroy = x11_swapchain_destroy;
|
||||
chain->base.get_images = x11_get_images;
|
||||
chain->base.acquire_next_image = x11_acquire_next_image;
|
||||
chain->base.queue_present = x11_queue_present;
|
||||
chain->base.image_fns = image_fns;
|
||||
chain->conn = x11_surface_get_connection(icd_surface);
|
||||
chain->window = x11_surface_get_window(icd_surface);
|
||||
chain->conn = conn;
|
||||
chain->window = window;
|
||||
chain->depth = geometry->depth;
|
||||
chain->extent = pCreateInfo->imageExtent;
|
||||
chain->image_count = num_images;
|
||||
chain->send_sbc = 0;
|
||||
|
||||
free(geometry);
|
||||
|
||||
chain->event_id = xcb_generate_id(chain->conn);
|
||||
xcb_present_select_input(chain->conn, chain->event_id, chain->window,
|
||||
XCB_PRESENT_EVENT_MASK_CONFIGURE_NOTIFY |
|
||||
|
Reference in New Issue
Block a user