Permalink
Browse files

glBindAttribLocation was basically broken.

  • Loading branch information...
1 parent 99882fd commit 4ea86e034614c79eef87f6445180e78f3434812a @gzorin committed Aug 14, 2012
View
4 configure.ac
@@ -120,10 +120,6 @@ RSXGL_CONFIG_RSX_compatibility=0
AC_ARG_ENABLE([RSX-compatibility],AS_HELP_STRING([--enable-RSX-compatibility],[configure the library to enable OpenGL compatibility profile capabilities that the RSX happens to support (e.g., GL_QUADS)]),[if test "$enableval" == "yes"; then RSXGL_CONFIG_RSX_compatibility=1; fi],[])
AC_SUBST([RSXGL_CONFIG_RSX_compatibility])
-RSXGL_CONFIG_client_attribs=0
-AC_ARG_ENABLE([client-attribs],AS_HELP_STRING([--enable-client-attribs],[configure the library to support client-side attribute data]),[if test "$enableval" == "yes"; then RSXGL_CONFIG_client_attribs=1; fi],[])
-AC_SUBST([RSXGL_CONFIG_client_attribs])
-
# Samples can send debugging information back to the host used to build them; set its IP here,
# or leave it unset & it won't try to phone home:
AC_ARG_VAR([RSXGL_CONFIG_samples_host_ip],[IP address of host for samples to send reporting to])
View
2 include/config.h.in
@@ -2,6 +2,4 @@
#ifndef rsxgl_config_H
#define rsxgl_config_H
-#define RSXGL_CONFIG_client_attribs @RSXGL_CONFIG_client_attribs@
-
#endif
View
146 src/library/attribs.cc
@@ -762,39 +762,12 @@ rsxgl_vertex_attrib_pointer(rsxgl_context_t * ctx,uint32_t rsx_type,GLuint index
RSXGL_ERROR_(GL_INVALID_VALUE);
}
-#if (RSXGL_CONFIG_client_attribs == 0)
if(ctx -> buffer_binding.names[RSXGL_ARRAY_BUFFER] == 0 && pointer != 0) {
RSXGL_ERROR_(GL_INVALID_OPERATION);
}
-#endif
attribs_t & attribs = ctx -> attribs_binding[0];
-#if (RSXGL_CONFIG_client_attribs == 1)
- if(ctx -> buffer_binding.names[RSXGL_ARRAY_BUFFER] != 0 || pointer != 0) {
- if(ctx -> buffer_binding.names[RSXGL_ARRAY_BUFFER] != 0) {
- attribs.buffers.bind(index,ctx -> buffer_binding.names[RSXGL_ARRAY_BUFFER]);
- attribs.offset[index] = rsxgl_pointer_to_offset(pointer);
- attribs.client_buffer[i] = 0;
- attribs.client_buffer_enabled.reset(index);
- }
- else {
- attribs.buffers.bind(index,0);
- attribs.offset[index] = 0;
- attribs.client_buffer[i] = pointer;
- attribs.client_buffer_enabled.set(index);
- }
- attribs.type.set(index,rsx_type);
- attribs.size.set(index,size - 1);
- attribs.stride[index] = stride;
- }
- else {
- attribs.buffers.bind(index,0);
- attribs.offset[index] = 0;
- attribs.client_buffer[i] = 0;
- attribs.client_buffer_enabled.reset(index);
- }
-#else
attribs.buffers.bind(index,ctx -> buffer_binding.names[RSXGL_ARRAY_BUFFER]);
if(ctx -> buffer_binding.names[RSXGL_ARRAY_BUFFER] != 0) {
@@ -806,7 +779,6 @@ rsxgl_vertex_attrib_pointer(rsxgl_context_t * ctx,uint32_t rsx_type,GLuint index
else {
attribs.offset[index] = 0;
}
-#endif
ctx -> invalid_attribs.set(index);
@@ -849,21 +821,10 @@ glVertexAttribDivisor (GLuint index, GLuint divisor)
}
void
-rsxgl_attribs_validate(rsxgl_context_t * ctx,const bit_set< RSXGL_MAX_VERTEX_ATTRIBS > & program_attribs,const uint32_t start,const uint32_t length,const uint32_t timestamp)
+rsxgl_attribs_validate(rsxgl_context_t * ctx,program_t & program,const uint32_t start,const uint32_t length,const uint32_t timestamp)
{
gcmContextData * context = ctx -> base.gcm_context;
- attribs_t & attribs = ctx -> attribs_binding[0];
- const bit_set< RSXGL_MAX_VERTEX_ATTRIBS > required_buffer_attribs = attribs.enabled & program_attribs;
- const bit_set< RSXGL_MAX_VERTEX_ATTRIBS > invalid_attribs = ctx -> invalid_attribs & program_attribs;
-#if (RSXGL_CONFIG_client_attribs == 1)
- bit_set< RSXGL_MAX_VERTEX_ATTRIBS > invalid_buffer_attribs = invalid_attribs & attribs.enabled & ~attribs.client_buffer_enabled;
- bit_set< RSXGL_MAX_VERTEX_ATTRIBS > invalid_client_buffer_attribs = attribs.enabled & attribs.client_buffer_enabled;
-#else
- bit_set< RSXGL_MAX_VERTEX_ATTRIBS > invalid_buffer_attribs = invalid_attribs & attribs.enabled;
-#endif
- const bit_set< RSXGL_MAX_VERTEX_ATTRIBS > invalid_constant_attribs = invalid_attribs & ~attribs.enabled;
-
// Validate the vertex cache
// TODO: move this someplace where it can be determined if vertex buffers have been made
// invalid, and perform the operation if that's the case.
@@ -885,6 +846,95 @@ rsxgl_attribs_validate(rsxgl_context_t * ctx,const bit_set< RSXGL_MAX_VERTEX_ATT
gcm_finish_n_commands(context,8);
}
+ //
+ const program_t::attribs_bitfield_type
+ attribs_enabled = program.attribs_enabled,
+ invalid_attrib_assignments = ctx -> invalid_attrib_assignments;
+ const program_t::attrib_assignments_type
+ attrib_assignments = program.attrib_assignments;
+
+ program_t::attribs_bitfield_type::const_iterator
+ enabled_it = attribs_enabled.begin(),
+ invalid_it = invalid_attrib_assignments.begin();
+ program_t::attrib_assignments_type::const_iterator
+ assignment_it = attrib_assignments.begin();
+
+ attribs_t & attribs = ctx -> attribs_binding[0];
+ const bit_set< RSXGL_MAX_VERTEX_ATTRIBS >
+ invalid_attribs = ctx -> invalid_attribs, enabled_attrib_pointers = attribs.enabled;
+ bit_set< RSXGL_MAX_VERTEX_ATTRIBS >
+ validated;
+
+ for(program_t::attrib_size_type index = 0;index < RSXGL_MAX_VERTEX_ATTRIBS;++index,enabled_it.next(attribs_enabled),invalid_it.next(invalid_attrib_assignments),assignment_it.next(attrib_assignments)) {
+ if(!enabled_it.test()) continue;
+
+ const program_t::attrib_size_type api_index = assignment_it.value();
+
+ if(invalid_it.test() || invalid_attribs.test(api_index)) {
+ // Attribute is backed by a buffer:
+ if(enabled_attrib_pointers.test(api_index)) {
+ // A buffer is actually attached:
+ if(attribs.buffers.names[api_index] != 0 && attribs.buffers[api_index].memory) {
+ rsxgl_buffer_validate(ctx,attribs.buffers[api_index],start,length,timestamp);
+
+ const memory_t memory = attribs.buffers[api_index].memory + attribs.offset[api_index];
+
+ uint32_t * buffer = gcm_reserve(context,4);
+
+ gcm_emit_method_at(buffer,0,NV30_3D_VTXBUF(index),1);
+ gcm_emit_at(buffer,1,memory.offset | ((uint32_t)memory.location << 31));
+ gcm_emit_method_at(buffer,2,NV30_3D_VTXFMT(index),1);
+ gcm_emit_at(buffer,3,
+ /* ((uint32_t)attribs.frequency[api_index] << 16 | */
+ ((uint32_t)attribs.stride[api_index] << NV30_3D_VTXFMT_STRIDE__SHIFT) |
+ ((uint32_t)(attribs.size[api_index] + 1) << NV30_3D_VTXFMT_SIZE__SHIFT) |
+ ((uint32_t)attribs.type[api_index] & 0x7));
+
+ gcm_finish_n_commands(context,4);
+ }
+ // Nothing attached; disable fetch:
+ else {
+ uint32_t * buffer = gcm_reserve(context,2);
+
+ gcm_emit_method_at(buffer,0,NV30_3D_VTXFMT(index),1);
+ gcm_emit_at(buffer,1,
+ /* ((uint32_t)attribs.frequency[i] << 16 | */
+ ((uint32_t)0 << NV30_3D_VTXFMT_STRIDE__SHIFT) |
+ ((uint32_t)0 << NV30_3D_VTXFMT_SIZE__SHIFT) |
+ ((uint32_t)RSXGL_VERTEX_F32 & 0x7));
+
+ gcm_finish_n_commands(context,2);
+ }
+ }
+ // Attribute is constant:
+ else {
+ uint32_t * buffer = gcm_reserve(context,5);
+
+ gcm_emit_method_at(buffer,0,NV30_3D_VTX_ATTR_4F(index),4);
+
+ gcm_emit_at(buffer,1,attribs.defaults[api_index][0].u);
+ gcm_emit_at(buffer,2,attribs.defaults[api_index][1].u);
+ gcm_emit_at(buffer,3,attribs.defaults[api_index][2].u);
+ gcm_emit_at(buffer,4,attribs.defaults[api_index][3].u);
+
+ gcm_finish_n_commands(context,5);
+ }
+
+ validated.set(api_index);
+ }
+ }
+
+ ctx -> invalid_attrib_assignments.reset();
+ ctx -> invalid_attribs &= ~validated;
+
+#if 0
+ //
+ attribs_t & attribs = ctx -> attribs_binding[0];
+ const program_t::attribs_bitfield_type required_buffer_attribs = attribs.enabled & program_attribs;
+ const program_t::attribs_bitfield_type invalid_attribs = ctx -> invalid_attribs & program_attribs;
+ program_t::attribs_bitfield_type invalid_buffer_attribs = invalid_attribs & attribs.enabled;
+ const program_t::attribs_bitfield_type invalid_constant_attribs = invalid_attribs & ~attribs.enabled;
+
// Validate modified buffers & update their timestamps:
for(size_t i = 0;i < RSXGL_MAX_VERTEX_ATTRIBS;++i) {
if(!required_buffer_attribs.test(i)) continue;
@@ -897,6 +947,8 @@ rsxgl_attribs_validate(rsxgl_context_t * ctx,const bit_set< RSXGL_MAX_VERTEX_ATT
// TODO: Somewhere in here, make it so that attribs with nothing attached will disable fetching by the RSX (by setting NV30_3D_VTXFMT_SIZE to 0):
if(invalid_buffer_attribs.any()) {
+ rsxgl_debug_printf("%s for program %u\n",__PRETTY_FUNCTION__,ctx -> program_binding.names[RSXGL_ACTIVE_PROGRAM]);
+
uint32_t * buffer = gcm_reserve(context,4 * RSXGL_MAX_VERTEX_ATTRIBS);
size_t nbuffer = 0;
@@ -907,15 +959,13 @@ rsxgl_attribs_validate(rsxgl_context_t * ctx,const bit_set< RSXGL_MAX_VERTEX_ATT
const memory_t memory = vbo.memory + attribs.offset[i];
-#if 0
rsxgl_debug_printf("\t%u m:%u %u o:%u stride:%u size:%u t:%x\n",
(unsigned int)i,
memory.location,memory.offset,
attribs.offset[i],
(uint32_t)attribs.stride[i],
(uint32_t)attribs.size[i],
(uint32_t)attribs.type[i]);
-#endif
gcm_emit_method_at(buffer,nbuffer + 0,NV30_3D_VTXBUF(i),1);
gcm_emit_at(buffer,nbuffer + 1,memory.offset | ((uint32_t)memory.location << 31));
@@ -931,17 +981,6 @@ rsxgl_attribs_validate(rsxgl_context_t * ctx,const bit_set< RSXGL_MAX_VERTEX_ATT
gcm_finish_n_commands(context,nbuffer);
}
-#if (RSXGL_CONFIG_client_attribs == 1)
- if(invalid_client_buffer_attribs.any()) {
- for(size_t i = 0;i < RSXGL_MAX_VERTEX_ATTRIBS;++i) {
- if(!invalid_client_buffer_attribs.test(i)) continue;
-
- // TODO: Migrate client-side data to RSX-mapped memory.
-
- }
- }
-#endif
-
if(invalid_constant_attribs.any()) {
uint32_t * buffer = gcm_reserve(context,5 * RSXGL_MAX_VERTEX_ATTRIBS);
size_t nbuffer = 0;
@@ -963,4 +1002,5 @@ rsxgl_attribs_validate(rsxgl_context_t * ctx,const bit_set< RSXGL_MAX_VERTEX_ATT
}
ctx -> invalid_attribs &= ~program_attribs;
+#endif
}
View
12 src/library/attribs.h
@@ -13,6 +13,7 @@
#include "gl_object.h"
#include "arena.h"
#include "buffer.h"
+#include "program.h"
#include "bit_set.h"
#include "smint_array.h"
@@ -54,22 +55,13 @@ struct attribs_t {
smint_array< 3, RSXGL_MAX_VERTEX_ATTRIBS > size;
uint8_t stride[RSXGL_MAX_VERTEX_ATTRIBS];
-#if (RSXGL_CONFIG_client_attribs == 1)
- bit_set< RSXGL_MAX_VERTEX_ATTRIBS > client_buffer_enabled;
- void * client_buffer[RSXGL_MAX_VERTEX_ATTRIBS];
-#endif
-
attribs_t() {
for(size_t i = 0;i < RSXGL_MAX_VERTEX_ATTRIBS;++i) {
defaults[i][0].f = 0.0f;
defaults[i][1].f = 0.0f;
defaults[i][2].f = 0.0f;
defaults[i][3].f = 1.0f;
offset[i] = 0;
-
-#if (RSXGL_CONFIG_client_attribs == 1)
- client_buffer[i] = 0;
-#endif
}
}
@@ -80,6 +72,6 @@ struct attribs_t {
struct rsxgl_context_t;
-void rsxgl_attribs_validate(rsxgl_context_t *,const bit_set< RSXGL_MAX_VERTEX_ATTRIBS > &,const uint32_t,const uint32_t,const uint32_t);
+void rsxgl_attribs_validate(rsxgl_context_t *,program_t &,const uint32_t,const uint32_t,const uint32_t);
#endif
View
2 src/library/draw.cc
@@ -549,7 +549,7 @@ namespace {
rsxgl_draw_framebuffer_validate(ctx,lastTimestamp);
rsxgl_state_validate(ctx);
rsxgl_program_validate(ctx,lastTimestamp);
- rsxgl_attribs_validate(ctx,ctx -> program_binding[RSXGL_ACTIVE_PROGRAM].attribs_enabled,index_range.first,index_range.second,lastTimestamp);
+ rsxgl_attribs_validate(ctx,ctx -> program_binding[RSXGL_ACTIVE_PROGRAM],index_range.first,index_range.second,lastTimestamp);
rsxgl_uniforms_validate(ctx,ctx -> program_binding[RSXGL_ACTIVE_PROGRAM]);
rsxgl_textures_validate(ctx,ctx -> program_binding[RSXGL_ACTIVE_PROGRAM],lastTimestamp);
View
87 src/library/program.cc
@@ -736,6 +736,15 @@ glLinkProgram (GLuint program_name)
compiler_context_t * cctx = ctx -> compiler_context();
for(unsigned int i = 0,n = program.attached_shaders().get_size();i < n;++i) {
+ const shader_t & shader = shader_t::storage().at(program.attached_shaders()[i]);
+
+#if 0
+ char * tmp = (char *)malloc(shader.source_size);
+ shader.source().get(tmp,shader.source_size);
+ rsxgl_debug_printf("%u source:\n%s\n",i,tmp);
+ free(tmp);
+#endif
+
cctx -> attach_shader(program.mesa_program,shader_t::storage().at(program.attached_shaders()[i]).mesa_shader);
}
@@ -859,10 +868,12 @@ glLinkProgram (GLuint program_name)
|| var->location == -1
|| var->location < VERT_ATTRIB_GENERIC0)
continue;
-
+
program_t::attrib_t attrib;
attrib.type = rsxgl_glsl_type_to_rsxgl_type(var->type);
attrib.index = st_vp -> input_to_index[var -> location];
+ attrib.location = var -> location - VERT_ATTRIB_GENERIC0;
+
attribs.insert(std::make_pair(var -> name,attrib));
const program_t::name_size_type name_length = strlen(var -> name);
@@ -1041,29 +1052,30 @@ glLinkProgram (GLuint program_name)
char * pnames = program.names_data;
// Migrate attributes table:
+ program.attribs_enabled.reset();
+
if(attribs.size() > 0) {
#if 0
rsxgl_debug_printf("%u attribs\n",attribs.size());
#endif
- program.attribs_enabled.reset();
-
program_t::attrib_table_type::type table = program.attrib_table();
table.resize(attribs.size());
unsigned int i = 0;
for(std::map< const char *, program_t::attrib_t, cstr_less >::const_iterator jt = attribs.begin(),jt_end = attribs.end();jt != jt_end;++jt) {
#if 0
rsxgl_debug_printf(" %s: type:%u index:%u\n",
- value.first,
- (unsigned int)value.second.type,
- (unsigned int)value.second.index);
+ jt -> first,
+ (unsigned int)jt -> second.type,
+ (unsigned int)jt -> second.index);
#endif
table[i].first = pnames - program.names_data;
table[i].second = jt -> second;
program.attribs_enabled.set(jt -> second.index);
+ program.attrib_assignments.set(jt -> second.index,jt -> second.location);
for(const char * name = jt -> first;*name != 0;++name,++pnames) {
*pnames = *name;
@@ -1345,31 +1357,55 @@ glUseProgram (GLuint program_name)
if(ctx -> program_binding.names[RSXGL_ACTIVE_PROGRAM] != program_name) {
const program_t::name_type prev_program_name = ctx -> program_binding.names[RSXGL_ACTIVE_PROGRAM];
-
ctx -> program_binding.bind(RSXGL_ACTIVE_PROGRAM,program_name);
ctx -> invalid.parts.program = 1;
if(program_name != 0) {
- ctx -> state.enable.transform_feedback_program = (program_t::storage().at(program_name).streamvp_num_insn > 0 && program_t::storage().at(program_name).streamfp_num_insn > 0);
+ const program_t & program = program_t::storage().at(program_name);
+
+ ctx -> state.enable.transform_feedback_program = (program.streamvp_num_insn > 0 && program.streamfp_num_insn > 0);
if(prev_program_name != 0) {
- const program_t::texture_assignments_bitfield_type
- textures_enabled = program_t::storage().at(prev_program_name).textures_enabled;
- const program_t::texture_assignments_type
- prev_assignments = program_t::storage().at(prev_program_name).texture_assignments,
- assignments = program_t::storage().at(program_name).texture_assignments;
-
- program_t::texture_assignments_bitfield_type::const_iterator
- enabled_it = textures_enabled.begin();
- program_t::texture_assignments_type::const_iterator
- prev_it = prev_assignments.begin(),
- it = assignments.begin();
-
- for(program_t::texture_size_type i = 0;i < program_t::texture_assignments_bitfield_type::size;++i,enabled_it.next(textures_enabled),prev_it.next(prev_assignments),it.next(assignments)) {
- ctx -> invalid_texture_assignments.set(enabled_it.test() && (prev_it.value() != it.value()));
+ const program_t & prev_program = program_t::storage().at(prev_program_name);
+
+ {
+ const program_t::attribs_bitfield_type
+ attribs_enabled = prev_program.attribs_enabled;
+ const program_t::attrib_assignments_type
+ prev_assignments = prev_program.attrib_assignments,
+ assignments = program.attrib_assignments;
+
+ program_t::attribs_bitfield_type::const_iterator
+ enabled_it = attribs_enabled.begin();
+ program_t::attrib_assignments_type::const_iterator
+ prev_it = prev_assignments.begin(),
+ it = assignments.begin();
+
+ for(program_t::attrib_size_type i = 0;i < program_t::attribs_bitfield_type::size;++i,enabled_it.next(attribs_enabled),prev_it.next(prev_assignments),it.next(assignments)) {
+ ctx -> invalid_attrib_assignments.set(i,enabled_it.test() && (prev_it.value() != it.value()));
+ }
+ }
+
+ {
+ const program_t::textures_bitfield_type
+ textures_enabled = prev_program.textures_enabled;
+ const program_t::texture_assignments_type
+ prev_assignments = prev_program.texture_assignments,
+ assignments = program.texture_assignments;
+
+ program_t::textures_bitfield_type::const_iterator
+ enabled_it = textures_enabled.begin();
+ program_t::texture_assignments_type::const_iterator
+ prev_it = prev_assignments.begin(),
+ it = assignments.begin();
+
+ for(program_t::texture_size_type i = 0;i < program_t::textures_bitfield_type::size;++i,enabled_it.next(textures_enabled),prev_it.next(prev_assignments),it.next(assignments)) {
+ ctx -> invalid_texture_assignments.set(i,enabled_it.test() && (prev_it.value() != it.value()));
+ }
}
}
else {
+ ctx -> invalid_attrib_assignments = ctx -> program_binding[RSXGL_ACTIVE_PROGRAM].attribs_enabled;
ctx -> invalid_texture_assignments = ctx -> program_binding[RSXGL_ACTIVE_PROGRAM].textures_enabled;
}
}
@@ -1472,7 +1508,7 @@ glGetAttribLocation (GLuint program_name, const GLchar* name)
std::pair< bool, program_t::attrib_size_type > tmp = program.attrib_table().find(program.names(),name);
- RSXGL_NOERROR((tmp.first) ? program.attrib_table_values[tmp.second].second.index : -1);
+ RSXGL_NOERROR((tmp.first) ? program.attrib_table_values[tmp.second].second.location : -1);
}
GLAPI void APIENTRY
@@ -1773,6 +1809,7 @@ rsxgl_program_validate(rsxgl_context_t * ctx,const uint32_t timestamp)
gcm_emit_method_at(buffer,i,NV40TCL_TEX_COORD_CONTROL(j),1);
//gcm_emit_at(buffer,i + 1,(fp_texcoord_mask & 0x1) ? ((1)) : 0);
//gcm_emit_at(buffer,i + 1,(fp_texcoord_mask & 0x1) ? ((1) | (1 << 4)) : 0);
+ //gcm_emit_at(buffer,i + 1,(((uint32_t)1) | ((uint32_t)0 << 4)));
//gcm_emit_at(buffer,i + 1,(((uint32_t)1) | ((uint32_t)1 << 4)));
gcm_emit_at(buffer,i + 1,0);
}
@@ -1793,7 +1830,8 @@ rsxgl_program_validate(rsxgl_context_t * ctx,const uint32_t timestamp)
}
}
}
-
+
+#if 0
// Tell unused attributes to have a size of 0:
{
const bit_set< RSXGL_MAX_VERTEX_ATTRIBS > unused_attribs = ~program.attribs_enabled;
@@ -1818,6 +1856,7 @@ rsxgl_program_validate(rsxgl_context_t * ctx,const uint32_t timestamp)
gcm_finish_n_commands(context,nbuffer);
}
}
+#endif
// Set point sprite behavior:
{
View
12 src/library/program.h
@@ -214,7 +214,7 @@ struct program_t {
// Tables of attributes, uniform variables, and texture maps:
struct attrib_t {
uint8_t type;
- attrib_size_type index;
+ attrib_size_type index, location;
};
struct uniform_t {
@@ -276,13 +276,17 @@ struct program_t {
bit_set< RSXGL_MAX_TEXTURE_COORDS > fp_texcoords, fp_texcoord2D, fp_texcoord3D;
// Vertex attribs that are enabled:
- bit_set< RSXGL_MAX_VERTEX_ATTRIBS > attribs_enabled;
+ typedef smint_array< RSXGL_MAX_VERTEX_ATTRIBS, RSXGL_MAX_VERTEX_ATTRIBS > attrib_assignments_type;
+ typedef bit_set< RSXGL_MAX_VERTEX_ATTRIBS > attribs_bitfield_type;
+
+ attribs_bitfield_type attribs_enabled;
+ attrib_assignments_type attrib_assignments;
// Textures that are enabled:
typedef smint_array< RSXGL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, RSXGL_MAX_COMBINED_TEXTURE_IMAGE_UNITS > texture_assignments_type;
- typedef bit_set< RSXGL_MAX_COMBINED_TEXTURE_IMAGE_UNITS > texture_assignments_bitfield_type;
+ typedef bit_set< RSXGL_MAX_COMBINED_TEXTURE_IMAGE_UNITS > textures_bitfield_type;
- texture_assignments_bitfield_type textures_enabled;
+ textures_bitfield_type textures_enabled;
texture_assignments_type texture_assignments;
// Storage for uniform variable values:
View
5 src/library/rsxgl_context.h
@@ -50,7 +50,7 @@ struct rsxgl_context_t {
uint8_t can_draw:1, can_read:1;
- bit_set< RSXGL_MAX_VERTEX_ATTRIBS > invalid_attribs;
+ program_t::attribs_bitfield_type invalid_attribs;
attribs_t::binding_type attribs_binding;
texture_t::binding_type::size_type active_texture;
@@ -66,7 +66,8 @@ struct rsxgl_context_t {
rsxgl_query_object_index_type any_samples_passed_query;
program_t::binding_type program_binding;
- program_t::texture_assignments_bitfield_type invalid_texture_assignments;
+ program_t::attribs_bitfield_type invalid_attrib_assignments;
+ program_t::textures_bitfield_type invalid_texture_assignments;
// Used by glFinish():
uint32_t ref;
View
38 src/library/textures.cc
@@ -781,6 +781,28 @@ rsxgl_util_format_translate_dma(rsxgl_context_t * ctx,
const struct util_format_description *dst_format_desc = util_format_description(dst_format);
const struct util_format_description *src_format_desc = util_format_description(src_format);
+ util_format_translate(dst_format,dstaddress,dst_stride,dst_x,dst_y,
+ src_format,srcaddress,src_stride,src_x,src_y,
+ width,height);
+
+#if 0
+ const uint8_t * pdstaddress = (const uint8_t *)dstaddress;
+ for(unsigned int j = 0;j < 120;++j) {
+ const uint8_t * ppdstaddress = pdstaddress;
+ for(unsigned int i = 0;i < 160;++i) {
+ rsxgl_debug_printf("(%i,%i,%i,%i)",
+ (unsigned int)ppdstaddress[0],
+ (unsigned int)ppdstaddress[1],
+ (unsigned int)ppdstaddress[2],
+ (unsigned int)ppdstaddress[3]);
+ ppdstaddress += 4;
+ }
+ rsxgl_debug_printf("\n");
+ pdstaddress += dst_stride;
+ }
+#endif
+
+#if 0
if(util_is_format_compatible(src_format_desc, dst_format_desc)) {
const int blocksize = dst_format_desc->block.bits / 8;
const int blockwidth = dst_format_desc->block.width;
@@ -811,6 +833,7 @@ rsxgl_util_format_translate_dma(rsxgl_context_t * ctx,
src_format,srcaddress,src_stride,src_x,src_y,
width,height);
}
+#endif
}
bool
@@ -1729,6 +1752,8 @@ rsxgl_tex_subimage(rsxgl_context_t * ctx,texture_t & texture,GLint _level,GLint
else if(data) {
rsxgl_assert(dstaddress != 0);
+ const texture_t::level_t & level = texture.levels[_level];
+
util_format_translate(pdstformat,dstaddress,dstpitch,x,y,
psrcformat,data,srcpitch,0,0,width,height);
}
@@ -1767,9 +1792,6 @@ rsxgl_copy_tex_image(rsxgl_context_t * ctx,texture_t & texture,uint8_t dims,bool
rsxgl_timestamp_post(ctx,timestamp);
}
- else {
- rsxgl_debug_printf("%s: format failed\n",__PRETTY_FUNCTION__);
- }
}
static inline void
@@ -2124,7 +2146,8 @@ rsxgl_texture_validate(rsxgl_context_t * ctx,texture_t & texture,uint32_t timest
for(texture_t::level_size_type i = 0,n = texture.num_levels;i < n;++i,++plevel) {
if(plevel -> memory) {
#if 0
- rsxgl_debug_printf("\tcopying mipmap level:%u pformat:%u pitch:%u size:%ux%ux%u from:%u pdstformat:%u dstpitch:%u to:%u\n",
+ rsxgl_debug_printf("%lx copying mipmap level:%u pformat:%u pitch:%u size:%ux%ux%u from:%u pdstformat:%u dstpitch:%u to:%u\n",
+ (uint32_t)((uint64_t)&texture),
(unsigned int)i,(unsigned int)plevel -> pformat,(unsigned int)plevel -> pitch,
(unsigned int)std::min(size[0],plevel -> size[0]),(unsigned int)std::min(size[1],plevel -> size[1]),(unsigned int)std::min(size[2],plevel -> size[2]),
(unsigned long)plevel -> memory.offset,
@@ -2198,13 +2221,13 @@ rsxgl_textures_validate(rsxgl_context_t * ctx,program_t & program,uint32_t times
gcm_finish_n_commands(context,4);
}
- const program_t::texture_assignments_bitfield_type
+ const program_t::textures_bitfield_type
textures_enabled = program.textures_enabled,
invalid_texture_assignments = ctx -> invalid_texture_assignments;
const program_t::texture_assignments_type
texture_assignments = program.texture_assignments;
- program_t::texture_assignments_bitfield_type::const_iterator
+ program_t::textures_bitfield_type::const_iterator
enabled_it = textures_enabled.begin(),
invalid_it = invalid_texture_assignments.begin();
program_t::texture_assignments_type::const_iterator
@@ -2338,8 +2361,9 @@ rsxgl_textures_validate(rsxgl_context_t * ctx,program_t & program,uint32_t times
if(texture.memory) {
#if 0
- rsxgl_debug_printf("texture: %u (%u) memory: %u %u pformat: %u format:%x size:%ux%u pitch:%u remap:%x\n",
+ rsxgl_debug_printf("texture: %u (%u) %lx memory: %u %u pformat: %u format:%x size:%ux%u pitch:%u remap:%x\n",
index,api_index,
+ (uint32_t)((uint64_t)&texture),
texture.memory.location,texture.memory.offset,
texture.pformat,
texture.format,
View
4 src/samples/rsxgltest/texcube.cc
@@ -269,8 +269,8 @@ rsxgltest_init(int argc,const char ** argv)
// Set up us the vertex data:
glGenBuffers(2,buffers);
- //glBindBuffer(GL_ARRAY_BUFFER,buffers[0]);
- //glBufferData(GL_ARRAY_BUFFER,sizeof(float) * 6 * 4 * 5,geometry,GL_STATIC_DRAW);
+ glBindBuffer(GL_ARRAY_BUFFER,buffers[0]);
+ glBufferData(GL_ARRAY_BUFFER,sizeof(float) * 6 * 4 * 5,geometry,GL_STATIC_DRAW);
glEnableVertexAttribArray(vertex_location);
glEnableVertexAttribArray(tc_location);

0 comments on commit 4ea86e0

Please sign in to comment.